33

I've caught the bug to learn functional programming for real. So my next self-study project is to work through the Structure and Interpretation of Computer Programs. Unfortunately, I've never learned Lisp, as I was not a CS major in college.

While SICP does not emphasize the tools for programming, doing the exercises entails picking a Lisp-like language to use. It seems like some implementation of Scheme would be the path of least resistance. On the other hand, I hear of others who have used Common Lisp and Clojure. It seems to me that Common Lisp or Clojure would be more likely to be used in production code, and therefore slightly better for my resume. BTW, I fully get the argument that learning a language is worthwhile for its own sake, but learning a language that helps my resume is still a benefit. I'm a capitalist and an academic about my learning.

If you had to self-study SICP, which language would you pick and why? Ideally, I would like to use a language that can run on the JVM. I can certainly work with a language where REPL works with bash and emacs.

ADDITION: have any of you tried reading SICP without using Scheme? If so, what was your experience like?

Alan
  • 7,066
  • 5
  • 30
  • 38

18 Answers18

41

Use Scheme. It is one of the simplest and easiest languages in existence, and you will spend very little time learning enough of it to understand SICP. Once you understand SICP, you will see how the concepts apply in any language.

Andru Luvisi
  • 24,367
  • 6
  • 53
  • 66
22

Use DrScheme. As others have said, Scheme is a simple language, and DrScheme is a great environment to use it in which has a lot of support and mediocre-to-good documentation.

Claudiu
  • 224,032
  • 165
  • 485
  • 680
  • Downloaded it last night, and its UI looks super simple to use. – Alan Oct 27 '08 at 22:23
  • 4
    Alan, don't forget to use the SICP support available from PLaneT (user contributed libaries for PLT Scheme/DrScheme). http://planet.plt-scheme.org/package-source/neil/sicp.plt/1/13/planet-docs/sicp/index.html – soegaard Jun 13 '09 at 10:52
  • 3
    DrScheme is now known as DrRacket http://en.wikipedia.org/wiki/DrRacket – Tim McNamara Nov 12 '10 at 05:19
9

Not a direct answer but I expect this information to be useful for anyone working through SICP. Be sure to have a look at the videos here:

http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/

There are 20 episodes of an hour each. They were presented by Abelson and Sussman in 1986 for Hewlett Packard employees. I put them on my iPod and watched them while commuting. Fascinating.

Also, the full text of the book is available online at http://mitpress.mit.edu/sicp/

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
5

As someone who hires people, I'll tell you that having Scheme on a resume is a good thing. Having Scheme, SML, Ocaml or Haskell on your resume suggests you are a very well rounded programmer, and quite a thinker.

That said, if you are trying for functional programming, why not Haskell instead? Scheme is multiparadigm, it can be OO, Funcitonal, Streams based, or anything else under the sun. This makes it awesome to try out new programming styles and paradigms, but if your goal is strictly functional, it can be a problem. (You will end up writing non functional code and not realizing it.)

Jonathan Arkell
  • 10,526
  • 2
  • 24
  • 32
4

I agree that you should just use Scheme. However, if you really have the itch to use Common Lisp or Clojure, I'd pick the latter. Scheme and Clojure are both Lisp-1s, so the code in the book will be more congruent between the two (except for tail calls, but if you understand how to compensate you'll be fine). Common Lisp is a Lisp-2 and will probably obscure the beauty of what SICP is trying to teach you.

drewr
  • 1,778
  • 1
  • 16
  • 20
  • By the way solve the tail-calls optimization problem in Clojure is recur: http://clojure.org/special_forms#toc10 (and to ask Sun to implement them in the JVM, where they should be) – Pablo Fernandez Nov 26 '08 at 14:36
3

The code in the book is Scheme so you'll have to read it anyways - you might as well write it. You might even like it!

Kyle Cronin
  • 77,653
  • 43
  • 148
  • 164
3

To get real value out of the book you'll have to use Scheme. Which implementation of scheme depends on your current environment:

Windows - Dr Scheme (PLT Scheme) - http://download.plt-scheme.org/ Linux - If this is a remote account - you may consider MZScheme (PLTScheme) (http://download.plt-scheme.org/) otherwise you'll want to use Dr Scheme if this is a local instance of Linux.

hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • I would also add MIT Scheme to that list. They seem to have a good (if large) interpreter. (bonus (points) (wrote MIT (the book))) – new123456 Feb 22 '11 at 21:45
3

I think Clojure fits what you want to do just perfectly. It's much more functional than Scheme because the data structures are immutable and it can be very useful as it runs on the JVM. But, be aware that you'll end up learning Scheme anyway to be able to understand the code in the book.

Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
2

I've caught the bug to learn functional programming for real.

From what I've heard, SICP is about a lot more than just functional programming.

grettke
  • 1,407
  • 7
  • 10
2

Caveat: I have not read the whole book

Since the examples rely on closures and continuations, you would be better served by using a language with both of those features, otherwise you would need to implement them yourself.

For example, writing a metacircular evaluator in Scheme leverages the fact that Scheme provides closures and continuations.

grettke
  • 1,407
  • 7
  • 10
2

I used lua when I had a look at sicp

works out pretty well

Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156
  • I'm trying to do so as well. I know Lua lacks full continuation and macro. Are those missing pieces critical for SICP (especially for the last several chapters)? Or is there any other missing piece I haven't been aware of? – Middleware Dec 11 '12 at 14:36
  • no, not really. Some things you have to approach a little differently because the syntax is different, but the solutions often look very similar. – Keith Nicholas Dec 11 '12 at 19:14
2

Use anything but scheme.

While using something else then scheme, you will be encouraged to think more, and avoid temptation to just retype the examples. It is a good thing.

Of course, it has to be similar enough, in lisp-1 sense, so clojure and arc are good to go.

Marko
  • 30,263
  • 18
  • 74
  • 108
  • 2
    I disagree. Maybe that might be true with other textbooks, but I've personally found SICP's exercises to be much more than simply copying an example earlier. – Kyle Cronin Oct 28 '08 at 03:30
  • I think it goes both ways, there's something to be said about using Scheme to stick close to the source, but switching to something a bit different but with similarities (another lisp dialect) does make you consider problems in different ways. – Runevault Nov 06 '08 at 20:30
2

While you could use something other than Scheme, you'd be needlessly adding extra work and possibly cutting yourself off from fully understanding what the book is about. SICP was an introductory programming book. It is a stepping stone to deeper topics in computer science. Getting bogged down in 'translating' from Scheme to CL or Clojure would probably obscure the finer points. That would be a shame, because SICP is truly a gateway to understanding what programming is really about.

Learning Scheme is really straight forward (especially compared to both CL and Clojure) and, in fact, the introductory course as well as the book, assumes the student doesn't know it already. CL and Clojure carry considerable baggage relative to the task at hand.

Eric Smith
  • 21
  • 2
2

I have used scheme for my self-study. The best way to learn from SICP is to do all the exercises relegiously.

I have used Gnu guile for scheme.

weima
  • 4,653
  • 6
  • 34
  • 55
1

I hear of others who have used Common Lisp and Clojure.

You should use whatever language most motivates you, but 99% of folks working through SICP are going to use Scheme.

grettke
  • 1,407
  • 7
  • 10
1

I worked through (most) of it earlier this year, and used Common Lisp, simply because I didn't have Scheme available (don't ask).

As has already been noted, Scheme is a Lisp-1 language whereas Common Lisp is a Lisp-2. There are enough differences between the languages to mean that you have think carefully about translating the code in the book, so it forced me to really get to grips with the material.

inglesp
  • 3,299
  • 9
  • 32
  • 30
0

but learning a language that helps my resume is still a benefit.

You should try using VB6 or COBOL, then, as there is a lot of billing work out there for it.

grettke
  • 1,407
  • 7
  • 10
  • Yes COBOL programmers will still be needed, but ... this is a question about functional programming not about COBOL. – Alan Oct 27 '08 at 04:50
  • 1
    @Alan: I'm guessing that this reply was meant as sarcasm :) – Ovid Oct 27 '08 at 12:11
0

I think Scheme would be the natural choice (since it is the "native" language of SICP)

However, since the true value of SICP comes from the concepts rather than the mechanics of the particular language, I think it would be a valuable learning exercise to attempt it in any Lisp-like language. I've personally tried some of the exercises in Clojure and they all translate pretty well.

For those interested there is an ongoing project to create a Clojure translation of SICP.

mikera
  • 105,238
  • 25
  • 256
  • 415