Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created October 23, 2017 14:45
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 patmaddox/c3064b92b8ac990859212ba04091e5d2 to your computer and use it in GitHub Desktop.
Save patmaddox/c3064b92b8ac990859212ba04091e5d2 to your computer and use it in GitHub Desktop.
# why a macro...
defmacrop d(sign, coef, exp) do
quote do
%Decimal{sign: unquote(sign), coef: unquote(coef), exp: unquote(exp)}
end
end
# instead of a function?
def d(sign, coef, exp) do
%Decimal{sign: sign, coef: coef, exp: exp}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment