[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 4990 - (download) (as text) (annotate)
Thu Jun 7 23:48:20 2007 UTC (12 years, 8 months ago) by dpvc
File size: 1495 byte(s)
More updates to use the new Value->Package() call.  This will make the
standard object-creation functions like Real() and Complex() use the
new lookup method.

    1 ###########################################################################
    2 #
    3 #  Declares functions needed for Value.pm
    4 #
    5 
    6 #
    7 #  Constructors for the various types
    8 #
    9 sub String   {Value->Package("String")->new(@_)}
   10 sub Real     {Value->Package("Real")->new(@_)}
   11 sub Complex  {Value->Package("Complex")->new(@_)}
   12 sub Point    {Value->Package("Point")->new(@_)}
   13 sub Vector   {Value->Package("Vector")->new(@_)}
   14 sub Matrix   {Value->Package("Matrix")->new(@_)}
   15 sub List     {Value->Package("List")->new(@_)}
   16 sub Interval {Value->Package("Interval")->new(@_)}
   17 sub Set      {Value->Package("Set")->new(@_)}
   18 sub Union    {Value->Package("Union")->new(@_)}
   19 
   20 sub ColumnVector {Value->Package("Vector")->new(@_)->with(ColumnVector=>1,open=>undef,close=>undef)}
   21 
   22 # sub Formula  {Value->Package("Formula")->new(@_)}  # in Parser.pl
   23 
   24 #
   25 #  Make a point or list a closed interval
   26 #
   27 sub Closed {
   28   my $x = shift;
   29   if (Value::isValue($x)) {$x->{open} = '['; $x->{close} = ']'}
   30   return $x;
   31 }
   32 
   33 ###########################################################################
   34 #
   35 #  Make it possible to use  1+3*i  in perl rather than  1+3*$i or 1+3*i()
   36 #
   37 #sub i ()  {Value->Package("Complex")->i};   #  defined in Parser.pl
   38 #sub pi () {Value->Package("Complex")->pi};  #  defined in dangerousMacros.pl
   39 
   40 ###########################################################################
   41 
   42 sub _Value_init {};  # don't let loadMacros load it again
   43 
   44 ###########################################################################
   45 
   46 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9