7 ms·
Both forth and lisp seem similar to me. They have a "three sentences to explain how everything works" vibe. Forth uses a stack and so "reverses" the order of th
by JohnDeHope 4y ago
Both forth and lisp seem similar to me. They have a "three sentences to explain how everything works" vibe. Forth uses a stack and so "reverses" the order of things. Lisp uses trees and so "indents" everything. I wonder if there is some kind of underlying rule. If you want "one syntax to rule them all" then it has to be recursive and so there's only a few options: stack, tree, etc. Hmm well recursive isn't the right term here. Maybe somebody who actually has thought about this can correct me.
- deleted 4y ago[deleted]
- LudwigNagasena 4y agoWell, recursion is one of the primitives that allows construction of all computable functions: https://en.wikipedia.org/wiki/General_recursive_function https://en.wikipedia.org/wiki/General_recursive_function
- jerf 4y agoI think the combination of "simple universal syntax" and "utility to human brains to write programs" is indeed probably a relatively small space. This is in contrast to simply having a "simple universal syntax", and I don't know how many solutions that may have in the abstract sense. There are many cellular automata that from a certain point of view have "simple syntax" (at least in the sense of a limited number of symbols and super limited number of ways to put them together) and have universal computation powers, but are not useful in the slightest for human programming. (Not the most common Turing tarpit to get caught in, but this has snared a number of people over the years trying to turn cellular automata into programming languages.) Who knows what other exotic possibilities may lie out there in math space where no human mind has yet even peered. I think there's probably a lot of other things that are mathematically universal computers, but like cellular automata are just too unstable (in the mathematical sense, all small changes to program produce huge changes to output; we humans prefer languages that have that characteristic only in controlled and limited ways) for humans to program. And dropping the other criterion of "simple universal syntax" of course reveals a rich space of possibilities, notably including every other programming language that isn't Lisp/Forth/Haskell-esque in theoretically being one of the simple universal syntaxes lifted up to being a programming language. (Haskell is one of the other ones, BTW, being "lambda calculus" reasonably translated to a programming language. It isn't purely so but generally neither is a Lisp.)
- samatman 4y agoIt's not an accident! Chuck Moore was a student of John McCarthy before joining the industry. Forth was created when Chunk applied his knowledge of Lisp to the problem of maintaining a personal library of punched cards which were reusable on whatever weird computer he needed to run them on next.
- carapace 4y agoIs that... do you have a reference for that? (Not challenging, just seeking more knowledge.)
- samatman 4y agoHere you go: http://www.forth.org/POL.pdf http://www.forth.org/POL.pdf Great read, highly recommended. I'd go on but this is my second drop of POL in this thread.
- carapace 4y agoCheers! A book about Forth, by Chuck Moore, that I haven't read already! Today is a good day. (Someone has posted it and it's reached the front page now: https://news.ycombinator.com/item?id=33180796 https://news.ycombinator.com/item?id=33180796 )
- arethuza 4y agoA long time ago I was writing PostScript, C and Common Lisp on the same project - PostScript and Common Lisp definitely have a lot in common.
- carapace 4y agoI've been playing with a language called Joy, created by Manfred von Thun, which seems to me to combine the best parts of Forth and Lisp while being simpler and more elegant than both. I suspect it might be the simplest useful language. "A Conversation with Manfred von Thun" in Vector, journal of the British APL Association http://archive.vector.org.uk/art10000350 http://archive.vector.org.uk/art10000350 https://hypercubed.github.io/joy/joy.html https://hypercubed.github.io/joy/joy.html Kevin Albrecht’s mirror of Manfred von Thun’s original website for the Joy Programming Language http://www.kevinalbrecht.com/code/joy-mirror/index.html http://www.kevinalbrecht.com/code/joy-mirror/index.html https://joypy.osdn.io/ https://joypy.osdn.io/ (My own project) Here's a flowchart (SVG) for the interpreter loop: https://github.com/calroc/Thun/blob/simpler/joy_interpreter_flowchart.svg https://github.com/calroc/Thun/blob/simpler/joy_interpreter_... It boils down to quotation as the primary operation, denoted by enclosing expressions in square brackets. Various combinators accept quotes on the stack and prepend (or not) one or more of them to the pending expression under evaluation (like Continuation-Passing Style), and that's it. That's the whole evaluation model. E.g. "branch" combinator accepts a Boolean value and two quoted expressions and put one of them onto the pending expression based on the Boolean value: true [ELSE] [THEN] branch ------------------------------- THEN false [ELSE] [THEN] branch -------------------------------- ELSE Anyway, I've been messing around with it for a few years now off-and-on and I really think it's "something", eh? (Like I'm almost willing to argue that it's status should be something like the other major models of computation: Turing Machine, Lambda Calculus, SKI Combinators, (Others? Wang Tiles?) ... I suspect Joy belongs on that list.)
- lioeters 4y agoThis is a nice page comparing Forth and Joy. Synopsis of the language Joy - https://hypercubed.github.io/joy/html/forth-joy.html https://hypercubed.github.io/joy/html/forth-joy.html Indeed, it has a beautiful simplicity like Lisp, expressing any computation with a small number of core concepts.
- dublin 4y agoTcl is kinda the same in that regard, hence some expanding that acronym as "try coding less". It's hard to make a powerful language that offers more power in such a small amount of simple, understandable code than these. (Though I have a hard time wrapping my head around Lisp, I find Tcl (and Lua, for a more modern incarnation of the idea) to be dead simple and intuitive, with awesome leverage in capability per LOC.)
- ravi-delia 4y agoYou have a hard time with Lisp, but find Tcl intuitive? I'm not judging, just scared and impressed. It's like when my friend told me she found differentiation tricky but integration easy. Objectively that's more impressive, but how?
- retrac 4y agoI think the term you are looking for is "homoiconicity" [1]. There's a trivial 1-to-1 map between the semantic elements the program operates on (Lisp lists of atoms/lists, or Forth arrays of words) and the code. https://en.wikipedia.org/wiki/Homoiconicity https://en.wikipedia.org/wiki/Homoiconicity