[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 5373 - (download) (as text) (annotate)
Sun Aug 19 02:01:57 2007 UTC (12 years, 3 months ago) by dpvc
File size: 1316 byte(s)
Normalized comments and headers to that they will format their POD
documentation properly.  (I know that the POD processing was supposed
to strip off the initial #, but that doesn't seem to happen, so I've
added a space throughout.)

    1 loadMacros("MathObjects.pl","contextString.pl");
    2 
    3 sub _contextABCD_init {}; # don't load it again
    4 
    5 =head1 DESCRIPTION
    6 
    7  ##########################################################
    8  #
    9  #  Implements contexts for string-valued answers especially
   10  #  for matching problems (where you match against A, B, C, D,
   11  #  and so on).
   12  #
   13  #  There are two contexts defined here,
   14  #
   15  #  Context("ABCD");
   16  #  Context("ABCD-List");
   17  #
   18  #  The second allows the students to enter lists of strings,
   19  #  while the first does not.
   20  #
   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()
   23  #  methods, eg.
   24  #
   25  #  Context("ABCD-List")->strings->add(E=>{},e=>{alias=>"E"});
   26  #
   27  #  Use string_cmp() to produce the answer checker(s) for your
   28  #  correct values.  Eg.
   29  #
   30  #  ANS(string_cmp("A","B"));
   31  #
   32  #  when there are two answers, the first being "A" and the second being "B".
   33  #
   34 
   35 =cut
   36 
   37 $context{ABCD} = Parser::Context->getCopy("String");
   38 $context{ABCD}->strings->are(
   39  "A" => {},
   40  "B" => {},
   41  "C" => {},
   42  "D" => {},
   43 );
   44 
   45 $context{'ABCD-List'} = $context{ABCD}->copy;
   46 $context{'ABCD-List'}->operators->add(
   47   ',' => $Parser::Context::Default::fullContext->operators->get(','),
   48 );
   49 $context{'ABCD-List'}->strings->add("NONE"=>{});
   50 
   51 Context("ABCD");
   52 
   53 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9