[Haskell-cafe] List all multiply/add combinations

timothyhobbs at seznam.cz timothyhobbs at seznam.cz
Sat Nov 17 16:18:40 CET 2012

This smells like homework to me,
which isn't a bad thing,
it will however change the way I answer you.

Please look at http://hackage.haskell.org/packages/archive/base/latest/doc/
and show us your attempts to use this function.


---------- Původní zpráva ----------
Od: Rune Harder Bak <rune at bak.dk>
Datum: 17. 11. 2012
Předmět: [Haskell-cafe] List all multiply/add combinations
"Given a list of numbers of fixed length I need to list all possible
values (and the associated computation) you get by
inserting +,-,*,/ between the numbers, and also set parentheses where
you please.
It shouldn't list computations with unnecessary parentheses.
Example list of length 3 [a,b,c] and only with + and *:
a*b+c, a*(b+c),a*b*c,a+b*c,(a+b)*c,a+b+c

What would be a good way to do this, and a good representation in Haskell?


Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121117/3a4ea2af/attachment.htm>

More information about the Haskell-Cafe mailing list