Tutorial: LFE Records

1 Creating a Record

Records are tuples with the record name as first element and the rest of the fields in order exactly like "normal" Erlang records. As with Erlang records the default default value is 'undefined'.

(defrecord name
  field
  (field default-value)
  ... )
  

Here is simple module that defines a person record.

(defmodule person
  (export all))

(defrecord person
  name
  address
  age)