Re:Retro: A Modern, Pragmatic Forth
by RodgerTheGreat on Thursday May 23, 2019 @10:06PM
(#19997873)
As someone who has written a considerable amount of Forth as a hobbyist, studied APL, and been paid to write K, it's fascinating to me how aesthetically similar the Forth and APL communities are, despite their languages approaching minimalism from completely different sides of the spectrum. I definitely credit learning to read Forth as helping to open my mind to the unconventionality of APLs. Spend enough time out there on the edge and you don't get as hung up on whether syntax resembles C or is "unreadable".
Forth and APLs both have a really strong data flow aesthetic.
Re:Retro: A Modern, Pragmatic Forth
by RodgerTheGreat on Thursday May 23, 2019 @10:52PM
(#19998070)
Exactly! They're both concatenative languages, or at least languages which have a concatenative subset. Juxtaposition is composition.
APL/K and Forth also have very concise syntax for declaring functions.
// JS
const foo = (x,y) => 1 + x * y
// K, lambda with implicit arguments
foo: {1+x*y}
// K, points-free
foo: 1+*
// Forth
: foo * 1+ ;
It's subtle, but I think making function declarations "lightweight" in this manner is important for encouraging factoring. In APLs the scale of the semantic units you give names to is a little different, but that's its own separate discussion.
Re:Retro: A Modern, Pragmatic Forth
by fiddlerwoaroof on Thursday May 23, 2019 @11:45PM
(#19998293)
It would be interesting to have a forth where, if you try to pop from an empty stack, you get a function object that consumes the next things pushed onto the stack (i.e. functions are curried)
Re:Retro: A Modern, Pragmatic Forth
by new4thaccount on Thursday May 23, 2019 @10:30PM
(#19997974)
Interesting points. Thanks for pointing this out.
I'm nowhere near your level of comprehension in either language, but agree that spending some time outside of curly brace land gets you more comfortable with other languages.
we are quite similar except I am paid to write q. In fact, I am writing a forth in q now.
> I am writing a forth in q now.
For some practical reason or just as an exercise?
Forth is unique as it is probably the only serious language that you can write production systems in and understand the entire compiler/interpreter, parsers, data structures, and functions (called words).
Everything is pretty simple. You could use C as the base, but traditionally you would write a few dozen assembly routines and link them together and form some core words to manage a stack (there are 2 stacks and that is it) and make more complex words.
It gets a lot more deep, but Forths aren't really for me. If I'm going to use something weird, I'll write some APL.