Unknown Use of Keyword Parameter
Posted: Thu Jan 07, 2010 2:47 pm
On the 5th line of code below, someone has used the keyword parameter named ":all" in the body of the function definition. I am not accustomed to seeing it this way. I have used the code and it works. I just don't know why the 5th line is a valid equality test.
??
??
Code: Select all
(defun find-matching-chunks (chunk-spec &key (chunks :all))
(let ((found nil))
(cond ((not (chunk-spec-p chunk-spec))
(print-warning "~s is not a valid chunk-spec in call to find-matching-chunks." chunk-spec))
((eq :all chunks)
(dolist (chunk chunks)
(when (chunk-matches-spec chunk chunk-spec)
(push chunk found))))
found)
(t (print-warning "~S isa not a valid value for the :chunks keyword parameter to find-matching-chunks." chunks)))))