Skip to content

Instantly share code, notes, and snippets.

@oskimura
Last active December 20, 2015 15:53
Show Gist options
  • Save oskimura/e5b58a789e74be75c60c to your computer and use it in GitHub Desktop.
Save oskimura/e5b58a789e74be75c60c to your computer and use it in GitHub Desktop.
-module(sample).
-export([func1/0]).
func1 () ->
ok.
func2([]) ->
ok;
func2(X) ->
ok.
func3(X) when is_atom(X) ->
X.
string_fun() ->
"abc".
char_fun() ->
$a.
integer_fun() ->
1.
op_fun() ->
1+1.
call_fun() ->
func1().
remote_call_fun() ->
io:format("test").
match_fun(X) ->
case X of
a ->
a;
b ->
b
end.
bind_fun() ->
X = 1.
list_fun() ->
[1,2,3,4].
binary_fun() ->
<<"abc">>.
recieve_fun() ->
receive
a ->
a
end.
try_fun() ->
try (1/0)
catch
Class:Reason ->
Reason
end.
@oskimura
Copy link
Author

[{attribute,1,module,sample},{attribute,2,export,[{func1,0}]},{function,4,func1,0,[{clause,4,[],[],[{atom,5,ok}]}]},{function,7,func2,1,[{clause,7,[{nil,7}],[],[{atom,8,ok}]},{clause,9,[{var,9,'X'}],[],[{atom,10,ok}]}]},{function,12,func3,1,[{clause,12,[{var,12,'X'}],[[{call,12,{atom,12,is_atom},[{var,12,'X'}]}]],[{var,13,'X'}]}]},{function,15,string_fun,0,[{clause,15,[],[],[{string,16,"abc"}]}]},{function,18,char_fun,0,[{clause,18,[],[],[{char,19,97}]}]},{function,21,integer_fun,0,[{clause,21,[],[],[{integer,22,1}]}]},{function,24,op_fun,0,[{clause,24,[],[],[{op,25,'+',{integer,25,1},{integer,25,1}}]}]},{function,27,call_fun,0,[{clause,27,[],[],[{call,28,{atom,28,func1},[]}]}]},{function,30,remote_call_fun,0,[{clause,30,[],[],[{call,31,{remote,31,{atom,31,io},{atom,31,format}},[{string,31,"test"}]}]}]},{function,33,match_fun,1,[{clause,33,[{var,33,'X'}],[],[{case,34,{var,34,'X'},[{clause,35,[{atom,35,a}],[],[{atom,36,a}]},{clause,37,[{atom,37,b}],[],[{atom,38,b}]}]}]}]},{function,41,bind_fun,0,[{clause,41,[],[],[{match,42,{var,42,'X'},{integer,42,1}}]}]},{function,44,list_fun,0,[{clause,44,[],[],[{cons,45,{integer,45,1},{cons,45,{integer,45,2},{cons,45,{integer,45,3},{cons,45,{integer,45,4},{nil,45}}}}}]}]},{function,47,binary_fun,0,[{clause,47,[],[],[{bin,48,[{bin_element,48,{string,48,"abc"},default,default}]}]}]},{function,50,recieve_fun,0,[{clause,50,[],[],[{receive,51,[{clause,52,[{atom,52,a}],[],[{atom,53,a}]}]}]}]},{function,56,try_fun,0,[{clause,56,[],[],[{try,57,[{op,57,'/',{integer,57,1},{integer,57,0}}],[],[{clause,59,[{tuple,59,[{var,59,'Class'},{var,59,'Reason'},{var,59,'_'}]}],[],[{var,60,'Reason'}]}],[]}]}]}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment