[m-dev.] For review: minor additions to list.m and string.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Sep 8 23:42:22 AEDT 2000
On 08-Sep-2000, schachte at cs.mu.OZ.AU <schachte at cs.mu.OZ.AU> wrote:
> 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).
Yes. I think probably the clearest way of writing these is as
an explicit lambda expression.
Hence I don't think it would be worth adding `lt' etc. to int.m.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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