On Nov 7, 9:32 pm, Chouser <[EMAIL PROTECTED]> wrote:
> > And in which case, your vector syntax could be misleading, because it
> > seems to imply you're assigning i to 10:
>
> > (dotimes [i 10]
> >  (prn i))
>
> Vectors are also used for "for":
>
> (for [i (range 10)]
>   (* 2 i))
>
> Here i is not bound to the seq (range 10) but to each of the numbers
> in turn.

I'm still not convinced on this one. Currently, you have single
assignments, where a value is assigned to a symbol as in let and
binding, and sequence assignments, where each item in the sequence is
assigned to a symbol. Adding a vector to dotimes would add a third
type, and I don't think it's obvious what the [i 10] does. I mean, you
originally put it down as [i (range 10)], so you were thinking in
terms of [symbol sequence] too.

> > Second, with your patch, is the following valid:
>
> > (doseq [i (range 10)
> >        j (range 10)]
> >  (prn i)
> >  (prn j))
>
> It behaves the same as "for" does, that is with j in an inner loop.
> It also supports :while and :when as "for" does.

Well, not that my opinion matters ;) - but you've sold me on this one.
Consistency with the for macro seems reasonable.

> My first inclination is to disallow it -- add a check to make sure
> only one binding pair is given.  Alternatively it could act as if it
> were nested, as "for" (and now "doseq") do, in which case it would act
> like an "and", and both x and y would be bound to non-false values.

Hm. A nested if would be consistent with the nested for and doseq
macros. If this is implemented, nesting ifs would be my preference for
this.

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