… | |
… | |
2 | |
2 | |
3 | sub _contextIntegerFunctions_init {}; # don't reload this file |
3 | sub _contextIntegerFunctions_init {}; # don't reload this file |
4 | |
4 | |
5 | =head3 Context("IntegerFunctions") |
5 | =head3 Context("IntegerFunctions") |
6 | |
6 | |
7 | ###################################################################### |
7 | ###################################################################### |
8 | # |
8 | # |
9 | # This is a Parser context that adds integer related functions C(n,r) |
9 | # This is a Parser context that adds integer related functions C(n,r) |
10 | # and P(n,r). They can be used by the problem author and also by |
10 | # and P(n,r). They can be used by the problem author and also by |
11 | # students if the answer checking is done by Parser. The latter is |
11 | # students if the answer checking is done by Parser. The latter is |
12 | # the main purpose of this file. |
12 | # the main purpose of this file. |
13 | # |
13 | # |
14 | # Note: by default, webwork problems do not permit students to use |
14 | # Note: by default, webwork problems do not permit students to use |
15 | # C(n,r) and P(n,r) functions. Problems which do permit this |
15 | # C(n,r) and P(n,r) functions. Problems which do permit this |
16 | # should alert the student in their text. |
16 | # should alert the student in their text. |
17 | # |
17 | # |
18 | # Usage examples: |
18 | # Usage examples: |
19 | # $b = random(2, 5); $a = $b+random(0, 5); |
19 | # $b = random(2, 5); $a = $b+random(0, 5); |
20 | # $c = C($a, $b); |
20 | # $c = C($a, $b); |
21 | # ANS(Compute("P($a, $b)")->cmp); |
21 | # ANS(Compute("P($a, $b)")->cmp); |
22 | # |
22 | # |
23 | # Note: If the context is set to something else, such as Numeric, it |
23 | # Note: If the context is set to something else, such as Numeric, it |
24 | # can be set back with Context("IntegerFunctions"). |
24 | # can be set back with Context("IntegerFunctions"). |
25 | |
25 | |
26 | =cut |
26 | =cut |
27 | |
27 | |
28 | $context{IntegerFunctions} = Parser::Context->getCopy("Numeric"); |
28 | $context{IntegerFunctions} = Parser::Context->getCopy("Numeric"); |
29 | |
29 | |
… | |
… | |
52 | P => {class => 'IntegerFunction2'}, |
52 | P => {class => 'IntegerFunction2'}, |
53 | ); |
53 | ); |
54 | |
54 | |
55 | Context("IntegerFunctions"); |
55 | Context("IntegerFunctions"); |
56 | |
56 | |
|
|
57 | 1; |