←back to thread

366 points nils-m-holm | 1 comments | | HN request time: 0.21s | source
Show context
C-x_C-f ◴[] No.45071000[source]
I love Lisp (I'm an Emacs user and often write in Racket for personal projects) but the one thing I never understood about the Lisp community is the emphasis placed on metacircular evaluators.

I sure find them beautiful and all, but why do they take center stage so often? Beside the aesthetics and instructional value, I don't get the appeal. Also I feel that a bunch of the heavy lifting behind metacircular evaluators is actually done by the Polish notation syntax as well as the actual implementation, and these concepts don't get nearly as much love.

Any Lisper who can illuminate me?

replies(2): >>45071038 #>>45071439 #
rootnod3 ◴[] No.45071439[source]
The metacircular evaluator shows how code is data and data is code.

And in a way it’s like Maxwell’s equations. A simple proof of computation that also somehow implements a very neat language.

replies(1): >>45073760 #
Y_Y ◴[] No.45073760[source]
But of course you must close the loop by representing Maxwell's equations electromagnetically.

I know this is a classic analogy, but now you've got me wondering, originally Maxwell wrote a messy pile of equations of scalrs, later someone (Gibbs?) gave them the familiar vector calculus form. Nowadays we have marvellously general and terse form, like (using the differential of the Hodge dual in naturalised units),

  d star(F) = J
My question is, when are we going to get some super-compact unified representation of `eval`?
replies(3): >>45074604 #>>45075030 #>>45075645 #
1. tromp ◴[] No.45075645[source]
It's hard to get a super compact eval for LISP with its many primitives. It's somewhat easier for the lambda calculus which inspired LISP, with obnly the 3 primitives of variable, abstraction, and application. In the binary lambda calculus this allows for a self-interpreter

    (λ 1 1) (λ λ λ 1 (λ λ λ λ 3 (λ 5 (3 (λ 2 (3 (λ λ 3 (λ 1 2 3))) (4 (λ 4
    (λ 3 1 (2 1)))))) (1 (2 (λ 1 2)) (λ 4 (λ 4 (λ 2 (1 4))) 5)))) (3 3) 2)
that tokenizes and parses a closed lambda term from a raw binary input stream and passes the term and the remainder stream to a given continuation [1].

[1] https://tromp.github.io/cl/cl.html