Seriously, what is the plural of regex?
About half an hour ago, assignment two was due! Finishing up part two was fun. Here are some thoughts regarding the second half of the second assignment, and the challenges it brought to the table.
Challenge 1: finding the right '.' or '|'.
In many of the functions, it was necessary to divide a regex string into two sections, at the right '.' or '|' in order to find the subtrees. How did I end up doing this? By splitting at '.' or '|' and then using the indices given by those splits, checking for equal numbers of open and closed parenthesis before the split to see if the index was correct.
Challenge 2: error checking in permutations.
I'm not sure that this issue was actually conceptually challenging, all I know is that it took much longer than it should have to find all the mistakes. Incidentally there were 5.
Challenge 3: matching dottree.
Matching dottree was challenging. However it was significantly less challenging once I figured out that it sufficed to create a helper function which returned all the possible ways to split the given string into two separate strings. Then I just had to check to see if at least one of them was correct.
Challenge 4: how many doctests is too many doctests?
Throughout the writing of this program, I used doctests as I went along to check every basecase for every function. This testing (which I did quite thoroughly since I wanted to catch any possible tricky exception) was rather extensive. I wasn't sure whether or not it would be appropriate to include so many... But I figured they couldn't hurt.
With that, assignment 2 was completed and submitted.
Marks for assignment 1 just appeared and I am quite happy about those results. Next week there's a midterm. I really wish there were more practice tests posted for such things. It really feels like this course is all over the place sometimes.
No comments:
Post a Comment