[m-rev.] trivial diff: fix the calculator2 sample

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Apr 4 14:58:28 AEDT 2008


Estimated hours take: 0.1
Branches: main

Update the calculator2 sample.

samples/calculator2.m:
 	Conform to the recent change to the term.const/0 type.

Julien.

Index: calculator2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/calculator2.m,v
retrieving revision 1.5
diff -u -r1.5 calculator2.m
--- calculator2.m	4 Jun 2007 07:48:56 -0000	1.5
+++ calculator2.m	4 Apr 2008 03:56:42 -0000
@@ -109,9 +109,6 @@
  report_eval_error(unexpected_const(Const), !IO) :-
      io.write_string("unexpected ", !IO),
      (
-        Const = term.integer(_),
-        error("report_eval_error")
-    ;
          Const = term.float(Float),
          io.write_string(" float `", !IO),
          io.write_float(Float, !IO),
@@ -122,7 +119,10 @@
          io.write_string(String, !IO),
          io.write_string("""", !IO)
      ;
-        Const = term.atom(_),
+        ( Const = term.integer(_)
+        ; Const = term.atom(_)
+        ; Const = term.implementation_defined(_)
+        ),
          error("report_eval_error")
      ),
      io.nl(!IO).
@@ -155,6 +155,9 @@
          throw(unexpected_const(term.float(Float)) - Context).
  eval_expr(_, _, term.functor(term.string(String), _, Context)) =
          throw(unexpected_const(term.string(String)) - Context).
+eval_expr(_,  _, term.functor(ImplDefConst, _, Context)) = _ :-
+    ImplDefConst = term.implementation_defined(_),
+    throw(unexpected_const(ImplDefConst) - Context).

  :- func eval_unop(string, int) = int is semidet.


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