From: William Harold Newman Date: Wed, 17 Oct 2001 18:37:52 +0000 (+0000) Subject: 0.pre7.72: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=f5fff2abb7de72d52905253a664cff2f80b6a617;p=sbcl.git 0.pre7.72: merged two AD patches from sbcl-devel 2001-10-17.. .."inconsistency in FIND", fixing bug in %FIND-POSITION stuff .."bug in APROPOS-LIST" added tests for these bugs --- diff --git a/NEWS b/NEWS index ae8fda0..272ab0f 100644 --- a/NEWS +++ b/NEWS @@ -893,7 +893,8 @@ changes in sbcl-0.7.0 relative to sbcl-0.6.13: * Martin Atzmueller fixed several other bugs: ** correct ERROR type for various file operations ** removing dead code -* Alexey Dejneka fixed many bugs: +* Alexey Dejneka fixed many bugs, both classic bugs and bugs he + discovered himself: ** misbehavior of WRITE-STRING/WRITE-LINE ** LOOP over keys of a hash table, LOOP bugs 49b and 81 and 103, and several other LOOP problems as well @@ -901,6 +902,8 @@ changes in sbcl-0.7.0 relative to sbcl-0.6.13: ** DEFGENERIC with :METHOD options ** bug 126, in (MAKE-STRING N :INITIAL-ELEMENT #\SPACE)) ** bug in the optimization of ARRAY-ELEMENT-TYPE + ** argument ordering in FIND with :TEST option + ** mishandled package designator argument in APROPOS-LIST He also pointed out some bogus old entries in BUGS, and fixed a number of bugs which came into existence in the pre7 branch (internal to the CVS repository), so that they never showed diff --git a/src/code/target-package.lisp b/src/code/target-package.lisp index 7201b7a..6e64443 100644 --- a/src/code/target-package.lisp +++ b/src/code/target-package.lisp @@ -868,24 +868,28 @@ (when (fboundp symbol) (write-string " (fbound)"))) -(defun apropos-list (string-designator &optional package external-only) +(defun apropos-list (string-designator + &optional + package-designator + external-only) #!+sb-doc "Like APROPOS, except that it returns a list of the symbols found instead of describing them." - (if package - (let ((string (stringify-name string-designator "APROPOS search")) - (result nil)) - (do-symbols (symbol package) - (when (and (eq (symbol-package symbol) package) - (or (not external-only) - (eq (find-symbol (symbol-name symbol) package) - :external)) - (search string (symbol-name symbol) :test #'char-equal)) - (push symbol result))) - result) - (mapcan (lambda (package) - (apropos-list string-designator package external-only)) - (list-all-packages)))) + (if package-designator + (let ((package (find-undeleted-package-or-lose package-designator)) + (string (stringify-name string-designator "APROPOS search")) + (result nil)) + (do-symbols (symbol package) + (when (and (eq (symbol-package symbol) package) + (or (not external-only) + (eq (find-symbol (symbol-name symbol) package) + :external)) + (search string (symbol-name symbol) :test #'char-equal)) + (push symbol result))) + result) + (mapcan (lambda (package) + (apropos-list string-designator package external-only)) + (list-all-packages)))) (defun apropos (string-designator &optional package external-only) #!+sb-doc diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp index e9be332..22e25de 100644 --- a/src/compiler/seqtran.lisp +++ b/src/compiler/seqtran.lisp @@ -751,8 +751,28 @@ :important t) "expand inline" '(%find-position-if (let ((test-fun (%coerce-callable-to-function test))) + ;; I'm having difficulty believing I'm + ;; reading it right, but as far as I can see, + ;; the only guidance that ANSI gives for the + ;; order of arguments to asymmetric tests is + ;; the character-set dependent example from + ;; the definition of FIND, + ;; (find #\d "here are some.." :test #'char>) + ;; => #\Space + ;; (In ASCII, we have (CHAR> #\d #\SPACE)=>T.) + ;; (Neither the POSITION definition page nor + ;; section 17.2 ("Rules about Test Functions") + ;; seem to consider the possibility of + ;; asymmetry.) + ;; + ;; So, judging from the example, we want to + ;; do (FUNCALL TEST-FUN ITEM I), because + ;; (FUNCALL #'CHAR> #\d #\SPACE)=>T. + ;; + ;; -- WHN (whose attention was drawn to it by + ;; Alexey Dejneka's bug report/fix) (lambda (i) - (funcall test-fun i item))) + (funcall test-fun item i))) sequence from-end start @@ -810,6 +830,9 @@ start end element + ;; (See the LIST transform for a discussion of the correct + ;; argument order, i.e. whether the searched-for ,ITEM goes before + ;; or after the checked sequence element.) `(funcall ,test ,item (funcall ,key ,element))))) (def!macro %find-position-if-vector-macro (predicate sequence diff --git a/tests/interface.pure.lisp b/tests/interface.pure.lisp index 6febe33..1098852 100644 --- a/tests/interface.pure.lisp +++ b/tests/interface.pure.lisp @@ -1,3 +1,5 @@ +;;;; tests for problems in the interface presented to the user/programmer + ;;;; This software is part of the SBCL system. See the README file for ;;;; more information. ;;;; @@ -10,6 +12,8 @@ ;;;; more information. (in-package :cl-user) + +;;;; properties of symbols, e.g. presence of doc strings for public symbols ;;; Check for fbound external symbols in public packages that have no ;;; argument list information. (This used to be possible when we got @@ -64,3 +68,12 @@ ;;; FIXME: It would probably be good to require here that every ;;; external symbol either has a doc string or has some good excuse ;;; (like being an accessor for a structure which has a doc string). + +;;;; tests of interface machinery + +;;; APROPOS should accept a package designator, not just a package, and +;;; furthermore do the right thing when it gets a package designator. +;;; (bug reported and fixed by Alexey Dejneka sbcl-devel 2001-10-17) +(assert (< 0 + (length (apropos-list "PRINT" :cl)) + (length (apropos-list "PRINT")))) diff --git a/tests/seq.impure.lisp b/tests/seq.impure.lisp index 7ab6163..ef2eeda 100644 --- a/tests/seq.impure.lisp +++ b/tests/seq.impure.lisp @@ -94,6 +94,15 @@ (defun indiscriminate (fun) (lambda (&rest rest) (apply fun rest))) +;;; asymmetric test arg order example from ANSI FIND definition page +(assert (eql #\space ; original example, depends on ASCII character ordering + (find #\d "here are some letters that can be looked at" + :test #'char>))) +(assert (eql #\e ; modified example, depends only on standard a-z ordering + (find #\f "herearesomeletters" :test #'char>))) +(assert (eql 4 ; modified more, avoids charset technicalities completely + (find 5 '(6 4) :test '>))) + ;;; tests of FIND, POSITION, FIND-IF, and POSITION-IF (and a few for ;;; deprecated FIND-IF-NOT and POSITION-IF-NOT too) (for-every-seq #() @@ -109,6 +118,9 @@ (null (position-if-not #'packagep seq :key nil)))) (for-every-seq #(1) '((null (find 2 seq)) + ;; Get the argument ordering for asymmetric tests like #'> right. + ;; (bug reported and fixed by Alexey Dejneka sbcl-devel 2001-10-17) + (eql 1 (find 2 seq :test #'>)) (find 2 seq :key #'1+) (find 1 seq :from-end t) (null (find 1 seq :from-end t :start 1)) @@ -122,6 +134,7 @@ (for-every-seq #(1 2 3 2 1) '((find 3 seq) (find 3 seq :from-end 'yes) + (eql 1 (position 1.5 seq :test #'<)) (eql 0 (position 0 seq :key '1-)) (eql 4 (position 0 seq :key '1- :from-end t)) (eql 2 (position 4 seq :key '1+)) diff --git a/version.lisp-expr b/version.lisp-expr index af48930..58842c1 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -1,7 +1,7 @@ ;;; This is the master value for LISP-IMPLEMENTATION-VERSION. It's ;;; separated into its own file here so that it's easy for ;;; text-munging make-ish or cvs-ish scripts to find and tweak it. For -;;; the convenience of such scripts, only a trivial subset of Lisp +;;; the convenience of such scripts, only a simple subset of Lisp ;;; reader syntax should be used here: semicolon-delimited comments, ;;; possible blank lines or other whitespace, and a single ;;; double-quoted string value alone on its own line. @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.pre7.71" +"0.pre7.72"