Whats the issue with following pgm to find permutation of a string<br><br>permute myStr = foldl(\acc x1 -> <br> (foldr(\x2 acc1 -> <br> (zipWith (\x3 y3 -> x3 ++ [x1] ++ y3) (inits acc1) (tails acc1))) <br>
[] acc)) <br> [] myStr<br><br><br><div class="gmail_quote">On Wed, Apr 29, 2009 at 6:35 PM, kaushal Pathak <span dir="ltr"><<a href="mailto:kaushalkp@gmail.com">kaushalkp@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Here is another one liner I am stuck at(Find permuation of string), here is my one line code :<br>
<br>permute myStr = foldr(\x acc -> (zipWith (\x1 y1 -> x1 ++ [x] ++ y1) (inits acc) (tails acc))) [] myStr<br><br>and here is 5 line error ;-(<br>
<br> Occurs check: cannot construct the infinite type: a = [a]<br> Expected type: [a]<br> Inferred type: [[a]]<br> In the expression:<br> (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails acc))<br>
In the first argument of `foldr', namely<br> `(\ x acc<br> -> (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails acc)))'<br><br><br>Will really appreciate your help in moving ahead<br>
<br>Regards<br><font color="#888888">Kaushal<br><br><div class="gmail_quote"><br></div><br>
</font></blockquote></div><br>