Finished user-level contact stuff
[hcoop/zz_old/portal.git] / util.sml
CommitLineData
8d347a33 1structure Util :> UTIL =
2struct
3
4fun printInt n =
5 Web.print (if n < 0 then
6 "-" ^ Int.toString (~n)
7 else
8 Int.toString n)
9
10fun 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
16fun id x = x
17
18fun 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 24fun neg (r : real) = ~r
25
8d347a33 26end