[Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library
Roman Cheplyaka
roma at ro-che.info
Tue Feb 22 08:52:50 CET 2011
* Max Bolingbroke <batterseapower at hotmail.com> [2011-02-21 14:57:08+0000]
> On 20 February 2011 03:40, Louis Wasserman <wasserman.louis at gmail.com> wrote:
> > I'd like to complain about that, too ;)
>
> I'm curious, when do people find that they need a really fast way to
> get map size? I use them quite a lot, and almost never call length -
> and when I do, it is typically only to get some statistics about the
> map for user display - certainly not in an inner loop.
>
> I find it is still useful to have a way to quickly test if a map is
> empty (for e.g. fixed points that slowly grow a map by unioning in a
> new bit every time) but "null" works OK for that purpose.
For example, consider a situation where you have two sets (they can be
maps as well), 'a' and 'b', such that by construction you know that 'a'
is a subset (submap) of 'b'. Now,
size a < size b
is a convenient O(1) way to test whether 'a' is a proper subset (submap)
of 'b'.
--
Roman I. Cheplyaka :: http://ro-che.info/
Don't worry what people think, they don't do it very often.
More information about the Haskell-Cafe
mailing list