Re:How to slice your code into continuations
by TeMPOraL on Tuesday May 07, 2019 @04:35AM
(#19847542)
One of the particular insights I gained reading SICP long time ago is that local variables are equivalent to function parameters. That is (using CL syntax):
(let ((a 3)
(b 2))
(some code using a b))
Is equivalent to: (funcall (lambda (a b)
(some code using a b))
3
2)
This is the basis of translating imperative loops into tail recursions.
Re:How to slice your code into continuations
by dreamcompiler on Tuesday May 07, 2019 @09:07AM
(#19848978)
You can go even further by currying the second one and then you're writing a Haskell compiler ;-)
Re:How to slice your code into continuations
by paulddraper on Monday May 06, 2019 @10:39PM
(#19845932)
I remember reading something on building a functional state machine that wound up being the equivalent of imperative programming, registers, etc.
Re:How to slice your code into continuations
by dreamcompiler on Tuesday May 07, 2019 @01:01AM
(#19846733)
Yep, two sides of the same coin. If you can find the reference I'd like to read it.
I think it's mind-bogglingly fascinating because it shines a bright spotlight on the deep connection between imperative and functional computing. If you don't think that's interesting, you're probably not somebody I would want to work for.