Loop over multiple arrays simultaneously: Difference between revisions
Content added Content deleted
(→C++23) |
m (→{{header|Haskell}}: ZipList version tidied for legibility) |
||
Line 1,786: | Line 1,786: | ||
ZipLists generalize zipWith to any number of parameters |
ZipLists generalize zipWith to any number of parameters |
||
<lang haskell>import Control.Applicative |
<lang haskell>import Control.Applicative (ZipList (ZipList, getZipList)) |
||
main = sequence $ getZipList $ (\x y z -> putStrLn [x, y, z]) <$> ZipList "abd" <*> ZipList "ABC" <*> ZipList "123"</lang> |
|||
main :: IO [()] |
|||
main = |
|||
sequence $ |
|||
getZipList $ |
|||
(\x y z -> putStrLn [x, y, z]) |
|||
<$> ZipList "abd" |
|||
<*> ZipList "ABC" |
|||
<*> ZipList "123"</lang> |
|||
=={{header|Haxe}}== |
=={{header|Haxe}}== |