Nadim Hussami
Nadim Hussami

Reputation: 359

Use SICP collection for racket from the command line

I've successfully installed the SICP package for DrRacket; and I tested it by using the inc operator in the GUI. I followed the instructions here.

However, when I run racket in bash, using the inc operator gives me an error.

Welcome to Racket v6.6.

> (inc 42)

inc: undefined; cannot reference undefined identifier context...: /usr/share/racket/collects/racket/private/misc.rkt:88:7

Clearly, I haven't installed it properly. So what do I do?

EDIT 1: Additionally, the 1+ and the -1+ operators give a similar error, for both DrRacket's GUI and racket in bash.

Upvotes: 2

Views: 1257

Answers (1)

Sylwester
Sylwester

Reputation: 48745

Looks like you forgot to include the sicp collection:

~$ racket -l sicp --repl
Welcome to Racket v6.6.
> (inc 4)
5

You can also just start racket normally and evaluate (require sicp) before doing any SICP stuff:

~$ racket
Welcome to Racket v6.6.
> (require sicp)
> (inc 4)
5

Upvotes: 5

Related Questions