Data.HashMap: Strict or lazy by default?

Edward Z. Yang ezyang at MIT.EDU
Fri Feb 18 02:25:43 CET 2011

Excerpts from Johan Tibell's message of Thu Feb 17 19:51:28 -0500 2011:
> I'd like to see some arguments for and against each of the two
> possible defaults (lazy or strict). Also, real life examples of cases
> where lazy maps are useful would be appreciated.

My favorite example of lazy maps being useful is the case of dynamic
programming, where the particular value you are attempting to compute
only uses a small subset of the true "table".  You can then actually
write out the map (which refers to itself) and "initialize" it with
all values, but not actually calculate all of them.  Less efficient
in some cases? Probably. But it's hella elegant.


More information about the Libraries mailing list