> 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)
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
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
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 range'
I think I found the relevant Firefox bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=215055
There's a test case that reproduces what we see on the Clojure API
page:
https://bugzilla.mozilla.org/attachment.cgi?id=129238
The reason for the bug is said to be a 16-bit limit on the coordinate
spa
I see the list of functions chopped off prematurely in Firefox 3.5.3
on Windows. Where the list ends depends on the size of the window.
However, the same version of Firefox on OS X, and other browsers on
both operating systems, show the entire list.
I investigated the page using Firebug, and it