
19 Nov
2015
19 Nov
'15
3:57 a.m.
The penultimate solution for problem 19 of Ninety-Nine Haskell Problems https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems is giving the result for the opposite of the given N. e.g. rotate "abcdefgh" (-3) gives the result for rotate "abcdefgh" 3 Here's the problem https://wiki.haskell.org/99_questions/11_to_20 and the solution https://wiki.haskell.org/99_questions/Solutions/19 I think it could be solved like this: rotate xs n | n <= 0 = (reverse . take (negate n) . reverse $ xs) ++ (reverse . drop (negate n) . reverse $ xs) | n > 0 = (drop n xs) ++ (take n xs) I know it's not great, just keeping the spirit of the original solution Is this the right list for reporting this kind of bugs? Nicolás
3470
Age (days ago)
3470
Last active (days ago)
0 comments
1 participants
participants (1)
-
Nicolás Hertzulis