I'm trying with SICP and I got some code. So I started with:
#lang scheme
(word 'comp 'uter)
Returned error: Function (word) undefined.
Even if I tried to copy this into IDE(Run):
(define word?
(let ((number? number?)
(symbol? symbol?)
(string? string?))
(lambda (x)
(or (symbol? x) (number? x) (string? x)))))
Still the same.
I think it may be certain problem with version of language or else.
Above are from "Simply Scheme" and when I introduce code exactly in SICP:
(define (sqrt x)
(sqrt-iter 1.0 x))
IDE returned sqrt-iter
undefined. The code can be found in chapter one: http://mitpress.mit.edu/sicp/code/index.html
In DrRacket there is a SICP compatibility language
In the documentation there is an easy guide to how it's installed from DrRacket:
Open the Package Manager: in DrRacket choose the menu "File" then choose "Package Manager...".
In the tab "Do What I Mean" find the text field and enter: "sicp"
Click the "Install" button. This produces lots of output. Don't worry about it even when there are warnings.
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.
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.
raco pkg
didn't workIn 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))))