master: Out of line some/every: check if the function is defined early

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  0ac261857941004337587426e99d81f70dd97ffe (commit)
      from  16880629988bd393a216f9e781030e0330020959 (commit)

- Log -----------------------------------------------------------------
commit 0ac261857941004337587426e99d81f70dd97ffe
Author: Stas Boukarev <[email protected]>
Date:   Sat Apr 11 00:39:27 2026 +0300

    Out of line some/every: check if the function is defined early
    
    Before returning on NIL, just like the compiled versions.
---
 src/code/quantifiers.lisp | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/code/quantifiers.lisp b/src/code/quantifiers.lisp
index 8c664197e..a21613d6c 100644
--- a/src/code/quantifiers.lisp
+++ b/src/code/quantifiers.lisp
@@ -66,17 +66,20 @@
                   #-sb-xc-host ; don't redefine CL builtins!
                   (defun ,name (pred first-seq &rest more-seqs)
                     ,doc
-                    (declare (dynamic-extent pred))
-                    (flet ((map-me (&rest rest)
-                             (let ((value (apply pred rest)))
-                               (,found-test value
-                                 (return-from ,name
-                                   ,(if (eq found-result :value)
-                                        'value
-                                        found-result))))))
-                      (declare (inline map-me))
-                      (apply #'%map nil #'map-me first-seq more-seqs)
-                      ,unfound-result)))))
+                    (declare (dynamic-extent pred)
+                             (explicit-check))
+                    (let ((pred (%coerce-callable-to-fun pred)))
+                      (flet ((map-me (&rest rest)
+                               (let ((value (apply pred rest)))
+                                 (,found-test value
+                                              (return-from ,name
+                                                ,(if (eq found-result :value)
+                                                     'value
+                                                     found-result))))))
+                        (declare (inline map-me)
+                                 (dynamic-extent #'map-me))
+                        (apply #'%map nil #'map-me first-seq more-seqs)
+                        ,unfound-result))))))
 
   (defquantifier some when :value :unfound-result nil
    :doc "Apply PREDICATE to the 0-indexed elements of the sequences, then

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


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.