Which lang packet is proper for SICP in Dr.Racket?

In DrRacket there is a SICP compatibility language

1. From the Package Manager

In the documentation there is an easy guide to how it’s installed from DrRacket:

  1. Open the Package Manager: in DrRacket choose the menu “File” then choose “Package Manager…”.

  2. In the tab “Do What I Mean” find the text field and enter: “sicp”

  3. Click the “Install” button. This produces lots of output. Don’t worry about it even when there are warnings.

  4. Test it. Make sure DrRacket has “Determine language from source” in
    the bottom left corner. Write the following program and click RUN:

    #lang sicp 
    
    (inc 42) 
    ; ==> 43
    

Here is a more advanced test that uses the picture language, which needs to be included with #%require:

#lang sicp
(#%require sicp-pict)

;; paint-hires / paint-hi-res renamed to just paint
(paint (below (beside diagonal-shading
                      (rotate90 diagonal-shading))
              (beside (rotate270 diagonal-shading)
                      (rotate180 diagonal-shading))))

Click RUN and you should see a square in the interactions window that gets brighter towards the center.

2 Command line installation

Alternatively, you can also do step 1-3 from a terminal/shell by running the following:

raco pkg install sicp

From here you do step 4. in the first installation instruction to test it.

3. Older versions or DrRacket using planet if the raco pkg didn’t work

In DrRacket there is also an old version of SICP compatibility language. While having bottom left select box at “Determine language from source” You may just add:

#lang planet neil/sicp

as the only line in the definitions (top text area) and press RUN and it will be installed. Restart DrRacket and you’ll find it available in the language drop down. Good luck.
You might get lots of error messages in red. Just ignore it and restart DrRacket. You might not find the choice in the language menu anymore, but by starting every file with #lang planet neil/sicp it still works as a module language.

Judging from the errors, it seems to relate to the picture language module. I tested this sniplet and it still works:

(paint-hires  (below (beside diagonal-shading
                             (rotate90 diagonal-shading))
                     (beside (rotate270 diagonal-shading)
                             (rotate180 diagonal-shading))))

Leave a Comment