[m-users.] Functions vs Predicates?

M McDonough foolkingcrown at gmail.com
Sat Oct 31 12:29:32 AEDT 2020


2020-10-31 04:01 GMT+11:00 "Qqwy/Wiebe-Marten" <qqwy at gmx.com>:
> I tried to translate a Prolog Sudoku-solver/generator/tester (c.f.
> http://rosettacode.org/wiki/Sudoku#Prolog) to Mercuy, and immediately
> encountered
> the problem that higher-order predicates/functions such as `list.map`
> seemingly can only be used in a single mode at a time,
> since the predicate/function you pass to it needs to have only a single
> mode (if it has multiple you need to wrap it in a lambda expression that
> exposes only one of them).
> (C.f. the reference manual, 8.1)
>
> Is this an implementation limitation that might be lifted some time in
> the future?
> Or is this an inherent limitation of logic-based type checking? (Would
> type-checking become undecidable if multiple modes are allowed?)
> Or maybe I am simply doing something wrong?

I believe you can also get around this by only having a single mode be
possible based on the liveness of the arguments (especially unique
versus ground), and having the input predicate to exactly match one of
the declared modes. It must also not have any modes which are
ambiguous based on inputs only (such as both a `pred(in, out) is det`
and a `pred(in, uo) is det`).


More information about the users mailing list