4

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.

Amit
  • 861
  • 1
  • 9
  • 18
  • If you can't be more specific than "didn't get that well", it's unlikely that anyone will be able to help. Did the installation fail? Did installation succeed, but `(require sicp-pict)` in the REPL fails? Did both succeed, but using anything in `sicp-pict` fails? Something else? – molbdnilo Oct 06 '16 at 11:00
  • (require sicp-pict) fail in repl. Here is an error : ```> (require sicp-pict) stdin::9: sicp-pict: standard-module-name-resolver: collection not found collection: "sicp-pict" in collection directories: /home/rishi/.racket/5.3.6/collects /usr/share/racket/collects in: sicp-pict context...: standard-module-name-resolver /usr/share/racket/collects/racket/private/misc.rkt:87:7``` – Amit Oct 06 '16 at 11:51
  • Possible duplicate of [Which lang packet is proper for SICP in Dr.Racket?](http://stackoverflow.com/questions/19546115/which-lang-packet-is-proper-for-sicp-in-dr-racket) – Sylwester Oct 06 '16 at 12:04

3 Answers3

2

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.

xuesheng
  • 3,396
  • 2
  • 29
  • 38
1

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?

John Clements
  • 16,895
  • 3
  • 37
  • 52
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.

Community
  • 1
  • 1
Sylwester
  • 47,942
  • 4
  • 47
  • 79