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

Module: Array ixmap (Ix a, Ix b) => (a,a) -> (a -> b) -> Array b c -> Array a c derive new arrays from existing ones, it allows for transformations on array indices

Example 1

Input: ixmap (2,4) (\i -> i) (array (1,5) [(1,1),(2,2),(3,3),(4,4),(5,5)])

Output: array (2,4) [(2,2),(3,3),(4,4)]

Example 2

Input: ixmap (0,2) (\i -> i+2) (array (1,5) [(1,'A'),(2,'B'),(3,'C'),(4,'D'),(5,'E')])

Output: array (0,2) [(0,'B'),(1,'C'),(2,'D')]

Example 3

Input: ixmap (1,2) (\i -> (i-1,i-1)) (array ((0,0),(1,1)) [((0,0),'A'),((1,0),'C'),((0,1),'D'),((1,1),'B')])

Output: array (1,2) [(1,'A'),(2,'B')]

Example 4

Input: ixmap ((0,0),(1,1)) (\i -> (snd i, fst i)) (array ((0,0),(1,1)) [((0,0),'A'),((1,1),'B'),((1,0),'C'),((0,1),'D')])

Output: array ((0,0),(1,1)) [((0,0),'A'),((0,1),'C'),((1,0),'D'),((1,1),'B')]