thor
thor

Reputation: 22490

How to find which module to require for a racket symbol?

When encountering an unbound identifier error for a racket symbol, how should one find out which module to require for the symbol?

For example, I encountered the following error while execute a racket file (as of 8.6):

....rkt:39:17: symbol=?: reference to an unbound identifier
;   at phase: 1; the transformer environment

I tried (help symbol=?), which correctly led me to its documentation page, on "Section 4.2 Booleans". But how can I tell which module to import so that I can have symbol=??

I tried

(require (for-meta 1 racket/base))

but the error remains.

Upvotes: 2

Views: 59

Answers (1)

Martin Půda
Martin Půda

Reputation: 7568

You can get that information from DrRacket Docs- when you search for any symbol, you will see a list of packages/ libraries that provide it.

Look at the results for symbol=?. The most straightforward solution is to use #lang racket (at the beginning of the code) or (require racket/bool).

This is even written in "Section 4.2 Booleans"- there are symbols boolean?, not and immutable?, followed by "4.2.1 Boolean Aliases":

(require racket/bool)
package: base The bindings documented in this section are provided by the racket/bool and racket libraries, but not racket/base.

Upvotes: 2

Related Questions