*Andrew Coppin wrote:
*

| I'm trying to construct a function
| | all_trees :: [Int] -> [Tree] | | such that all_trees [1,2,3] will yield
:

If you write a helper function that takes an N element list, and returns all 2^N ways of dividing those elements into 2 lists, e.g.

   splits "ab" --> [("ab",""),("b","a"),("a","b"),("","ab")]

then you can use it both for dividing the initial list into kept and discarded elements, and for dividing a list between a left subtree and a right subtree.

Regards,
Tom

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to