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
main =
(putStrLn . unlines) $
[ show . M.toList
, show . M.keys --
, show . M.elems
] <*>
pure myMap</lang>
{{Out}}
<pre>[("!",71),("hello",13),("world",31)]
["!","hello","world"]
[71,13,31]</pre>
=={{header|Icon}} and {{header|Unicon}}==
|