Paul SomeoneElse on Nostr: I really like association lists. I like that they can be treated as a hash-table just ...
I really like association lists.
I like that they can be treated as a hash-table just by pushing a new cons with the same name.
And 'assoc will grab the latest one.
I also like how you have to use cdr to get the value. Because it is more generally useful to return the whole cons, and not worth specializing to the typical case.
(push (cons "asd" 9000) l)
(push (cons "qwe" 56) l)
(push (cons "asd" 9001) l)
(cdr (assoc "asd" l :test 'equal))
...
I like that they can be treated as a hash-table just by pushing a new cons with the same name.
And 'assoc will grab the latest one.
I also like how you have to use cdr to get the value. Because it is more generally useful to return the whole cons, and not worth specializing to the typical case.
(push (cons "asd" 9000) l)
(push (cons "qwe" 56) l)
(push (cons "asd" 9001) l)
(cdr (assoc "asd" l :test 'equal))
...