Hi Viksit,
I would suggest that the CL loop construct and the Clojure construct
of the same name are, in fact, fairly different beasts, both
structurally and in terms of their goals. I don't believe that Rich
has any intent to extend loop towards the CL flavored loop. The for
construct is more Clo
Personally, I think the cl loop-macro is kind of ugly. Yes, it's a
nice dsl for looping, but it is almost too powerful for my taste. Too
complicated to learn, if you can accomplish the same thing with sexps.
However, you can combine doseq, destructuring and the map-stuff by
Meikel Brandmeyer to lo
Hey Meikel,
On Jun 17, 10:48 pm, Meikel Brandmeyer wrote:
> Hi,
>
> On Jun 18, 1:35 am, viksit wrote:
>
> > (loop for x in '(a b c d e)
> > for y in '(1 2 3 4 5)
> > collect (list x y) )
>
> > ((A 1) (B 2) (C 3) (D 4) (E 5))
>
> > Are there any good (and idiomatic) methods to achieve
Hi,
On Jun 18, 1:35 am, viksit wrote:
> (loop for x in '(a b c d e)
> for y in '(1 2 3 4 5)
> collect (list x y) )
>
> ((A 1) (B 2) (C 3) (D 4) (E 5))
>
> Are there any good (and idiomatic) methods to achieve this using a
> Clojure loop construct?
user=> (map vector [:a :b :c :d :e]
Sean,
On Jan 10, 12:29 pm, Sean Devlin wrote:
> Conrad,
> What's your use case that requires for and not map? I haven't seen
> something like this yet, and you've got my curious.
Stumbled across this thread after looking for some CL loop
equivalents. For instance in CL, the loop macro provides,
Conrad,
What's your use case that requires for and not map? I haven't seen
something like this yet, and you've got my curious.
Sean
On Jan 8, 4:41 pm, Conrad wrote:
> Thanks again Sean/Chouser- Sounds like there isn't any easy way to do
> in-step iteration using the "for" construct, as I suspec
Thanks again Sean/Chouser- Sounds like there isn't any easy way to do
in-step iteration using the "for" construct, as I suspected- This is
of course easily remedied for writing a convenience function for "(map
vec ...)"
(As I mentioned in the top post, I am aware the simple example I gave
can be w
Oh, right. I saw "paralell" and the brain hit autopilot.
And I think you CAN improve on your fn a little bit. This should do
the trick
(map + (range 1 5) (range 11 15))
The mapping fn itself will be applied to as many arguments as you have
collections. Since + is variadic, it will do the job
Thanks Sean...
Sorry, I should have used a better word than "parallel"- The second
code example shows what I mean... I'm not referring to multithreaded
parallelism, but simply being able to iterate through two lists in
step, as Chouser describes. (as you can do by passing two different
seqs to "ma
On Fri, Jan 8, 2010 at 11:34 AM, Sean Devlin wrote:
> Take a look at pmap
I don't think that's the kind of "parallel" being asked about.
> On Jan 8, 11:13 am, Conrad wrote:
>> Looping variables in a clojure "for" loop are iterated in a serial,
>> cartesian fashion:
>>
>> > (for [a (range 5) b (
Take a look at pmap
On Jan 8, 11:13 am, Conrad wrote:
> Looping variables in a clojure "for" loop are iterated in a serial,
> cartesian fashion:
>
> > (for [a (range 5) b (range 10 15)]
>
> (+ a b))
> (10 11 12 13 14 11 12 13 14 15 12 13 14 15 16 13 14 15 16 17 14 15 16
> 17 18)
>
> I was
Looping variables in a clojure "for" loop are iterated in a serial,
cartesian fashion:
> (for [a (range 5) b (range 10 15)]
(+ a b))
(10 11 12 13 14 11 12 13 14 15 12 13 14 15 16 13 14 15 16 17 14 15 16
17 18)
I was wondering if there's a standard idiom for looping in parallel
fashion- Doe
12 matches
Mail list logo