Array copy primops
johan.tibell at gmail.com
Sun Jan 30 09:01:15 CET 2011
On Sun, Jan 30, 2011 at 1:42 AM, Daniel Peebles <pumpkingod at gmail.com> wrote:
> In a slightly related proposal on the same topic, what do people think of:
> newArrayWith# :: (Int# -> a) -> Int# -> State# s -> (# State# s,
> MutableArray# s a #)
> that would do the obvious thing, by allocating an array of the size
> specified by the Int#, and then pass indices into the function to get
> elements. This would again be to avoid the initialization cost for large
> arrays, but provides a way more flexible interface than the clones (which
> could be implemented in terms of it, but not as quickly).
If it's more efficient that newArray# followed by n writes, it could
be a good addition.
More information about the Cvs-ghc