From 90744af0fec0148a48141cb1490240641ef3b386 Mon Sep 17 00:00:00 2001 From: Marco Baringer Date: Thu, 29 Nov 2012 10:25:27 +0100 Subject: [PATCH] Removed if-bind and aif since these are already in alexandria and we're depending on alexandria anyway --- src/test.lisp | 10 ++++++++-- src/utils.lisp | 26 +++----------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/test.lisp b/src/test.lisp index defb357..02296c1 100644 --- a/src/test.lisp +++ b/src/test.lisp @@ -90,12 +90,18 @@ is compiled." `((with-fixture ,name ,args ,@body-forms))) body-forms)))) `(progn - (register-test ',name ,description ',effective-body ,suite-form ',depends-on ,compile-at ,profile) + (register-test :name ',name + :description ,description + :body ',effective-body + :suite ,suite-form + :depends-on ',depends-on + :compile-at ,compile-at + :profile ,profile) (when *run-test-when-defined* (run! ',name)) ',name)))) -(defun register-test (name description body suite depends-on compile-at profile) +(defun register-test (&key name description body suite depends-on compile-at profile) (let ((lambda-name (format-symbol t "%~A-~A" '#:test name)) (inner-lambda-name diff --git a/src/utils.lisp b/src/utils.lisp index d23aff7..87e8e0a 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -55,26 +55,6 @@ current list of values." (return-from item))))) (mapcar #'funcall (mapcar #'cdr collectors)))) -;;;; ** Anaphoric conditionals - -(defmacro if-bind (var test &body then/else) - "Anaphoric IF control structure. - -VAR (a symbol) will be bound to the primary value of TEST. If -TEST returns a true value then THEN will be executed, otherwise -ELSE will be executed." - (assert (first then/else) - (then/else) - "IF-BIND missing THEN clause.") - (destructuring-bind (then &optional else) - then/else - `(let ((,var ,test)) - (if ,var ,then ,else)))) - -(defmacro aif (test then &optional else) - "Just like IF-BIND but the var is always IT." - `(if-bind it ,test ,then ,else)) - ;;;; ** Simple list matching based on code from Paul Graham's On Lisp. (defmacro acond2 (&rest clauses) @@ -96,9 +76,9 @@ ELSE will be executed." (defun binding (x binds) (labels ((recbind (x binds) - (aif (assoc x binds) - (or (recbind (cdr it) binds) - it)))) + (if-let (value (assoc x binds)) + (or (recbind (cdr value) binds) + value)))) (let ((b (recbind x binds))) (values (cdr b) b)))) -- 1.7.10.4