Last active
June 16, 2016 06:06
-
-
Save sword-jin/81d4e81fec3554dc8d7c76d40f9e721e to your computer and use it in GitHub Desktop.
elixir exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function 2 | |
func_2 = fn | |
0, 0, _ -> "FizzBuzz" | |
0, _, _ -> "Fizz" | |
_, 0, _ -> "Buzz" | |
_, _, n -> n | |
end | |
IO.puts func_2.(1,1,1) | |
# function 3 | |
func_3 = fn n -> | |
func_2.(rem(n, 3), rem(n,5), n) | |
end | |
# function 4 | |
prefix = fn firstname -> (fn name -> "#{firstname} #{name}" end) end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment