3 ms·
> thinking about sequences of assignments as chains of function applications can be illuminating I think it's mind-bogglingly fascinating because it shines a b
by dreamcompiler 8y ago
> thinking about sequences of assignments as chains of function applications can be illuminating
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.
- paulddraper 8y agoI remember reading something on building a functional state machine that wound up being the equivalent of imperative programming, registers, etc.
- dreamcompiler 8y agoYep, two sides of the same coin. If you can find the reference I'd like to read it.
- TeMPOraL 8y agoOne 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 ;-)