Re:Why Concatenative Programming Matters (2012)
by remexre on Monday November 30, 2020 @09:55PM
(#25261763)
I've been trying to write a bunch of Forth, and I've gotta say stack comments (essentially type signatures, though typically not checked) are invaluable; that, and making definitions small enough that you can verify that they're obviously correct within a few seconds. (Typically, most definitions are one-liners.)
Re:Why Concatenative Programming Matters (2012)
by h3rald on Tuesday December 01, 2020 @02:54PM
(#25269110)
Having created a small concatenative language myself[1], no, the pure concatenative style with no variables and stack combinators is just too much for a normally-wired brain.
BUT! I tried to cheat a little bit to make things more readable. Take this example from the min front page, which showcases its concatenative style:
. ls-r
(mtime now 3600 - >)
filter
Can you guess what it does? You might, but what about this: . ls-r :files
((mtime > (now - 3600)) ><) =changed-in-last-hour
@files #changed-in-last-hour filter
Now ok, I went insane with sigils and weird operators but:
- creating variables helps
- using infix notation via the infix-dequote (><) operator makes expressions much more readableWhy would I use this rather than a traditional language? It helps reasoning in terms of point-free function composition and in some case it is faster to work with, i.e. processing rules, pipelines, task sequences etc.
Re:Why Concatenative Programming Matters (2012)
by throwaway_pdp09 on Tuesday December 01, 2020 @04:43AM
(#25263836)
> Sick article
A little red-faced here but I don't know if you're saying it's good or bad (suspect former but not sure). Matters as upon it depends whether I read the article or not, so... help me out? :)
Re:Why Concatenative Programming Matters (2012)
by jim-jim-jim on Tuesday December 01, 2020 @04:54AM
(#25263888)
Sick = good
1. The focus on verbs can make things clearer.
2. Under ideal circumstances, it's no more complex than Unix pipes.
But I'm still not 100% convinced it makes for more readable code. Sometimes I still need variable names for documentation purposes. This isn't so bad in Haskell, since the type signature can make the intention known, but something like J...