caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Association lists
@ 2012-03-12 18:12 Lukasz Stafiniak
  2012-03-12 18:31 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Stafiniak @ 2012-03-12 18:12 UTC (permalink / raw)
  To: caml-list

On Mon, Mar 12, 2012 at 7:03 PM, Xavier Leroy <Xavier.Leroy@inria.fr> 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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Association lists
  2012-03-12 18:12 [Caml-list] Association lists Lukasz Stafiniak
@ 2012-03-12 18:31 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2012-03-12 18:31 UTC (permalink / raw)
  To: caml-list

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-12 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 18:12 [Caml-list] Association lists Lukasz Stafiniak
2012-03-12 18:31 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).