[m-users.] A predicate taking a lists of predicates as input?
Volker Wysk
post at volker-wysk.de
Thu Sep 25 02:09:17 AEST 2025
Hi, Anders.
I don't completely get what you're trying to do now, but you can have
multiple mode lines for a predicate, with different determinism categories
in them. For instance:
:- pred ?(list(ta_rule(TKNS)), TKNS, TKNS).
:- mode ?(in(list(pred(in, out) is semidet)), in, out).
:- mode ?(in(list(pred(in, out) is det)), in, out).
You could also shut up the determinism warning which you get, by using ":-
pragma no_determinism_warning(...)".
Cheers,
Volker
Am Mittwoch, dem 24.09.2025 um 17:35 +0200 schrieb Anders Lundstedt:
> > % gives compilation error, but not if the both the determinism of ? and
> > of
> > % this predicate is changed to semidet, in which case we get warnings
> > about
> > % too loose determinism for ?
> > :- pred test_1(list(char)::in, list(char)::out) is det.
> > test_1 --> ?([['a'], ?([['b']])]).
>
> Sorry, tried to simplify too much. Here is a correct example:
>
> :- pred r_a(list(char)::in, list(char)::out) is semidet.
> :- pred r_b(list(char)::in, list(char)::out) is semidet.
> r_a --> ['a'].
> r_b --> ['b'].
> % gives compilation error, but not if the both the determinism of ? and of
> % this predicate is changed to semidet, in which case we get warnings
> about
> % too loose determinism for ?
> :- pred test_1(list(char)::in, list(char)::out) is det.
> test_1 --> ?([r_a, ?([r_b])]).
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users
More information about the users
mailing list