[Haskell-cafe] Haskell arrays

Gregory Crosswhite gcross at phys.washington.edu
Wed Dec 16 23:22:04 EST 2009


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 <pumpkingod at gmail.com> wrote:
> 
> From: Daniel Peebles <pumpkingod at gmail.com>
> Subject: Re: [Haskell-cafe] Haskell arrays
> To: "michael rice" <nowgate at yahoo.com>
> Cc: haskell-cafe at 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 <nowgate at yahoo.com> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091216/694bff3b/attachment.html


More information about the Haskell-Cafe mailing list