[m-dev.] Syntactic sugar for functor matching

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 2 17:40:06 AEDT 2001


On 02-Nov-2001, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> A related proposal is to allow `X @ f(...)' to denote pattern matching
> with f(...) and having X unify with that argument on success.
> 
> For example, rather than writing
> 
> 	p(f(A, B, C)) :- X = f(A, B, C), ...
> 
> one could write
> 
> 	p(X @ f(A, B, C)) :- ...
> 
> It's not clear to me that putting the pattern on the RHS of @ is
> the right thing to do, but that's what ML, Haskell, etc. do.

How about using `=' rather than `@', and allowing either order?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list