@amszmidt Remove that ‘a’ and then it’s fine. There’s neither a Forth, nor a Lisp. Both language families, I suppose, have similar ideals, but executed in extremely different manner. I can not exactly recall who put it this way, but I’ll borrow a part of their words and sentiment in the following: Forths are Lisps with empathy towards the machine, and Lisps are Forths with respect towards the theory. This is why I think the families of languages are used in different domains and rarely interact with each other; like two independent civilizations (“ecosystems”) with little trade or travel between them.
@smlckz A nice philosophical take. Have a CONS cell. I disagree that Lisp is towards theory, Lisp is very close to the machine -- I'd argue, closer than Forth!
@amszmidt@crc I think there are some serious and interesting points to be made. What is Lisp? What is Forth?
For the former, probably something about cons cells, atoms, functions, and S-expressions. I'd like this to include Scheme but exclude Dylan. But there's an angle where Scheme is kind of like the Esperanto of Lisp; it wants to make a clean break, so in this sense it's not part of the continuous Lisp lineage.
@amszmidt@crc As for Forth, two stacks, dictionary (another stack if you will), a handful of primitives, syntax made of tokens separated by whitespace.
The exact names of these functions are not important but their semantics are. I'm not now familiar with FORTH (I last used it more than 40 years ago), but...
1. there is no COND (there is IF...ELSE...THEN but this is much less powerful); 2. EXECUTE is roughly equivalent to EVAL but I *think* there is no separate APPLY; 3. There's no built in CAR, CDR, CONS but they are trivial to implement; 4. There's sort-of EQ (you can compare pointers) but it does not seem to be idiomatically used; 5. A reader is implicit in INTERPRET but I'm not sure that it's explicit.
@simon_brooke So ... they are equivalent. 🙂 Specially in Forth, they are as readable as COND.
: EGGSIZE ( n -- ) DUP 18 < IF ." reject " ELSE DUP 21 < IF ." small " ELSE DUP 24 < IF ." medium " ELSE DUP 27 < IF ." large " ELSE DUP 30 < IF ." extra large " ELSE ." error " THEN THEN THEN THEN THEN DROP ;
@amszmidt no, seriously, they're not. You can build the logical equivalent of a COND expression with an unwieldy and unmanageable tree of IF... ELSE... THEN expressions, but the COND form is much more compact and readable.