module DobutokO.Poetry.Norms.Extended (
norm7
, norm7n
, norm54n
, norm45n
) where
import qualified Data.Vector as V
import Data.List ((\\),sort)
import DobutokO.Poetry.Norms
norm7 :: Int -> [Int] -> Int
norm7 l xs
| null xs = 0
| otherwise =
let n = ((abs l `rem` 101) * length xs) `quot` 10
m = abs ((length xs `quot` 3) - (n `quot` 2))
ys = if compare (minimum xs) 1 /= GT then filter (\t -> compare t 1 == GT) xs else xs \\ [minimum xs] in
if null ys then sum xs else (n * sum xs) `quot` ((sum . take n . sort $ xs) + m * maximum xs)
{-# INLINE norm7 #-}
norm7n :: Int -> [Int] -> Int
norm7n l xs
| null xs = 0
| otherwise =
let n = ((abs l `rem` 101) * length xs) `quot` 10
ys = if compare (minimum xs) 1 /= GT then filter (\t -> compare t 1 == GT) xs else xs \\ [minimum xs] in
if null ys then sum xs else (n * sum xs) `quot` (sum . take n . sort $ xs)
{-# INLINE norm7n #-}
norm54n :: Int -> Int -> [Int] -> Int
norm54n n m xs = (norm513 xs ^ n * norm6r xs) `quot` (norm4 xs ^ m)
{-# INLINE norm54n #-}
norm45n :: Int -> Int -> [Int] -> Int
norm45n n m xs = (norm4 xs ^ n * norm6r xs) `quot` (norm513 xs ^ m)
{-# INLINE norm45n #-}