On Sun, Jun 28, 2009 at 12:19 AM, Handkea fumosa<hfum...@gmail.com> wrote:
>
> user=> (doall
>  (for [x (range 2) y (range 2)]
>    (println x "@" y)
>    (* x y)))
>
> Expected:
>
> 0 @ 0
> 0 @ 1
> 1 @ 0
> 1 @ 1
> (0 0 0 1)
>
> Got:
>
> #<CompilerException java.lang.IllegalArgumentException: Wrong number
> of args passed to: core$for (NO_SOURCE_FILE:220)>
>
> Wrapping the body in an explicit "do" fixes it, but the need for an
> explicit "do" violates the convention for non-conditional binding
> forms -- ones like (let [binds] body), and (loop [binds] body), and so
> on.

That's true, it is different. But it is different also in yielding a
lazy seq. Prior to doseq acquiring similar nested iteration, use of
'for' for side effects, and not getting them, was a frequent problem
for people.

Now that doseq has similar capabilities, I think the situation you've
put forth (side effects and keeping lazy result) will be an extreme
minority case, and am inclined to think it would be better to require
and see the 'do' so you know something funky is going on.

Rich

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to