[m-dev.] Syntactic sugar for functor matching
Tyson Dowd
trd at cs.mu.OZ.AU
Wed Oct 31 16:14:38 AEDT 2001
On 31-Oct-2001, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Occasionally one comes across code like this:
>
> p(constructor1(_, _, _), ...) :- ...
> p(constructor2(_, _, _, _, _), ...) :- ...
> p(constructor3(_, _, _, _), ...) :- ...
> p(constructor4(_, _, _, _, _, _, _), ...) :- ...
>
> Which looks rather awkward. Would there be any merit in extending
> the language so that one could write
>
> p(constructor1/3, ...) :- ...
> p(constructor2/5, ...) :- ...
> p(constructor3/4, ...) :- ...
> p(constructor4/7, ...) :- ...
>
> or something similar (I am aware that overloading `/' this way is
> probably not a good thing.)
>
> On the other hand, this is perhaps just too infrequent a "problem" to
> worry about.
For what it is worth, I've often wished we had such a thing.
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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