Re: Reducers newbie question

2013-04-27 Thread Stanislav Yurin
Indeed, that was my really bad example with 100. On Saturday, April 27, 2013 4:19:07 PM UTC+3, Alan Busby wrote: > > > On Sat, Apr 27, 2013 at 10:01 PM, Stanislav Yurin > > > wrote: > >> By the way, fold function has [n combinef reducef coll] implementation, >> where n is number of elements col

Re: Reducers newbie question

2013-04-27 Thread Alan Busby
On Sat, Apr 27, 2013 at 10:01 PM, Stanislav Yurin wrote: > By the way, fold function has [n combinef reducef coll] implementation, > where n is number of elements collection is folded by. 512 is just the > default. > Yep I misspoke there, but it is still one of the tricks to be aware of. Lots o

Re: Reducers newbie question

2013-04-27 Thread Stanislav Yurin
Thanks Alan, looking into it. By the way, fold function has [n combinef reducef coll] implementation, where n is number of elements collection is folded by. 512 is just the default. On Saturday, April 27, 2013 3:51:39 PM UTC+3, Alan Busby wrote: > > On Sat, Apr 27, 2013 at 7:35 PM, Stanislav Yur

Re: Reducers newbie question

2013-04-27 Thread Alan Busby
On Sat, Apr 27, 2013 at 7:35 PM, Stanislav Yurin wrote: > Actually, what I was trying to do, is to prototype multithreaded i/o > operation via reducers. And then use fold to regulate number of concurrent > operations. > But now something tells me I am doing not very clever thing. > I'm not entir

Re: Reducers newbie question

2013-04-27 Thread Stanislav Yurin
Yep, thanks, my bad. I got the point. Actually, what I was trying to do, is to prototype multithreaded i/o operation via reducers. And then use fold to regulate number of concurrent operations. But now something tells me I am doing not very clever thing. On Friday, April 26, 2013 5:27:46 PM UTC

Re: Reducers newbie question

2013-04-26 Thread Jim - FooBar();
+1 ! I use 'fold-into-vec' regularly :) Jim On 26/04/13 18:07, Alan Busby wrote: Some additional pointers here (this is a little old though); http://www.thebusby.com/2012/07/tips-tricks-with-clojure-reducers.html On Fri, Apr 26, 2013 at 11:51 PM, László Török >

Re: Reducers newbie question

2013-04-26 Thread Alan Busby
Some additional pointers here (this is a little old though); http://www.thebusby.com/2012/07/tips-tricks-with-clojure-reducers.html On Fri, Apr 26, 2013 at 11:51 PM, László Török wrote: > Hi, > > Not sure what you are trying to do, but xxx is a lazy seq, thus it can > only be consumed sequentia

Re: Reducers newbie question

2013-04-26 Thread László Török
Hi, Not sure what you are trying to do, but xxx is a lazy seq, thus it can only be consumed sequentially and fold falls back to reduce You need a vector. Las Sent from my phone On Apr 26, 2013 4:46 PM, "Stanislav Yurin" wrote: > I was assuming that following code will fold in parallel, but it

Reducers newbie question

2013-04-26 Thread Stanislav Yurin
I was assuming that following code will fold in parallel, but it is reduced sequentially (require '[clojure.core.reducers :as r]) (defn test1 [x] (Thread/sleep 1000) (println (str "Finished:" x)) x) (def xxx (r/map test1 (range 100))) (r/fold + xxx) What am I doing wrong? Thanks. -- -- You