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 59 60 61 62 63 64 65 66 67 68
|
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A options.xml GAP documentation Steve Linton -->
<!-- %% -->
<!-- %% -->
<!-- %Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y Copyright (C) 2002 The GAP Group -->
<!-- %% -->
<Chapter Label="Options Stack">
<Heading>Options Stack</Heading>
<#Include Label="[1]{options}">
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="sect:Options Stack">
<Heading>Functions Dealing with the Options Stack</Heading>
<#Include Label="PushOptions">
<#Include Label="PopOptions">
<#Include Label="ResetOptionsStack">
<#Include Label="OnQuit">
<#Include Label="ValueOption">
<#Include Label="DisplayOptionsStack">
<#Include Label="InfoOptions">
</Section>
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="sect:Options Stack Example">
<Heading>Options Stack – an Example</Heading>
The example below shows simple manipulation of the Options Stack,
first using <Ref Func="PushOptions"/> and <Ref Func="PopOptions"/>
and then using the special function calling syntax.
<P/>
<Example><![CDATA[
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>
]]></Example>
</Section>
</Chapter>
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %E -->
|