Hi, I'm trying to read some (a lot of) sml code.
I've read some tutorials and documentation, so I believe I understand
most of the sml syntax.
However this line bugs me:
case valOf (List.find match asciiweights) of (x, y, w) =>
(w, Char.chr (pick (li, ri, x, y)))
Besides I don't know what the valOf function does, I also have two other
problems.
1) asciiweights is defined by
val asciiweights = [
( 65, 91, 1),
( 97, 123, 1),
( 48, 58, 2),
( 32, 33, 3),
( 58, 65, 4),
( 91, 97, 4),
(123, 127, 4),
( 33, 48, 4),
(127, 256, 12),
( 1, 32, 25),
( 0, 1, 200)]
and match is defined by "fun match (x, y, _) = ..."
So how comes match takes three input variables but gets a list?
2) When I read documentation on case of => it normaly looks something like
fun fac n =
case n of
0 => 1
| _ => n * fac(n-1);
Which is "case <number> of <condition> => return value"
But in the line I'm investigating the condition has been switched by
"(x, y, w)". How can that be?
I hope you can help getting me to understand this. I think sml in general
looks quite interesting, or at least different :)


|