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
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
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/
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
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.
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