[mercury-users] Mercury needs a Tutorial

Bas de Bakker basde.bakker at pica.nl
Thu Feb 11 23:51:17 AEDT 1999


>>>>> "Ralph" == Ralph Becket <rwab1 at cam.sri.com> writes:

    Ralph> Funnily enough, I started work on a tutorial last night.

Even more funnily (?), so did I last week.  I must say I did not find
this easy at all.  Texts on logic programming that I've seen are
usually along the lines of

1) Assume knowledge of (first order) predicate logic.
2) Explain Herbrand terms, unification, SLDF derivations and such.
3) Introduce "pure" logic programming.
4) Introduce impure constructs (var(X), !, etc).  We won't need this
   step. :-)

I doubt whether the average programmer will read all that when trying
to learn a new language.

    Ralph> I'm inclined (and this is the approach I started out with
    Ralph> last night) to assume nothing other than a reasonably
    Ralph> general computer science background and some past
    Ralph> programming experience.

So am I.  Not many programmers are familiar with Prolog.

    Ralph> 2. To teach by example or not?  I've started out with
    Ralph> "Hello, World!"  as is the tradition.

Indeed, so did I.

    Ralph> 3. Traditional `flat' text vs hypertext.

I'm using texinfo.  TeX output looks good (although texinfo generates
too much whitespace) and unlike using (La)TeX directly (the only other
way I considered) you can easily create online documents.

Also, it is my experience that if you create documentation for
software packages in anything other than manpages or info format, it
will not be installed in a place where it is easy to find and users
that have not installed the package themselves do not read it.

    Ralph> 4. One problem with teaching Mercury is that there are a
    Ralph> number of subtle aspects to the language that you are
    Ralph> usually forced to consider explicitly in your code
    Ralph> (e.g. mode and determinism declarations).  Teaching a
    Ralph> non-Prolog type how "Hello, World!" works is non-trivial.
    Ralph> The very first example introduces modules, interfaces,
    Ralph> module use, implementations, unique modes and DCGs!

My "Hello, World!" doesn't use DCGs.  module use and
interface/implementation in some way is very common (C/C++ has
headers, many other languages have similar constructs).  I tried to
delay explaining the "destructive input" and "unique output", by
saying that "for now, just think of it as a peculiarity of I/O".

    Ralph> 5. How far is the tutorial expected to take people?

Begin at the beginning.  Add more later if time allows.  It could
cover everything.

I'll contact Ralph by private email about cooperation.

Regards,
Bas.



More information about the users mailing list