master: Return early from set-exclusive-or if one of the arguments is NIL
stassats via Sbcl-commits <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.cvs |
|---|---|
| Message-ID | <[email protected]> |
The branch "master" has been updated in SBCL:
via b64590858b43fcd320dc8d8e39c4dc464adf6454 (commit)
from 561ce4284b26ba669a3f44d4793b1669a53280e7 (commit)
- Log -----------------------------------------------------------------
commit b64590858b43fcd320dc8d8e39c4dc464adf6454
Author: Stas Boukarev <[email protected]>
Date: Sat Apr 11 01:04:12 2026 +0300
Return early from set-exclusive-or if one of the arguments is NIL
---
src/code/list.lisp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/code/list.lisp b/src/code/list.lisp
index 20279f4f6..e936e7d4f 100644
--- a/src/code/list.lisp
+++ b/src/code/list.lisp
@@ -1140,6 +1140,8 @@
(error ":TEST and :TEST-NOT were both supplied."))
(let ((result nil))
(with-member-test (member-test)
+ (cond ((null list1) (return-from set-exclusive-or list2))
+ ((null list2) (return-from set-exclusive-or list1)))
(dolist (elt list1)
(unless (funcall member-test elt list2 key test)
(push elt result)))
@@ -1165,6 +1167,8 @@
(test (if testp (%coerce-callable-to-fun test) test))
(test-not (if notp (%coerce-callable-to-fun test-not) test-not)))
(declare (type function test test-not))
+ (cond ((null list1) (return-from nset-exclusive-or list2))
+ ((null list2) (return-from nset-exclusive-or list1)))
;; The outer loop examines LIST1 while the inner loop examines
;; LIST2. If an element is found in LIST2 "equal" to the element
;; in LIST1, both are spliced out. When the end of LIST1 is
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL