Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
55c01f44
by Raymond Toy at 2023-08-17T13:33:59+00:00
-
14d847f0
by Raymond Toy at 2023-08-17T13:34:15+00:00
1 changed file:
Changes:
| ... | ... | @@ -825,11 +825,20 @@ |
| 825 | 825 | (declare (inline member))
|
| 826 | 826 | (if (and testp notp)
|
| 827 | 827 | (error "Test and test-not both supplied."))
|
| 828 | - (let ((res nil))
|
|
| 829 | - (dolist (elt list1)
|
|
| 830 | - (if (with-set-keys (member (apply-key key elt) list2))
|
|
| 831 | - (push elt res)))
|
|
| 832 | - res))
|
|
| 828 | + (let ((hashtable
|
|
| 829 | + (list-to-hashtable list2 key test test-not)))
|
|
| 830 | + (cond (hashtable
|
|
| 831 | + (let ((res nil))
|
|
| 832 | + (dolist (item list1)
|
|
| 833 | + (when (nth-value 1 (gethash (apply-key key item) hashtable))
|
|
| 834 | + (push item res)))
|
|
| 835 | + res))
|
|
| 836 | + ((null hashtable)
|
|
| 837 | + (let ((res nil))
|
|
| 838 | + (dolist (elt list1)
|
|
| 839 | + (if (with-set-keys (member (apply-key key elt) list2))
|
|
| 840 | + (push elt res)))
|
|
| 841 | + res)))))
|
|
| 833 | 842 | |
| 834 | 843 | (defun nintersection (list1 list2 &key key
|
| 835 | 844 | (test #'eql testp) (test-not nil notp))
|