Scheme beginner here. I've just read SICP which in the end doesn't teach much about Scheme itself.
I was baffled with the meta-circular evaluator so I'm beginning to read _Lisp in Small Pieces_ by Christian Queinnec.
I found this in a footnote in the first pages. I thought it was interesting and I'm sharing it here.
(let ((x π₁)) π₂) ≡ ((lambda (x) π₂) π₁)
As an example, an expression like
(let ((a 3) (b 4)) (+ a b)) would expand to
((lambda (a b) (+ a b)) 3 4)
So, the macro for the basic
let is simply
(define-syntax let (syntax-rules () ((let ((var val) ...) body ...) ((lambda (var ...) body ...) val ...))))
Another example is the special form
begin which is equivalent to this function application:
(begin α β) ≡ ((lambda (void) β) α)
void must not be a free variable in β but this can be guaranteed by using
You would have gotten more out of SICP if you had paid attention while reading it.
The way this happens is that the let expression is interpreted as an alternate syntax for
((lambda (<var1> ...<varn>) <body>) <exp1> <expn>)
No new mechanism is required in the interpreter in order to provide local variables. A let expression is simply syntactic sugar for the underlying lambda application.
Damn, everything that needs to be said has already been said in SICP. Did I forget that part or skimmed that brand new knowledge in the first chapter too fast? Either way, you're right, I should have paid more attention.
Who cares if a language is dead or not? You shouldn't learn scheme because you want to work with the language professionally (in fact that might even make it *less* fun to work with), but because you want to learn more about programming and computational thought on a more fundamental level.