[mercury-users] More on tutorials, examples etc.

Luke Evans Luke.Evans at seagatesoftware.com
Tue Jun 15 02:21:03 AEST 1999


I'm dead interested to see what rabbits Ralph Becket pulls out of the hat
when the next installation of the tutorial rolls off the presses (no
pressure intended Ralph!), but one thing I'd love to get a set of examples
for is the Mercury typeclass system.

Coming from an OO background, this seems to match with a lot of concepts I'm
familiar with, yet after reading the Mercury Language Document a number of
times, I'm still left feeling like I need someone to take me by the hand and
introduce me to it!  There's scant opportunity to pick this stuff up by
inspection either, as this feature appears largely absent from Mercury code
in the samples and compiler/library sources (because it's a reasonably
recent feature).

On a separate note (by following from previous mails on this subject), now
that I'm spending rather more of my time with Mercury than before (and even
being paid for doing so!), I'm collating an 'examples compendium' of my own
which I'll send along in due course.  There are two sections to this:

- How do I <X>?
- Why does it <X>?

The first is a set of code fragments for doing certain simple things:  
How do I loop through a list and print the contents?
How do I access the fields within a type?
...

The second is a set of things the compiler can often say to you, because you
screwed up (often only slightly), and offers a pattern for fixing the
problem e.g.:
Missing out the { } to escape DCG expansion
Simple mode or determinism mismatches (like 'multi' inferred due to multiple
solutions in predicate, when you wanted det)

The aim is completely to help the poor imperative programmer in the first
few days of his Mercury exploration.  This is often the semantic details
that you bump into, just after you think you got the syntax right!  It's
also the stuff I _still_ bump into rather more often than I'd like to admit
:-)

Luke

--------------------------------------------------------------------------
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