[m-dev.] for review: changes to the tutorial

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Jul 15 18:05:52 AEST 1999


Hi Ralph,

Could you please review this? I suspect that my improvements might themselves
be improved...


Estimated hours taken: 1

A bunch of little clarifications that came up after a new user (Anthony
Senyard) went through the tutorial. Thanks Anthony.

tutorial/description-etc.m4:
	Write a condition as `X >= 7' rather than `7 =< X'.
	Refer explicitly to the binding of a particular variable rather
	than referring to `solutions' when explaining backtracking.
tutorial/hello-world.m4:
	Remove a rogue LIBSECio. It was causing a number to appear at the
	start of a line where it wasn't needed.
tutorial/sums-n-things.m4:
	Clarify that the integer *type* is built in, but the operations on
	integers aren't.
	Make the names of some variables consistent.
tutorial/types-n-things.m4:
	Fix a typo.


cvs diff: Diffing .
Index: determinism-etc.m4
===================================================================
RCS file: /home/staff/zs/imp/tutorial/determinism-etc.m4,v
retrieving revision 1.1
diff -u -t -r1.1 determinism-etc.m4
--- determinism-etc.m4	1999/03/05 14:46:14	1.1
+++ determinism-etc.m4	1999/07/15 07:24:25
@@ -253,12 +253,13 @@
 into play.  Consider the following piece of code (TT(X) is assumed to
 be initially unbound):
 CODE(
-`       member(X, [1, 2, 4, 8, 16]), 7 =< X
+`       member(X, [1, 2, 4, 8, 16]), X >= 7
 ')
 What MERCURY does here is look for a solution to
-TT(`member(X, [1, 2, 4, 8, 16])') and then tries TT(`7 =< X').  If the
+TT(`member(X, [1, 2, 4, 8, 16])') and then tries TT(`X >= 7').  If the
 comparison fails, then execution EM(backtracks) to look for another
-solution to the call to TT(member/2).  If no solution can be found
+solution to the call to TT(member/2), binding TT(X) to another value.  
+If no binding for TT(X) can be found
 that allows the comparison to succeed then the whole clause fails.
 If MERCURY generates solutions to the first goal in the following
 order:
Index: hello-world.m4
===================================================================
RCS file: /home/staff/zs/imp/tutorial/hello-world.m4,v
retrieving revision 1.1
diff -u -t -r1.1 hello-world.m4
--- hello-world.m4	1999/03/05 14:46:15	1.1
+++ hello-world.m4	1999/07/15 06:51:09
@@ -39,7 +39,6 @@
 particular name, then it should be declared in the implementation
 section rather than the interface.
 
-LIBSECio
 This module uses names defined in the LIB(io) library module.  This is
 what the declaration
 CODE(
Index: sums-n-things.m4
===================================================================
RCS file: /home/staff/zs/imp/tutorial/sums-n-things.m4,v
retrieving revision 1.1
diff -u -t -r1.1 sums-n-things.m4
--- sums-n-things.m4	1999/03/05 14:46:21	1.1
+++ sums-n-things.m4	1999/07/15 06:58:24
@@ -5,7 +5,10 @@
 Next on the agenda is how to construct predicates and functions that
 calculate with numbers.  MERCURY is unusual in that you actually have
 to import the module that defines the basic integer operations,
-whereas in most languages they are built in.  There are good reasons
+whereas in most languages they are built in.  
+Although the integer type is built in, but the basic operations 
+that act upon them (eg. TT(+), TT(-)) are not.
+There are good reasons
 for this, but this tutorial is probably not the place to discuss them.
 So just trust us.
 
@@ -51,11 +54,11 @@
 This code is pretty straightforward.  One thing to be aware of is that
 you will often see
 CODE(
-`       ( if Condition then TrueCase else ElseCase )
+`       ( if Condition then ThenCase else ElseCase )
 ')
 written as
 CODE(
-`       ( Condition -> TrueCase ; FalseCase )
+`       ( Condition -> ThenCase ; ElseCase )
 ')
 This syntax is a throwback to MERCURY's ancestor, Prolog.
 
Index: types-n-things.m4
===================================================================
RCS file: /home/staff/zs/imp/tutorial/types-n-things.m4,v
retrieving revision 1.1
diff -u -t -r1.1 types-n-things.m4
--- types-n-things.m4	1999/03/05 14:46:23	1.1
+++ types-n-things.m4	1999/07/15 06:57:09
@@ -4,7 +4,7 @@
 
 We have seen a couple of types introduced already and it's probably
 time to say a few more words about them.  There are three kinds
-of type in MERCURY: discriminated unions, equivalence types and
+of types in MERCURY: discriminated unions, equivalence types and
 abstract types.  We'll have a look at each of these in order.
 
 All discriminated union types look something like this:
cvs diff: Diffing src


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list