toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Slide

Description

Sliding window data structures. See also SlideMin.

Typical Problems

Synopsis

Documentation

data StackSlidingFold s a #

Stack-based sliding window folding, going from left to right only. SWAG (sliding window aggregation).

Constructors

StackSlidingFold 

Fields

newSSF :: (PrimMonad m, Monoid a, Unbox a) => Int -> m (StackSlidingFold (PrimState m) a) #

\(O(N)\)

clearSSF :: (PrimMonad m, Monoid a, Unbox a) => StackSlidingFold (PrimState m) a -> m () #

\(O(1)\)

pushBackSSF :: (PrimMonad m, Semigroup a, Unbox a) => StackSlidingFold (PrimState m) a -> a -> m () #

\(O(1)\)

popFrontSSF :: (PrimMonad m, Monoid a, Unbox a) => StackSlidingFold (PrimState m) a -> m () #

Amortised \(O(1)\).

foldSSF :: (PrimMonad m, Semigroup a, Unbox a) => StackSlidingFold (PrimState m) a -> m a #

\(O(1)\)

data DequeSlidingFold s a #

Dequeue-based sliding window folding. Prefer StackSlidingFold for speed. SWAG (sliding window aggregation).

Constructors

DequeSlidingFold 

Fields

newDSF :: (PrimMonad m, Monoid a, Unbox a) => Int -> m (DequeSlidingFold (PrimState m) a) #

\(O(N)\)

clearDSF :: (PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #

\(O(1)\)

pushFrontDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> a -> m () #

\(O(1)\)

pushBackDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> a -> m () #

\(O(1)\)

popFrontDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #

Amortised \(O(1)\).

popBackDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #

Amortised \(O(1)\).

balanceDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #

\(O(N)\)