[ prog / sol / mona ]

prog


let is just a macro for a function application

1 2020-02-11 03:03

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 ...))))

Everything about this language is so simple and nice. Tell me Scheme is not dead and there's a future for it. I can't help reading about it but I have this awful feeling that I'm wasting my time because it's absolutely useless in the real world and that I should learn Javascript instead.

6


VIP:

do not edit these