See it run
(define else 5)
elseObserved result
5else is not a reserved word. It only means something at the head of a cond, case, or guard clause, so using it as a name is accepted. (define include 1), on the other hand, is rejected with E120. include is an ordinary English word that invites use as a variable, and it sits on the forbidden list.
How to reason about it
- Binding a reserved word is E110. Rename the variable.
- A forbidden form in code position is E120, whether you bind it or call it. Quoted data is not code, so
'includeis an ordinary symbol. - Notations the reader rejects never reach normalization.
- Some notations you learned in another Lisp are simply absent here. A few have no diagnostic, so read the list below.
The twenty-seven names you cannot bind
Put any of these in a define, a let, or a parameter list and you get E110.
| Group | Names |
|---|---|
| quoting | quote quasiquote unquote unquote-splicing |
| core | lambda if begin set! define |
| binding | let let* letrec |
| branching | cond case guard and or when unless do |
| modules | module export import |
| values and control | values call-with-values call/cc dynamic-wind |
The four on the last row are reserved words and procedures at once, so they can be referenced as values. The other twenty-three name forms only, and standing alone in value position they are an error.
The twelve forms you cannot use
| Form | What to use instead |
|---|---|
| define-syntax syntax-rules syntax-case let-syntax letrec-syntax | there are no user macros. Solve it with procedures |
| define-values let-values let*-values | call-with-values |
| define-library include include-ci include-library-declarations | module, and joining the files yourself |
The name in code position is enough for E120. Quoted data is not code, so 'include is an ordinary symbol.
Notations the reader rejects outright
| Notation | Result |
|---|---|
#; datum comment | E120 |
#lang directive | E120 |
[ ] { } | E100, with a message of its own |
Notations that do not exist
- The
condarrow clause=>is unsupported and raises E130. Thecasearrow clause has no diagnostic at all, so=>reads as a name and raises E300. - A parameter list written as a bare name with no parentheses, as in
(lambda args ...), is E130. To gather arguments, write(lambda (x . rest) ...)or(define (f . xs) ...). - Datum labels
#0=and#0#do not exist. E100. - There are no
#!reader directives. E100. There is no notation at all for declaring something at the top of a file. - The radix and exactness prefixes
#x#b#o#e#ido not exist. E100. - Pipe-quoted symbols like
|a b|do not exist.|is an ordinary character, so that reads as the two names|aandb|.
A common mistake
E110 and E120 both come from names, but they mean different things. E110 means you tried to cover something that exists. E120 means you called for something that does not.
Next steps
The exact shapes live in the core and derived form references, and the meaning of each code lives in the diagnostic catalog.