parse_trans/examples/ex_codegen.erl

26 lines
331 B
Erlang
Raw Normal View History

2010-06-22 10:37:08 +00:00
-module(ex_codegen).
-compile({parse_transform, parse_trans_codegen}).
2010-06-22 14:16:11 +00:00
-export([f/1, g/2]).
2010-06-22 10:37:08 +00:00
f(Name) ->
codegen:gen_function(
Name,
fun(1,2,3) ->
foo;
(A,B,C) ->
{A,B,C}
end).
2010-06-22 14:16:11 +00:00
g(Name, V) ->
codegen:gen_function(
Name,
fun(L) ->
member({'$var',V}, L)
end).