Certain Aarguments to sequence functions that can be functions or
authorPaul F. Dietz <pfdietz@users.sourceforge.net>
Fri, 4 Feb 2005 09:28:40 +0000 (09:28 +0000)
committerPaul F. Dietz <pfdietz@users.sourceforge.net>
Fri, 4 Feb 2005 09:28:40 +0000 (09:28 +0000)
function names.  Coerce them to functions once instead of each time
they are applied (similar to an earlier enhancement of REDUCE).

src/code/seq.lisp
version.lisp-expr

index 631e848..e2afa66 100644 (file)
   "Return a sequence formed by destructively removing the elements satisfying
   the specified PREDICATE from the given SEQUENCE."
   (declare (fixnum start))
   "Return a sequence formed by destructively removing the elements satisfying
   the specified PREDICATE from the given SEQUENCE."
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (predicate (%coerce-callable-to-fun predicate)))
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
   "Return a sequence formed by destructively removing the elements not
   satisfying the specified PREDICATE from the given SEQUENCE."
   (declare (fixnum start))
   "Return a sequence formed by destructively removing the elements not
   satisfying the specified PREDICATE from the given SEQUENCE."
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (predicate (%coerce-callable-to-fun predicate)))
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
   "Return a copy of sequence with elements such that predicate(element)
    is non-null removed"
   (declare (fixnum start))
   "Return a copy of sequence with elements such that predicate(element)
    is non-null removed"
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (predicate (%coerce-callable-to-fun predicate)))
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
   "Return a copy of sequence with elements such that predicate(element)
    is null removed"
   (declare (fixnum start))
   "Return a copy of sequence with elements such that predicate(element)
    is null removed"
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (predicate (%coerce-callable-to-fun predicate)))
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
   manual for details."
   (declare (fixnum start))
   (let ((end (or end length))
   manual for details."
   (declare (fixnum start))
   (let ((end (or end length))
-        (test pred)
+        (test (%coerce-callable-to-fun pred))
        test-not
        old)
     (declare (type index length end))
        test-not
        old)
     (declare (type index length end))
   See manual for details."
   (declare (fixnum start))
   (let ((end (or end length))
   See manual for details."
   (declare (fixnum start))
   (let ((end (or end length))
-        (test pred)
+        (test (%coerce-callable-to-fun pred))
        test-not
        old)
     (declare (type index length end))
        test-not
        old)
     (declare (type index length end))
    except that all elements satisfying the PRED are replaced with NEW. 
    SEQUENCE may be destructively modified. See manual for details."
   (declare (fixnum start))
    except that all elements satisfying the PRED are replaced with NEW. 
    SEQUENCE may be destructively modified. See manual for details."
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (pred (%coerce-callable-to-fun pred)))
     (declare (fixnum end))
     (if (listp sequence)
        (if from-end
     (declare (fixnum end))
     (if (listp sequence)
        (if from-end
    except that all elements not satisfying the TEST are replaced with NEW.
    SEQUENCE may be destructively modified. See manual for details."
   (declare (fixnum start))
    except that all elements not satisfying the TEST are replaced with NEW.
    SEQUENCE may be destructively modified. See manual for details."
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (pred (%coerce-callable-to-fun pred)))
     (declare (fixnum end))
     (if (listp sequence)
        (if from-end
     (declare (fixnum end))
     (if (listp sequence)
        (if from-end
   #!+sb-doc
   "Return the number of elements in SEQUENCE satisfying PRED(el)."
   (declare (fixnum start))
   #!+sb-doc
   "Return the number of elements in SEQUENCE satisfying PRED(el)."
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (pred (%coerce-callable-to-fun pred)))
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
   #!+sb-doc
   "Return the number of elements in SEQUENCE not satisfying TEST(el)."
   (declare (fixnum start))
   #!+sb-doc
   "Return the number of elements in SEQUENCE not satisfying TEST(el)."
   (declare (fixnum start))
-  (let ((end (or end length)))
+  (let ((end (or end length))
+       (pred (%coerce-callable-to-fun pred)))
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
     (declare (type index end))
     (seq-dispatch sequence
                  (if from-end
index 0b19914..4100fba 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.19.11"
+"0.8.19.12"