Search code examples
emacslispracketsicp

which Lisp dialect should I use and *how* should I get started for SICP? I use Dr. Racket & know a little Racket


I've been working with Dr. Racket (just started) for the "Programming Languages" MOOC on Coursera through University of Washington. So I'm just starting to learn the Racket language. In tandem with that I'd like to start reading SICP and watching the lecture videos on MIT OCW from 1986. I'm wondering what dialect of Lisp I should use so I'll be able to have a fairly seamless experience going from the video lectures on MIT OCW to Emacs or Dr. Racket. [That's essentially my question]. What would people recommend? Especially people who have watched the 1986 lectures, have read SICP cover to cover and worked at least some exercises, and ideally also are familiar with Dr. Racket, Racket and possibly multiple dialects of Lisp and Scheme but I'm open to all opinions.


Solution

  • I read through SICP and did all the exercises using PLT Scheme, although back then it was called Dr Scheme rather than Dr Racket. And I'd recommend it whole-heartedly. EMACS is great (my main editor), but learning it is harder than learning scheme. And it's best to have only the one problem to solve.

    I used R4RS scheme, which was closest to the version in SICP.

    If that's still in the latest version then you should be fine. If not then just about anything calling itself scheme will do.

    I think you won't hit that many problems using Racket itself until chapter 3, where they start using things like set-car!, but if you get that far you'll probably be able to work out what's going on yourself by then.


    Edit:

    Just to check, I've just tried it on my Debian box: R4RS is missing, but R5RS should be fine.

    $ sudo apt-get install plt-scheme
    

    Windows install should be easier, since ease of use is Windows' selling point...

    Run Dr Racket

    $ drracket
    

    DrRacket version 5.3.6 says 'No language chosen' Navigate to:

    Language/Choose Language/Other Languages/Legacy Languages/R5RS
    

    type:

    (define (factorial n)
      (if (< n 2) 1
          (* n (factorial (- n 1)))))
    

    into the top window

    Press Run

    type:

    (factorial 10)
    

    into the bottom window and press return, and it should give you

    3628800
    

    That's hello world for Scheme, and if you can get that working then you should be ok for the first chapters of the book.

    As I remember there was a recursive graphics exercise somewhere which was a bit of a sod to get working, but it can be done. Just skip over it. Everything else should be fine.

    If you run into any trouble get in touch and I'll show you how to get through it.

    Good luck!