X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Futils.lisp;h=5cb702c6f385d79d8f045ecc1409f981b90ad943;hb=91fd1e39d4f509e13fcab3ce3a2dd5a17ddcdcc5;hp=41fe5f3676eb80c6641fbc399036e1eadfc5cf37;hpb=b3c22837d022f29e077bc65d74cc1b320c91ba65;p=jscl.git diff --git a/src/utils.lisp b/src/utils.lisp index 41fe5f3..5cb702c 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -16,6 +16,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with JSCL. If not, see . +(/debug "loading utils.lisp!") + (defvar *newline* " ") @@ -84,3 +86,10 @@ (defun float-to-string (x) #+jscl (float-to-string x) #-jscl (format nil "~f" x)) + +(defun satisfies-test-p (x y &key key (test #'eql) testp (test-not #'eql) test-not-p) + (when (and testp test-not-p) + (error "Both test and test-not are set")) + (let ((key-val (if key (funcall key y) y)) + (fn (if test-not-p (complement test-not) test))) + (funcall fn x key-val)))