
15 May
2011
15 May
'11
6:52 a.m.
On Sunday 15 May 2011 09:32:32, Manfred Lotz wrote:
Hi all, I have a map with some two thousand entries. Now I want to print that map.
I could do: print m
but I like to use my own print function: mapM_ myprint (Map.toList m)
I may be wrong but having to use Map.toList looks pretty inefficient.
It's pretty efficient. I'm not sure that the compiler can completely fuse away the intermediate list, but such allocations are cheap. The list is consumed as it's generated, the consumed cells are collected in the next gc - the space and time overhead should be negligible.
Question: I'd like to know if there is a more efficient way to do it?