7.4.0.4

17.5 Improving Repeat to Produce Lists

A shortcoming of this design is that the r^* operation does not collect the results of each individual match of the repeated regular expression into a list. Now that you have completed the other portions of the exercise, return to revisit the rest of the portions of the exercise to make r^* return a list.

One approach is to extend the way the matching functions in Untyped, Slow Regular Expressions, so they can be called recursively, and then let the r^* procedure repeatedly do the matching explicitly with a loop. This design of the implementation would still allow reuse of the procedures for matching other kinds of regular expressions.

Note that, with this variation of r^*, the expr argument is not necessary and should be eliminated.

Here are some test cases for this variant of the language.

Solution