[m-dev.] for review: allow clauses in instance declarations

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 7 19:32:22 AEDT 2000


On 07-Sep-2000, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> On 07-Sep-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 
> Nice one Fergus. It looks great. I've only got a couple of comments.
> 
> > +	% list__map_foldl2(Pred, InList, OutList, StartA, EndA, StartB, EndB)
> > +	% calls Pred with two accumulator (with the initial values of
> > +	% StartA and StartB respectively) on each element of InList
> > +	% (working left-to-right) to transform InList into OutList.
> > +	% The final values of the accumulators are returned in EndA
> > +	% and EndB respectively.
> > +:- pred list_map_foldl2(pred(X, Y, Z, Z, W, W), list(X), list(Y), Z, Z, W, W).
> > +:- mode list_map_foldl2(pred(in, out, in, out, di, uo) is det,
> > +			     in, out, in, out, di, uo) is det.
> > +
> > +list_map_foldl2(_, [],  [], A, A) -->
> > +        [].
> > +list_map_foldl2(P, [H0|T0], [H|T], A0, A) -->
> > +        call(P, H0, H, A0, A1),
> > +        list_map_foldl2(P, T0, T, A1, A).
> 
> One for the standard library. I've written this one myself a couple of times...
> there are definitely times when it is useful.

OK.  I'll commit it as is, and then move it to the standard library
as a separate change.

> > +			Result = ok(instance_method(PredOrFunc,
> > +					ClassMethodName,
> > +					% XXX FIXME handle multiple clauses
> > +					clauses([Item]),
> > +					ArityInt, Context))
> 
> It would be good if you could fix that XXX before committing. (If it a
> major hassle, leave it out for now, but it would be good).

I'm not sure exactly how much hassle it will be, but it's not trivial.
I'll commit it as is for now, since this is still a definite improvement
on the status quo.  And then I'll have a look at how difficult it is to
fix that XXX.

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