[plt-scheme] redefinition of built in function needs to be done twice to be recursive?
This sure looks like a bug.
On Sep 30, 2008, at 9:50 AM, John Lawrence Aspden wrote:
> Hi, in the process of porting a program with a different definition
> of assq,
> I encountered some behaviour which I'm having trouble understanding:
>
> pasted verbatim from interactions window, definitions window
> contains (only)
> #lang scheme, run button freshly pressed:
>
> Welcome to DrScheme, version 4.1.0.3 [3m].
> Language: Module; memory limit: 228 megabytes.
>> (define (assq a alist) (if (null? alist) #f (if (eq? (caar alist)
>> a) alist
> (assq a (cdr alist)))))
>> (assq 'b '((a . 1)(b . 2)))
> (b . 2)
>> (define (assq a alist) (if (null? alist) #f (if (eq? (caar alist)
>> a) alist
> (assq a (cdr alist)))))
>> (assq 'b '((a . 1)(b . 2)))
> ((b . 2))
>>
>
> It seems that the first definition works like let and the second
> (identical)
> definition works like letrec.
>
> It doesn't happen if you put the definitions in the definition
> window, and
> it doesn't seem to happen if the function's called my-assq.
>
> Can anyone explain what's going on?
>
> Cheers, John.
>
> --
> Contractor in Cambridge UK -- http://www.aspden.com
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme