Live data from Hacker News

SICP: JavaScript Edition available for pre-order

mitpress.mit.edu

111–120 of 123 posts

Re: SICP: JavaScript Edition available for pre-order

#111
post #93

Earlier quoted context omitted.

JS has always been a LISP in Algol clothing.

Actually Scheme is Algol in LISP clothing. I don’t know what that makes JavaScript.

There 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.

Re: SICP: JavaScript Edition available for pre-order

#112
post #108

Earlier quoted context omitted.

I 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 the…

Some of this is a lack of familiarity. You wouldn't dream of using C without reading a book first. You wouldn't dream of tackling a Java project without reading on the topic. You wouldn't even dream of trying something as simple as Python without a bunch of reading. Why do you try to code JS without reading about the language? It's the only language where people consistently try this kind of thing. > false != x Refer…

> Why do you try to code JS without reading about the language?

Because it's painful drivel.

> Your code is potentially bad. `||` uses "falsey" values

We know that this dictionary will only contain things to which we will be adding 1, which we expect to be numerically done.

(I have already made the point that there shouldn't be multiple falsey values.)

I mean, there could be other problems in this direction: if a string is in there like "foo", then the + operation will make it "foo1".

It's unlikely we would ever want to code a "add 1 to dictionary element, treating non-existence as zero" which will work for absolutely any dictionary regardless of knowing/assuming anything about its content.

> This could happen in any language with a methodNotFound handler.

Only if you define that handler, and have it silently return.

Handlers for method not found are a very poor idea to include in an object system. Ruby and its ilk uses it for ugly, monkey patched solutions for this and that.

Re: SICP: JavaScript Edition available for pre-order

#113
post #10

I 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.

Yeah, imagine the craziness of making materials like this accessible to users of the most widely used language.

One of the exercises in the first (or was that the second?) chapter is speeding up Fibonacci's iterative algorithm by viewing the state transition equations that derives F_n and F_n+1 from F_n-1 and F_n as a pair of linear transformations, therefore a matrix multiplication that can benfit from fast exponentiation (repeatedly squaring). Then in the chapters after that you code a symbolic differentiator and add pattern matching to the language.

SICP doesn't try to be accessible, it's explicitely an engineering text book made for engineers. That's even the reason some people have criticized it[1] and wrote another book[2] with the same themes and goals but ditching the excessive math focus. Anyone who can understand SICP's exercises can understand Scheme.

[1] https://en.wikipedia.org/wiki/The_Structure_and_Interpretati...

[2] https://en.wikipedia.org/wiki/How_to_Design_Programs

Re: SICP: JavaScript Edition available for pre-order

#114
post #111
post #93

Earlier quoted context omitted.

Actually Scheme is Algol in LISP clothing. I don’t know what that makes JavaScript.

There 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 ev…

Scheme adapted lexical scoping and block structure from Algol 60. Lexical scoping was a major departure from LISP in 1970s. Call/CC was not in the original Scheme. Probably added in R4RS. Macros came later too. My point was that calling JS Scheme in Algol clothing even less valid than calling Scheme Algol in LISP clothing!

Re: SICP: JavaScript Edition available for pre-order

#115
post #84
post #73

Earlier quoted context omitted.

The 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.

When 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.

It's not if the familiar language obscures the central ideas.

Re: SICP: JavaScript Edition available for pre-order

#117
post #34

Maybe SICP will not be better for using Javascript, but perhaps Javascript programmers will get better for reading SICP? That would be very nice.

Until 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.

Re: SICP: JavaScript Edition available for pre-order

#118
post #34

Maybe SICP will not be better for using Javascript, but perhaps Javascript programmers will get better for reading SICP? That would be very nice.

No, 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.

Thanks for the laugh!

Guilty here too, just not in python.

Re: SICP: JavaScript Edition available for pre-order

#119
post #10

I 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.

Yeah, imagine the craziness of making materials like this accessible to users of the most widely used language.

Yeah, there are so many people who want to expand their experience and mind, who also can't learn a language that can be taught in 10 minutes.

Re: SICP: JavaScript Edition available for pre-order

#120
post #6

One 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 nex…

This 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 consi…

I'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.

Post reply on HN