!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone(c) Roman Leshchinskiy 2009 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNoneB            32 (c) Roman Leshchinskiy 2008-2011 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone<=DRCClass of mutable vectors parametrised with a primitive state token.NLength of the mutable vector. This method should not be called directly, use ! instead.gYield a part of the mutable vector without copying it. This method should not be called directly, use  unsafeSlice instead.SCheck whether two vectors overlap. This method should not be called directly, use overlaps instead.]Create a mutable vector of the given length. This method should not be called directly, use  unsafeNew instead.Initialize a vector to a standard value. This is intended to be called as part of the safe new operation (and similar operations), to properly blank the newly allocated memory if necessary.\Vectors that are necessarily initialized as part of creation may implement this as a no-op.Create a mutable vector of the given length and fill it with an initial value. This method should not be called directly, use " instead.YYield the element at the given position. This method should not be called directly, use  unsafeRead instead.[Replace the element at the given position. This method should not be called directly, use  unsafeWrite instead.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors. This method should not be called directly, use clear instead.cSet all elements of the vector to the given value. This method should not be called directly, use set instead.`Copy a vector. The two vectors may not overlap. This method should not be called directly, use  unsafeCopy instead. lMove the contents of a vector. The two vectors may overlap. This method should not be called directly, use  unsafeMove instead.!_Grow a vector by the given number of elements. This method should not be called directly, use  unsafeGrow instead. ! ! !  ! (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone :<=DORT "gClass of immutable vectors. Every immutable vector is associated with its mutable version through the *K type family. Methods of this class should not be used directly. Instead, Data.Vector.GenericB and other Data.Vector modules provide safe and fusible wrappers. Minimum complete implementation:#$%&'#Assumed complexity: O(1)Unsafely convert a mutable vector to its immutable version without copying. The mutable vector may not be used after this operation.$Assumed complexity: O(1)Unsafely convert an immutable vector to its mutable version without copying. The immutable vector may not be used after this operation.%Assumed complexity: O(1)Yield the length of the vector.&Assumed complexity: O(1)OYield a slice of the vector without copying it. No range checks are performed.'Assumed complexity: O(1)SYield the element at the given position in a monad. No range checks are performed.IThe monad allows us to be strict in the vector if we want. Suppose we had unsafeIndex :: v a -> Int -> aCinstead. Now, if we wanted to copy a vector, we'd do something like :copy mv v ... = ... unsafeWrite mv i (unsafeIndex v i) ...For lazy vectors, the indexing would not be evaluated which means that we would retain a reference to the original vector in each element we write. This is not what we want!With ' , we can do gcopy mv v ... = ... case basicUnsafeIndexM v i of Box x -> unsafeWrite mv i x ...lwhich does not have this problem because indexing (but not the returned element!) is evaluated immediately.(Assumed complexity: O(n)pCopy an immutable vector into a mutable one. The two vectors must have the same length but this is not checked. Instances of "X should redefine this method if they wish to support an efficient block copy operation.%Default definition: copying basic on ' and basicUnsafeWrite.) Evaluate a2 as far as storing it in a vector would and yield b. The v a argument only fixes the type and is not touched. The method is only used for optimisation purposes. Thus, it is safe for instances of " to evaluate a^ less than it would be when stored in a vector although this might result in suboptimal code. 2elemseq v x y = (singleton x `asTypeOf` v) `seq` yDefault defintion: a is not evaluated at all* Mutable v s a0 is the mutable version of the pure vector type v a with the state token s "#$%&'()* "%&(#$')*"#$%&'()*(c) Roman Leshchinskiy 2009 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimentalportableSafe+ Box monad.Identity monad1FDelay inlining a function until late in the game (simplifier phase 0).2# inlined in phase 0+,-./012345678+,-./012./0+,-12 +,-./012345678 (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone%&9;<=ADOTV9Monadic streams;*Result of taking a single step in a stream? Length of a 9@ Check if a 9 is emptyAEmpty 9B Singleton 9C#Replicate a value to a given lengthDYield a 9O of values obtained by performing the monadic action the given number of timesF"Generate a stream from its indicesGPrepend an elementHAppend an elementIConcatenate two 9sJFirst element of the 9 or error if emptyKLast element of the 9 or error if emptyLElement at the given positionM!Element at the given position or $ if out of boundsNGExtract a substream of the given length starting at the given position.OAll but the last elementPAll but the first elementQ The first n elementsRAll but the first n elementsSMap a function over a 9TMap a monadic function over a 9U1Execute a monadic action for each element of the 9V Transform a 9 to use a different monadXPair each element in a 9 with its indexYPair each element in a 9; with its index, starting from the right and counting downZZip two 9!s with the given monadic functionj Check if two 9 s are equalkLexicographically compare two 9sl0Drop elements which do not satisfy the predicatem8Drop elements which do not satisfy the monadic predicaten5Longest prefix of elements that satisfy the predicateo=Longest prefix of elements that satisfy the monadic predicatep>Drop the longest prefix of elements that satisfy the predicateqFDrop the longest prefix of elements that satisfy the monadic predicaterCheck whether the 9 contains an elements Inverse of rtYield %3 the first element that satisfies the predicate or $ if no such element exists.uYield %< the first element that satisfies the monadic predicate or $ if no such element exists.vYield %A the index of the first element that satisfies the predicate or $ if no such element exists.wYield %I the index of the first element that satisfies the monadic predicate or $ if no such element exists.x Left foldy!Left fold with a monadic operatorzSame as y{Left fold over a non-empty 9|Left fold over a non-empty 9 with a monadic operator}Same as |~#Left fold with a strict accumulator:Left fold with a strict accumulator and a monadic operatorSame as Left fold over a non-empty 9 with a strict accumulatorLeft fold over a non-empty 92 with a strict accumulator and a monadic operatorSame as  Right fold"Right fold with a monadic operator"Right fold over a non-empty stream:Right fold over a non-empty stream with a monadic operator Create a 9 of values from a 9 of streamable thingsUnfoldUnfold with a monadic functionUnfold at most n" elements with a monadic functionsJApply monadic function n times to value. Zeroth element is original value.BApply function n times to value. Zeroth element is original value. Prefix scan#Prefix scan with a monadic operator#Prefix scan with strict accumulator:Prefix scan with strict accumulator and a monadic operator Suffix scan#Suffix scan with a monadic operator#Suffix scan with strict accumulator;Suffix scan with strict acccumulator and a monadic operatorHaskell-style scan*Haskell-style scan with a monadic operator*Haskell-style scan with strict accumulatorAHaskell-style scan with strict accumulator and a monadic operatorScan over a non-empty 9Scan over a non-empty 9 with a monadic operatorScan over a non-empty 9 with a strict accumulatorScan over a non-empty 92 with a strict accumulator and a monadic operatorYield a 9+ of the given length containing the values x, x+y, x+y+y etc.Enumerate valuesWARNING:B This operation can be very inefficient. If at all possible, use  instead.#Enumerate values with a given step.WARNING:> This operation is very inefficient. If at all possible, use  instead. Convert a 9 to a listConvert a list to a 9Convert the first n elements of a list to a Bundle&'()9:;<=>*?@ABCDEFGHIJKLMNstarting indexlengthOPQRST+UVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~,-./012s9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~s9:;<=>?@ABGHCDEFIJKLMNOPQRSTUVWXY[Z\]^_`abcdefghijklmnopqrstuvwxy{|z}~x&'()9:;<=>*?@ABCDEFGHIJKLMNOPQRST+UVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~,-./012I5L9 M9 r4s4  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimentalportableSafe  Size hint Exact sizeUpper bound on the size Unknown size;Subtract two sizes with clamping to 0, for drop-like thingsMinimum of two size hintsMaximum of two size hints%Convert a size hint to an upper bound)Compute the minimum size from a size hint5Compute the maximum size from a size hint if possible 34 34  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone%&9;<=ADOTYMonadic streams hint of a  Attach a  hint to a  Length of a  Check if a  is emptyEmpty  Singleton #Replicate a value to a given lengthYield a O of values obtained by performing the monadic action the given number of times"Generate a stream from its indicesPrepend an elementAppend an elementConcatenate two sFirst element of the  or error if emptyLast element of the  or error if emptyElement at the given position!Element at the given position or $ if out of boundsGExtract a substream of the given length starting at the given position.All but the last elementAll but the first element The first n elementsAll but the first n elementsMap a function over a Map a monadic function over a 1Execute a monadic action for each element of the  Transform a  to use a different monadPair each element in a  with its indexPair each element in a ; with its index, starting from the right and counting downZip two !s with the given monadic function Check if two  s are equalLexicographically compare two s0Drop elements which do not satisfy the predicate8Drop elements which do not satisfy the monadic predicate5Longest prefix of elements that satisfy the predicate=Longest prefix of elements that satisfy the monadic predicate>Drop the longest prefix of elements that satisfy the predicateFDrop the longest prefix of elements that satisfy the monadic predicateCheck whether the  contains an element Inverse of Yield %3 the first element that satisfies the predicate or $ if no such element exists.Yield %< the first element that satisfies the monadic predicate or $ if no such element exists.Yield %A the index of the first element that satisfies the predicate or $ if no such element exists.Yield %I the index of the first element that satisfies the monadic predicate or $ if no such element exists. Left fold!Left fold with a monadic operatorSame as Left fold over a non-empty Left fold over a non-empty  with a monadic operatorSame as #Left fold with a strict accumulator:Left fold with a strict accumulator and a monadic operatorSame as Left fold over a non-empty  with a strict accumulatorLeft fold over a non-empty 2 with a strict accumulator and a monadic operator Same as   Right fold "Right fold with a monadic operator "Right fold over a non-empty stream :Right fold over a non-empty stream with a monadic operator Create a  of values from a  of streamable thingsUnfoldUnfold with a monadic functionUnfold at most n elementsUnfold at most n" elements with a monadic functionsJApply monadic function n times to value. Zeroth element is original value.BApply function n times to value. Zeroth element is original value. Prefix scan#Prefix scan with a monadic operator#Prefix scan with strict accumulator:Prefix scan with strict accumulator and a monadic operator Suffix scan#Suffix scan with a monadic operator#Suffix scan with strict accumulator ;Suffix scan with strict acccumulator and a monadic operator!Haskell-style scan"*Haskell-style scan with a monadic operator#*Haskell-style scan with strict accumulator$AHaskell-style scan with strict accumulator and a monadic operator%Scan over a non-empty &Scan over a non-empty  with a monadic operator'Scan over a non-empty  with a strict accumulator(Scan over a non-empty 2 with a strict accumulator and a monadic operator)Yield a + of the given length containing the values x, x+y, x+y+y etc.*Enumerate valuesWARNING:B This operation can be very inefficient. If at all possible, use ) instead.+#Enumerate values with a given step.WARNING:> This operation is very inefficient. If at all possible, use ) instead., Convert a  to a list-Convert a list to a .Convert the first n elements of a list to a /Convert a list to a  with the given  hint.starting indexlength      !"#$%&'()*56789:;+,-./01234|      !"#$%&'()*+,-./0123|      !"#$%&'()*+,-./0312~      !"#$%&'()*56789:;+,-./0123459 9 44  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone9;OTD5$Alternative name for monadic streams6The type of pure streams8)Convert a pure stream to a monadic stream9 hint of a 6: Attach a  hint to a 6; Length of a 6< Check if a 6 is empty=Empty 6> Singleton 6?#Replicate a value to a given length@"Generate a stream from its indicesAPrepend an elementBAppend an elementCConcatenate two 6sDFirst element of the 6 or error if emptyELast element of the 6 or error if emptyFElement at the given positionG!Element at the given position or $ if out of boundsHGExtract a substream of the given length starting at the given position.IAll but the last elementJAll but the first elementK The first n elementsLAll but the first n elementsMMap a function over a 6PPair each element in a 6 with its indexQPair each element in a 6; with its index, starting from the right and counting downRZip two 6s with the given functionS Zip three 6s with the given function\0Drop elements which do not satisfy the predicate]5Longest prefix of elements that satisfy the predicate^>Drop the longest prefix of elements that satisfy the predicate_Check whether the 6 contains an element` Inverse of _aYield %- the first element matching the predicate or $ if no such element exists.bYield %; the index of the first element matching the predicate or $ if no such element exists.c Left folddLeft fold on non-empty 6se!Left fold with strict accumulatorfLeft fold on non-empty 6s with strict accumulatorg Right foldhRight fold on non-empty 6skUnfoldlUnfold at most n elementsmDApply function n-1 times to value. Zeroth element is original value.n Prefix scano#Prefix scan with strict accumulatorp Suffix scanq#Suffix scan with strict accumulatorrHaskell-style scans*Haskell-style scan with strict accumulatortScan over a non-empty 6uScan over a non-empty 6 with a strict accumulatorv Check if two 6 s are equalwLexicographically compare two 6sx\Apply a monadic action to each element of the stream, producing a monadic stream of resultsy4Apply a monadic action to each element of the stream|EYield a monadic stream of elements that satisfy the monadic predicate} Monadic fold~"Monadic fold over non-empty stream$Monadic fold with strict accumulator8Monad fold over non-empty stream with strict accumulatorYield a 6+ of the given length containing the values x, x+y, x+y+y etc.Enumerate valuesWARNING:C This operations can be very inefficient. If at all possible, use  instead.#Enumerate values with a given step.WARNING:? This operations is very inefficient. If at all possible, use  instead. Convert a 6 to a list Create a 6 from a list Create a 6 from the first n elements of a list %fromListN n xs = fromList (take n xs) Create a 6 of values from a 6 of streamable things[56789:;<=>?@ABCDEFGHstarting indexlengthIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<^;<=>56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~^;<=>6579:;<=>AB?@CDEFGHIJKLMONPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu8xyz{|}~vw[56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<C5F9 G9 _4`4  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone :<=DRT#?Create a new mutable vector and fill it with elements from the 6A. The vector will grow exponentially if the maximum size of the 6 is unknown.Create a new mutable vector and fill it with elements from the monadic stream. The vector will grow exponentially if the maximum size of the stream is unknown.?Create a new mutable vector and fill it with elements from the 6A. The vector will grow exponentially if the maximum size of the 6 is unknown.=Create a new mutable vector and fill it with elements from the monadic stream. The vector will grow exponentially if the maximum size of the stream is unknown.?Create a new mutable vector and fill it with elements from the 6U from right to left. The vector will grow exponentially if the maximum size of the 6 is unknown.Create a new mutable vector and fill it with elements from the monadic stream from right to left. The vector will grow exponentially if the maximum size of the stream is unknown.Length of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap.,Create a mutable vector of the given length.GCreate a mutable vector of the given length. The length is not checked.mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive.>Grow a vector logarithmicallydGrow a vector by the given number of elements. The number must be positive but this is not checked.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.(Yield the element at the given position.*Replace the element at the given position.)Modify the element at the given position.)Swap the elements at the given positions.DReplace the element at the give position and return the old element.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.eReplace the element at the give position and return the old element. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.I?@AB=CDEFstarting indexlength of the sliceG>HtargetsourcetargetsourceIJKH !H !I?@AB=CDEFG>HIJK  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DR7Mutable boxed vectors keyed on the monad they live in (L or ST s).Length of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap.,Create a mutable vector of the given length.GCreate a mutable vector of the given length. The length is not checked.mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive.dGrow a vector by the given number of elements. The number must be positive but this is not checked.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.(Yield the element at the given position.*Replace the element at the given position.)Modify the element at the given position.)Swap the elements at the given positions.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.-MNOPQstarting indexlength of the slicetargetsourcetargetsource'',MNOPQ (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone09;<=T#Mutable vectors of primitive types.-offset, length, underlying mutable byte arrayLength of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap.,Create a mutable vector of the given length.GCreate a mutable vector of the given length. The length is not checked.mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive. dGrow a vector by the given number of elements. The number must be positive but this is not checked. Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors. (Yield the element at the given position. *Replace the element at the given position. )Modify the element at the given position.)Swap the elements at the given positions.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.)starting indexlength of the slice     targetsourcetargetsource(     (     (      (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone09;<=T!Mutable -based vectorsLength of the mutable vector.!Check whether the vector is empty 6Yield a part of the mutable vector without copying it.&WYield a part of the mutable vector without copying it. No bounds checks are performed.+"Check whether two vectors overlap.,,Create a mutable vector of the given length.-GCreate a mutable vector of the given length. The length is not checked..mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value./Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action.0"Create a copy of a mutable vector.1LGrow a vector by the given number of elements. The number must be positive.2dGrow a vector by the given number of elements. The number must be positive but this is not checked.3Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.4(Yield the element at the given position.5*Replace the element at the given position.6)Modify the element at the given position.7)Swap the elements at the given positions.8HYield the element at the given position. No bounds checks are performed.9JReplace the element at the given position. No bounds checks are performed.:IModify the element at the given position. No bounds checks are performed.;ISwap the elements at the given positions. No bounds checks are performed.<2Set all elements of the vector to the given value.=NCopy a vector. The two vectors must have the same length and may not overlap.>cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.?JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to =. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.@cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to >. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.AO(1) Unsafely cast a mutable vector from one element type to another. The operation just changes the type of the underlying pointer and does not modify the elements.\The resulting vector contains as many elements as can fit into the underlying memory block.BCreate a mutable vector from a R with an offset and a length.Modifying data through the RT afterwards is unsafe if the vector could have been frozen before the modification.0If your offset is 0 it is more efficient to use C.CO(1) Create a mutable vector from a R and a length.HIt is assumed the pointer points directly to the data (no offset). Use B" if you need to specify an offset.Modifying data through the RT afterwards is unsafe if the vector could have been frozen before the modification.DYield the underlying RV together with the offset to the data and its length. Modifying the data through the RD is unsafe if the vector could have frozen before the modification.EO(1) Yield the underlying R together with its length.CYou can assume the pointer points directly to the data (no offset).Modifying the data through the RD is unsafe if the vector could have frozen before the modification.FPass a pointer to the vector's data to the IO action. Modifying data through the pointer is unsafe if the vector could have been frozen before the modification.3STUV !"#$%&starting indexlength of the slice'()*+,-./0123456789:;<=>targetsource?@targetsourceABpointeroffsetlengthCpointerlengthDEFGH. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF. $%!"#&)*'(+,-./0123456789:;<=?>@ABCDEF2STUV !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone:<=OTIJKLMNOPQRSTUVWXYZ[\IJKLMNOPQRSTUVWXYZ[\IJKLMNOPQRSTUVWXYZ[\IJKLMNOPQRSTUVWXYZ[\ (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone :<=DORT]O(1) Yield the length of the vector.^O(1) Test whether a vector if empty_ O(1) Indexing`O(1) Safe indexingaO(1) First elementbO(1) Last elementcO(1)( Unsafe indexing without bounds checkingdO(1)6 First element without checking if the vector is emptyeO(1)5 Last element without checking if the vector is emptyfO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With f/, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.gO(1)+ First element of a vector in a monad. See f+ for an explanation of why this is useful.hO(1)* Last element of a vector in a monad. See f+ for an explanation of why this is useful.iO(1)0 Indexing in a monad without bounds checks. See f+ for an explanation of why this is useful.jO(1)C First element in a monad without checking for empty vectors. See f* for an explanation of why this is useful.kO(1)B Last element in a monad without checking for empty vectors. See f* for an explanation of why this is useful.lO(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.mO(1)N Yield all but the last element without copying. The vector may not be empty.nO(1)O Yield all but the first element without copying. The vector may not be empty.oO(1) Yield the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.pO(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.qO(1) Yield the first n4 elements paired with the remainder without copying. Note that q n v is equivalent to (o n v, p n v) but slightly more efficient.rO(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.sO(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.tO(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.uO(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.vO(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.wO(1) Empty vectorxO(1) Vector with exactly one elementyO(n)@ Vector of the given length with the same value in each positionzO(n)O Construct a vector of the given length by applying the function to each index{O(n)C Apply function n times to value. Zeroth element is original value.|O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>}O(n)! Construct a vector with at most n] by repeatedly applying the generator function to the a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>~O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than . enumFromN 5 3 = <5,6,7>O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than . +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Prepend an elementO(n) Append an elementO(m+n) Concatenate two vectorsO(n)$ Concatenate all vectors in the listO(n)Y Execute the monadic action the given number of times and store the results in a vector.O(n)U Construct a vector of the given length by applying the monadic action to each index;Execute the monadic action and freeze the resulting vector. create (do { v <-  2;  v 0 'a';  v 1 'b'; return v }) = <a,b> O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>O(m+n) For each pair (i,a)O from the vector of index/value pairs, replace the vector element at position i by a. 0update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>)This function is useful for instances of "& that cannot store pairs. Otherwise,  is probably more convenient. update_ xs is ys =  xs ( is ys)  Same as () but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>O(m+n) For each pair (i,b)7 from the vector of pairs, replace the vector element a at position i by f a b. Daccumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>)This function is useful for instances of "& that cannot store pairs. Otherwise,  is probably more convenient: accumulate_ f as is bs =  f as ( is bs) Same as  but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(n) Reverse a vectorO(n)5 Yield the vector obtained by replacing each element i of the index vector by xs_i. This is equivalent to  (xs_) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as  but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v ->  v 0 'x') (y 3 'a') = <'x','a','a'> O(n)- Pair each element in a vector with its indexO(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)c Apply the monadic action to every element of a vector and its index, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)[ Apply the monadic action to every element of a vector and its index, ignoring the resultsO(n)e Apply the monadic action to all elements of the vector, yielding a vector of results. Equvalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices. O(min(m,n)) Zip two vectors O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results O(min(m,n))k Zip the two vectors with a monadic action that also takes the element index and yield a vector of results O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(min(m,n))d Zip the two vectors with a monadic action that also takes the element index and ignore the results O(min(m,n)) Unzip a vector of pairs.O(n)0 Drop elements that do not satisfy the predicateO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield %- the first element matching the predicate or $ if no such element exists.O(n) Yield %; the index of the first element matching the predicate or $ if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield %; the index of the first occurence of the given element or $O if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of .O(n) Left foldO(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulatorO(n)7 Left fold on non-empty vectors with strict accumulatorO(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulatorO(n); Left fold (function applied to each element and its index)O(n)T Left fold with strict accumulator (function applied to each element and its index)O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Check if all elements are WO(n) Check if any element is WO(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)< Monadic fold (action applied to each element and its index)O(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)U Monadic fold with strict accumulator (action applied to each element and its index)O(n)< Monadic fold over non-empty vectors with strict accumulatorO(n)& Monadic fold that discards the resultO(n)V Monadic fold that discards the result (action applied to each element and its index)O(n)= Monadic fold over non-empty vectors that discards the resultO(n)> Monadic fold with strict accumulator that discards the resultO(n)n Monadic fold with strict accumulator that discards the result (action applied to each element and its index)O(n)T Monad fold over non-empty vectors with strict accumulator that discards the result,Evaluate each action and collect the results,Evaluate each action and discard the resultsO(n) Prescan prescanl f z = m .  f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>O(n) Prescan with strict accumulatorO(n) Scan postscanl f z = n .  f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>O(n) Scan with strict accumulatorO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>O(n)+ Haskell-style scan with strict accumulatorO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiO(n)7 Scan over a non-empty vector with a strict accumulatorO(n) Right-to-left prescan prescanr f z =  .  (flip f) z .  O(n). Right-to-left prescan with strict accumulatorO(n) Right-to-left scanO(n)+ Right-to-left scan with strict accumulatorO(n)! Right-to-left Haskell-style scanO(n)9 Right-to-left Haskell-style scan with strict accumulatorO(n)+ Right-to-left scan over a non-empty vectorO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorO(n) Convert a vector to a listO(n) Convert a list to a vectorO(n) Convert the first n elements of a list to a vector fromListN n xs =  (o n xs)  O(n) Convert different vector types O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation. O(n)/ Yield an immutable copy of the mutable vector. O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation. O(n). Yield a mutable copy of the immutable vector.O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.O(1) Convert a vector to a 6O(n) Construct a vector from a 6O(1) Convert a vector to a 6, proceeding from right to leftO(n) Construct a vector from a 6, proceeding from right to left.Construct a vector from a monadic initialiser.SConvert a vector to an initialiser which, when run, produces a copy of the vector.O(n)% Check if two vectors are equal. All "" instances are also instances of Xh and it is usually more appropriate to use those. This function is primarily intended for implementing X! instances for new vector types.O(n), Compare two vectors lexicographically. All "" instances are also instances of Yh and it is usually more appropriate to use those. This function is primarily intended for implementing Y! instances for new vector types.Generic definition of Generic definition of Generic definion of  that views a " as a list.]^_`abcdefghijkli starting indexn lengthmnopqri starting indexn lengthstuvwxyz{|}~initial vector (of length m)%list of index/value pairs (of length n)initial vector (of length m)'vector of index/value pairs (of length n)initial vector (of length m)index vector (of length n1)value vector (of length n2)Z[accumulating function finitial vector (of length m)%list of index/value pairs (of length n)accumulating function finitial vector (of length m)'vector of index/value pairs (of length n)accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)\]xs value vectoris index vector (of length n)^_`ab     cdef"%&(#$')*]^_`abcdefghijklmnopqrstuvwxyz{|}~     "#$%&'()*]^_`abcdefghijklmnopqrstuvwxyz{|}~     ]^_`abcdefghijklmnopqrstuvwxyz{|}~Z[\]^_`ab     cdef_9 `9 544 (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DORT"Unboxed vectors of primitive types%offset, length, underlying byte arrayO(1) Yield the length of the vector. O(1) Test whether a vector if empty! O(1) Indexing"O(1) Safe indexing#O(1) First element$O(1) Last element%O(1)( Unsafe indexing without bounds checking&O(1)6 First element without checking if the vector is empty'O(1)5 Last element without checking if the vector is empty(O(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With (/, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.)O(1)+ First element of a vector in a monad. See (+ for an explanation of why this is useful.*O(1)* Last element of a vector in a monad. See (+ for an explanation of why this is useful.+O(1)0 Indexing in a monad without bounds checks. See (+ for an explanation of why this is useful.,O(1)C First element in a monad without checking for empty vectors. See (* for an explanation of why this is useful.-O(1)B Last element in a monad without checking for empty vectors. See (* for an explanation of why this is useful..O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements./O(1)N Yield all but the last element without copying. The vector may not be empty.0O(1)O Yield all but the first element without copying. The vector may not be empty.1O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.2O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.3O(1) Yield the first n4 elements paired with the remainder without copying. Note that 3 n v is equivalent to (1 n v, 2 n v) but slightly more efficient.4O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.5O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.6O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.7O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.8O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.9O(1) Empty vector:O(1) Vector with exactly one element;O(n)@ Vector of the given length with the same value in each position<O(n)O Construct a vector of the given length by applying the function to each index=O(n)C Apply function n times to value. Zeroth element is original value.>O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>?O(n)! Construct a vector with at most n] by repeatedly applying the generator function to the a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>@O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>AO(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>BO(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than D. enumFromN 5 3 = <5,6,7>CO(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than E. +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>DO(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use B instead.EO(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use C instead.FO(n) Prepend an elementGO(n) Append an elementHO(m+n) Concatenate two vectorsIO(n)$ Concatenate all vectors in the listJO(n)Y Execute the monadic action the given number of times and store the results in a vector.KO(n)U Construct a vector of the given length by applying the monadic action to each indexL;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> MO(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.NO(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>OO(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>P Same as (N) but without bounds checking.QSame as O but without bounds checking.RO(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>SO(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>TSame as R but without bounds checking.USame as S but without bounds checking.VO(n) Reverse a vectorWO(n)5 Yield the vector obtained by replacing each element i of the index vector by xs!i. This is equivalent to Z (xs!) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>XSame as W but without bounds checking.YApply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') (; 3 'a') = <'x','a','a'> ZO(n) Map a function over a vector[O(n)< Apply a function to every element of a vector and its index\9Map a function over a vector and concatenate the results.]O(n)V Apply the monadic action to all elements of the vector, yielding a vector of results^O(n)M Apply the monadic action to all elements of a vector and ignore the results_O(n)e Apply the monadic action to all elements of the vector, yielding a vector of results. Equvalent to flip ].`O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip ^.a O(min(m,n))) Zip two vectors with the given function.b*Zip three vectors with the given function.f O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.g<Zip three vectors and their indices with the given function.k O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of resultsl O(min(m,n))D Zip the two vectors with the monadic action and ignore the resultsmO(n)0 Drop elements that do not satisfy the predicatenO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesoO(n)8 Drop elements that do not satisfy the monadic predicatepO(n)P Yield the longest prefix of elements satisfying the predicate without copying.qO(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.rO(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to s.sO(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than r.tO(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.uO(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.vO(n)( Check if the vector contains an elementwO(n)= Check if the vector does not contain an element (inverse of v)xO(n) Yield %- the first element matching the predicate or $ if no such element exists.yO(n) Yield %; the index of the first element matching the predicate or $ if no such element exists.zO(n)L Yield the indices of elements satisfying the predicate in ascending order.{O(n) Yield %; the index of the first occurence of the given element or $O if the vector does not contain the element. This is a specialised version of y.|O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of z.}O(n) Left fold~O(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulatorO(n)7 Left fold on non-empty vectors with strict accumulatorO(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulatorO(n); Left fold (function applied to each element and its index)O(n)T Left fold with strict accumulator (function applied to each element and its index)O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)< Monadic fold over non-empty vectors with strict accumulatorO(n)& Monadic fold that discards the resultO(n)= Monadic fold over non-empty vectors that discards the resultO(n)> Monadic fold with strict accumulator that discards the resultO(n)V Monadic fold over non-empty vectors with strict accumulator that discards the resultO(n) Prescan prescanl f z = / .  f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>O(n) Prescan with strict accumulatorO(n) Scan postscanl f z = 0 .  f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>O(n) Scan with strict accumulatorO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>O(n)+ Haskell-style scan with strict accumulatorO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiO(n)7 Scan over a non-empty vector with a strict accumulatorO(n) Right-to-left prescan prescanr f z = V .  (flip f) z . V O(n). Right-to-left prescan with strict accumulatorO(n) Right-to-left scanO(n)+ Right-to-left scan with strict accumulatorO(n)! Right-to-left Haskell-style scanO(n)9 Right-to-left Haskell-style scan with strict accumulatorO(n)+ Right-to-left scan over a non-empty vectorO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorO(n) Convert a vector to a listO(n) Convert a list to a vectorO(n) Convert the first n elements of a list to a vector fromListN n xs =  (1 n xs) O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.O(n). Yield a mutable copy of the immutable vector.O(n)/ Yield an immutable copy of the mutable vector.O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length. !"#$%&'()*+,-.i starting indexn length/01234i starting indexn length56789:;<=>?@ABCDEFGHIJKLMNinitial vector (of length m)%list of index/value pairs (of length n)Oinitial vector (of length m)index vector (of length n1)value vector (of length n2)PQRaccumulating function finitial vector (of length m)%list of index/value pairs (of length n)Saccumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=JKL>?@ABCDEFGHIMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~H5v4w4 (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone /0:<=DRghijklmnopqrstuvwxyz{|}~/}{ywusqomkig~|zxvtrpnljhsghijklmnopqrstuvwxyz{|}~ (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone$Length of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap.,Create a mutable vector of the given length.GCreate a mutable vector of the given length. The length is not checked.mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive.dGrow a vector by the given number of elements. The number must be positive but this is not checked.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.(Yield the element at the given position.*Replace the element at the given position.)Modify the element at the given position.)Swap the elements at the given positions.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.O(1) Zip 2 vectorsO(1) Unzip 2 vectorsO(1) Zip 3 vectorsO(1) Unzip 3 vectorsO(1) Zip 4 vectorsO(1) Unzip 4 vectorsO(1) Zip 5 vectorsO(1) Unzip 5 vectorsO(1) Zip 6 vectorsO(1) Unzip 6 vectors-starting indexlength of the slicetargetsourcetargetsourceF~|zxvtrpnljh1- (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DORT-based vectorsO(1) Yield the length of the vector.O(1) Test whether a vector if empty O(1) IndexingO(1) Safe indexingO(1) First elementO(1) Last elementO(1)( Unsafe indexing without bounds checkingO(1)6 First element without checking if the vector is emptyO(1)5 Last element without checking if the vector is emptyO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.O(1)+ First element of a vector in a monad. See + for an explanation of why this is useful.O(1)* Last element of a vector in a monad. See + for an explanation of why this is useful.O(1)0 Indexing in a monad without bounds checks. See + for an explanation of why this is useful.O(1)C First element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)B Last element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.O(1)N Yield all but the last element without copying. The vector may not be empty.O(1)O Yield all but the first element without copying. The vector may not be empty.O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.O(1) Yield the first n4 elements paired with the remainder without copying. Note that  n v is equivalent to ( n v,  n v) but slightly more efficient.O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked. O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked. O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked. O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked. O(1) Empty vector O(1) Vector with exactly one elementO(n)@ Vector of the given length with the same value in each positionO(n)O Construct a vector of the given length by applying the function to each indexO(n)C Apply function n times to value. Zeroth element is original value.O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>O(n)! Construct a vector with at most n] by repeatedly applying the generator function to the a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than . enumFromN 5 3 = <5,6,7>O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than . +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Prepend an elementO(n) Append an elementO(m+n) Concatenate two vectorsO(n)$ Concatenate all vectors in the listO(n)Y Execute the monadic action the given number of times and store the results in a vector.O(n)U Construct a vector of the given length by applying the monadic action to each index;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b>  O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.!O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>"O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7># Same as (!) but without bounds checking.$Same as " but without bounds checking.%O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>&O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>'Same as % but without bounds checking.(Same as & but without bounds checking.)O(n) Reverse a vector*O(n)5 Yield the vector obtained by replacing each element i of the index vector by xsi. This is equivalent to - (xs) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>+Same as * but without bounds checking.,Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') ( 3 'a') = <'x','a','a'> -O(n) Map a function over a vector.O(n)< Apply a function to every element of a vector and its index/9Map a function over a vector and concatenate the results.0O(n)V Apply the monadic action to all elements of the vector, yielding a vector of results1O(n)M Apply the monadic action to all elements of a vector and ignore the results2O(n)e Apply the monadic action to all elements of the vector, yielding a vector of results. Equvalent to flip 0.3O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip 1.4 O(min(m,n))) Zip two vectors with the given function.5*Zip three vectors with the given function.9 O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.:<Zip three vectors and their indices with the given function.> O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results? O(min(m,n))D Zip the two vectors with the monadic action and ignore the results@O(n)0 Drop elements that do not satisfy the predicateAO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesBO(n)8 Drop elements that do not satisfy the monadic predicateCO(n)P Yield the longest prefix of elements satisfying the predicate without copying.DO(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.EO(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to F.FO(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than E.GO(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.HO(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.IO(n)( Check if the vector contains an elementJO(n)= Check if the vector does not contain an element (inverse of I)KO(n) Yield %- the first element matching the predicate or $ if no such element exists.LO(n) Yield %; the index of the first element matching the predicate or $ if no such element exists.MO(n)L Yield the indices of elements satisfying the predicate in ascending order.NO(n) Yield %; the index of the first occurence of the given element or $O if the vector does not contain the element. This is a specialised version of L.OO(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of M.PO(n) Left foldQO(n) Left fold on non-empty vectorsRO(n)" Left fold with strict accumulatorSO(n)7 Left fold on non-empty vectors with strict accumulatorTO(n) Right foldUO(n) Right fold on non-empty vectorsVO(n)% Right fold with a strict accumulatorWO(n)8 Right fold on non-empty vectors with strict accumulatorXO(n); Left fold (function applied to each element and its index)YO(n)T Left fold with strict accumulator (function applied to each element and its index)ZO(n)< Right fold (function applied to each element and its index)[O(n)U Right fold with strict accumulator (function applied to each element and its index)\O(n)- Check if all elements satisfy the predicate.]O(n). Check if any element satisfies the predicate.^O(n) Check if all elements are W_O(n) Check if any element is W`O(n) Compute the sum of the elementsaO(n)$ Compute the produce of the elementsbO(n)G Yield the maximum element of the vector. The vector may not be empty.cO(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.dO(n)G Yield the minimum element of the vector. The vector may not be empty.eO(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.fO(n)T Yield the index of the maximum element of the vector. The vector may not be empty.gO(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.hO(n)T Yield the index of the minimum element of the vector. The vector may not be empty.iO(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.jO(n) Monadic foldkO(n)$ Monadic fold over non-empty vectorslO(n)% Monadic fold with strict accumulatormO(n)< Monadic fold over non-empty vectors with strict accumulatornO(n)& Monadic fold that discards the resultoO(n)= Monadic fold over non-empty vectors that discards the resultpO(n)> Monadic fold with strict accumulator that discards the resultqO(n)V Monadic fold over non-empty vectors with strict accumulator that discards the resultrO(n) Prescan prescanl f z =  . v f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>sO(n) Prescan with strict accumulatortO(n) Scan postscanl f z =  . v f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>uO(n) Scan with strict accumulatorvO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>wO(n)+ Haskell-style scan with strict accumulatorxO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiyO(n)7 Scan over a non-empty vector with a strict accumulatorzO(n) Right-to-left prescan prescanr f z = ) . r (flip f) z . ) {O(n). Right-to-left prescan with strict accumulator|O(n) Right-to-left scan}O(n)+ Right-to-left scan with strict accumulator~O(n)! Right-to-left Haskell-style scanO(n)9 Right-to-left Haskell-style scan with strict accumulatorO(n)+ Right-to-left scan over a non-empty vectorO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorO(n) Convert a vector to a listO(n) Convert a list to a vectorO(n) Convert the first n elements of a list to a vector fromListN n xs =  ( n xs) O(1) Unsafely cast a vector from one element type to another. The operation just changes the type of the underlying pointer and does not modify the elements.\The resulting vector contains as many elements as can fit into the underlying memory block.O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.O(n). Yield a mutable copy of the immutable vector.O(n)/ Yield an immutable copy of the mutable vector.O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.O(1) Create a vector from a R with an offset and a length.)The data may not be modified through the R afterwards.0If your offset is 0 it is more efficient to use .O(1) Create a vector from a R and a length.HIt is assumed the pointer points directly to the data (no offset). Use " if you need to specify an offset.)The data may not be modified through the R afterwards.O(1) Yield the underlying R` together with the offset to the data and its length. The data may not be modified through the R.O(1) Yield the underlying R together with its length.CYou can assume the pointer points directly to the data (no offset).)The data may not be modified through the R.ePass a pointer to the vector's data to the IO action. The data may not be modified through the 'Ptr.i starting indexn lengthi starting indexn length      !initial vector (of length m)%list of index/value pairs (of length n)"initial vector (of length m)index vector (of length n1)value vector (of length n2)#$%accumulating function finitial vector (of length m)%list of index/value pairs (of length n)&accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~pointeroffsetlengthpointerlength       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdehifgjlkmnpoqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~5I4J4 (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNoneDORTO(1) Yield the length of the vector.O(1) Test whether a vector if empty O(1) IndexingO(1) Safe indexingO(1) First elementO(1) Last elementO(1)( Unsafe indexing without bounds checkingO(1)6 First element without checking if the vector is emptyO(1)5 Last element without checking if the vector is emptyO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.O(1)+ First element of a vector in a monad. See + for an explanation of why this is useful.O(1)* Last element of a vector in a monad. See + for an explanation of why this is useful.O(1)0 Indexing in a monad without bounds checks. See + for an explanation of why this is useful.O(1)C First element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)B Last element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.O(1)N Yield all but the last element without copying. The vector may not be empty.O(1)O Yield all but the first element without copying. The vector may not be empty.O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.O(1) Yield the first n4 elements paired with the remainder without copying. Note that  n v is equivalent to ( n v,  n v) but slightly more efficient.O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Empty vectorO(1) Vector with exactly one elementO(n)@ Vector of the given length with the same value in each positionO(n)O Construct a vector of the given length by applying the function to each indexO(n)C Apply function n times to value. Zeroth element is original value.O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>O(n)! Construct a vector with at most n] by repeatedly applying the generator function to the a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than . enumFromN 5 3 = <5,6,7>O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than . +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Prepend an elementO(n) Append an elementO(m+n) Concatenate two vectorsO(n)$ Concatenate all vectors in the listO(n)Y Execute the monadic action the given number of times and store the results in a vector.O(n)U Construct a vector of the given length by applying the monadic action to each index;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>O(m+n) For each pair (i,a)O from the vector of index/value pairs, replace the vector element at position i by a. 0update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> The function A provides the same functionality and is usually more convenient. update_ xs is ys =  xs (@ is ys)  Same as () but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>O(m+n) For each pair (i,b)7 from the vector of pairs, replace the vector element a at position i by f a b. Daccumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> The function A provides the same functionality and is usually more convenient. accumulate_ f as is bs =  f as (@ is bs) Same as  but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(n) Reverse a vectorO(n)5 Yield the vector obtained by replacing each element i of the index vector by xsi. This is equivalent to  (xs) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as  but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') ( 3 'a') = <'x','a','a'> O(n)- Pair each element in a vector with its indexO(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)c Apply the monadic action to every element of a vector and its index, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)[ Apply the monadic action to every element of a vector and its index, ignoring the resultsO(n)e Apply the monadic action to all elements of the vector, yielding a vector of results. Equvalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.<Zip three vectors and their indices with the given function. O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results O(min(m,n))k Zip the two vectors with a monadic action that also takes the element index and yield a vector of results O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(min(m,n))d Zip the two vectors with a monadic action that also takes the element index and ignore the resultsO(n)0 Drop elements that do not satisfy the predicateO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield %- the first element matching the predicate or $ if no such element exists.O(n) Yield %; the index of the first element matching the predicate or $ if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield %; the index of the first occurence of the given element or $O if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of .O(n) Left foldO(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulatorO(n)7 Left fold on non-empty vectors with strict accumulatorO(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulator O(n); Left fold (function applied to each element and its index) O(n)T Left fold with strict accumulator (function applied to each element and its index) O(n)< Right fold (function applied to each element and its index) O(n)U Right fold with strict accumulator (function applied to each element and its index) O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Check if all elements are WO(n) Check if any element is WO(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)< Monadic fold (action applied to each element and its index)O(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)U Monadic fold with strict accumulator (action applied to each element and its index) O(n)< Monadic fold over non-empty vectors with strict accumulator!O(n)& Monadic fold that discards the result"O(n)V Monadic fold that discards the result (action applied to each element and its index)#O(n)= Monadic fold over non-empty vectors that discards the result$O(n)> Monadic fold with strict accumulator that discards the result%O(n)n Monadic fold with strict accumulator that discards the result (action applied to each element and its index)&O(n)V Monadic fold over non-empty vectors with strict accumulator that discards the result'O(n) Prescan prescanl f z =  . + f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>(O(n) Prescan with strict accumulator)O(n) Scan postscanl f z =  . + f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>*O(n) Scan with strict accumulator+O(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>,O(n)+ Haskell-style scan with strict accumulator-O(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xi.O(n)7 Scan over a non-empty vector with a strict accumulator/O(n) Right-to-left prescan prescanr f z =  . ' (flip f) z .  0O(n). Right-to-left prescan with strict accumulator1O(n) Right-to-left scan2O(n)+ Right-to-left scan with strict accumulator3O(n)! Right-to-left Haskell-style scan4O(n)9 Right-to-left Haskell-style scan with strict accumulator5O(n)+ Right-to-left scan over a non-empty vector6O(n)F Right-to-left scan over a non-empty vector with a strict accumulator7O(n) Convert a vector to a list8O(n) Convert a list to a vector9O(n) Convert the first n elements of a list to a vector fromListN n xs = 8 ( n xs) :O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.;O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.<O(n). Yield a mutable copy of the immutable vector.=O(n)/ Yield an immutable copy of the mutable vector.>O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.?O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.@O(1) Zip 2 vectorsAO(1) Unzip 2 vectorsBO(1) Zip 3 vectorsCO(1) Unzip 3 vectorsDO(1) Zip 4 vectorsEO(1) Unzip 4 vectorsFO(1) Zip 5 vectorsGO(1) Unzip 5 vectorsHO(1) Zip 6 vectorsIO(1) Unzip 6 vectorsi starting indexn lengthi starting indexn lengthinitial vector (of length m)%list of index/value pairs (of length n)initial vector (of length m)'vector of index/value pairs (of length n)initial vector (of length m)index vector (of length n1)value vector (of length n2)accumulating function finitial vector (of length m)%list of index/value pairs (of length n)accumulating function finitial vector (of length m)'vector of index/value pairs (of length n)accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO ~|zxvtrpnljh      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI@BDFHACEGI      !"$%#&'()*+,-./0123456789 =<?:;>      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO544 (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DORTP,Boxed vectors, supporting efficient slicing.QO(1) Yield the length of the vector.RO(1) Test whether a vector if emptyS O(1) IndexingTO(1) Safe indexingUO(1) First elementVO(1) Last elementWO(1)( Unsafe indexing without bounds checkingXO(1)6 First element without checking if the vector is emptyYO(1)5 Last element without checking if the vector is emptyZO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With Z/, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.[O(1)+ First element of a vector in a monad. See Z+ for an explanation of why this is useful.\O(1)* Last element of a vector in a monad. See Z+ for an explanation of why this is useful.]O(1)0 Indexing in a monad without bounds checks. See Z+ for an explanation of why this is useful.^O(1)C First element in a monad without checking for empty vectors. See Z* for an explanation of why this is useful._O(1)B Last element in a monad without checking for empty vectors. See Z* for an explanation of why this is useful.`O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.aO(1)N Yield all but the last element without copying. The vector may not be empty.bO(1)O Yield all but the first element without copying. The vector may not be empty.cO(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.dO(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.eO(1) Yield the first n4 elements paired with the remainder without copying. Note that e n v is equivalent to (c n v, d n v) but slightly more efficient.fO(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.gO(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.hO(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.iO(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.jO(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.kO(1) Empty vectorlO(1) Vector with exactly one elementmO(n)@ Vector of the given length with the same value in each positionnO(n)O Construct a vector of the given length by applying the function to each indexoO(n)C Apply function n times to value. Zeroth element is original value.pO(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>qO(n)! Construct a vector with at most n] by repeatedly applying the generator function to the a seed. The generator function yields %' the next element and the new seed or $ if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>rO(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>sO(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>tO(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than v. enumFromN 5 3 = <5,6,7>uO(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than w. +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>vO(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use t instead.wO(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use u instead.xO(n) Prepend an elementyO(n) Append an elementzO(m+n) Concatenate two vectors{O(n)$ Concatenate all vectors in the list|O(n)Y Execute the monadic action the given number of times and store the results in a vector.}O(n)U Construct a vector of the given length by applying the monadic action to each index~;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>O(m+n) For each pair (i,a)O from the vector of index/value pairs, replace the vector element at position i by a. 0update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> The function A provides the same functionality and is usually more convenient. update_ xs is ys =  xs ( is ys)  Same as () but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>O(m+n) For each pair (i,b)7 from the vector of pairs, replace the vector element a at position i by f a b. Daccumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> The function A provides the same functionality and is usually more convenient. accumulate_ f as is bs =  f as ( is bs) Same as  but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(n) Reverse a vectorO(n)5 Yield the vector obtained by replacing each element i of the index vector by xsSi. This is equivalent to  (xsS) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as  but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') (m 3 'a') = <'x','a','a'> O(n)- Pair each element in a vector with its indexO(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)c Apply the monadic action to every element of a vector and its index, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)[ Apply the monadic action to every element of a vector and its index, ignoring the resultsO(n)e Apply the monadic action to all elements of the vector, yielding a vector of results. Equvalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.<Zip three vectors and their indices with the given function.&Elementwise pairing of array elements.3zip together three vectors into a vector of triples O(min(m,n)) Unzip a vector of pairs. O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results O(min(m,n))k Zip the two vectors with a monadic action that also takes the element index and yield a vector of results O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(min(m,n))d Zip the two vectors with a monadic action that also takes the element index and ignore the resultsO(n)0 Drop elements that do not satisfy the predicateO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield %- the first element matching the predicate or $ if no such element exists.O(n) Yield %; the index of the first element matching the predicate or $ if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield %; the index of the first occurence of the given element or $O if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of .O(n) Left foldO(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulatorO(n)7 Left fold on non-empty vectors with strict accumulatorO(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulatorO(n); Left fold (function applied to each element and its index)O(n)T Left fold with strict accumulator (function applied to each element and its index)O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Check if all elements are WO(n) Check if any element is WO(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)< Monadic fold (action applied to each element and its index)O(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)U Monadic fold with strict accumulator (action applied to each element and its index)O(n)< Monadic fold over non-empty vectors with strict accumulatorO(n)& Monadic fold that discards the resultO(n)V Monadic fold that discards the result (action applied to each element and its index)O(n)= Monadic fold over non-empty vectors that discards the resultO(n)> Monadic fold with strict accumulator that discards the resultO(n)n Monadic fold with strict accumulator that discards the result (action applied to each element and its index)O(n)V Monadic fold over non-empty vectors with strict accumulator that discards the result,Evaluate each action and collect the results,Evaluate each action and discard the resultsO(n) Prescan prescanl f z = a .  f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>O(n) Prescan with strict accumulatorO(n) Scan postscanl f z = b .  f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>O(n) Scan with strict accumulatorO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>O(n)+ Haskell-style scan with strict accumulatorO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiO(n)7 Scan over a non-empty vector with a strict accumulatorO(n) Right-to-left prescan prescanr f z =  .  (flip f) z .  O(n). Right-to-left prescan with strict accumulatorO(n) Right-to-left scanO(n)+ Right-to-left scan with strict accumulatorO(n)! Right-to-left Haskell-style scanO(n)9 Right-to-left Haskell-style scan with strict accumulatorO(n)+ Right-to-left scan over a non-empty vectorO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorO(n) Convert a vector to a listO(n) Convert a list to a vectorO(n) Convert the first n elements of a list to a vector fromListN n xs =  (c n xs) O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.O(n). Yield a mutable copy of the immutable vector.O(n)/ Yield an immutable copy of the mutable vector.O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.PQRSTUVWXYZ[\]^_`i starting indexn lengthabcdefi starting indexn lengthghijklmnopqrstuvwxyz{|}~initial vector (of length m)%list of index/value pairs (of length n)initial vector (of length m)'vector of index/value pairs (of length n)initial vector (of length m)index vector (of length n1)value vector (of length n2)accumulating function finitial vector (of length m)%list of index/value pairs (of length n)accumulating function finitial vector (of length m)'vector of index/value pairs (of length n)accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)      PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~PQRSTUVWXYZ[\]^_`abcdefghijklmno|}~pqrstuvwxyz{ PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     z544 !"#$%&'()*+,-./0123456789:;<=>?@ABCDE67F@GHIIJKKLMNOPQRSTUUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~         Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~    Z [ \ ] ^ ` b c d e f g h i j k l m n r s t { | } ~  o p u v Z [ i l m j k ^ _                             5 5 Z [ i l m j k ^ _                55Z[ilmjk^_    55Z[ilmjk^_     !"#$$%&'()ijklmZ[*hef+,-./0123ijklm\]^`456bcd7_a%89:;<=>?@ABsnCoDpEFG{|}~HIJKLuMvNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~CCZ[*hef+,-./0123ijklm\]^`456bcd7_a%89:;<>@ABnCopFG{|}~HIJKLuvTUVWXYZ[\]^_`abcdefghijkloqrtwxyz{|}~C5Z[ilmjk^_    OPQRSCZ[*hef+,-./0123ijklm\]^`456bcd7_a%89:;<>@ABnCopFG{|}~HIJKLuvTUVWXYZ[\]^_`abcdefghijkloqrtwxyz{|}~ !"#Z[*hef+,-./0123ijklm\]^`456bcd7_a%89:;<=>?@ABsnCoDpEFG{|}~HIJKLuMvNTUVWXYZ[\]^_`abcdefghijklmnopqrstwxyz{|}~OPQRSCZ[*hef+,-./0123ijklm\]^`456bcd7_a%89:;<=>?@ABsnCoDpEFG{|}~HIJKLOPQRSuMvNTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Z ^                                 )      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|CC}&vector-0.11.0.0-HhutbadagxHIONIkSRJEug!Data.Vector.Fusion.Stream.MonadicData.Vector.Storable.MutableData.Vector.Primitive.MutableData.Vector.Storable.InternalData.Vector.Internal.Check Data.Vector.Generic.Mutable.BaseData.Vector.GenericData.Vector.Fusion.UtilData.Vector.Fusion.Bundle.Size!Data.Vector.Fusion.Bundle.MonadicData.Vector.Fusion.BundleData.Vector.Generic.MutableData.Vector.MutableData.Vector.Generic.NewData.Vector.PrimitiveData.Vector.Unboxed.MutableData.Vector.UnboxedData.Vector.Storable Data.VectorData.Vector.Generic.BasePrelude showsPrec Text.ReadreadPrec Data.DatagfoldlData.Vector.Unboxed.Baseghc-prim GHC.TypesSPECSPEC2baseForeign.StorableStorable'primitive-0.6.1.0-6AbSTw9JXz141LE5p6LGHData.Primitive.TypesPrimgetPtrsetPtrupdPtrChecksBoundsUnsafeInternaldoCheckserror internalErrorcheck checkIndex checkLength checkSlice $fEqChecksMVector basicLengthbasicUnsafeSlice basicOverlapsbasicUnsafeNewbasicInitializebasicUnsafeReplicatebasicUnsafeReadbasicUnsafeWrite basicClearbasicSetbasicUnsafeCopybasicUnsafeMovebasicUnsafeGrowVectorbasicUnsafeFreezebasicUnsafeThawbasicUnsafeIndexMelemseqMutableBoxunBoxIdunId delay_inline delayed_min $fMonadBox$fApplicativeBox $fFunctorBox $fMonadId$fApplicativeId $fFunctorIdStreamStepYieldSkipDonelengthnullempty singleton replicate replicateMgenerate generateMconssnoc++headlast!!!?sliceinittailtakedropmapmapMmapM_transunboxindexedindexedRzipWithM zipWithM_ zipWith3M zipWith4M zipWith5M zipWith6MzipWithzipWith3zipWith4zipWith5zipWith6zipzip3zip4zip5zip6eqcmpfilterfilterM takeWhile takeWhileM dropWhile dropWhileMelemnotElemfindfindM findIndex findIndexMfoldlfoldlMfoldMfoldl1foldl1Mfold1Mfoldl'foldlM'foldM'foldl1'foldl1M'fold1M'foldrfoldrMfoldr1foldr1Mandor concatMap concatMapMflattenunfoldrunfoldrMunfoldrN unfoldrNM iterateNMiterateNprescanl prescanlM prescanl' prescanlM' postscanl postscanlM postscanl' postscanlM'scanlscanlMscanl'scanlM'scanl1scanl1Mscanl1'scanl1M' enumFromStepN enumFromToenumFromThenTotoListfromList fromListN$fFunctorStream $fFunctorStepSizeExactMaxUnknownclampedSubtractsmallerlargertoMax lowerBound upperBound $fNumSize$fEqSize $fShowSizeBundlesElemssChunkssVectorsSizeChunk fromStreamchunkselementssizesizedunsafeFromList fromVector fromVectors concatVectorsreVector$fFunctorBundleMBundleinplacelift $fOrdBundle $fEqBundlemstreamfill transformmstreamRfillR transformRunstream munstream vunstream unstreamR munstreamRsplitAt unsafeSlice unsafeInit unsafeTail unsafeTake unsafeDropoverlapsnew unsafeNewclonegrow growFront unsafeGrowunsafeGrowFrontclearreadwritemodifyswapexchange unsafeRead unsafeWrite unsafeModify unsafeSwapunsafeExchangesetcopymove unsafeCopy unsafeMoveaccumupdate unsafeAccum unsafeUpdatereverseunstablePartitionunstablePartitionBundlepartitionBundleSTVectorIOVector$fMVectorMVectora$fNFDataMVector unsafeCastunsafeFromForeignPtrunsafeFromForeignPtr0unsafeToForeignPtrunsafeToForeignPtr0 unsafeWithNewcreaterunrunPrimapplymodifyWithBundle! unsafeIndex unsafeHead unsafeLastindexMheadMlastM unsafeIndexM unsafeHeadM unsafeLastM constructN constructrN enumFromNconcatforce//update_ unsafeUpd unsafeUpdate_ accumulate accumulate_unsafeAccumulateunsafeAccumulate_ backpermuteunsafeBackpermuteimapimapMimapM_forMforM_izipWith izipWith3 izipWith4 izipWith5 izipWith6 izipWithM izipWithM_unzipunzip3unzip4unzip5unzip6ifilter partitionspanbreak findIndices elemIndex elemIndicesfoldr'foldr1'ifoldlifoldl'ifoldrifoldr'allanysumproductmaximum maximumByminimum minimumBymaxIndex maxIndexByminIndex minIndexByifoldMifoldM'foldM_ifoldM_fold1M_foldM'_ifoldM'_fold1M'_sequence sequence_prescanr prescanr' postscanr postscanr'scanrscanr'scanr1scanr1'convert unsafeFreezefreeze unsafeThawthawstreamstreamRmkTypedataCast$fIsListVector$fMonoidVector $fOrdVector $fEqVector$fVectorVectora $fDataVector $fReadVector $fShowVector$fNFDataVectorUnbox$fTraversableVector$fFoldableVector$fAlternativeVector$fApplicativeVector$fMonadPlusVector $fMonadVector$fFunctorVectornot&&||doBoundsChecksdoUnsafeChecksdoInternalChecks error_msg checkErrorcheckIndex_msgcheckIndex_msg#checkLength_msgcheckLength_msg#checkSlice_msgcheckSlice_msg# Data.FoldableGHC.List GHC.ClassesminGHC.BaseNothingJust DropWhileDropWhile_DropDropWhile_YieldDropWhile_Next emptyStreamconsumeenumFromTo_smallenumFromTo_intenumFromTo_intlikeenumFromTo_big_wordenumFromTo_big_intenumFromTo_charenumFromTo_double checkedAddcheckedSubtracttoListFB vmunstreamenlarge unsafeAppend1unsafePrepend1 munstreamMaxmunstreamUnknown vmunstreamMaxvmunstreamUnknown munstreamRMaxmunstreamRUnknown enlarge_delta enlargeFrontunstablePartitionMax partitionMaxpartitionUnknownIO moveBackwardsmoveForwardsSmallOverlapmoveForwardsLargeOverlaploopM uninitialisedGHC.ForeignPtr ForeignPtr storableZero storableSetstorableSetAsPrim mallocVectorTrueEqOrd update_streamunsafeUpdate_stream accum_streamunsafeAccum_streampartition_streamunstablePartition_streamunstablePartition_newdiscard unstreamM unstreamPrimMunstreamPrimM_IOunstreamPrimM_STV_6MV_6V_5MV_5V_4MV_4V_3MV_3V_2MV_2 V_Complex MV_ComplexV_BoolMV_BoolV_CharMV_CharV_Double MV_DoubleV_FloatMV_FloatV_Word64 MV_Word64V_Word32 MV_Word32V_Word16 MV_Word16V_Word8MV_Word8V_WordMV_WordV_Int64MV_Int64V_Int32MV_Int32V_Int16MV_Int16V_Int8MV_Int8V_IntMV_IntV_UnitMV_UnitfromBooltoBool$fVectorVector(,,,,,)$fMVectorMVector(,,,,,)$fUnbox(,,,,,)D:R:Vector(,,,,,)0D:R:MVectors(,,,,,)0$fVectorVector(,,,,)$fMVectorMVector(,,,,) $fUnbox(,,,,)D:R:Vector(,,,,)0D:R:MVectors(,,,,)0$fVectorVector(,,,)$fMVectorMVector(,,,) $fUnbox(,,,)D:R:Vector(,,,)0D:R:MVectors(,,,)0$fVectorVector(,,)$fMVectorMVector(,,) $fUnbox(,,)D:R:Vector(,,)0D:R:MVectors(,,)0$fVectorVector(,)$fMVectorMVector(,) $fUnbox(,)D:R:Vector(,)0D:R:MVectors(,)0$fVectorVectorComplex$fMVectorMVectorComplex$fUnboxComplexD:R:VectorComplex0D:R:MVectorsComplex0$fVectorVectorBool$fMVectorMVectorBool $fUnboxBoolD:R:VectorBool0D:R:MVectorsBool0$fVectorVectorChar$fMVectorMVectorChar $fUnboxCharD:R:VectorChar0D:R:MVectorsChar0$fVectorVectorDouble$fMVectorMVectorDouble $fUnboxDoubleD:R:VectorDouble0D:R:MVectorsDouble0$fVectorVectorFloat$fMVectorMVectorFloat $fUnboxFloatD:R:VectorFloat0D:R:MVectorsFloat0$fVectorVectorWord64$fMVectorMVectorWord64 $fUnboxWord64D:R:VectorWord640D:R:MVectorsWord640$fVectorVectorWord32$fMVectorMVectorWord32 $fUnboxWord32D:R:VectorWord320D:R:MVectorsWord320$fVectorVectorWord16$fMVectorMVectorWord16 $fUnboxWord16D:R:VectorWord160D:R:MVectorsWord160$fVectorVectorWord8$fMVectorMVectorWord8 $fUnboxWord8D:R:VectorWord80D:R:MVectorsWord80$fVectorVectorWord$fMVectorMVectorWord $fUnboxWordD:R:VectorWord0D:R:MVectorsWord0$fVectorVectorInt64$fMVectorMVectorInt64 $fUnboxInt64D:R:VectorInt640D:R:MVectorsInt640$fVectorVectorInt32$fMVectorMVectorInt32 $fUnboxInt32D:R:VectorInt320D:R:MVectorsInt320$fVectorVectorInt16$fMVectorMVectorInt16 $fUnboxInt16D:R:VectorInt160D:R:MVectorsInt160$fVectorVectorInt8$fMVectorMVectorInt8 $fUnboxInt8D:R:VectorInt80D:R:MVectorsInt80$fVectorVectorInt$fMVectorMVectorInt $fUnboxIntD:R:VectorInt0D:R:MVectorsInt0$fVectorVector()$fMVectorMVector() $fUnbox() D:R:Vector()0D:R:MVectors()0