On 03/12/2012 07:12 PM, Lukasz Stafiniak wrote:

>> Resignedly awaiting a CVE about association lists,
> 
> Is using association lists a lot "poor style"? Wouldn't it be better
> to use maps -- which would make it possible to throw in different
> implementations to tune performance?

I was joking, but to answer seriously:

Association lists have O(1) insertion time but O(n) lookup time.  So,
you can use them as long as you're sure they are pretty short.  If
you're not sure, e.g. if malicious users of your program can grow the
a-list as much as they want, better use maps, indeed.

The joke was that we don't need a CVE to know this, just basic
algorithmic reasoning.

- Xavier Leroy




-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to