Skip to content

Instantly share code, notes, and snippets.

@voluntas
Created August 26, 2016 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voluntas/288a776b11c332062a7091d0fbfbd190 to your computer and use it in GitHub Desktop.
Save voluntas/288a776b11c332062a7091d0fbfbd190 to your computer and use it in GitHub Desktop.
Eshell V8.0.3 (abort with ^G)
1> erl_scan:string("fun() -> ok end.").
{ok,[{'fun',1},
{'(',1},
{')',1},
{'->',1},
{atom,1,ok},
{'end',1},
{dot,1}],
1}
2> {ok, Tokens, _} = erl_scan:string("fun() -> ok end.").
{ok,[{'fun',1},
{'(',1},
{')',1},
{'->',1},
{atom,1,ok},
{'end',1},
{dot,1}],
1}
3> {ok,[Expression]} = erl_parse:parse_exprs(Tokens).
{ok,[{'fun',1,{clauses,[{clause,1,[],[],[{atom,1,ok}]}]}}]}
4> erl_eval:expr(Expression,erl_eval:bindings(erl_eval:new_bindings())).
{value,#Fun<erl_eval.20.52032458>,[]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment