22 Oct
2004
22 Oct
'04
4:15 p.m.
Ryan Newton wrote:
For example, in OCaml:
match 3 with 3 -> 99 | 4 -> 99
Can be abbreviated
match 3 with 3 | 4 -> 99
But I have had no luck figuring out how to do the same thing with:
case 3 of 3 -> 99; 4 -> 99
You can do this: let rhs = (some complicated expression) in case 3 of 3 -> rhs 4 -> rhs The complicated expression won't be evaluated unless one of the appropriate case alternatives is chosen. -- Ben