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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5551 - (download) (as text) (annotate)
Tue Oct 2 20:48:05 2007 UTC (12 years, 2 months ago) by sh002i
File size: 1311 byte(s)
improved formatting for docs -- these were in pod sections but were all
formatted as verbatim sections, and i moved them into normal paragraphs,
lists, etc. should make things more readable from the web.

    1 =head1 NAME
    2 
    3 contextABCD.pl - Contexts for matching problems.
    4 
    5 =head1 DESCRIPTION
    6 
    7 Implements contexts for string-valued answers especially
    8 for matching problems (where you match against A, B, C, D,
    9 and so on).
   10 
   11 There are two contexts defined here,
   12 
   13     Context("ABCD");
   14     Context("ABCD-List");
   15 
   16 The second allows the students to enter lists of strings,
   17 while the first does not.
   18 
   19 You can add new strings to the context as needed (or remove old ones)
   20 via the Context()->strings->add() and Context()-strings->remove()
   21 methods, eg.
   22 
   23     Context("ABCD-List")->strings->add(E=>{},e=>{alias=>"E"});
   24 
   25 Use string_cmp() to produce the answer checker(s) for your
   26 correct values.  Eg.
   27 
   28     ANS(string_cmp("A","B"));
   29 
   30 when there are two answers, the first being "A" and the second being "B".
   31 
   32 =cut
   33 
   34 loadMacros("MathObjects.pl","contextString.pl");
   35 
   36 sub _contextABCD_init {
   37   my $context = $main::context{ABCD} = Parser::Context->getCopy("String");
   38   $context->{name} = "ABCD";
   39   $context->strings->are(
   40     "A" => {},
   41     "B" => {},
   42     "C" => {},
   43     "D" => {},
   44    );
   45 
   46   $context = $main::context{'ABCD-List'} = $context->copy;
   47   $context->operators->redefine(',', from => "Full");
   48   $context->strings->add("NONE"=>{});
   49 
   50   main::Context("ABCD");  ### FIXME:  probably should make author select context explicitly
   51 }
   52 
   53 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9