hmt-0.20: Haskell Music Theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Z

Contents

Description

Z-n functions

Synopsis

Documentation

newtype Z i Source #

Z type.

map z_modulus [z7,z12] == [7,12]

Constructors

Z 

Fields

z_mod :: Integral i => Z i -> i -> i Source #

mod of Z.

map (z_mod z12) [-1,0,1,11,12,13] == [11,0,1,11,0,1]

z5 :: Num i => Z i Source #

Common moduli in music theory.

z7 :: Num i => Z i Source #

Common moduli in music theory.

z12 :: Num i => Z i Source #

Common moduli in music theory.

z16 :: Num i => Z i Source #

Common moduli in music theory.

is_z_n :: (Num a, Ord a) => a -> a -> Bool Source #

Is n in (0,m-1).

lift_unary_Z :: Integral i => Z i -> (t -> i) -> t -> i Source #

lift_binary_Z :: Integral i => Z i -> (s -> t -> i) -> s -> t -> i Source #

z_add :: Integral i => Z i -> i -> i -> i Source #

Add two Z.

map (z_add z12 4) [1,5,6,11] == [5,9,10,3]

z_sub :: Integral i => Z i -> i -> i -> i Source #

The underlying type i is presumed to be signed...

z_sub z12 0 8 == 4
import Data.Word {- base -}
z_sub z12 (0::Word8) 8 == 8
((0 - 8) :: Word8) == 248
248 `mod` 12 == 8

z_sub_unsigned :: (Integral i, Ord i) => Z i -> i -> i -> i Source #

Allowing unsigned i is rather inefficient...

z_sub_unsigned z12 (0::Word8) 8 == 4

z_mul :: Integral i => Z i -> i -> i -> i Source #

z_negate :: Integral i => Z i -> i -> i Source #

z_signum :: t -> u -> v Source #

z_abs :: t -> u -> v Source #

to_Z :: Integral i => Z i -> i -> i Source #

from_Z :: (Integral i, Num n) => i -> n Source #

z_univ :: Integral i => Z i -> [i] Source #

Universe of Z.

z_univ z12 == [0..11]

z_complement :: Integral i => Z i -> [i] -> [i] Source #

Z of z_univ not in given set.

z_complement z5 [0,2,3] == [1,4]
z_complement z12 [0,2,4,5,7,9,11] == [1,3,6,8,10]

z_quot :: Integral i => Z i -> i -> i -> i Source #

z_rem :: Integral i => Z i -> i -> i -> i Source #

div_err :: Integral i => String -> i -> i -> i Source #

z_div :: Integral i => Z i -> i -> i -> i Source #

z_quotRem :: Integral i => Z i -> i -> i -> (i, i) Source #

z_divMod :: Integral i => Z i -> i -> i -> (i, i) Source #

z_toInteger :: Integral i => Z i -> i -> i Source #

Z16

integral_to_digit :: Integral t => t -> Char Source #

Type generalised intToDigit.

map integral_to_digit [0 .. 15] == "0123456789abcdef"

is_z16 :: Integral t => t -> Bool Source #

is_z_n 16.

z16_set_pp :: Integral t => [t] -> String Source #

z16_to_char in braces, {1,2,3}.

z16_seq_pp :: Integral t => [t] -> String Source #

z16_to_char in arrows, 1,2,3.

z16_vec_pp :: Integral t => [t] -> String Source #

z16_to_char in brackets, [1,2,3].