Loops/Nested: Difference between revisions

Content added Content deleted
No edit summary
(added haskell: no explicit for loops)
Line 204:
</pre>
 
=={{header|Haskell}}==
<lang haskell>import Data.List
 
taskLLB k = map (uncurry ((. take 1). (++)). break (==k)).
uncurry ((. take 1). (++)). break (k`elem`)</lang>
Example:
<lang haskell>mij :: [[Int]]
mij = takeWhile(not.null). unfoldr (Just. splitAt 5) $
[2, 6, 17, 5, 14, 1, 9, 11, 18, 10, 13, 20, 8, 7, 4, 16, 15, 19, 3, 12]
 
*Main> mapM_ print $ taskLLB 20 mij
[2,6,17,5,14]
[1,9,11,18,10]
[13,20]</lang>
=={{header|J}}==