-- | John Rahn. /Basic Atonal Theory/. Longman, New York, 1980.
module Music.Theory.Z.Rahn_1980 where

import qualified Music.Theory.Z.Forte_1973 as Forte_1973 {- hmt -}
import Music.Theory.Z {- hmt -}

-- | Rahn prime form (comparison is rightmost inwards).
--
-- > rahn_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == GT
rahn_cmp :: Ord a => [a] -> [a] -> Ordering
rahn_cmp :: forall a. Ord a => [a] -> [a] -> Ordering
rahn_cmp [a]
p [a]
q = forall a. Ord a => a -> a -> Ordering
compare (forall a. [a] -> [a]
reverse [a]
p) (forall a. [a] -> [a]
reverse [a]
q)

-- | Rahn prime form, ie. 'Forte_1973.ti_cmp_prime' of 'rahn_cmp'.
--
-- > z_rahn_prime z12 [0,1,3,6,8,9] == [0,2,3,6,7,9]
z_rahn_prime :: Integral i => Z i -> [i] -> [i]
z_rahn_prime :: forall i. Integral i => Z i -> [i] -> [i]
z_rahn_prime Z i
z = forall i.
Integral i =>
Z i -> ([i] -> [i] -> Ordering) -> [i] -> [i]
Forte_1973.z_ti_cmp_prime Z i
z forall a. Ord a => [a] -> [a] -> Ordering
rahn_cmp

-- | The six sets where the Forte and Rahn prime forms differ.
--   Given here in Forte prime form.
--
-- > all (\p -> Forte_1973.forte_prime z12 p /= rahn_prime z12 p) rahn_forte_diff == True
rahn_forte_diff :: Num n => [[n]]
rahn_forte_diff :: forall n. Num n => [[n]]
rahn_forte_diff =
  [[n
0,n
1,n
3,n
7,n
8] -- #5
  ,[n
0,n
1,n
3,n
5,n
8,n
9],[n
0,n
1,n
3,n
6,n
8,n
9] -- #6
  ,[n
0,n
1,n
2,n
4,n
7,n
8,n
9],[n
0,n
1,n
2,n
3,n
5,n
8,n
9] -- #7
  ,[n
0,n
1,n
2,n
4,n
5,n
7,n
9,n
10] -- #8
  ]