Range queries and Data.Map

Jean-Philippe Bernardy jeanphilippe.bernardy at gmail.com
Fri Mar 10 15:40:05 EST 2006


Ticket created.

http://hackage.haskell.org/trac/ghc/ticket/720

JP.

On 3/10/06, Einar Karttunen <ekarttun at cs.helsinki.fi> wrote:
> Hello
>
> Data.Map seems to lack a way to perform range queries
> like "fetch all elements between keys low and high".
> The naive implementation is easy:
>
> range :: Ord k => k -> k -> Map.Map k v -> [(k,v)]
> range low high = toList . fst . split high . snd . split low
>
> But this is not very fast for larger maps. Maybe
> this operation could be provided in Data.Map?
>
> - Einar Karttunen
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list