[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 5441 - (download) (as text) (annotate)
Tue Aug 28 22:40:15 2007 UTC (12 years, 5 months ago) by dpvc
File size: 1374 byte(s)
Add context names for the context(s) created here.

    1 loadMacros("MathObjects.pl","contextString.pl");
    2 
    3 =head1 DESCRIPTION
    4 
    5  ##########################################################
    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 
   33 =cut
   34 
   35 sub _contextABCD_init {
   36   my $context = $main::context{ABCD} = Parser::Context->getCopy("String");
   37   $context->{name} = "ABCD";
   38   $context->strings->are(
   39     "A" => {},
   40     "B" => {},
   41     "C" => {},
   42     "D" => {},
   43    );
   44 
   45   $context = $main::context{'ABCD-List'} = $context->copy;
   46   $context->operators->redefine(',', from => "Full");
   47   $context->strings->add("NONE"=>{});
   48 
   49   main::Context("ABCD");  ### FIXME:  probably should make author select context explicitly
   50 }
   51 
   52 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9