fukamachi / assoc-utils

Utilities for manipulating association lists.
25 stars 1 forks source link

Suggestion: Use stable-sort in alist= #1

Open epipping opened 7 years ago

epipping commented 7 years ago

It is common practice to have multiple entries in an alist with the same key. E.g. CLtL2 explicitly touts this as a feature:

Moreover, because the searching function assoc searches the a-list in order, new entries can ``shadow'' old entries

The order of keys should thus be maintained in alist=, otherwise this function might e.g. return non-nil for '(("foo" . 1) ("foo" . 2)) and '(("foo" . 2) ("foo" . 1)).

svetlyak40wt commented 4 years ago

@epipping could you please provide a test which will break because the sort is not stable?