[m-users.] Mercury to c# workflow?
David Epstein
davideps at umich.edu
Sat Jan 15 19:21:57 AEDT 2022
Julien,
Thanks again for the C# example in the repo! I think my use case for
"assert" and "retract" is the exact one described on page 4 of the Prolog
to Mercury transition guide, "Most uses of assert and retract in Prolog
programs are not actually intended to alter the program. Their purpose is
just to maintain a set of facts, with semantically separate sets of facts
being stored in separate predicates." I won't need to define new predicates
or rules during runtime, but I may want to change the assignment of terms
to predicates, for example, whether "is_citrus(orange)" from the C# side.
My questions below relate to this need:
(1) Would I just build a list of (predefined) terms of type fruit and send
them to "is_citrus(fruit::in)" like you did with "cube(int)"?
(2) How would I remove one or more assignments, e.g. so the database is
silent on whether orange is_citrus?
(3) How about members of types, could I add the new term "kiwi" to the list
of type fruit during runtime and have it exported automatically for
reference in C#?
-david
On Sat, Jan 15, 2022 at 5:03 AM Julien Fischer <jfischer at opturion.com>
wrote:
>
> Hi David,
>
> On Fri, 14 Jan 2022, David Epstein wrote:
>
> > Thank you for adding a csharp interface example under "samples"! I'm
> > studying it now. Do you happen to know if the Mercury compiler creates
> > a DLL file that is compatible with Xamarin.Forms and mobile
> > development?
>
> I have not tried it with Xamarin.Forms, nor have I heard from anyone who
> has. The C# code the Mercury compiler emits doesn't depend on anything
> other than standard C# languages constructs and what's in the C# version
> of the Mercury runtime and standard library; the DLLs should be fairly
> portable.
>
> Any Mercury code will you include in an application will have a
> dependency on mer_std.dll (i.e. the DLL containing the Mercury runtime
> and standard library). Again, I think most of that should be fairly
> portable -- if you encounter something that isn't let us know.
>
> Julien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220115/409c5225/attachment.html>
More information about the users
mailing list