
Show HN: Interactive SICP - zodiac
http://xuanji.appspot.com/isicp/1-1-elements.html
======
zodiac
Hello everyone, OP here. This is my first Show HN post.

I guess most of you should know what SICP is. I took a class where it was used
as a textbook (only the first 3 chapters, unfortunately) and loved it.

Most of the syntax-highlighted code fragments can be clicked on and edited.
Either click somewhere else after that or press ctrl-enter to re-evaluate the
scheme code. There are also some auto-graded exercises which involve writing
code, as well as some multiple-choice questions (inspired by coursera)

So far only the first section is up. I don't think I can finish converting the
whole of SICP to this format, so any help is much appreciated! I've tried to
make the API as short as I can, but still able to run arbitrary code (eg for
auto-graders). The main code is in isicp/coding.js and the content is stored
in chapter-specific html files. All this is done via client-side javascript. I
used biwascheme for the scheme interpreter and codemirror for the editor.

~~~
shelf
A great initiative. I hope you manage to finish it.

I hope people extend the same treatment to non-lisp canonical texts.

~~~
zodiac
One reason it was possible to choose SICP was the license (Creative Commons),
which I think is pretty rare for a text of this quality. If I could I'd do the
same for K&R.

------
dschiptsov
SICP is an advanced text, and using it to teach amateurs how to program is,
probably, a mistake.

Brian Harvey have done a great job to simplify and make it more freshman-
friendly. I think his CS61A is the best intro course available (but I don't
think that the sentence ADT is a such great idea, and it make things little
messier, not more clear).

The HtDP2 approach is also remarkable, but problem is it is part of Racket
promotion (word dr.racket is used hundred times in the first chapter). The
idea to make changes in a program visible, via using graphical primitive
functions is brilliant, but controversial one - it is too soon (but it kicks
and makes a progress visible)

I think that _functions with multiple arguments, first-class "citizens"
(values has a type, everything is a pointer), pairs, lists, then generic
functions and environments_ must be taught first, and visualized
interactively, similar to that python tool. Then, after, you can teach parts
from HtDP and then SICP.

People who really enjoyed this initiation will go through whole books
themselves.)

~~~
dmazin
I'm currently doing SICP with Harvey and to be honest after list and cons in
general are introduced I wish the course would abandon sentences altogether.

~~~
samrat
I agree. I'm doing the same course and because I couldn't get their
implementation of Scheme(ucb-scheme) to work, I'm really out-of-sync with the
course.

I'm doing the examples and exercises in Racket.

~~~
tikhonj
Are you taking 61as, the self-paced version? I was under the impression they
were either already using, or planning to switch to, a JavaScript Scheme
implementation to ease just this sort of problem.

I know one of he people who is running 61as, and I believe he wants to move as
much as possible into the browser. In fact, they might even use a JavaScript-
based Emacs clone instead of Emacs proper next time.

I think using the browser should make setting up the environment much easier
than using some old, unsupported Scheme implementation!

~~~
dmazin
I'm in AS. We aren't using a js interpreter and actually I haven't seen them
mention such a switch much. That's news to me.

~~~
tikhonj
In that case, I think that's what they're going to be working on over winter
break for the next iteration of the class. At the very least, I'm sure it's a
possiblity; there's obviously no guarantee that it is practical or will get
done.

I think it's a good idea, personally. It could also make many of the
assignments more interactive.

------
sudhirj
The site doesn't seem to need a server to function - so it would be awesome if
you could add a cache manifest to make it available offline:

<http://www.html5rocks.com/en/tutorials/appcache/beginner/>

------
firesofmay
Good initiative. I wish it was done in clojure/clojurescript, would have been
great. But still its a nice way to learn. One suggestion. Add paredit mode to
balance the parens. Without paredit mode one has to worry about balancing the
parens and its a painful experience. It's like coding in notepad. Looks great!
Looking forward to more chapters :)

~~~
dizzystar
I can't imagine a Clojure SICP really working. The whole idea of SICP is to
take a super-simple language and learn to build your own data-structure,
psuedo-languages, and clarify _how_ expressions, structures, etc. we use
everyday are used, created, and implemented.

I really wish people wouldn't look at Clojure and think that it is the same as
Scheme, especially the flavor presented in SICP, because it isn't. They're two
entirely different languages and conflating the two as the same because OMG
Parenthesis is like saying Python and Ruby are the same because they are
categorized as scripting languages.

