[system] / trunk / pg / macros / Value.pl Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

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

Wed Jul 11 02:42:12 2007 UTC (12 years, 5 months ago) by gage
File size: 1678 byte(s)
```Add comment explaining that Infinity is defined in dangerousMacros.pl along with pi and sometimes
the complex version of i as well.
```

```    1
2
4
5 #
6 #  Declares functions needed for Value.pm
7 #
8
9 =cut
10
11 =head3 Constructors for the various types
12
13 #
14 # String, Real, Complex, Point, Vector, Matrix, List, Interval, Set, Union, ColumnVector
15 #
16
17 =cut
18
19
20 sub String   {Value->Package("String")->new(@_)}
21 sub Real     {Value->Package("Real")->new(@_)}
22 sub Complex  {Value->Package("Complex")->new(@_)}
23 sub Point    {Value->Package("Point")->new(@_)}
24 sub Vector   {Value->Package("Vector")->new(@_)}
25 sub Matrix   {Value->Package("Matrix")->new(@_)}
26 sub List     {Value->Package("List")->new(@_)}
27 sub Interval {Value->Package("Interval")->new(@_)}
28 sub Set      {Value->Package("Set")->new(@_)}
29 sub Union    {Value->Package("Union")->new(@_)}
30
31 sub ColumnVector {Value->Package("Vector")->new(@_)->with(ColumnVector=>1,open=>undef,close=>undef)}
32
33 # sub Formula  {Value->Package("Formula")->new(@_)}  # in Parser.pl
34
36
37 #
38 #  Make a point or list a closed interval.
39 #  (Obsolete: use \$x->with(open=>'[',close=>']') instead.)
40 #
41
42 =cut
43
44 sub Closed {
45   my \$x = shift;
46   if (Value::isValue(\$x)) {\$x->{open} = '['; \$x->{close} = ']'}
47   return \$x;
48 }
49
51
52 ###########################################################################
53 #
54 #  Make it possible to use  1+3*i  in perl rather than  1+3*\$i or 1+3*i()
55 #
56
57 #sub i ()  {Value->Package("Complex")->i};   #  defined in Parser.pl
58 #sub pi () {Value->Package("Complex")->pi};  #  defined in dangerousMacros.pl
59 #sub Infinity () {Value->Package("Infinity")->new()} # defined in dangerousMacros.pl
60
61
62 =cut
63