Raymond Toy pushed to branch issue-240-add-hashtable-set-exclusive-or at cmucl / cmucl
Commits:
-
8074203f
by Raymond Toy at 2023-08-26T20:42:51-07:00
1 changed file:
Changes:
... | ... | @@ -906,7 +906,7 @@ |
906 | 906 | |
907 | 907 | (defun set-exclusive-or (list1 list2 &key key
|
908 | 908 | (test #'eql testp) (test-not nil notp))
|
909 | - "Return new list of elements appearing exactly once in LIST1 and LIST2."
|
|
909 | + "Return new list of elements appearing exactly one of LIST1 and LIST2."
|
|
910 | 910 | (declare (inline member))
|
911 | 911 | (let ((result nil)
|
912 | 912 | (key (when key (coerce key 'function)))
|
... | ... | @@ -914,6 +914,8 @@ |
914 | 914 | (test-not (if test-not (coerce test-not 'function) #'eql)))
|
915 | 915 | (declare (type (or function null) key)
|
916 | 916 | (type function test test-not))
|
917 | + ;; Find the elements in list1 that do not appear in list2 and add
|
|
918 | + ;; them to the result.
|
|
917 | 919 | (let ((hashtable (list-to-hashtable list2 key test test-not)))
|
918 | 920 | (cond
|
919 | 921 | (hashtable
|
... | ... | @@ -924,6 +926,8 @@ |
924 | 926 | (dolist (elt list1)
|
925 | 927 | (unless (with-set-keys (member (apply-key key elt) list2))
|
926 | 928 | (setq result (cons elt result)))))))
|
929 | + ;; Now find the elements in list2 that do not appear in list1 and
|
|
930 | + ;; them to the result.
|
|
927 | 931 | (let ((hashtable (list-to-hashtable list1 key test test-not)))
|
928 | 932 | (cond
|
929 | 933 | (hashtable
|