
SICP in Clojure - bernatfp
http://sicpinclojure.com
======
benawabe896
Could we stop posting this please? It is a fantastic idea, but is incomplete
and not worked on much at all.

[http://news.ycombinator.com/item?id=7078660](http://news.ycombinator.com/item?id=7078660)
[http://news.ycombinator.com/item?id=900865](http://news.ycombinator.com/item?id=900865)
[http://news.ycombinator.com/item?id=1425203](http://news.ycombinator.com/item?id=1425203)
[http://news.ycombinator.com/item?id=6843719](http://news.ycombinator.com/item?id=6843719)
[http://news.ycombinator.com/item?id=2701414](http://news.ycombinator.com/item?id=2701414)
[http://news.ycombinator.com/item?id=4112852](http://news.ycombinator.com/item?id=4112852)

~~~
lelf
Also when will people understand that SICP is not about teaching programming
language? There is _no fucking point_ in rewriting it in your favourite
language, it is 99.9% your language less suitable for it (99% it already has
mutable state, assignment, loops, (pseudo-)OOP and 5 layers of historic brain
damage)

Don't know scheme? But it's even better that way! Many things will faster
click in your head. Like oh wtf we're writing programs in some lists. Oh and
now how the fuck your interpreter can evaluate programs far more complex than
itself?

~~~
niuzeta
Scheme and/or Common LISP seem to be the common recommendation to embark on
SICP journey, just for reference.

~~~
juliangamble
Look at Racket (was Dr Scheme) and use the dialect R5RS

[http://stackoverflow.com/questions/939582/which-language-
in-...](http://stackoverflow.com/questions/939582/which-language-in-drscheme-
for-sicp)

~~~
soegaard
Use the SICP package for Racket, when you get to the chapters with non-
standard functions. For example the chapter on streams and the one about the
picture language.

[http://planet.racket-lang.org/package-
source/neil/sicp.plt/1...](http://planet.racket-lang.org/package-
source/neil/sicp.plt/1/17/planet-docs/sicp/index.html)

------
dschiptsov
The irony is that in Clojure the classic, naive non-tail-recursive factorial
procedure from SICP will first result in an Overflow Exception and then in
Stack Overflow, while _any_ other Schemes or Lisps could do (fact 1024)
easily.

Don't tell me that I should use some bigint type, the whole big idea behind
the numeric tower is to do not bother with types.

~~~
nickik
Maybe that is the reason why Clojure has growing industry adoption while
scheme does not. Clojure used to have automatic promotion and all this stuff,
but it was taken out in 1.3. BigInts are usful in a very small domain and
Project Euler examples, not in many real applications.

If you could start fresh and reprogramm your VM, JIT and GC, it would probebly
be good idea to do full numeric tower, but in the real world you have
constraints and you cant be pure.

~~~
dschiptsov
Adoption of Java is a different issue, junk food chains are also enjoys
growing adoption, so what?)

~~~
yetanotherphd
You are engaging in the ad populum fallacy fallacy.

That is, you wrongly believe that the popularity of a language isn't, in
itself, evidence of its usefulness.

A lot of people making decisions on which language to use are very qualified
and knowledgeable. When they choose clojure over scheme, they do it for good
reasons.

~~~
dschiptsov
If I am engaging in anything here, it is not this. You should take a look at
my blog at least.)

Clojure is gaining popularity (along with Scala) because it makes living in
the Java Ecosystem a bit less painful and disgusting. It has nothing to do
with the "decline" (non-popularity) of Common Lisps and Schemes in so-called
industry, but more with mediocrity of those for whom this very ecosystem was
created and marketed in the first place.

~~~
nickik
You just assume that it was much better then anything else and people where to
stupid and the marketing of the others to good and thats why CL and Scheme see
no industry adoption.

This might be true and it might not be true but its sure arrogance to pretend
to know that it is true. Your(and other Lispers) arrogance might be a big
reason why Scheme and CL never got adopted.

~~~
lispm
It is pure ignorance on your side to say Scheme or CL never got adopted.

~~~
nickik
After the AI Winter they where of course still both used, but its absolutly
clear that they did not have the addoption other languages had.

At no point was it among the couple of most common used languages at least in
the last 30 years. Look at jobs, popularity or any ranking for as we long as
we have data.

~~~
lispm
That sounds different like 'no adoption'. Based on that I would say Clojure
has very little adoption. Probably there are a few hundred people using
Clojure - not more. The latest State of Clojure survey had just 1000 people
taking part. Half of those say they use Clojure at work - where work can be
anything from academic to industry.

Clojure has to show a few websites, very few applications and a bunch of hobby
projects.

Given that Clojure is at a different point in the hype cycle than Scheme or
CL, it does not look like mass scale adoption rivalling Python, Ruby, C++,
Objective C or Java is coming soon...

In this light there is absolutely no reason to make snide remarks about CL or
Scheme 'industry' adoption, where for example Google uses CL, Sony uses Scheme
for game programming, where companies use Siscog's scheduling applications,
PTC sells CAD systems, Amdocs uses Allegro Cl in Telco applications, various
spae and earth telescopes use a CL-based scheduling engine, various companies
use ACL2, NASA has a theorem prover in Lisp, ...

If these apps were written in Clojure we would see large amounts of blog
posts, ...

------
Nimi
I'm trying to get my faculty to switch to SICP as the intro to programming
course, instead of a planned migration to Python (I'm at the EE department,
which is completely separate from CS). Can anyone think of good arguments in
favor, which may convince the professors?

So far, my main "ammunition" is Dijkstra's argument that "it provides an
environment that discourages operational reasoning":

[http://chrisdone.com/posts/dijkstra-haskell-
java](http://chrisdone.com/posts/dijkstra-haskell-java)

~~~
crashbangwallop
You can try to contact the heads of the SOFT group at the Free University of
Brussels, they might give you a heap of good arguments and or documents.
Thanks to them (and some others), our university still uses SICP as the main
course in the first year of the CS education.

[http://soft.vub.ac.be/](http://soft.vub.ac.be/)

~~~
Nimi
Thanks for the suggestion. I'll see if I can gather a few supporters before I
request their help.

------
bernatfp
Does Clojure differ a lot from Scheme for what SICP teaches? Is there any
benefit for studying the Clojure version of SICP, rather than the original?

~~~
dizzystar
Yes, the differences are significant. The least reason is tail-call. The point
is that Clojure is a very different language, abstracting many of the things
that aren't abstracted in Scheme.

The idea of the book (at least in my interpretation) is that you are given a
language with the absolute bare-minimum needed to built programs, thus why you
can "learn Scheme in an afternoon." All of these things like (filter), hash-
maps, dicts, etc, that we use and take for granted in our programs simply do
not exist in Scheme unless you build it yourself.

In Scheme, you have to build up all the tools you need by _creating_ your
abstractions. To do this in Clojure (or any language) you have to ignore the
abstractions you are given, and often must _break_ the abstractions to create
the abstractions you are already given.

Think of it this way. If you are going to be learning how to create and
explore algorithms for matrix multiplication, would you prefer to use
Mathematica or Python without Numpy?

------
ivan_ah
Also matching the RE "SICP in *" we have Martin Henz's JavaScript clone of the
first few chapters of SICP:
[http://www.comp.nus.edu.sg/~cs1101s/sicp/](http://www.comp.nus.edu.sg/~cs1101s/sicp/)

A (slightly) more readable version is available here:
[http://ivanistheone.github.io/SICPapp/](http://ivanistheone.github.io/SICPapp/)

------
ardz
Clojure joke:

'knock knock!'

\- Who's there?

'minute of silence'

'Knock Knock!'

\- Who's there!?

'another minute of silence'

\- Java

\- Why did you knock twice?

\- I didn't, but some other suspicious guy is standing here with raised arm
and mouth open.

 _Based on my recent Clojure on Android experience._

~~~
mildtrepidation
_Based on my recent Clojure on Android experience._

As much as I wish Clojure on Android were a viable option, anyone with any
sort of reading comprehension knows it's not. So while I don't doubt your
criticism may have some sort of merit, you've managed to shoot your
credibility in the foot, at least for this particular post.

~~~
smrtinsert
by what "reading" do you make that claim? I recently saw a really cool game
written in libgdx clojure. it looked and played great.

------
username223
I remember when "SICP in X" was a thing some years ago. I thought I might as
well do a version in a language I use, so I found a text version of the
exercises and got to work. I lasted all of 1.5 chapters before passing out
from boredom. If translating a bunch of examples of what you can do with
lexical scope and singly-linked lists is your thing, go for it, but I'll pass.

------
billsix
but would the metacircular evaluator fit on a chalkboard?

[http://ocw.mit.edu/courses/electrical-engineering-and-
comput...](http://ocw.mit.edu/courses/electrical-engineering-and-computer-
science/6-001-structure-and-interpretation-of-computer-programs-
spring-2005/video-lectures/7a-metacircular-evaluator-part-1/)

~~~
cjo
I was interested in the same question (how big is a simple Scheme in
Clojure?), and ended up working on one for the heck of it. It's a little under
500 lines of Clojure, and it has a very small number of primitives at this
point.

I tell myself some day I'll go back and build a read layer so I can have
macros.

[https://github.com/CJOlsen/fez/blob/master/src/fez/core.clj](https://github.com/CJOlsen/fez/blob/master/src/fez/core.clj)

------
mebassett
if you're in london and working through/thinking about reading/interested
in/heard about sicp, let me just shamelessly plug my group here:
[http://www.meetup.com/London-SICP-Study-Group/](http://www.meetup.com/London-
SICP-Study-Group/)

(we use racket)

------
radious
Where is the coin slot so I can put some money into this awesome project?

------
djKianoosh
holy comment spam batman! well that's a shame...

------
elwell
"You should not be here yet."

------
ocfx
I've seen this project before, it's been around and incomplete for a long
time. Is someone still working on it?

