Copyright | Copyright (c) 2009-2013, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Tested with: GHC 7.8.3
An imperative vector.
- data Vector a
- newVector :: IO (Vector a)
- copyVector :: Vector a -> IO (Vector a)
- vectorCount :: Vector a -> IO Int
- appendVector :: Vector a -> a -> IO ()
- readVector :: Vector a -> Int -> IO a
- writeVector :: Vector a -> Int -> a -> IO ()
- vectorBinarySearch :: Ord a => Vector a -> a -> IO Int
- vectorInsert :: Vector a -> Int -> a -> IO ()
- vectorDeleteAt :: Vector a -> Int -> IO ()
- vectorIndex :: Eq a => Vector a -> a -> IO Int
- freezeVector :: Vector a -> IO (Array Int a)
Documentation
Represents a resizable vector.
copyVector :: Vector a -> IO (Vector a) Source
Copy the vector.
vectorCount :: Vector a -> IO Int Source
Return the element count.
appendVector :: Vector a -> a -> IO () Source
Add the specified element to the end of the vector.
readVector :: Vector a -> Int -> IO a Source
Read a value from the vector, where indices are started from 0.
writeVector :: Vector a -> Int -> a -> IO () Source
Set an array item at the specified index which is started from 0.
vectorBinarySearch :: Ord a => Vector a -> a -> IO Int Source
Return the index of the specified element using binary search; otherwise, a negated insertion index minus one: 0 -> -0 - 1, ..., i -> -i - 1, ....
vectorInsert :: Vector a -> Int -> a -> IO () Source
Insert the element in the vector at the specified index.
vectorDeleteAt :: Vector a -> Int -> IO () Source
Delete the element at the specified index.