This question is related to the Chapter 6 code of Conrad Barski's Book, Land of Lisp
.
The code is the following
(defun tweak-text (lst caps lit)
(when lst
(let ((item (car lst))
(rest (cdr lst)))
(cond ((eq item #\space) (cons item (tweak-text rest caps lit)))
((member item '(#\! #\? #\.)) (cons item (tweak-text rest t lit)))
((eq item #\") (tweak-text rest caps (not lit)))
(lit (cons item (tweak-text rest nil lit)))
((or caps lit) (cons (char-upcase item) (tweak-text rest nil lit)))
(t (cons (char-downcase item) (tweak-text rest nil nil)))))))
Now look at the (lit ..)
part and the stuff below it .. ((or caps nil) ..)
, so my question is the following
- if
lit
is ever true, it will be will be evaluated in the former expression stated - if it is not true, the latter expression will always evaluate to
(or caps false)
=>(or caps false)
which is pretty much useless?
So shouldn't the latter expression simply be (caps (cons (char ...))
?
This book has been read by thousands so I must be wrong about something and I'm not John Bell.