
15 May
2011
15 May
'11
9:48 a.m.
Hi Daniel,
However, traverse assembles a new Map. While it's trivial to discard consumed list-cells (if the list is consumed sequentially), that is not so for Maps. Unless the compiler manages to completely eliminate the new Map, that is going to cost considerably more than the throwaway list-cells.
good to know.
I conclude that the new Map assembled by traverse is not discarded. So, overall, going through the list is better.
Ok, now if I think about it, this seems obvious :-) Thanks for the clarification and the tests. regards Matthias