More constants
There are some other notations that might be useful occasionally, and are
probably different from most other languages. We'll also look at the special
cases mentioned above. These examples are certainly EuLisp specific, but
similar denotations will probably be defined in most Lisps you encounter.
- #o345
- denotes the base eight integer value
three-four-five, which is two hundred and twenty-nine in decimal.
- #xa1b
- denotes the base sixteen integer value a-one-b,
which is two thousand five hundred and eighty-seven in decimal.
- #36rz
- denotes the base thirty-six integer value z,
which is thirty-five in decimal. Denoting digits in a base higher than 36
is awkward.
- #\newline
- is an example of a special character,
namely the one denoting the newline character. EuLisp defines several
special characters:
-
#\alert
-
#\backspace
-
#\delete
-
#\formfeed
-
#\linefeed
-
#\newline
-
#\return
-
#\tab
-
#\space
-
#\vertical-tab
The result of printing anyone of these characters is implementation
defined, but should be predictable from the names.
#\alert
will probably make your terminal go
beep.
- #\x0000
- denotes the character at position zero in
the current character set. The position is specified in hexadecimal.
- "a\nb"
- is a string containing the three characters
a-newline-b. In fact, any of the above special characters can be included
in a string by the sequence
\
x, where
x is the initial character of the name of the special character,
for example \t
denotes a tab character in a string.
- "a\x0000b"
- is a string containing the three
characters a, the character at position zero in the current character set,
and b. Thus any character can be encoded in a string by using its index
position in the implementation-defined character set.