Clojure and Scheme attempt to solve very different issues. Scheme does a
wonderful job in the sphere allocated in SICP. SICP could theoretically be
taught with Clojure, but one must wonder why it hasn't been fully attempted
yet. I think that once you try out Clojure, you would see the glove doesn't
fit very well, so to speak. The main issue is that SICP is extremely fast and
ideally, you'd want a language that takes a day to sort of learn and
understand. Clojure certainly does not have this advantage. Clojure has many
built-in structures. If you did do SICP in Clojure, you'd effectively be using
a Scheme without cons, car, and cdr and using a Clojure without map, filter,
etc etc etc. What's the point of that?

~~~
firesofmay
I was actually thinking of the whole web app being written in
clojure/clojurescript actually. And not teaching SICP via clojure.

~~~
zodiac
Oh. Well both biwascheme and codemirror use javascript, and the amount of glue
code I have to write isn't that much, so I'm not sure the benefits of
clojurescript would outweigh that of being able to talk to these libraries
directly.

------
zodiac
Sorry for repeating myself, but I really need contributors for this - I can't
finish it just working on my own on weekends.

~~~
franciscoap
Hey,

I thought about doing this 3 or 4 days ago (eerily similar -- I had even
decided on Biwa Scheme as well). To avoid duplication of effort, I would
rather contribute to your iSICP than start my own.

Drop me a line at me@f.rancis.co

------
ghubbard
SICP - Structure And Interpretation Of Computer Programs

Is an MIT computer science textbook.

[http://mitpress.mit.edu/books/structure-and-
interpretation-c...](http://mitpress.mit.edu/books/structure-and-
interpretation-computer-programs)

------
BlackJack
Looks awesome. I think exercise 1.2 is broken. I enter in:

(/ (+ 5 (+ 4 (- 2 (- 3 (+ 6 (/ 4 5)))))) (* 3 (* (- 6 2) (- 2 7))))

and it tells me the result is wrong, but wolfram and my own REPL confirms the
result.

~~~
zodiac
The autograder checks for (+ 5 4 (- 2 ...)), instead of nesting the additions.
You can view the source to see the grader. I'm not sure how to make it
accomodate all the ways it could be nested though.

~~~
BlackJack
Why not check the result and also check for the presence of parentheses? That
way you can verify the result and make sure nobody's just copying and pasting
in an answer.

One could easily do something like (-2.466..) as the answer, but given that
you just need a simple way to verify answers, I think my strategy works well.

~~~
FuzzyDunlop
I think you could get away with not even checking for parens, if you go with
the idea that people doing it properly won't try to cheat it (because they'll
learn nothing).

For people who do want to 'cheat', the grade is meaningless anyway.

~~~
BlackJack
I thought about that, but my reasoning for checking parens is that there's a
decent subset of people who might get stuck and just google an answer, but if
it gets rejected, then they'll put more time into figuring out the correct
answer.

I guess I'm trying to view it from the POV of a beginner, as most CS
people/programmers can work through this without needing the website.

------
Surio
"Green Bar" on the right: It is the navigation menu that comes into focus once
you click on it. You can focus on the content w/o getting distracted by the
ToC. :)

To OP. Don't worry. It is intuitive enough (for me at least (-; )

------
jyf1987
ok, here is my suggestions:

1, add a on page chat for people, so they could help each other

2, add comment extension for the page, so people could add extra notes or
corrects for your error :] , i saw those style here `[http://hgbook.red-
bean.com/read/a-tour-of-mercurial-the-basi...](http://hgbook.red-
bean.com/read/a-tour-of-mercurial-the-basics.html`)

3, if possible, DO develop an app for mobile device, so you could get income
or reputation which could driven you to continue this greate initial and
finally done the job

------
Tyr42
uhh, It's got some sort of green bar, but it's stuck waaay over to my right
and I can't read it. Chrome OSX

~~~
zodiac
try clicking on the left edge of the green bar

sorry if it's not intuitive - I wanted the content to not be too wide (for
reading) and had an idea to place some non-critical things on the remaining
space, but then I decided it shouldn't always be visible

edit: I've fixed the page to make the green tab visible by default

~~~
ezyang
The best way to cue that it is clickable is to have it "bounce" when you mouse
over it, indicating that it is hidden on purpose and can be expanded.

~~~
zodiac
Thanks, I've seen those bounces before but it never occurred to me to use it.

btw, I love your blog

------
arikrak
If I ever get up to Scheme, I'm adding this to my chart of interactive
resources for learning programming.

------
zodiac
Anyone have ideas for how best to show footnotes? The current version doesn't
have them.

------
jyf1987
well, i just planing to post a blog about interactive books, hmm , seems late

