13 ms·
SICP: JavaScript Edition available for pre-order
- moralestapia 5y agoWhoops, they beat me to it. Super nice, I hope it gets very well received by all people interested in FP.
- shrubble 5y agoI admit, I did a double-take: thought it was a joke,at first... like those meme-oriented O'Reilly book covers.
- perihelions 5y agoNote to the unaware, both* this version and the classic (Scheme) version are Creative Commons-licensed and freely available online. (*edit: thanks to keithwinstein for enlightening me -- I wrongly thought it was just the one. The publisher's site doesn't advertise this at all!) https://sicp.sourceacademy.org/ https://sicp.sourceacademy.org/ (JS version) https://mitpress.mit.edu/sites/default/files/sicp/index.html https://mitpress.mit.edu/sites/default/files/sicp/index.html (1984 classic)
- keithwinstein 5y agoI believe they are both CC-licensed. See https://sicp.sourceacademy.org/ https://sicp.sourceacademy.org/ 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)!
- perihelions 5y agoVery respectfully disagree; but long or short, this looks really bad: 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 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?)
- gumby 5y agoI know which one I'd rather debug, but which one can a new student get started with faster? They are unlikely to already have a scheme interpreter on their computer.
- d3nj4l 5y agoIt won't take longer than 15 minutes to get racket installed, and that's being extremely conservative. If you can't spend 15 minutes getting setup done, why would you finish a dense book on the theory of computation?
- deleted 5y ago[deleted]
- cbm-vic-20 5y ago
- gumby 5y agoThe scheme version was aimed at students who might never have touched a computer before. Why should this book be different, though these days aimed at students who’d only operated a computer before.
- bitwize 5y agoWhen the Scheme version was written, all the programming languages were equally weird to incoming students. So Scheme was as good a starting point as any other. Today, Scheme is still weird, but JavaScript is familiar. It's something the incoming students are at least likely to have heard of. So it makes more sense to ease them into the material with the familiar rather than drop them into something weird.
- filoeleven 5y agoBy that logic, North Korea is a better vacation spot than Niue, since most people are at least likely to have heard of North Korea.
- markc 5y agohttps://sicp.sourceacademy.org/ https://sicp.sourceacademy.org/ brings me to something called "Comparison Edition". I was looking for a straight JS version with editable/executable code, and found it at the link named "Interactive SICP JS" (which takes you to https://sourceacademy.org/sicpjs/index https://sourceacademy.org/sicpjs/index) 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.
- celroid 5y agoIs this version the same as the one that's going to be released on paperback?
- kragen 5y agoThat's wonderful! I was going to ask.
- kurhan 5y agoThere is also github repo https://github.com/source-academy/sicp/wiki https://github.com/source-academy/sicp/wiki with instruction how to generate various versions
- strictfp 5y agoWHAT? They skipped all the way from Lisp to JS? Why?
- deleted 5y ago[deleted]
- shaunxcode 5y agoJS has always been a LISP in Algol clothing.
- kazinator 5y agoOnly, you know, without List Processing. And seventeen things that test false. And all numbers being floating-point (except when optimized implementations fudgily pretend that small values are integers). And a switch statement that you have to put into a function in order to get a return value out of it (everything returns a value in Lisp). Maybe it's more of a Scheme in Algol clothing; not everything returns a value in Scheme.
- bmitc 5y agoAnd no tail-call recursion.
- bakul 5y agoActually Scheme is Algol in LISP clothing. I don’t know what that makes JavaScript.
- hajile 5y agoThere were some similarities, but I'd say Scheme is more different than similar. Scheme is GC'd Scheme is fundamentally based on functions rather than proceedures Scheme functions are first-class Scheme uses tail recursion in place of loops Scheme uses CPS and continuations (even though that was no doubt a mistake) Scheme has symbols and programs are composed of symbols. Scheme makes use of macros pervasively (not even C-style preprocessors were in ALGOL) Scheme has only expressions while ALGOL has statements. A lot of surface-level API designs and names seem inspired by ALGOL, but the fundamental building blocks seem very different to me.
- nobleach 5y agoOne major benefit here is how approachable this is. One could even simply open Dev Tools on their browser and use the console as a REPL. As someone who installed Scheme/Dr Scheme/Dr Racket long ago, it's nice to say, "you can get started right now". I know there'll be a lot of complaint about JS as a language choice but, it's pretty ubiquitous. And, much like Scheme, no one's saying, "you should use this for your next app that you have planned"
- boardwaalk 5y agoThough I'm sure there are a few Scheme interpreters written in JS or that compile to WebAssembly and so are just about as accessible.
- nobleach 5y agoRight, but if we're looking for the quickest path, "right click on this page, and select 'Inspect'" and boom. You're there. Certainly one could go to https://replit.com/ https://replit.com/ and choose from a host of "better" languages. My approach was trying to avoid someone having to install anything at all. As soon as you say, "ok, you'll need to install NodeJS, then use npm to install this package....", things get dicey. Someone who's serious about learning will fight through it, but someone who's just starting out may be put off.
- turminal 5y agoThis is the wrong kind of approachable, because you have to learn a ton of random web things before you do anything outside the repl and before your program can even process user input and then people struggle with those two concepts that would be trivial to them if they could be introduced earlier. Having seen what having javascript as a first language does to first year students I can't understand why this is considered a good idea.
- mwcampbell 5y agoI'm an uncle of 6 children, ages 7 and under. My guess is that if any of them have ever seen a VT100 terminal emulator or Windows console window, it was probably only when watching me or my brother-in-law. So traditional line-oriented programs, with plain text input and output, will be alien to kids of this generation. I know Racket has an integrated GUI toolkit, but will this new generation be able to run it on their tablets? One benefit of the great variety in front-end JavaScript frameworks, often criticized as churn, is that we're more likely to arrive at an abstraction that will be approachable to beginners. I look forward to watching how this generation learns to program.
- eggy 5y agoFirst they replace Scheme with Python for their CS classes, and now SICP in JavaScript! Isn't this another portent from Nostradamus about the coming of the end of the world?
- jacquesm 5y agoNo, it's proof that you are already in hell.
- tartoran 5y agoI think hell is coded in Java
- jacquesm 5y agoIndeed, and this is common knowledge. But in hell you program in javascript. Or https://en.wikipedia.org/wiki/Malbolge https://en.wikipedia.org/wiki/Malbolge .
- jpgvm 5y agoHell, Heaven and Earth are written in Java. That is why most people are slow after waking up and why you need to sleep for garbage collection to run.
- just_steve_h 5y agoWrite Once, Burn Anywhere
- bmitc 5y agoI saw this the other day on Amazon while picking up the SICP instructor's edition. For the life of me, I can't figure out why they chose JavaScript to do this. And the new authors are professors. Since the original SICP has a permissive license, I've actually thought about doing something similar, but with a more modern functional language.
- schwartzworld 5y agoYeah, imagine the craziness of making materials like this accessible to users of the most widely used language.
- turminal 5y agoIt didn't become widely used because it were any good and being widely used generally doesn't imply quality. I think the decision on what language to use in teaching material should be made based on quality and ease use, not popularity of the language.
- ravi-delia 5y agoSCIP uses an amount of high-level functions that are frankly ridiculous outside of a very functional language. Hell, maybe even outside of a Lisp-1. That's not to say that Scheme is the best language (probably not in my top 5), but there are better languages than javascript for SCIP, and better programming methods than SCIP for javascript.
- hajile 5y agoWhich remotely popular language would be a better choice? The only ones that leap to mind are the ML languages.
- ravi-delia 5y agoI guess that's the rub, I'm not sure any of them are. Certainly Javascript has stronger support for functional programming than Python. Maybe Ruby? Even Haskell would get pretty much unreadable extremely quickly, though pattern matching would make some parts way easier. I'm not coming at this from a lisp fanboy perspective (though I am one), it's just kinda the reality of SICP's style of programming. Even PAIP translates extremely well to Python, but SICP encourages a layering of abstractions that I can't picture reading without parenthesis keeping order of operations strict. The best solution I can think of is having a pre-packaged setup for getting started with Scheme, a la Dr. Racket.
- gadtfly 5y agoSICP translated to JavaScript (2013): https://news.ycombinator.com/item?id=6385617 https://news.ycombinator.com/item?id=6385617
- dang 5y agoThanks! Macroexpanded: SICP – Upcoming JavaScript Edition - https://news.ycombinator.com/item?id=27737942 https://news.ycombinator.com/item?id=27737942 - July 2021 (2 comments) Structure and Interpretation of Computer Programs – JavaScript Adaptation - https://news.ycombinator.com/item?id=21822903 https://news.ycombinator.com/item?id=21822903 - Dec 2019 (180 comments) SICP JavaScript Going Public - https://news.ycombinator.com/item?id=21779397 https://news.ycombinator.com/item?id=21779397 - Dec 2019 (1 comment) SICP translated to JavaScript - https://news.ycombinator.com/item?id=6385617 https://news.ycombinator.com/item?id=6385617 - Sept 2013 (107 comments)
- macmac 5y agoI feel so conflicted about this.
- millerm 5y agoInsta buy. I love my SICP book. Need this for fun, perspective to teach juniors, and shelf art. Yes, I pre-ordered. For those complaining about it being in JS, probably didn’t read SICP as it wasn’t about LISP. This isn’t about JS.
- turminal 5y ago> This isn’t about JS. That's precisely why it shouldn't be in JS. Edit: to clarify, javascript is full of random warts that you have to know about in order to use it effectively, that's why I think a language with less such warts would be more suitable for someone that wants to try out and use the ideas book introduces with caring too much about the language.
- millerm 5y agoThe most accessible runtime on the planet. To each their own. I loathe JS, but I also believe english is a crap language. English happens to be the only language I can effectively use to describe my ideas to others. :-)
- bmitc 5y ago> The most accessible runtime on the planet. In what sense?
- lkschubert8 5y agoIf you have a browser on a computer you have a js repl.
- bmitc 5y agoThat's what I had assumed but wanted to double check since "accessible" is ambiguous. However, it's not all that convincing of an argument. Several languages are installed as easy as a browser is. And loading a local file, such as code included with a book, in the developer console quickly goes beyond accessible.
- exdsq 5y agoHoly crap take a look at some of the JS examples in Chapter 4 - functions declaring functions declaring functions returning functions
- labrador 5y agoI hate this style of coding. I don't see how it's any better than turning everything into data and code in encapsulated class objects and passing them around
- skybrian 5y agoYou shouldn't read SICP as a guide to practical programming. A lot of things in it would normally be bad style or contrived, but it's interesting to know that they are possible.
- ravi-delia 5y agoIt's handy sometimes, but I think it starts looking worse the further from Scheme you travel. Even in Common Lisp it's probably too far, but with a Lisp-1 you get some really pretty high-level abstractions. Of course I find I don't miss them very much, but they sure are fun.
- fermentation 5y agoI never read this book during my education. Would you all say there’s something to be gleaned from reading this as an engineer with some years of experience already, or is it primarily an introduction to programming?
- StreamBright 5y agoIt is introduction to programming like no other. It takes it to a whole new level. Mind you, it is not about software engineering just about how to solve problems with algos. It used to be in LISP (Scheme if i am not mistaken) and now they have a JS version.
- pvg 5y agoIf you are already a programmer and mostly want to check it out for ideas and concepts, you're better off with the Scheme version. The book itself is not 'primarily an introduction to programming', at least not in the conventional sense.
- throwthere 5y agoAs a former Lisper turned JS/TS apologist for practicality, I have to ask-- Et tu, Brute??
- deleted 5y ago[deleted]
- zwaps 5y agoMaybe SICP will not be better for using Javascript, but perhaps Javascript programmers will get better for reading SICP? That would be very nice.
- Fellshard 5y agoI'd say JS-only devs would benefit from getting outside of their bubble ASAP, and the original SICP is a very good way to begin doing that.
- thrower123 5y agoNo, they'll get bad ideas and try to implement them even more badly. Everybody's dealt with that one asshole* who overdosed on category theory and proceeds to write Haskell in Python for the next two years. * It's me, I'm that asshole.
- gorjusborg 5y agoThanks for the laugh! Guilty here too, just not in python.
- gorjusborg 5y agoUntil js runtimes implement tail call optimization, recursive coding is only really feasible in an academic sense. In langs with proper TCO (like scheme and lua), recursion is a beautiful and practical way to solve problems.
- lenkite 5y agoJavascript is eating the world. Only WASM can save us now.
- hajile 5y agoJS isn't just popular because of the browser. It has a TON of syntactit niceties today. Most of the warts are no longer relevant (here's to a future "use strict 2" mode that eliminates the really bad type coercion bits). It hits a very pragmatic center where you can do OOP, but top-level functions are also possible (looking at you Java). JS also has good functions. Closures that don't require spelling everything out, first-class functions that can be passed around to other functions, anonymous functions, etc. Outside of currying, it has almost everything you'd want functions to have. That's something sorely missing in languages like Python (lambdas), Ruby (proc/lambda/block mess), PHP (no implicit closures), Java (no first-class functions), etc.
- muh_gradle 5y agoI have a copy of SICP right next to me, and it's one of my favorite computer science books. I'm not sure how I feel about this javascript edition though...
- kazinator 5y agoI was doing some Javascript coding today. A false != x test failed for a zero-valued x; had to make it !==. WTF? I never want false and 0 to be other than different objects. Almost every twist and turn in this language is an imbecillic clusterfuck. I had one instance of a if (foo.bar = 0) typo; no warning from the implementation. Why do we want stupid C mistakes in a higher level language, without the C fixes for them? list.forEach(function (item, i) { ... }); makes my eyes bleed. JavasSript borrows the syntax of languages geared toward a form of computing at which JavaScript is poorly suited for; when you're combining functions together, it looks like dog's breakfast. To get a value out of a switch statement, you have to wrap it in a function that is immediately called? function () { switch (WTF) { } }(); the switch statement has the idiotic break with fallthrough found in C. One redeeming feature: A || B || C ... works a lot like (or A B C ...). Unfortunately, this is required for the simple task of incrementing a nonexistent dictionary key from zero: dict[key] = (dict[key] || 0) + 1; this calls for two dictionary key lookups. You want this sort of thing in a single operation. Oops! In the following, j isn't lexical: for (let i = 0, j = 0; .... I copy and pasted something like this from a StackOveflow answer into a recursive function and spotted that the j in a recursed frame was messing with the j in outer frames, there just being one j. What is "function scope" and why even have something so idiotic? Just let, or GTFO! C has function scope for goto labels, that's it; why introduce something like that. Appending together Lists has functional semantics, like Lisp: a.concatenate(b) // new thing is returned, a stays the same, so you must do a = a.concatenate(b). But a.push(b) // mutates a in place. Here is a shitshow, curently with a fitting number of upvotes: 666. https://stackoverflow.com/questions/881085/count-the-number-of-occurrences-of-a-character-in-a-string-in-javascript https://stackoverflow.com/questions/881085/count-the-number-... I accidentally wrote if (foo.bar.indexOf[key] < 0) { code } code was silently skipped even though foo.bar is an empty list. No diagnostic, nothing. Oh, indexOf is a function, which is an object. Every damned object is a dictionary with properties you can access as strings with square bracket indexing, and that is always safe: it yields undefined if the property is not found.
- kazinator 5y ago
- buescher 5y agoHe had a copy of SICP on his shelf.
- adamgordonbell 5y agoI got a chance to talk to Hal Abelson and two things I found surprising where: 1) he thought part of SICPs success was due to the calibre of students MIT gets and 2) He though Javascript was a fairly good scheme approximation ( although with too much syntax).
- Barrin92 5y ago>He though Javascript was a fairly good scheme approximation ( although with too much syntax). that one isn't too surprising because "putting scheme in the browser" was quite literally what Eich set out to do "As I’ve often said, and as others at Netscape can confirm, I was recruited to Netscape with the promise of “doing Scheme” in the browser. At least client engineering management including Tom Paquin, Michael Toy, and Rick Schell, along with some guy named Marc Andreessen, were convinced that Netscape should embed a programming language, in source form, in HTML. So it was hardly a case of me selling a “pointy-haired boss” — more the reverse. Whether that language should be Scheme was an open question, but Scheme was the bait I went for in joining Netscape. Previously, at SGI, Nick Thompson had turned me on to SICP." https://brendaneich.com/2008/04/popularity/ https://brendaneich.com/2008/04/popularity/
- paradite 5y agoI took the CS1101S course taught by Martin Henz (who did the adaptation), where this JavaScript adaptation of SICP was the textbook. I enjoyed writing JavaScript and functional programming. Here is an old screenshot of the interpreter that I was able to build: https://paradite.com/wp-content/uploads/2013/10/interpreter.png https://paradite.com/wp-content/uploads/2013/10/interpreter....
- namelosw 5y agoSICP in Python - https://news.ycombinator.com/item?id=22994976 https://news.ycombinator.com/item?id=22994976 You can see there's more negativity in this thread compared to the Python one. HN crowd is pretty hostile toward JavaScript. Yet JavaScript is obviously a better choice than Python in terms of SICP Scheme substitute. For example: - JavaScript is arguably a Scheme descendant, or at least have closer blood ties with Scheme than Python. - The Lambda in Python is just awkward, and SICP is a book about lambdas. - The Chapter 2: JavaScript use more anonymous object which makes it a better choice, although there are dictionaries in Python it's more favored to use Classes. - Chapter 3, the Object-oriented Programming part: Use lexical closure to simulate object is just day to day JavaScript. So does dispatch and pattern matching messages. - Chapter 3, the stream part: In JavaScript world the "functional" streams approach is also very popular. - As for symbolic programming and such, they're both not particularly good. But that's a problem for all mainstream languages. At least JavaScript has programmable string template. As you can see many SICP stuff are just day-to-day JavaScript, but not so much in idiomatic Python. Let alone JavaScript is more approachable in almost every platform, and much easier to make interactive tutorials.
- aaomidi 5y agoI've really noticed that people rage that Javascript and npm removed so much of a barrier to tech. Try publishing a dependency for Java. Now try doing it for JS. Everyone was able to do highly concurrent workloads. Something that was extremely difficult before Javascript. It just smells of elitism to me. It's a wonderful language that brought the async await system to everyone.
- bitwize 5y agoJavaScript should be enough Lisp for everybody. Fite me.
- pretext 5y agoI think Racket Edition would be more faithful to original SICP spirit.
- philonoist 5y agoSICP should be shelved into the museum of the great CS courses. It served its purpose in its generation (the early batches like 1990s were already electrical engineers).Even Discrete-Math was just an experimental collection of concepts for them[1]. My mad respect and admiration to those professors at MIT. We moved on. Assuming we have completed nand2tetris[https://www.nand2tetris.org/ https://www.nand2tetris.org/], we should instead be focussing on something like HtDP[2], or maybe like how they do at Brown using Pyret[3] or my favourite, how they teach programming at CMU - C with training wheels[5][6] SICP as a second course, will then be fun to those passionate about mariad applications in the midst of innovation decades. Javascript (and sometimes Python) won't give you the insight these courses were designed for. To learn programming? Absoutely NO. [1]http://www.aduni.org/courses/ http://www.aduni.org/courses/ [2]https://news.ycombinator.com/item?id=18890417 https://news.ycombinator.com/item?id=18890417 [3]https://www.pyret.org/ https://www.pyret.org/ [4]https://www.cs.cmu.edu/afs/cs/local/sml/common/smlguide/index.html https://www.cs.cmu.edu/afs/cs/local/sml/common/smlguide/inde... [5]https://news.ycombinator.com/item?id=15499160 https://news.ycombinator.com/item?id=15499160 [6]https://bitbucket.org/c0-lang/docs/wiki/Home https://bitbucket.org/c0-lang/docs/wiki/Home
- dancemethis 5y agoNo, thanks. It serves as a perfect blend of a serious bullet point in the introduction entries and niche comedy. It's part of the eternal culture around it.
- JHonaker 5y agoI will preface this with, "I absolutely love SICP", but I think there are better places to go for everything it teaches. In terms of breadth and information per page ratio there's almost nothing better though. - For how to actually program: How to Design Programs [1] - For how to write programming languages: Essentials of Programming Languages [2] - For how computers actually work: The Elements of Computing Systems (nand2tetris) [3] I am a huge fan of How to Design Programs. It does a better, more thorough job of teaching the "core skill" of programming SICP or anything else I've come across. Its text is better paced (although very long), more approachable, and more focused on teaching how to program (as the name suggests). On top of that it has an absolutely massive number of exercises that do not require an interest in basic number theory to enjoy. You will know how to actually solve new problems with programming when you finish HtDP (or are even part way through). The really interesting parts of SICP are the 4th and 5th chapters any way right? Well, Ch. 4 (about "metalinguistic abstraction" or how to modify your interpreter to give your language different properties) is incredibly densely packed with information. It covers an interpreter for all of this in about 100 pages: - lazy evaluation by default - nondeterminism - aka search as a language primitive - the basics of continuations (but not accessible to the user) - propositional logic - aka declarative (what is) vs imperative (how to) programming It's a great appetite whetter, but it'll leave you wanting more. If this stuff interests you Essentials of Programming Languages is a much better resource. It follows a similar style to the approach in SICP. You are walked through building interpreters for increasingly more complicated languages. Here are some brief descriptions of some of features you'll learn to add to the LET language (a very simple purely functional language that serves as the core, you'll also write this too): - Mutually recursive procedures - Static code transformation to use lexical addressing - Mutation (and how to perform call-by-value, call-by-ref, and call-by-need languages) - Continuation-passing vs Environment-passing interpreters - Advanced control structures like exceptions and threads - Static types and type inference - Typed modules (I've not seen any other introductory text do this) - Object-orientation It contains a plethora of great exercises that ask you to extend the languages in interesting ways or to reflect more realistic demands of a language. For chapter 5, Register Machines, I think we all know that the first half of Elements of Computing Systems (colloquially nand2tetris) is a great resource for that. The second half is excellent as well, but it's outside of the SICP scope. Summary: ;; Page Count 1374 = (+ 792 410 (/ 344 2)) In total I just recommended 1374 pages to replace 657 pages in SICP, so it's double the effort. And to be honest, if you're motivated enough to read all that then, you'll probably still read SICP if for nothing else than historical interest. If you start with SICP though, you'll still get a lot out of all the recommendations though! [1] HtDP: http://htdp.org/2021-11-15/Book/index.html http://htdp.org/2021-11-15/Book/index.html [2] EoPL: https://eopl3.com/ https://eopl3.com/ [3] nand2tetris: https://www.nand2tetris.org/ https://www.nand2tetris.org/
- gorjusborg 5y agoSICP is a scheme course. If you want to experience SICP, why compromise? If you learned JS, you can learn scheme. Reusing the SICP name is just a marketing tactic to sell something different and probably less special.