Commit 5d8fe2ce authored by Juergen Nickelsen's avatar Juergen Nickelsen
Browse files

optimized min and max down to half the cost; still broken

parent b32daf2e
;; fundamental predefined Lisp functions
;(debug t)
(defun max (&rest numargs)
(defun max (first &rest numargs)
"return the biggest of all (numeric) arguments"
(if (null (cdr numargs))
(car numargs)
(let ((a (car numargs))
(b (apply #'max (cdr numargs))))
(if (< a b)
b
a))))
(defun min (&rest numargs)
(if (null numargs)
first
(let ((next (apply #'max (cdr numargs))))
(if (< first next)
next
first))))
(defun min (first &rest numargs)
"return the smallest of all (numeric) arguments"
(if (null (cdr numargs))
(car numargs)
(let ((a (car numargs))
(b (apply #'min (cdr numargs))))
(if (< a b)
a
b))))
(if (null numargs)
first
(let ((next (apply #'min (cdr numargs))))
(if (< first next)
first
next))))
(defun apropos (match)
(sort (filter #'(lambda (sym) (re-match match (symbol-name sym)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment