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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2609 - (download) (as text) (annotate)
Sat Aug 14 13:54:52 2004 UTC (15 years, 5 months ago) by dpvc
File size: 1042 byte(s)
Added a String type to the Value package.  Mostly this is to make it
possible to generate an answer checker for it that uses the parser.
It also makes it more consistent for handling things like stringify,
especially when they are recursively called internally.

Added new default strings "NONE" and "DNE", since these get used a
lot.

Modified how the default parameters are set up for the answer
checkers, and how the answer checker reports the expected answer type
in type mismatch error messages.

    1 ###########################################################################
    2 #
    3 #  Declares functions needed for Value.pm
    4 #
    5 
    6 #
    7 #  Constructors for the various types
    8 #
    9 sub String   {Value::String->new(@_)}
   10 sub Real     {Value::Real->new(@_)}
   11 sub Complex  {Value::Complex->new(@_)}
   12 sub Point    {Value::Point->new(@_)}
   13 sub Vector   {Value::Vector->new(@_)}
   14 sub Matrix   {Value::Matrix->new(@_)}
   15 sub List     {Value::List->new(@_)}
   16 sub Interval {Value::Interval->new(@_)}
   17 sub Union    {Value::Union->new(@_)}
   18 
   19 # sub Formula  {Value::Formula->new(@_)}
   20 #
   21 # #
   22 # #  Parse a formula and evaluate it
   23 # #
   24 # sub Compute {
   25 #   my $formula = Formula(shift);
   26 #   return $formula->eval(@_);
   27 # }
   28 
   29 ###########################################################################
   30 #
   31 #  Make it possible to use  1+3*i  in perl rather than  1+3*$i or 1+3*i()
   32 #
   33 #sub i ()  {Value::Complex->i};   #  defined in Parser.pl
   34 #sub pi () {Value::Complex->pi};  #  defined in dangerousMacros.pl
   35 
   36 ###########################################################################
   37 
   38 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9