[plt-scheme] Redefining in Mzscheme with legacy R5RS support
Matthew Flatt <mflatt at cs.utah.edu> writes:
>If you really want to make this work, you can use functions like
>`namespace-require/copy' that are designed to work around the hopeless
>top level to some degree:
>
> laptop% plt-r5rs --no-prim
> Welcome to MzScheme v4.2.0.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
> R5RS legacy support loaded
> > (#%require (only scheme/base namespace-require/copy))
> > (namespace-require/copy 'scheme)
> > filter
> #<procedure:filter>
> > (define (filter x) (if x (filter #f) 'done))
> > (filter #t)
> done
>
>This doesn't help with bindings to syntax, though, and it hurts
>performance.
Thanks, but this brings me to my next question. Is there a way to have
both R5RS and MzScheme extensions working together without redefining?
For example, if I now try to use both R5RS and Mzscheme language, I
get:
Welcome to MzScheme v4.1.5 [3m], Copyright (c) 2004-2009 PLT Scheme
Inc.
> (#%require (only scheme/base namespace-require/copy))
> (namespace-require/copy 'scheme)
> (namespace-require/copy 'r5rs/run)
Welcome to MzScheme v4.1.5 [3m], Copyright (c) 2004-2009 PLT Scheme
Inc.
R5RS legacy support loaded
> (filter (lambda (x) x) '(1 2 3))
filter: expected argument of type <proper list>; given (1 2 3)
=== context ===
[...]/lib/plt/collects/scheme/private/list.ss:182:2: filter
[...]lib/plt/collects/scheme/private/misc.ss:74:7
[...]/lib/plt/collects/scheme/private/misc.ss:74:7
--
Timo Lilja