[mercury-users] Idea for a currying library

Michael Day mcda at cat.cs.mu.OZ.AU
Sat Jan 15 11:07:23 AEDT 2000


> 	> 	P = foo(X, #2, Y, #1)
> 	> 
> 	> would translate into
> 	> 
> 	> 	P = (func(A, B) = foo(X, B, Y, A))

When named predicate arguments are implemented would it be preferable to
curry by name rather than number? I've no idea what syntax would be
appropriate, but I would imagine something like this:

:- pred foo(name : string, size : int, color : tuple).

...

	P = foo(size = 3, name = "Rupert")

Would such a scheme be desirable? Doing anything based on the index of the
argument is quite uncomfortable when the number or ordering of the
arguments inevitably change.

Michael

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list