[m-users.] Syntax error at token 'is': operator precedence error

Julien Fischer jfischer at opturion.com
Sat May 1 01:11:49 AEST 2021


Hi,

On Fri, 30 Apr 2021, Volker Wysk wrote:

> I'm trying to define a predicate, which takes another predicate of arity 0
> as its first argument:
>
> :- pred issat(pred, bool).
> :- mode issat(pred is semidet, out) is det.


"pred" in the mode declaration requires parentheses for arity zero
predicates, e.g. it should be:

    :- mode issat((pred) is semidet, out) is det.

> issat(Pred, Issat) :-
>    ( if Pred then Issat = yes
>              else Issat = no
>    ).

(The standard library contains a function providing the above,
bool.pred_to_bool/2.)

Julien.


More information about the users mailing list