[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Alist versus Hash-table
From: |
Christian Kellermann |
Subject: |
Re: [Chicken-users] Alist versus Hash-table |
Date: |
Tue, 12 Nov 2013 11:40:46 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi!
* Loïc Faure-Lacroix <address@hidden> [131112 11:33]:
> To do the same job, it takes 650s for the non destructive function
> and 0.014s for the use of destructive ???alist-update!???. Anyone
> can explain why is this so slow?
The non-destructive version creates a new list:
#;1> (define l '((a . foo) (b . bar)))
#;2> (alist-update 'c 'baz l)
((a . foo) (b . bar) (c . baz))
#;3> (alist-update 'c 'baz l)
((a . foo) (b . bar) (c . baz))
#;4> (eq? #2 #3)
#f
> Also what is the big difference between alist and a hash-table
> other than alist doesn???t seem to hash objects. After testing
> again, I realize that ???alist-update!??? isn???t even adding new
> element to the current list.
alist-update! updates the *element* destructively. It does not set
the list itself. This may be a bit confusing. I think alist-update!
is a misnomer really but I cannot think of a shorter name that's
better suited.
Does this help?
Kind regards,
Christian
--
In the world, there is nothing more submissive and weak than
water. Yet for attacking that which is hard and strong, nothing can
surpass it. --- Lao Tzu
- [Chicken-users] Alist versus Hash-table, Loïc Faure-Lacroix, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table,
Christian Kellermann <=
- Re: [Chicken-users] Alist versus Hash-table, Jörg F. Wittenberger, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, Peter Bex, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, Loïc Faure-Lacroix, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, John Cowan, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, Peter Bex, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, John Cowan, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, Peter Bex, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, Loïc Faure-Lacroix, 2013/11/12
- Re: [Chicken-users] Alist versus Hash-table, John Cowan, 2013/11/12