| Copyright | (c) Erich Gut |
|---|---|
| License | BSD3 |
| Maintainer | zerich.gut@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
OAlg.Entity.Sequence.PSequence
Contents
Description
partially defined sequences of items in x with a totally ordered index type i.
Synopsis
- newtype PSequence i x = PSequence [(x, i)]
- psqxs :: PSequence i x -> [(x, i)]
- iProxy :: s i x -> Proxy i
- psqSpan :: Ord i => PSequence i x -> Span i
- psqEmpty :: PSequence i x
- psqIsEmpty :: PSequence i x -> Bool
- psequence :: Ord i => (x -> x -> x) -> [(x, i)] -> PSequence i x
- psqHead :: PSequence i x -> (x, i)
- psqTail :: PSequence i x -> PSequence i x
- psqMap :: (x -> y) -> PSequence i x -> PSequence i y
- psqMapShift :: Number i => i -> ((x, i) -> y) -> PSequence i x -> PSequence i y
- psqMapWithIndex :: Monotone i j -> ((x, i) -> y) -> PSequence i x -> PSequence j y
- newtype Monotone i j = Monotone (i -> j)
- psqFilter :: (x -> Bool) -> PSequence i x -> PSequence i x
- psqSplitWhile :: ((x, i) -> Bool) -> PSequence i x -> (PSequence i x, PSequence i x)
- psqInterlace :: Ord i => (x -> y -> z) -> (x -> z) -> (y -> z) -> PSequence i x -> PSequence i y -> PSequence i z
- psqCompose :: (Ord i, Ord j) => PSequence i x -> PSequence j i -> PSequence j x
- psqAppend :: PSequence i x -> PSequence i x -> PSequence i x
- psqShear :: Ord i => (Maybe a -> Maybe a -> Maybe a, i) -> (Maybe a -> Maybe a -> Maybe a, i) -> PSequence i a -> PSequence i a
- psqSwap :: Ord i => i -> i -> PSequence i a -> PSequence i a
- psqTree :: PSequence i x -> PTree i x
- psqFromTree :: PTree i x -> PSequence i x
- newtype PTree i x = PTree (Maybe (Tree i (x, i)))
- ptrxs :: PTree i x -> [(x, i)]
- ptrx :: Ord i => PTree i x -> i -> Maybe x
- ptrEmpty :: PTree i x
- ptrMax :: PTree i x -> Closure i
- ptrMin :: PTree i x -> Closure i
- ptrSpan :: PTree i x -> Span i
- ptrFilter :: (x -> Bool) -> PTree i x -> PTree i x
- ptrFilterWithIndex :: ((x, i) -> Bool) -> PTree i x -> PTree i x
- ptrMap :: (x -> y) -> PTree i x -> PTree i y
- ptrMapShift :: Number i => i -> ((x, i) -> y) -> PTree i x -> PTree i y
- ptrMapWithIndex :: Monotone i j -> ((x, i) -> y) -> PTree i x -> PTree j y
- xPSequence :: Ord i => N -> N -> X x -> X i -> X (PSequence i x)
- prpPSequence :: Statement
- prpPTreeFilter :: N -> Statement
Sequence
newtype PSequence i x Source #
partially defined sequences (x0,i0),(x1,i1).. of index items in x with a
totally ordered index type i.
Property Let be in PSequence xis then holds:
PSequence i xi for all < j..(_,i) in :(_,j)..xis.
Examples
>>>PSequence [('a',3),('b',7),('c',12)] :: PSequence N CharPSequence [('a',3),('b',7),('c',12)]
and
>>>validate (valid (PSequence [('a',3),('b',7),('c',12)] :: PSequence N Char))Valid
but
>>>validate (valid (PSequence [('a',3),('b',15),('c',12)] :: PSequence N Char))Invalid
as Char is a totally ordered type it can serve as index type
>>>validate (valid (PSequence [(12,'c'),(3,'e'),(8,'x')] :: PSequence Char Z))Valid
and they admit a total right operation <* of
Permutation i
>>>(PSequence [(12,'c'),(3,'e'),(8,'x')] :: PSequence Char Z) <* pmtSwap 'e' 'x'PSequence [(12,'c'),(8,'e'),(3,'x')]
Note As we keep the constructor public, it is crucial for there further use to
ensure that they are valid!
Constructors
| PSequence [(x, i)] |
Instances
psqIsEmpty :: PSequence i x -> Bool Source #
checks of being empty.
psequence :: Ord i => (x -> x -> x) -> [(x, i)] -> PSequence i x Source #
the partial sequenc given by a aggregation function an a list of value index pairs, which will be sorted and accordingly aggregated by thegiven aggregation function.
psqMap :: (x -> y) -> PSequence i x -> PSequence i y Source #
maps the entries, where the indices are preserved.
psqMapShift :: Number i => i -> ((x, i) -> y) -> PSequence i x -> PSequence i y Source #
shifts the indices of a partial sequence.
psqMapWithIndex :: Monotone i j -> ((x, i) -> y) -> PSequence i x -> PSequence j y Source #
maps of a PSequence according to the given strict monotone mapping and the given indexed
mapping.
predicate for strict monoton mappings.
Property Let _i__, j two Ord-types, and in Monotone f, then
holds: For all Monotone i jx, y in i holds: . compare (f x) (f y) == compare x y
Constructors
| Monotone (i -> j) |
psqFilter :: (x -> Bool) -> PSequence i x -> PSequence i x Source #
filters the partially defiend sequence accordingly the given predicate.
psqSplitWhile :: ((x, i) -> Bool) -> PSequence i x -> (PSequence i x, PSequence i x) Source #
splits the sequence as long as the given predicate holds.
psqInterlace :: Ord i => (x -> y -> z) -> (x -> z) -> (y -> z) -> PSequence i x -> PSequence i y -> PSequence i z Source #
interlaces the tow partially defined sequences according to the given mappings.
psqShear :: Ord i => (Maybe a -> Maybe a -> Maybe a, i) -> (Maybe a -> Maybe a -> Maybe a, i) -> PSequence i a -> PSequence i a Source #
psqFromTree :: PTree i x -> PSequence i x Source #
the induced partially sequence.
Tree
binary tree for efficient retrieving elements of a partially defined sequence.
Instances
| Foldable (PTree i) Source # | |
Defined in OAlg.Entity.Sequence.PSequence Methods fold :: Monoid m => PTree i m -> m # foldMap :: Monoid m => (a -> m) -> PTree i a -> m # foldMap' :: Monoid m => (a -> m) -> PTree i a -> m # foldr :: (a -> b -> b) -> b -> PTree i a -> b # foldr' :: (a -> b -> b) -> b -> PTree i a -> b # foldl :: (b -> a -> b) -> b -> PTree i a -> b # foldl' :: (b -> a -> b) -> b -> PTree i a -> b # foldr1 :: (a -> a -> a) -> PTree i a -> a # foldl1 :: (a -> a -> a) -> PTree i a -> a # elem :: Eq a => a -> PTree i a -> Bool # maximum :: Ord a => PTree i a -> a # minimum :: Ord a => PTree i a -> a # | |
| Functor (PTree i) Source # | |
| (Show i, Show x) => Show (PTree i x) Source # | |
| (Eq i, Eq x) => Eq (PTree i x) Source # | |
| (Ord i, Ord x) => Ord (PTree i x) Source # | |
| (Entity x, Entity i, Ord i) => Validable (PTree i x) Source # | |
ptrFilter :: (x -> Bool) -> PTree i x -> PTree i x Source #
the sub tree containing all leafs satisfying the given predicate.
ptrFilterWithIndex :: ((x, i) -> Bool) -> PTree i x -> PTree i x Source #
the sub tree containing all leafs satisfying the given indexed predicate.
ptrMapShift :: Number i => i -> ((x, i) -> y) -> PTree i x -> PTree i y Source #
shifts the indices of a PTree.
ptrMapWithIndex :: Monotone i j -> ((x, i) -> y) -> PTree i x -> PTree j y Source #
maps a PTree according to the given strict monotone mapping and the given indexed
mapping.
X
xPSequence :: Ord i => N -> N -> X x -> X i -> X (PSequence i x) Source #
random variable of partially defined sequences with maximal length of
xPSequence n m.min n m
Proposition
prpPSequence :: Statement Source #
validity of PSequence.