From: John J. <jj...@as...> - 2006-09-21 02:06:57
|
Davide P. Cervone wrote: >>In testing an answer, "3 ft / s" worked for me, but "3ft / s" gave >>a pink screen. >> >> > >Sorry about that. I have fixed it, and now use a more sophisticated >approach to strip off the units that will find them even when there >is no leading space. But since the %Units::known_units hash is >private, the pattern is a little more aggressive than it ideally >would be. This shouldn't be a problem for well-formatted answers, >but some erroneous answers may get unhelpful messages. For example >entering "3x" would give an error about unknown unit 'x'. The regexp >approach is never going to be perfect, but the better approach would >be to make a proper units class for the Parser. > Thanks. The current version works great. If a student enters 3x to a question which is asking for a number with a unit, then "Unrecognizable unit: |x|" is a reasonable diagnostic message to give students. I imagine it could be improved, but it is definitely much better than it was before. John |