Re: functional check slower than imperative?

2010-05-20 Thread Christophe Grand
On Wed, May 19, 2010 at 7:13 PM, braver delivera...@gmail.com wrote: On May 18, 11:45 am, Christophe Grand christo...@cgrand.net wrote: (defn sorted-by? [pred s] (if-let [ns (next s)] (let [[a b] s] (and (pred a b) (recur pred ns))) true)) (defn reps-sorted2? [dreps]

Re: functional check slower than imperative?

2010-05-19 Thread braver
On May 18, 11:45 am, Christophe Grand christo...@cgrand.net wrote: (defn sorted-by? [pred s]   (if-let [ns (next s)]     (let [[a b] s]       (and (pred a b) (recur pred ns)))     true)) (defn reps-sorted2? [dreps]  (every? #(sorted-by? = (map first (val %))) dreps)) and it should be as

Re: functional check slower than imperative?

2010-05-19 Thread Michael Gardner
On May 18, 2010, at 10:45 AM, Christophe Grand wrote: (every? f coll1 coll2) is not supported. Is there a reason for this? It seems like an obvious improvement to make every?, some, etc. take multiple args just like map. -- You received this message because you are subscribed to the Google

functional check slower than imperative?

2010-05-18 Thread braver
I have a huge graph of the form {john {1 {alice 1, bob 3}, 4 {alice 2, stan 1}, alice {1 {john 1, mandy 2}, 2 {john 3, stan 2}}} It shows for each user days on which he communicated, and for each day, with whom and how many times he addressed that person. Essentially this is an adjacency list --

Re: functional check slower than imperative?

2010-05-18 Thread David Nolen
On Tue, May 18, 2010 at 10:18 AM, braver delivera...@gmail.com wrote: I have a huge graph of the form {john {1 {alice 1, bob 3}, 4 {alice 2, stan 1}, alice {1 {john 1, mandy 2}, 2 {john 3, stan 2}}} It shows for each user days on which he communicated, and for each day, with whom and how

Re: functional check slower than imperative?

2010-05-18 Thread braver
On May 18, 10:27 am, David Nolen dnolen.li...@gmail.com wrote: On Tue, May 18, 2010 at 10:18 AM, braver delivera...@gmail.com wrote: The documentation is pretty clear about how pmap works. Your work needs to be greater than the coordination overhead. You probably need to batch your work before

Re: functional check slower than imperative?

2010-05-18 Thread Heinz N. Gies
On May 18, 2010, at 16:18 , braver wrote: user= (time (reps-sorted2? dreps)) Elapsed time: 127606.905 msecs true user= (time (reps-sorted1? dreps)) Elapsed time: 8368.616 msecs true As you can see, the imperative solution vastly outperforms the functional one, even though the

Re: functional check slower than imperative?

2010-05-18 Thread Laurent PETIT
2010/5/18 braver delivera...@gmail.com: On May 18, 10:27 am, David Nolen dnolen.li...@gmail.com wrote: On Tue, May 18, 2010 at 10:18 AM, braver delivera...@gmail.com wrote: The documentation is pretty clear about how pmap works. Your work needs to be greater than the coordination overhead. You

Re: functional check slower than imperative?

2010-05-18 Thread Christophe Grand
Hi, On Tue, May 18, 2010 at 4:59 PM, braver delivera...@gmail.com wrote: On May 18, 10:47 am, Heinz N. Gies he...@licenser.net wrote: Out of curiosity, can you remove the pmap and run them in the opposite order? as first (time (reps-sorted1? dreps)) then (time (reps-sorted2? dreps))?