HCoop
/
hcoop
/
zz_old
/
portal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cvsimport
[hcoop/zz_old/portal.git]
/
util.sml
diff --git
a/util.sml
b/util.sml
index
9ac38d0
..
f1bdcbb
100644
(file)
--- a/
util.sml
+++ b/
util.sml
@@
-29,11
+29,12
@@
fun makeSet f items =
fun neg (r : real) = ~r
fun add (r1 : real, r2) = r1 + r2
fun neg (r : real) = ~r
fun add (r1 : real, r2) = r1 + r2
+fun mult (r1, r2) = real r1 * r2
fun isIdent ch = Char.isLower ch orelse Char.isDigit ch orelse ch = #"-"
fun validHost s =
fun isIdent ch = Char.isLower ch orelse Char.isDigit ch orelse ch = #"-"
fun validHost s =
- size s > 0 andalso size s <
2
0 andalso List.all isIdent (String.explode s)
+ size s > 0 andalso size s <
4
0 andalso List.all isIdent (String.explode s)
fun validDomain s =
size s > 0 andalso size s < 100 andalso List.all validHost (String.fields (fn ch => ch = #".") s)
fun validDomain s =
size s > 0 andalso size s < 100 andalso List.all validHost (String.fields (fn ch => ch = #".") s)
@@
-78,4
+79,12
@@
fun readFile fname =
before TextIO.closeIn inf
end
before TextIO.closeIn inf
end
+fun mem (x, ls) = List.exists (fn y => y = x) ls
+
+val allLower = CharVector.map Char.toLower
+
+fun normEmail s = case String.tokens Char.isSpace (allLower s) of
+ s :: _ => s
+ | [] => ""
+
end
end