问题
I'm newbie in programming world. I'm using ubuntu OS. I have started my journey with sicp book. I'm working with scheme repl
. But suddenly I get stuck with section 2.2.4
I'm not able to execute it's example with scheme repl
. I tried to run given example of section, I got an error as given below
1 ]=> (define wave2 (beside wave (flip-vert wave)))
;Unbound variable: wave
Even In book, painter is given as primitive procedure. when I ran it, it thrown an error too
1 ]=> painter
;Unbound variable: painter
I don't know, where I'm doing mistake? can I run these example with scheme repl?
I have installed racket to solve this problem, But I'm not able to install sicp package for it. I was following these instruction. Unfortunately I didn't get that well. How can install these package?
Please give your suggestion to solve this problem.
回答1:
You are using an old version of DrRacket. You need to upgrade DrRacket in order to install the sicp package.
If you cannot upgrade to a more recent version you should try the laternative, that is to use the planet package version of SICP. Look at my answer on how to use SICP with DrRacket for both new and old versions of Racket.
回答2:
There are a couple of things you probably need to do, here.
First: you need to install the sicp
package. You can do this from the command-line, as other posts indicate, but the easiest way is probably to use DrRacket's package manager. Fortunately, the documentation for the sicp package describes how to do this:
http://docs.racket-lang.org/sicp-manual/index.html
After installing the sicp package, it sounds like the right solution is to use the "Racket Language" language, and start your file with
#lang sicp
Again, the documentation for the sicp package goes into a bit more detail here.
Let us know if this doesn't work!
EDIT: are you perhaps using a very old version of DrRacket? Pre-6.2, say?
回答3:
Use DrRacket to install the sicp package like this:
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"
Finally click the "Install" button.
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)
The expected output is 43.
来源:https://stackoverflow.com/questions/39892793/how-to-install-sicp-package-module-in-racket