Skip to content

Instantly share code, notes, and snippets.

@puzza007
Created October 27, 2010 18:01
Show Gist options
  • Save puzza007/649585 to your computer and use it in GitHub Desktop.
Save puzza007/649585 to your computer and use it in GitHub Desktop.
Core Erlang
-module(foo).
-export([list_comprehension/0, statements/0]).
get_foo(S) ->
S.
list_comprehension() ->
[get_foo(S) || S <- ["a","b","c"]].
statements() ->
A = get_foo("a"),
B = get_foo("b"),
C = get_foo("c"),
[A, B, C].
%% core is
module 'foo' ['list_comprehension'/0,
'module_info'/0,
'module_info'/1,
'statements'/0]
attributes []
'get_foo'/1 =
%% Line 5
fun (_cor0) ->
_cor0
'list_comprehension'/0 =
%% Line 8
fun () ->
%% Line 9
letrec
'lc$^0'/1 =
fun (_cor2) ->
case _cor2 of
<[S|_cor1]> when 'true' ->
let <_cor3> =
apply 'get_foo'/1
(S)
in let <_cor4> =
apply 'lc$^0'/1
(_cor1)
in ( [_cor3|_cor4]
-| ['compiler_generated'] )
<[]> when 'true' ->
[]
( <_cor2> when 'true' ->
( primop 'match_fail'
({'function_clause',_cor2})
-| [{'function_name',{'lc$^0',1}}] )
-| ['compiler_generated'] )
end
in apply 'lc$^0'/1
([[97]|[[98]|[[99]]]])
'statements'/0 =
%% Line 11
fun () ->
let <A> =
%% Line 12
apply 'get_foo'/1
([97])
in let <B> =
%% Line 13
apply 'get_foo'/1
([98])
in let <C> =
%% Line 14
apply 'get_foo'/1
([99])
in %% Line 15
[A|[B|[C|[]]]]
'module_info'/0 =
fun () ->
call 'erlang':'get_module_info'
('foo')
'module_info'/1 =
fun (_cor0) ->
call 'erlang':'get_module_info'
('foo', _cor0)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment