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

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

Parent Directory Parent Directory

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

Revision 5787 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 25 19:46:38 2008 UTC (11 years, 7 months ago) by apizer
File length: 4494 byte(s)
Diff to previous 5439
no strict "refs"
to try to avoid new error checking in Perl 5.10.

Revision 5439 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 28 21:53:42 2007 UTC (12 years, 5 months ago) by dpvc
File length: 4476 byte(s)
Diff to previous 5408
Updated contexts to include a "name" field that at least tracks what
context you started with (though it can be modified and no longer be
the same as the original context).

Remove the individual named variables in the Default.pm file; they are
now available only through the %Parser::Context::Default::context

Remove the >< and . operators, the <...> parentheses, the norm and
unit functions, and the i, j, and k constants from the Point context.
So the Point context no longer includes vectors and vector

Revision 5408 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 24 03:02:54 2007 UTC (12 years, 5 months ago) by dpvc
File length: 4440 byte(s)
Diff to previous 5403
Load the UNIVERSAL package and make it available to Parser Items and Contexts.

Revision 5403 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 22 23:31:10 2007 UTC (12 years, 5 months ago) by dpvc
File length: 4326 byte(s)
Diff to previous 5401
Make sure Context's cmpDefaults hash is copied when duplicated.  (Now
that isHash() and so on can be used, this can be improved.)

Revision 5401 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 22 20:16:26 2007 UTC (12 years, 5 months ago) by dpvc
File length: 4313 byte(s)
Diff to previous 5399
Allow conversion of error messages after the value substitution has
been performed.  Also provide a subroutine to do more complex
conversion of error messages:

    Context()->{error}{convert} = sub {
      my $message = shift;
      ... manipulate message ...
      return $message;

Revision 5399 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 22 19:49:36 2007 UTC (12 years, 5 months ago) by dpvc
File length: 4061 byte(s)
Diff to previous 5253
Allow contexts to override the MathObject constructors separately from
the ones generated by the parser.  That way, you can define Real(),
for example, to produce ScientificNotation, without screwing up the
reals used in the parser itself.

Revision 5253 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 9 06:30:52 2007 UTC (12 years, 6 months ago) by dpvc
File length: 3965 byte(s)
Diff to previous 5116
Copy the error message translation array when a Context is duplicated.

Revision 5116 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 3 10:44:30 2007 UTC (12 years, 7 months ago) by dpvc
File length: 3912 byte(s)
Diff to previous 5026
Modified the method used to tokenize a formula to use one large
pattern that includes all the token types rather than individual
patterns for variables, strings, operators, and so on.  This allows
the Parser to handle the situation where a token of one type is a
prefix of a token of another type (e.g., < as a parenthesis but <- as
an operator) without worrying about which one is checked first.  The
new mtheod is also more flexible about having additional patterns
(like quoted strings, or arbitrary variable names) and about
specifying the order in which they are applied.

Revision 5026 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jun 23 20:08:07 2007 UTC (12 years, 7 months ago) by dpvc
File length: 3979 byte(s)
Diff to previous 5012
Make the Package method really be a method of the context rather than
the Value objects, and make the Value method call the context one.
This means it is not necessary to pass the context as a parameter any

Revision 5012 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 21 23:10:13 2007 UTC (12 years, 7 months ago) by dpvc
File length: 3715 byte(s)
Diff to previous 4975
Added Package method to the Context object to replace the
Value->Package() calls and simplify the $self->Package calls (don't
have to look up the context again).

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: 3580 byte(s)
Diff to previous 3714
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 3714 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Oct 16 02:44:34 2005 UTC (14 years, 4 months ago) by dpvc
File length: 3570 byte(s)
Diff to previous 3677
Modified context data objects to provide a copy method so that the
various types of data can copy themselves (and can provide a more
comprehensive copy if necessary).

Revision 3677 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Oct 1 01:10:27 2005 UTC (14 years, 4 months ago) by dpvc
File length: 3274 byte(s)
Diff to previous 3569
Allow context to override object class used to create formula objects
(so that things like ImplicitPlane can create instances of themselves
automatically when needed).

This mechanism needs to be enlarged to encompass the other Value
object classes as well (like the Context()->{parser}{...} hash).

The real problem is that the List object probably shouldn't create a
formula returning a list when it is passed formulas, since there
really isn't much need for a formula returning a list to be
autogenerated (you can create one by hand using Formula if needed).

Right now, ALL the Value objects make themselves into Formulas when
one of their entries is a formula.  For example, Point(1,"x") produces
the same thing as Formula("(1,x)"), and List(1,"x") is the same as
Formula("1,x").  This is good for points, but not so good for lists.
And it might sometimes be nice to have a Vector of Formulas, or a
Matrix with Formula entries (rather than Formulas returning Vectors or
Matrices).  But this would require some serious changes internally in
the Value objects, which make assumptions about their values being
constant.  Changing that will be for another day...

Revision 3569 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 25 03:40:44 2005 UTC (14 years, 5 months ago) by dpvc
File length: 3218 byte(s)
Diff to previous 3504
Fixed problem with Context's not properly initializing themselves with
the WW environment parameters (like zeroLevelTol and useBaseTenLog).
The copy method and the method that did an initialized copy used to be
separate routines, but that turned out to be unnecessary, so they have
now been merged (copy always tries to initialize the WW values when it
can, and when the copied context doesn't already have them).

The reason this is complicated is that a number contexts are set up
before the global.conf data is available, so these can't be
initialized with the WW values.  Also, these default contexts are
stored in the persistant processes, and we don't want to leave
possibly course-specific values lying around in them, so whenever a
context is selected, it is copied from the standard version and the
WW parameters are inserted into it.  The problem author can only
modify the copy, not the original, so this is OK with mod_perl.

The context's copy method now always tries to initialize (we used to
have to call initCoopy to get a copy that has the WW parameters
inserted).  That turned out to cause trouble with code that handled
contexts without the usual Context() command.

Revision 3504 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 13 15:57:17 2005 UTC (14 years, 6 months ago) by dpvc
File length: 3326 byte(s)
Diff to previous 3442
Moved the union and set reduction checks from cmp_equal to cmp_compare
so that the messages can be produced even in lists of unions.

Improved the message facilities for the list comparison so that
cmp_compare can make errors that refer to the number of the entry in
the student's answer (otherwise an extra "There was a problem with
your nth value" message needs to be prepended, which looks bad if it
can be avoided).

