Re: [m-users.] Cartesian product of two sets of things.

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Am Dienstag, dem 10.10.2023 um 17:04 +1100 schrieb Julien Fischer:
> 
> On Mon, 9 Oct 2023, Volker Wysk wrote:
> 
> > Am Montag, dem 09.10.2023 um 11:04 +0200 schrieb Volker Wysk:
> > > :- pred cart_prod(set(T)::in, set(U)::in, set(pair(T, U))::out) is det.
> > 
> > Oops, that should be:
> > 
> > :- pred cart_prod(set(T)::in, set(U)::in, list(pair(T, U))::out) is det.
> 
> Either that, or you should call solutions_set:
> 
> cart_prod(Set1, Set2, Res) :-
>      solutions_set(
>          (pred((A - B)::out) is nondet :-
>              set.member(A, Set1),
>              set.member(B, Set2)
>          ),
>          Res).

Nice. Good to know. Thanks.

Volker
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.