Safe Haskell | None |
---|---|
Language | Haskell2010 |
General functions for the twentyseven project
- flatIndex :: Int -> Int -> Int -> Int
- zipWith' :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
- sequence' :: Applicative f => [f a] -> f [a]
- rotate :: Int -> [a] -> [a]
- subs :: Int -> a -> [a] -> [a]
- insert' :: Int -> a -> [a] -> [a]
- inverseList :: Int -> [Int] -> [Int]
- composeList :: [a] -> [Int] -> [a]
- listSeq :: [a] -> b -> b
- type Vector = Vector
- isPermutationVector :: Vector Int -> Bool
- signPermutationVector :: Vector Int -> Int
- idVector :: Int -> Vector Int
- inverseVector :: Vector Int -> Vector Int
- composeVector :: Unbox a => Vector a -> Vector Int -> Vector a
- class Monoid a => Group a where
- inverse :: a -> a
- iden :: Group a => a
- (<>^) :: (Integral int, Group a) => a -> int -> a
- conjugate :: Group a => a -> a -> a
- (??) :: Group a => a -> a -> a
- fact :: Int -> Int
- choose :: Int -> Int -> Int
- iFind :: (Integral a, Ord a, Vector v a) => a -> v a -> Maybe Int
- bool :: a -> a -> Bool -> a
- chunk :: Int -> [a] -> [[a]]
- partition' :: (a -> a -> Bool) -> [a] -> [[a]]
- tagOf :: tag a b -> tag' a b' -> tag a b
- asProxyTypeOf :: a -> proxy a -> a
- proxyUnwrap :: proxy (f a) -> Proxy a
- (<&>) :: Functor f => f a -> (a -> b) -> f b
Documentation
Applicative
zipWith' :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source
sequence' :: Applicative f => [f a] -> f [a] Source
Lists
inverseList :: Int -> [Int] -> [Int] Source
If l
is a permutation list (replaced-by) of length n
,
inverseList n l
is its inverse permutation.
composeList :: [a] -> [Int] -> [a] Source
Backpermute. Substitute every index in the second list with the corresponding element in the first.
Vectors
isPermutationVector :: Vector Int -> Bool Source
Permutation of [0 .. length v]
.
signPermutationVector :: Vector Int -> Int Source
Sign of a permutation vector.
inverseVector :: Vector Int -> Vector Int Source
If v
is a permutation,
inverseVector v
is its inverse permutation.
composeVector :: Unbox a => Vector a -> Vector Int -> Vector a Source
Permutation composition: (p . q) x == p (q x)
.
composeVector u v ! i == u ! (v ! i)
Groups
class Monoid a => Group a where Source
Class for groups:
a <> (b <> c) == (a <> b) <> c -- Associative property
a <> iden == a -- Neutral element iden <> a == a
a <> inverse a == iden -- Inverse inverse a <> a == iden
(<>^) :: (Integral int, Group a) => a -> int -> a infixr 8 Source
Exponentiation, negative indices are supported.
Combinatorics
choose :: Int -> Int -> Int Source
Binomial coefficient:
choose n k == fact n `div` (fact k) * (fact (n - k))
iFind :: (Integral a, Ord a, Vector v a) => a -> v a -> Maybe Int Source
Interpolation search for Int
partition' :: (a -> a -> Bool) -> [a] -> [[a]] Source
Generalized partition
asProxyTypeOf :: a -> proxy a -> a Source
proxyUnwrap :: proxy (f a) -> Proxy a Source