Copyright | (c) 2021 Xy Ren |
---|---|
License | BSD3 |
Maintainer | xy.r@outlook.com |
Stability | unstable |
Portability | non-portable (GHC only) |
Safe Haskell | None |
Language | Haskell2010 |
This module contains an efficient vector datatype that is implemented as a radix tree.
This is an internal module and its API may change even between minor versions. Therefore you should be extra careful if you're to depend on this module.
Documentation
An efficient vector type, implemented as a radix tree. It has the following time complexities:
- Lookup: \( O(\log n) \)
- Update: \( O(\log n) \)
- Append: \( O(\log n) \)
The branching factor (base of log) is 32 therefore the time is close to constant in most cases. Note that in practice, lookup is faster than update, and update is faster than append.
lookup :: Int -> Vec a -> a Source #
Lookup in a Vec
by an index. This does not perform any bounds check.