Closed jolyonb closed 6 years ago
Cool, I thought this was going to be harder!
I think it might be worth testing a few cases (positive/negative/zero), but if you decide to use the numbered_vars_regexp()
function above, the doctests could take care of that.
Oh, and I suspect you were just waiting to finish the review, but changelog and zip!
(At some point, it might be worthwhile merging things like this into a next
branch instead of master, so we can have fewer minor releases.)
Eh, I'm fine with minor releases every now and again.
Dealing with the case insensitive nature here is a royal PITA. In fact, I'm certain that I've screwed up case-sensitive situations by using a case-insensitive regexp. Sigh.
In fact, I'm so over case-insensitive that I'm going to make a PR right now that exorcises it completely.
Ok, see PR #50. After a decision is made on that, I'll rebase and update this appropriately. I think if #50 is accepted, this should be v1.1.
I believe this is ready for merge. Please check carefully!
This introduces the concept of a numbered variable in FormulaGrader, resolving #41. A separate key,
numbered_vars
is used to set up numbered variables, which leverage the existingsample_from
infrastructure. Here is an example of its use:Any integer entered as an index will be accepted by the grader; there is presently no way of restricting it. I don't think this is actually necessary; if a student enters a_{-1} when only positive indices have meaning, they will be (correctly) marked wrong.
There is a little duplication happening in constructing and checking the list of used variables between FormulaGrader and
calc.py
. That functionality needs to remain incalc.py
so it can be used outside of FormulaGrader, but it also needs to be used to construct the numbered variables. I think it's ok.Note that there is a very small expansion of acceptable variable names in the form of the optional inclusion of a minus sign in tensor notation.
Documentation has been updated, and an example added to the sample course.