Copyright | (c) OleksandrZhabenko 2020 |
---|---|

License | MIT |

Stability | Experimental |

Safe Haskell | None |

Language | Haskell2010 |

Maintainer : olexandr543@yahoo.com

Helps to order the 7 or less (in the first version the Ukrainian) words (or their concatenations) to obtain (to some extent) suitable for poetry or music text. This module provides several different norms that allow to research the text and to create interesting sequences.

## Synopsis

- norm1 :: [Int] -> Int
- norm2 :: [Int] -> Int
- norm3 :: [Int] -> Int
- norm4 :: [Int] -> Int
- norm5 :: [Int] -> Int
- norm51 :: [Int] -> Int
- norm513 :: [Int] -> Int
- norm54 :: [Int] -> Int
- norm6 :: [Int] -> Int
- norm6r :: [Int] -> Int
- norm8 :: [Int] -> Int
- splitNorm :: [Int] -> Vector ([Int] -> Int) -> [Int]
- combineNorms :: [Int] -> Vector ([Int] -> Int) -> [Int]
- flSplitNorms :: Vector ([Int] -> Int) -> [Int] -> [Int]
- normSplit :: Vector ([Int] -> Int) -> [Int] -> Int
- normSplitWeighted :: [Int] -> Vector ([Int] -> Int) -> [Int] -> Int
- normSplitShifted :: [Int] -> Vector ([Int] -> Int) -> [Int] -> Int
- normSplitWeightedG :: (Int -> Int -> Int) -> [Int] -> Vector ([Int] -> Int) -> [Int] -> Int

# Different norms

norm1 :: [Int] -> Int Source #

The first norm for the list of non-negative `Int`

. For not empty lists equals to the maximum element.

norm2 :: [Int] -> Int Source #

The second norm for the list of non-negative `Int`

. For not empty lists equals to the sum of the elements.

norm3 :: [Int] -> Int Source #

The third norm for the list of non-negative `Int`

. For not empty lists equals to the sum of the doubled maximum element and the rest elements of the list.

norm5 :: [Int] -> Int Source #

The fifth norm for the list of non-negative `Int`

. For not empty lists equals to the sum of the elements quoted with sum of the two most minimum elements.

norm54 :: [Int] -> Int Source #

The fifth-fourth norm for the list of non-negative `Int`

. Tries to generate more suitable for poetry text.

# Norms combining

splitNorm :: [Int] -> Vector ([Int] -> Int) -> [Int] Source #

Splits a given list of non-negative integers into lists of elements not equal to zero and then applies to them the norms from the `Vector`

starting
from the last element in the vector right-to-left.

## More complex combining

combineNorms :: [Int] -> Vector ([Int] -> Int) -> [Int] Source #

Applies all the given norms in the `Vector`

to the first argument and collects the result as a list.

flSplitNorms :: Vector ([Int] -> Int) -> [Int] -> [Int] Source #

The flipped variant of the `combineNorms`

(can be more convenient for applications).

normSplit :: Vector ([Int] -> Int) -> [Int] -> Int Source #

Using `combineNorms`

and given a group of norms (represented as a `Vector`

) returns the sum of their applications. These norms are equally important
and their order can be volatile.

normSplitWeighted :: [Int] -> Vector ([Int] -> Int) -> [Int] -> Int Source #

Using `combineNorms`

and given a group of norms (represented as a `Vector`

) returns the sum of their applications. The importance of these norms can be
easily controlled by the first function argument. The corresponding greater numbers in the first argument list signify the greater importance of the
norm in the `Vector`

of norms all being applied (so these numbers are multiplicative weights in the sum). If some of the numbers are equal to zero then
the corresponding norm is not taken into account. If some of the numbers are negative then the corresponding norms are weightly subtracted from the sum.

normSplitShifted :: [Int] -> Vector ([Int] -> Int) -> [Int] -> Int Source #

Similar to `normSplitWeighted`

, but uses more complex modification instead of multiplication.
Using `splitNorm`

and given a group of norms (represented as a `Vector`

) returns the sum of their applications. The importance of these norms can be
controlled by the first function argument. The corresponding greater numbers in the first argument list signify the greater importance of the
norm in the `Vector`

of norms all being applied. If some of the numbers are negative then the corresponding norms reduces the sum in some way.

normSplitWeightedG :: (Int -> Int -> Int) -> [Int] -> Vector ([Int] -> Int) -> [Int] -> Int Source #

Generalization for the `normSplitWeighted`

and `normSplitShifted`

with the possibility to define and use the volatile function that influences the
weights for the norms in the `Vector`

. This function used in the `zipWith`

is given as the first argument.