[Haskell] Re: Looking for a random-access sequence data structure

Christian Maeder maeder at tzi.de
Fri Jan 13 09:21:01 EST 2006

Duncan Coutts wrote:
>> What's the semantics of insert? Does it replace an element, or does it
>> shirt all the elements after it one step?
> It shifts all the elements after it one step. So that's why all the
> finite map types are no help.

import Data.Map as Map

seqInsert i v = Map.insert i v
   . Map.mapKeysMonotonic (\ j -> if j < i then j else j + 1)

More information about the Haskell mailing list