This is an idea that I got from studying category theory.
Concatenative programming is just a first step in that direction.
I leave the details an an exercise for the reader.
This is an idea that I got from studying category theory.
Concatenative programming is just a first step in that direction.
I leave the details an an exercise for the reader.
https://dspace.mit.edu/handle/1721.1/5753
The point is there's a closer connection between functions and gotos than you might imagine.
This is roughly the point Steele is making, in addition to his point that the stack pointer side effects are often unnecessary (i.e. tail jumps).
Implementing a stack pointer in hardware is merely a legacy hack: Before people figured out continuations they didn't know any better.
That's like saying "There's really no such thing as a 'chair' at the quantum level."
One of the problems of the purely applicative approach is that you get a nice algebra for describing your results, including the sequence of effects, but reasoning about the resources spent by the computation becomes harder.
I might argue that laziness makes haskell something different than purely applicative.
It's not just pure values being passed around. It's a language built atop suspended self-caching invocable thunks getting knotted up and then firing off in chain reaction.
main = do
let
hello = foo world
world = bar hello
putStrLn $ show hello
putStrLn $ show world
where
foo v = [v]
bar v = length v