[Haskell-cafe] Haskell scripting system (please help me simplify
the design)
Cale Gibbard
cgibbard at gmail.com
Thu Oct 27 12:29:27 EDT 2005
On 27/10/05, Joel Reymont <joelr1 at gmail.com> wrote:
> On Oct 27, 2005, at 4:59 PM, Robert Dockins wrote:
[snip]
> > As a side note, I see you are doing a bunch of operations on lists
> > of properties. If performance is an issue, you might want to
> > consider using Data.Map or similar. If your properties lists can
> > get big, mergeprops looks like a potential problem ( O( n*(n+m) )
> > each time it's called ).
>
> What would I use as the key for each map entry? If I knew this then I
> could use a map :-). As it stands, each property is a solid chunk and
> I can't even extract the name of the attribute it was created with. I
> don't think Map lets me index on Strings, does it?
[snip]
> Joel
>
You can use any type in Ord as an index for a Map -- see fromList in
the Data.Map documentation. Strings are actually quite an effective
type of key, as they don't usually even need to be fully evaluated to
be compared.
- Cale
More information about the Haskell-Cafe
mailing list