Browse Source

Made more understandable

Samuel W. Flint 8 years ago
parent
commit
5c6da68950
1 changed files with 10 additions and 5 deletions
  1. 10 5
      derive2.lisp

+ 10 - 5
derive2.lisp

@@ -45,11 +45,16 @@
        ',name)))
 
 (defun get-expansion (expression)
-  (let (expansion-function)
-    (loop for (name test expander) in *rules*
-       do (if (apply test expression)
-              (setf expansion-function expander)))
-    expansion-function))
+  (first
+   (remove-if #'null
+              (map 'list
+                #'(lambda (nte)
+                    (let ((test (second nte))
+                          (expander (third nte)))
+                      (if (apply test expression)
+                          expander
+                          nil)))
+                *rules*))))
 
 (defun derive (function)
   (declare (cons function))