The great mercury tutorial

Robert Bossy bossy at ccr.jussieu.fr
Thu Apr 22 01:32:41 AEST 1999


I understand some feedback on the tutorial would be appreciated. Since
I'm not actually a computer scientist, I (hopefully) think my detailed
remarks will help a bit.

First of all, let me introduce myself: my name is Robert Bossy and I'm a
student (phd) in Paris, France. My research field is computer science
applied to biological research in particular to systematics and
taxonomy, so I deal a lot with data bases, knowledge bases and
ontologies.

My programming background: some experience with Pascal, C, Prolog, LISP
and Caml. My knowledge of each one of these languages is more or less
limited.


I will give some of my feelings and thoughts about each chapter of the
tutorial. While I would look full of criticism, you should know that the
tutorial is really great and I would never have installed and learned
Mercury at home without it. The reason I give this feedback is it would
be cool if a lot more of people discover and use Mercury.
Let's go for it:

1) Hello World: good introduction.

Some will point that introducing DCGs is useless but I don't think so.
It's ok to get people used with Mercury syntax and style.

Aren't you afraid that one would give up when reading "Think
mathematically and you'll be fine!" ?


2) Working With Lists: fine.

Unexpected token: "hysterical raisins" ... Inferred "hysterical reasons"


3) Sums and Functions: cool, there's an if/then/else structure... you
got rid of the "!".

A sumary of the Mercury different selection structures would be a nice
(but not necessary) thing: disjunction (explicit or not) and
if/then/else. Imperative programmers may be confused about the switch
structure that is not exactly the same in Mercury.


4) Defining New Types: there's a but...

It took me a few time to figure that type constructors are not types
themeselves. So one shouldn't type anything like this:
:- type foo ---> int ; char.
It could be particularly enraging for Caml users because Caml allows
type filters in functions.
I know it's in the FAQ but a tutorial is meant to avoid "common
programming errors" ;)

Bt the way, I can't remember where I saw this declaration:
:- type foo(T) ---> T(T).
What does the compiler understands?


5) Determinism and Backtracking: it is the most exciting part of Mercury
and it is well covered by the tutorial.

It's a good idea to quickly answer to the question: "is it possible to
write different definitions for different procedures of the same
predicate?"

Another good thing is to tip the reader on how make a det version of a
semidet, multi or nondet predicate. When learning a new language one
likes to compile however the main predicate can't be semidet, multi or
nondet.


6) Modes and Instantiation: fine.

A little sample of defining a new foo mode would help. One might think
this chapter is useless: "Very interesting but what can I do with those
states of instanciation?".


7) Clausal Form and Unification: ok.

It's a piece of cake for Prolog users. Ask a Prolog unaware for feedback
on this chapter.


8) Modules and Name Spaces: straightforward.

Let me congratulate the Mercury creators for this very simple and
sufficient module system.


9) Definite Clause Grammar: same remarks than chapter 6.


I hope these annotations will be of any use. An overall look tells us
that Mercury lacks some little meaningful (not the foo things) , this is
a difficult goal to achieve considering some topics like Modes and
Instantiation (chapter 6) because one can't imagine something simple,
short while meaningful.



Sincerly,

Robert Bossy
bossy at ccr.jussieu.fr



More information about the users mailing list