[Haskell-beginners] Solution to problem 17 (99 Haskell problems)
jean lopes
hawu.bnu at gmail.com
Mon Dec 8 10:17:32 UTC 2014
Hello, I am wondering, is this solution acceptable to the question 17 ? (
https://www.haskell.org/haskellwiki/99_questions/11_to_20)
code:
split :: [a] -> Int -> ([a], [a])
split xs y = fst (mapAccumL (\a b -> (let f = fst a
s = snd a
l = length f
in if l < y
then (f ++ [b], s)
else (f, s ++ [b]), b)) ([],[])
xs)
Also, any inputs are welcome (indentation, misuse of something)
Best regards,
Jean Lopes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141208/742b1396/attachment.html>
More information about the Beginners
mailing list