ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | >> Array << | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Module: Array
Function: assocs
Type: Ix a => Array a b -> [(a,b)]
Description: The functions indices, elems, and assocs, when applied to an array, return lists of the indices, elements, or associations, respectively, in index order.
Related: bounds, elems, indices

Example 1

Input: assocs (array (0,3) [(1,"A"),(2,"B"),(3,"D"),(0,"QQQ")])

Output: [(0,"QQQ"),(1,"A"),(2,"B"),(3,"D")]

Example 2

Input: assocs (array (1,10) (zip [1..10] [5,9..100]))

Output: [(1,5),(2,9),(3,13),(4,17),(5,21),(6,25),(7,29),(8,33),(9,37),(10,41)]