[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs
I see, that does work to define "if". (Racket, under #lang r6rs, only allows one "library" form, so I can't run all of the above directly without maybe creating separate files and figuring out how to load them... --which I just did.) Ok, your example works.
Is there a portable way within R6RS to effectively or actually turn off the explicit phasing when it exists? Imagine I want to do this for a large tree of macros. Is there a better approach than, say, creating a new library for each new macro?
Science is what we understand well enough to explain to a computer. Art is everything else we do. --Knuth
On Thu, Oct 11, 2012 at 8:55 PM, Aaron W. Hsu <arcfide@x>
Sorry, that was a quick one-off and not intended to be runnable (the
On Thu, 11 Oct 2012 22:21:05 -0400, John Boyle
> Aaron, I can't get your example to run.
export list is completely
invalid for one). Here's an example that you can actually cut and paste as
a series of libraries.
(import (rename (rnrs) (if %if)))
[(_) (%if #f #t)]
[(_ t c r ...) (%if t c (if r ...))])))
(import (except (rnrs) if) (for (extended-if) run expand))
(let ([x (cadr (syntax->datum x))])
(if x 42 (not x) 24))))
(define result (list (test #t) (test #f))))
Notice that you only need the explicit FOR when you are dealing with
explicit phasing systems like Racket. On systems like Chez or
Vicare/Ikarus, you should be able to just specify the (extended-if)
library and have things work.
Scheme-reports mailing list