|
|
is there a bug in the SRFI-1 reference implementation?
I'm having trouble with filter using chicken. I spent quite a while
trying to debug my program and then tried the example given in the
documentation:-
#;1> (even? 12)
#t
#;2> (filter even? '(0 7 8 8 43 -4))
Error: (car) bad argument type: #<procedure (even? n451)>
Call history:
<syntax> (filter even? (quote (0 7 8 8 43 -4)))
<syntax> (quote (0 7 8 8 43 -4))
<eval> (filter even? (quote (0 7 8 8 43 -4)))
<eval> [filter] (null? li)
<eval> [filter] (include? (car li))
<eval> [filter] (car li) <--
|
|
0
|
|
|
|
Reply
|
nick_keighley_nospam (4574)
|
2/3/2010 11:26:37 AM |
|
On 3 Feb, 11:26, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
> I'm having trouble with filter using chicken. I spent quite a while
> trying to debug my program and then tried the example given in the
> documentation:-
>
> #;1> (even? 12)
> #t
> #;2> (filter even? '(0 7 8 8 43 -4))
> Error: (car) bad argument type: #<procedure (even? n451)>
>
> =A0 =A0 =A0 =A0 Call history:
>
> =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(filter even? (qu=
ote (0 7 8 8 43 -4)))
> =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(quote (0 7 8 8 4=
3 -4))
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0(filter even? (quote (0 7 8 8 4=
3 -4)))
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (null? li)
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (include? (car li))
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (car li) =A0 =A0 =A0 <=
--
oops! probably no! The code shown in the stack trace isn't in the
reference model. I'm guessing I've got a collision between a chicken
version of filter and the srfi-1 one (bet they have the parameters the
other way around)
|
|
0
|
|
|
|
Reply
|
Nick
|
2/3/2010 11:37:58 AM
|
|
On 3 Feb, 11:37, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
> On 3 Feb, 11:26, Nick Keighley <nick_keighley_nos...@hotmail.com>
> wrote:
>
>
>
>
>
> > I'm having trouble with filter using chicken. I spent quite a while
> > trying to debug my program and then tried the example given in the
> > documentation:-
>
> > #;1> (even? 12)
> > #t
> > #;2> (filter even? '(0 7 8 8 43 -4))
> > Error: (car) bad argument type: #<procedure (even? n451)>
>
> > Call history:
>
> > <syntax> (filter even? (quote (0 7 8 8 43 -4)))
> > <syntax> (quote (0 7 8 8 43 -4))
> > <eval> (filter even? (quote (0 7 8 8 43 -4)))
> > <eval> [filter] (null? li)
> > <eval> [filter] (include? (car li))
> > <eval> [filter] (car li) <--
>
> oops! probably no! The code shown in the stack trace isn't in the
> reference model. I'm guessing I've got a collision between a chicken
> version of filter and the srfi-1 one (bet they have the parameters the
> other way around)
not according to the chicken documentation. Which looks like a
straight lift from SRFI-1 (right down to the example).
On the other hand Gambit, MIT and even TinyScheme(!) all handle this
code fine. I'll go and squawk at chicken.
|
|
0
|
|
|
|
Reply
|
Nick
|
2/3/2010 12:55:52 PM
|
|
On Feb 3, 6:55=A0am, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
> On 3 Feb, 11:37, Nick Keighley <nick_keighley_nos...@hotmail.com>
> wrote:
>
>
>
>
>
> > On 3 Feb, 11:26, Nick Keighley <nick_keighley_nos...@hotmail.com>
> > wrote:
>
> > > I'm having trouble with filter using chicken. I spent quite a while
> > > trying to debug my program and then tried the example given in the
> > > documentation:-
>
> > > #;1> (even? 12)
> > > #t
> > > #;2> (filter even? '(0 7 8 8 43 -4))
> > > Error: (car) bad argument type: #<procedure (even? n451)>
>
> > > =A0 =A0 =A0 =A0 Call history:
>
> > > =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(filter even?=
(quote (0 7 8 8 43 -4)))
> > > =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(quote (0 7 8=
8 43 -4))
> > > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0(filter even? (quote (0 7 8=
8 43 -4)))
> > > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (null? li)
> > > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (include? (car li)=
)
> > > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (car li) =A0 =A0 =
=A0 <--
>
> > oops! probably no! The code shown in the stack trace isn't in the
> > reference model. I'm guessing I've got a collision between a chicken
> > version of filter and the srfi-1 one (bet they have the parameters the
> > other way around)
>
> not according to the chicken documentation. Which looks like a
> straight lift from SRFI-1 (right down to the example).
>
> On the other hand Gambit, MIT and even TinyScheme(!) all handle this
> code fine. I'll go and squawk at chicken.
Bigloo:
1:=3D> (filter even? '(0 7 8 8 43 -4))
(0 8 8 -4)
|
|
0
|
|
|
|
Reply
|
w_a_x_man
|
2/3/2010 8:09:04 PM
|
|
On 3 Feb., 12:26, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
> I'm having trouble with filter using chicken. I spent quite a while
> trying to debug my program and then tried the example given in the
> documentation:-
>
> #;1> (even? 12)
> #t
> #;2> (filter even? '(0 7 8 8 43 -4))
> Error: (car) bad argument type: #<procedure (even? n451)>
>
> =A0 =A0 =A0 =A0 Call history:
>
> =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(filter even? (qu=
ote (0 7 8 8 43 -4)))
> =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(quote (0 7 8 8 4=
3 -4))
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0(filter even? (quote (0 7 8 8 4=
3 -4)))
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (null? li)
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (include? (car li))
> =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (car li) =A0 =A0 =A0 <=
--
Is it possible that you somehow load a file that defines
a different version of `filter' at toplevel?
cheers,
felix
|
|
0
|
|
|
|
Reply
|
bunny351
|
2/4/2010 10:39:34 AM
|
|
On 4 Feb, 10:39, "bunny...@yoho-gmail.com" <bunny...@gmail.com> wrote:
> On 3 Feb., 12:26, Nick Keighley <nick_keighley_nos...@hotmail.com>
> wrote:
>
>
>
>
>
> > I'm having trouble with filter using chicken. I spent quite a while
> > trying to debug my program and then tried the example given in the
> > documentation:-
>
> > #;1> (even? 12)
> > #t
> > #;2> (filter even? '(0 7 8 8 43 -4))
> > Error: (car) bad argument type: #<procedure (even? n451)>
>
> > =A0 =A0 =A0 =A0 Call history:
>
> > =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(filter even? (=
quote (0 7 8 8 43 -4)))
> > =A0 =A0 =A0 =A0 <syntax> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(quote (0 7 8 8=
43 -4))
> > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0(filter even? (quote (0 7 8 8=
43 -4)))
> > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (null? li)
> > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (include? (car li))
> > =A0 =A0 =A0 =A0 <eval> =A0 =A0 =A0 =A0 =A0[filter] (car li) =A0 =A0 =A0=
<--
>
> Is it possible that you somehow load a file that defines
> a different version of `filter' at toplevel?
>
> cheers,
> felix
very likely but I'm not sure what chicken is loading for me
ooo...
if I just load the sfri-1 library it works fine...
so what have I done?
good grief. Defined my own version of filter with the parameters the
wrong way round! Thanks to all who treated my post with seriousness!
Always remember the First Law of Programming: "it's always your fault"
|
|
0
|
|
|
|
Reply
|
Nick
|
2/4/2010 11:54:08 AM
|
|
|
5 Replies
80 Views
(page loaded in 0.108 seconds)
|
|
|
|
|
|
|
|
|