Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

as per Jpakotal's comment elsewhere this might be even prettier:

    1..100
    |> Enum.map_join("\n", fn 
      int when rem(int, 15) == 0 -> "FizzBuzz"
      int when rem(int, 5)  == 0 -> "Fizz"
      int when rem(int, 3)  == 0 -> "Buzz"
      int                        -> inspect int
    end)
    |> IO.puts


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: