Macro: IN

Documentation

tests if 'obj' is in the list of 'choices' use: (in obj 'a 'b 'c ...) expands into: (or (eql obj 'a) (eql obj 'b) ...)

Source

(defmacro in (obj &rest choices)
  "tests if 'obj' is in the list of 'choices'
   use: (in obj 'a 'b 'c ...)
   expands into: (or (eql obj 'a)
                     (eql obj 'b)
                     ...)"
  (with-gensyms (insym)
    `(let ((,insym ,obj))
      (or ,@(loop for c in choices
		  collect `(eql ,insym ,c))))))
Source Context