From 2772e5a4eb948874d248ce0129ccd705d492d692 Mon Sep 17 00:00:00 2001 From: Owen Rodley Date: Sat, 18 May 2013 15:26:43 +1200 Subject: [PATCH] Rewrite FIND using SATISFIES-TEST-P --- src/sequence.lisp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 -- 1.7.10.4