Exercise idea: Genexpr
Write a function: genexpr(pattern)
generating all possible strings matching the given pattern, from the shortest to the longest.
Examples:
-
genexpr("[ab]c")
should yield "ac" then "bc". -
genexpr("a*")
should yield "", "a", "aa", "aaa", "aaaa", ad nauseam. -
genexpr("a*b*")
should yield "", "a", "b", "aa", "ab", "bb", "aaa", "aab", "abb", "bbb", ...