[m-users.] A predicate taking a lists of predicates as input?
Volker Wysk
post at volker-wysk.de
Thu Sep 25 02:35:00 AEST 2025
Am Mittwoch, dem 24.09.2025 um 18:09 +0200 schrieb Tomas By:
> On Wed, 24 Sep 2025 17:32:05 +0200, Anders Lundstedt wrote:
> > Thanks everyone for the help! Now another, related, issue.
>
>
> So `?' applies a list of rules, and then you are nesting them?
>
> First, you could look at list:all_true/1 and related preds.
>
> Then it might be better if you try to explain what it is all about.
>
> If you want to parse a limited, static formalism, like some variant of
> predicate logic, then DCG may not be the best solution.
DCGs are just a handy syntax for predicates with a state variable at the end
of the arguments. When you have that in mind, it's doesn't matter if you use
DCGs or state variables explicitly.
>
> If you really want to use DCG, ie experiment with the grammar and have
> something that is easy to work with, then just declare everything
> nondet and be done with it.
>
> You just need a top-level call that handles the nondeterminism (calls
> solution/2 and picks the first in the list of results).
I don't think that's a good idea, for various reasons.
Cheers,
Volker
More information about the users
mailing list