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

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jun 15 12:37:29 AEST 1999


On 14-Jun-1999, Luke Evans <Luke.Evans at seagatesoftware.com> wrote:
> 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)

That sounds like a great idea.

For the second part, it sounds like some of these would also be good hints
about ways to improve the compiler's diagnostics.  For example, it probably
wouldn't be too hard for the compiler to keep track of which predicates
were defined using DCG notation, and then whenever it gets a type error of
the form "call to predicate with wrong number of arguments,
got N, expecting N+2", it could also print out an additional message
telling the user that they probably forgot to put in the { } to escape
DCG expansion.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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