2007/7/23, Carl c.groner@gmail.com:
Wow, no takers, huh. With all the talk that has been going around about lisp lately, this list is surprisingly quiet.
Uhm... I liked your solution, even though I'm a newbie. Thanks for submitting it, you helped me to learn some new functions. And yes, almost anyone is trying to solve the quiz (me included) but at least reading the few solutions of others is helping me a lot.
Off topic: I am reading Paul Graham's ANSI Common Lisp and I have a little question: why does he uses a lot (at least until chapter 4) "and" clauses when I think he should use the "when" macro? For example, in this code snip from figure 4.1:
;; This is a binary search algorithm as you may guess. (defun bin-search (obj vec) (let ((len (length vec))) (and (not (zerop len)) ;Here is the and clause that I may change for a when (finder obj vec 0 (- len 1)))))
(defun finder (obj vec start end) ...)
I've read that at least three times I think and it seems that there will be more. I know that the and clause gives the desired behavior of returning the last value that satisfies it or the first one that doesn't, but I would have used a when for some of the cases I've read (it is more readable for me, I think). Is he using the and clause for some reason that eludes me or is it just a personal taste? Thanks.