Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
9
Task/FizzBuzz/OCaml/fizzbuzz-2.ml
Normal file
9
Task/FizzBuzz/OCaml/fizzbuzz-2.ml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(* Useful rule declaration: "cond => f", 'cond'itionally applies 'f' to 'a'ccumulated value *)
|
||||
let (=>) cond f a = if cond then f a else a
|
||||
let append s a = a^s
|
||||
|
||||
let fizzbuzz i =
|
||||
"" |> (i mod 3 = 0 => append "Fizz")
|
||||
|> (i mod 5 = 0 => append "Buzz")
|
||||
|> (function "" -> string_of_int i
|
||||
| s -> s)
|
||||
Loading…
Add table
Add a link
Reference in a new issue