I hate looking stuff up. I just like having this type of thing 1 click away, in a nice summary. This post is mostly for me.

Define a record:

-record( rule, {ruleid, site, rule, original} ).

You can define a record in the shell using rd:

99> rd(rule, {ruleid, site, rule, original} ).
rule

Create an instance of a record:

100> A = #rule{ ruleid=1, site=2, rule=2, original=3}.
#rule{ruleid = 1,site = 2,rule = 2,original = 3}

Access a single field in a record:

101> A#rule.original.
3

Extracting multiple fields:

102> #rule{ruleid=B, site=C, rule=D, original=E} = A.
#rule{ruleid = 1,site = 2,rule = 2,original = 3}
103> B.
1
104> C.
2
105> D.
2
106> E.
3

Recommended Reading
Introduction to Records

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>