error function in lang sicp in DrRacket does not bound

384 views Asked by At

I use DrRacket 6.6 and use #lang sicp , everything looks good but the function error does not exist, it says:

error: unbound identifier in module in: error

Why?

1

There are 1 answers

5
Sylwester On

The documentation for the sicp package does not include the identifier error so it is not a part of the language #lang sicp. The purpose of the sicp package is to give a R5RS namespace with some of the books special bindings in addition, however there is no mention of a procedure or special form called error in the book.

Under the standard language in DrRacket, #lang racket, and under the current standard Scheme, #!r6rs, error is a procedure which can be used to signal an error (called exception in R6RS).

Adding only error from racket/base:

#lang sicp
(#%require (only racket/base error))

(error "some error") ; error gets thrown