From 03b592b558387b9e2b105f0ff91ae265b156f9c7 Mon Sep 17 00:00:00 2001 From: "Paul F. Dietz" Date: Fri, 4 Feb 2005 09:28:40 +0000 Subject: [PATCH] Certain Aarguments to sequence functions that can be functions or 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 | 28 ++++++++++++++++++---------- version.lisp-expr | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/code/seq.lisp b/src/code/seq.lisp index 631e848..e2afa66 100644 --- a/src/code/seq.lisp +++ b/src/code/seq.lisp @@ -1311,7 +1311,8 @@ "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 @@ -1347,7 +1348,8 @@ "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 @@ -1510,7 +1512,8 @@ "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 @@ -1526,7 +1529,8 @@ "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 @@ -1830,7 +1834,7 @@ 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)) @@ -1844,7 +1848,7 @@ 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)) @@ -1911,7 +1915,8 @@ 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 @@ -1951,7 +1956,8 @@ 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 @@ -2100,7 +2106,8 @@ #!+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 @@ -2115,7 +2122,8 @@ #!+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 diff --git a/version.lisp-expr b/version.lisp-expr index 0b19914..4100fba 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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".) -"0.8.19.11" +"0.8.19.12" -- 1.7.10.4