Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. let cycle list =
  2. seq {
  3. while true do
  4. for item in list do
  5. yield item
  6. }
  7.  
  8. let zipWith f firstSeq secondSeq = Seq.zip firstSeq secondSeq |> Seq.map (fun (x,y) -> f x y)
  9.  
  10. let numbers = Seq.initInfinite id |> Seq.skip 1 |> Seq.map string
  11. let fizzez = cycle [ ""; ""; "Fizz" ]
  12. let buzzez = cycle [ ""; ""; ""; ""; "Buzz" ]
  13. let words = zipWith (+) fizzez buzzez
  14.  
  15. let choice = max
  16. let fizzBuzz = zipWith choice words numbers
  17.  
  18. let fizzBuzz100 = fizzBuzz |> Seq.take 100 |> List.ofSeq
  19. printfn "%A" fizzBuzz100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement