[m-dev.] For review: minor additions to list.m and string.m

schachte at cs.mu.OZ.AU schachte at cs.mu.OZ.AU
Fri Sep 8 23:01:01 AEDT 2000


On  8 Sep, Ralph Becket wrote:
>> you know what I mean.)  Then if you want a geometric series you can
>> always write something like series(1, >(1000), *(2)).
> 
> One problem here is that >(1000) = ( pred(X::in) is semidet :- 1000 > X )
> which is probably not what is intended.

That is what I intended: lambda x . x < 1000.

But I do agree currying a non-commutative infix predicate or function
is very confusing, since you have to write the infix operator in a
prefix position so the left argument is written after the operator.

> Should I add something like the following to int.m?
> 
> 	% lt(Y) returns the predicate P succeeding for X
> 	% iff X < Y.
> 	%
> :- func lt(int) = pred(int).
> :- mode lt(in) = out(pred(in) is semidet).
> 
> lt(Y) = ( pred(X::in) is semidet :- X < Y ).
> 
> (sim. for le, gt, ge).

Hmmmmmmm.  That would read very nicely, but I think it still gets kind
of confusing, for the same reason (or maybe it's the dual reason).  When
you start thinking about it too closely, you realize that call(lt(X),Y)
means that Y < X.  But if you just read it quickly, it does look good,
so maybe you should go ahead with it anyway.

I think a nicer solution would to add operator sections somehow.  But I
don't know how you'd fit that into the parser.

-- 
Peter Schachte                     The use of COBOL cripples the mind; its
mailto:schachte at cs.mu.OZ.AU        teaching should, therefore, be regarded
http://www.cs.mu.oz.au/~schachte/  as a criminal offense.
PGP: finger schachte at 128.250.37.3      -- E. W. Dijkstra 

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