Search found 2 matches

by crabbe
Wed Jun 22, 2011 2:41 pm
Forum: Common Lisp
Topic: Pairing list elementes
Replies: 6
Views: 8159

Re: Pairing list elementes

(defparameter *y* '()) (defun make-point (list) (let ((x (cons (first list) (second list)))) (setf *y* (push x *y*)) (if (cddr list) (make-point (cddr list)) (progn (print (reverse *y*)) (setf *y* '()))))) This isn't a lispy-way to do this. Essentially you are collecting the result of the recursion...
by crabbe
Mon Jun 20, 2011 3:48 pm
Forum: Common Lisp
Topic: Finding the minimum element in a list
Replies: 15
Views: 28301

Re: Finding the minimum element in a list

Is there a reason you don't want to use apply?

* (defun select (l)
(apply #'min l))
SELECT
* (SELECT '(1 2 3))
1
* (select '(3 1 2))
1

-r