14 lines
421 B
Common Lisp
14 lines
421 B
Common Lisp
(defun range (min max) (loop for n from min below (+ max 1) by 1 collect n))
|
|
(defun sum (list) (apply '+ list))
|
|
(defun select (expr list) (remove-if-not expr list))
|
|
(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)
|
|
)
|