#| Simple program to illustrate recursive processing. Look to see if some symbol is in a list. |# (setf our-list '(The other two slight air and purging fire Are both with thee wherever I abide The first my thought the other my desire These present-absent with swift motion slide For when these quicker elements are gone)) (defun word-present (word l) ; <-- Note: "l" as in list, not 1 as in 1,2,3 (cond ((null l) 'not-present) ; On the condition that the list is empty BASE CASE ((equal word (first l)) 'yes-present) ; If the first word is what we are looking for, PRESENT, BASE CASE (t (word-present word (rest l))))) ; Otherwise look in the remainder of the list. RECURSIVE CASE (format t "~%To run: (word-present 'desire our-list) and (word-present 'elephant our-list)~%") #| Output: CL-USER(41): (word-present 'desire our-list) YES-PRESENT CL-USER(42): (word-present 'elephant our-list) NOT-PRESENT |#