Hi! * Loïc Faure-Lacroix <[email protected]> [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 mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
