From: Owen Rodley Date: Sat, 18 May 2013 03:26:43 +0000 (+1200) Subject: Rewrite FIND using SATISFIES-TEST-P X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=2772e5a4eb948874d248ce0129ccd705d492d692;p=jscl.git Rewrite FIND using SATISFIES-TEST-P --- diff --git a/src/sequence.lisp b/src/sequence.lisp index 8d2701b..2fe5108 100644 --- a/src/sequence.lisp +++ b/src/sequence.lisp @@ -33,14 +33,11 @@ (let ((,elt (aref ,nseq ,index))) ,@body)))))) -(defun find (item seq &key key (test #'eql)) - (if key - (do-sequence (x seq) - (when (funcall test (funcall key x) item) - (return x))) - (do-sequence (x seq) - (when (funcall test x item) - (return x))))) +(defun find (item seq &key key (test #'eql testp) (test-not #'eql test-not-p)) + (do-sequence (x seq) + (when (satisfies-test-p item x :key key :test test :testp testp + :test-not test-not :test-not-p test-not-p) + (return x)))) (defun find-if (predicate sequence &key key) (if key