newbie Q: [a] -> [[a]]
Vardhan Varma
vardhan@cadence.com
Mon, 07 Apr 2003 09:00:34 +0530 (IST)
Hello,
Please help me with this:
I'm absolute newbie in Haskell,
I hope I'm posting to right forum.
(1) For "abcdefgh" -> ["ab","cd","ef"]
I figured this out:
foo (x:y:z) = ( (x:y) :(foo z))
Now how generalize this to club 'n' chars instead of two ?
3 -> "abcdefgh" -> ["abc","def","gh"]
i.e. n -> [Char] -> [ [Char] ] -- all except last element
have length == n
(2) My original problem is of splitting by markers.
"a<b>cd<efg>hi" -> [ "a" , "b", "cd", "efg", "hi" ]
I'm at total loss on how to do it.
Any pointer will be appreciated.
--TIA
--Vardhan