[m-dev.] list.all2

Paul Bone pbone at csse.unimelb.edu.au
Fri Jan 23 14:11:43 AEDT 2009


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?

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/2617f144/attachment.sig>


More information about the developers mailing list