by machine words. However, you can use declarations to give Common Lisp information about the types of numbers you're using that will enable it to generate code that does only as much work as the code that would be generated by a C or FORTRAN compiler. Tuning numeric code for this kind of performance is beyond the scope of this book, but it's certainly possible.
111
While the standard doesn't require it, many Common Lisp implementations support the IEEE standard for floating-point arithmetic,
112
It's also possible to change the default base the reader uses for numbers without a specific radix marker by changing the value of the global variable *READ-BASE*
. However, it's not clear that's the path to anything other than complete insanity.
113
Since the purpose of floating-point numbers is to make efficient use of floating-point hardware, each Lisp implementation is allowed to map these four subtypes onto the native floating-point types as appropriate. If the hardware supports fewer than four distinct representations, one or more of the types may be equivalent.
114
'Computerized scientific notation' is in scare quotes because, while commonly used in computer languages since the days of FORTRAN, it's actually quite different from real scientific notation. In particular, something like 1.0e4
means 10000.0
, but in true scientific notation that would be written as 1.0 x 10^4. And to further confuse matters, in true scientific notation the letter 1.0e4
, is a completely different value, approximately 54.6.
115
For mathematical consistency, +
and *
can also be called with no arguments, in which case they return the appropriate identity: 0 for +
and 1 for *
.
116
Roughly speaking, MOD
is equivalent to the %
operator in Perl and Python, and REM
is equivalent to the % in C and Java. (Technically, the exact behavior of % in C wasn't specified until the C99 standard.)
117
Even Java, which was designed from the beginning to use Unicode characters on the theory that Unicode was the going to be
118
Note, however, that not all literal strings can be printed by passing them as the second argument to FORMAT
since certain sequences of characters have a special meaning to FORMAT
. To safely print an arbitrary string—say, the value of a variable s— with FORMAT
you should write (format t '~a' s).
119
Once you're familiar with all the data types Common Lisp offers, you'll also see that lists can be useful for prototyping data structures that will later be replaced with something more efficient once it becomes clear how exactly the data is to be used.
120
Vectors are called
121
Array elements 'must' be set before they're accessed in the sense that the behavior is undefined; Lisp won't necessarily stop you.