Creating anonymous functions via macros
问题 I'm tying to make an API where an anonymous function are composed from macros, e.g. transform [x, y], do: x + y transform x, do: x should use the transform head and body[:do] as the heads and bodies for an anonymous function. For example, the above macro calls The example above should be collected into: fn [x, y] -> x + y; x -> x end With unquote fragments it's easy to create new named function def s, but not new anonymous functions: iex> val = 1 iex> fn() -> unquote(val) end ** (CompileError