[Haskell-cafe] List all multiply/add combinations
artyom.kazak at gmail.com
Sat Nov 17 20:24:17 CET 2012
Instead of attacking the problem textually, try to create a datatype which
would describe your expressions, then generate all values of this
datatype, filter those you don’t need, and convert the rest into Strings.
Currently your expressions are represented by “String” — conversion is
very cheap, but filtering is “hard” (since it boils down to parsing).
Binary trees would suit you better.
More information about the Haskell-Cafe