7 ms·
(learn 'scheme)
- gus_massa 3y agoIt's nice that the site can run the examples. Did you wrote the interpreter?
- schemescape 3y agoPleasantly 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 ;-)
- DonHopkins 3y agoHere's Kent Pittman's :TEACH;LISP from ITS, which is a MACLISP program that teaches you how to program in MACLISP. (That's "Man And Computer Lisp" from "Project MAC", not "Macintosh Lisp".) https://github.com/PDP-10/its/tree/master/src/teach https://github.com/PDP-10/its/tree/master/src/teach https://en.wikipedia.org/wiki/Incompatible_Timesharing_System https://en.wikipedia.org/wiki/Incompatible_Timesharing_Syste... https://en.wikipedia.org/wiki/Maclisp https://en.wikipedia.org/wiki/Maclisp https://en.wikipedia.org/wiki/MIT_Computer_Science_and_Artificial_Intelligence_Laboratory#Project_MAC https://en.wikipedia.org/wiki/MIT_Computer_Science_and_Artif... Scheme or Lisp? Kent M Pitman explains the deep philosophical differences: https://www.reddit.com/r/programming/comments/6fa5r/scheme_or_lisp_kent_m_pitman_explains_the_deep/ https://www.reddit.com/r/programming/comments/6fa5r/scheme_o... https://groups.google.com/g/comp.lang.lisp/c/TEk4O4-zsA8/m/HLonoeiFG4cJ https://groups.google.com/g/comp.lang.lisp/c/TEk4O4-zsA8/m/H... >You should definitely learn both if you can afford the time. They are not redundant with one another, in spite of their superficial syntactic similarity. >Others divide up this space differently than I, but for most purposes, I personally regard them as distinct langauges, not mere dialectal variations, although plainly they are from what I would call the same language family. >You will probably prefer to use one or the other in the end, but they each have things to teach you. Even if you prefer to use neither, you will use the things you learn from these languages in your future thinking, becuase they will give you metaphors for thinking about things that other languages do not. This is like catnip for people interested in the sociological and cultural aspects of programming language design: Common Lisp: The Untold Story; Kent M. Pitman, HyperMeta Inc. https://www.nhplace.com/kent/Papers/cl-untold-story.html https://www.nhplace.com/kent/Papers/cl-untold-story.html Here's a description of :TEACH;LISP that I posted to reddit 11 years ago: https://www.reddit.com/r/programming/comments/t4rre/comment/c4k02ug/?utm_source=reddit&utm_medium=web2x&context=3 https://www.reddit.com/r/programming/comments/t4rre/comment/... >xardox 11 yr. ago >Kent Pitman's a great guy who's done a lot of pioneering work to teach people Lisp. >KMP wrote a Lisp program to teach MACLISP on the MIT AI Lab's ITS systems called ":TEACH;LISP", which I used to learn Lisp (but which Jerry Pournelle cited in a not-friendly light). >KMP kindly took the time to personally teach me some LISP, by challenging me to a dual! We both ran our own LISP processes, and loaded a function called EVAL-IN-OTHER-LISP that used "core link interrupts" to send s-expressions from one LISP to another, so we could evaluate code in each other's LISP. That made it easy for him to define and call functions in my LISP, which was quite fun, but then he set my numeric output base to roman numerals! He won that dual. Core Link Interrupts (ITS's interprocess communication mechanism, sending messages through actual core memory on a PDP-10): https://web.archive.org/web/20110904184550/http://www.avanthar.com/~healyzh/sysdoc/clo.100 https://web.archive.org/web/20110904184550/http://www.avanth... How Jerry Pournelle got kicked off the ARPANET: http://www.art.net/~hopkins/Don/text/pourne-smut.html http://www.art.net/~hopkins/Don/text/pourne-smut.html >From: Kent M Pitman <KMP at SCRC-STONY-BROOK.ARPA> >Subject: Pourne >Personally, I'd just turn off his account. It's not like it's the first time, and he not only flaunts his use of our machines but stabs us in the back with grumblings about why he doesn't like this or that program of ours when he gets a chance. (Am thinking particularly of an article he wrote which condemned Lisp for reasons amounting to little more than his ignorance, but which cited Teach-Lisp in a not-friendly light... The man has learned nothing from his presence on MC and sets a bad example of what people might potentially accomplish there. I'd rather recycle his account for some bright 12-yr-old...) Here's the source code to EVAL-IN-OTHER-LISP: https://www.maclisp.info/pitmanual/system.html https://www.maclisp.info/pitmanual/system.html The following is some sample code (complete with documentation) that I found in my notes and thought might be helpful: ;;; Notes about CLI interrupts: ;;; ;;; A CLI interrupt is what happens when another job sends to yours. It is ;;; normally the case that other jobs will send directly to a user's HACTRN. ;;; If, however, Lisp is interrupted by a CLI message, it can elect to handle ;;; handle the interrupt in an arbitrary way. ;;; ;;; To define a handler, two things must be done: ;;; [1] Place the name of the handler function (function of one arg) ;;; in the variable CLI-MESSAGE. ;;; [2] Enable CLI handling with (SSTATUS CLI T) ;;; ;;; The handler should take a single argument which it probably should ignore ;;; since I have no idea what it is likely to be. ;;; ;;; The handler should open the file "CLA:" in (CLA BLOCK) mode and immediately ;;; discard the first 8 characters which will be garbage. ;;; ;;; The remainder of the stream, until a control-C or an eof, will be the text ;;; of the message sent. It may be read with TYI, READ, etc. and handled ;;; however. (eval-when (eval compile) (cond ((not (get 'iota 'version)) (load "liblsp;iota")))) (defun handle-cli-msg (ignore) (iota ((stream '((cla)) '(cla block))) (do ((i 0 (1+ i))) ((= i 8)) (tyi stream)) (do ((c (tyi stream -1) (tyi stream -1))) ((or (= c -1) (= c 3))) (format t "~&~3,'0O ~@:C~%" c c)))) ;print out chars seen (setq cli-message 'handle-cli-msg) (sstatus cli t) ; -------- (defun eval-cli-msg (ignore) ;alternate handler (iota ((stream '((cla)) '(block cla))) (do ((i 0 (1+ i))) ((= i 8)) (tyi stream)) (do ((f (read stream nil) (read stream nil))) ((null f)) (errset (eval f) nil)))) ;Quietly evaluate forms... ;; Assumes the other lisp will have EVAL-CLI-MSG as value of CLI-MESSAGE (defun eval-in-other-lisp (uname jname s-expression) (iota ((stream `((cli) ,uname ,jname) '(out ascii block))) (print s-expression stream)))
- chunsj 3y agoThe only thing I miss is that the editor does not support structured editing. Lisp needs one, period.
- ForgedEngine 3y agoEmbedded languages are the probably the biggest advantage of LISP (https://youtu.be/PEwZL3H2oKg?t=3370 https://youtu.be/PEwZL3H2oKg?t=3370). Could LISP-embedded languages be the key to unlocking the full potential of LLMs?
- vario 3y agoNoob here. What was the justification of SICP using Scheme as vehicle of instruction? I feel the book is intellectually dishonest.
- JonChesterfield 3y agoThe lambda calculus is a big thing in computer science.
- vario 3y agoSICP authors were not the originators of Lambda Calc. Even a noob like me knows that!
- Jtsummers 3y agoWhat's intellectually dishonest about it?
- vario 3y agoBased on: WOOD, A. (2001). Structure and Interpretation of Computer Programs, 2nd Ed by Abelson and Sussman, with Sussman, MIT Press, 1996, ISBN 0-262-51087-1, 657pp. Journal of Functional Programming, 11(2), 253–262. doi:10.1017/s0956796801223983: "The new material on concurrency is rather a disappointment since such a large and fundamental topic is relegated to little more than a convenient link item between lists and streams. ... The major omission, and it is major, is that types are never fully, or even adequately discussed." There's more.
- cadr 3y agoThe entire instruction of Scheme in 6.001 was less than an hour. You only need a tiny bit and then you can focus on the concepts in the book rather than quirks of some programming language's syntax. I think that is a huge win. On what basis do you find it "intellectually dishonest"?
- vario 3y ago