
The point of the array function is just that it lets you initialize the elements of the array in any order you want rather than sequentially; that's why you need to specify the index as well as the element. It isn't indicating that the indices are being stored in addition to the elements. Cheers, Greg On Dec 16, 2009, at 7:54 PM, michael rice wrote:
http://www.zvon.org/other/haskell/Outputarray/array_f.html
Example 7 (and others)
Input: array ('a','c') [('a',"AAA"),('b',"BBB"),('c',"CCC")] ! 'b'
Output: "BBB"
Maybe it's just the notation that makes it LOOK like the indices are also getting stored?
Michael
--- On Wed, 12/16/09, Daniel Peebles
wrote: From: Daniel Peebles
Subject: Re: [Haskell-cafe] Haskell arrays To: "michael rice" Cc: haskell-cafe@haskell.org Date: Wednesday, December 16, 2009, 10:46 PM It doesn't store both, but does provides a flexible indexing strategy (that allows indices to be non-trivial values). What docs suggest that it stores both?
On Wed, Dec 16, 2009 at 10:38 PM, michael rice
wrote: Based upon docs I've looked at, Haskell seems to store both an array element value AND its index/indices, whereas most languages just store the value and find its location in memory through mapping calculations. Is it true?
Michael
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe