3 ms·
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):
by TeMPOraL 8y ago
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.
- dreamcompiler 8y agoYou can go even further by currying the second one and then you're writing a Haskell compiler ;-)