f



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

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))

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?

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

debian etch i686
0
budden01 (75)
9/23/2008 3:14:07 PM
comp.lang.lisp 16861 articles. 5 followers. Post Follow

9 Replies
342 Views

Similar Articles

[PageSpeed] 52

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

0
9/23/2008 4:56:48 PM
In article <48d924ba$0$12875$834e42db@reader.greatnowhere.com>,
 Leandro Rios <leandroprogramador@gmail.com> wrote:

> 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)

I would expect that FIND :start a :end b does only search
the elements from a to b-1. It is not necessary to apply
the key function to element b, since it is not searched.
At least the implementations I tried behave that way...

> 
> and you'll see.
> 
> hth,
> 
> Leandro
> 
> > 
> >> (lisp-implementation-type)
> > "SBCL"
> >> (lisp-implementation-version)
> > "1.0.20"
> > 
> > debian etch i686

-- 
http://lispm.dyndns.org/
0
joswig8642 (2203)
9/23/2008 5:32:12 PM
On 23 sep, 14:32, Rainer Joswig <jos...@lisp.de> wrote:

> I would expect that FIND :start a :end b does only search
> the elements from a to b-1. It is not necessary to apply
> the key function to element b, since it is not searched.
> At least the implementations I tried behave that way...

You're right, Rainer. The clhs glossary says:

"bounded adj. (of a sequence S, by an ordered pair of bounding indices
istart and iend) restricted to a subrange of the elements of S that
includes each element beginning with (and including) the one indexed
by istart and continuing up to (but not including) the one indexed by
iend."

Thanks for pointing this out. Apologies to the OP, he's right, it
seems to be a bug in SBCL.

Leandro
0
9/23/2008 6:32:22 PM
Ok. Is there a reliable way to report the bug? Sorry for asking it
here...
0
budden01 (75)
9/23/2008 6:49:58 PM
On Sep 23, 10:49=A0pm, budden <budde...@mtu-net.ru> wrote:
> Ok. Is there a reliable way to report the bug? Sorry for asking it
> here...

sbcl-devel mailing list.
0
stassats (8)
9/23/2008 7:45:51 PM
On Tue, 23 Sep 2008 12:45:51 -0700, stassats wrote:

> On Sep 23, 10:49 pm, budden <budde...@mtu-net.ru> wrote:
>> Ok. Is there a reliable way to report the bug? Sorry for asking it
>> here...
> 
> sbcl-devel mailing list.

Like the OP, I have never been able to post to the SBCL mailing list (or 
any other list on sourceforge.net for that matter) from my university 
account.  So I just created an account on Gmail - maybe something like 
that would work for the OP.

Tamas
0
tkpapp (998)
9/23/2008 8:49:03 PM
Tamas K Papp <tkpapp@gmail.com> writes:

> > sbcl-devel mailing list.
>
> Like the OP, I have never been able to post to the SBCL mailing list (or 
> any other list on sourceforge.net for that matter) from my university 
> account.  So I just created an account on Gmail - maybe something like 
> that would work for the OP.

Sbcl-devel, like many other mailinglists, is available through Gmane
which offerns a very nice mailing-list to nntp gateway.

  -T.
0
tcr8807 (219)
9/23/2008 8:51:19 PM
Thanks for the advices. Hope I'll try them soon.
0
budden01 (75)
9/24/2008 11:49:34 AM
On Sep 24, 7:49=A0am, budden <budde...@mtu-net.ru> wrote:
> Thanks for the advices. Hope I'll try them soon.

FWIW, the bug is fixed in SBCL 1.0.20.29 in CVS (well, after the 15 or
whatever minutes it takes for things to percolate to the anonCVS.)

Cheers,

 -- Nikodemus
0
nikodemus (193)
9/24/2008 2:56:49 PM
Reply: