I'm having a problem that should be stupidly easy to fix. Following this, I'm trying to access a field in a record. Here's a simplified example that exhibits my problem:
-module(test).
-export([test/0]).
-record(rec, {f1=[], f2=[], f3=[]}).
test() ->
Rec = #rec{f1=[1,2,3], f3=[4,5,6]},
Fields = record_info(fields, rec),
loop(Fields, Rec).
loop([Field|Fields], Rec) ->
[Rec#rec.Field|loop(Fields, Rec)]; %% <-- This is line 12.
loop([], _Rec) ->
[].
When I try to compile test, I get a syntax error:
./test.erl:12: syntax error before: Field
What am I doing wrong?