module Music.Theory.Metric.Morris_1980 where
import Data.Int
import Data.Ratio
import Music.Theory.Z
import Music.Theory.Z.Forte_1973
sim :: Integral a => [Int8] -> [Int8] -> a
sim :: forall a. Integral a => [Int8] -> [Int8] -> a
sim [Int8]
r [Int8]
s =
let r' :: [a]
r' = forall i n. (Integral i, Num n) => Z i -> [i] -> [n]
z_icv forall i. Num i => Z i
z12 [Int8]
r
s' :: [a]
s' = forall i n. (Integral i, Num n) => Z i -> [i] -> [n]
z_icv forall i. Num i => Z i
z12 [Int8]
s
t :: [a]
t = forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (-) [a]
r' [a]
s'
in forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum (forall a b. (a -> b) -> [a] -> [b]
map forall a. Num a => a -> a
abs [a]
t)
asim :: (Integral n) => [Int8] -> [Int8] -> Ratio n
asim :: forall n. Integral n => [Int8] -> [Int8] -> Ratio n
asim [Int8]
r [Int8]
s =
let r' :: [n]
r' = forall i n. (Integral i, Num n) => Z i -> [i] -> [n]
z_icv forall i. Num i => Z i
z12 [Int8]
r
s' :: [n]
s' = forall i n. (Integral i, Num n) => Z i -> [i] -> [n]
z_icv forall i. Num i => Z i
z12 [Int8]
s
in forall a. Integral a => [Int8] -> [Int8] -> a
sim [Int8]
r [Int8]
s forall a. Integral a => a -> a -> Ratio a
% (forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum [n]
r' forall a. Num a => a -> a -> a
+ forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum [n]
s')