X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Flist.lisp;h=7a4ca6d909dfd7c9ff98d5fac5b6e2dfeaf4b2db;hb=68cd2db6542fa3442d46b0331ecf8be8f86c09c2;hp=02d1984ff3930dbe3c89d7607e3fa8e609bc3a11;hpb=0c673afe782ea04c81cebee2a4060581ff99184d;p=jscl.git diff --git a/src/list.lisp b/src/list.lisp index 02d1984..7a4ca6d 100644 --- a/src/list.lisp +++ b/src/list.lisp @@ -263,3 +263,16 @@ (3rd y 2nd)) ;3rd follows 2nd down the list. ((atom 2nd) 3rd) (rplacd 2nd 3rd))) + + +(defun adjoin (item list &key (test #'eql) (key #'identity)) + (if (member item list :key key :test test) + list + (cons item list))) + +(defun intersection (list1 list2 &key (test #'eql) (key #'identity)) + (let ((new-list ())) + (dolist (x list1) + (when (member x list2 :test test :key key) + (push x new-list))) + new-list))