Creating records dynamically

Kiran Khaladkar kiran.khaladkar@REDACTED
Thu Jan 21 12:00:00 CET 2010


hi all,
I have record name in a variable how do i create variable of that.
e.g.  (just a rough example of what the intention is)
-record(sample, {a,b}).
put_vals(T) ->
       V = #T{a =1,b=2}.

now when i call put_vals like
put_vals(sample).
it will fill the record and return the variable
The values may be passed as list to put vals like [{a,1}, {b,2}]

there is a way i found but want to know if there is any better way ..
One can write several put_vals, one each record precisely.

-- 
Kiran Khaladkar | Software Engineer
Geodesic Limited | www.geodesic.com
Tel: +91 22 4031 5800 -  ext -  225
Mob: 9870587508



More information about the erlang-questions mailing list