Vegetarianboy30

out of ideas in lisp

Jan 20th, 2021
717
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defun list-intersection (L1 L2)
  2.   "Return a list containing elements belonging to both L1 and L2."
  3.   (cond
  4.    ((null L1) nil)
  5.    ((member (first L1) L2)
  6.     (cons (first L1) (list-intersection (rest L1) L2)))
  7.    (t (list-intersection (rest L1) L2))))
RAW Paste Data