[mercury-users] Idea for a currying library

Peter Schachte schachte at cs.mu.OZ.AU
Sat Jan 15 23:25:46 AEDT 2000


On 07-Jan-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> 	P = foo(X, #2, Y, #1)
> would translate into
> 	P = (func(A, B) = foo(X, B, Y, A))

On Tue, Jan 11, 2000 at 03:12:56PM +1300, Richard A. O'Keefe replied:
> ... I'm pretty sure someone
> else suggested that, and I attacked it.  I've had a strong dislike for
> notations that require people to count

Richard goes on to recommend

> :- module(callperm, [
>     %	call/1,
> 
> 	call_1/2,
> 
> 	call_1_2/3,
> 	call_2_1/3,

and so on...

I agree that interfaces based on counting are not ideal, but both of
these proposals are based on counting in one way or another, and once
both conventions are explained, I find

	maplist((#1 > 0), Numbers)

very much clearer than

	maplist(call_2_1(>,0), Numbers)

The only things I see to recommend the second approach over the first
is that it's easier implement and doesn't require changing the
language.  These are significant advantages, but I think for ease of
use and intuitiveness, the first approach is the clear winner.

-- 
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