[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Alist versus Hash-table

From: John Cowan
Subject: Re: [Chicken-users] Alist versus Hash-table
Date: Tue, 12 Nov 2013 09:24:23 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Peter Bex scripsit:

> alist-update will take O(n) to locate the key just like alist-update!,
> but when it finds the entry, it will need to build a new list with
> the entry replaced at the same position.  That means it's O(n) to update
> (for new keys it's O(1), they can just be consed onto the front).
> In total, that's O(2n).  The major extra time you see can not be
> explained due to that, but the output of time gives a clear hint.

Why was alist-update introduced, anyway?  It is more efficient
to use either alist-update! or alist-cons (from SRFI 1) in any situation
I can think of.  I note that neither SRFI 1 nor the alist-lib egg has it.

[W]hen I wrote it I was more than a little              John Cowan
febrile with foodpoisoning from an antique carrot       address@hidden
that I foolishly ate out of an illjudged faith
in the benignancy of vegetables.  --And Rosta

reply via email to

[Prev in Thread] Current Thread [Next in Thread]