Creating a Record

Before a record is created, its record format must be defined. A record may be created by assigning as few or as many of the record fields as desired.

rec< F | L >: RecFormat, FieldAssignmentList -> Rec

Given a record format \(F\), construct the record format corresponding to the field assignment list \(L\). Each term of \(L\) must be of the form fieldname := expression where fieldname is in \(F\) and the value of the expression conforms (directly or by coercion) to any restriction on it. The list \(L\) may be empty, and there is no fixed order for the fieldnames.

Example: Building Records (ex-648bdd)

We build some records having the record format RF.

> RF := recformat< n : Integers(), misc, seq : SeqEnum >;
> r := rec< RF | >;
> r;
rec<RF | >
> s := rec< RF | misc := "adsifaj", n := 42, seq := [ GF(13) | 4, 8, 1 ]>;
> s;
rec<RF | n := 42, misc := adsifaj, seq := [ 4, 8, 1 ]>
> t := rec< RF | seq := [ 4.7, 1.9 ], n := 51/3 >;
> t;
rec<RF | n := 17, seq := [ 4.7, 1.9 ]>
> u := rec< RF | misc := RModule(PolynomialRing(Integers(7)), 4) >;
> u;
rec<RF | misc := RModule of dimension 4 with base ring Univariate Polynomial
Algebra over Integers(7)>

Run in calculator (opens in a new tab)