pmap is still semi-lazy, and there's little point to derefing futures in
parallel.
You'd be better off with:
(doseq [r results]
(deref r))
Or:
(dorun (map deref results))
- James
On 18 June 2015 at 12:57, Haim Ashkenazi <[email protected]> wrote:
> Thanks Luc,
>
> This was a simplification if what I really have :) I actually need the
> result. The actual code was something like:
>
> (let [results (for [host hosts]
> (future (remote-exec commands host)))]
> (pmap deref results))
>
> where remote-exec runs commands via ssh-clj.
>
> Is there another way to verify that the futures executed?
>
> Thanks.
>
>
>
>
> On Thu, Jun 18, 2015 at 11:06 AM, Luc Prefontaine <
> [email protected]> wrote:
>
>> Btwy,
>>
>> For is not a loop as in imperative languages. It returns a lazy sequence.
>>
>> Luc P.
>>
>> Sent from my iPhone
>>
>> On Jun 18, 2015, at 07:51, Haim Ashkenazi <[email protected]>
>> wrote:
>>
>> Hi,
>>
>> I'm trying boot scripting capabilities so I have the following file:
>>
>> #!/usr/bin/env boot
>> (set-env!
>> :dependencies '[[org.clojure/clojure "1.6.0"]])
>>
>> (defn -main
>> []
>> (println "before")
>> (for [s ["one" "two" "three"]]
>> (do
>> (spit "output" s :append true)
>> (println s)))
>> (println "after"))
>>
>>
>> When running this script form the command line all the stuff inside the
>> *for* loop is doesn't seem to run:
>>
>> ✓ src ➤ ./testboot
>> before
>> after
>>
>> ... and there's no "out[put" file. Inside a REPL it runs without a
>> problem. Am I missing something?
>>
>> Thanks in advance
>>
>> --
>> Haim
>>
>> --
>> 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
>> ---
>> 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> 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
>> ---
>> 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Haim
>
> --
> 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
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.