[m-rev.] trivial diff: use state vars in referance manual example

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Feb 22 17:07:18 AEDT 2007


Estimated hours taken: 0.1
Branches: main

doc/reference_manual.texi:
 	Use state variables in place of DCGs for threading the I/O state
 	in some example code.

Julien.

Index: reference_manual.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.384
diff -u -r1.384 reference_manual.texi
--- reference_manual.texi	22 Feb 2007 03:50:37 -0000	1.384
+++ reference_manual.texi	22 Feb 2007 06:04:13 -0000
@@ -5391,12 +5391,11 @@
  :- pred portray_list(list(T), io.state, io.state) <= portrayable(T).
  :- mode portray_list(in, di, uo) is det.

-portray_list([]) --> 
-        [].
-portray_list([X|Xs]) --> 
-	portray(X),
-	io.write_char(' '),
-	portray_list(Xs).
+portray_list([], !IO).
+portray_list([X | Xs], !IO) :-
+	portray(X, !IO),
+	io.write_char(' ', !IO),
+	portray_list(Xs, !IO).
  @end example

  For abstract instance declarations, the type class constraints on an

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list