I am reading On Lisp and cannot make out why the code below has use a quote. Here is the excerpt from the text:
Another character combination reserved for the user is #[. Figure 17.3 gives an example of how this character might be defined as a more elaborate kind of left parenthesis. It defines an expression of the form #[x y] to read as a list of all the integers between x and y, inclusive:
#[2 7] (2 3 4 5 6 7)
Figure 17.3: A read-macro defining delimiters.
(set-macro-character #\] (get-macro-character #\))) (set-dispatch-macro-character #\# #\[ #'(lambda (stream char1 char2) (let ((accum nil) (pair (read-delimited-list #\] stream t))) (do ((i (ceiling (car pair)) (1+ i))) ((> i (floor (cadr pair))) (list 'quote (nreverse accum))) (push i accum))))) Figure 17.3: A read-macro defining delimiters.
I do not understand why the line in the result form for the do**is **(list 'quote (nreverse accum))) rather than (nreverse accum). Because we can run the code which does not using quote below without problem, right?
(let ((acc nil))
(do ((i 2 (1+ i)))
((> i 7)
(nreverse acc))
(push i acc)))
Does any one know the trick here?