[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nmap



Here is another version of an nmap macro that I think addresses the 
problems with length vs circular lists:

(defmacro nmap (seq fun &rest seqs)

  (let ((arglist (mapcar #'(lambda (dummy) (gensym)) seqs)) )
    `(let ((i 0)
	   (rseq ,seq) )
       (map nil
	    #'(lambda ,(cons (gensym) arglist)
	        (setf (elt rseq i) (funcall ,fun ,@arglist))
		(incf i) )
	    rseq ,@seqs )
       rseq )))

-------
Gregory Frascadore		
Computer Science Department 	frascado%umn-cs.csnet@csnet-relay.arpa
University of Minnesota		frascado@umn-cs