
16 Apr
2012
16 Apr
'12
2:55 p.m.
You can also use lazy pattern matching.
http://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching
On 16 April 2012 15:21, Lorenzo Bolla
splitAt' :: Int -> [a] -> ([a], [a]) splitAt' n = foldr (\x ~(z1, z2) -> if fst x <= n then (snd x : z1, z2) else ([], snd x : z2)) ([], []) . zip [1..]
Ozgur