[plt-scheme] alternative amb macro

From: Ryan Culpepper (ryan_sml at yahoo.com)
Date: Sun Nov 26 12:34:54 EST 2006

--- michael rice <nowgate at yahoo.com> wrote:
> 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))))

Try the following:

  > (my-amb '((+ 1 2)))
  3

Seems odd, doesn't it? 

What do you intend the macro to do? Your macro accepts a single
argument. Is it any expression, or must it have a particular shape?

For example, should this work:
  (let ([nums (list 1 2 3)])
    (my-amb nums))

Ryan

> 
> Welcome to DrScheme, version 360.
> Language: Swindle.
> > (my-amb '(1 2 3))
> 1
> > (amb)
> 2
> > (amb)
> 3
> > 
> 
> Michael
>
> [...]
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.