Re: Association list utilities
Arne Babenhauserheide 10 Jun 2020 10:33 UTC
Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> writes:
> Am Mi., 10. Juni 2020 um 10:49 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
>
>> Using two-element lists instead of pairs means that another pair has to
>> > be needlessly allocated for each entry in the association list.
>>
>
> We have already alists and plists. Maybe, it makes sense to coin another
> term, say, xlists where the entries are proper lists. Then we would have
> `xlist-cons', etc.
I’m a bit surprised by this, because I see that already working with Guile:
(import (srfi srfi-1))
(assoc 0 (alist-cons 0 '(a b c) '()))
;; => (0 a b c)
(assoc-ref (alist-cons 0 '(a b c) '()) 0)
;; => (a b c)
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken