Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 2093cc1014be1e8f2491270f81f3f3d2 > files > 34

ghc-array-devel-0.3.0.1-8.6.fc14.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Data.Array</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
></SCRIPT
><SCRIPT TYPE="text/javascript"
>window.onload = function () {setSynopsis("mini_Data-Array.html")};</SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>array-0.3.0.1: Mutable and immutable arrays</TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Data.Array</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>portable</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>provisional</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>libraries@haskell.org</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="section4"
><B
>Contents</B
></TD
></TR
><TR
><TD
><DL
><DT
><A HREF="#1"
>Immutable non-strict arrays
</A
></DT
><DT
><A HREF="#2"
>Array construction
</A
></DT
><DT
><A HREF="#3"
>Accessing arrays
</A
></DT
><DT
><A HREF="#4"
>Incremental array updates
</A
></DT
><DT
><A HREF="#5"
>Derived arrays
</A
></DT
></DL
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
><P
>Basic non-strict arrays.
</P
><P
><EM
>Note:</EM
> The <A HREF="Data-Array-IArray.html"
>Data.Array.IArray</A
> module provides a more general interface
 to immutable arrays: it defines operations with the same names as
 those defined below, but with more general types, and also defines
 <TT
><A HREF="Data-Array.html#t%3AArray"
>Array</A
></TT
> instances of the relevant classes.  To use that more general
 interface, import <A HREF="Data-Array-IArray.html"
>Data.Array.IArray</A
> but not <A HREF="Data-Array.html"
>Data.Array</A
>.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
>module <A HREF="../base-4.2.0.2/Data-Ix.html"
>Data.Ix</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
> <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aarray"
>array</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; (i, i) -&gt; [(i, e)] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AlistArray"
>listArray</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; (i, i) -&gt; [e] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AaccumArray"
>accumArray</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; (e -&gt; a -&gt; e) -&gt; e -&gt; (i, i) -&gt; [(i, a)] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3A%21"
>(!)</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; i -&gt; e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Abounds"
>bounds</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; (i, i)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aindices"
>indices</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [i]</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aelems"
>elems</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [e]</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aassocs"
>assocs</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [(i, e)]</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3A%2F%2F"
>(//)</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [(i, e)] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aaccum"
>accum</A
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; (e -&gt; a -&gt; e) -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [(i, a)] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aixmap"
>ixmap</A
> :: (<A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i, <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> j) =&gt; (i, i) -&gt; (i -&gt; j) -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> j e -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="1"
><A NAME="1"
>Immutable non-strict arrays
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Haskell provides indexable <EM
>arrays</EM
>, which may be thought of as functions
whose domains are isomorphic to contiguous subsets of the integers.
Functions restricted in this way can be implemented efficiently;
in particular, a programmer may reasonably expect rapid access to
the components.  To ensure the possibility of such an implementation,
arrays are treated as data, not as general functions.
</P
><P
>Since most array functions involve the class <TT
><A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
></TT
>, this module is exported
from <A HREF="Data-Array.html"
>Data.Array</A
> so that modules need not import both <A HREF="Data-Array.html"
>Data.Array</A
> and
<A HREF="Data-Ix.html"
>Data.Ix</A
>.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
>module <A HREF="../base-4.2.0.2/Data-Ix.html"
>Data.Ix</A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>data</SPAN
> <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A NAME="t:Array"
><A NAME="t%3AArray"
></A
></A
><B
>Array</B
> i e </TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="ndoc"
>The type of immutable non-strict (boxed) arrays
 with indices in <TT
>i</TT
> and elements in <TT
>e</TT
>.
 The Int is the number of elements in the Array.
</TD
></TR
><TR
><TD CLASS="section4"
><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Array')" ALT="show/hide"
> Instances</TD
></TR
><TR
><TD CLASS="body"
><DIV ID="i:Array" STYLE="display:block;"
><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="../base-4.2.0.2/Data-Typeable.html#t%3ATypeable2"
>Typeable2</A
> <A HREF="Data-Array.html#t%3AArray"
>Array</A
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="Data-Array-IArray.html#t%3AIArray"
>IArray</A
> <A HREF="Data-Array.html#t%3AArray"
>Array</A
> e</TD
></TR
><TR
><TD CLASS="decl"
><A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="../base-4.2.0.2/Control-Monad.html#t%3AFunctor"
>Functor</A
> (<A HREF="Data-Array.html#t%3AArray"
>Array</A
> i)</TD
></TR
><TR
><TD CLASS="decl"
>(<A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i, <A HREF="../base-4.2.0.2/Data-Eq.html#t%3AEq"
>Eq</A
> e) =&gt; <A HREF="../base-4.2.0.2/Data-Eq.html#t%3AEq"
>Eq</A
> (<A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e)</TD
></TR
><TR
><TD CLASS="decl"
>(<A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i, <A HREF="../base-4.2.0.2/Data-Ord.html#t%3AOrd"
>Ord</A
> e) =&gt; <A HREF="../base-4.2.0.2/Data-Ord.html#t%3AOrd"
>Ord</A
> (<A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e)</TD
></TR
><TR
><TD CLASS="decl"
>(<A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> a, <A HREF="../base-4.2.0.2/Text-Show.html#t%3AShow"
>Show</A
> a, <A HREF="../base-4.2.0.2/Text-Show.html#t%3AShow"
>Show</A
> b) =&gt; <A HREF="../base-4.2.0.2/Text-Show.html#t%3AShow"
>Show</A
> (<A HREF="Data-Array.html#t%3AArray"
>Array</A
> a b)</TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="2"
><A NAME="2"
>Array construction
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:array"
><A NAME="v%3Aarray"
></A
></A
><B
>array</B
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="arg"
>:: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i</TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="arg"
>=&gt; (i, i)</TD
><TD CLASS="rdoc"
>a pair of <EM
>bounds</EM
>, each of the index type
 of the array.  These bounds are the lowest and
 highest indices in the array, in that order.
 For example, a one-origin vector of length
 '10' has bounds '(1,10)', and a one-origin '10'
 by '10' matrix has bounds '((1,1),(10,10))'.
</TD
></TR
><TR
><TD CLASS="arg"
>-&gt; [(i, e)]</TD
><TD CLASS="rdoc"
>a list of <EM
>associations</EM
> of the form
 (<EM
>index</EM
>, <EM
>value</EM
>).  Typically, this list will
 be expressed as a comprehension.  An
 association '(i, x)' defines the value of
 the array at index i to be x.
</TD
></TR
><TR
><TD CLASS="arg"
>-&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="ndoc" COLSPAN="2"
><P
>Construct an array with the specified bounds and containing values
 for given indices within these bounds.
</P
><P
>The array is undefined (i.e. bottom) if any index in the list is
 out of bounds.  The Haskell 98 Report further specifies that if any
 two associations in the list have the same index, the value at that
 index is undefined (i.e. bottom).  However in GHC's implementation,
 the value at such an index is the value part of the last association
 with that index in the list.
</P
><P
>Because the indices must be checked for these errors, <TT
><A HREF="Data-Array.html#v%3Aarray"
>array</A
></TT
> is
 strict in the bounds argument and in the indices of the association
 list, but nonstrict in the values.  Thus, recurrences such as the
 following are possible:
</P
><TT
> a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i &lt;- [2..100]])
</TT
><P
>Not every index within the bounds of the array need appear in the
 association list, but the values associated with indices that do not
 appear will be undefined (i.e. bottom).
</P
><P
>If, in any dimension, the lower bound is greater than the upper bound,
 then the array is legal, but empty.  Indexing an empty array always
 gives an array-bounds error, but <TT
><A HREF="Data-Array.html#v%3Abounds"
>bounds</A
></TT
> still yields the bounds
 with which the array was constructed.
</P
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:listArray"
><A NAME="v%3AlistArray"
></A
></A
><B
>listArray</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; (i, i) -&gt; [e] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="doc"
>Construct an array from a pair of bounds and a list of values in
 index order.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:accumArray"
><A NAME="v%3AaccumArray"
></A
></A
><B
>accumArray</B
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="arg"
>:: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i</TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="arg"
>=&gt; e -&gt; a -&gt; e</TD
><TD CLASS="rdoc"
>accumulating function
</TD
></TR
><TR
><TD CLASS="arg"
>-&gt; e</TD
><TD CLASS="rdoc"
>initial value
</TD
></TR
><TR
><TD CLASS="arg"
>-&gt; (i, i)</TD
><TD CLASS="rdoc"
>bounds of the array
</TD
></TR
><TR
><TD CLASS="arg"
>-&gt; [(i, a)]</TD
><TD CLASS="rdoc"
>association list
</TD
></TR
><TR
><TD CLASS="arg"
>-&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
><TD CLASS="rdoc"
></TD
></TR
><TR
><TD CLASS="ndoc" COLSPAN="2"
><P
>The <TT
><A HREF="Data-Array.html#v%3AaccumArray"
>accumArray</A
></TT
> deals with repeated indices in the association
 list using an <EM
>accumulating function</EM
> which combines the values of
 associations with the same index.
 For example, given a list of values of some index type, <TT
>hist</TT
>
 produces a histogram of the number of occurrences of each index within
 a specified range:
</P
><TT
> hist :: (Ix a, Num b) =&gt; (a,a) -&gt; [a] -&gt; Array a b
 hist bnds is = accumArray (+) 0 bnds [(i, 1) | i&lt;-is, inRange bnds i]
</TT
><P
>If the accumulating function is strict, then <TT
><A HREF="Data-Array.html#v%3AaccumArray"
>accumArray</A
></TT
> is strict in
 the values, as well as the indices, in the association list.  Thus,
 unlike ordinary arrays built with <TT
><A HREF="Data-Array.html#v%3Aarray"
>array</A
></TT
>, accumulated arrays should
 not in general be recursive.
</P
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="3"
><A NAME="3"
>Accessing arrays
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:!"
><A NAME="v%3A%21"
></A
></A
><B
>(!)</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; i -&gt; e</TD
></TR
><TR
><TD CLASS="doc"
>The value at the given index in an array.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:bounds"
><A NAME="v%3Abounds"
></A
></A
><B
>bounds</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; (i, i)</TD
></TR
><TR
><TD CLASS="doc"
>The bounds with which an array was constructed.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:indices"
><A NAME="v%3Aindices"
></A
></A
><B
>indices</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [i]</TD
></TR
><TR
><TD CLASS="doc"
>The list of indices of an array in ascending order.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:elems"
><A NAME="v%3Aelems"
></A
></A
><B
>elems</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [e]</TD
></TR
><TR
><TD CLASS="doc"
>The list of elements of an array in index order.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:assocs"
><A NAME="v%3Aassocs"
></A
></A
><B
>assocs</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [(i, e)]</TD
></TR
><TR
><TD CLASS="doc"
>The list of associations of an array in index order.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="4"
><A NAME="4"
>Incremental array updates
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v://"
><A NAME="v%3A%2F%2F"
></A
></A
><B
>(//)</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [(i, e)] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="doc"
><P
>Constructs an array identical to the first argument except that it has
 been updated by the associations in the right argument.
 For example, if <TT
>m</TT
> is a 1-origin, <TT
>n</TT
> by <TT
>n</TT
> matrix, then
</P
><TT
> m//[((i,i), 0) | i &lt;- [1..n]]
</TT
><P
>is the same matrix, except with the diagonal zeroed.
</P
><P
>Repeated indices in the association list are handled as for <TT
><A HREF="Data-Array.html#v%3Aarray"
>array</A
></TT
>:
 Haskell 98 specifies that the resulting array is undefined (i.e. bottom),
 but GHC's implementation uses the last association for each index.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:accum"
><A NAME="v%3Aaccum"
></A
></A
><B
>accum</B
> :: <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i =&gt; (e -&gt; a -&gt; e) -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e -&gt; [(i, a)] -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="doc"
><P
><TT
><TT
><A HREF="Data-Array.html#v%3Aaccum"
>accum</A
></TT
> f</TT
> takes an array and an association list and accumulates
 pairs from the list into the array with the accumulating function <TT
>f</TT
>.
 Thus <TT
><A HREF="Data-Array.html#v%3AaccumArray"
>accumArray</A
></TT
> can be defined using <TT
><A HREF="Data-Array.html#v%3Aaccum"
>accum</A
></TT
>:
</P
><TT
> accumArray f z b = accum f (array b [(i, z) | i &lt;- range b])
</TT
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
><A NAME="5"
><A NAME="5"
>Derived arrays
</A
></A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:ixmap"
><A NAME="v%3Aixmap"
></A
></A
><B
>ixmap</B
> :: (<A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> i, <A HREF="../base-4.2.0.2/Data-Ix.html#t%3AIx"
>Ix</A
> j) =&gt; (i, i) -&gt; (i -&gt; j) -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> j e -&gt; <A HREF="Data-Array.html#t%3AArray"
>Array</A
> i e</TD
></TR
><TR
><TD CLASS="doc"
><P
><TT
><A HREF="Data-Array.html#v%3Aixmap"
>ixmap</A
></TT
> allows for transformations on array indices.
 It may be thought of as providing function composition on the right
 with the mapping that the original array embodies.
</P
><P
>A similar transformation of array values may be achieved using <TT
><A HREF="../base-4.2.0.2/Control-Monad.html#v%3Afmap"
>fmap</A
></TT
>
 from the <TT
><A HREF="Data-Array.html#t%3AArray"
>Array</A
></TT
> instance of the <TT
><A HREF="../base-4.2.0.2/Control-Monad.html#t%3AFunctor"
>Functor</A
></TT
> class.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 2.6.1</TD
></TR
></TABLE
></BODY
></HTML
>