Created
April 6, 2016 21:42
-
-
Save wende/ecdd46aec3c2a1206c6af650cb3c6dea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Queue do | |
| @functions :queue.module_info(:exports) | |
| Enum.map @functions, fn | |
| {:module_info, _} -> 0 | |
| {name, 0} -> def unquote(name)(), do: apply(:queue, unquote(name), []) | |
| {name, 1} -> def unquote(name)(x), do: apply(:queue, unquote(name), [x]) | |
| {name, 2} -> def unquote(name)(x,y), do: apply(:queue, unquote(name), [y, x]) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment