[system] / trunk / pg / lib / Value / String.pm Repository:
ViewVC logotype

Log of /trunk/pg/lib/Value/String.pm

Parent Directory Parent Directory

Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 5696 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jun 14 12:14:21 2008 UTC (11 years, 8 months ago) by dpvc
File length: 2010 byte(s)
Diff to previous 5089

	 no strict "refs"

to try to avoid new error checking in Perl 5.10.

Revision 5089 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 29 22:07:10 2007 UTC (12 years, 7 months ago) by dpvc
File length: 1992 byte(s)
Diff to previous 5072
Transfer flags from parent objects to their children for comparisons
and printing purposes.  Also touch up a few type-coersion issues.  (It
may be possible to not to need Value::isValue() if these can all be
taken care of.)

Revision 5072 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 28 23:40:46 2007 UTC (12 years, 7 months ago) by dpvc
File length: 1970 byte(s)
Diff to previous 5042
Fixed a typo in the compare method.

Revision 5042 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 28 01:31:09 2007 UTC (12 years, 7 months ago) by dpvc
File length: 1966 byte(s)
Diff to previous 4996
Recent changes to automatically do promotion in the Value methods was
a mistake.  I put it back into the subclass methods again.

Revision 4996 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jun 10 11:34:27 2007 UTC (12 years, 8 months ago) by dpvc
File length: 1965 byte(s)
Diff to previous 4991
Allow promote() to accept a context as the first argument so that the
promoted object can be forced into the given context.

Revision 4991 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 8 02:09:21 2007 UTC (12 years, 8 months ago) by dpvc
File length: 1894 byte(s)
Diff to previous 4979
Update new() and make() methods to accept a context as the first
parameter (making it easier to create objects in a given context
without having to resort to a separate call to coerce them to the
given context after the fact).

Revision 4979 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 7 11:59:05 2007 UTC (12 years, 8 months ago) by dpvc
File length: 1858 byte(s)
Diff to previous 4975
More updates for marking MathObjects with the context in which they
were created, so they should now work like the Formula objects in that
respect.  As they are combined via overloaded operators, they should
pass on their contexts correctly.

Also normalized the use of getFlag() to obtain flags from the
MathObject's context rather than looking in the context directly.
This allows the math object to override the flag by setting the flag
value in the object's hash (e.g., $f->{tolerance} = .001).  I've also
added the ability to override context flags via the answerHash (e.g.,
$f->cmp(tolerance => .001)), though some filtering may need to be
added to this at some point.  Note that ONLY the context flags can be
overridden, not other parts of the context.

Revision 4975 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 6 21:44:05 2007 UTC (12 years, 8 months ago) by dpvc
File length: 1854 byte(s)
Diff to previous 3716
This begins some major updates to the Parser and Value libraries.
This may make the MathObjects unstable as things shake down, but I'll
try to keep that to a minimum.

This update reorganizes how the overloading of operations are
implemented.  The base Value class is now overloaded rather than the
individual Value classes.  This makes it easier to make subclasses
that take advantage of the overloading.

The code that handles promoting one MathObject to another has been
updated as a part of this.  This should also make subclassing the
existing MathObjects more flexible.

In the past, Formula objects included a pointer to the Context in
which the object was created, but other MathObject did not.  This
update is the first round of updates to include the context in the
other MathObjects, but more work needs to be done.

The changes here should not affect existing problems; it is possible
that some macro files will need to be updated, but none of the
standard ones in pg/macros seem to need it at the moment.

Revision 3716 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Oct 16 03:37:17 2005 UTC (14 years, 4 months ago) by dpvc
File length: 2100 byte(s)
Diff to previous 3652
In the past, when Value objects were inserted into strings, they would
automatically include parentheses so that if you had $f equal to 1+x
and $g equal to 1-x, then Formula("$f/$g") would mean (1+x)/(1-x)
rather than 1+(x/1)-x, which is what would happen as a straing string

The problem is that this would also happen for real numbers, vectors,
and everything else, even when it wasn't necessary.  So if $x=Real(3),
then "Let x = $x" would be "Let x = (3)".

