Created
May 14, 2018 15:11
-
-
Save nwalker/914ce9e1856c91be9e5b889f2e1d62ad 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
iex(14)> defmodule T do | |
...(14)> def f(fun, arg), do: apply(String, :"#{fun}", [arg]) | |
...(14)> end |> elem(2) |> :beam_lib.chunks([:abstract_code]) |> elem(1) |> elem(1) |> get_in([:abstract_code]) |> elem(1) |> :erl_syntax.form_list |> :erl_prettypr.format |> IO.puts | |
warning: redefining module T (current version defined in memory) | |
iex:14 | |
-file("iex", 14). | |
-module('Elixir.T'). | |
-compile(no_auto_import). | |
-export(['__info__'/1, f/2]). | |
-spec '__info__'(attributes | compile | functions | | |
macros | md5 | module | deprecated) -> any(). | |
'__info__'(module) -> 'Elixir.T'; | |
'__info__'(functions) -> [{f, 2}]; | |
'__info__'(macros) -> []; | |
'__info__'(attributes) -> | |
erlang:get_module_info('Elixir.T', attributes); | |
'__info__'(compile) -> | |
erlang:get_module_info('Elixir.T', compile); | |
'__info__'(md5) -> | |
erlang:get_module_info('Elixir.T', md5); | |
'__info__'(deprecated) -> []. | |
f(Vfun@1, Varg@1) -> | |
erlang:apply('Elixir.String', | |
erlang:binary_to_atom(<<case Vfun@1 of | |
Vrewrite@1 | |
when | |
erlang:is_binary(Vrewrite@1) -> | |
Vrewrite@1; | |
Vrewrite@1 -> | |
'Elixir.String.Chars':to_string(Vrewrite@1) | |
end/binary>>, | |
utf8), | |
[Varg@1]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment