G      !"#$%&'()*+,-./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 { | } ~                                                                                                                                           ! " # $ % & ' ( ) * + , - . / 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 rstuvwxyz{|}~                                                                                                                                               !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au> Box monad Identity monad  GDelay inlining a function until late in the game (simplifier phase 0).      portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>  Size hint  Unknown size Upper bound on the size  Exact size Minimum of two size hints Maximum of two size hints &Convert a size hint to an upper bound *Compute the minimum size from a size hint 6Compute the maximum size from a size hint if possible       non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>    non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>{Monadic streams !+Result of taking a single step in a stream "end of stream #just a new seed $a new element and a new seed %  hint of a   & Attach a   hint to a   ' Length of a   ( Check if a   is empty )Empty   * Singleton   +$Replicate a value to a given length ,Yield a  9 of values obtained by performing the monadic action the  given number of times -.#Generate a stream from its indices /Prepend an element 0Append an element 1Concatenate two  s 2First element of the   or error if empty 3Last element of the   or error if empty 4Element at the given position 5HExtract a substream of the given length starting at the given position. starting index length 6All but the last element 7All but the first element 8 The first n elements 9All but the first n elements :Map 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 monad >?Pair each element in a   with its index @Pair each element in a  ) with its index, starting from the right  and counting down AZip two  "s with the given monadic function BCDEFGHIJKLMNOPQ1Drop elements which do not satisfy the predicate R9Drop elements which do not satisfy the monadic predicate S6Longest prefix of elements that satisfy the predicate T>Longest prefix of elements that satisfy the monadic predicate U?Drop the longest prefix of elements that satisfy the predicate VGDrop the longest prefix of elements that satisfy the monadic predicate WCheck whether the   contains an element X Inverse of W YYield 3 the first element that satisfies the predicate or   if no such element exists. ZYield ; the first element that satisfies the monadic predicate or   if no such element exists. [Yield = the index of the first element that satisfies the predicate  or  if no such element exists. \Yield ; the index of the first element that satisfies the monadic  predicate or  if no such element exists. ] Left fold ^"Left fold with a monadic operator _Same as ^ `Left fold over a non-empty   aLeft fold over a non-empty   with a monadic operator bSame as a c$Left fold with a strict accumulator d;Left fold with a strict accumulator and a monadic operator eSame as d fLeft fold over a non-empty   with a strict accumulator gLeft fold over a non-empty  ! with a strict accumulator and a  monadic operator hSame as g i Right fold j#Right fold with a monadic operator k#Right fold over a non-empty stream l;Right fold over a non-empty stream with a monadic operator mnopqUnfold rUnfold with a monadic function sUnfold at most n elements tUnfold at most n# elements with a monadic functions u Prefix scan v$Prefix scan with a monadic operator w$Prefix scan with strict accumulator x;Prefix scan with strict accumulator and a monadic operator y Suffix scan z$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 BHaskell-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  ) 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 values WARNING:A 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. m !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~m !$#"%&'()*/0+,-.123456789:;<=>o?@BACDEFGHIJKLMNOPQRSTUVWXYZ[\]^`a_bcdfgehijklmnpqrstuvwxyz{|}~m !$#""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>R%Alternative name for monadic streams The type of pure streams *Convert a pure stream to a monadic stream   hint of a   Attach a   hint to a   Length of a   Check if a  is empty Empty   Singleton  $Replicate a value to a given length #Generate a stream from its indices Prepend an element Append an element Concatenate two s First element of the  or error if empty Last element of the  or error if empty Element at the given position HExtract a substream of the given length starting at the given position. starting index length All but the last element All but the first element  The first n elements All but the first n elements Map a function over a  Pair each element in a  with its index Pair each element in a ) with its index, starting from the right  and counting down Zip two s with the given function  Zip three s with the given function 1Drop elements which do not satisfy the predicate 6Longest prefix of elements that satisfy the predicate ?Drop the longest prefix of elements that satisfy the predicate Check whether the  contains an element  Inverse of  Yield - the first element matching the predicate or  if no  such element exists. Yield : the index of the first element matching the predicate or   if no such element exists.  Left fold Left fold on non-empty s "Left fold with strict accumulator Left fold on non-empty s with strict accumulator  Right fold Right fold on non-empty s Unfold Unfold at most n elements  Prefix scan $Prefix scan with strict accumulator  Suffix scan $Suffix scan with strict accumulator Haskell-style scan +Haskell-style scan with strict accumulator Scan over a non-empty  Scan over a non-empty  with a strict accumulator  Check if two  s are equal Lexicographically compare two s JApply a monadic action to each element of the stream, producing a monadic  stream of results 5Apply a monadic action to each element of the stream FYield a monadic stream of elements that satisfy the monadic predicate  Monadic fold #Monadic fold over non-empty stream %Monadic fold with strict accumulator 9Monad fold over non-empty stream with strict accumulator Yield a + of the given length containing the values x, x+y,  x+y+y etc. Enumerate values WARNING:B 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  to a list  Create a  from a list  Create a  from the first n elements of a list ' fromListN n xs = fromList (take n xs) U!"#$U!$#"Q  non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>JDClass of mutable vectors parametrised with a primitive state token. 8Length of the mutable vector. This method should not be  called directly, use  instead. CYield a part of the mutable vector without copying it. This method $ should not be called directly, use  instead. starting index length of the slice GCreate a mutable vector of the given length. This method should not be  called directly, use  instead. @Create a mutable vector of the given length and fill it with an ? initial value. This method should not be called directly, use   instead. CYield the element at the given position. This method should not be  called directly, use  instead. EReplace the element at the given position. This method should not be  called directly, use  instead. GReset all elements of the vector to some undefined value, clearing all D references to external objects. This is usually a noop for unboxed 9 vectors. This method should not be called directly, use  instead. FSet all elements of the vector to the given value. This method should  not be called directly, use  instead. GCopy a vector. The two vectors may not overlap. This method should not  be called directly, use  instead. target source IGrow a vector by the given number of elements. This method should not be  called directly, use  instead. ?Create a new mutable vector and fill it with elements from the . ? The vector will grow exponentially if the maximum size of the  is  unknown. GCreate a new mutable vector and fill it with elements from the monadic N 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  L from right to left. The vector will grow exponentially if the maximum size  of the  is unknown. GCreate a new mutable vector and fill it with elements from the monadic N 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 empty -Create a mutable vector of the given length. @Create a mutable vector of the given length and fill it with an  initial value. HCreate a mutable vector of the given length. The length is not checked. @Create a mutable vector of the given length and fill it with an + initial value. The length is not checked. BGrow a vector by the given number of elements. The number must be  positive. Grow a vector logarithmically BGrow a vector by the given number of elements. The number must be # positive but this is not checked. )Yield the element at the given position. +Replace the element at the given position. *Swap the elements at the given positions. EReplace the element at the give position and return the old element. IYield the element at the given position. No bounds checks are performed. KReplace the element at the given position. No bounds checks are performed. JSwap the elements at the given positions. No bounds checks are performed. HReplace the element at the give position and return the old element. No  bounds checks are performed. GReset all elements of the vector to some undefined value, clearing all N references to external objects. This is usually a noop for unboxed vectors. 3Set all elements of the vector to the given value. ECopy a vector. The two vectors must have the same length and may not  overlap. ECopy a vector. The two vectors must have the same length and may not  overlap. This is not checked. target source 7Yield a part of the mutable vector without copying it. HYield a part of the mutable vector without copying it. No bounds checks  are performed. starting index length of the slice      6     6     6       non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>JClass of immutable vectors. Every immutable vector is associated with its  mutable version through the $ type family. Methods of this class ' should not be used directly. Instead, Data.Vector.Generic and other 8 Data.Vector modules provide safe and fusible wrappers. !Minimum complete implementation:         Assume 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)  Yield the length of the vector. Assumed complexity: O(1) DYield a slice of the vector without copying it. No range checks are  performed. starting index length Assumed complexity: O(1) HYield the element at the given position in a monad. No range checks are  performed. JThe monad allows us to be strict in the vector if we want. Suppose we had   unsafeIndex :: v a -> Int -> a /instead. Now, if we wanted to copy a vector, we'd do something like  < copy mv v ... = ... unsafeWrite mv i (unsafeIndex v i) ... JFor lazy vectors, the indexing would not be evaluated which means that we K would retain a reference to the original vector in each element we write.  This is not what we want! With  , we can do  3 copy mv v ... = ... case basicUnsafeIndexM v i of 7 Box x -> unsafeWrite mv i x ... Hwhich does not have this problem because indexing (but not the returned % element!) is evaluated immediately. Assumed complexity: O(n) GCopy an immutable vector into a mutable one. The two vectors must have * the same length but this is not checked.  Instances of 5 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 H 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 0 although this might result in suboptimal code.  4 elemseq v x y = (singleton x `asTypeOf` v) `seq` y Default 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   non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au> !"#$%&'()*+,- !"#$%&'()*+,- !"#$%&'()*+,- !"#$%&'()*+,-  non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>.O(1)! Yield the length of the vector. /O(1) Test whether a vector if empty 0O(1) Indexing 1O(1) First element 2O(1) Last element 3O(1)) Unsafe indexing without bounds checking 4O(1)7 First element without checking if the vector is empty 5O(1)6 Last element without checking if the vector is empty 6O(1) Indexing in a monad. GThe monad allows operations to be strict in the vector when necessary. 2 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 60, copying can be implemented like this instead:   copy mv v = ... do # x <- indexM v i  write mv i x Here, no references to v$ are retained because indexing (but not the ! elements) is evaluated eagerly. 7O(1)+ First element of a vector in a monad. See 6 for an $ explanation of why this is useful. 8O(1)* Last element of a vector in a monad. See 6 for an $ explanation of why this is useful. 9O(1)0 Indexing in a monad without bounds checks. See 6 for an $ explanation of why this is useful. :O(1)> First element in a monad without checking for empty vectors.  See 6+ for an explanation of why this is useful. ;O(1)= Last element in a monad without checking for empty vectors.  See 6+ for an explanation of why this is useful. <O(1)A Yield a slice of the vector without copying it. The vector must  contain at least i+n elements. i starting index n length =O(1)D Yield all but the last element without copying. The vector may not  be empty. >O(1)E 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 n2 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 n5 elements in which case an empty vector is returned. AO(1)> Yield a slice of the vector without copying. The vector must  contain at least i+n# elements but this is not checked. i starting index n length BO(1)D Yield all but the last element without copying. The vector may not # be empty but this is not checked. CO(1)E Yield all but the first element without copying. The vector may not # be empty but this is not checked. DO(1) Yield the first n+ elements without copying. The vector must  contain at least n# elements but this is not checked. EO(1) Yield all but the first n& elements without copying. The vector  must contain at least n# elements but this is not checked. FO(1) Empty vector GO(1)! Vector with exactly one element HO(n)A Vector of the given length with the same value in each position IO(n)D Construct a vector of the given length by applying the function to  each index JO(n)B 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. = unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10  = <10,9,8,7,6,5,4,3,2,1> KO(n)! Construct a vector with at most n by repeatedly applying the A 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> LO(n): Yield a vector of the given length containing the values x, x+1 4 etc. This operation is usually more efficient than N.  enumFromN 5 3 = <5,6,7> MO(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 O. - enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4> NO(n) Enumerate values from x to y. WARNING:A This operation can be very inefficient. If at all possible, use  L instead. OO(n) Enumerate values from x to y with a specific step z. WARNING:A This operation can be very inefficient. If at all possible, use  M instead. PO(n) Prepend an element QO(n) Append an element RO(m+n) Concatenate two vectors SO(n)D Execute the monadic action the given number of times and store the  results in a vector. T<Execute the monadic action and freeze the resulting vector.   create (do { v <-  2;  v 0 'a';  v 1 'b' }) = <a,b> UO(n)A Yield the argument but force it not to retain any extra memory,  possibly by copying it. AThis is especially useful when dealing with slices. For example:  ! force (slice 0 2 <huge vector>) KHere, the slice retains a reference to the huge vector. Forcing it creates J a copy of just the elements that belong to the slice and allows the huge ! vector to be garbage collected. VO(m+n) For each pair (i,a)# 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> initial vector (of length m)  list of index/value pairs (of length n) WO(m+n) For each pair (i,a) from the vector of index/ value pairs, ( replace the vector element at position i by a. 2 update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7> initial vector (of length m) vector of index/value pairs (of length n) XO(m+min(n1,n2)) For each index i from the index vector and the  corresponding value a3 from the value vector, replace the element of the  initial vector at position i by a.  0 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, W is probably more convenient.   update_ xs is ys = W xs (w is ys) initial vector (of length m) index vector (of length n1) value vector (of length n2) Y Same as (V) but without bounds checking. ZSame as W but without bounds checking. [Same as X 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. A accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m)  list of index/value pairs (of length n) ]O(m+n) For each pair (i,b). from the vector of pairs, replace the vector  element a at position i by f a b. F accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m) vector of index/value pairs (of length n) ^O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value b from the the value vector, . replace the element of the initial vector at  position i by f a b.  A 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 (w is bs) accumulating function f initial vector (of length m) index vector (of length n1) value vector (of length n2) _Same as \ but without bounds checking. `Same as ] but without bounds checking. aSame as ^ but without bounds checking. bO(n) Reverse a vector cO(n)5 Yield the vector obtained by replacing each element i of the  index vector by xs0i. This is equivalent to f (xs0) is but is  often much more efficient. 5 backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a> xs value vector is index vector (of length n) dSame as c but without bounds checking. eAApply a destructive operation to a vector. The operation will be I performed in place if it is safe to do so and will modify a copy of the  vector otherwise.   modify (\v ->  v 0 'x') (H 3 'a') = <'x','a','a'> fO(n) Map a function over a vector gO(n)= Apply a function to every element of a vector and its index h:Map a function over a vector and concatenate the results. iO(n)D Apply the monadic action to all elements of the vector, yielding a  vector of results jO(n)E Apply the monadic action to all elements of a vector and ignore the  results kO(n)D Apply the monadic action to all elements of the vector, yielding a ! vector of results. Equvalent to flip i. lO(n)E Apply the monadic action to all elements of a vector and ignore the  results. Equivalent to flip j. m O(min(m,n))* Zip two vectors with the given function. n+Zip three vectors with the given function. opqr O(min(m,n))5 Zip two vectors with a function that also takes the  elements' indices. stuvw O(min(m,n)) Zip two vectors xyz{| O(min(m,n))9 Zip the two vectors with the monadic action and yield a  vector of results } O(min(m,n))< Zip the two vectors with the monadic action and ignore the  results ~ O(min(m,n)) Unzip a vector of pairs. O(n)1 Drop elements that do not satisfy the predicate O(n)E Drop elements that do not satisfy the predicate which is applied to  values and their indices O(n)9 Drop elements that do not satisfy the monadic predicate O(n)? Yield the longest prefix of elements satisfying the predicate  without copying. O(n)@ 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 F elements that satisfy the predicate and the second one those that don't. The H 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 F elements that satisfy the predicate and the second one those that don't. G The order of the elements is not preserved but the operation is often  faster than . O(n)C Split the vector into the longest prefix of elements that satisfy - the predicate and the rest without copying. O(n)B Split the vector into the longest prefix of elements that do not 5 satisfy the predicate and the rest without copying. O(n)) Check if the vector contains an element O(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 7 the index of the first element matching the predicate  or  if no such element exists. O(n)E 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  C if the vector does not contain the element. This is a specialised  version of . O(n)= Yield the indices of all occurences of the given element in 3 ascending order. This is a specialised version of . O(n) Left fold O(n) Left fold on non-empty vectors O(n)# Left fold with strict accumulator O(n)8 Left fold on non-empty vectors with strict accumulator O(n) Right fold O(n)! Right fold on non-empty vectors O(n)& Right fold with a strict accumulator O(n)9 Right fold on non-empty vectors with strict accumulator O(n)< Left fold (function applied to each element and its index) O(n)E 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)> 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  O(n) Check if any element is  O(n)! Compute the sum of the elements O(n)% Compute the produce of the elements O(n)@ Yield the maximum element of the vector. The vector may not be  empty. O(n)@ Yield the maximum element of the vector according to the given 3 comparison function. The vector may not be empty. O(n)@ Yield the minimum element of the vector. The vector may not be  empty. O(n)@ Yield the minimum element of the vector according to the given 3 comparison function. The vector may not be empty. O(n)B Yield the index of the maximum element of the vector. The vector  may not be empty. O(n)C Yield the index of the maximum element of the vector according to = the given comparison function. The vector may not be empty. O(n)B Yield the index of the minimum element of the vector. The vector  may not be empty. O(n)C 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 fold O(n)% Monadic fold over non-empty vectors O(n)& Monadic fold with strict accumulator O(n); Monad fold over non-empty vectors with strict accumulator 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  ) scanl 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 # scanl f <x1,...,xn> = <y1,...,yn>  where y1 = x1  yi = f y(i-1) xi O(n)8 Scan over a non-empty vector with a strict accumulator O(n) Right-to-left prescan   prescanr f z = b .  (flip f) z . b 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 scan O(n): Right-to-left Haskell-style scan with strict accumulator O(n), Right-to-left scan over a non-empty vector O(n): Right-to-left scan over a non-empty vector with a strict  accumulator O(n) Convert a vector to a list O(n) Convert a list to a vector O(n) Convert the first n elements of a list to a vector   fromListN n xs =  (? n xs) O(n)C Copy an immutable vector into a mutable one. The two vectors must  have the same length. O(n)C 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  O(n) Construct a vector from a  O(1) Convert a vector to a  , proceeding from right to left O(n) Construct a vector from a  , proceeding from right to left /Construct a vector from a monadic initialiser. GConvert 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 7 and it is usually more appropriate to use those. This 1 function is primarily intended for implementing  instances for new  vector types. O(n), Compare two vectors lexicographically. All  instances are  also instances of 7 and it is usually more appropriate to use those. This 1 function is primarily intended for implementing  instances for new  vector types. Generic definion of Data.Data.gfoldl that views a  as a  list. ./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Ы./0123456789:;<=>?@ABCDEFGHISTJKLMNOPQRUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>$Mutable vectors of primitive types. HYield a part of the mutable vector without copying it. No bounds checks  are performed. starting index length of the slice HCreate a mutable vector of the given length. The length is not checked. @Create a mutable vector of the given length and fill it with an + initial value. The length is not checked. IYield the element at the given position. No bounds checks are performed. KReplace the element at the given position. No bounds checks are performed. JSwap the elements at the given positions. No bounds checks are performed. ECopy a vector. The two vectors must have the same length and may not  overlap. This is not checked. target source BGrow a vector by the given number of elements. The number must be # positive but this is not checked. Length of the mutable vector. 7Yield a part of the mutable vector without copying it. -Create a mutable vector of the given length. @Create a mutable vector of the given length and fill it with an  initial value. )Yield the element at the given position. +Replace the element at the given position. *Swap the elements at the given positions. GReset all elements of the vector to some undefined value, clearing all N references to external objects. This is usually a noop for unboxed vectors. 3Set all elements of the vector to the given value. ECopy a vector. The two vectors must have the same length and may not  overlap. BGrow a vector by the given number of elements. The number must be  positive.   non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>#Unboxed vectors of primitive types O(1)! Yield the length of the vector. O(1) Test whether a vector if empty O(1) Indexing O(1) First element O(1) Last element O(1)) Unsafe indexing without bounds checking O(1)7 First element without checking if the vector is empty O(1)6 Last element without checking if the vector is empty O(1) Indexing in a monad. GThe monad allows operations to be strict in the vector when necessary. 2 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 0, copying can be implemented like this instead:   copy mv v = ... do # x <- indexM v i  write mv i x Here, 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)> First element in a monad without checking for empty vectors.  See + for an explanation of why this is useful. O(1)= Last element in a monad without checking for empty vectors.  See + for an explanation of why this is useful. O(1)A Yield a slice of the vector without copying it. The vector must  contain at least i+n elements. i starting index n length O(1)D Yield all but the last element without copying. The vector may not  be empty. O(1)E 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 n2 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 n5 elements in which case an empty vector is returned. O(1)> Yield a slice of the vector without copying. The vector must  contain at least i+n# elements but this is not checked. i starting index n length O(1)D Yield all but the last element without copying. The vector may not # be empty but this is not checked. O(1)E 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 element O(n)A Vector of the given length with the same value in each position O(n)D Construct a vector of the given length by applying the function to  each index O(n)B 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. = unfoldr (\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 A 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): Yield a vector of the given length containing the values x, x+1 4 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:A 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:A This operation can be very inefficient. If at all possible, use    instead.  O(n) Prepend an element  O(n) Append an element O(m+n) Concatenate two vectors O(n)D Execute the monadic action the given number of times and store the  results in a vector. <Execute the monadic action and freeze the resulting vector.   create (do { v <- new 2; write v 0 'a' ; write v 1 'b' }) = <a,b> O(n)A Yield the argument but force it not to retain any extra memory,  possibly by copying it. AThis is especially useful when dealing with slices. For example:  ! force (slice 0 2 <huge vector>) KHere, the slice retains a reference to the huge vector. Forcing it creates J 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)# 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> initial vector (of length m)  list of index/value pairs (of length n) O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value a3 from the value vector, replace the element of the  initial vector at position i by a. 0 update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> initial vector (of length m) index vector (of length n1) value vector (of length n2)  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. A accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m)  list of index/value pairs (of length n) O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value b from the the value vector, . replace the element of the initial vector at  position i by f a b. A accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m) index vector (of length n1) value vector (of length n2) 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. 5 backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a> Same as  but without bounds checking. AApply a destructive operation to a vector. The operation will be I 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  :Map a function over a vector and concatenate the results. !O(n)D Apply the monadic action to all elements of the vector, yielding a  vector of results "O(n)E Apply the monadic action to all elements of a vector and ignore the  results #O(n)D Apply the monadic action to all elements of the vector, yielding a ! vector of results. Equvalent to flip !. $O(n)E 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))5 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))9 Zip the two vectors with the monadic action and yield a  vector of results 0 O(min(m,n))< Zip the two vectors with the monadic action and ignore the  results 1O(n)1 Drop elements that do not satisfy the predicate 2O(n)E Drop elements that do not satisfy the predicate which is applied to  values and their indices 3O(n)9 Drop elements that do not satisfy the monadic predicate 4O(n)? Yield the longest prefix of elements satisfying the predicate  without copying. 5O(n)@ Drop the longest prefix of elements that satisfy the predicate  without copying. 6O(n)? Split the vector in two parts, the first one containing those F elements that satisfy the predicate and the second one those that don't. The H relative order of the elements is preserved at the cost of a sometimes ! reduced performance compared to 7. 7O(n)? Split the vector in two parts, the first one containing those F elements that satisfy the predicate and the second one those that don't. G The order of the elements is not preserved but the operation is often  faster than 6. 8O(n)C Split the vector into the longest prefix of elements that satisfy - the predicate and the rest without copying. 9O(n)B Split the vector into the longest prefix of elements that do not 5 satisfy the predicate and the rest without copying. :O(n)) Check if the vector contains an element ;O(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 7 the index of the first element matching the predicate  or  if no such element exists. >O(n)E 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  C if the vector does not contain the element. This is a specialised  version of =. @O(n)= Yield the indices of all occurences of the given element in 3 ascending order. This is a specialised version of >. AO(n) Left fold BO(n) Left fold on non-empty vectors CO(n)# Left fold with strict accumulator DO(n)8 Left fold on non-empty vectors with strict accumulator EO(n) Right fold FO(n)! Right fold on non-empty vectors GO(n)& Right fold with a strict accumulator HO(n)9 Right fold on non-empty vectors with strict accumulator IO(n)< Left fold (function applied to each element and its index) JO(n)E Left fold with strict accumulator (function applied to each element  and its index) KO(n)= Right fold (function applied to each element and its index) LO(n)> Right fold with strict accumulator (function applied to each  element and its index) MO(n). Check if all elements satisfy the predicate. NO(n)/ Check if any element satisfies the predicate. OO(n)! Compute the sum of the elements PO(n)% Compute the produce of the elements QO(n)@ Yield the maximum element of the vector. The vector may not be  empty. RO(n)@ Yield the maximum element of the vector according to the given 3 comparison function. The vector may not be empty. SO(n)@ Yield the minimum element of the vector. The vector may not be  empty. TO(n)@ Yield the minimum element of the vector according to the given 3 comparison function. The vector may not be empty. UO(n)B Yield the index of the maximum element of the vector. The vector  may not be empty. VO(n)C Yield the index of the maximum element of the vector according to = the given comparison function. The vector may not be empty. WO(n)B Yield the index of the minimum element of the vector. The vector  may not be empty. XO(n)C Yield the index of the minimum element of the vector according to = the given comparison function. The vector may not be empty. YO(n) Monadic fold ZO(n)% Monadic fold over non-empty vectors [O(n)& Monadic fold with strict accumulator \O(n); Monad fold over non-empty vectors with strict accumulator ]O(n) Prescan    prescanl f z =  . a 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 =  . a f z  Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10> `O(n) Scan with strict accumulator aO(n) Haskell-style scan  ) scanl 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> bO(n), Haskell-style scan with strict accumulator cO(n) Scan over a non-empty vector # scanl f <x1,...,xn> = <y1,...,yn>  where y1 = x1  yi = f y(i-1) xi dO(n)8 Scan over a non-empty vector with a strict accumulator eO(n) Right-to-left prescan   prescanr f z =  . ] (flip f) z .  fO(n)/ Right-to-left prescan with strict accumulator gO(n) Right-to-left scan hO(n), Right-to-left scan with strict accumulator iO(n)" Right-to-left Haskell-style scan jO(n): Right-to-left Haskell-style scan with strict accumulator kO(n), Right-to-left scan over a non-empty vector lO(n): Right-to-left scan over a non-empty vector with a strict  accumulator mO(n) Convert a vector to a list nO(n) Convert a list to a vector oO(n) Convert the first n elements of a list to a vector   fromListN n xs = n ( n xs) pO(n)C Copy an immutable vector into a mutable one. The two vectors must  have the same length. qO(n)C Copy an immutable vector into a mutable one. The two vectors must , have the same length. This is not checked.       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopq      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTWXUVY[Z\]^_`abcdefghijklmnoqp      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopq non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>rstMutable -based vectors uvCreate a mutable vector from a  with an offset and a length.  Modifying data through the $ afterwards is unsafe if the vector 1 could have been frozen before the modification. pointer offset length wYield the underlying & together with the offset to the data 0 and its length. Modifying the data through the  is A unsafe if the vector could have frozen before the modification. xPass a pointer to the vector'(s data to the IO action. Modifying data K through the pointer is unsafe if the vector could have been frozen before  the modification. yHYield a part of the mutable vector without copying it. No bounds checks  are performed. starting index length of the slice zHCreate a mutable vector of the given length. The length is not checked. {@Create a mutable vector of the given length and fill it with an + initial value. The length is not checked. |IYield the element at the given position. No bounds checks are performed. }KReplace the element at the given position. No bounds checks are performed. ~JSwap the elements at the given positions. No bounds checks are performed. ECopy a vector. The two vectors must have the same length and may not  overlap. This is not checked. target source BGrow a vector by the given number of elements. The number must be # positive but this is not checked. Length of the mutable vector. 7Yield a part of the mutable vector without copying it. -Create a mutable vector of the given length. @Create a mutable vector of the given length and fill it with an  initial value. )Yield the element at the given position. +Replace the element at the given position. *Swap the elements at the given positions. GReset all elements of the vector to some undefined value, clearing all N references to external objects. This is usually a noop for unboxed vectors. 3Set all elements of the vector to the given value. ECopy a vector. The two vectors must have the same length and may not  overlap. BGrow a vector by the given number of elements. The number must be  positive. rstuvwxyz{|}~tusryz{|}~vwxrstuuvwxyz{|}~  non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>-based vectors O(1)! Yield the length of the vector. O(1) Test whether a vector if empty O(1) Indexing O(1) First element O(1) Last element O(1)) Unsafe indexing without bounds checking O(1)7 First element without checking if the vector is empty O(1)6 Last element without checking if the vector is empty O(1) Indexing in a monad. GThe monad allows operations to be strict in the vector when necessary. 2 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 0, copying can be implemented like this instead:   copy mv v = ... do # x <- indexM v i  write mv i x Here, 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)> First element in a monad without checking for empty vectors.  See + for an explanation of why this is useful. O(1)= Last element in a monad without checking for empty vectors.  See + for an explanation of why this is useful. O(1)A Yield a slice of the vector without copying it. The vector must  contain at least i+n elements. i starting index n length O(1)D Yield all but the last element without copying. The vector may not  be empty. O(1)E 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 n2 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 n5 elements in which case an empty vector is returned. O(1)> Yield a slice of the vector without copying. The vector must  contain at least i+n# elements but this is not checked. i starting index n length O(1)D Yield all but the last element without copying. The vector may not # be empty but this is not checked. O(1)E 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 element O(n)A Vector of the given length with the same value in each position O(n)D Construct a vector of the given length by applying the function to  each index O(n)B 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. = unfoldr (\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 A 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): Yield a vector of the given length containing the values x, x+1 4 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:A 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:A This operation can be very inefficient. If at all possible, use   instead. O(n) Prepend an element O(n) Append an element O(m+n) Concatenate two vectors O(n)D Execute the monadic action the given number of times and store the  results in a vector. <Execute the monadic action and freeze the resulting vector.   create (do { v <- new 2; write v 0 'a' ; write v 1 'b' }) = <a,b> O(n)A Yield the argument but force it not to retain any extra memory,  possibly by copying it. AThis is especially useful when dealing with slices. For example:  ! force (slice 0 2 <huge vector>) KHere, the slice retains a reference to the huge vector. Forcing it creates J 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)# 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> initial vector (of length m)  list of index/value pairs (of length n) O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value a3 from the value vector, replace the element of the  initial vector at position i by a. 0 update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> initial vector (of length m) index vector (of length n1) value vector (of length n2)  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. A accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m)  list of index/value pairs (of length n) O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value b from the the value vector, . replace the element of the initial vector at  position i by f a b. A accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m) index vector (of length n1) value vector (of length n2) 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. 5 backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a> Same as  but without bounds checking. AApply a destructive operation to a vector. The operation will be I 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 :Map a function over a vector and concatenate the results. O(n)D Apply the monadic action to all elements of the vector, yielding a  vector of results O(n)E Apply the monadic action to all elements of a vector and ignore the  results O(n)D Apply the monadic action to all elements of the vector, yielding a ! vector of results. Equvalent to flip . O(n)E 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))5 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))9 Zip the two vectors with the monadic action and yield a  vector of results  O(min(m,n))< Zip the two vectors with the monadic action and ignore the  results O(n)1 Drop elements that do not satisfy the predicate O(n)E Drop elements that do not satisfy the predicate which is applied to  values and their indices O(n)9 Drop elements that do not satisfy the monadic predicate O(n)? Yield the longest prefix of elements satisfying the predicate  without copying. O(n)@ 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 F elements that satisfy the predicate and the second one those that don't. The H 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 F elements that satisfy the predicate and the second one those that don't. G The order of the elements is not preserved but the operation is often  faster than . O(n)C Split the vector into the longest prefix of elements that satisfy - the predicate and the rest without copying. O(n)B Split the vector into the longest prefix of elements that do not 5 satisfy the predicate and the rest without copying. O(n)) Check if the vector contains an element O(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 7 the index of the first element matching the predicate  or  if no such element exists. O(n)E 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  C if the vector does not contain the element. This is a specialised  version of . O(n)= Yield the indices of all occurences of the given element in 3 ascending order. This is a specialised version of . O(n) Left fold O(n) Left fold on non-empty vectors O(n)# Left fold with strict accumulator O(n)8 Left fold on non-empty vectors with strict accumulator O(n) Right fold O(n)! Right fold on non-empty vectors O(n)& Right fold with a strict accumulator O(n)9 Right fold on non-empty vectors with strict accumulator O(n)< Left fold (function applied to each element and its index) O(n)E 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)> 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  O(n) Check if any element is  O(n)! Compute the sum of the elements O(n)% Compute the produce of the elements O(n)@ Yield the maximum element of the vector. The vector may not be  empty. O(n)@ Yield the maximum element of the vector according to the given 3 comparison function. The vector may not be empty. O(n)@ Yield the minimum element of the vector. The vector may not be  empty. O(n)@ Yield the minimum element of the vector according to the given 3 comparison function. The vector may not be empty. O(n)B Yield the index of the maximum element of the vector. The vector  may not be empty. O(n)C Yield the index of the maximum element of the vector according to = the given comparison function. The vector may not be empty. O(n)B Yield the index of the minimum element of the vector. The vector  may not be empty. O(n)C 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 fold O(n)% Monadic fold over non-empty vectors O(n)& Monadic fold with strict accumulator O(n); Monad fold over non-empty vectors with strict accumulator 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  ) scanl 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 # scanl f <x1,...,xn> = <y1,...,yn>  where y1 = x1  yi = f y(i-1) xi  O(n)8 Scan over a non-empty vector with a strict accumulator  O(n) Right-to-left prescan   prescanr f z =  .  (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 scan O(n): Right-to-left Haskell-style scan with strict accumulator O(n), Right-to-left scan over a non-empty vector O(n): Right-to-left scan over a non-empty vector with a strict  accumulator O(n) Convert a vector to a list O(n) Convert a list to a vector O(n) Convert the first n elements of a list to a vector   fromListN n xs =  ( n xs) O(n)C Copy an immutable vector into a mutable one. The two vectors must  have the same length. O(n)C Copy an immutable vector into a mutable one. The two vectors must , have the same length. This is not checked. O(1) Create a vector from a  with an offset and a length. * The data may not be modified through the  afterwards. pointer offset length O(1) Yield the underlying ! together with the offset to the ? data and its length. The data may not be modified through the . Pass a pointer to the vector'-s data to the IO action. The data may not be  modified through the 'Ptr. tu     tu           non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>/ non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au> O(1)! Yield the length of the vector. !O(1) Test whether a vector if empty "O(1) Indexing #O(1) First element $O(1) Last element %O(1)) Unsafe indexing without bounds checking &O(1)7 First element without checking if the vector is empty 'O(1)6 Last element without checking if the vector is empty (O(1) Indexing in a monad. GThe monad allows operations to be strict in the vector when necessary. 2 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 (0, copying can be implemented like this instead:   copy mv v = ... do # x <- indexM v i  write mv i x Here, 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)> First element in a monad without checking for empty vectors.  See (+ for an explanation of why this is useful. -O(1)= Last element in a monad without checking for empty vectors.  See (+ for an explanation of why this is useful. .O(1)A Yield a slice of the vector without copying it. The vector must  contain at least i+n elements. i starting index n length /O(1)D Yield all but the last element without copying. The vector may not  be empty. 0O(1)E 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 n2 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 n5 elements in which case an empty vector is returned. 3O(1)> Yield a slice of the vector without copying. The vector must  contain at least i+n# elements but this is not checked. i starting index n length 4O(1)D Yield all but the last element without copying. The vector may not # be empty but this is not checked. 5O(1)E Yield all but the first element without copying. The vector may not # be empty but this is not checked. 6O(1) Yield the first n+ elements without copying. The vector must  contain at least n# elements but this is not checked. 7O(1) Yield all but the first n& elements without copying. The vector  must contain at least n# elements but this is not checked. 8O(1) Empty vector 9O(1)! Vector with exactly one element :O(n)A Vector of the given length with the same value in each position ;O(n)D Construct a vector of the given length by applying the function to  each index <O(n)B 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. = unfoldr (\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 A 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): Yield a vector of the given length containing the values x, x+1 4 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 A. - enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4> @O(n) Enumerate values from x to y. WARNING:A This operation can be very inefficient. If at all possible, use  > instead. AO(n) Enumerate values from x to y with a specific step z. WARNING:A This operation can be very inefficient. If at all possible, use  ? instead. BO(n) Prepend an element CO(n) Append an element DO(m+n) Concatenate two vectors EO(n)D Execute the monadic action the given number of times and store the  results in a vector. F<Execute the monadic action and freeze the resulting vector.   create (do { v <- new 2; write v 0 'a' ; write v 1 'b' }) = <a,b> GO(n)A Yield the argument but force it not to retain any extra memory,  possibly by copying it. AThis is especially useful when dealing with slices. For example:  ! force (slice 0 2 <huge vector>) KHere, the slice retains a reference to the huge vector. Forcing it creates J a copy of just the elements that belong to the slice and allows the huge ! vector to be garbage collected. HO(m+n) For each pair (i,a)# 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> initial vector (of length m)  list of index/value pairs (of length n) IO(m+n) For each pair (i,a) from the vector of index/ value pairs, ( replace the vector element at position i by a. 2 update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7> initial vector (of length m) vector of index/value pairs (of length n) JO(m+min(n1,n2)) For each index i from the index vector and the  corresponding value a3 from the value vector, replace the element of the  initial vector at position i by a.  0 update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>  The function I5 provides the same functionality and is usually more  convenient.   update_ xs is ys = I xs ( is ys) initial vector (of length m) index vector (of length n1) value vector (of length n2) K Same as (H) but without bounds checking. LSame as I but without bounds checking. MSame as J but without bounds checking. NO(m+n) For each pair (i,b)+ from the list, replace the vector element  a at position i by f a b. A accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m)  list of index/value pairs (of length n) OO(m+n) For each pair (i,b). from the vector of pairs, replace the vector  element a at position i by f a b. F accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m) vector of index/value pairs (of length n) PO(m+min(n1,n2)) For each index i from the index vector and the  corresponding value b from the the value vector, . replace the element of the initial vector at  position i by f a b.  A accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>  The function O5 provides the same functionality and is usually more  convenient.   accumulate_ f as is bs = O f as ( is bs) accumulating function f initial vector (of length m) index vector (of length n1) value vector (of length n2) QSame as N but without bounds checking. RSame as O but without bounds checking. SSame as P but without bounds checking. TO(n) Reverse a vector UO(n)5 Yield the vector obtained by replacing each element i of the  index vector by xs"i. This is equivalent to X (xs") is but is  often much more efficient. 5 backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a> VSame as U but without bounds checking. WAApply a destructive operation to a vector. The operation will be I 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'> XO(n) Map a function over a vector YO(n)= Apply a function to every element of a vector and its index Z:Map a function over a vector and concatenate the results. [O(n)D Apply the monadic action to all elements of the vector, yielding a  vector of results \O(n)E Apply the monadic action to all elements of a vector and ignore the  results ]O(n)D Apply the monadic action to all elements of the vector, yielding a ! vector of results. Equvalent to flip [. ^O(n)E 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. abcd O(min(m,n))5 Zip two vectors with a function that also takes the  elements' indices. e=Zip three vectors and their indices with the given function. fghi O(min(m,n))9 Zip the two vectors with the monadic action and yield a  vector of results j O(min(m,n))< Zip the two vectors with the monadic action and ignore the  results kO(n)1 Drop elements that do not satisfy the predicate lO(n)E Drop elements that do not satisfy the predicate which is applied to  values and their indices mO(n)9 Drop elements that do not satisfy the monadic predicate nO(n)? Yield the longest prefix of elements satisfying the predicate  without copying. oO(n)@ Drop the longest prefix of elements that satisfy the predicate  without copying. pO(n)? Split the vector in two parts, the first one containing those F elements that satisfy the predicate and the second one those that don't. The H relative order of the elements is preserved at the cost of a sometimes ! reduced performance compared to q. qO(n)? Split the vector in two parts, the first one containing those F elements that satisfy the predicate and the second one those that don't. G The order of the elements is not preserved but the operation is often  faster than p. rO(n)C Split the vector into the longest prefix of elements that satisfy - the predicate and the rest without copying. sO(n)B Split the vector into the longest prefix of elements that do not 5 satisfy the predicate and the rest without copying. tO(n)) Check if the vector contains an element uO(n)= Check if the vector does not contain an element (inverse of t) vO(n) Yield - the first element matching the predicate or   if no such element exists. wO(n) Yield 7 the index of the first element matching the predicate  or  if no such element exists. xO(n)E Yield the indices of elements satisfying the predicate in ascending  order. yO(n) Yield : the index of the first occurence of the given element or  C if the vector does not contain the element. This is a specialised  version of w. zO(n)= Yield the indices of all occurences of the given element in 3 ascending order. This is a specialised version of x. {O(n) Left fold |O(n) Left fold on non-empty vectors }O(n)# Left fold with strict accumulator ~O(n)8 Left fold on non-empty vectors with strict accumulator O(n) Right fold O(n)! Right fold on non-empty vectors O(n)& Right fold with a strict accumulator O(n)9 Right fold on non-empty vectors with strict accumulator O(n)< Left fold (function applied to each element and its index) O(n)E 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)> 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  O(n) Check if any element is  O(n)! Compute the sum of the elements O(n)% Compute the produce of the elements O(n)@ Yield the maximum element of the vector. The vector may not be  empty. O(n)@ Yield the maximum element of the vector according to the given 3 comparison function. The vector may not be empty. O(n)@ Yield the minimum element of the vector. The vector may not be  empty. O(n)@ Yield the minimum element of the vector according to the given 3 comparison function. The vector may not be empty. O(n)B Yield the index of the maximum element of the vector. The vector  may not be empty. O(n)C Yield the index of the maximum element of the vector according to = the given comparison function. The vector may not be empty. O(n)B Yield the index of the minimum element of the vector. The vector  may not be empty. O(n)C 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 fold O(n)% Monadic fold over non-empty vectors O(n)& Monadic fold with strict accumulator O(n); Monad fold over non-empty vectors with strict accumulator 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 = 0 .  f z  Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10> O(n) Scan with strict accumulator O(n) Haskell-style scan  ) scanl 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 # scanl f <x1,...,xn> = <y1,...,yn>  where y1 = x1  yi = f y(i-1) xi O(n)8 Scan over a non-empty vector with a strict accumulator O(n) Right-to-left prescan   prescanr f z = T .  (flip f) z . T 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 scan O(n): Right-to-left Haskell-style scan with strict accumulator O(n), Right-to-left scan over a non-empty vector O(n): Right-to-left scan over a non-empty vector with a strict  accumulator O(n) Convert a vector to a list O(n) Convert a list to a vector O(n) Convert the first n elements of a list to a vector   fromListN n xs =  (1 n xs) O(n)C Copy an immutable vector into a mutable one. The two vectors must  have the same length. O(n)C Copy an immutable vector into a mutable one. The two vectors must , have the same length. This is not checked. O(1) Zip 2 vectors O(1) Unzip 2 vectors O(1) Zip 3 vectors O(1) Unzip 3 vectors O(1) Zip 4 vectors O(1) Unzip 4 vectors O(1) Zip 5 vectors O(1) Unzip 5 vectors O(1) Zip 6 vectors O(1) Unzip 6 vectors  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;EF<=>?@ABCDGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>HYield a part of the mutable vector without copying it. No bounds checks  are performed. starting index length of the slice HCreate a mutable vector of the given length. The length is not checked. @Create a mutable vector of the given length and fill it with an + initial value. The length is not checked. IYield the element at the given position. No bounds checks are performed. KReplace the element at the given position. No bounds checks are performed. JSwap the elements at the given positions. No bounds checks are performed. ECopy a vector. The two vectors must have the same length and may not  overlap. This is not checked. target source BGrow a vector by the given number of elements. The number must be # positive but this is not checked. Length of the mutable vector. 7Yield a part of the mutable vector without copying it. -Create a mutable vector of the given length. @Create a mutable vector of the given length and fill it with an  initial value. )Yield the element at the given position. +Replace the element at the given position. *Swap the elements at the given positions. GReset all elements of the vector to some undefined value, clearing all N references to external objects. This is usually a noop for unboxed vectors. 3Set all elements of the vector to the given value. ECopy a vector. The two vectors must have the same length and may not  overlap. BGrow a vector by the given number of elements. The number must be  positive. O(1) Zip 2 vectors O(1) Unzip 2 vectors O(1) Zip 3 vectors O(1) Unzip 3 vectors O(1) Zip 4 vectors O(1) Unzip 4 vectors O(1) Zip 5 vectors O(1) Unzip 5 vectors O(1) Zip 6 vectors O(1) Unzip 6 vectors 7" non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>7Mutable boxed vectors keyed on the monad they live in ( or ST s). HYield a part of the mutable vector without copying it. No bounds checks  are performed. starting index length of the slice HCreate a mutable vector of the given length. The length is not checked. @Create a mutable vector of the given length and fill it with an + initial value. The length is not checked. IYield the element at the given position. No bounds checks are performed. KReplace the element at the given position. No bounds checks are performed. JSwap the elements at the given positions. No bounds checks are performed. ECopy a vector. The two vectors must have the same length and may not  overlap. This is not checked. target source BGrow a vector by the given number of elements. The number must be # positive but this is not checked. Length of the mutable vector. 7Yield a part of the mutable vector without copying it. -Create a mutable vector of the given length. @Create a mutable vector of the given length and fill it with an  initial value. )Yield the element at the given position. +Replace the element at the given position. *Swap the elements at the given positions. GReset all elements of the vector to some undefined value, clearing all N references to external objects. This is usually a noop for unboxed vectors. 3Set all elements of the vector to the given value. ECopy a vector. The two vectors must have the same length and may not  overlap. BGrow a vector by the given number of elements. The number must be  positive.  non-portable experimental'Roman Leshchinskiy <rl@cse.unsw.edu.au>-Boxed vectors, supporting efficient slicing. O(1)! Yield the length of the vector. O(1) Test whether a vector if empty O(1) Indexing O(1) First element O(1) Last element O(1)) Unsafe indexing without bounds checking O(1)7 First element without checking if the vector is empty O(1)6 Last element without checking if the vector is empty O(1) Indexing in a monad. GThe monad allows operations to be strict in the vector when necessary. 2 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 0, copying can be implemented like this instead:   copy mv v = ... do # x <- indexM v i  write mv i x Here, 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)> First element in a monad without checking for empty vectors.  See + for an explanation of why this is useful. O(1)= Last element in a monad without checking for empty vectors.  See + for an explanation of why this is useful. O(1)A Yield a slice of the vector without copying it. The vector must  contain at least i+n elements. i starting index n length O(1)D Yield all but the last element without copying. The vector may not  be empty. O(1)E 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 n2 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 n5 elements in which case an empty vector is returned. O(1)> Yield a slice of the vector without copying. The vector must  contain at least i+n# elements but this is not checked. i starting index n length O(1)D Yield all but the last element without copying. The vector may not # be empty but this is not checked. O(1)E 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 element O(n)A Vector of the given length with the same value in each position  O(n)D Construct a vector of the given length by applying the function to  each index  O(n)B 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. = unfoldr (\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 A 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): Yield a vector of the given length containing the values x, x+1 4 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:A 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:A This operation can be very inefficient. If at all possible, use    instead. O(n) Prepend an element O(n) Append an element O(m+n) Concatenate two vectors O(n)D Execute the monadic action the given number of times and store the  results in a vector. <Execute the monadic action and freeze the resulting vector.   create (do { v <- new 2; write v 0 'a' ; write v 1 'b' }) = <a,b> O(n)A Yield the argument but force it not to retain any extra memory,  possibly by copying it. AThis is especially useful when dealing with slices. For example:  ! force (slice 0 2 <huge vector>) KHere, the slice retains a reference to the huge vector. Forcing it creates J 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)# 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> initial vector (of length m)  list of index/value pairs (of length n) O(m+n) For each pair (i,a) from the vector of index/ value pairs, ( replace the vector element at position i by a. 2 update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7> initial vector (of length m) vector of index/value pairs (of length n) O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value a3 from the value vector, replace the element of the  initial vector at position i by a.  0 update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>  The function 5 provides the same functionality and is usually more  convenient.   update_ xs is ys =  xs (7 is ys) initial vector (of length m) index vector (of length n1) value vector (of length n2)  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. A accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m)  list of index/value pairs (of length n) O(m+n) For each pair (i,b). from the vector of pairs, replace the vector  element a at position i by f a b. F accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4> accumulating function f initial vector (of length m) vector of index/value pairs (of length n) O(m+min(n1,n2)) For each index i from the index vector and the  corresponding value b from the the value vector, . replace the element of the initial vector at  position i by f a b.  A accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>  The function 5 provides the same functionality and is usually more  convenient.   accumulate_ f as is bs =  f as (7 is bs) accumulating function f initial vector (of length m) index vector (of length n1) value vector (of length n2) Same as  but without bounds checking.  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. 5 backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a> $Same as # but without bounds checking. %AApply a destructive operation to a vector. The operation will be I 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 (:Map a function over a vector and concatenate the results. )O(n)D Apply the monadic action to all elements of the vector, yielding a  vector of results *O(n)E Apply the monadic action to all elements of a vector and ignore the  results +O(n)D Apply the monadic action to all elements of the vector, yielding a ! vector of results. Equvalent to flip ). ,O(n)E 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. /012 O(min(m,n))5 Zip two vectors with a function that also takes the  elements' indices. 3=Zip three vectors and their indices with the given function. 4567(Elementwise pairing of array elements. 84zip together three vectors into a vector of triples 9:;< O(min(m,n)) Unzip a vector of pairs. =>?@A O(min(m,n))9 Zip the two vectors with the monadic action and yield a  vector of results B O(min(m,n))< Zip the two vectors with the monadic action and ignore the  results CO(n)1 Drop elements that do not satisfy the predicate DO(n)E Drop elements that do not satisfy the predicate which is applied to  values and their indices EO(n)9 Drop elements that do not satisfy the monadic predicate FO(n)? Yield the longest prefix of elements satisfying the predicate  without copying. GO(n)@ Drop the longest prefix of elements that satisfy the predicate  without copying. HO(n)? Split the vector in two parts, the first one containing those F elements that satisfy the predicate and the second one those that don't. The H relative order of the elements is preserved at the cost of a sometimes ! reduced performance compared to I. IO(n)? Split the vector in two parts, the first one containing those F elements that satisfy the predicate and the second one those that don't. G The order of the elements is not preserved but the operation is often  faster than H. JO(n)C Split the vector into the longest prefix of elements that satisfy - the predicate and the rest without copying. KO(n)B Split the vector into the longest prefix of elements that do not 5 satisfy the predicate and the rest without copying. LO(n)) Check if the vector contains an element MO(n)= Check if the vector does not contain an element (inverse of L) NO(n) Yield - the first element matching the predicate or   if no such element exists. OO(n) Yield 7 the index of the first element matching the predicate  or  if no such element exists. PO(n)E Yield the indices of elements satisfying the predicate in ascending  order. QO(n) Yield : the index of the first occurence of the given element or  C if the vector does not contain the element. This is a specialised  version of O. RO(n)= Yield the indices of all occurences of the given element in 3 ascending order. This is a specialised version of P. SO(n) Left fold TO(n) Left fold on non-empty vectors UO(n)# Left fold with strict accumulator VO(n)8 Left fold on non-empty vectors with strict accumulator WO(n) Right fold XO(n)! Right fold on non-empty vectors YO(n)& Right fold with a strict accumulator ZO(n)9 Right fold on non-empty vectors with strict accumulator [O(n)< Left fold (function applied to each element and its index) \O(n)E 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)> 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. aO(n) Check if all elements are  bO(n) Check if any element is  cO(n)! Compute the sum of the elements dO(n)% Compute the produce of the elements eO(n)@ Yield the maximum element of the vector. The vector may not be  empty. fO(n)@ Yield the maximum element of the vector according to the given 3 comparison function. The vector may not be empty. gO(n)@ Yield the minimum element of the vector. The vector may not be  empty. hO(n)@ Yield the minimum element of the vector according to the given 3 comparison function. The vector may not be empty. iO(n)B Yield the index of the maximum element of the vector. The vector  may not be empty. jO(n)C Yield the index of the maximum element of the vector according to = the given comparison function. The vector may not be empty. kO(n)B Yield the index of the minimum element of the vector. The vector  may not be empty. lO(n)C Yield the index of the minimum element of the vector according to = the given comparison function. The vector may not be empty. mO(n) Monadic fold nO(n)% Monadic fold over non-empty vectors oO(n)& Monadic fold with strict accumulator pO(n); Monad fold over non-empty vectors with strict accumulator qO(n) Prescan    prescanl f z =  . u f z  Example: prescanl (+) 0 <1,2,3,4> = <0,1,3,6> rO(n)! Prescan with strict accumulator sO(n) Scan    postscanl f z =  . u f z  Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10> tO(n) Scan with strict accumulator uO(n) Haskell-style scan  ) scanl 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> vO(n), Haskell-style scan with strict accumulator wO(n) Scan over a non-empty vector # scanl f <x1,...,xn> = <y1,...,yn>  where y1 = x1  yi = f y(i-1) xi xO(n)8 Scan over a non-empty vector with a strict accumulator yO(n) Right-to-left prescan   prescanr f z = " . q (flip f) z . " zO(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 scan ~O(n): Right-to-left Haskell-style scan with strict accumulator O(n), Right-to-left scan over a non-empty vector O(n): Right-to-left scan over a non-empty vector with a strict  accumulator O(n) Convert a vector to a list O(n) Convert a list to a vector O(n) Convert the first n elements of a list to a vector   fromListN n xs =  ( n xs) O(n)C Copy an immutable vector into a mutable one. The two vectors must  have the same length. O(n)C Copy an immutable vector into a mutable one. The two vectors must , have the same length. This is not checked.       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;AB<=>?@CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghklijmonpqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./01234556789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~5:;<=>?@BDEFGHIJKLMNOSTU\]^_`abcdefhjlmnprux{~PQVWgtwz}  < J M N K L    J K L M N < = G H J K L M N > ? @ B D E F A O P Q \ ] ^ _ `  a b c d e V W      f  g h j    l m n p    r u x { ~                   t w z }   ! " # $ % & ' ( ) * + ,-.<J  < = G H J K L M N > ? @ B D E F A O P Q \ ] ^ _ `  V W f  g h j    l m n p    r u x { ~                   t w z }   ! " # $ % & -./01<J  < = G H J K L M N > ? @ B D E F A O P Q \ ] ^ _ `  V W f  g h j    l m n p    r u x { ~                   t w z }   ! " # $ % & / 0 12-.<=GHJKLMN>?@BDEFAOPQ\]^_`VWfghj lmnp   rux{~ twz} !"#$%&abcde<Jabcde-.<J<=GHJKLMN>?@BDEFAOPQ\]^_`abcdeVWfghj lmnp   rux{~ twz} !"#$%&3456789:;<=>?@A@BCDCEFGHIJKL M N O P Q R S T = U V W X Y Z [ \ ] ^ _ ` a b c defg hijik lm nopqrstuvwxyz{|}~evector-0.6.0.1Data.Vector.Storable.MutableData.Vector.Primitive.MutableData.Vector.Storable.InternalData.Vector.Fusion.UtilData.Vector.Fusion.Stream.SizeData.Vector.Internal.Check!Data.Vector.Fusion.Stream.MonadicData.Vector.Fusion.StreamData.Vector.Generic.MutableData.Vector.GenericData.Vector.Generic.NewData.Vector.PrimitiveData.Vector.StorableData.Vector.UnboxedData.Vector.Unboxed.MutableData.Vector.Mutable Data.VectorData.Vector.Generic.BaseData.Vector.Unboxed.BasebaseForeign.StorableStorable primitive-0.3Data.Primitive.TypesPrim ptrToOffset offsetToPtrBoxunBoxIdunId delay_inlineSizeUnknownMaxExactsmallerlargertoMax upperBoundChecksInternalUnsafeBoundsdoCheckserror emptyStreamcheckassert checkIndex checkLength checkSliceStreamStepDoneSkipYieldsizesizedlengthnullempty singleton replicate replicateMgenerate generateMconssnoc++headlast!!sliceinittailtakedropmapmapMmapM_transunboxindexedindexedRzipWithM zipWithM_ zipWith3M zipWith4M zipWith5M zipWith6MzipWithzipWith3zipWith4zipWith5zipWith6zipzip3zip4zip5zip6filterfilterM takeWhile takeWhileM dropWhile dropWhileMelemnotElemfindfindM findIndex findIndexMfoldlfoldlMfoldMfoldl1foldl1Mfold1Mfoldl'foldlM'foldM'foldl1'foldl1M'fold1M'foldrfoldrMfoldr1foldr1Mandor concatMap concatMapMunfoldrunfoldrMunfoldrN unfoldrNMprescanl prescanlM prescanl' prescanlM' postscanl postscanlM postscanl' postscanlM'scanlscanlMscanl'scanlM'scanl1scanl1Mscanl1'scanl1M' enumFromStepN enumFromToenumFromThenTotoListfromList fromListNunsafeFromListMStreaminplace liftStreameqcmpMVector basicLengthbasicUnsafeSlice basicOverlapsbasicUnsafeNewbasicUnsafeNewWithbasicUnsafeReadbasicUnsafeWrite basicClearbasicSetbasicUnsafeCopybasicUnsafeGrowoverlapsfill transformfillR transformRunstream munstream unstreamR munstreamRnewnewWith unsafeNew unsafeNewWithgrow unsafeGrowreadwriteswap unsafeRead unsafeWrite unsafeSwapclearsetcopy unsafeCopy unsafeSlice unsafeInit unsafeTailaccumupdate unsafeAccum unsafeUpdatereverseunstablePartitionunstablePartitionStreampartitionStreamVector unsafeFreezebasicUnsafeIndexMelemseqMutableNewcreaterunapplymodifymodifyWithStream! unsafeIndex unsafeHead unsafeLastindexMheadMlastM unsafeIndexM unsafeHeadM unsafeLastM unsafeTake unsafeDrop enumFromNforce//update_ unsafeUpd unsafeUpdate_ accumulate accumulate_unsafeAccumulateunsafeAccumulate_ backpermuteunsafeBackpermuteimapforMforM_izipWith izipWith3 izipWith4 izipWith5 izipWith6unzipunzip3unzip4unzip5unzip6ifilter partitionspanbreak findIndices elemIndex elemIndicesfoldr'foldr1'ifoldlifoldl'ifoldrifoldr'allanysumproductmaximum maximumByminimum minimumBymaxIndex maxIndexByminIndex minIndexByprescanr prescanr' postscanr postscanr'scanrscanr'scanr1scanr1'streamstreamRclonegfoldlmkTypedataCastSTVectorIOVectorunsafeFromForeignPtrunsafeToForeignPtr unsafeWithUnboxdistance lowerBounddoBoundsChecksdoUnsafeChecksdoInternalChecks assert_msgcheckIndex_msgcheckLength_msgcheckSlice_msg DropWhileDropWhile_NextDropWhile_YieldDropWhile_DropSPECSPEC2consume Data.MaybeJustNothingenumFromTo_smallenumFromTo_intenumFromTo_big_wordenumFromTo_big_intenumFromTo_charenumFromTo_doubletoListFB unsafeAppend1unsafePrepend1mstreammstreamR munstreamMaxmunstreamUnknown munstreamRMaxmunstreamRUnknown growFrontenlarge enlargeFrontunsafeGrowFrontexchangeunsafeExchangeunstablePartitionMax partitionMaxpartitionUnknown update_streamunsafeUpdate_stream accum_streamunsafeAccum_streampartition_streamunstablePartition_streamunstablePartition_newghc-primGHC.BoolTrue unstreamM GHC.ClassesEqOrdGHC.ForeignPtr ForeignPtrvectorTyfromBooltoBoolV_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_Unit GHC.TypesIO uninitialised