[system] / trunk / pg / macros / contextABCD.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/contextABCD.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5372 Revision 5373
2 2
3sub _contextABCD_init {}; # don't load it again 3sub _contextABCD_init {}; # don't load it again
4 4
5=head1 DESCRIPTION 5=head1 DESCRIPTION
6 6
7########################################################## 7 ##########################################################
8# 8 #
9# Implements contexts for string-valued answers especially 9 # Implements contexts for string-valued answers especially
10# for matching problems (where you match against A, B, C, D, 10 # for matching problems (where you match against A, B, C, D,
11# and so on). 11 # and so on).
12# 12 #
13# There are two contexts defined here, 13 # There are two contexts defined here,
14# 14 #
15# Context("ABCD"); 15 # Context("ABCD");
16# Context("ABCD-List"); 16 # Context("ABCD-List");
17# 17 #
18# The second allows the students to enter lists of strings, 18 # The second allows the students to enter lists of strings,
19# while the first does not. 19 # while the first does not.
20# 20 #
21# You can add new strings to the context as needed (or remove old ones) 21 # You can add new strings to the context as needed (or remove old ones)
22# via the Context()->strings->add() and Context()-strings->remove() 22 # via the Context()->strings->add() and Context()-strings->remove()
23# methods, eg. 23 # methods, eg.
24# 24 #
25# Context("ABCD-List")->strings->add(E=>{},e=>{alias=>"E"}); 25 # Context("ABCD-List")->strings->add(E=>{},e=>{alias=>"E"});
26# 26 #
27# Use string_cmp() to produce the answer checker(s) for your 27 # Use string_cmp() to produce the answer checker(s) for your
28# correct values. Eg. 28 # correct values. Eg.
29# 29 #
30# ANS(string_cmp("A","B")); 30 # ANS(string_cmp("A","B"));
31# 31 #
32# when there are two answers, the first being "A" and the second being "B". 32 # when there are two answers, the first being "A" and the second being "B".
33# 33 #
34 34
35=cut 35=cut
36 36
37$context{ABCD} = Parser::Context->getCopy("String"); 37$context{ABCD} = Parser::Context->getCopy("String");
38$context{ABCD}->strings->are( 38$context{ABCD}->strings->are(
47 ',' => $Parser::Context::Default::fullContext->operators->get(','), 47 ',' => $Parser::Context::Default::fullContext->operators->get(','),
48); 48);
49$context{'ABCD-List'}->strings->add("NONE"=>{}); 49$context{'ABCD-List'}->strings->add("NONE"=>{});
50 50
51Context("ABCD"); 51Context("ABCD");
52
531;

Legend:
Removed from v.5372  
changed lines
  Added in v.5373

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9