Constants
Many constants in Lisp look very much like constants in other programming
languages. Some constants are peculiar to Lisp. Here are some examples:
- ()
- denotes the empty list.
- ""
- denotes the empty string.
- "hello"
- denotes the string comprising the characters
h-e-l-l-o. You can put all the usual characters, such as 'a'...'z', 'A'...'Z',
'0'...'9' and many of the other characters you can type on your keyboard
in a string.
- #\a
- denotes the character
a
. In
general, a character is denoted by
#\
name, where name is
the name of the character, such as a
,
b
, %
, or 2
.
- #()
- denotes the empty vector.
- #(1 () 3.1)
- denotes the vector of three elements: the
integer value one, the empty list and the floating point value three point
one. Note that the elements of vectors do not have to be of the same
type, unlike many other languages.
- 123
- denotes the integer value one hundred and
twenty-three. Just like in many other programming languages, only a
subset of the integers is usually supported. The actual largest value is
implementation-defined. Some Lisp systems allow for arbitrarily large
integer values.
- 6.718
- denotes the floating point approximation to the
real value six point seven one eight.
- 67.18e-1
- denotes the same value as immediately above,
but shows that scientific notation looks just like it does in other
languages.