SEARCH does not work correctly for some inputs when user-defined sequences are involved
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
What I do:
(defclass list-backed-
((elements :initarg :elements :type list :accessor %elements)))
(defmethod sequence:
(declare (ignore initial-element initial-contents))
(make-instance 'list-backed-
(defmethod sequence:length ((sequence list-backed-
(length (%elements sequence)))
(defmethod sequence:elt ((sequence list-backed-
(nth index (%elements sequence)))
(defmethod (setf sequence:elt) (new-value (sequence list-backed-
(setf (nth index (%elements sequence)) new-value))
(search #(1) (coerce #(1 2 3 2 1) 'list-backed-
What happens:
0 is returned
What I expected to happen:
4 is returned
$ sbcl --version
SBCL 1.1.5
$ uname -a
Linux ferberit 3.5.0-25-generic #38-Ubuntu SMP Mon Feb 18 23:28:26 UTC 2013 i686 i686 i686 GNU/Linux
$ sbcl --eval '(print *features*)' --quit
(:QUICKLISP :SB-BSD-
:ALIEN-CALLBACKS :ANSI-CL :C-STACK-
:COMPARE-
:INLINE-CONSTANTS :LARGEFILE :LINKAGE-TABLE :LINUX :LITTLE-ENDIAN
:MEMORY-
:OS-PROVIDES-
:OS-PROVIDES-POLL :OS-PROVIDES-PUTWC :OS-PROVIDES-
:PACKAGE-
:SB-EVAL :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-SAFEPOINT
:SB-SOURCE-
:STACK-
:STACK-
:STACK-
tags: | added: review |
Changed in sbcl: | |
importance: | Undecided → Low |
status: | New → Triaged |
Changed in sbcl: | |
status: | Triaged → Fix Released |
The attached patch extends some tests in tests/seq. impure. lisp to user-defined sequences. It also contains a new implementation of SEQUENCE:SEARCH which passes the tests and is slightly faster on the inputs in tests/seq. impure. lisp.