From: John J. <jj...@as...> - 2005-07-06 16:44:25
|
Are these a collection of conversion scripts, or one which you are successively improving? In any case, I should get a copy when they are done so I can run them on the "database-library" problems. John Michael E. Gage wrote: > > On Jul 6, 2005, at 11:58 AM, Davide P.Cervone wrote: > >>> This script is great. >>> I've converted the rochester problem library and haven't found >>> any glitches yet. >> >> >> I'm glad it is working out for you. >> >>> I think we should add the string compare functions as well. >> >> >> OK, no problem. I'll add them to the table of routines to convert. >> I notice in PGanswermacros.pl that in addition to setting the >> filters, they also set a type flag. Do you want that to be included >> in the conversion? That is, should >> >> strict_str_cmp("foobar") >> >> produce >> >> str_cmp("foobar",filters=>'trim_whitespace') >> or >> str_cmp("foobar",filters=>'trim_whitespace', type=>'strict_str_cmp') >> >> I think it should be the former, but I don't know how the type flag >> might be used later on, if at all. I suspect it is just >> informational and can be ignored. >> > I think the former is best as well. The type sets a flag in the > AnswerHash to 'strict_str_cmp' (the default is 'str_cmp') in case some > filter needs to know what kind of answer_evaluator it is dealing > with. So far it's most useful when trying to debug an answer > evaluator. I think > we can use 'str_cmp' as the answer evaluator type for all of the > special cases. > >> Also, do you prefer >> >> str_cmp("foobar",filters=>'trim_whitespace') >> >> or just >> >> str_cmp("foobar",'trim_whitespace') >> >> as the result? >> > As long as we are converting I think I prefer > str_cmp("foobar", filters=>['trim_whitespace']) > > since there will be examples where more than one filter is needed. > The default > is actually > > 'filters' => [qw(trim_whitespace compress_whitespace > ignore_case)] > > str_cmp will accept a variable as if it were an array with one > element, but as a model > I suggest we use the square brackets. > > I do want to use the filters => ..... however. I think the > model of > > ans_evaluator( var or arrayRef, %options) > > is something that we can make fairly universal. At least I'd like to > try. > >>> Here are some examples of str_cmp >>> I found in actual problems: >>> >>> ANS( str_cmp( $ml -> ra_correct_ans ) ); # no change needed here >> >> >> right >> >>> ANS(std_num_str_cmp($ans, ['N'])); # make sure this is >>> handled properly >> >> >> That one should already be handled by the version you have. It is >> converted to >> >> ANS(num_cmp($ans, strings=>['N'])); >> >> which is what you want, right? >> > That's correct. > >> I'll send an updated version when I know how to handle the 'type' >> flag above. >> >> Davide >> > Thanks. > > Take care, > > Mike > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > OpenWeBWorK-Devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openwebwork-devel |