Skip to content

Instantly share code, notes, and snippets.

@alco
Created May 16, 2014 17:04
Show Gist options
  • Save alco/b59aa8293356aae5351d to your computer and use it in GitHub Desktop.
Save alco/b59aa8293356aae5351d to your computer and use it in GitHub Desktop.
λ iex my.ex
Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (0.13.3-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> use My
nil
iex(2)> 3&&4
81.0
defmodule My do
defmacro __using__(_) do
quote do
# import all macros from My
import unquote(__MODULE__)
# hide macros from Kernel
import Kernel, except: [&&: 2]
end
end
defmacro left && right do
:math.pow(left, right)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment