Re: Chunking is making my life more difficult.

2011-01-03 Thread ehanneken
> Four is better than 32, but still. I found the explanation for this on stackoverflow.com. Stuart Sierra wrote, > This is due to the definition of =, which, when given a sequence of > arguments, forces the first 4: >> (defn = >> ;; ... other arities ... >> ([x y & more] >>(if (= x y)

Re: Chunking is making my life more difficult.

2010-12-31 Thread ehanneken
Chas, Thanks for your help. However, modifying the code to use mapcat instead of (map println) seems to cause some chunking: (defn tenify [n] (do (println \" n \") [n n n n n n n n n n])) => (->> (range 50) (mapcat list) (mapcat tenify) first) " 0 " " 1 " " 2 " " 3 " 0

Re: Chunking is making my life more difficult.

2010-12-31 Thread Steven E. Harris
ehanneken writes: > I spent a long time debugging some Clojure code yesterday. The > essence of it looked similar to this: > > (defn items [] > (mapcat expensive-function (range 0 4000 100))) > > . . . (take 5 (items)) . . . I tried to distill the problem down by defining a non-chunking range

Re: Chunking is making my life more difficult.

2010-12-31 Thread ehanneken
On Dec 31, 12:48 am, Ken Wesson wrote: > Is mapcat also semi-eager, then? I guess so. The Clojure 1.1 release notes also say, "Some of the sequence processing functions (like map and filter) are now chunk-aware and leverage this efficiency." I should have mentioned that. -- You received this

Re: Chunking is making my life more difficult.

2010-12-30 Thread Chas Emerick
On Fri, Dec 31, 2010 at 12:25 AM, ehanneken wrote: > I spent a long time debugging some Clojure code yesterday. The > essence of it looked similar to this: > > (defn items [] > (mapcat expensive-function (range 0 4000 100))) > > . . . (take 5 (items)) . . . > > expensive-function is a functio

Re: Chunking is making my life more difficult.

2010-12-30 Thread Ken Wesson
On Fri, Dec 31, 2010 at 12:25 AM, ehanneken wrote: > I spent a long time debugging some Clojure code yesterday.  The > essence of it looked similar to this: > > (defn items [] >  (mapcat expensive-function (range 0 4000 100))) > > . . . (take 5 (items)) . . . > > expensive-function is a function t