SegmentTree-0.1: Data structure for O(log n) mconcats on list intervals

Data.SegmentTree.Examples

Contents

Description

Example uses of SegmentTrees.

Synopsis

Sum Monoid

intervalSum :: SegmentTree (Sum Int) -> (Int, Int) -> IntSource

Find the sum of the elements in the interval [l, u].

Any Monoid

intervalAny :: SegmentTree Any -> (Int, Int) -> BoolSource

Find out if any of the elements are True in the interval [l, u].

GCD Monoid

newtype Integral a => GCD a Source

Constructors

GCD 

Fields

getGCD :: a
 

Instances

Integral a => Monoid (GCD a) 

intervalGCD :: SegmentTree (GCD Int) -> (Int, Int) -> IntSource

Find the greatest common divisor of the elements in the interval [l, u].

String Monoid

intervalConcat :: SegmentTree String -> (Int, Int) -> StringSource

Concatenate the strings in the interval [l, u].

Unwords Monoid

newtype Unwords Source

Constructors

Unwords 

Fields

getUnwords :: String
 

Instances

intervalUnwords :: SegmentTree Unwords -> (Int, Int) -> StringSource

Unwords the words in the interval [l, u].