[MLton-commit] r6255

Vesa Karvonen vesak at mlton.org
Sun Dec 9 13:34:26 PST 2007


Simplified using prints.
----------------------------------------------------------------------

U   mltonlib/trunk/org/mlton/vesak/tech/oo/framework/prelude.sml
U   mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/circle.sml
U   mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/rectangle.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/org/mlton/vesak/tech/oo/framework/prelude.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/tech/oo/framework/prelude.sml	2007-12-09 21:30:43 UTC (rev 6254)
+++ mltonlib/trunk/org/mlton/vesak/tech/oo/framework/prelude.sml	2007-12-09 21:34:25 UTC (rev 6255)
@@ -8,6 +8,8 @@
 
 fun id x = x
 
+val prints = print o concat
+
 structure Int = struct
    open Int
    type t = int

Modified: mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/circle.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/circle.sml	2007-12-09 21:30:43 UTC (rev 6254)
+++ mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/circle.sml	2007-12-09 21:34:25 UTC (rev 6255)
@@ -16,9 +16,9 @@
       val x = Var.new x and y = Var.new y
       val r = Var.new r
       fun draw () =
-          print (concat ["Drawing a Circle at:(", Int.toString (#get x ()), ",",
-                         Int.toString (#get y ()), "), Radius ",
-                         Int.toString (#get r ()), "\n"])
+          prints ["Drawing a Circle at:(", Int.toString (#get x ()), ",",
+                  Int.toString (#get y ()), "), Radius ",
+                  Int.toString (#get r ()), "\n"]
    in
       () & {r = r} & {x = x, y = y, draw = draw}
    end

Modified: mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/rectangle.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/rectangle.sml	2007-12-09 21:30:43 UTC (rev 6254)
+++ mltonlib/trunk/org/mlton/vesak/tech/oo/imperative-shapes/rectangle.sml	2007-12-09 21:34:25 UTC (rev 6255)
@@ -18,10 +18,10 @@
       val x = Var.new x and y = Var.new y
       val w = Var.new w and h = Var.new h
       fun draw () =
-          print (concat ["Drawing a Rectangle at:(", Int.toString (#get x ()),
-                         ",", Int.toString (#get y ()), "), Width ",
-                         Int.toString (#get w ()), ", Height ",
-                         Int.toString (#get h ()), "\n"])
+          prints ["Drawing a Rectangle at:(", Int.toString (#get x ()), ",",
+                  Int.toString (#get y ()), "), Width ",
+                  Int.toString (#get w ()), ", Height ",
+                  Int.toString (#get h ()), "\n"]
    in
       () & {w = w, h = h} & {x = x, y = y, draw = draw}
    end




More information about the MLton-commit mailing list