Created
March 29, 2017 15:09
-
-
Save kofigumbs/b6592ed1ed69725a9e5d21b77ad32d0a to your computer and use it in GitHub Desktop.
How Core Erlang handles nested function application
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
module 'test' ['f'/0, | |
'module_info'/0, | |
'module_info'/1, | |
'three'/0] | |
attributes [] | |
'f'/0 = | |
%% Line 5 | |
fun () -> | |
%% Line 6 | |
( fun (_cor2) -> | |
%% Line 7 | |
( fun (_cor0) -> | |
%% Line 8 | |
call 'erlang':'+' | |
(_cor2, _cor0) | |
-| [{'id',{0,0,'-f/0-fun-0-'}}] ) | |
-| [{'id',{0,0,'-f/0-fun-1-'}}] ) | |
'three'/0 = | |
%% Line 13 | |
fun () -> | |
let <_cor0> = | |
%% Line 14 | |
apply 'f'/0 | |
() | |
in let <_cor1> = | |
%% Line 14 | |
apply _cor0 | |
(1) | |
in let <_cor2> = | |
%% Line 14 | |
apply _cor1 | |
(2) | |
in let <_cor3> = | |
%% Line 14 | |
apply 'f'/0 | |
() | |
in let <_cor4> = | |
%% Line 14 | |
apply _cor3 | |
(0) | |
in let <_cor5> = | |
%% Line 14 | |
apply _cor4 | |
(3) | |
in %% Line 14 | |
[_cor2|[_cor5|[]]] | |
'module_info'/0 = | |
( fun () -> | |
( call ( 'erlang' | |
-| ['compiler_generated'] ):( 'get_module_info' | |
-| ['compiler_generated'] ) | |
(( 'test' | |
-| ['compiler_generated'] )) | |
-| ['compiler_generated'] ) | |
-| ['compiler_generated'] ) | |
'module_info'/1 = | |
( fun (( _cor0 | |
-| ['compiler_generated'] )) -> | |
( call ( 'erlang' | |
-| ['compiler_generated'] ):( 'get_module_info' | |
-| ['compiler_generated'] ) | |
(( 'test' | |
-| ['compiler_generated'] ), ( _cor0 | |
-| ['compiler_generated'] )) | |
-| ['compiler_generated'] ) | |
-| ['compiler_generated'] ) | |
end |
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
-module(test). | |
-export([f/0, three/0]). | |
f() -> | |
fun (X) -> | |
fun (Y) -> | |
X + Y | |
end | |
end. | |
three() -> | |
[((f())(1))(2), ((f())(0))(3)]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment