Associative array/Iteration: Difference between revisions

→‎{{header|Haskell}}: Slight applicative tidying, to foreground the 3 functions. Added output
(→‎{{header|Haskell}}: Slight applicative tidying, to foreground the 3 functions. Added output)
Line 1,188:
<lang haskell>import qualified Data.Map as M
 
myMap :: M.Map String Int
myMap = M.fromList [("hello", 13), ("world", 31), ("!", 71)]
 
main =:: doIO -- pairs()
main =
print $ M.toList myMap
(putStrLn . unlines) $
-- keys
[ show . M.toList print $ M.keys-- myMapPairs
, show . M.keys -- valuesKeys
, show . M.elems print $ M.elems-- myMap</lang>Values
] <*>
pure myMap</lang>
{{Out}}
<pre>[("!",71),("hello",13),("world",31)]
["!","hello","world"]
[71,13,31]</pre>
 
=={{header|Icon}} and {{header|Unicon}}==
9,659

edits