[m-users.] Writing Prolog extensions in Mercury

Tomas By tomas at basun.net
Wed Mar 12 13:54:52 AEDT 2014


Hi,

I have no experience with extending SWI-prolog, but I have used Mercury
for "extending" Guile Scheme, and the GC is indeed a problem. Mercury has
apparently slightly modified the Boehm GC, and having two versions of it
does not work. (Earlier versions of Guile do not use Boehm.)

However, it sounds like you probably should not worry about combining
Mercury & Prolog, but just use both. First Prolog for experimentation, and
then switch to Mercury when you know what you want to do.

You can iterate this, ie write out your data from Mercury in a new format,
then load it into Prolog and experiment. It is very easy to read Prolog
data in Mercury, by defining a custom type describing the syntax.

/Tomas



On Wed, March 12, 2014 02:52, Haitao Zhang wrote:
> Hi,
>
> I am interested in using Mercury to write Prolog extensions. The first
> question that comes to mind is the GC issue, as Prolog (SWI in my case)
> has
> its own GC. I appreciate any thought on how important this is and if there
> are other potential problems.
>
> Background: I've read the previous threads discussing why there is no REPL
> support for Mercury and I largely agree with the view that it is not
> necessary for debugging purposes. However there is another modality where
> REPL is of great help which is the case of exploratory programming. In
> this
> case one may deal with complicated data that takes effort to be processed
> into a form that is amenable to manipulation and the programmer needs to
> interact with the data to decide what is the best way to proceed. I've
> found Prolog REPL to be indispensable for this purpose, however I would
> like to have better performance as the data set scales up. Writing Prolog
> extensions in C for performance enhancement though is quite painful
> because
> of the gap in semantics. I am interested in finding out if Mercury may be
> a
> better tool for this task.
>
> Thanks,
>
> Haitao
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://www.mercurylang.org/lists/listinfo/users
>





More information about the users mailing list