0On Fri, Apr 30, 2010 at 8:41 PM, Michał Marczyk
<[email protected]>wrote:

> That will overflow the stack when you do, say,
>
> (last (apply pairup (range 20000)))
>


> That can be fixed by wrapping (cons ...) in lazy-seq.
>

Sure.  Laziness good.


Another version:
>
> (defn pairup [& args]
>  (map vector args (rest args)))
>

Nope, that doubles the middle elements:

user=> (pairup 1 2 3 4)
([1 2] [2 3] [3 4])


-- 
Mark J. Reed <[email protected]>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to