[m-users.] Mercury to c# workflow?

David Epstein davideps at umich.edu
Thu Jan 6 06:46:40 AEDT 2022


Thanks for your quick response Zoltan. I'm not skilled enough in Prolog or
Mercury yet to be sure I'm asking the question correctly, but I essentially
want to know if the rule *mortal(X):-man(X) * and the predicate *man(X) *could
be compiled into C# and if new instances such as *man(john)* and *man(bob)*
could later be created during runtime, e.g. when a user clicks on the
"create man" button in the GUI? Is this the purpose of *mutables* (from
section 4 in the transition guide)?

On Wed, Jan 5, 2022 at 8:52 PM Zoltan Somogyi <zoltan.somogyi at runbox.com>
wrote:

>
>
> On Wed, 5 Jan 2022 18:42:17 +0200, David Epstein <davideps at umich.edu>
> wrote:
> > For example, given:
> >
> > mortal(X) :- man(X).
> >
> > How would I dynamically (from c#) declare "man(Socrates)." and then query
> > if "human(Socrates)"?
>
> While a Prolog program allows the set of clauses in a predicate
> to be altered during runtime with assert and retract, Mercury does not.
> Please read section 4 of the Prolog to Mercury transition guide
> for the reason why it doesn't, and the many other solutions
> Mercury programmers can choose from.
>
> Note that this has nothing to do with C#, or with pragma foreign_export.
>
> You should also note that a fact of the form "man(Socrates)" would
> in fact assert that *everyone* is a man, because
>
> - "Socrates" starts with an upper case letter, which means it is a
> variable,
> - any value in the declared argument type of the "man/1" predicate,
>   which presumably is a type representing people, is an instance of this
> variable.
>
> Zoltan.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220105/342cd1c0/attachment.html>


More information about the users mailing list