On Feb 13, 2014, at 14:31 , Michael Gardner <gardne...@gmail.com> wrote:
> On Feb 13, 2014, at 08:56 , Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > >> No. Clojure's `apply` is lazy. Varargs are passed to the >> function as a lazy sequence, and it's up to the function to >> realize them or not. > > It's worth noting (for people who might try to rely on that laziness) that > apply will always realize its first four arguments. See > http://clojurian.blogspot.com/2012/11/beware-of-mapcat.html On further examination, I don't think this is correct. user=> (defn f [x] (println x) x) #'user/f user=> (defn s [n] (lazy-seq (cons (f n) (s (inc n))))) #'user/s user=> (defn myfn [& args] nil) #'user/myfn user=> (apply myfn (s 0)) 0 1 nil I can't explain why exactly two of the elements in (s 0) are being realized here, but in any case my claim seems to be wrong. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.