[m-dev.] trivial diff: fix calculator.m bug

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 28 19:45:31 AEST 1999


Estimated hours taken: 0.1

samples/calculator.m:
	Fix a bug in my previous change.
	Also change the program so that it prints a "calculator> " prompt.

Workspace: /home/mercury0/fjh/mercury
Index: samples/calculator.m
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/calculator.m,v
retrieving revision 1.6
diff -u -d -r1.6 calculator.m
--- calculator.m	1999/10/26 14:14:18	1.6
+++ calculator.m	1999/10/28 09:43:09
@@ -24,6 +24,7 @@
 	;       div(expr, expr).
 
 main --> 
+	io__write_string("calculator> "),
 	io__read_line(Res),
 	( { Res = error(_) },
 		io__write_string("Error reading from stdin\n")
@@ -31,7 +32,7 @@
 		io__write_string("EOF\n")
 	; { Res = ok(Line) },
 		( { fullexpr(X,Line,[]) } ->
-			{ evalexpr(X, Num) },
+			{ Num = evalexpr(X) },
 			io__write_int(Num),
 			io__write_string("\n")
 		;

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