[Haskell-beginners] associative arrays

Nick Vanderweit nick.vanderweit at gmail.com
Sat Aug 25 17:11:30 CEST 2012


I'd still recommend Data.Map, since it's a much more efficient data structure 
for the task.


Nick

On Friday, August 24, 2012 11:44:16 PM Karl Voelker wrote:
> On Fri, Aug 24, 2012 at 10:05 PM, Christopher Howard
> 
> <christopher.howard at frigidcode.com> wrote:
> > What is typically used in Haskell circles to provide associative array
> > functionality? (I.e., key-value type arrays.) I'm not really looking for
> > efficiency so much as interface convenience. Obviously I could code it
> > myself based on lists or something, but I don't want to reinvent the
> > wheel.
> 
> In simple situations, "coding it yourself" doesn't require much of any
> code, since the Prelude comes with a lookup function for lists of
> pairs:
> 
> lookup :: Eq a => a -> [(a, b)] -> Maybe b
> 
> -Karl V.
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners



More information about the Beginners mailing list