Skip to content

Instantly share code, notes, and snippets.

@sword-jin
Last active June 16, 2016 06:06
Show Gist options
  • Save sword-jin/81d4e81fec3554dc8d7c76d40f9e721e to your computer and use it in GitHub Desktop.
Save sword-jin/81d4e81fec3554dc8d7c76d40f9e721e to your computer and use it in GitHub Desktop.
elixir exercise
# 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