1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%A options.msk GAP documentation Steve Linton
%%
%A @(#)$Id: options.msk,v 1.9 2002/06/07 14:04:42 gap Exp $
%%
%Y (C) 1998 School Math and Comp. Sci., University of St. Andrews, Scotland
%Y Copyright (C) 2002 The GAP Group
%%
\Chapter{Options Stack}
\FileHeader{options}[1]
\Declaration{PushOptions}
\Declaration{PopOptions}
\Declaration{ResetOptionsStack}
\Declaration{ValueOption}
\Declaration{DisplayOptionsStack}
\Declaration{InfoOptions}
The example below shows simple manipulation of the Options Stack,
first using `PushOptions' and `PopOptions' and then using the special
function calling syntax.
\beginexample
gap> foo := function()
> Print("myopt1 = ", ValueOption("myopt1"),
> " myopt2 = ",ValueOption("myopt2"),"\n");
> end;
function( ) ... end
gap> foo();
myopt1 = fail myopt2 = fail
gap> PushOptions(rec(myopt1 := 17));
gap> foo();
myopt1 = 17 myopt2 = fail
gap> DisplayOptionsStack();
[ rec(
myopt1 := 17 ) ]
gap> PopOptions();
gap> foo();
myopt1 = fail myopt2 = fail
gap> foo( : myopt1, myopt2 := [Z(3),"aardvark"]);
myopt1 = true myopt2 = [ Z(3), "aardvark" ]
gap> DisplayOptionsStack();
[ ]
gap>
\endexample
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%E
|