I have changed the behavior of the string concatenation for Value
objects so that parentheses are only added in a few cases: for
Formulas, Complex numbers, and Unions.  This makes the other Value
objects work more like regular variables in strings, but might cause
some problems with strings that are used as formulas.  For example, if
$a = Real(-3), then "x + 2 $a" will become "x + 2 -3", or "x-1" rather
than the expected "x - 6".  (The old approach would have made it "x +
2 (-3)" which would have worked properly).  For the most part, it is
easier to use something like "x + 2*$a" or even "x" + 2*$a in this
case, so the extra trouble of having to avoid parentheses when you
really meant to substitute the value into a string didn't seem worth

Revision 3652 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Sep 24 00:47:30 2005 UTC (14 years, 4 months ago) by dpvc
File length: 2092 byte(s)
Diff to previous 3370
Added ability to have answers that are empty strings.  String("") now
will produce a valid string object regardless of the Context's defined
string values.  (You can prevent this using


if you wish).  String("")->cmp will produce an answer checker for an
empty string (it removes the blank checker that WW installs).

Revision 3370 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 12 22:29:53 2005 UTC (14 years, 7 months ago) by dpvc
File length: 2024 byte(s)
Diff to previous 3334
A first pass at making parser error messages localizable.  The
Context()->{error}{msg} hash can be used to specify translations of
the standard messages.  For example,

    Context()->{error}{msg}{'Division by zero'} = "Don't divide by zero, dude!";
    Context()->{error}{msg}{'Function '%s' has too many inputs'} =
        "You passed too many arguments to '%s'";

(I didn't translate into another language, here, but you could do
that, too.)

The msg hash could also be used within answer checkers to make certain
answer messages more appropriate for the given type of expected answer.

Revision 3334 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jul 3 20:10:37 2005 UTC (14 years, 7 months ago) by dpvc
File length: 2021 byte(s)
Diff to previous 3192
Updates to allow string matches to be case-insensitive.  This is now
the default, and can be overridden in the Context by setting the
string's "caseSensitive" attribute.  e.g.:


would rewuire "FooBar" to be entered exactly as typed.

Revision 3192 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Mar 16 13:30:28 2005 UTC (14 years, 11 months ago) by dpvc
File length: 1660 byte(s)
Diff to previous 3171
Update the overloaded operators so that they can be overridden by
subclasses of the predefined object classes.  This involves calling
the objects method rather than using a hard reference to the routine
in the parent class.

Also, change the name of the string comparison routine to
compare_string to avoid conflicts with cmp that is used to produce the
answer checker for the class.

Finally, in Value.pm, promotePrecedence no longer has to do fancy
footwork to get "special" precedence to work (this was a hack to get
around the misfeature of the overloaded operators -- now that that is
being handled correctly, there is no need for it).

Revision 3171 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Feb 15 21:53:23 2005 UTC (15 years ago) by dpvc
File length: 1614 byte(s)
Diff to previous 2800
Improved the Real(), Complex(), Point(), Vector(), Matrix() and
String() constructors so that they will process formulas passed to
them as strings rather than requiring perl objects for these.

For example, you can use Real("2/3") rather than Real(2/3) if you
want.  Also, Real("1+x") will return a formula returning a real
(essentially the same as Formula("1+x") in this case).

Revision 2800 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Sep 19 14:27:39 2004 UTC (15 years, 5 months ago) by dpvc
File length: 1574 byte(s)
Diff to previous 2660
Added isZero and isOne checks for Parser::Value objects (i.e., for
constants within formulas).  These now correctly handle vector and
matrices, in particular.  The isOne and isZero checks are used in the
reduce() method to simplify formulas.

Revision 2660 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 20 15:52:32 2004 UTC (15 years, 6 months ago) by dpvc
File length: 1544 byte(s)
Diff to previous 2610
A number of adjustments to get negative infinities to work better.
They used to be stored as separate Parser strings, but now they are
flagged versions of a single string.

All of the problems are really due to the fact that there is no
Infinity class in the Parser (only a Value version).  That should be
changed, but will require some work, and can be put off for now.

It would be best if the classes within the two packages would match up
nearly 1-to-1, but for historical reasons, they don't.  Since the
introduction of Real, String and Infinity classes to the Value
package, The Infinity class is the one main difference between the
two, and once that is fixed, everything needs to be looked over to
check for unnecessary complications due to the historical lack of classes
in one or the other package.

Revision 2610 - (view) (download) (as text) (annotate) - [select for diffs]
Added Sat Aug 14 13:55:54 2004 UTC (15 years, 6 months ago) by dpvc
File length: 1581 byte(s)
The class file for the Value::String object.  (Forgot to add it before
the last commit.  Sorry!)

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9