This page is humor, and should not be mistaken for a real source of information. See Annotations for Infrequently Asked Questions if you want to spoil the jokes for yourself, some of which are actually funny.
Can we write something like Infrequently Asked Questions in comp.lang.c [warning: this document requires very good C knowledge to catch all jokes in it] for CL? Maybe it is not possible to write it for CL due to nature of language but it might be interesting to try and identify parts that can to make things better and to have fun of it.
Document conventionsSource code is written in
monospaced font. Prompts look like
, etc.) and results are written after
Section 1, symbols and numbers
Q: What is difference between
A: The first is composed of three characters, the second isn't.
Q: Seriously, can
() be unequal?
A: Ok, seriously.
() will always make
nil (with exception of abusing the read macros).
Nil can be equal to
Q: How can be that
nil is same symbol?
nil is special constant that always evaluate to same symbol.
Q: How can I enter numbers in hexadecimal?
A: You can enter numbers in hexadecimal after this trick:
(setq *read-base* 16)
Q: What's wrong with changing read base back to decimal in this way:
(|setq| |*read-base*| 10)
A: You need to write it in upper-case.
Q: What's a 'special variable'?
A: Some variables have values that must be accessed very quickly. They are stored in memory that is connected to the CPU by a high speed datapath called 'the short bus'. Special variables ride the short bus.
Section 2, Evaluation and functions
Q: Why does
(READ-FROM-STRING "foobar" :START 3) return
FOOBAR instead of
A: Real reason is that there are actually two starts. The first is ignored. Write it this way:
(READ-FROM-STRING "foobar" :START 3 :START 3)
Q: Why I can't
A: Contrary to what your mathematicians say,
OR are not functions.
Q: What does it mean that
OR, and some others are short-circuiting?
A: This is jargon taken from electronics. i.e. When you have two AND gates that have outputs connected, they may short circuit depending on inputs.
Q: Why does
(sort my-variable) not update the variable?
A: Default calling convention in Common Lisp is call by value, it cannot modify arguments passed in. Try to find a compiler switch to make it call by reference.
Q: What is faster,
list-length. Just compare the speed of the following expressions:
Section 3, Historical facts
Q: Why are some basic functions named in such a weird way (I mean
MAPCAR, and so on)?
A: There is a reason for it. The designers of lisp were actually very much in a hurry when they designed it. They needed to release version 1.5 to the market very soon. Due to lack of imagination they had problems thinking out the names so they just looked at things around them, and used their names or abbreviations as identifiers (hint: CDR is a relatively unknown car manufacturer, that also explains the old joke "My other CAR is CDR"). Rumors that
CDR have something to do with registers are complete nonsense.
Q: What is CDR coding?
A: CDR coding is a programming style where programs looks like this (incomplete) example:
Q: Is CDR coding useful?
A: Programs written in CDR coding style may be faster, especially on hardware with CDR coding support.
Section 4, ANSI standardization
Q: People keep saying the behavior is undefined, but I just tried it on an ANSI-conforming compiler, and got the results I expected.
A: They were probably wrong. Flame them mercilessly. Be sure before you do that your compiler is really ANSI conforming, though. If it turns out you were wrong, they get a legal claim on your first-born.
Note the similarity of the question and the answer to one found in C language Infrequently Asked Questions. This one is really common to all standardized languages.
Section 5, Performance
Q: I have heard that Java is slower than Common Lisp
A: Languages don't have speed. Their implementations, however, do. We have found most Common Lisp implementations to be slower than Java. See the following Java code:
myloopfunction must be compiled):
Add more if you know. -jtra