Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule Max do
- def max([]), do: nil
- def max([x]), do: x
- def max([x, y]) when x > y, do: x
- def max([x, y]), do: y
- def max([head | tail]), do: max([head, max(tail)])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement