On Thursday, 7 April 2016 at 08:27:23 UTC, Edwin van Leeuwen
wrote:
On Thursday, 7 April 2016 at 08:17:38 UTC, Puming wrote:
On Thursday, 7 April 2016 at 08:07:12 UTC, Edwin van Leeuwen
wrote:
OK. Even if it consumes the first two elements, then why does
it have to consume them AGAIN when actually used? If the
function mkarray has side effects, it could lead to problems.
After some testing it seems to get each element twice, calls
front on the MapResult twice, on each element. The first two
mkarray are both for first element, the second two for the
second. You can solve this by caching the front call with:
xs.map!(x=>mkarray(x)).cache.joiner;
Thanks! I added more elements to xs and checked that you are
right.
So EVERY element is accessed twice with joiner. Better add that
to the docs, and note the use of cache.