Permalink
Browse files

asdf

  • Loading branch information...
1 parent bac0a91 commit 7c31ac80761f4c5dd166d6aa8c775ea342367149 Jacob Vorreuter committed Oct 28, 2009
Showing with 33 additions and 21 deletions.
  1. BIN hacking_erlang.key
  2. +4 −1 src/example1.erl
  3. +21 −20 src/example2.erl
  4. +8 −0 src/print_forms.erl
View
Binary file not shown.
View
@@ -1,4 +1,7 @@
-module(example1).
+-compile({parse_transform, print_forms}).
-export([foo/0]).
-foo() -> "Hello Stockholm!".
+foo() -> "Hello Stockholm!".
+
+
View
@@ -1,21 +1,22 @@
-module(example2).
--compile({parse_transform, expand_records}).
--export([encode_record/1]).
-
--record(pizza, {size, toppings, price}).
-
-encode_record(Rec) ->
- [RecName|Fields] = tuple_to_list(Rec),
- FieldNames = expanded_record_fields(RecName),
- lists:zip(FieldNames, Fields).
-
-
-encode_record(Rec) ->
- case Rec of
- Pizza when is_record(Pizza, pizza) ->
- [{size, Pizza#pizza.size},
- {toppings, Pizza#pizza.toppings},
- {price, Pizza#pizza.price}];
- _ ->
- exit(wtf_do_i_do_with_this)
- end.
+% -compile({parse_transform, expand_records}).
+% -export([record_to_proplist/1]).
+%
+% -record(pizza, {size, toppings, price}).
+%
+% record_to_proplist(Rec) when is_tuple(Rec) ->
+% [RecName|Fields] = tuple_to_list(Rec),
+% FieldNames = expanded_record_fields(RecName),
+% lists:zip(FieldNames, Fields).
+%
+%
+% record_to_proplist(Rec) when is_tuple(Rec) ->
+% case Rec of
+% Pizza when is_record(Pizza, pizza) ->
+% [{size, Pizza#pizza.size},
+% {toppings, Pizza#pizza.toppings},
+% {price, Pizza#pizza.price}];
+% _ ->
+% exit(wtf_do_i_do_with_this)
+% end.
+%
View
@@ -0,0 +1,8 @@
+-module(print_forms).
+-export([parse_transform/2]).
+
+parse_transform(Forms, _Options) ->
+ io:format("forms: ~p~n", [Forms]),
+ Forms.
+
+

0 comments on commit 7c31ac8

Please sign in to comment.