From: David Vázquez Date: Thu, 20 Jun 2013 12:26:53 +0000 (+0200) Subject: Merge branch 'master' of github.com:davazp/jscl X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=f9319021c1f4d35b7ee223bab96ffbe587f049b6;hp=c5584d88b18cedba257bf2958493b31ed62cd9e4;p=jscl.git Merge branch 'master' of github.com:davazp/jscl # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. --- diff --git a/src/numbers.lisp b/src/numbers.lisp index 3490df9..578d0b1 100644 --- a/src/numbers.lisp +++ b/src/numbers.lisp @@ -81,7 +81,7 @@ (macrolet ((def (name comparison) `(defun ,name (x &rest xs) (dolist (y xs) - (unless (,comparison x (car xs)) + (when (,comparison y x) (setq x y))) x))) (def max >) diff --git a/tests/numbers.lisp b/tests/numbers.lisp index 811d423..ae3ebb9 100644 --- a/tests/numbers.lisp +++ b/tests/numbers.lisp @@ -8,11 +8,13 @@ (test (= (max 1) 1)) (test (= (max 1 2 3) 3)) (test (= (max 3 2 1) 3)) +(test (= (max 1 2 3 4 5) 5)) ;;; MIN (test (= (min 1) 1)) (test (= (min 1 2 3) 1)) (test (= (min 3 2 1) 1)) +(test (= (min 9 3 8 7 6 3 3) 3)) ;;; EVENP (test (evenp 2))