; Each field clause names its accessor and, optionally, its mutator. define-record-type(point, make-point(x,y), point?, x(point-x,set-point-x!), y(point-y)) p := make-point(20,22) set-point-x!(p,21) display(point?(p)) newline() display(point-x(p)+point-y(p)) newline() ; Local declarations create a new type whenever the factory runs. factory := fn(value) { define-record-type(cell, make-cell(value), cell?, value(cell-value)) [make-cell(value),cell?] } first := factory(42) second := factory(42) display(first[1](first[0])) newline() display(first[1](second[0])) newline()