From: Ken Harris Date: Mon, 17 Jun 2013 22:29:55 +0000 (-0700) Subject: Merge upstream. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=57b5128b148076b44a9f207b59b6b7702b5fcad9;p=jscl.git Merge upstream. --- 57b5128b148076b44a9f207b59b6b7702b5fcad9 diff --cc src/numbers.lisp index 66c2db8,dd09462..3490df9 --- a/src/numbers.lisp +++ b/src/numbers.lisp @@@ -59,24 -56,19 +56,22 @@@ (defun zerop (x) (= x 0)) (defun plusp (x) (< 0 x)) +(defun signum (x) + (if (zerop x) x (/ x (abs x)))) + - ;; TODO: Use MACROLET when it exists - (defmacro defcomparison (operator) - `(defun ,operator (x &rest args) - (dolist (y args) - (if (,operator x y) - (setq x (car args)) - (return-from ,operator nil))) - t)) - - (defcomparison >) - (defcomparison >=) - (defcomparison =) - (defcomparison <) - (defcomparison <=) - (defcomparison /=) + (macrolet ((def (operator) + `(defun ,operator (x &rest args) + (dolist (y args) + (if (,operator x y) + (setq x (car args)) + (return-from ,operator nil))) + t))) + (def >) + (def >=) + (def =) + (def <) + (def <=) + (def /=)) (defconstant pi 3.141592653589793)