master: nintersection and nset-difference do not modify the second list

stassats via Sbcl-commits <[email protected]> Wed, 13 May 2026 21:41:45 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  de7356db63a4d52db2c116c902305016036e86d5 (commit)
      from  99cf2439f404b58784aafded14f4d53273723c2c (commit)

- Log -----------------------------------------------------------------
commit de7356db63a4d52db2c116c902305016036e86d5
Author: Stas Boukarev <[email protected]>
Date:   Thu May 14 00:37:46 2026 +0300

    nintersection and nset-difference do not modify the second list
---
 src/compiler/fndb.lisp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/compiler/fndb.lisp b/src/compiler/fndb.lisp
index 920c30875..d3748a566 100644
--- a/src/compiler/fndb.lisp
+++ b/src/compiler/fndb.lisp
@@ -1233,7 +1233,7 @@
   list
   (foldable flushable call))
 
-(defknown (nunion nintersection nset-difference nset-exclusive-or)
+(defknown (nunion nset-exclusive-or)
   ((modifying list) (modifying list)
    &key (:key (function-designator ((or (nth-arg 0 :sequence t)
                                         (nth-arg 1 :sequence t)))))
@@ -1244,6 +1244,17 @@
   list
   (foldable flushable call important-result))
 
+(defknown (nintersection nset-difference)
+  ((modifying list) proper-list
+   &key (:key (function-designator ((or (nth-arg 0 :sequence t)
+                                        (nth-arg 1 :sequence t)))))
+   (:test (function-designator ((nth-arg 0 :sequence t :key :key)
+                                (nth-arg 1 :sequence t :key :key))))
+   (:test-not (function-designator ((nth-arg 0 :sequence t :key :key)
+                                    (nth-arg 1 :sequence t :key :key)))))
+  list
+  (foldable flushable call important-result))
+
 (defknown subsetp
   (proper-list proper-list &key (:key (function-designator ((or (nth-arg 0 :sequence t)
                                                                 (nth-arg 1 :sequence t)))))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL