Tino Calancha writes: > Consider the following question: > https://emacs.stackexchange.com/questions/33892/replace-element-of-alist-using-equal-even-if-key-does-not-exist/33893#33893 > > 1. The OP wants to update an alist without adding duplicates, > 2. but he doesn't want to restrict the lookup in the alist to 'eq'. > > The OP realized that > > (setf (alist-get key alist) val) > > is not an option because, `alist-get' assumes 'eq' in the lookup. > Then he writes his own function: > ;; docstrig omitted: > (defun alist-set (key val alist &optional symbol) > (if-let ((pair (if symbol (assq key alist) (assoc key alist)))) > (setcdr pair val) > (push (cons key val) alist)) > alist) > > * In the same thread, Drew suggests to add an optional arg TESTFN in `alist-get'. > * We might also tweak `map.el' so that the following code works: Thanks, I like your changes. If this is going to be installed, could you add tests to map-tests.el as well? Cheers, Nico