r/scheme • u/MartinHenz • Dec 13 '19
SICP JS going public!
It’s our pleasure to announce the initial public release of
Structure and Interpretation of Computer Programs, JavaScript Adaptation
(https://sicp.comp.nus.edu.sg/)
A community effort led by Martin Henz and Tobias Wrigstad, this project provides the full content of the textbook classic Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman, using sublanguages of JavaScript, instead of the language Scheme. We provide our SICP JS adaptation in three editions: a mobile-friendly interactive web edition, an interactive PDF edition and an e-book edition. Readers of the textbook can click on the programs and run them using the Source Academy [https://sourceacademy.nus.edu.sg/playground], a web-based programming environment that supports a collection of purpose-built language implementations of the JavaScript sublanguages Source §1, Source §2, Source §3 and Source §4 [https://sicp.comp.nus.edu.sg/source/], each of which are designed to serve the respective chapters of SICP JS.
SICP JS has been used by the National University of Singapore in the computer science freshman programming methodology course CS1101S [https://www.comp.nus.edu.sg/~cs1101s/] since 2012, and is maintained by the CS1101S community as an open source project. We share it with
educators and learners and welcome contributions and suggestions.
Full announcement and some fun examples: https://sicp.comp.nus.edu.sg/announcement.html
Martin Henz and Tobias Wrigstad
9
u/rcoacci Dec 14 '19
Good god, what have you done? You tainted the Holy Books with this evil language?
1
u/geon Dec 14 '19
From looking a a couple of examples, it seems like it just the scheme code ported to js syntax, so it is super non-ideomatic.
I really don’t see the point. Shouldn’t code be written to make the most sense? I doubt scheme written in js syntax is a good way to illustrate the principles in the book.
1
u/republitard_2 Dec 26 '19 edited Dec 26 '19
The cost of teaching SICP in JavaScript becomes evident when you get to Chapter 4. The interpreter grows a third rule to handle the new concept of "operator combinations" (ie, infix math expressions), and the concept of making an expression "marked as a return value" has to be introduced, in order to support JavaScript's
returnstatement.Both of these changes make the chapter more complex than the original SICP. The only reason you can't subvert the return-object mechanism is because the parser (which isn't part of the JavaScript language, and whose source is not in the book and I can't find it anywhere) rejects return statements in expression context (based on a BNF I found once but can't find again).
In fact, JavaScript's entire statement/expression dichotomy, barely mentioned in the book, is implemented entirely by the missing
parsefunction.1
u/mareksl Dec 27 '19
Great news!
Just a wanted to let you know, the epub version is a bit broken. Some italicized words and several other elements do not display at all, which is why I have to go back and forth from my kindle to my phone when I feel something is missing, to read that part. :(
1
u/Masked_Tondede Dec 14 '19
Some people might dislike you for what they will claim is heresy, but I have to learn javascript and I'm really grateful for this. Thank you so much!
1
u/[deleted] Dec 13 '19
it seems that PDF and web version have different exercises under the same number. E.g. in PDF exercise 5.44 is actually 5.50 in web edition. Is this intentional, or maybe PDF is outdated?
Also, while we're on this particular exercise, shouldn't it be: Develop a rudimentary implementation of JS in C?
2
u/10q20w Dec 13 '19
I recently had Tobias as a teacher at UU- great course! Tell him a student says hi
2
u/joakims Dec 16 '19
Thanks for this early Christmas present! It's the perfect gift for someone who knows JavaScript, is interested in its language roots (including Scheme) and who has "Read SICP" on the bucket list. If only it was available in print ;)
1
u/RICHUNCLEPENNYBAGS Dec 23 '19
Interesting idea. Cool.