by perihelions · 4y ago · 0 comments
https://sicp.sourceacademy.org/ (JS version)
https://mitpress.mit.edu/sites/default/files/sicp/index.html (1984 classic)
The in-line editor is a bit intrusive (fills up most of my screen, unlike say eloquentjavascript.net) but it's still pretty neat to have run-able examples. Kudos to the creators.
A ton of work seems to have gone into this -- they have a meta-circular evaluator in JavaScript (and it's not that much longer than the original Scheme)!
list("sequence",
list(list("constant_declaration",
list("name", "size"), list("literal", 2)),
list("binary_operator_combination", "*",
list("literal", 5), list("name", "size"))))
https://sourceacademy.org/sicpjs/4.1.2 ("4.1.2 Metalinguistic Abstraction / Representing Components")This isn't an ideal language for doing this stuff. The Scheme version is completely transparent about what you're doing; whereas this kind of language makes you work through a thick veil of abstractions.
(This line doesn't occur in the Scheme version, but the analog would be (quote (let ((size 2)) (* size 5))). Which would you rather debug?)
With the scheme version, you have straight-up trees to work with.
With the Javascript version, you have to learn all about parsing rules and gotchas and then you STILL wind up with trees for everything.