Forum archive 2000-2006

Michael Gage - Consolidating the answer evaluator macros

Michael Gage - Consolidating the answer evaluator macros

by Arnold Pizer -
Number of replies: 0
inactiveTopicConsolidating the answer evaluator macros topic started 7/6/2005; 12:34:42 PM
last post 7/6/2005; 12:34:42 PM
userMichael Gage - Consolidating the answer evaluator macros  blueArrow
7/6/2005; 12:34:42 PM (reads: 533, responses: 0)
I posted this recently to the openwebwork WWdev list, but I'm posting it here as well since this bulletin board is seen more widely.

I've made a chart of most of the macros currently available for use in WeBWorK problem (this includes macros from union_problib/macros, but not yet the macros from nau_problib/macros)

It was made essentially by searching for /^sub / in the macro files, followed by a bit of text cleaning. You can find them displayed on the twiki at

and at

The first link is easier to keep up to date. The chart is already slightly obsolete since I've made some changes in the macro files. I am also writing notes indicating which subroutines should be deprecated, which ones are really obsolete and should never be used, which ones are actually internal and should not be available to a problem writer and so forth.

It's on the twiki, so you are all invited to help with the editing and notating.

There are over 900 macros -- way too many -- so some consolidation is in order and the place to start would be to try to get a handle on what has already been produced and how they overlap.

One of my desires is to replace the calls such as strict_num_cmp( $ans, .001,'%0.5f')


num_cmp($ans, relTol=>.001, format=>'%0.5f', mode=>'strict')


strict_num_cmp_list(.001, '%0.5f',$ans1, $ans2, $ans3);


num_cmp([$ans1, $ans2, $ans3], relTol=>.001, mode=>'strict', format=>'%0.5f');

perhaps a dozen different subroutines can be replaced by using num_cmp with either a single answer, or a reference to an array of answers and then followed by a list of parameters.

This is fairly similar to the style that Mathematica uses and I think that it will be easier to remember, document and maintain.

I'm thinking of placing these calls in a "" file where they can be called for those who want to use them, but taking them out of and modifying the problems in rochester_problib that use them.

Similar savings can be made with the fun_cmp family.

This will also cut down substantially on the size of

I invite your comments. Reply to this post.

Take care,


<| Post or View Comments |>