Re: sbcl bug in ppsition and/or find with :start, :end and :key



budden escribió:
Good time of day!

I failed to post this to sbcl-help mail list, so posting here

(find :a '((:c) 1) :start 0 :end 1 :key #'car)
=>error (attempted to call (car 1))

My sbcl gives a more meaningul error message:

>The value 1 is not of type LIST.
> [Condition of type TYPE-ERROR]

It doesn't seem to be a bug in SBCL.


And even
(defun foo () (declare (notinline find)) (find :a '((:c) 1) :start 0 :end 1 :key 'car))
(foo)
=>error (attempted to call (car 1))

Why does sbcl access second element of list?

Because it can't find :a in the first. It keeps searching till :end is reached. You are using #'car to extract the value to be compared (the key) against :a from each element of the sequence. Try

(find :a '((:c) 1) :start 0 :end 1)

or

(find :a '((:c) (1)) :start 0 :end 1 :key #'car)

and you'll see.

hth,

Leandro


(lisp-implementation-type)
"SBCL"
(lisp-implementation-version)
"1.0.20"

debian etch i686

.



Relevant Pages

  • Re: A Collections Framework?
    ...  I believe his proposal is implemented in SBCL, ... collections to the Lisp sequence interface. ... the Java Collections API referred to by the OP also has some ... About iterators: the CL sequence API per se does not say anything ...
    (comp.lang.lisp)
  • Re: Tipping point for list of integers versus vector?
    ... What version of SBCL are you using? ... are the integers and floats? ... How often do you need to access entries in each specific way? ... Not that it matters now, but under a hundred elements in the sequence, ...
    (comp.lang.lisp)
  • Re: Heap exhausted during garbage collection
    ... SBCL confirms this is created by printing *LARGE-DATA*. ... Are my expressions valid or am I doing something wrong? ... 100MB sequence was being pretty-printed and this caused the heap ... (see the write-sequence documentation at ...
    (comp.lang.lisp)
  • How do you copy an array?
    ... This doesn't seem to work in sbcl: ... #\)) is not a sequence, ... That's a strange line break in the middle of the bottom row. ... My name is dsb, and I'm at prairienet, which is an O-R-G. ...
    (comp.lang.lisp)
  • Re: Replacing subsequences
    ... In LispWorks: ... But in CLISP and SBCL: ... So your code works as long as the NEW sequence is the same length as the ...
    (comp.lang.lisp)