[plt-scheme] alternative amb macro
michael rice skrev:
> Can this be accomplished with a single (simpler)
> macro?
>
> (define-syntax my-amb-aux
> (syntax-rules ()
> ((_ (quote (c1 ...)))
> (amb c1 ...))))
>
> (define-syntax my-amb
> (syntax-rules ()
> ((_ choices)
> (my-amb-aux choices))))
>
> Welcome to DrScheme, version 360.
> Language: Swindle.
>> (my-amb '(1 2 3))
> 1
>> (amb)
> 2
>> (amb)
> 3
Maybe this?
(define-syntax my-amb
(syntax-rules (quote)
[(_ (quote (c1 ...)))
(amb c1 ...)]))
(my-amb '(1 2 3))
(amb)
(amb)
(amb)
--
Jens Axel Søgaard