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) (if (next

Re: Chunking is making my life more difficult.

2010-12-31 Thread ehanneken
On Dec 31, 12:48 am, Ken Wesson kwess...@gmail.com 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. --

Re: Chunking is making my life more difficult.

2010-12-31 Thread Steven E. Harris
ehanneken ehanne...@pobox.com 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

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 And indeed,

Chunking is making my life more difficult.

2010-12-30 Thread ehanneken
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 that issues an HTTP GET to retrieve a vector of data. Since

Re: Chunking is making my life more difficult.

2010-12-30 Thread Ken Wesson
On Fri, Dec 31, 2010 at 12:25 AM, ehanneken ehanne...@pobox.com 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

Re: Chunking is making my life more difficult.

2010-12-30 Thread Chas Emerick
On Fri, Dec 31, 2010 at 12:25 AM, ehanneken ehanne...@pobox.com 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