for review: Add implementation of reference types, plus examples

Andrew Bromage bromage at cs.mu.OZ.AU
Wed Jan 28 00:30:56 AEDT 1998


G'day all.

Peter Schachte wrote:

> > :- pred between(int, int, int).
> > :- mode between(out, in, in) is nondet.
> > 
> > between(I, Low, High) :-
> > 	Low =< High,
> > 	(   I = Low
> > 	;   between(I, Low+1, High)
> > 	).

Fergus Henderson wrote:

> I've implemented that too often myself.
> That predicate is worth putting in library/int.m, I think.

I agree, but I think the arguments are in the "bad for currying" order
(though we have plenty of precedents for this inconvenient ordering,
e.g. set__member).

You want to be able to say:

	solutions(between(Lo, Hi), Values)

	list__filter(between(42, 48), Xs, Filtered)	% Inefficient but
							% very elegant.

And so on.

Cheers,
Andrew Bromage



More information about the developers mailing list