Goto Chapter: Top 1 2 3 4 5 6 7 Bib Ind

5 Records

5.1 Functions for records

5.1-1 SetIfMissing
 ‣ SetIfMissing( rec, name, val ) ( function )

This function has been transferred from package AutoDoc, where it was called AUTODOC_WriteOnce. It writes into a record provided the position is not yet bound.


gap> r := rec( a := 1, b := 2 );;
gap> SetIfMissing( r, "c", 3 );
gap> RecNames( r );
[ "b", "c", "a" ]
gap> SetIfMissing( r, "c", 4 );
gap> r;
rec( a := 1, b := 2, c := 3 )



5.1-2 AssignGlobals
 ‣ AssignGlobals( rec ) ( function )

This function has been transferred from package RCWA.

It assigns the record components of rec to global variables with the same names.


gap> AssignGlobals( r );
The following global variables have been assigned:
[ "a", "b", "c" ]
gap> [a,b,c];
[ 1, 2, 3 ]


Goto Chapter: Top 1 2 3 4 5 6 7 Bib Ind

generated by GAPDoc2HTML