Subject: Re: builtin for generating list?
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 16 May 2008 06:57:37 -0500
Newsgroups: comp.lang.lisp
Message-ID: <-r2dncPr3b0s67DVnZ2dnUVZ_oWdnZ2d@speakeasy.net>
GP lisper  <spambait@clouddancer.com> wrote:
+---------------
| <rpw3@rpw3.org> wrote:
| ><philip.armitage@gmail.com> wrote:
| >| (defun range (start end &optional (step 1))
| >|   (loop for n from start below end by step collect n))
| >| (mapcar (lambda (x) (* x x x)) (range 1 101 2))
| > +---------------
| >
| > Here's mine, which is *very* similar but with a slightly different
| > signature which better matches the way I tend to use it:
| >     (defun iota (count &optional (start 0) (step 1))
| >       (loop repeat count for i upfrom start by step collect i))
| >     (mapcar (lambda (x) (* x x x)) (iota 100 1 2))
| 
| Since there are only 50 steps between 1 and 101, I think I like the
| start-end-step version a bit more.
+---------------

Ah, yes, That should have been (IOTA 50 1 2), of course.
Thanks for the catch.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607