From: budden
Subject: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <82cf2fd6-7744-43fb-8681-6b95cf938ce3@79g2000hsk.googlegroups.com>
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

From: Leandro Rios
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <48d924ba$0$12875$834e42db@reader.greatnowhere.com>
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
From: Rainer Joswig
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <joswig-FD276D.19321223092008@news-europe.giganews.com>
In article <·························@reader.greatnowhere.com>,
 Leandro Rios <··················@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/
From: Leandro Ríos
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <ad0bc715-5259-465c-8f8e-f75916c542e4@r66g2000hsg.googlegroups.com>
On 23 sep, 14:32, Rainer Joswig <······@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
From: budden
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <54eadd1d-6a79-4bbf-8744-5260e7b817d3@d45g2000hsc.googlegroups.com>
Ok. Is there a reliable way to report the bug? Sorry for asking it
here...
From: stassats
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <eba5f4b6-78a4-4fc1-84c5-b97869df73a8@y38g2000hsy.googlegroups.com>
On Sep 23, 10:49 pm, budden <········@mtu-net.ru> wrote:
> Ok. Is there a reliable way to report the bug? Sorry for asking it
> here...

sbcl-devel mailing list.
From: Tamas K Papp
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <6jt31vF50sm6U1@mid.individual.net>
On Tue, 23 Sep 2008 12:45:51 -0700, stassats wrote:

> On Sep 23, 10:49 pm, budden <········@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
From: Tobias C. Rittweiler
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <87fxnq8u2g.fsf@freebits.de>
Tamas K Papp <······@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.
From: budden
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <902652fd-42a7-406f-aa08-41d197936750@m73g2000hsh.googlegroups.com>
Thanks for the advices. Hope I'll try them soon.
From: Nikodemus Siivola
Subject: Re: sbcl bug in ppsition and/or find with :start, :end and :key
Date: 
Message-ID: <a700e8b0-1b32-4091-8003-6b57705a98c9@e53g2000hsa.googlegroups.com>
On Sep 24, 7:49 am, budden <········@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