up previous next
record --
create a record
|
record[F_1 := OBJECT,..., F_n := OBJECT]
where each F_i is a field name
returns RECORD |
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.
/**/ 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]
|