8d347a33 |
1 | structure Util :> UTIL = |
2 | struct |
3 | |
4 | fun printInt n = |
5 | Web.print (if n < 0 then |
6 | "-" ^ Int.toString (~n) |
7 | else |
8 | Int.toString n) |
9 | |
10 | fun printReal n = |
11 | Web.print (if n < 0.0 then |
12 | "-" ^ Real.fmt (StringCvt.FIX (SOME 2)) (~n) |
13 | else |
14 | Real.fmt (StringCvt.FIX (SOME 2)) n) |
15 | |
16 | fun id x = x |
17 | |
18 | fun makeSet f items = |
19 | case items of |
20 | [] => "()" |
21 | | [usr] => "(" ^ f usr ^ ")" |
22 | | usr::rest => foldl (fn (usr, s) => s ^ ", " ^ f usr) ("(" ^ f usr) rest ^ ")" |
23 | |
f1ea3762 |
24 | fun neg (r : real) = ~r |
25 | |
8d347a33 |
26 | end |