<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi David,<div class=""><br class=""></div><div class="">Check out the source code for a recent ROTD version and then read ./mercury-srcdist-20.06.1/README.CSharp</div><div class=""><br class=""></div><div class="">It might yield some useful starting points etc.</div><div class=""><br class=""></div><div class="">Sean</div><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On 5 Jan 2022, at 19:46, David Epstein <<a href="mailto:davideps@umich.edu" class="">davideps@umich.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">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 <i class="">mortal(X):-man(X) </i>  and the predicate <i class="">man(X) </i>could be compiled into C# and if new instances such as <i class="">man(john)</i> and <i class="">man(bob)</i> 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 <i class="">mutables</i> (from section 4 in the transition guide)?<br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 5, 2022 at 8:52 PM Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com" class="">zoltan.somogyi@runbox.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="">
<br class="">
On Wed, 5 Jan 2022 18:42:17 +0200, David Epstein <<a href="mailto:davideps@umich.edu" target="_blank" class="">davideps@umich.edu</a>> wrote:<br class="">
> For example, given:<br class="">
> <br class="">
> mortal(X) :- man(X).<br class="">
> <br class="">
> How would I dynamically (from c#) declare "man(Socrates)." and then query<br class="">
> if "human(Socrates)"?<br class="">
<br class="">
While a Prolog program allows the set of clauses in a predicate<br class="">
to be altered during runtime with assert and retract, Mercury does not.<br class="">
Please read section 4 of the Prolog to Mercury transition guide<br class="">
for the reason why it doesn't, and the many other solutions<br class="">
Mercury programmers can choose from.<br class="">
<br class="">
Note that this has nothing to do with C#, or with pragma foreign_export.<br class="">
<br class="">
You should also note that a fact of the form "man(Socrates)" would<br class="">
in fact assert that *everyone* is a man, because<br class="">
<br class="">
- "Socrates" starts with an upper case letter, which means it is a variable,<br class="">
- any value in the declared argument type of the "man/1" predicate,<br class="">
  which presumably is a type representing people, is an instance of this variable.<br class="">
<br class="">
Zoltan.<br class="">
<br class="">
<br class="">
<br class="">
</blockquote></div>
_______________________________________________<br class="">users mailing list<br class=""><a href="mailto:users@lists.mercurylang.org" class="">users@lists.mercurylang.org</a><br class="">https://lists.mercurylang.org/listinfo/users<br class=""></div></blockquote></div><br class=""></body></html>