4fun plus(x, y) = case x of {
6 | S(k) => S (plus(k, y))
9fun fact(x) = factAux(x, 1)
11fun factAux(x, acc) = case (x == 1) of {
12 0 => factAux(x-1, acc * x)
16fun natToInt(x) = case x of {
18 | S(k) => let y = natToInt(k) in y + 1
21fun intToNat(x) = case x of {
23 | _ => S (intToNat (x - 1))
26fun sin(x) = foreign C Float "sin" (Float x)
28fun main() = let val = natToInt(plus(intToNat(fact(6)), S(S(O)))) in
29 let sval = sin(1.0) in
30 %WriteString("Answer: " ++ %IntString(val)
31 ++ " " ++ %FloatString(sval))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list