[mercury-users] clause/1, functor/3, arg/3 ...

Ralph Becket rwab1 at cam.sri.com
Tue Jul 8 20:19:32 AEST 1997


Fergus Henderson wrote:
> ...
> Another more long-term alternative would be to extend the
> Mercury support for meta-programming to include support for
> a Mercury equivalent to Prolog's clause/1, just as we have
> (in our latest development release) added support for Mercury
> equivalents to Prolog's functor/3 and arg/3.
> ...

I'm sure I'm being a bit dense here, but given Mercury's type scheme,
surely one can just use a switch and pattern matching to decide the
functor/arity/arguments of any structure?  I thought Prolog only
needed them *because* it doesn't have a (strong) type scheme.

What does functor/3 and arg/3 get you in Mercury?  I'm intrigued (or
very dim)!

Ralph



More information about the users mailing list