
Structure and Interpretation of Computer Programs – JavaScript Adaptation - hwartig
https://sicp.comp.nus.edu.sg/
======
brlewis
What an interesting and ambitious project! Of course the first thing I did was
skim the Metacircular Interpreter section to see how they handled the
additional syntactic complexity. They gloss over the "parse" function, which
is probably the best one can do. That the Scheme function "read" could be
implemented by a novice is one of the advantages of using Scheme for SICP and
it wouldn't be reasonable to expect an adaptation like this to reproduce the
exact experience. I do think it's great the way SICP leads people through
doing powerful things with a programming language, and then shows them that
they themselves could implement the language they've been using. It gives a
powerful feeling of control in an environment (computer programming) that can
otherwise be intimidating. I think this adaptation does almost the same thing.

The translation is pretty direct, so the data structures are more idiomatic to
Scheme than they are to JavaScript. I think that's OK.

~~~
vanderZwan
> _The translation is pretty direct, so the data structures are more idiomatic
> to Scheme than they are to JavaScript. I think that 's OK._

I do wonder if it wouldn't be simpler to write a Scheme interpreter in JS (or
take one of the undoubtedly existing ones) and make the book interactive with
that.

This version feels more like something that has added value if you already
know JS, not so much when you're learning JS

~~~
ahuth
> This version feels more like something that has added value if you already
> know JS, not so much when you're learning JS

Totally agreed, which I think is a strength of SICP. I know historically it
was for learning computer science, but I've gotten so much out of reading it,
despite not being a newcomer to the field.

------
Theizestooke
Is this the first adaption of SICP to a different language?

~~~
mehrdadn
[https://wizardforcel.gitbooks.io/sicp-in-
python/content/](https://wizardforcel.gitbooks.io/sicp-in-python/content/)

~~~
gchamonlive
This is really cool, thanks

------
ngcc_hk
Finally have a free 1 hour and try the site. The site cert. is not valid ...
and also if you start with the book, click it does not result in running code.
More important the first preface is about Scheme which I think it should be in
reverse. My 1 hour up. May try later.

------
voldacar
There's kind of a reason why SICP was written in Scheme in mind and not a blub
language...

~~~
mattacular
Were you going to let the rest of us mere mortals in on the reason?

I think it's good to offer a version of SICP adapted to a language that's used
today very prominently and is relevant to many current jobs in the industry.

~~~
ken
Why? Why does a textbook about fundamental principles need to be 'adapted' to
technology currently in use in industry?

The Feynman Lectures uses an example of a screw jack with 10 threads per inch,
and a 20" lever. Should we update this to a name brand screw jack with 8 or 16
threads per inch, and an 18" breaker bar, because those are common in industry
today?

Be sure to extend the introduction of that chapter to include a history of
this particular screw jack company, and who currently holds the trademark, and
all the major companies that make screw jacks today, and typical uses of
jacks, and how they're constructed [1].

[1]:
[https://sicp.comp.nus.edu.sg/chapters/1](https://sicp.comp.nus.edu.sg/chapters/1)

~~~
tiborsaas
> Why? Why does a textbook about fundamental principles need to be 'adapted'
> to technology currently in use in industry?

Because it's widely used in the industry.

~~~
goto11
Why does that matter? You are not going to get paid to work through the SICP
exercises on a job. Rather, you are going to use the things you learned
through SICP on a job. Like deciding when JavaScript is the right tool and
when it isn't.

~~~
tiborsaas
> Rather, you are going to use the things you learned through SICP on a job.

That's my point. Is that bad somehow that it's written in a familiar and
accessible language for the majority?

One can sharpen its knowledge without the barrier to understand a new language
and syntax.

~~~
goto11
If learning a new language and syntax is a barrier, you will not be able to
follow SICP anyway, since it includes developing multiple languages in various
paradigms.

~~~
tiborsaas
Oh, okay. I thought I was just lazy, not dumb. My bad.

~~~
goto11
Come on, I'm not putting anybody down. Just pointing out that you cannot avoid
learning new languages anyway, since the exercises in the book requires you to
design multiple different languages. It is basically a book about language
design.

------
musicale
Add this to Little Scheme/The Little JavaScripter.

[https://www.crockford.com/scheme.html](https://www.crockford.com/scheme.html)

[https://www.crockford.com/little.html](https://www.crockford.com/little.html)

------
swiley
I remember finding the SICP in our university’s library as a freshman, me and
a friend (both of us had never used scheme) had a lot of fun going through the
first chapter together.

------
kyancey
What fresh hell is this?

~~~
braythwayt
Dorothy Parker, is that you?

------
nhlx2
Adaption - another term for adaptation.

~~~
jessaustin
It's a perfectly cromulent word, but at the link only "adaptation" appears.

~~~
kaycebasques
> It’s a perfectly cromulent word

TIL: [https://www.merriam-webster.com/words-at-play/what-does-
crom...](https://www.merriam-webster.com/words-at-play/what-does-cromulent-
mean)

------
b0rsuk
Every now and then a great movie comes out. Then it gets its American remake.
It's been proven you can put Al Pacino, Robert de Niro and Bruce Willis in any
movie (with predictable results!). This is the book equivalent of an American
remake for me.

Is Javascript the new pseudocode? Honestly I'd rather be forced to learn a new
language to understand a book than to read the book adapted to JS.

~~~
scottoreily
Typical dramatic Hacker News user. JS is a great language and enjoyed by
millions of developers.

~~~
vmchale
> JS is a great language

literally no one believes this

~~~
MisterOctober
I like JS. I use JS daily. JS is part of the workflow for nearly everyone I
know who works with code. For me, ES6 is fantastic to use. Some of the better
books on JS [I'm thinking specifically of Haverbeke's "Eloquent Javascript"]
are general computing classics in their own right.

I used to be a snob about JS, due to the fact that in the 90s / early 2000s,
it had major shortcomings and produced a lot of slow, crashy web pages. But
when I learned modern JS, I realized that it is now a fully mature language
equal to any other, and easily used in a huge variety of contexts [thanks in
no small part to Node]

~~~
ryeights
JS is a terrible language. The amount of pitfalls, language features you must
avoid, and obscure paradigms you must follow to make JS usable is mind-
boggling. Just because you _can_ use JS well doesn't mean it's a good
language.

~~~
ahuth
Out of curiosity, what languages do you think are good ones?

~~~
CalChris
Scheme is a good programming language.

------
FoyrNeo
Great news

------
rakhalmadhu
Awesome....

------
dprophecyguy
Holy Shit... This is awesome ... !!!

------
z3t4
I skimmed through the book and think I saw a function declared inside an if-
statement. Some JS engines don't like that. And if the engine does support it,
the function will be function scoped. To make an if-scoped function, declare
it using const f = x => y,

nitpick: I personally prefer to use intermediate variables instead of nested
function calls and ternary operator.

------
muzzletov
Dont like where they state shit (code, programs, processes etc.) isnt comprise
of anything.

Everything is comprised of something.

Please, if you compose something many people could potentionally consume, at
least dont be all esoteric and/or mystical about it. This is not a campfire,
where everyone tells a story of fairies and shit. They maybe even more so
eager to learn a typical umderlying layer/architecture.

