codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
let rec fizz = ""::""::"fizz"::fizz;; let rec buzz = ""::""::""::""::"buzz"::buzz;; let rec take l n = match l with [] -> [] | hd::tl -> if n > 0 then hd::take tl (pred n) else [] let fizzbuzz = List.map2 (fun n -> function "" -> string_of_int n | a -> a) (List.map succ (Array.to_list (Array.init 100 (fun x -> x)))) (List.map2 (^) (take fizz 100) (take buzz 100));; List.iter print_endline fizzbuzz;;
Private
[
?
]
Run code