Skip to content

Instantly share code, notes, and snippets.

@Adzz
Last active June 16, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adzz/761eac503faaba1316e67e5bb37ff46e to your computer and use it in GitHub Desktop.
Save Adzz/761eac503faaba1316e67e5bb37ff46e to your computer and use it in GitHub Desktop.
defimpl Add, for: Decimal do
def calculate(decimal, decimal_2 = %Decimal{}), do: Decimal.add(decimal, decimal_2)
end
list_1 = [Decimal.new(1), Decimal.new(2)]
list_2 = [Decimal.new(3), Decimal.new(4)]
Zip.apply(list_1, list_2, Add) #=> [Decimal.new(4), Decimal.new(6)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment