Lisp: Check If a Item Exist in a List

wrote this yesterday, when i want to know if a item exists in a list.

(defun sequence-to-alist (mySequence)
  "Take a sequence mySequence and returns a association list.
Each element's cdr is “t”.

Example:
 (sequence-to-alist (list 3 4 5)) ⇒ ((3 . t) (4 . t) (5 . t))

This function is useful when you need to check a element is in a list, using
`assoc' without loading CL library."
  (mapcar (lambda (ξx) (cons ξx t) ) mySequence))

ends up not using it. But, i think even if i need it, i probably should just use whichever is in the CL package. Btw, of you Common Lisp coders, what function would it be?

Answer: there's a elisp function member. (thanks to Elias Mårtenson.)

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?