From: Jörg "F. Wittenberger" <[email protected]>
Subject: Re: [Chicken-users] redefining cons,car,cdr in SICP
Date: Fri, 03 Dec 2010 21:03:15 +0100

> Am Freitag, den 03.12.2010, 12:57 -0500 schrieb Hans Nowak:
>> On Fri, Dec 3, 2010 at 12:33, David Steiner <[email protected]> 
>> wrote:
>> > i'm reading SICP and practicing in chicken. in the book they redefine
>> > cons, car and cdr using procedures:
>> >
>> > (define (cons x y)
>> >  (define (dispatch m)
>> >    (cond ((= m 0) x)
>> >          ((= m 1) y)
>> >          (else (error "Argument not 0 or 1 -- CONS" m))))
>> >  dispatch)
>> > (define (car z) (z 0))
>> > (define (cdr z) (z 1))
>> >
>> > however it produces an error in chicken:
>> >   Error: (caar) bad argument type: #<procedure (dispatch m)>
>> >
>> > why doesn't it work?
> 
> This is clearly a bug!
> 

... depending on how `caar' was called here. David, what expression
did you enter?


cheers,
felix

_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to