A Haskell programmer will use some higher-order library functions to build a list comprehension over a variable number of permutations, but that's tricky and just moves the recursion to a library function.
-
-
For example, consider the regular expression [XY]{7} which coincides with this problem when the count is 7. If you have an efficient generator for regular expression components E, and F, you can recursively define one for E*, E+, EF, E|F, etc.
-
Conversely, many of the functional logic constructs that generate a choice of values can also match a specified known value through a series of tests which don’t add combinatorial inefficiency to the program.
End of conversation
New conversation -
-
-
Agreed. But then you're relying on the compiler to implicitly generate an optimal solution, which might be confusing to read and is hard to control.
-
If the operational semantics of the language are documented, then a performance-focused programmer can learn the rules and understand (at least combinatorially) the expected performance of a block of code.
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.