6 ms·
Pleasantly surprised to see this on HN! This is an old (and incomplete) project of mine to reformat Structure and Interpretation of Computer Programs into a bro
by schemescape 3y ago
Pleasantly surprised to see this on HN! This is an old (and incomplete) project of mine to reformat Structure and Interpretation of Computer Programs into a browser-friendly format, with a built-in code editor and interpreter [1].
I think today, you can use Racket in its special SICP mode to get a much better experience. But maybe the HTML (Bootstrap) formatting is a little nicer to read (and with the bonus that it probably works on phones).
The interpreter was incomplete and written from scratch, as a learning project [2]. This was done in the pre-WebAssembly days, so I couldn't just recompile, say, a Scheme written in C for use in the browser.
If I recall correctly, I took the SICP source files, ran a bunch of regular expressions on them to convert the content into XML [3], and then used XSLT to generate the web pages [1]. I was really into XSLT at the time :)
Anyway, hope people find this useful! It's outdated and incomplete, and the interpreter has an odd implementation, but it was a fun project.
Source code links:
[1] HTML generator: https://github.com/jaredkrinke/learn-scheme https://github.com/jaredkrinke/learn-scheme
[2] Interpreter: https://github.com/jaredkrinke/jslisp https://github.com/jaredkrinke/jslisp
[3] SICP-to-XML converter: https://github.com/jaredkrinke/sicp-reformatter https://github.com/jaredkrinke/sicp-reformatter
- Zambyte 3y ago> This was done in the pre-WebAssembly days, so I couldn't just recompile, say, a Scheme written in C for use in the browser. If this is a direction you (or anyone else!) would like to explore, GNU Guile has been having work done to port it to WebAssembly under the Hoot project[0]. [0] https://gitlab.com/spritely/guile-hoot https://gitlab.com/spritely/guile-hoot
- sitkack 3y agoA cool hack was presented at the 13th Racket Con yesterday, showing how to run PB (the Chez Scheme bytecode interpreter) on Wasm. Racket with Wasm-PB Chunk, https://github.com/adamperlin/racket https://github.com/adamperlin/racket Videos should be posted here shortly, https://www.youtube.com/@racketlang/videos https://www.youtube.com/@racketlang/videos https://con.racket-lang.org/ https://con.racket-lang.org/
- kreelman 3y agoNeat, thanks.
- bitwize 3y agoThe JS backend for Gambit is also out of beta and a documented, stable feature now as well.
- Zambyte 3y agoSweet, I'll have to give that a go :) Another option in browser land is lips[0], which exclusively targets a js backend. [0] https://lips.js.org https://lips.js.org
- josh-sematic 3y agoYeah, I went through it this weekend because I was curious about Scheme, and was surprised when it ended so suddenly! It was a good read though. Any more advanced free online Scheme tutorials you can recommend? I’d like to get to continuations, lazy evaluations, macros etc..
- Jtsummers 3y agoThe linked site's text comes from this source material: https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/index.html https://mitp-content-server.mit.edu/books/content/sectbyfn/b... So you can continue to explore the rest of the book for free (without the aid of the built-in interactive interpreter). Check out Racket and its included support for the particular Scheme used by SICP: https://docs.racket-lang.org/sicp-manual/ https://docs.racket-lang.org/sicp-manual/
- schemescape 3y agoI switched over to Common Lisp, so I don't really have any personal recommendations for Scheme, but this site was useful for learning CL and it also has a section on Scheme: https://www.linuxlinks.com/excellent-free-books-learn-scheme/ https://www.linuxlinks.com/excellent-free-books-learn-scheme...
- segh 3y agoHere is another online SICP with built in interpreter. http://xuanji.appspot.com/isicp/ http://xuanji.appspot.com/isicp/
- schemescape 3y agoThat one seems better! Edit: wow, it even predates my attempt: https://news.ycombinator.com/item?id=4860370 https://news.ycombinator.com/item?id=4860370
- easytiger 3y agoThere are verbatim copies of SICP content in here. Is that legal?
- deleted 3y ago[deleted]
- reikonomusha 3y ago> Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License by the MIT Press. from https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/index.html https://mitp-content-server.mit.edu/books/content/sectbyfn/b...
- easytiger 3y agofair enough, didn't realise. Got multiple paper copies didn't know they CCd it
- schemescape 3y agoYes, and I even confirmed it with MIT Press prior to publishing the project (many years ago): https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/index.html https://mitp-content-server.mit.edu/books/content/sectbyfn/b... > Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License by the MIT Press.
- DonHopkins 3y ago>I was really into XSLT at the time :) We all have embarasing skeletons in our closets, and that's one of mine, too. https://news.ycombinator.com/item?id=33728303 https://news.ycombinator.com/item?id=33728303 >My impression of XSLT is that there were representatives from every different programming language paradigm on the XSLT standard committee, and each one of them was able to get just enough of what was special about their own paradigm into the standard to showcase it while sabotaging the others and making them all look foolish, but not enough to actually get any work done or lord forbid synergistically dovetail together into a unified whole. >The only way I was ever able to get anything done with XLST was to use Microsoft's script extensions to drop down into JavaScript and just solve the problem with a few lines of code. And that begs the question of why am I not just solving this problem with a few lines of JavaScript code instead of inviting XSLT to the party?
- schemescape 3y agoI can’t decide if I liked XSLT or just the out-of-the-box thinking its convoluted solutions demanded. XPath was a joy to use, and I thought XHTML made more sense than HTML. But I was naive to think the “more logical” technology would take over!
- jrumbut 3y agoThere is a unique satisfaction to solving a problem with XSLT. That said, it's a lot like that old joke about regular expressions, "now you have two problems."
- pjmlp 3y agoI am on the same boat. In fact, our own take on AOLServer used xml namespaces for our widget libraries, but alas we got HTML 5 instead, and Web Components are still not widely adopted.
- shortrounddev2 3y agoDid you know SICP is in Javascript now?
- mark_l_watson 3y agoStill a nice interactive web site!! I did something similar when applets were added to Java 1.0 beta, so many years ago. I had an AI tutorial powered by applets. You mentioned Racket. Were you at Racket Con this weekend? I attended remotely, and really enjoyed it. Pardon the self-promotion, but speaking of Scheme/Racket you can read my newly released (last Friday) book "Practical Artificial Intelligence Development With Racket - Using Racket Scheme for implementing many short AI examples including LLMs, vector datastore, NLP, semantic web and non-AI utilities" for free online. [1] [1] https://leanpub.com/racket-ai/read https://leanpub.com/racket-ai/read EDIT: my book is only 80% done. Example programs: https://github.com/mark-watson/Racket-AI-book-code https://github.com/mark-watson/Racket-AI-book-code
- jmye 3y agoThis is brilliant. Scheme broke me back in school- I could not get my head around it. I’ve thought about trying it again now that I’ve got a better understanding of what my professors were trying to actually teach with it. And here you are with the exact book I’d forgotten the name of!
- mvc 3y ago> I was really into XSLT at the time XSLT was my first Lisp ;-)