2016-10-19 21:34:59 +00:00
|
|
|
(defun range (min max) (loop for n from min below (+ max 1) by 1 collect n))
|
2016-10-19 06:02:57 +00:00
|
|
|
(defun sum (list) (apply '+ list))
|
|
|
|
(defun select (expr list) (remove-if-not expr list))
|
2016-10-19 21:34:59 +00:00
|
|
|
(defun filter (expr list) (remove-if expr list))
|
|
|
|
|
|
|
|
(defun partial (func &rest args1)
|
|
|
|
(lambda (&rest args2)
|
|
|
|
(apply func (append args1 args2)))
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun prime (n)
|
|
|
|
(eq (length (member T (mapcar (lambda (a) (eq (mod n a) 0)) (range 2 (sqrt n))))) 0)
|
|
|
|
)
|