On Wed, 29 Dec 2010, william murphy wrote:
Hi All,
I've spent a lot of time trying to write a version of concat, which
concatenates lists of any
depth:
So:
concat'' [[[1,2],[3,4]],[[5]]] would return: [1,2,3,4,5]
You can nicely solve this problem in Haskell 98 using a Tree
Hi All,
I've spent a lot of time trying to write a version of concat, which
concatenates lists of any depth:
So:
concat'' [[[1,2],[3,4]],[[5]]] would return: [1,2,3,4,5]
The code is:
concat'' :: [a] - [b]
concat'' ((y:ys):xs) = (concat'' (y:ys)) ++ (concat'' xs)
concat'' []
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 12/29/10 22:05 , william murphy wrote:
I've spent a lot of time trying to write a version of concat, which
concatenates lists of any depth:
So:
concat'' [[[1,2],[3,4]],[[5]]] would return: [1,2,3,4,5]
You can't do that, at least
First, what type would such a function have?
Certainly not [a]-[b], because that type say that it can take a list of any
type and turn it into a list of any other type, e.g.,
[Int]-[Bool].
On Thu, Dec 30, 2010 at 4:05 AM, william murphy will.t.mur...@gmail.comwrote:
Hi All,
I've spent a lot