[mercury-users] Idea for a currying library
Peter Schachte
schachte at cs.mu.OZ.AU
Sat Jan 15 23:40:53 AEDT 2000
On Sat, Jan 15, 2000 at 11:07:23AM +1100, Michael Day wrote:
> 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")
I think named arguments would be a good thing (though being lazy, I
probably wouldn't use them much without support from my editor).
However, I don't think they'd help very much for in providing more
flexible currying. For example, in your example, I assume you'd need
to invoke P as something like
P(color=...).
But what are the chances that the higher-order predicate you're
passing P to will know that what it needs to supply to the closure is
a color?
If you expected P would be invoked without a supplied argument name,
then this would work fine for closures expecting one argument, but
when more than 1 argument is missing, you're back to the same old
problem (but worse, since there's no natural argument order to
determne which missing argument is which).
--
Peter Schachte Many men stumble across the truth, but
mailto:schachte at cs.mu.OZ.AU most manage to pick themselves up and
http://www.cs.mu.oz.au/~schachte/ continue as if nothing had happened.
PGP: finger schachte at 128.250.37.3 -- Winston Churchill
--------------------------------------------------------------------------
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