Use the "extra" answer checker to report syntax error messages in unordered

Revision 3442 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 1 12:37:35 2005 UTC (14 years, 6 months ago) by dpvc
File length: 3311 byte(s)
Diff to previous 3370
Fixed typo that caused hilighting of the position of errors to be lost.

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: 3314 byte(s)
Diff to previous 2664
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 2664 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 21 22:02:14 2004 UTC (15 years, 5 months ago) by dpvc
File length: 2826 byte(s)
Diff to previous 2606
Added a file to perform WeBWorK-specific modifications to the
Parser/Value packages.  (I've tried to make these independent of
WeBWorK, so you can use them in other perl code if you want to.)

The parameters for fuzzy reals and some of the other parameters now
are taken from the pg->{ansEvalDefaults} values (as defined in
global.conf or course.conf).  More still needs to be done with this,

Revision 2606 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 11:25:47 2004 UTC (15 years, 6 months ago) by dpvc
File length: 2717 byte(s)
Diff to previous 2597
Can now specify that the objects stringify themselfs in their TeX
forms rather than their answer-string forms.  This makes it easier to
use the objects in the text of a problem (without having to call ->TeX
explicitly each reference).



to start outputting TeX strings, and


to switch back.

Revision 2597 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 13 11:38:22 2004 UTC (15 years, 6 months ago) by dpvc
File length: 2552 byte(s)
Diff to previous 2579
Added answer checker for parallel vectors.
Added option to number checker to have it not report type mismatches
for the known strings (like 'infinity').  (Really need a class for
infinities, and a Value.pm class for strings.)

Revision 2579 - (view) (download) (as text) (annotate) - [select for diffs]
Added Mon Aug 9 21:38:01 2004 UTC (15 years, 6 months ago) by dpvc
File length: 2554 byte(s)
Significant update to new parser.

New features include:

  Better control over format of vector output (you can now
    specify ijk-format rather than <...> format)

  "Fuzzy" reals, where the relations like == return true when the
    two values are "close enough".  (This is controlable using
    parameters similar to those used in NUM_CMP).

  The fuzzy reals are now used in vectors/points/matrices/complexes/intervals
    and so on so that their relations will also be fuzzy.  E.g.,
    (1E-13,2) == (0,3) will be true, and norm(Vector(0,1E-13)) will
    equal 0.

  The two main portions of the parser (the Parser and Value packages)
    now share a common context object for configuration purposes.

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