up previous next
record

create a record

Syntax
record[F_1 := OBJECT,..., F_n := OBJECT]
  where each F_i is a field name
  returns RECORD

Description
This constructor creates a record with fields called F_1 ,..., F_n . The empty record is given by record[] . Records in CoCoA are open in the sense that new fields may be added after the record is first defined. The names allowed for the fields are the same as those allowed for variables.

The dot operator is used to access the fields in a record.

Example
/**/  P := record[height := 10, width := 5];
/**/  P.height * P.width;
50

/**/  P.area := It;  --> creates a new field called "area"
/**/  P;
record[area := 50, height := 10, width := 5]

See Also