[mercury-users] Emacs mode; a_solution?

Robert Bossy bossy at ccr.jussieu.fr
Thu Jan 3 21:55:38 AEDT 2002


And so spoke Douglas Michael Auclair :

> Hi, I'm starting to program in Mercury to address some issues I have
parsing 
> a data description language.  I have a few questions:
> 
> * Is there an emacs mode somewhere?  I'm not looking for gud.el (I
think), 
> I'm looking for a fontifier, indenter, and (aiming high) interpreter for

> Mercury code in Emacs.

There is indeed, actually there are two I know of:
1- The prolog mode has a mercury minor mode, I use it and I like it:
http://www.freesoft.cz/~pdm/software/emacs/prolog-mode/

2- A specific mercury.el, I didn't try it:
search for mercury.el in the mercury-users archive.


> * How does one get only 1 solution of n solutions?  For example, how
would 
> one implement next_permutation([1, 2, 3, 4], L)?  The documentation
makes it 
> sound trivial, but I seem to be missing some fundamentals to get there.

For that example, there is a perm/2 predicate in the list library declared
as:
:- pred	list__perm(list(T), list(T)).
:- mode list__perm(in, out) is nondet.

I would use it in combination with the solutions/2 predicate from
std_util:
:- pred solutions(pred(T), list(T)).
:- mode solutions(pred(out) is nondet, out) is det.

So the goal would look like:
solutions(perm([1,2,3,4]),Perms)
And Perms would be a list (of lists of ints) and each element of that list
is a permutation of [1,2,3,4].


> * Writing of CLP ... is constraints.m available for hacking on (I saw 
> mention of it in an archive)?  I saw the CLP(R) implementation in the
extras 
> package with the associated warnings.  I was wondering if there was an 
> open-source, freely-usable implementation to work on and to use.  HAL
seems 
> like it's too far from Mercury for what I need.

gnuprolog and YAP prolog have CLP modules:
http://pauillac.inria.fr/~diaz/gnu-prolog/
http://www.ncc.up.pt/~vsc/Yap/


RB
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list