
29 Apr
2009
29 Apr
'09
1:05 p.m.
Here is another one liner I am stuck at(Find permuation of string), here is my one line code : permute myStr = foldr(\x acc -> (zipWith (\x1 y1 -> x1 ++ [x] ++ y1) (inits acc) (tails acc))) [] myStr and here is 5 line error ;-( Occurs check: cannot construct the infinite type: a = [a] Expected type: [a] Inferred type: [[a]] In the expression: (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails acc)) In the first argument of `foldr', namely `(\ x acc -> (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails acc)))' Will really appreciate your help in moving ahead Regards Kaushal