Talk:99 questions/Solutions/18

From HaskellWiki
Revision as of 08:27, 30 May 2012 by Rbirenheide (talk | contribs)
Jump to navigation Jump to search

Hi. I'm wondering if this solution still works in the current Haskell version.

slice xs (i+1) k = snd (split (fst (split xs k)) i)

The solution: slice xs (i+1) k = snd (split (fst (split xs k)) i) will not give proper results for negative indices particularly when the first index is negative and the second one within the length of the list.