[m-dev.] list.all2

Paul Bone pbone at csse.unimelb.edu.au
Fri Jan 23 15:00:54 AEDT 2009


On Fri, Jan 23, 2009 at 02:57:25PM +1100, Mark Brown wrote:
> On 23-Jan-2009, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> > 
> > Hi Guys.
> > 
> > I've created a predicate list.all2 that succeeds if two lists are equal
> > and all pairs of elements from each satisfy a predicate.
> > 
> > :- pred list_all2(pred(A, B), list(A), list(B)).
> > :- mode list_all2(pred(in, in) is semidet, in, in) is semidet.
> > 
> > list_all2(_, [], []).
> > list_all2(P, [X | Xs], [Y | Ys]) :-
> >     P(X, Y),
> >     list_all2(P, Xs, Ys).
> > 
> > 
> > Is this useful enough to be added to the standard library?
> 
> It already has been ;-).  There is an (in, in) mode of list.map which
> does this.

d'oh!

Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20090123/d5e6e831/attachment.sig>


More information about the developers mailing list