2018-04-07から1日間の記事一覧

F# でFizzBuzz

F#でFizzBuzzを書く。 let fizz x = x % 3 = 0 let buzz x = x % 5 = 0 let fizzBuzz x = match x with | _ when ( (fizz x) && (buzz x) ) -> "FizzBuzz" | _ when (fizz x) -> "Fizz" | _ when (buzz x) -> "Buzz" | _ -> string x seq {1 .. 100} |> Seq.…