Parent Directory
|
Revision Log
Revision 2855 - (view) (download) (as text)
| 1 : | dpvc | 2855 | loadMacros("Parser.pl","contextString.pl"); |
| 2 : | dpvc | 2824 | |
| 3 : | sub _contextTF_init {}; # don't load it again | ||
| 4 : | |||
| 5 : | ########################################################## | ||
| 6 : | # | ||
| 7 : | # Implements contexts for string-valued answers especially | ||
| 8 : | # for matching problems (where you match against T and F). | ||
| 9 : | # | ||
| 10 : | # Context("TF"); | ||
| 11 : | # | ||
| 12 : | # You can add new strings to the context as needed (or remove old ones) | ||
| 13 : | # via the Context()->strings->add() and Context()-strings->remove() | ||
| 14 : | # methods | ||
| 15 : | # | ||
| 16 : | dpvc | 2855 | # ANS(String_cmp("T","F")); |
| 17 : | dpvc | 2824 | # |
| 18 : | # when there are two answers, the first being "T" and the second being "F". | ||
| 19 : | # | ||
| 20 : | |||
| 21 : | dpvc | 2855 | $context{TF} = Context("String")->copy; |
| 22 : | dpvc | 2824 | $context{TF}->strings->are( |
| 23 : | "T" => {value => 1}, "t" => {alias => "T"}, | ||
| 24 : | "F" => {value => 0}, "f" => {alias => "F"}, | ||
| 25 : | "True" => {alias => "T"}, "False" => {alias => "F"}, | ||
| 26 : | "TRUE" => {alias => "T"}, "FALSE" => {alias => "F"}, | ||
| 27 : | "true" => {alias => "T"}, "false" => {alias => "F"}, | ||
| 28 : | ); | ||
| 29 : | |||
| 30 : | Context("TF"); | ||
| 31 : | |||
| 32 : |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |