'p @      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    !!!!!!!!!!!!!!!!!!!!! ! ! ! ! !!!!!!!!!!!!!!!!!!! !!!"!#!$!%!&!'!(!)!*!+!,!-!.!/"0"1"2"3"4"5"6"7"8"9":";"<"=">"?"@"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~""""""""""""""""""""""""""""""""""###############$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&&&&&&&&&&&&&& & & & & &&&&&&&&&&&&&&&&&&& &!&"&#&$&%&&&'&(&)&*&+&,&-&.&/&0&1&2&3&4&5&6&7&8&9&:&;&<&=&>&?&@&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&[&\&]&^&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&{&|&}&~&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& & & & & &&&&&&&&&&&&&&&&&&& &!&"&#&$&%&&&'&(&)&*&+&,&-&.&/&0&1&2&3&4&5&6&7&8&9&:&;&<&=&>&?&@&A&B&C&D&E&F&G&H&I'J'K'L'M'N'O'P'Q'R'S'T'U'V'W(X(Y(Z([(\(](^(_(`(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u)v)w)x)y)z){)|)})~)))))))))))))))))))))))))))))))***++,,,,,-----..............//00111111111111111111111111111111111111111111111111111111112222222222222222222 2 2 2 2 2222222222222222222 2!2"2#2$2%2&2'2(2)2*2+2,2-2.2/202122233435363738393:3;3<3=3>3?3@3A3B3C3D3E3F3G3H3I3J3K3L3M3N3O3P3Q3R3S3T3U3V3W3X3Y3Z3[3\3]3^4_4`4a4b4c4d4e4f4g4h4i4j4k4l5m5n5o5p5q5r5s5t5u5v5w6x6y6z6{6|6}6~6666666666666666666666666666666666666666666666666667777777777777777777777777777777777777777778888888888888888888888888888888888888888888888 8 8 8 8 8888888888999999999 9!9"9#9$9%9&9':(:);*;+;,;-;.;/;0;1<2<3<4<5<6<7<8<9<:<;<<<=<><?<@=A=B=C=D=E=F=G=H=I=J=K=L>M>N>O>P>Q>R>S>T>U>V>W>X>Y>Z>[>\>]>^>_>`?a?b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@{@|@}A~ABBCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHH H H H H HHHHHHHHHHHHHHHHHHH H!H"H#H$H%H&H'H(H)H*H+H,H-H.H/H0H1H2H3H4H5H6H7H8H9H:H;H<H=H>I?I@IAIBICIDIEIFIGIHIIIJIKILIMINIOIPIQIRISITIUIVIWIXIYIZI[J\J]J^J_J`JaJbJcJdKeKfKgKhKiKjKkKlKmKnKoKpKqKrKsKtKuKvKwKxKyKzL{L|L}L~LLLLLLLMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNOOPPQQQQQQQQQQQQQQQQRRRSSSSSSSSSSSSSSTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVWWWWWWWWWWWWWWW W W W W WWWWWWWWWWWWWWWWWWW W!W"W#W$W%W&W'W(W)W*W+W,W-W.W/W0W1W2W3W4W5W6X7X8X9X:X;X<X=X>X?XX Safe-Inferred@ A B C. &observeAll (fromList [1..7]) == [1..7]D all-interval series. [0,1,3,2,9,5,10,4,7,11,8,6] `elem` observeAll (all_interval_m 12) length (observeAll (all_interval_m 12)) == 3856 map (length . observeAll . all_interval_m) [4,6,8,10] == [2,4,24,288]E of . Xlet r = [[0,1,5,2,4,3],[0,2,1,4,5,3],[0,4,5,2,1,3],[0,5,1,4,2,3]] in all_interval 6 == r Safe-InferredwSet class database with descriptors for historically and theoretically significant set classes, indexed by Forte name. klookup "6-Z17" sc_db == Just "All-Trichord Hexachord" lookup "7-35" sc_db == Just "diatonic collection (d)" Safe-Inferred Z not in set. Pz_complement 5 [0,2,3] == [1,4] z_complement 12 [0,2,4,5,7,9,11] == [1,3,6,8,10]     Safe-Inferred  Transpose p by n. 5tn 5 4 [0,1,4] == [4,0,3] tn 12 4 [1,5,6] == [5,9,10]Invert p about n. \invert 5 0 [0,1,4] == [0,4,1] invert 12 6 [4,5,6] == [8,7,6] invert 12 0 [0,1,3] == [0,11,9]Composition of  about 0 and . dtni 5 1 [0,1,3] == [1,0,3] tni 12 4 [1,5,6] == [3,11,10] (invert 12 0 . tn 12 4) [1,5,6] == [7,3,2]Modulo multiplication. (mn 12 11 [0,1,4,9] == tni 12 0 [0,1,4,9]T-related sequences of p. %length (t_related 12 [0,3,6,9]) == 12T/I-related sequences of p. slength (ti_related 12 [0,1,3]) == 24 length (ti_related 12 [0,3,6,9]) == 24 ti_related 12 [0] == map return [0..11]R/T/I-related sequences of p. Mlength (rti_related 12 [0,1,3]) == 48 length (rti_related 12 [0,3,6,9]) == 24 Variant of  , transpose p so first element is n. Htn_to 12 5 [0,1,3] == [5,6,8] map (tn_to 12 0) [[0,1,3],[1,3,0],[3,0,1]] Variant of , inverse about n th element. ymap (invert_ix 12 0) [[0,1,3],[3,4,6]] == [[0,11,9],[3,2,0]] map (invert_ix 12 1) [[0,1,3],[3,4,6]] == [[2,1,11],[5,4,2]] The standard t-matrix of p. _tmatrix 12 [0,1,3] == [[0,1,3] ,[11,0,2] ,[9,10,0]]      Safe-Inferred! Bit array."Coding.#Pretty printer for !.$ Parse PP of !. 4parse_array "01001" == [False,True,False,False,True]% Generate " from !*, the coding is most to least significant. >array_to_code (map toEnum [1,1,0,0,1,0,0,0,1,1,1,0,0]) == 6428& Inverse of %. ?code_to_array 13 6428 == map toEnum [1,1,0,0,1,0,0,0,1,1,1,0,0]' Array to set. garray_to_set (map toEnum [1,1,0,0,1,0,0,0,1,1,1,0,0]) == [0,1,4,8,9,10] T.encode [0,1,4,8,9,10] == 1811( Inverse of ', z is the degree of the array.)% of (. Iset_to_code 12 [0,2,3,5] map (set_to_code 12) (T.ti_related 12 [0,2,3,5])*Logical complement.+The prime form is the F encoding. 3array_is_prime (set_to_array 12 [0,2,3,5]) == False,The augmentation rule adds 1$ in each empty slot at end of array. Omap array_pp (array_augment (parse_array "01000")) == ["01100","01010","01001"]-4Enumerate first half of the set-classes under given primeJ function. The second half can be derived as the complement of the first. wimport Music.Theory.Z12.Forte_1973 length scs == 224 map (length . scs_n) [0..12] == [1,1,6,12,29,38,50,38,29,12,6,1,1] xlet z12 = map (fmap (map array_to_set)) (enumerate_half array_is_prime 12) map (length . snd) z12 == [1,1,6,12,29,38,50]This can become slow, edit z( to find out. It doesn't matter about n$. This can be edited so that small n# would run quickly even for large z. Efmap (map array_to_set) (lookup 5 (enumerate_half array_is_prime 16)). Encoder for 0. encode [0,1,3,6,8,9] == 843/ Decoder for 0. decode 12 843 == [0,1,3,6,8,9]0;Binary encoding prime form algorithm, equalivalent to Rahn. sencode_prime 12 [0,1,3,6,8,9] == [0,2,3,6,7,9] Music.Theory.Z12.Rahn_1980.rahn_prime [0,1,3,6,8,9] == [0,2,3,6,7,9]!"#$%&'()*+,-./0!"#$%&'()*+,-./0"!#$%&'()*+,-./0!"#$%&'()*+,-./0 Safe-Inferred123456123456123456123456 Safe-Inferred>Uniform two-tuple.FInfix G. "t2_join ([1,2],[3,4]) == [1,2,3,4]ILeft rotation. !p3_rotate_left (1,2,3) == (2,3,1)K789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~K789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~K?>@ABCDEFGHIJKL=MNOPQRSTUVWXYZ<[\]^_`abcdefghi;jklmnopqrstuvwx:yz{9|}8~7K789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred#Minutes, seconds, centi-seconds as (min,sec,csec)Minutes, seconds as  (min,sec)Fractional seconds.Fractional seconds to  (min,sec). ;map fsec_to_minsec [59.49,60,60.51] == [(0,59),(1,0),(1,1)] pretty printer. =map (minsec_pp . fsec_to_minsec) [59,61] == ["00:59","01:01"]Fractional seconds to (min,sec,csec). >map fsec_to_mincsec [1,1.5,4/3] == [(0,1,0),(0,1,50),(0,1,33)] pretty printer. Emap (mincsec_pp . fsec_to_mincsec) [1,4/3] == ["00:01.00","00:01.33"]  Safe-InferredDuration stored as hours, minutes, seconds and  milliseconds.Convert fractional seconds to integral (seconds,milliseconds). s_sms 1.75 == (1,750) Inverse of . sms_s (1,750) == 1.75H function for  tuple.H function for . Allows either H:M:S.MS or M:S.MS or S.MS. read_duration "01:35:05.250" == Duration 1 35 5 250 read_duration "35:05.250" == Duration 0 35 5 250 read_duration "05.250" == Duration 0 0 5 250I function for . bshow_duration (Duration 1 35 5 250) == "01:35:05.250" show (Duration 1 15 0 000) == "01:15:00.000"Extract / tuple applying filter function at each element 7duration_tuple id (Duration 1 35 5 250) == (1,35,5,250) Inverse of .  Safe-Inferred Element of "(sequence,multiplier,displacement).Tiling (sequence)Voice. Canon of +(period,sequence,multipliers,displacements). Sequence. Cycle at period. 8take 9 (p_cycle 18 [0,2,5]) == [0,2,5,18,20,23,36,38,41]Resolve sequence from . Ze_to_seq ([0,2,5],2,1) == [1,5,11] e_to_seq ([0,1],3,4) == [4,7] e_to_seq ([0],1,2) == [2]Infer  from sequence. `e_from_seq [1,5,11] == ([0,2,5],2,1) e_from_seq [4,7] == ([0,1],3,4) e_from_seq [2] == ([0],1,2)Set of  from .J of .Retrograde of  , the result  is sorted. zlet r = [[0,7,14],[1,5,9],[2,4,6],[3,8,13],[10,11,12]] in t_retrograde [[0,7,14],[1,6,11],[2,3,4],[5,9,13],[8,10,12]] == rThe normal form of  is the K of t and it's . vlet r = [[0,7,14],[1,5,9],[2,4,6],[3,8,13],[10,11,12]] in t_normal [[0,7,14],[1,6,11],[2,3,4],[5,9,13],[8,10,12]] == rDerive set of  from . let {r = [(21,[0,1,2],[10,8,2,4,7,5,1],[0,1,2,3,5,8,14])] ;t = [[0,10,20],[1,9,17],[2,4,6],[3,7,11],[5,12,19],[8,13,18],[14,15,16]]} in r_from_t t == r@ A B C. &observeAll (fromList [1..7]) == [1..7] Search for perfect tilings of the sequence  using multipliers from m to degree n with k parts. of E of . (perfect_tilings [[0,1]] [1..3] 6 3 == [] klet r = [[[0,7,14],[1,5,9],[2,4,6],[3,8,13],[10,11,12]]] in perfect_tilings [[0,1,2]] [1,2,4,5,7] 15 5 == r 4length (perfect_tilings [[0,1,2]] [1..12] 15 5) == 1 let r = [[[0,1],[2,5],[3,7],[4,6]] ,[[0,1],[2,6],[3,5],[4,7]] ,[[0,2],[1,4],[3,7],[5,6]]] in perfect_tilings [[0,1]] [1..4] 8 4 == r let r = [[[0,1],[2,5],[3,7],[4,9],[6,8]] ,[[0,1],[2,7],[3,5],[4,8],[6,9]] ,[[0,2],[1,4],[3,8],[5,9],[6,7]] ,[[0,2],[1,5],[3,6],[4,9],[7,8]] ,[[0,3],[1,6],[2,4],[5,9],[7,8]]] in perfect_tilings [[0,1]] [1..5] 10 5 == rJohnson 2004, p.2 let r = [[0,6,12],[1,8,15],[2,11,20],[3,5,7],[4,9,14],[10,13,16],[17,18,19]] in perfect_tilings [[0,1,2]] [1,2,3,5,6,7,9] 21 7 == [r] let r = [[0,10,20],[1,9,17],[2,4,6],[3,7,11],[5,12,19],[8,13,18],[14,15,16]] in perfect_tilings [[0,1,2]] [1,2,4,5,7,8,10] 21 7 == [t_retrograde r] Variant of L4 for ordered sequences, which can therefore return M# when searching infinite sequences. <5 `elemOrd` [0,2..] == False && 10 `elemOrd` [0,2..] == TrueA .* diagram of n places of . -v_dot_star 18 [0,2..] == "*.*.*.*.*.*.*.*.*."#A white space and index diagram of n places of .1mapM_ (putStrLn . v_space_ix 9) [[0,2..],[1,3..]]>> 0 2 4 6 8> 1 3 5 7Insert | every n places. =with_bars 6 (v_dot_star 18 [0,2..]) == "*.*.*.|*.*.*.|*.*.*."Variant with measure length m and number of measures n. 2v_dot_star_m 6 3 [0,2..] == "*.*.*.|*.*.*.|*.*.*."Print .* diagram.Variant to print | at measures.Variant that discards first k measures.  Safe-Inferred{0,1,2} order 5, p.1v_print 15 (r_voices p1)>> ..***..........> ........*.*.*..> .....*...*...*.> .*....*....*...> *......*......*{0,1,2} order 7, p.2v_print 21 (r_voices p2)>> ..............***....> ..*.*.*..............> ...*...*...*.........> ........*....*....*..> .....*......*......*.> .*.......*.......*...> *.........*.........*{0,1} order 4, p.3v_print 8 (r_voices p3)> > *...*... > .**..... > ...*..*. > .....*.*{0,1} order 5, p.4 mapM_ (v_print 10 . r_voices) p4> > *...*..... > .**....... > ...*....*. > .....*.*.. > ......*..*> > *....*.... > .**....... > ...*..*... > ....*...*. > .......*.*> > *...*..... > .*....*... > ..**...... > .....*..*. > .......*.*Open {1,2,3} order 5, p.4v_print 18 (r_voices p4_b)>> ...***............> ........*.*.*.....> .........*...*...*> .*....*....*......> *......*......*...  Safe-InferredTilework for Clarinet, p.3v_print 36 (rr_voices p3)>&> *.*..*............*.*..*............&> .*.*..*............*.*..*...........&> ........*.*..*............*.*..*....&> ....*..*.*............*..*.*........&> ...........*..*.*............*..*.*.&> ............*..*.*............*..*.* Tilework for String Quartet, p.5 mapM_ (v_print 24 . r_voices) p5 >> ******......******......> ......******......******>> *.****.*....*.****.*....> ......*.****.*....*.****>> **.***..*...**.***..*...> ......**.***..*...**.***>> *..***.**...*..***.**...> ......*..***.**...*..***Extra Perfect (p.7)#v_print_m_from 18 6 6 (r_voices p7) >+> **.*..|......|......|......|......|......+> ......|.*.*..|.*....|......|......|......+> ......|......|......|......|.*..*.|....*.+> ......|......|...*..|.*....|...*..|......+> ......|......|....*.|...*..|......|.*....+> ......|*.....|*.....|......|*.....|......+> ....*.|......|......|*.....|......|...*..+> ......|......|......|....*.|......|*.....#Tilework for Log Drums (2005), p.10v_print 18 (r_voices p10)>> *.*.*.............> .*...*...*........> ...*...*...*......> ......*...*...*...> ........*...*...*.> .............*.*.*"Self-Similar Melodies (1996), p.11v_print_m 20 5 (r_voices p11)>j> *.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....|*.....*.....*..*..*.|....*.....*.....*...j> ....................|*.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....|*.....*.....*..*..*.j> ....................|....................|*.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*..... NoneB Z12 are modulo 12 integers. Emap signum [-1,0::Z12,1] == [1,0,1] map abs [-1,0::Z12,1] == [11,0,1]The Z12 modulo (ie. 12) as a 4 value. This is required when lifting generalised Z functions to  . It is not the same as writing 12::Z12. Rz12_modulo == Z12 12 z12_modulo /= 12 (12::Z12) == 0 show z12_modulo == "(Z12 12)"Basis for Z12 show instance. >map show [-1,0::Z12,1,z12_modulo] == ["11","0","1","(Z12 12)"])Lift unary function over integers to Z12. lift_unary_Z12 (negate) 7 == 5)Lift unary function over integers to Z12. /map (lift_binary_Z12 (+) 4) [1,5,6] == [5,9,10]Raise an error if the internal  value is negative.Convert integral to . $map to_Z12 [-9,-3,0,13] == [3,9,0,1]Convert  to integral.Z12 not in set. +complement [0,2,4,5,7,9,11] == [1,3,6,8,10]N instance for Z12. -[minBound::Z12 .. maxBound] == [0::Z12 .. 11]Cyclic O instance for Z12. ipred (0::Z12) == 11 succ (11::Z12) == 0 [9::Z12 .. 3] == [9,10,11,0,1,2,3] [9::Z12,11 .. 3] == [9,11,1,3]  None%Map to pitch-class and reduce to set. pcset [1,13] == [1]Transpose by n. 0tn 4 [1,5,6] == [5,9,10] tn 4 [0,4,8] == [0,4,8]Invert about n. 8invert 6 [4,5,6] == [6,7,8] invert 0 [0,1,3] == [0,9,11]Composition of  about 0 and . @tni 4 [1,5,6] == [3,10,11] (invert 0 . tn 4) [1,5,6] == [2,3,7]Modulo 12 multiplication %mn 11 [0,1,4,9] == invert 0 [0,1,4,9]M5, ie.  5. m5 [0,1,3] == [0,3,5]T-related sets of p. Ylength (t_related [0,1,3]) == 12 t_related [0,3,6,9] == [[0,3,6,9],[1,4,7,10],[2,5,8,11]]T/I-related set of p. [length (ti_related [0,1,3]) == 24 ti_related [0,3,6,9] == [[0,3,6,9],[1,4,7,10],[2,5,8,11]]None Encoder for . encode [0,1,3,6,8,9] == 843 Decoder for . decode 843 == [0,1,3,6,8,9];Binary encoding prime form algorithm, equalivalent to Rahn. pencode_prime [0,1,3,6,8,9] == [0,2,3,6,7,9] Music.Theory.Z12.Rahn_1980.rahn_prime [0,1,3,6,8,9] == [0,2,3,6,7,9] Safe-Inferred Variant of unzip. ulet r = ([Just 1,Nothing,Just 3],[Just 'a',Nothing,Just 'c']) in maybe_unzip [Just (1,'a'),Nothing,Just (3,'c')] == rReplace P elements with last Q5 value. This does not alter the length of the list. :maybe_latch 1 [Nothing,Just 2,Nothing,Just 4] == [1,2,2,4]'Variant requiring initial value is not P. 9maybe_latch1 [Just 1,Nothing,Nothing,Just 4] == [1,1,1,4]B of R. 8maybe_map negate [Nothing,Just 2] == [Nothing,Just (-2)] If either is P then M, else eq of values.0Join two values, either of which may be missing. of SApply predicate inside T. (maybe_predicate even (Just 3) == NothingB of . blet r = [Nothing,Nothing,Nothing,Just 4] in maybe_filter even [Just 1,Nothing,Nothing,Just 4] == r Variant of YZ that retains P( as a placeholder for removed elements. ;filter_maybe even [1..4] == [Nothing,Just 2,Nothing,Just 4]  Safe-InferredReal (alias for U). @http://reference.wolfram.com/mathematica/ref/FractionalPart.htmlType specialised. @http://reference.wolfram.com/mathematica/ref/FractionalPart.html Zimport Sound.SC3.Plot {- hsc3-plot -} plotTable1 (map fractional_part [-2.0,-1.99 .. 2.0]) >http://reference.wolfram.com/mathematica/ref/SawtoothWave.html 2plotTable1 (map sawtooth_wave [-2.0,-1.99 .. 2.0])Pretty printer for V that elides denominators of 1. ,map rational_pp [1,3/2,2] == ["1","3/2","2"]Pretty print ratio as : separated integers. -map ratio_pp [1,3/2,2] == ["1:1","3:2","2:1"]Predicate that is true if n/d can be simplified, ie. where W of n and d is not 1. Nlet r = [False,True,False] in map rational_simplifies [(2,3),(4,6),(5,7)] == rX and Y of rational.Rational as a whole number, or P.Erroring variant. Variant of Z. The IC instance for floats resorts to exponential notation very readily. 4[show 0.01,realfloat_pp 2 0.01] == ["1.0e-2","0.01"]Type specialised .Type specialised .Show only0 positive and negative values, always with sign. lmap num_diff_str [-2,-1,0,1,2] == ["-2","-1","","+1","+2"] map show [-2,-1,0,1,2] == ["-2","-1","0","1","2"] Safe-Inferred*Type pairing a stratification and a tempo.4A stratification is a tree of integral subdivisions.One indexed variant of [. &map (at [11..13]) [1..3] == [11,12,13] Variant of 1 with boundary rules and specified error message. Jmap (at' 'x' [11..13]) [0..4] == [1,11,12,13,1] at' 'x' [0] 3 == undefined Variant of \ with input constraints. mod' (-1) 2 == 1Specialised variant of ]. Variant on ^ with input constraints.'Indispensibilities from stratification. indispensibilities [3,2,2] == [11,0,6,3,9,1,7,4,10,2,8,5] indispensibilities [2,3,2] == [11,0,6,2,8,4,10,1,7,3,9,5] indispensibilities [2,2,3] == [11,0,4,8,2,6,10,1,5,9,3,7] indispensibilities [3,5] == [14,0,9,3,6,12,1,10,4,7,13,2,11,5,8]!The indispensibility measure (). map (lower_psi [2] 1) [1..2] == [1,0] map (lower_psi [3] 1) [1..3] == [2,0,1] map (lower_psi [2,2] 2) [1..4] == [3,0,2,1] map (lower_psi [5] 1) [1..5] == [4,0,3,1,2] map (lower_psi [3,2] 2) [1..6] == [5,0,3,1,4,2] map (lower_psi [2,3] 2) [1..6] == [5,0,2,4,1,3] The first nth primes, reversed. <reverse_primes 14 == [43,41,37,31,29,23,19,17,13,11,7,5,3,2]"Generate prime stratification for n. map prime_stratification [2,3,5,7,11] == [[2],[3],[5],[7],[11]] map prime_stratification [6,8,9,12] == [[3,2],[2,2,2],[3,3],[3,2,2]] map prime_stratification [22,10,4,1] == [[11,2],[5,2],[2,2],[]] map prime_stratification [18,16,12] == [[3,3,2],[2,2,2,2],[3,2,2]]5Fundamental indispensibilities for prime numbers ().  map (upper_psi 2) [1..2] == [1,0] map (upper_psi 3) [1..3] == [2,0,1] map (upper_psi 5) [1..5] == [4,0,3,1,2] map (upper_psi 7) [1..7] == [6,0,4,2,5,1,3] map (upper_psi 11) [1..11] == [10,0,6,4,9,1,7,3,8,2,5] map (upper_psi 13) [1..13] == [12,0,7,4,10,1,8,5,11,2,9,3,6]LTable such that each subsequent row deletes the least indispensibile pulse. ethinning_table [3,2] == [[True,True,True,True,True,True] ,[True,False,True,True,True,True] ,[True,False,True,False,True,True] ,[True,False,True,False,True,False] ,[True,False,False,False,True,False] ,[True,False,False,False,False,False]] Trivial pretty printer for . EputStrLn (thinning_table_pp [3,2]) putStrLn (thinning_table_pp [2,3]) _****** ****** *.**** *.**** *.*.** *.**.* *.*.*. *..*.* *...*. *..*.. *..... *..... .Scale values against length of list minus one. 6relative_to_length [0..5] == [0.0,0.2,0.4,0.6,0.8,1.0]  Variant of  that scales value to lie in (0,1).:relative_indispensibilities [3,2] == [1,0,0.6,0.2,0.8,0.4] ]Align two meters (given as stratifications) to least common multiple of their degrees. The k function is given as an argument so that it may be relative if required. This generates Table 7 (p.58). alet r = [(5,5),(0,0),(2,3),(4,1),(1,4),(3,2)] in align_meters indispensibilities [2,3] [3,2] == r zlet r = [(1,1),(0,0),(0.4,0.6),(0.8,0.2),(0.2,0.8),(0.6,0.4)] in align_meters relative_indispensibilities [2,3] [3,2] == r dalign_meters indispensibilities [2,2,3] [3,5] align_meters relative_indispensibilities [2,2,3] [3,5]  Variant of ^ that requires \ be 0. Variant of _ that requires ` be 0.&Rule to prolong stratification of two N values such that pulse at the deeper level are aligned. (Paragraph 2, p.58) Clet x = ([2,2,2],1) in prolong_stratifications x x == (fst x,fst x) Ulet r = ([2,5,3,3,2],[3,2,5,5]) in prolong_stratifications ([2,5],50) ([3,2],60) == r @prolong_stratifications ([2,2,3],5) ([3,5],4) == ([2,2,3],[3,5])$Arithmetic mean (average) of a list. mean [0..5] == 2.5 Square of n. square 5 == 25Composition of  and  . 3align_s_mm indispensibilities ([2,2,3],5) ([3,5],4) An attempt at Equation 5 of the CMJ paper. When n is h-1H the output is incorrect (it is the product of the correct values for n at h-1 and h). map (upper_psi' 5) [1..5] /= [4,0,3,1,2] map (upper_psi' 7) [1..7] /= [6,0,4,2,5,1,3] map (upper_psi' 11) [1..11] /= [10,0,6,4,9,1,7,3,8,2,5] map (upper_psi' 13) [1..13] /= [12,0,7,4,10,1,8,5,11,2,9,3,6]The MPS limit equation given on p.58. mps_limit 3 == 21 + 7/9nThe square of the product of the input sequence is summed, then divided by the square of the sequence length. nmean_square_product [(0,0),(1,1),(2,2),(3,3)] == 6.125 mean_square_product [(2,3),(4,5)] == (6^2 + 20^2) / 2^2IAn incorrect attempt at the description in paragraph two of p.58 of the CMJ paper. {let p ~= q = abs (p - q) < 1e-4 metrical_affinity [2,3] 1 [3,2] 1 ~= 0.0324 metrical_affinity [2,2,3] 20 [3,5] 16 ~= 0.0028*An incorrect attempt at Equation 6 of the CMJ paper, see omega_z. let p ~= q = abs (p - q) < 1e-4 metrical_affinity' [2,2,2] 1 [2,2,2] 1 ~= 1.06735 metrical_affinity' [2,2,2] 1 [2,2,3] 1 ~= 0.57185 metrical_affinity' [2,2,2] 1 [2,3,2] 1 ~= 0.48575 metrical_affinity' [2,2,2] 1 [3,2,2] 1 ~= 0.45872 1metrical_affinity' [3,2,2] 3 [2,2,3] 2 ~= 0.10282                     Safe-InferredFunction to spell a  PitchClass.oGeneralised alteration, given as a rational semitone difference and a string representation of the alteration.6Enumeration of common music notation note alterations.$1Enumeration of common music notation note names (C to B)., Transform $ to pitch-class number. !map note_to_pc [C,E,G] == [0,4,7]-Modal transposition of $ value. note_t_transpose C 2 == E. Generic form./ Transform # to semitone alteration. Returns P for non-semitone alterations. Emap alteration_to_diff [Flat,QuarterToneSharp] == [Just (-1),Nothing]0Is  12-ET.1 Transform  to semitone alteration. 1map alteration_to_diff_err [Flat,Sharp] == [-1,1]2 Transform = to fractional semitone alteration, ie. allow quarter tones. +alteration_to_fdiff QuarterToneSharp == 0.53,Transform fractional semitone alteration to , ie. allow quarter tones. ymap fdiff_to_alteration [-0.5,0.5] == [Just QuarterToneFlat ,Just QuarterToneSharp]4Raise " by a quarter tone where possible. oalteration_raise_quarter_tone Flat == Just QuarterToneFlat alteration_raise_quarter_tone DoubleSharp == Nothing5Lower " by a quarter tone where possible. palteration_lower_quarter_tone Sharp == Just QuarterToneSharp alteration_lower_quarter_tone DoubleFlat == Nothing6Edit # by a quarter tone where possible, -0.5 lowers, 0 retains, 0.5 raises. Yimport Data.Ratio alteration_edit_quarter_tone (-1 % 2) Flat == Just ThreeQuarterToneFlat7 Simplify , to standard 12ET by deleting quarter tones. FData.List.nub (map alteration_clear_quarter_tone [minBound..maxBound])8Unicode has entries for Musical Symbols in the range U+1D100 through U+1D1FF. The 3/44 symbols are non-standard, here they correspond to MUSICAL SYMBOL FLAT DOWN and MUSICAL SYMBOL SHARP UP. ;map alteration_symbol [minBound .. maxBound] == "+-&m3&n2&o0*"9The ISOL ASCII spellings for alterations. Naturals as written as the empty string. 9mapMaybe alteration_iso_m [Flat .. Sharp] == ["b","","#"]:The ISO! ASCII spellings for alterations.;The Tonhhe! ASCII spellings for alterations.See  7http://www.musiccog.ohio-state.edu/Humdrum/guide04.html and Dhttp://lilypond.org/doc/v2.16/Documentation/notation/writing-pitches ?map alteration_tonh [Flat .. Sharp] == ["es","eh","","ih","is"]< Transform  to . Qlet r = [(-1,"&m"),(0,"&n"),(1,"&o")] in map alteration_t' [Flat,Natural,Sharp] == r% !"#$%&'()*+,-./0123456789:;<% !"#$%&'()*+,-./0123456789:;<%$+*)('&%,-#"! ./0123456789:;< #"! $+*)('&%,-./0123456789:;< Safe-Inferred= Variant of  for incomplete functions.>$Spelling for natural (&n) notes only. :map pc_spell_natural_m [0,1] == [Just (C,Natural),Nothing]?Erroring variant of >. Emap pc_spell_natural [0,5,7] == [(C,Natural),(F,Natural),(G,Natural)]@LUse spelling from simplest key-signature. Note that this is ambiguous for 8', which could be either G Sharp (&o) in A Major or A Flat (&m) in E Flat (&m) Major. -map pc_spell_ks [6,8] == [(F,Sharp),(A,Flat)]AUse always sharp (&o) spelling. map pc_spell_sharp [6,8] == [(F,Sharp),(G,Sharp)] Data.List.nub (map (snd . pc_spell_sharp) [1,3,6,8,10]) == [Sharp] octpc_to_pitch pc_spell_sharp (4,6) == Pitch F Sharp 4BUse always flat (&m) spelling. q map pc_spell_flat [6,8] == [(G,Flat),(A,Flat)] Data.List.nub (map (snd . pc_spell_flat) [1,3,6,8,10]) == [Flat]=>?@AB=>?@AB=>?@AB=>?@AB Safe-InferredCMaybe a of b.DMaybe c of b.CDCDCDCD Safe-Inferred Ed of predicates.Fe of predicates. alet r = [False,False,True,False,True,False] in map (predicate_all [(> 0),(< 5),even]) [0..5] == rGf of predicates.Hg of predicates. alet r = [True,False,True,False,True,True] in map (predicate_any [(== 0),(== 5),even]) [0..5] == rIR A R, ie. ((t -> c) -> (a -> b -> t) -> a -> b -> c.JR A I, ie. 2(t -> d) -> (a -> b -> c -> t) -> a -> b -> c -> d.KR A J.LR A K.MR A L. EFGHIJKLM EFGHIJKLM EFGHIJKLM EFGHIJKLMIJKLM Safe-InferredN&Common music notation durational modelPdivision of whole noteQnumber of dotsRtuplet modifierSAre multipliers equal?T)Compare durations with equal multipliers.UErroring variant of T.WASort a pair of equal type values using given comparison function. (sort_pair compare ('b','a') == ('a','b')Y#True if neither duration is dotted.Z7Sum undotted divisions, input is required to be sorted.[5Sum dotted divisions, input is required to be sorted. sum_dur_dotted (4,1,4,1) == Just (Duration 2 1 1) sum_dur_dotted (4,0,2,1) == Just (Duration 1 0 1) sum_dur_dotted (8,1,4,0) == Just (Duration 4 2 1) sum_dur_dotted (16,0,4,2) == Just (Duration 2 0 1)\`Sum durations. Not all durations can be summed, and the present algorithm is not exhaustive. import Music.Theory.Duration.Name sum_dur quarter_note eighth_note == Just dotted_quarter_note sum_dur dotted_quarter_note eighth_note == Just half_note sum_dur quarter_note dotted_eighth_note == Just double_dotted_quarter_note]Erroring variant of \.^Give MusicXML type for division. Dmap whole_note_division_to_musicxml_type [2,4] == ["half","quarter"]_ Variant of ^ extracting P from N. 3duration_to_musicxml_type quarter_note == "quarter"`Give Lilypond notation for N). Note that the duration multiplier is not written. mimport Music.Theory.Duration.Name map duration_to_lilypond_type [half_note,dotted_quarter_note] == ["2","4."]a.Calculate number of beams at notated division. .whole_note_division_to_beam_count 32 == Just 3bCalculate number of beams at N. ;map duration_beam_count [half_note,sixteenth_note] == [0,2]e Duration to **recip notation. 9http://humdrum.org/Humdrum/representations/recip.rep.html rlet d = map (\z -> Duration z 0 1) [0,1,2,4,8,16,32] in map duration_recip_pp d == ["0","1","2","4","8","16","32"] mlet d = [Duration 1 1 (1/3),Duration 4 1 1,Duration 4 1 (2/3)] in map duration_recip_pp d == ["3.","4.","6."]fh instance in terms of U.NOPQRSTUVWXYZ[\]^_`abcdefNOPQRSTUVWXYZ[\]^_`abcdeNOPQRSTUfVWXYZ[\]^_`abcdeNOPQRSTUVWXYZ[\]^_`abcdef Safe-Inferredghijklmnopqrstuvwxyz{ghijklmnopqrstuvwxyz{gmlkjihntsrqpou{zyxwvghijklmnopqrstuvwxyz{ Safe-Inferred|Rational Quarter-Note}}Rational quarter note to duration value. It is a mistake to hope this could handle tuplets directly since, for instance, a 3:2D dotted note will be of the same duration as a plain undotted note. /rq_to_duration (3/4) == Just dotted_eighth_note~Is | a cmn duration. ;map rq_is_cmn [1/4,1/5,1/8,3/32] == [True,False,True,False] Variant of } with error message.,Convert a whole note division integer to an | value. 6map whole_note_division_to_rq [1,2,4,8] == [4,2,1,1/2]Apply dots to an | duration. (map (rq_apply_dots 1) [1,2] == [3/2,7/4]Convert N to | value, see } for partial inverse. ^let d = [half_note,dotted_quarter_note,dotted_whole_note] in map duration_to_rq d == [2,3/2,6]i function for N via . 2half_note `duration_compare_rq` quarter_note == GT| modulo. -map (rq_mod (5/2)) [3/2,3/4,5/2] == [1,1/4,0]Is p divisible by q , ie. is the Y of p/q j 1. 5map (rq_divisible_by (3%2)) [1%2,1%3] == [True,False]Is | a whole number (ie. is Y j 1. 1map rq_is_integral [1,3/2,2] == [True,False,True]Return X of | if Y j 1. 4map rq_integral [1,3/2,2] == [Just 1,Nothing,Just 2](Derive the tuplet structure of a set of | values. yrq_derive_tuplet_plain [1/2] == Nothing rq_derive_tuplet_plain [1/2,1/2] == Nothing rq_derive_tuplet_plain [1/4,1/4] == Nothing rq_derive_tuplet_plain [1/3,2/3] == Just (3,2) rq_derive_tuplet_plain [1/2,1/3,1/6] == Just (6,4) rq_derive_tuplet_plain [1/3,1/6] == Just (6,4) rq_derive_tuplet_plain [2/5,3/5] == Just (5,4) rq_derive_tuplet_plain [1/3,1/6,2/5,1/10] == Just (30,16) map rq_derive_tuplet_plain [[1/3,1/6],[2/5,1/10]] == [Just (6,4) ,Just (10,8)](Derive the tuplet structure of a set of | values. rq_derive_tuplet [1/4,1/8,1/8] == Nothing rq_derive_tuplet [1/3,2/3] == Just (3,2) rq_derive_tuplet [1/2,1/3,1/6] == Just (3,2) rq_derive_tuplet [2/5,3/5] == Just (5,4) rq_derive_tuplet [1/3,1/6,2/5,1/10] == Just (15,8)Remove tuplet multiplier from value, ie. to give notated duration. This seems odd but is neccessary to avoid ambiguity. Ie. is 1 a quarter note or a 3:2 tuplet dotted-quarter-note etc. ;map (rq_un_tuplet (3,2)) [1,2/3,1/2,1/3] == [3/2,1,3/4,1/2]If an |* duration is un-representable by a single cmn duration, give tied notation. 7catMaybes (map rq_to_cmn [1..9]) == [(4,1),(4,3),(8,1)] 8map rq_to_cmn [5/4,5/8] == [Just (1,1/4),Just (1/2,1/8)]dPredicate to determine if a segment can be notated either without a tuplet or with a single tuplet. rq_can_notate [1/2,1/4,1/4] == True rq_can_notate [1/3,1/6] == True rq_can_notate [2/5,1/10] == True rq_can_notate [1/3,1/6,2/5,1/10] == False rq_can_notate [4/7,1/7,6/7,3/7] == True rq_can_notate [4/7,1/7,2/7] == True|}~|}~|}~|}~ Safe-Inferred Annotated N.4Standard music notation durational model annotationsDoes  begin a tuplet?Does  end a tuplet?Is  tied to the the right?Annotate a sequence of  as a tuplet. gimport Music.Theory.Duration.Name da_tuplet (3,2) [(quarter_note,[Tie_Left]),(eighth_note,[Tie_Right])]Transform predicates into k predicate such that if f holds then l, if g holds then m else n. 9map (begin_end_cmp (== '{') (== '}')) "{a}" == [LT,EQ,GT] Variant of  , predicates are constructed by j. 2map (begin_end_cmp_eq '{' '}') "{a}" == [LT,EQ,GT] Given an k predicate where l opens a group, m closes a group, and n4 continues current group, construct tree from list. plet {l = "a {b {c d} e f} g h i" ;t = group_tree (begin_end_cmp_eq '{' '}') l} in catMaybes (flatten t) == l dlet d = putStrLn . drawTree . fmap show in d (group_tree (begin_end_cmp_eq '(' ')') "a(b(cd)ef)ghi")Group tuplets into a o. Branch nodes have label P, leaf nodes label Q . .import Music.Theory.Duration.Name.Abbreviation let d = [(q,[]) ,(e,[Begin_Tuplet (3,2,e)]) ,(s,[Begin_Tuplet (3,2,s)]),(s,[]),(s,[End_Tuplet]) ,(e,[End_Tuplet]) ,(q,[])] in catMaybes (flatten (da_group_tuplets d)) == d Variant of p that places separator at left. Sbreak_left (== 3) [1..6] == ([1..3],[4..6]) break_left (== 3) [1..3] == ([1..3],[]) Variant of & that balances begin & end predicates. break_left (== ')') "test (sep) _) balanced" sep_balanced True (== '(') (== ')') "test (sep) _) balanced" sep_balanced False (== '(') (== ')') "(test (sep) _) balanced"AGroup non-nested tuplets, ie. groups nested tuplets at one level.Keep right variant of q!, unused rhs values are returned. Ezip_with_kr (,) [1..3] ['a'..'e'] == ([(1,'a'),(2,'b'),(3,'c')],"de")Keep right variant of r!, unused rhs values are returned. Dzip_kr [1..4] ['a'..'f'] == ([(1,'a'),(2,'b'),(3,'c'),(4,'d')],"ef")q* variant that adopts the shape of the lhs. let {p = [Left 1,Right [2,3],Left 4] ;q = "abcd"} in nn_reshape (,) p q == [Left (1,'a'),Right [(2,'b'),(3,'c')],Left (4,'d')]Replace elements at  Traversable1 with result of joining with elements from list. Variant of  that considers only Q elements at  Traversable. ilet {s = "a(b(cd)ef)ghi" ;t = group_tree (begin_end_cmp_eq '(' ')') s} in adopt_shape_m (,) [1..13] tDoes a have  and ?Does d have  and ? Safe-InferredA rational time signature is a  where the parts are V.,A composite time signature is a sequence of s.A Time Signature is a (numerator,denominator) pair.7Tied, non-multiplied durations to fill a whole measure. Pts_whole_note (3,8) == [dotted_quarter_note] ts_whole_note (2,2) == [whole_note]Duration of measure in |. -map ts_whole_note_rq [(3,8),(2,2)] == [3/2,4] Duration, in |, of a measure of indicated . "map ts_rq [(3,4),(5,8)] == [3,5/2]% derived from whole note duration in | form. 8map rq_to_ts [4,3/2,7/4,6] == [(4,4),(3,8),(7,16),(6,4)]#Uniform division of time signature. wts_divisions (3,4) == [1,1,1] ts_divisions (3,8) == [1/2,1/2,1/2] ts_divisions (2,2) == [2,2] ts_divisions (1,1) == [4]SConvert a duration to a pulse count in relation to the indicated time signature. *ts_duration_pulses (3,8) quarter_note == 20Rewrite time signature to indicated denominator. ts_rewrite 8 (3,4) == (6,8)Sum time signatures.  ts_sum [(3,16),(1,2)] == (11,16)The | is the s of  of the elements. cts_rq [(3,4),(1,8)] == 3 + 1/2The divisions are the t of the  of the elements. *cts_divisions [(3,4),(1,8)] == [1,1,1,1/2]1Pulses are 1-indexed, RQ locations are 0-indexed. Emap (cts_pulse_to_rq [(2,4),(1,8),(1,4)]) [1 .. 4] == [0,1,2,2 + 1/2]Variant that gives the window9 of the pulse (ie. the start location and the duration). elet r = [(0,1),(1,1),(2,1/2),(2 + 1/2,1)] in map (cts_pulse_to_rqw [(2,4),(1,8),(1,4)]) [1 .. 4] == rThe s of the RQ of the elements. Erts_rq [(3,4),(1,8)] == 3 + 1/2 rts_rq [(3/2,4),(1/2,8)] == 3/2 + 1/4The  divisions of the elements. Yrts_divisions [(3,4),(1,8)] == [1,1,1,1/2] rts_divisions [(3/2,4),(1/2,8)] == [1,1/2,1/4]1Pulses are 1-indexed, RQ locations are 0-indexed. map (rts_pulse_to_rq [(2,4),(1,8),(1,4)]) [1 .. 4] == [0,1,2,2 + 1/2] map (rts_pulse_to_rq [(3/2,4),(1/2,8),(1/4,4)]) [1 .. 4] == [0,1,3/2,7/4]Variant that gives the window9 of the pulse (ie. the start location and the duration). elet r = [(0,1),(1,1),(2,1/2),(2 + 1/2,1)] in map (rts_pulse_to_rqw [(2,4),(1,8),(1,4)]) [1 .. 4] == r Safe-Inferred!!!! Safe-Inferred7A tempo marking is in terms of a common music notation N.:Duration of a RQ value, in seconds, given indicated tempo. *rq_to_seconds (quarter_note,90) 1 == 60/90ZThe duration, in seconds, of a pulse at the indicated time signature and tempo marking. Oimport Music.Theory.Duration.Name pulse_duration (6,8) (quarter_note,60) == 1/2[The duration, in seconds, of a measure at the indicated time signaure and tempo marking. ^measure_duration (3,4) (quarter_note,90) == 2 measure_duration (6,8) (quarter_note,120) == 3/2u variant of .AItalian terms and markings from Wittner metronome (W.-Germany). http://wittner-gmbh.de/@Italian terms and markings from Nikko Seiki metronome (Japan). http://nikkoseiki.com/Lookup metronome mark in table. 2mm_name metronome_table_nikko 72 == Just "Andante" Safe-InferredRemove duplicate elements with v and then w. set_l [3,3,3,2,2,1] == [1,2,3]'Size of powerset of set of cardinality n, ie. 2 x n. )map n_powerset [6..9] == [64,128,256,512]!Powerset, ie. set of all subsets. osort (powerset [1,2]) == [[],[1],[1,2],[2]] map length (map (\n -> powerset [1..n]) [6..9]) == [64,128,256,512]Two element subsets. $pairs [1,2,3] == [(1,2),(1,3),(2,3)]Three element subsets. 3triples [1..4] == [(1,2,3),(1,2,4),(1,3,4),(2,3,4)] Plet f n = genericLength (triples [1..n]) == nk_combinations n 3 in all f [1..15])Set expansion (ie. to multiset of degree n). 7expand_set 4 [1,2,3] == [[1,1,2,3],[1,2,2,3],[1,2,3,3]]&All distinct multiset partitions, see y. Apartitions "aab" == [["aab"],["a","ab"],["b","aa"],["b","a","a"]] vpartitions "abc" == [["abc"] ,["bc","a"],["b","ac"],["c","ab"] ,["c","b","a"]]Cartesian product of two sets. _let r = [('a',1),('a',2),('b',1),('b',2),('c',1),('c',2)] in cartesian_product "abc" [1,2] == r Safe-Inferred  Safe-Inferred8Bjorklund's algorithm to construct a binary sequence of n bits with k ones such that the k8 ones are distributed as evenly as possible among the (n - k ) zeroes. kbjorklund (5,9) == [True,False,True,False,True,False,True,False,True] xdot (bjorklund (5,9)) == "x.x.x.x.x" let es = [(2,3),(2,5) ,(3,4),(3,5),(3,8) ,(4,7),(4,9),(4,12),(4,15) ,(5,6),(5,7),(5,8),(5,9),(5,11),(5,12),(5,13),(5,16) ,(6,7),(6,13) ,(7,8),(7,9),(7,10),(7,12),(7,15),(7,16),(7,17),(7,18) ,(8,17),(8,19) ,(9,14),(9,16),(9,22),(9,23) ,(11,12),(11,24) ,(13,24) ,(15,34)] in map (\e -> let e' = bjorklund e in (e,xdot e',iseq_str e')) es _[((2,3),"xx.","(12)") ,((2,5),"x.x..","(23)") ,((3,4),"xxx.","(112)") ,((3,5),"x.x.x","(221)") ,((3,8),"x..x..x.","(332)") ,((4,7),"x.x.x.x","(2221)") ,((4,9),"x.x.x.x..","(2223)") ,((4,12),"x..x..x..x..","(3333)") ,((4,15),"x...x...x...x..","(4443)") ,((5,6),"xxxxx.","(11112)") ,((5,7),"x.xx.xx","(21211)") ,((5,8),"x.xx.xx.","(21212)") ,((5,9),"x.x.x.x.x","(22221)") ,((5,11),"x.x.x.x.x..","(22223)") ,((5,12),"x..x.x..x.x.","(32322)") ,((5,13),"x..x.x..x.x..","(32323)") ,((5,16),"x..x..x..x..x...","(33334)") ,((6,7),"xxxxxx.","(111112)") ,((6,13),"x.x.x.x.x.x..","(222223)") ,((7,8),"xxxxxxx.","(1111112)") ,((7,9),"x.xxx.xxx","(2112111)") ,((7,10),"x.xx.xx.xx","(2121211)") ,((7,12),"x.xx.x.xx.x.","(2122122)") ,((7,15),"x.x.x.x.x.x.x..","(2222223)") ,((7,16),"x..x.x.x..x.x.x.","(3223222)") ,((7,17),"x..x.x..x.x..x.x.","(3232322)") ,((7,18),"x..x.x..x.x..x.x..","(3232323)") ,((8,17),"x.x.x.x.x.x.x.x..","(22222223)") ,((8,19),"x..x.x.x..x.x.x..x.","(32232232)") ,((9,14),"x.xx.xx.xx.xx.","(212121212)") ,((9,16),"x.xx.x.x.xx.x.x.","(212221222)") ,((9,22),"x..x.x..x.x..x.x..x.x.","(323232322)") ,((9,23),"x..x.x..x.x..x.x..x.x..","(323232323)") ,((11,12),"xxxxxxxxxxx.","(11111111112)") ,((11,24),"x..x.x.x.x.x..x.x.x.x.x.","(32222322222)") ,((13,24),"x.xx.x.x.x.x.xx.x.x.x.x.","(2122222122222)") ,((15,34),"x..x.x.x.x..x.x.x.x..x.x.x.x..x.x.","(322232223222322)")]xdot notation for pattern. %xdot (bjorklund (5,9)) == "x.x.x.x.x"The & of a pattern is the distance between z values. %iseq (bjorklund (5,9)) == [2,2,2,2,1] of pattern as compact string. 'iseq_str (bjorklund (5,9)) == "(22221)"{|}~{|}~! Safe-Inferred;Comparison function type.,Bracket sequence with left and right values. &bracket ('<','>') "1,2,3" == "<1,2,3>"%Variant where brackets are sequences. ,bracket_l ("<:",":>") "1,2,3" == "<:1,2,3:>"Generic form of .Left rotation. Crotate_left 1 [1..3] == [2,3,1] rotate_left 3 [1..5] == [4,5,1,2,3]Generic form of .Right rotation.  rotate_right 1 [1..3] == [3,1,2]Rotate left by n \ #p places. 9rotate 1 [1..3] == [2,3,1] rotate 8 [1..5] == [4,5,1,2,3]Rotate right by n places.  rotate_r 8 [1..5] == [3,4,5,1,2]All rotations. .rotations [0,1,3] == [[0,1,3],[1,3,0],[3,0,1]]Generic form of .;Adjacent elements of list, at indicated distance, as pairs. hadj2 1 [1..5] == [(1,2),(2,3),(3,4),(4,5)] adj2 2 [1..4] == [(1,2),(3,4)] adj2 3 [1..5] == [(1,2),(4,5)]$Append first element to end of list. close [1..3] == [1,2,3,1] A . +adj2_cyclic 1 [1..3] == [(1,2),(2,3),(3,1)]Interleave elements of p and q. ginterleave [1..3] [4..6] == [1,4,2,5,3,6] interleave ".+-" "abc" == ".a+b-c" interleave [1..3] [] == []-Variant that continues with the longer input. {interleave_continue ".+-" "abc" == ".a+b-c" interleave_continue [1..3] [] == [1..3] interleave_continue [] [1..3] == [1..3] of  by i and j. ainterleave_rotations 9 3 [1..13] == [10,4,11,5,12,6,13,7,1,8,2,9,3,10,4,11,5,12,6,13,7,1,8,2,9,3]%Count occurences of elements in list. &histogram "hohoh" == [('h',3),('o',2)]List segments of length i at distance j. Usegments 2 1 [1..5] == [[1,2],[2,3],[3,4],[4,5]] segments 2 2 [1..5] == [[1,2],[3,4]] . .intersect_l [[1,2],[1,2,3],[1,2,3,4]] == [1,2] . +sort (union_l [[1,3],[2,3],[3]]) == [1,2,3] 6Intersection of adjacent elements of list at distance n. <adj_intersect 1 [[1,2],[1,2,3],[1,2,3,4]] == [[1,2],[1,2,3]] List of cycles at distance n. ~cycles 2 [1..6] == [[1,3,5],[2,4,6]] cycles 3 [1..9] == [[1,4,7],[2,5,8],[3,6,9]] cycles 4 [1..8] == [[1,5],[2,6],[3,7],[4,8]] Given accesors for key and value collate input. alet r = [('A',"a"),('B',"bd"),('C',"ce"),('D',"f")] in collate_on fst snd (zip "ABCBCD" "abcdef")   of  and . 1collate (zip [1,2,1] "abc") == [(1,"ac"),(2,"b")] Make assoc list with given key. 0with_key 'a' [1..3] == [('a',1),('a',2),('a',3)]Intervals to values, zero is n. dx_d 5 [1,2,3] == [5,6,8,11]bVariant that takes initial value and separates final value. This is an appropriate function for . >dx_d' 5 [1,2,3] == (11,[5,6,8]) dx_d' 0 [1,1,1] == (3,[0,1,2])8Integrate, ie. pitch class segment to interval sequence. (d_dx [5,6,8,11] == [1,2,3] d_dx [] == [] Elements of p not in q. ![1,2,3] `difference` [1,2] == [3]Is p a subset of q , ie. is  of p and q j p. is_subset [1,2] [1,2,3] == TrueIs p a superset of q, ie.  . !is_superset [1,2,3] [1,2] == TrueIs p a subsequence of q, ie. synonym for . !subsequence [1,2] [1,2,3] == True Variant of  that requires e to be unique in p. *elem_index_unique 'a' "abcda" == undefined Basis of f. There is an option to consider the last element specially, and if equal to the last span is given.JFind adjacent elements of list that bound element under given comparator. wlet {f = find_bounds True compare [1..5] ;r = [Nothing,Just (1,2),Just (3,4),Just (4,5)]} in map f [0,1,3.5,5] == r Variant of  from right of list. dropRight 1 [1..9] == [1..8] Variant of  from right of list. .dropWhileRight Data.Char.isDigit "A440" == "A"Apply f at first element, and g at all other elements. (at_head negate id [1..5] == [-1,2,3,4,5]Apply f at all but last element, and g at last element. )at_last (* 2) negate [1..4] == [2,4,6,-4]<Separate list into an initial list and a last element tuple. "separate_last [1..5] == ([1..4],5)(Replace directly repeated elements with P. Cindicate_repetitions "abba" == [Just 'a',Just 'b',Nothing,Just 'a'] does not make adjacent comparisons, it compares each new element to the start of the group. This function is the adjacent variant. xgroupBy (<) [1,2,3,2,4,1,5,9] == [[1,2,3,2,4],[1,5,9]] adjacent_groupBy (<) [1,2,3,2,4,1,5,9] == [[1,2,3],[2,4],[1,5,9]] on  structure of T , ie. all Q compare equal. nlet r = [[Just 1],[Nothing,Nothing],[Just 4,Just 5]] in group_just [Just 1,Nothing,Nothing,Just 4,Just 5] == r 7Predicate to determine if all elements of the list are j.! of . qlet r = [[('1','a'),('1','c')],[('2','d')],[('3','b'),('3','e')]] in sort_group_on fst (zip "13123" "abcde") == r"Maybe cons element onto list. UNothing `mcons` "something" == "something" Just 's' `mcons` "omething" == "something"#If f compares n , defer to g.$Invert k.%Sort sequence a based on ordering of sequence b. Esort_to "abc" [1,3,2] == "acb" sort_to "adbce" [1,4,2,3,5] == "abcde"& of %. &sort_on [1,4,2,3,5] "adbce" == "abcde"' of #.(7Given a comparison function, merge two ascending lists. 'mergeBy compare [1,3,5] [2,4] == [1..5]) of #.*mergeBy i.+WMerge list of sorted lists given comparison function. Note that this is not equal to .,+ of i. 1merge_set [[1,3,5,7,9],[2,4,6,8],[10]] == [1..10]-(. variant that joins (resolves) equal elements. 3let {left p _ = p ;right _ q = q ;cmp = compare `on` fst ;p = zip [1,3,5] "abc" ;q = zip [1,2,3] "ABC" ;left_r = [(1,'a'),(2,'B'),(3,'b'),(5,'c')] ;right_r = [(1,'A'),(2,'B'),(3,'C'),(5,'c')]} in merge_by_resolve left cmp p q == left_r && merge_by_resolve right cmp p q == right_r.Apply f& to both elements of a two-tuple, ie. bimap f f.;      !"#$%&'()*+,-.;      !"#$%&'()*+,-.;      !"#$%&'()*+,-.;      !"#$%&'()*+,-." Safe-Inferred9/Container for values that have on and off modes.2 Variant of 7 where nodes have an Intepolation_T value.6)Window sequence. The temporal field is (time,duration). Holes exist where  t(n) + d(n)  t(n+1).. Overlaps exist where the same relation is .7'Time-point sequence. To express holes a must have a empty6 value. To indicate the duration of the final value a must have an nil (end of sequence) value.8/Pattern sequence. The duration is a triple of logical, sounding and forward durations.95Inter-offset sequence. The duration is the interval before: the value. To indicate the duration of the final value a must have an nil (end of sequence) value.:(Duration sequence. The duration is the forwardK duration of the value, if it has other durations they must be encoded at a.;+Sequence of elements with uniform duration.>RGiven functions for deriving start and end times calculate time span of sequence. Iseq_tspan id id [] == (0,0) seq_tspan id id (zip [0..9] ['a'..]) == (0,9)DThe interval of ?. "tseq_dur (zip [0..] "abcde|") == 5EThe interval of @. 2wseq_dur (zip (zip [0..] (repeat 2)) "abcde") == 6F4Keep only elements in the indicated temporal window. {let r = [((5,1),'e'),((6,1),'f'),((7,1),'g'),((8,1),'h')] in wseq_twindow (5,9) (zip (zip [1..10] (repeat 1)) ['a'..]) == rJMerge comparing only on time.K,Merge, where times are equal compare values.L#Merge, where times are equal apply f to form a single value. let {p = zip [1,3,5] "abc" ;q = zip [1,2,3] "ABC" ;left_r = [(1,'a'),(2,'B'),(3,'b'),(5,'c')] ;right_r = [(1,'A'),(2,'B'),(3,'C'),(5,'c')]} in tseq_merge_resolve (\x _ -> x) p q == left_r && tseq_merge_resolve (\_ x -> x) p q == right_rSLinear interpolation.T Temporal map.UThis can give P if t precedes the 2 or if t is after the final element of 28 and that element has an interpolation type other than 5.V ing variant.YMap t and e simultaneously.] variant.^ Variant of ._$If value is unchanged, according to f, replace with P. ~let r = [(1,'s'),(2,'t'),(4,'r'),(6,'i'),(7,'n'),(9,'g')] in seq_cat_maybes (seq_changed_by (==) (zip [1..] "sttrrinng")) == r`_ j.aApply f at time points of 6.bApply f at durations of elements of 6.c#Given a function that determines a voice0 for a value, partition a sequence into voices.dType specialised c. let {p = zip [0,1,3,5] (zip (repeat 0) "abcd") ;q = zip [2,4,6,7] (zip (repeat 1) "ABCD") ;sq = tseq_merge p q} in tseq_partition fst sq == [(0,p),(1,q)]fTGiven a decision predicate and a join function, recursively join adjacent elements. coalesce_f undefined undefined [] == [] coalesce_f (==) const "abbcccbba" == "abcba" coalesce_f (==) (+) [1,2,2,3,3,3] == [1,4,6,3]gf using G for the join function.hForm of f) where the decision predicate is on the element, and a join function sums the times. plet r = [(1,'a'),(2,'b'),(3,'c'),(2,'d'),(1,'e')] in seq_coalesce (==) const (useq_to_dseq (1,"abbcccdde")) == rjGiven equality@ predicate, simplify sequence by summing durations of adjacent equal' elements. This is a special case of i where the join function is 4. The implementation is simpler and non-recursive. hlet {d = useq_to_dseq (1,"abbcccdde") ;r = dseq_coalesce (==) const d} in dseq_coalesce' (==) d == ro Post-process  of cmp  . \let r = [(0,"a"),(1,"bc"),(2,"de"),(3,"f")] in group_f (==) (zip [0,1,1,2,2,3] ['a'..]) == rp"Group values at equal time points. Zlet r = [(0,"a"),(1,"bc"),(2,"de"),(3,"f")] in tseq_group (zip [0,1,1,2,2,3] ['a'..]) == rq,Group values where the inter-offset time is 0 to the left. Slet r = [(0,"a"),(1,"bcd"),(1,"ef")] in iseq_group (zip [0,1,0,0,1,0] ['a'..]) == rr4Set durations so that there are no gaps or overlaps. ]let r = wseq_zip [0,3,5] [3,2,1] "abc" in wseq_fill_dur (wseq_zip [0,3,5] [2,1,1] "abc") == rt0Scale by lcm so that all durations are integral.uGiven a a default value, a 7 sq and a list of time-points t7, generate a Tseq that is a union of the timepoints at sq and t where times in t not at sq are given the current value, or def if there is no value. =tseq_latch 'a' [(2,'b'),(4,'c')] [1..5] == zip [1..5] "abbcc"v Transform 6 to 7 by discaring durations.wEdit durations to ensure that notes don't overlap. If the same note is played simultaneously delete shorter note. If a note extends into a later note shorten duration (apply d_fn to iot).x;Unjoin elements (assign equal time stamps to all elements).yType specialised.zStructural comparison at /, 1 compares less than 0.{Translate container types.|Translate container types.}Convert 6 to 7 transforming elements to 1 and 0 parts. When merging, off elements precede on elements at equal times. tlet {sq = [((0,5),'a'),((2,2),'b')] ;r = [(0,On 'a'),(2,On 'b'),(4,Off 'b'),(5,Off 'a')]} in wseq_on_off sq == r let {sq = [((0,1),'a'),((1,1),'b'),((2,1),'c')] ;r = [(0,On 'a'),(1,Off 'a') ,(1,On 'b'),(2,Off 'b') ,(2,On 'c'),(3,Off 'c')]} in wseq_on_off sq == r~| of }.Variant that applies on and off functions to nodes. }let {sq = [((0,5),'a'),((2,2),'b')] ;r = [(0,'A'),(2,'B'),(4,'b'),(5,'a')]} in wseq_on_off_f Data.Char.toUpper id sq == r Inverse of }. given a predicate function for locating the off node of an on node. let {sq = [(0,On 'a'),(2,On 'b'),(4,Off 'b'),(5,Off 'a')] ;r = [((0,5),'a'),((2,2),'b')]} in tseq_on_off_to_wseq (==) sq == r+The conversion requires a start time and a nil value used as an eof4 marker. Productive given indefinite input sequence. Wlet r = zip [0,1,3,6,8,9] "abcde|" in dseq_to_tseq 0 '|' (zip [1,2,3,2,1] "abcde") == r }let {d = zip [1,2,3,2,1] "abcde" ;r = zip [0,1,3,6,8,9,10] "abcdeab"} in take 7 (dseq_to_tseq 0 undefined (cycle d)) == rVariant where the nil. is take as the last element of the sequence. Xlet r = zip [0,1,3,6,8,9] "abcdee" in dseq_to_tseq_last 0 (zip [1,2,3,2,1] "abcde") == r?The conversion requires a start time and does not consult the logical duration. let p = pseq_zip (repeat undefined) (cycle [1,2]) (cycle [1,1,2]) "abcdef" in pseq_to_wseq 0 p == wseq_zip [0,1,2,4,5,6] (cycle [1,2]) "abcdef"The last element of 7 is required to be an eof< marker that has no duration and is not represented in the :. [let r = zip [1,2,3,2,1] "abcde" in tseq_to_dseq undefined (zip [0,1,3,6,8,9] "abcde|") == r Rlet r = zip [1,2,3,2,1] "-abcd" in tseq_to_dseq '-' (zip [1,3,6,8,9] "abcd|") == rThe last element of 7 is required to be an eof< marker that has no duration and is not represented in the 6G. The duration of each value is either derived from the value, if an dur3 function is given, or else the inter-offset time. jlet r = wseq_zip [0,1,3,6,8] [1,2,3,2,1] "abcde" in tseq_to_wseq Nothing (zip [0,1,3,6,8,9] "abcde|") == r }let r = wseq_zip [0,1,3,6,8] (map fromEnum "abcde") "abcde" in tseq_to_wseq (Just fromEnum) (zip [0,1,3,6,8,9] "abcde|") == rRequires start time. dlet r = zip (zip [0,1,3,6,8,9] [1,2,3,2,1]) "abcde" in dseq_to_wseq 0 (zip [1,2,3,2,1] "abcde") == r Inverse of . The empty! value is used to fill holes in 6. If values overlap at 6 durations are truncated. clet w = wseq_zip [0,1,3,6,8,9] [1,2,3,2,1] "abcde" in wseq_to_dseq '-' w == zip [1,2,3,2,1] "abcde" Plet w = wseq_zip [3,10] [6,2] "ab" in wseq_to_dseq '-' w == zip [3,6,1,2] "-a-b" Ilet w = wseq_zip [0,1] [2,2] "ab" in wseq_to_dseq '-' w == zip [1,2] "ab" Qlet w = wseq_zip [0,0,0] [2,2,2] "abc" in wseq_to_dseq '-' w == zip [0,0,2] "abc"Given a list of :! (measures) convert to a list of 7+ and the end time of the overall sequence. let r = [[(0,'a'),(1,'b'),(3,'c')],[(4,'d'),(7,'e'),(9,'f')]] in dseql_to_tseql 0 [zip [1,2,1] "abc",zip [3,2,1] "def"] == (10,r)q/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~q/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~q;:9876<=>?@ABCDEFGHIJKLMNOPQR3542STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy/10z{|}~m/1023546789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~# Safe-Inferred#Optional header row then data rows.Append k to the right of l until result has n places.Append k to each row of tbl4 as required to be regular (all rows equal length).Delete trailing  where  holds.,Join second table to right of initial table.2Add a row number column at the front of the table.KMarkdown table, perhaps with header. Table is in row order. Options are: pad_left. Gmd_table_opt False (Nothing,[["a","bc","def"],["ghij","klm","no","p"]]) of .Variant relying on I instances. -md_table_show Nothing [[1..4],[5..8],[9..12]]Variant in column order (ie. ). <md_table_column_order [["a","bc","def"],["ghij","klm","no"]] Two-tuple  variant. Three-tuple  variant.rMatrix form, ie. header in both first row and first column, in each case displaced by one location which is empty. Rlet t = md_matrix "" (map return "abc") (map (map show) [[1,2,3],[2,3,1],[3,1,2]]) putStrLn $ unlines $ md_table' t- - - - a b ca 1 2 3b 2 3 1c 3 1 2- - - - Variant for  tables where nil7 is the empty string and the header cells are in bold.$ Safe-Inferred    % Safe-Inferred/#Midi note number with cents detune.5Generalised pitch, given by a generalised alteration."Common music notation pitch value. and  duple.0Octaves are integers, the octave of middle C is 4.)Pitch classes are modulo twelve integers.Pretty printer for . printed without octave. Simplify , to standard 12ET by deleting quarter tones. Vlet p = Pitch A QuarterToneSharp 4 in alteration (pitch_clear_quarter_tone p) == Sharp to  and  notation. )pitch_to_octpc (Pitch F Sharp 4) == (4,6)Is  12-ET. to midi note number notation. 'pitch_to_midi (Pitch A Natural 4) == 69) to fractional midi note number notation. 3pitch_to_fmidi (Pitch A QuarterToneSharp 4) == 69.5Extract  of  Gpitch_to_pc (Pitch A Natural 4) == 9 pitch_to_pc (Pitch F Sharp 4) == 6 comparison, implemented via . Dpitch_compare (Pitch A Natural 4) (Pitch A QuarterToneSharp 4) == LTGiven  function translate from  notation to . Normalise  value, ie. ensure  is in (0,11). octpc_nrm (4,16) == (5,4) Transpose  value. :octpc_trs 7 (4,9) == (5,4) octpc_trs (-11) (4,9) == (3,10) value to integral midi note number. octpc_to_midi (4,9) == 69] of . Inverse of . midi_to_octpc 69 == (4,9)Enumerate range, inclusive. Doctpc_range ((3,8),(4,1)) == [(3,8),(3,9),(3,10),(3,11),(4,0),(4,1)]Midi note number to . Xlet r = ["C4","E&m4","F&o4"] in map (pitch_pp . midi_to_pitch pc_spell_ks) [60,63,66] == rFractional midi note number to . import Music.Theory.Pitch.Spelling pitch_pp (fmidi_to_pitch pc_spell_ks 65.5) == "F24" pitch_pp (fmidi_to_pitch pc_spell_ks 66.5) == "F04" pitch_pp (fmidi_to_pitch pc_spell_ks 67.5) == "A-4" pitch_pp (fmidi_to_pitch pc_spell_ks 69.5) == "B-4"Composition of  and then . Kimport Music.Theory.Pitch.Name as T import Music.Theory.Pitch.Spelling as T -pitch_tranpose T.pc_spell_ks 2 T.ees5 == T.f5Set octave of p2 so that it nearest to p1. #import Music.Theory.Pitch.Name as T plet {r = ["B1","C2","C#2"];f = pitch_in_octave_nearest T.cis2} in map (pitch_pp_iso . f) [T.b4,T.c4,T.cis4] == rRaise $ of #, account for octave transposition. 9pitch_note_raise (Pitch B Natural 3) == Pitch C Natural 4Lower $ of #, account for octave transposition. 3pitch_note_lower (Pitch C Flat 4) == Pitch B Flat 3Rewrite  to not use 3/4$ tone alterations, ie. re-spell to 1/4 alteration. |let {p = Pitch A ThreeQuarterToneFlat 4 ;q = Pitch G QuarterToneSharp 4} in pitch_rewrite_threequarter_alteration p == qApply function to  of . @pitch_edit_octave (+ 1) (Pitch A Natural 4) == Pitch A Natural 5Midi" note number to cycles per second. 4map midi_to_cps [60,69] == [261.6255653005986,440.0] Fractional midi" note number to cycles per second. 7map fmidi_to_cps [69,69.1] == [440.0,442.5488940698553] of .!Frequency (cycles per second) to midi note number, ie.  of . &map cps_to_midi [261.6,440] == [60,69],Frequency (cycles per second) to fractional midi note number. Acps_to_fmidi 440 == 69 cps_to_fmidi (fmidi_to_cps 60.25) == 60.25Frequency (in hertz) to . Imap (fmap round . cps_to_midi_detune) [440.00,508.35] == [(69,0),(71,50)] Inverse of . of . octpc_to_cps (4,9) == 440 of .Slight generalisation of ISO pitch representation. Allows octave to be elided, pitch names to be lower case, and double sharps written as ##.See 7http://www.musiccog.ohio-state.edu/Humdrum/guide04.html let r = [Pitch C Natural 4,Pitch A Flat 5,Pitch F DoubleSharp 6] in mapMaybe (parse_iso_pitch_oct 4) ["C","Ab5","f##6",""] == r Variant of  requiring octave.Pretty printer for  (unicode, see 8). Qpitch_pp (Pitch E Flat 4) == "E&m4" pitch_pp (Pitch F QuarterToneSharp 3) == "F23" printed without octave.Sequential list of n! pitch class names starting from k. (pitch_class_names_12et 11 2 == ["B","C"]Pretty printer for  (ISO, ASCII, see :). Tpitch_pp_iso (Pitch E Flat 4) == "Eb4" pitch_pp_iso (Pitch F DoubleSharp 3) == "Fx3"Pretty printer for  (ASCII, see ;). pitch_pp_hly (Pitch E Flat 4) == "ees4" pitch_pp_hly (Pitch F QuarterToneSharp 3) == "fih3" pitch_pp_hly (Pitch B Natural 6) == "b6"Pretty printer for  (Tonhhe, see ;). pitch_pp_tonh (Pitch E Flat 4) == "Es4" pitch_pp_tonh (Pitch F QuarterToneSharp 3) == "Fih3" pitch_pp_tonh (Pitch B Natural 6) == "H6"6561& Safe-InferredX      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHX      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHX      &%$#"!'-,+*)(.43210/5;:9876<BA@?>=CIHGFEDJPONMLKQWVUTSRX^]\[ZY_edcba`flkjihgmsrqpontzyxwvu{~}|     "! #)('&%$*0/.-,+17654328>=<;:9?EDCBA@FHGX      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH' Safe-InferredIClef with octave offset.MClef enumeration type.SGive clef range as a 6 pair indicating the notes below and above the staff. \map clef_range [Treble,Bass] == [Just (d4,g5),Just (f2,b3)] clef_range Percussion == NothingT Suggest a I given a . :map clef_suggest [c2,c4] == [Clef Bass (-1),Clef Treble 0]USet L to 0.VSet L to be no further than r from 0.IJKLMNOPQRSTUVIJKLMNOPQRSTUVMRQPONIJKLSTUVIJKLMRQPONSTUV( Safe-InferredWVoice & part number.XTable giving ranges for Ys.Y Voice types.^"Single character abbreviation for Y._ Standard Clef for Y.`$More or less standard choir ranges,  inclusive.aMore conservative ranges,  inclusive.bErroring variant.cLookup voice range table.dLookup `.eLookup a.fIs p  l and  r.gIs p in range for v, (std & safe). )map (in_voice_rng T.c4) [Bass .. Soprano]hGiven tbl list Ys that can sing .istd variant.jsafe variant.kEnumeration of SATB voices.l Names of k.m^ of k as s.nk part choir, ordered by voice.on grouped in parts. map (map part_nm) (ch_parts 8)pAbreviated name for part. part_nm (Soprano,1) == "S1"qk SATB choirs, grouped by choir.  k_ch_groups 2rt of q.sTwo k! part SATB choirs in score order. %map part_nm (concat (dbl_ch_parts 8))t_ for Ws.WXYZ[\]^_`abcdefghijklmnopqrstWXYZ[\]^_`abcdefghijklmnopqrstY]\[Z^_X`abcdefghijklmWnopqrstWXY]\[Z^_`abcdefghijklmnopqrst) Safe-Inferredu$Common music notation interval. An k of l# indicates an ascending interval, m a descending interval, and n a unison.{Interval quality.Interval type or degree.Interval type between $ values. ,map (interval_ty C) [E,B] == [Third,Seventh]'Table of interval qualities. For each = gives directed semitone interval counts for each allowable {. For lookup function see , for reverse lookup see .Lookup { for given  and semitone count. interval_q Unison 11 == Just Diminished interval_q Third 5 == Just Augmented interval_q Fourth 5 == Just Perfect interval_q Unison 3 == NothingLookup semitone difference of  with {. Xinterval_q_reverse Third Minor == Just 3 interval_q_reverse Unison Diminished == Just 11Semitone difference of u. interval_semitones (interval (Pitch C Sharp 4) (Pitch E Sharp 5)) == 16 interval_semitones (interval (Pitch C Natural 4) (Pitch D Sharp 3)) == -9Inclusive set of $3 within indicated interval. This is not equal to  which is not circular. Jnote_span E B == [E,F,G,A,B] note_span B D == [B,C,D] enumFromTo B D == []Invert k, ie. m becomes l and vice versa. ,map invert_ordering [LT,EQ,GT] == [GT,EQ,LT] Determine u between two es. interval (Pitch C Sharp 4) (Pitch D Flat 4) == Interval Second Diminished EQ 0 interval (Pitch C Sharp 4) (Pitch E Sharp 5) == Interval Third Major LT 1Apply  to y of u. Hinvert_interval (Interval Third Major LT 1) == Interval Third Major GT 1/The signed difference in semitones between two {" values when applied to the same A. Can this be written correctly without knowing the Interval_T? quality_difference_m Minor Augmented == Just 2 quality_difference_m Augmented Diminished == Just (-3) quality_difference_m Major Perfect == NothingErroring variant of . Transpose a  by an u. Ntranspose (Interval Third Diminished LT 0) (Pitch C Sharp 4) == Pitch E Flat 4QMake leftwards (perfect fourth) and and rightwards (perfect fifth) circles from . elet c = circle_of_fifths (Pitch F Sharp 4) in map pitch_to_pc (snd c) == [6,1,8,3,10,5,12,7,2,9,4,11]EParse a positive integer into interval type and octave displacement. 1mapMaybe parse_interval_type (map show [1 .. 15]) Parse interval quality notation. AmapMaybe parse_interval_quality "dmPMA" == [minBound .. maxBound]>Degree of interval type and octave displacement. Inverse of . Fmap interval_type_degree [(Third,0),(Second,1),(Unison,2)] == [3,9,15]#Inverse of 'parse_interval_quality..Parse standard common music interval notation. let i = mapMaybe parse_interval (words "P1 d2 m2 M2 A3 P8 +M9 -M2") in unwords (map interval_pp i) == "P1 d2 m2 M2 A3 P8 M9 -M2" PmapMaybe (fmap interval_octave . parse_interval) (words "d1 d8 d15") == [-1,0,1])Pretty printer for intervals, inverse of .Standard names for the intervals within the octave, divided into perfect, major and minor at the left, and diminished and augmented at the right. zlet {bimap f (p,q) = (f p,f q) ;f = mapMaybe (fmap interval_semitones . parse_interval)} in bimap f std_interval_names(uvwxyz{|}~(uvwxyz{|}~({~}|uvwxyzuvwxyz{~}|* Safe-Inferred+ Safe-InferredBSimplest spelling for semitone intervals. This is ambiguous for 6 which could be either aug.4 or dim.5. Ki_to_interval 6 == Interval Fourth Augmented LT 0 map i_to_interval [0..11]aPerform some interval simplifications. For non-tonal music some spellings are poor, ie. (f,g#). interval_simplify (Interval Second Augmented LT 0) == Interval Third Minor LT 0 interval_simplify (Interval Seventh Augmented GT 0) == Interval Unison Perfect GT 1, Safe-Inferred!A common music notation key is a $, ,  triple.+Enumeration of common music notation modes.2Distance along circle of fifths path of indicated ]. A positive number indicates the number of sharps, a negative number the number of flats. ukey_fifths (A,Natural,Minor_Mode) == 0 key_fifths (A,Natural,Major_Mode) == 3 key_fifths (C,Natural,Minor_Mode) == -3- Safe-Inferred&Spelling table for chromatic clusters. ^let f (p,q) = p == sort (map (snd . pitch_to_octpc) q) in all f spell_cluster_c4_table == TrueKSpelling for chromatic clusters. Sequence must be ascending. Pitch class 0 maps to , if there is no 0 then all notes are in octave 4. glet f = fmap (map pitch_pp) . spell_cluster_c4 in map f [[11,0],[11]] == [Just ["B3","C4"],Just ["B4"]] Cfmap (map pitch_pp) (spell_cluster_c4 [10,11]) == Just ["A&o4","B4"] Variant of  that runs . An octave of 4 is the identitiy, 3 an octave below, 5 an octave above. fmap (map pitch_pp) (spell_cluster_c 3 [11,0]) == Just ["B2","C3"] fmap (map pitch_pp) (spell_cluster_c 3 [10,11]) == Just ["A&o3","B3"] Variant of  that runs 7 so that the left-most note is in the octave given by f. import Data.Maybe let {f n = if n >= 11 then 3 else 4 ;g = map pitch_pp .fromJust . spell_cluster_f f ;r = [["B3","C4"],["B3"],["C4"],["A&o4","B4"]]} in map g [[11,0],[11],[0],[10,11]] == r Variant of  that runs * so that the left-most note is in octave o. fmap (map pitch_pp) (spell_cluster_left 3 [11,0]) == Just ["B3","C4"] fmap (map pitch_pp) (spell_cluster_left 3 [10,11]) == Just ["A&o3","B3"].NoneFactorial function. (factorial 13,maxBound::Int) Number of k" element permutations of a set of n elements. 7(nk_permutations 4 3,nk_permutations 13 3) == (24,1716) Number of nk permutations where n j k. fmap n_permutations [1..8] == [1,2,6,24,120,720,5040,40320] n_permutations 16 `div` 1000000 == 20922789Generate the permutation from p to q-, ie. the permutation that, when applied to p, gives q. Bapply_permutation (permutation [0,1,3] [1,0,3]) [0,1,3] == [1,0,3]Apply permutation f to p. Olet p = permutation [1..4] [4,3,2,1] in apply_permutation p [1..4] == [4,3,2,1]Composition of  and . apply_permutation_c [[0,3],[1,2]] [1..4] == [4,3,2,1] apply_permutation_c [[0,2],[1],[3,4]] [1..5] == [3,2,1,5,4] apply_permutation_c [[0,1,4],[2,3]] [1..5] == [2,5,4,3,1] apply_permutation_c [[0,1,3],[2,4]] [1..5] == [2,4,5,1,3]True if the inverse of p is p. 4non_invertible (permutation [0,1,3] [1,0,3]) == True _let p = permutation [1..4] [4,3,2,1] in non_invertible p == True && P.cycles p == [[0,3],[1,2]]'Generate a permutation from the cycles c. ?apply_permutation (from_cycles [[0,1,2,3]]) [1..4] == [2,3,4,1]"Generate all permutations of size n. map one_line (permutations_n 3) == [[1,2,3],[1,3,2] ,[2,1,3],[2,3,1] ,[3,1,2],[3,2,1]]Composition of q then p. let {p = from_cycles [[0,2],[1],[3,4]] ;q = from_cycles [[0,1,4],[2,3]] ;r = p `compose` q} in apply_permutation r [1,2,3,4,5] == [2,4,5,1,3]Two line notation of p. ;two_line (permutation [0,1,3] [1,0,3]) == ([1,2,3],[2,1,3])One line notation of p. 1one_line (permutation [0,1,3] [1,0,3]) == [2,1,3] map one_line (permutations_n 3) == [[1,2,3],[1,3,2] ,[2,1,3],[2,3,1] ,[3,1,2],[3,2,1]] Variant of  that produces a compact string. 7one_line_compact (permutation [0,1,3] [1,0,3]) == "213" Ylet p = permutations_n 3 in unwords (map one_line_compact p) == "123 132 213 231 312 321"(Multiplication table of symmetric group n. Gunlines (map (unwords . map one_line_compact) (multiplication_table 3)) ==> 123 132 213 231 312 321 132 123 312 321 213 231 213 231 123 132 321 312 231 213 321 312 123 132 312 321 132 123 231 213 321 312 231 213 132 123 /None Number of k" element combinations of a set of n elements. 6(nk_combinations 6 3,nk_combinations 13 3) == (20,286)k element subsets of s. pcombinations 3 [1..4] == [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] length (combinations 3 [1..5]) == nk_combinations 5 30NoneGenerate all permutations. Vpermutations [0,3] == [[0,3],[3,0]] length (permutations [1..5]) == P.n_permutations 52Generate all distinct permutations of a multi-set. :multiset_permutations [0,1,1] == [[0,1,1],[1,1,0],[1,0,1]]1None0HFunction to test is a partial sequence conforms to the target sequence.rFunction to perhaps generate an element and a new state from an initial state. This is the function provided to . Description notation of contour.!Half matrix notation for contour.A list notation for matrices. Replace the i th value at ns with x. replace "test" 2 'n' == "tent"Are all elements equal. all_equal "aaa" == True0Compare adjacent elements (p.262) left to right. (compare_adjacent [0,1,3,2] == [LT,LT,GT]Construct set of n  1$ adjacent indices, left right order. /adjacent_indices 5 == [(0,1),(1,2),(2,3),(3,4)]All (i,j) indices, in half matrix order. 6all_indices 4 == [(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)]Generic variant of  (p.263).Generic variant of  (p.263). Specialised . Specialised .Invert k. 'map ord_invert [LT,EQ,GT] == [GT,EQ,LT]Apply f to construct  from sequence. matrix_f (,) [1..3] == [[(1,1),(1,2),(1,3)] ,[(2,1),(2,2),(2,3)] ,[(3,1),(3,2),(3,3)]] Construct  with i (p.263). ;contour_matrix [1..3] == [[EQ,LT,LT],[GT,EQ,LT],[GT,GT,EQ]]Half & of contour given comparison function f. half_matrix_f (flip (-)) [2,10,6,7] == [[8,4,5],[-4,-3],[1]] half_matrix_f (flip (-)) [5,0,3,2] == [[-5,-2,-3],[3,2],[-1]] half_matrix_f compare [5,0,3,2] == [[GT,GT,GT],[LT,LT],[GT]] Construct  (p.264)I function for . Construct  of contour (p.264). \let c = [[3,2,4,1],[3,2,1,4]] in map (show.contour_description) c == ["202 02 2","220 20 0"]I function for  (p.264). Convert from  notation to .Ordering from ith to j$th element of sequence described at d. ?contour_description_ix (contour_description "abdc") (0,3) == LTz2 if contour is all descending, equal or ascending. Vlet c = ["abc","bbb","cba"] in map (uniform.contour_description) c == [True,True,True]z" if contour does not containt any n elements. Zlet c = ["abc","bbb","cba"] map (no_equalities.contour_description) c == [True,False,True] Set of all contour descriptions. 3map (length.all_contours) [3,4,5] == [27,729,59049]A sequence of orderings (i,j) and (j,k) may imply ordering for (i,k). Fmap implication [(LT,EQ),(EQ,EQ),(EQ,GT)] == [Just LT,Just EQ,Just GT]List of all violations at a  (p.266).Is the number of  zero.!All possible contour descriptions 5map (length.possible_contours) [3,4,5] == [13,75,541]#All impossible contour descriptions :map (length.impossible_contours) [3,4,5] == [14,654,58508]9Calculate number of contours of indicated degree (p.263). 5map contour_description_lm [2..7] == [1,3,6,10,15,21] _let r = [3,27,729,59049,14348907] in map (\n -> 3 ^ n) (map contour_description_lm [2..6]) == r Truncate a  to have at most n elements. \let c = contour_description [3,2,4,1] in contour_truncate c 3 == contour_description [3,2,4]Is  p a prefix of q. rlet {c = contour_description [3,2,4,1] ;d = contour_description [3,2,4]} in d `contour_is_prefix_of` c == TrueAre s p and q equal at column n. let {c = contour_description [3,2,4,1,5] ;d = contour_description [3,2,4,1]} in map (contour_eq_at c d) [0..4] == [True,True,True,True,False] Derive an % contour that would be described by $. Diverges for impossible contours. 6draw_contour (contour_description "abdc") == [0,1,3,2]Invert . ^let c = contour_description "abdc" in draw_contour (contour_description_invert c) == [3,2,0,1] Transform a  to produce at most n elements. Elet f i = Just (i,succ i) in unfoldr (build_f_n f) (5,'a') == "abcde"#Attempt to construct a sequence of n elements given a # to generate possible elements, a < that the result sequence must conform to at each step, an m to specify the maximum number of elements to generate when searching for a solution, and an initial state. |let {b_f i = Just (i,i+1) ;c_f i x = odd (sum x `div` i)} in build_sequence 6 b_f c_f 20 0 == (Just [1,2,6,11,15,19],20)SAttempt to construct a sequence that has a specified contour. The arguments are a # to generate possible elements, a / that the result sequence must conform to, an l to specify the maximum number of elements to generate when searching for a solution, and an initial state. import System.Random let {f = Just . randomR ('a','z') ;c = contour_description "atdez" ;st = mkStdGen 2347} in fst (build_contour f c 1024 st) == Just "nvruy" A variant on v that retries a specified number of times using the final state of the failed attempt as the state for the next try. let {f = Just . randomR ('a','z') ;c = contour_description "atdezjh" ;st = mkStdGen 2347} in fst (build_contour_retry f c 64 8 st) == Just "nystzvu" A variant on 4 that returns the set of all sequences constructed. let {f = Just . randomR ('a','z') ;c = contour_description "atdezjh" ;st = mkStdGen 2347} in length (build_contour_set f c 64 64 st) == 60 Variant of X that halts when an generated sequence is a duplicate of an already generated sequence. let {f = randomR ('a','f') ;c = contour_description "cafe" ;st = mkStdGen 2346836 ;r = build_contour_set_nodup f c 64 64 st} in filter ("c" `isPrefixOf`) r == ["cafe","cbed","caed"]+Example from p.262 (quarter-note durations) ex_1 == [2,3/2,1/2,1,2] compare_adjacent ex_1 == [GT,GT,LT,LT] show (contour_half_matrix ex_1) == "2221 220 00 0" draw_contour (contour_description ex_1) == [3,2,0,1,3] qlet d = contour_description_invert (contour_description ex_1) in (show d,is_possible d) == ("0001 002 22 2",True)Example on p.265 (pitch) 9ex_2 == [0,5,3] show (contour_description ex_2) == "00 2"Example on p.265 (pitch) ex_3 == [12,7,6,7,8,7] show (contour_description ex_3) == "22222 2101 000 01 2" contour_description_ix (contour_description ex_3) (0,5) == GT is_possible (contour_description ex_3) == TrueExample on p.266 (impossible) ashow ex_4 == "2221 220 00 1" is_possible ex_4 == False violations ex_4 == [(0,3,4,GT),(1,3,4,GT)]86822NoneEnumeration of set of faces of a cube.Relation between to  values as a (complementary,permutation) pair.Complete sequence (ie. #8).Initial half of  (ie. #4). The complete  is formed by appending the  of the .)s for elements of the symmetric group P4.Complement of a . =map complement [[4,1,3,2],[6,7,8,5]] == [[8,5,7,6],[2,3,4,1]]Form  from . nfull_seq [3,2,4,1] == [3,2,4,1,7,6,8,5] label_of (full_seq [3,2,4,1]) == G2 label_of (full_seq [1,4,2,3]) == LLower , ie.  or S. 8map lower [[4,1,3,2],[6,7,8,5]] == [[4,1,3,2],[2,3,4,1]]Application of  p on q. Fl_on Q1 I == Q1 l_on D A == G [l_on L L,l_on E D,l_on D E] == [L2,C,B] of  , inverse of !. seq_of Q1 == [8,7,5,6,4,3,1,2] of , ie.  A . half_seq_of Q1 == [8,7,5,6] of , ie.  4. .complement (half_seq (seq_of Q7)) == [3,4,2,1] Reverse table . Yreverse_lookup 'b' (zip [1..] ['a'..]) == Just 2 lookup 2 (zip [1..] ['a'..]) == Just 'b'! of  , inverse of . ;label_of [8,7,5,6,4,3,1,2] == Q1 label_of (seq_of Q4) == Q4"z if two  s are complementary, ie. form a . )complementary [4,2,1,3] [8,6,5,7] == True# Determine  of s. ~relate [1,4,2,3] [1,3,4,2] == (False,P.listPermute 4 [0,3,1,2]) relate [1,4,2,3] [8,5,6,7] == (True,P.listPermute 4 [1,0,2,3])$ from  p to q. 2relate_l L L2 == (False,P.listPermute 4 [0,3,1,2])%# adjacent  , see also &.&# adjacent s. vrelations_l [L2,L,A] == [(False,P.listPermute 4 [0,2,3,1]) ,(False,P.listPermute 4 [2,0,1,3])]'Apply  to . Gapply_relation (False,P.listPermute 4 [0,3,1,2]) [1,4,2,3] == [1,3,4,2](Apply sequence of  to initial .) Variant of (. =apply_relations_l (relations_l [L2,L,A,Q1]) L2 == [L2,L,A,Q1]*HTable indicating set of faces of cubes as drawn in Fig. VIII-6 (p.220). Tlookup [1,4,6,7] faces == Just F_Left reverse_lookup F_Right faces == Just [2,3,5,8]+3Fig. VIII-6. Hexahedral (Octahedral) Group (p. 220) =length viii_6_l == 24 take 7 viii_6_l == [L2,L,A,Q1,Q7,Q3,Q9],Fig. VIII-7 (p.221) map (take 4) (take 4 viii_7) == [[I,A,B,C] ,[A,I,C,B] ,[B,C,I,A] ,[C,B,A,I]]-Fig. VIII-6/b Labels (p.221) Klength viii_6b_l == length viii_6_l take 8 viii_6b_l == [I,A,B,C,D2,D,E2,E].Fig. VIII-6/b . Rviii_6b_p' == map half_seq_of viii_6b_l nub (map (length . nub) viii_6b_p') == [4]/ Variant of 0 with .0Fig. VIII-6/b. map (viii_6b !!) [0,8,16] == [(I,[1,2,3,4,5,6,7,8]) ,(G2,[3,2,4,1,7,6,8,5]) ,(Q8,[6,8,5,7,2,4,1,3])]1The sequence of  to give + from  . Uapply_relations_l viii_6_relations L2 == viii_6_l length (nub viii_6_relations) == 142The sequence of  to give - from . Wapply_relations_l viii_6b_relations I == viii_6b_l length (nub viii_6b_relations) == 10=      !"#$%&'()*+,-./012=      !"#$%&'()*+,-./012=      !"#$%&'()*+,-./012      !"#$%&'()*+,-./0123 Safe-Inferred3Click track definition.:Types of nodes.;The end of the track.<7A regular pulse in a measure prior to a rehearsal mark.=,The start of a pulse group within a measure.>A regular pulse.?The start of a regular measure.@-The start of a measure with a rehearsal mark.A 1-indexed.B 1-indexed.CTransform measures given as | divisions to absolute | locations. mdv abbreviates measure divisions. 1mdv_to_mrq [[1,2,1],[3,2,1]] == [[0,1,3],[4,7,9]]DLookup function for (B,A) indexed structure.EComparison for (B,A ) indices.FCLatch measures (ie. make measures contiguous, hold previous value). Aunzip (ct_ext 10 'a' [(3,'b'),(8,'c')]) == ([1..10],"aabbbbbccc")G=Variant that requires a value at measure one (first measure).H of G.IH without measures numbers.JC of I.MGLatch rehearsal mark sequence, only indicating marks. Initial mark is .. .ct_mark_seq 2 [] == [(1,Just '.'),(2,Nothing)] qlet r = [(1,Just '.'),(3,Just 'A'),(8,Just 'B')] in filter (isJust . snd) (ct_mark_seq 10 [(3,'A'),(8,'B')]) == rN!Indicate measures prior to marks. kct_pre_mark [] == [] ct_pre_mark [(1,'A')] == [] ct_pre_mark [(3,'A'),(8,'B')] == [(2,Just ()),(7,Just ())]OContiguous pre-mark sequence. Qct_pre_mark_seq 1 [(1,'A')] == [(1,Nothing)] ct_pre_mark_seq 10 [(3,'A'),(8,'B')]Q(Interpolating lookup of tempo sequence (V).R Lead-in of (pulse,tempo,count).S)Prepend initial element to start of list. delay1 "abc" == "aabc"UInitial tempo, if given.VErroring variant.+3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]+3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]+BACDEFGHIJKLMNOPQ:@?>=<;RST3456789UVWXYZ[\]3456789:@?>=<;ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]4 Safe-Inferred^| with  tie right._Boolean.` Construct ^.a| field of ^.bTied field of ^.cIs ^ tied right.d^ variant of . $rqt_un_tuplet (3,2) (1,T) == (3/2,T) Ylet f = rqt_un_tuplet (7,4) in map f [(2/7,F),(4/7,T),(1/7,F)] == [(1/2,F),(1,T),(1/4,F)]e Transform | to untied ^. rq_rqt 3 == (3,F)f!Tie last element only of list of |. *rq_tie_last [1,2,3] == [(1,F),(2,F),(3,T)]gTransform a list of ^ to a list of 9. The flag indicates if the initial value is tied left. /rqt_to_duration_a False [(1,T),(1/4,T),(3/4,F)]h^ variant of .i^ variant of . ~rqt_to_cmn (5,T) == Just ((4,T),(1,T)) rqt_to_cmn (5/4,T) == Just ((1,T),(1/4,T)) rqt_to_cmn (5/7,F) == Just ((4/7,T),(1/7,F))jList variant of i. #rqt_to_cmn_l (5,T) == [(4,T),(1,T)]kJ j. 7rqt_set_to_cmn [(1,T),(5/4,F)] == [(1,T),(1,T),(1/4,F)] ?rqt_set_to_cmn [(1/5,True),(1/20,False),(1/2,False),(1/4,True)]^_`abcdefghijk^_`abcdefghijk_^`abcdefghijk^_`abcdefghijk5None l Variant of m where n is 1.m Divisions of n | into i equal parts grouped as j0. A quarter and eighth note triplet is written (1,1,[2,1],False).nLift l to m.oVerify that grouping j sums to the divisor i.qTranslate from m to a sequence of | values. rq_div_to_rq_set_t (1,5,[1,3,1],True) == ([1/5,3/5,1/5],True) rq_div_to_rq_set_t (1/2,6,[3,1,2],False) == ([1/4,1/12,1/6],False)rTranslate from result of q to seqeunce of ^. Drq_set_t_to_rqt ([1/5,3/5,1/5],True) == [(1/5,_f),(3/5,_f),(1/5,_t)]sTransform sequence of m into sequence of |, discarding any final tie. _let q = [(1,5,[1,3,1],True),(1/2,6,[3,1,2],True)] in rq_div_seq_rq q == [1/5,3/5,9/20,1/12,1/6]tPartitions of an  that sum to n9. This includes the two 'trivial paritions, into a set n 1, and a set of 1 n. 7partitions_sum 4 == [[1,1,1,1],[2,1,1],[2,2],[3,1],[4]] Bmap (length . partitions_sum) [9..15] == [30,42,56,77,101,135,176]uThe  of t. >map (length . partitions_sum_p) [9..12] == [256,512,1024,2048]vThe set of all l that sum to n, a variant on u. kmap (length . rq1_div_univ) [3..5] == [8,16,32] map (length . rq1_div_univ) [9..12] == [512,1024,2048,4096] lmnopqrstuv lmnopqrstuv mlnopqrstuv lmnopqrstuv6 Safe-Inferred7w Variant of y allowing multiple rules.xPredicate function at y.yStructure given to x. to decide simplification. The structure is  (ts,start-rq,(left-rq,right-rq)).z Variant of #. If all elements of the list are Just a , then gives Just [a] else gives P. Uall_just (map Just [1..3]) == Just [1..3] all_just [Just 1,Nothing,Just 3] == Nothing{ Variant of [\ that preserves first a. ^all_right (map Right [1..3]) == Right [1..3] all_right [Right 1,Left 'a',Left 'b'] == Left 'a'| Applies a join9 function to the first two elements of the list. If the joinL function succeeds the joined element is considered for further coalescing. .coalesce (\p q -> Just (p + q)) [1..5] == [15] hlet jn p q = if even p then Just (p + q) else Nothing in coalesce jn [1..5] == map sum [[1],[2,3],[4,5]]} Variant of | with accumulation parameter. <coalesce_accum (\i p q -> Left (p + q)) 0 [1..5] == [(0,15)] zlet jn i p q = if even p then Left (p + q) else Right (p + i) in coalesce_accum jn 0 [1..7] == [(0,1),(1,5),(6,9),(15,13)] zlet jn i p q = if even p then Left (p + q) else Right [p,q] in coalesce_accum jn [] [1..5] == [([],1),([1,2],5),([5,4],9)]~ Variant of } that accumulates running sum. glet f i p q = if i == 1 then Just (p + q) else Nothing in coalesce_sum (+) 0 f [1,1/2,1/4,1/4] == [1,1]Lower b to T by discarding a.Take elements while the sum of the prefix is less than or equal to the indicated value. Returns also the difference between the prefix sum and the requested sum. Note that zero elements are kept left. take_sum_by id 3 [2,1] == ([2,1],0,[]) take_sum_by id 3 [2,2] == ([2],1,[2]) take_sum_by id 3 [2,1,0,1] == ([2,1,0],0,[1]) take_sum_by id 3 [4] == ([],3,[4]) take_sum_by id 0 [1..5] == ([],0,[1..5]) Variant of  with S function. Variant of * that requires the prefix to sum to value. Xtake_sum_by_eq id 3 [2,1,0,1] == Just ([2,1,0],[1]) take_sum_by_eq id 3 [2,2] == NothingRecursive variant of . dsplit_sum_by_eq id [3,3] [2,1,0,3] == Just [[2,1,0],[3]] split_sum_by_eq id [3,3] [2,2,2] == Nothing6Split sequence such that the prefix sums to precisely m. The third element of the result indicates if it was required to divide an element. Note that zero elements are kept left. If the required sum is non positive, or the input list does not sum to at least the required sum, gives nothing. split_sum 5 [2,3,1] == Just ([2,3],[1],Nothing) split_sum 5 [2,1,3] == Just ([2,1,2],[1],Just (2,1)) split_sum 2 [3/2,3/2,3/2] == Just ([3/2,1/2],[1,3/2],Just (1/2,1)) split_sum 6 [1..10] == Just ([1..3],[4..10],Nothing) fmap (\(a,_,c)->(a,c)) (split_sum 5 [1..]) == Just ([1,2,2],Just (2,1)) split_sum 0 [1..] == Nothing split_sum 3 [1,1] == Nothing split_sum 3 [2,1,0] == Just ([2,1,0],[],Nothing) split_sum 3 [2,1,0,1] == Just ([2,1,0],[1],Nothing) Alias for z!, used locally for documentation. Alias for M!, used locally for documentation. Variant of  that operates at ^ sequences. Vlet r = Just ([(3,_f),(2,_t)],[(1,_f)]) in rqt_split_sum 5 [(3,_f),(2,_t),(1,_f)] == r ]let r = Just ([(3,_f),(1,_t)],[(1,_t),(1,_f)]) in rqt_split_sum 4 [(3,_f),(2,_t),(1,_f)] == r (rqt_split_sum 4 [(5/2,False)] == Nothing Separate ^ values in sequences summing to |* values. This is a recursive variant of !. Note that is does not ensure cmn notation of values. let d = [(2,_f),(2,_f),(2,_f)] in rqt_separate [3,3] d == Right [[(2,_f),(1,_t)] ,[(1,_f),(2,_f)]] let d = [(5/8,_f),(1,_f),(3/8,_f)] in rqt_separate [1,1] d == Right [[(5/8,_f),(3/8,_t)] ,[(5/8,_f),(3/8,_f)]] let d = [(4/7,_t),(1/7,_f),(1,_f),(6/7,_f),(3/7,_f)] in rqt_separate [1,1,1] d == Right [[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(5/7,_f),(2/7,_t)] ,[(4/7,_f),(3/7,_f)]] If the input ^" sequence cannot be notated (see hD) separate into equal parts, so long as each part is not less than i. lrqt_separate_tuplet undefined [(1/3,_f),(1/6,_f)] rqt_separate_tuplet undefined [(4/7,_t),(1/7,_f),(2/7,_f)] let d = map rq_rqt [1/3,1/6,2/5,1/10] in rqt_separate_tuplet (1/8) d == Right [[(1/3,_f),(1/6,_f)] ,[(2/5,_f),(1/10,_f)]] Xlet d = [(1/5,True),(1/20,False),(1/2,False),(1/4,True)] in rqt_separate_tuplet (1/16) d ^let d = [(2/5,_f),(1/5,_f),(1/5,_f),(1/5,_t),(1/2,_f),(1/2,_f)] in rqt_separate_tuplet (1/2) d Llet d = [(4/10,True),(1/10,False),(1/2,True)] in rqt_separate_tuplet (1/2) dRecursive variant of . let d = map rq_rqt [1,1/3,1/6,2/5,1/10] in rqt_tuplet_subdivide (1/8) d == [[(1/1,_f)] ,[(1/3,_f),(1/6,_f)] ,[(2/5,_f),(1/10,_f)]]Sequence variant of . ^let d = [(1/5,True),(1/20,False),(1/2,False),(1/4,True)] in rqt_tuplet_subdivide_seq (1/2) [d]7If a tuplet is all tied, it ought to be a plain value?! 6rqt_tuplet_sanity_ [(4/10,_t),(1/10,_f)] == [(1/2,_f)] Separate |! sequence into measures given by | length. to_measures_rq [3,3] [2,2,2] == Right [[(2,_f),(1,_t)],[(1,_f),(2,_f)]] to_measures_rq [3,3] [6] == Right [[(3,_t)],[(3,_f)]] to_measures_rq [1,1,1] [3] == Right [[(1,_t)],[(1,_t)],[(1,_f)]] to_measures_rq [3,3] [2,2,1] to_measures_rq [3,2] [2,2,2] hlet d = [4/7,33/28,9/20,4/5] in to_measures_rq [3] d == Right [[(4/7,_f),(33/28,_f),(9/20,_f),(4/5,_f)]] Variant of  that ensures ^ are cmn- durations. This is not a good composition. }to_measures_rq_cmn [6,6] [5,5,2] == Right [[(4,_t),(1,_f),(1,_t)] ,[(4,_f),(2,_f)]] klet r = [[(4/7,_t),(1/7,_f),(1,_f),(6/7,_f),(3/7,_f)]] in to_measures_rq_cmn [3] [5/7,1,6/7,3/7] == Right r to_measures_rq_cmn [1,1,1] [5/7,1,6/7,3/7] == Right [[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(4/7,_f),(3/7,_f)]] Variant of  with measures given by  values. Does not ensure ^ are cmn durations. to_measures_ts [(1,4)] [5/8,3/8] /= Right [[(1/2,_t),(1/8,_f),(3/8,_f)]] to_measures_ts [(1,4)] [5/7,2/7] /= Right [[(4/7,_t),(1/7,_f),(2/7,_f)]] let {m = replicate 18 (1,4) ;x = [3/4,2,5/4,9/4,1/4,3/2,1/2,7/4,1,5/2,11/4,3/2]} in to_measures_ts m x == Right [[(3/4,_f),(1/4,_t)],[(1/1,_t)] ,[(3/4,_f),(1/4,_t)],[(1/1,_f)] ,[(1/1,_t)],[(1/1,_t)] ,[(1/4,_f),(1/4,_f),(1/2,_t)],[(1/1,_f)] ,[(1/2,_f),(1/2,_t)],[(1/1,_t)] ,[(1/4,_f),(3/4,_t)],[(1/4,_f),(3/4,_t)] ,[(1/1,_t)],[(3/4,_f),(1/4,_t)] ,[(1/1,_t)],[(1/1,_t)] ,[(1/2,_f),(1/2,_t)],[(1/1,_f)]] cto_measures_ts [(3,4)] [4/7,33/28,9/20,4/5] to_measures_ts (replicate 3 (1,4)) [4/7,33/28,9/20,4/5] Variant of  that allows for duration field operation but requires that measures be well formed. This is useful for re-grouping measures after notation and ascription.(Divide measure into pulses of indicated |J durations. Measure must be of correct length but need not contain only cmnZ durations. Pulses are further subdivided if required to notate tuplets correctly, see . let d = [(1/4,_f),(1/4,_f),(2/3,_t),(1/6,_f),(16/15,_f),(1/5,_f) ,(1/5,_f),(2/5,_t),(1/20,_f),(1/2,_f),(1/4,_t)] in m_divisions_rq [1,1,1,1] d ?m_divisions_rq [1,1,1] [(4/7,_f),(33/28,_f),(9/20,_f),(4/5,_f)] Variant of ' that determines pulse divisions from . Jlet d = [(4/7,_t),(1/7,_f),(2/7,_f)] in m_divisions_ts (1,4) d == Just [d] let d = map rq_rqt [1/3,1/6,2/5,1/10] in m_divisions_ts (1,4) d == Just [[(1/3,_f),(1/6,_f)] ,[(2/5,_f),(1/10,_f)]] let d = map rq_rqt [4/7,33/28,9/20,4/5] in m_divisions_ts (3,4) d == Just [[(4/7,_f),(3/7,_t)] ,[(3/4,_f),(1/4,_t)] ,[(1/5,_f),(4/5,_f)]]Composition of  and :, where measures are initially given as sets of divisions. let m = [[1,1,1],[1,1,1]] in to_divisions_rq m [2,2,2] == Right [[[(1,_t)],[(1,_f)],[(1,_t)]] ,[[(1,_f)],[(1,_t)],[(1,_f)]]] 4let d = [2/7,1/7,4/7,5/7,8/7,1,1/7] in to_divisions_rq [[1,1,1,1]] d == Right [[[(2/7,_f),(1/7,_f),(4/7,_f)] ,[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(6/7,_f),(1/7,_t)] ,[(6/7,_f),(1/7,_f)]]] let d = [5/7,1,6/7,3/7] in to_divisions_rq [[1,1,1]] d == Right [[[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(4/7,_f),(3/7,_f)]]] =let d = [2/7,1/7,4/7,5/7,1,6/7,3/7] in to_divisions_rq [[1,1,1,1]] d == Right [[[(2/7,_f),(1/7,_f),(4/7,_f)] ,[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(4/7,_t),(1/7,_f),(2/7,_t)] ,[(4/7,_f),(3/7,_f)]]] let d = [4/7,33/28,9/20,4/5] in to_divisions_rq [[1,1,1]] d == Right [[[(4/7,_f),(3/7,_t)] ,[(3/4,_f),(1/4,_t)] ,[(1/5,_f),(4/5,_f)]]] let {p = [[1/2,1,1/2],[1/2,1]] ;d = map (/6) [1,1,1,1,1,1,4,1,2,1,1,2,1,3]} in to_divisions_rq p d == Right [[[(1/6,_f),(1/6,_f),(1/6,_f)] ,[(1/6,_f),(1/6,_f),(1/6,_f),(1/2,True)] ,[(1/6,_f),(1/6,_f),(1/6,True)]] ,[[(1/6,_f),(1/6,_f),(1/6,_f)] ,[(1/3,_f),(1/6,_f),(1/2,_f)]]] Variant of  with measures given as set of . ,let d = [3/5,2/5,1/3,1/6,7/10,17/15,1/2,1/6] in to_divisions_ts [(4,4)] d == Just [[[(3/5,_f),(2/5,_f)] ,[(1/3,_f),(1/6,_f),(1/2,_t)] ,[(1/5,_f),(4/5,_t)] ,[(1/3,_f),(1/2,_f),(1/6,_f)]]] ,let d = [3/5,2/5,1/3,1/6,7/10,29/30,1/2,1/3] in to_divisions_ts [(4,4)] d == Just [[[(3/5,_f),(2/5,_f)] ,[(1/3,_f),(1/6,_f),(1/2,_t)] ,[(1/5,_f),(4/5,_t)] ,[(1/6,_f),(1/2,_f),(1/3,_f)]]] !let d = [3/5,2/5,1/3,1/6,7/10,4/5,1/2,1/2] in to_divisions_ts [(4,4)] d == Just [[[(3/5,_f),(2/5,_f)] ,[(1/3,_f),(1/6,_f),(1/2,_t)] ,[(1/5,_f),(4/5,_f)] ,[(1/2,_f),(1/2,_f)]]] let d = [4/7,33/28,9/20,4/5] in to_divisions_ts [(3,4)] d == Just [[[(4/7,_f),(3/7,_t)] ,[(3/4,_f),(1/4,_t)] ,[(1/5,_f),(4/5,_f)]]]Pulse tuplet derivation. p_tuplet_rqt [(2/3,_f),(1/3,_t)] == Just ((3,2),[(1,_f),(1/2,_t)]) p_tuplet_rqt (map rq_rqt [1/3,1/6]) == Just ((3,2),[(1/2,_f),(1/4,_f)]) p_tuplet_rqt (map rq_rqt [2/5,1/10]) == Just ((5,4),[(1/2,_f),(1/8,_f)]) p_tuplet_rqt (map rq_rqt [1/3,1/6,2/5,1/10])dNotate pulse, ie. derive tuplet if neccesary. The flag indicates if the initial value is tied left. p_notate False [(2/3,_f),(1/3,_t)] p_notate False [(2/5,_f),(1/10,_t)] p_notate False [(1/4,_t),(1/8,_f),(1/8,_f)] p_notate False (map rq_rqt [1/3,1/6]) p_notate False (map rq_rqt [2/5,1/10]) p_notate False (map rq_rqt [1/3,1/6,2/5,1/10]) == NothingNotate measure. 5m_notate True [[(2/3,_f),(1/3,_t)],[(1,_t)],[(1,_f)]] let f = m_notate False . concat fmap f (to_divisions_ts [(4,4)] [3/5,2/5,1/3,1/6,7/10,17/15,1/2,1/6]) fmap f (to_divisions_ts [(4,4)] [3/5,2/5,1/3,1/6,7/10,29/30,1/2,1/3])Multiple measure notation. Qlet d = [2/7,1/7,4/7,5/7,8/7,1,1/7] in fmap mm_notate (to_divisions_ts [(4,4)] d) Qlet d = [2/7,1/7,4/7,5/7,1,6/7,3/7] in fmap mm_notate (to_divisions_ts [(4,4)] d) Xlet d = [3/5,2/5,1/3,1/6,7/10,4/5,1/2,1/2] in fmap mm_notate (to_divisions_ts [(4,4)] d) wlet {p = [[1/2,1,1/2],[1/2,1]] ;d = map (/6) [1,1,1,1,1,1,4,1,2,1,1,2,1,3]} in fmap mm_notate (to_divisions_rq p d) Transform w to x. Transform w to set of y.!The default table of simplifiers. %default_table ((3,4),1,(1,1)) == True.The default eighth-note pulse simplifier rule. default_8_rule ((3,8),0,(1/2,1/2)) == True default_8_rule ((3,8),1/2,(1/2,1/2)) == True default_8_rule ((3,8),1,(1/2,1/2)) == True default_8_rule ((2,8),0,(1/2,1/2)) == True default_8_rule ((5,8),0,(1,1/2)) == True default_8_rule ((5,8),0,(2,1/2)) == True/The default quarter note pulse simplifier rule. default_4_rule ((3,4),0,(1,1/2)) == True default_4_rule ((3,4),0,(1,3/4)) == True default_4_rule ((4,4),1,(1,1)) == False default_4_rule ((4,4),2,(1,1)) == True default_4_rule ((4,4),2,(1,2)) == True default_4_rule ((4,4),0,(2,1)) == True default_4_rule ((3,4),1,(1,1)) == False;The default simplifier rule. To extend provide a list of y.!Measure simplifier. Apply given x.%Pulse simplifier predicate, which is  z.Pulse simplifier. ^import Music.Theory.Duration.Name.Abbreviation p_simplify [(q,[Tie_Right]),(e,[Tie_Left])] == [(q',[])] p_simplify [(e,[Tie_Right]),(q,[Tie_Left])] == [(q',[])] p_simplify [(q,[Tie_Right]),(e',[Tie_Left])] == [(q'',[])] p_simplify [(q'',[Tie_Right]),(s,[Tie_Left])] == [(h,[])] p_simplify [(e,[Tie_Right]),(s,[Tie_Left]),(e',[])] == [(e',[]),(e',[])] ^let f = rqt_to_duration_a False in p_simplify (f [(1/8,_t),(1/4,_t),(1/8,_f)]) == f [(1/2,_f)]:Notate RQ duration sequence. Derive pulse divisions from ( if not given directly. Composition of ,  .  let ts = [(4,8),(3,8)] ts_p = [[1/2,1,1/2],[1/2,1]] rq = map (/6) [1,1,1,1,1,1,4,1,2,1,1,2,1,3] sr x = T.default_rule [] x in T.notate_rqp sr ts (Just ts_p) rq Variant of " without pulse divisions (derive). Cnotate (default_rule [((3,2),0,(2,2)),((3,2),0,(4,2))]) [(3,2)] [6] Variant of r that retains elements of the right hand (rhs) list where elements of the left hand (lhs) list meet the given lhs predicate. If the right hand side is longer the remaining elements to be processed are given. It is an error for the right hand side to be short. zip_hold_lhs even [1..5] "abc" == ([],zip [1..6] "abbcc") zip_hold_lhs odd [1..6] "abc" == ([],zip [1..6] "aabbcc") zip_hold_lhs even [1] "ab" == ("b",[(1,'a')]) zip_hold_lhs even [1,2] "a" == undefined Variant of H that requires the right hand side to be precisely the required length. zip_hold_lhs_err even [1..5] "abc" == zip [1..6] "abbcc" zip_hold_lhs_err odd [1..6] "abc" == zip [1..6] "aabbcc" zip_hold_lhs_err id [False,False] "a" == undefined zip_hold_lhs_err id [False] "ab" == undefined Variant of rY that retains elements of the right hand (rhs) list where elements of the left hand (lhs) list meet the given lhs predicate, and elements of the lhs list where elements of the rhs meet the rhs predicate. If the right hand side is longer the remaining elements to be processed are given. It is an error for the right hand side to be short. zip_hold even (const False) [1..5] "abc" == ([],zip [1..6] "abbcc") zip_hold odd (const False) [1..6] "abc" == ([],zip [1..6] "aabbcc") zip_hold even (const False) [1] "ab" == ("b",[(1,'a')]) zip_hold even (const False) [1,2] "a" == undefined Ezip_hold odd even [1,2,6] [1..5] == ([4,5],[(1,1),(2,1),(6,2),(6,3)])Zip a list of N elements duplicating elements of the right hand sequence for tied durations. let {Just d = to_divisions_ts [(4,4),(4,4)] [3,3,2] ;f = map snd . snd . flip m_ascribe "xyz"} in fmap f (notate d) == Just "xxxyyyzz" A . Variant of  for a set of measures.'mm_ascribe of .Group elements as chords< where a chord element is indicated by the given predicate. =group_chd even [1,2,3,4,4,5,7,8] == [[1,2],[3,4,4],[5],[7,8]] Variant of  that groups the rhs elements using  and with the indicated chord0 function, then rejoins the resulting sequence. Variant of  using :wxyz{|}~:wxyz{|}~:z{|}~yxw:wxyz{|}~7 Safe-InferredA node in a dynamic sequence."Enumeration of hairpin indicators.$Enumeration of dynamic mark symbols.Lookup MIDI velocity for . The range is linear in 0-127. flet r = [0,6,17,28,39,50,61,72,83,94,105,116,127] in mapMaybe dynamic_mark_midi [Niente .. FFFFF] == r Fmap dynamic_mark_midi [FP,SF,SFP,SFPP,SFZ,SFFZ] == replicate 6 NothingError variant.*Map midi velocity (0-127) to dynamic mark. 1histogram (mapMaybe midi_dynamic_mark [0 .. 127]) Translate fixed s to db amplitude over given range. mapMaybe (dynamic_mark_db 120) [Niente,P,F,FFFFF] == [-120,-70,-40,0] mapMaybe (dynamic_mark_db 60) [Niente,P,F,FFFFF] == [-60,-35,-20,0] 0http://www.csounds.com/manual/html/ampmidid.html [import Sound.SC3.Plot plotTable [map (ampmidid 20) [0 .. 127],map (ampmidid 60) [0 .. 127]]JMcC (SC3) equation. &plotTable1 (map amp_db [0,0.005 .. 1])JMcC (SC3) equation. &plotTable1 (map db_amp [-60,-59 .. 0])The  implied by a ordered pair of s. Cmap (implied_hairpin MF) [MP,F] == [Just Diminuendo,Just Crescendo] The empty . Calculate a  sequence from a sequence of s. dynamic_sequence [PP,MP,MP,PP] == [(Just PP,Just Crescendo) ,(Just MP,Just End_Hairpin) ,(Nothing,Just Diminuendo) ,(Just PP,Just End_Hairpin)]+Delete redundant (unaltered) dynamic marks. tlet s = [Just P,Nothing,Just P,Just P,Just F] in delete_redundant_marks s == [Just P,Nothing,Nothing,Nothing,Just F] Variant of  for sequences of  with holes (ie. rests). Runs . let r = [Just (Just P,Just Crescendo),Just (Just F,Just End_Hairpin) ,Nothing,Just (Just P,Nothing)] in dynamic_sequence_sets [Just P,Just F,Nothing,Just P] == r dlet s = [Just P,Nothing,Just P] in dynamic_sequence_sets s = [Just (Just P,Nothing),Nothing,Nothing]Apply  and ) functions in that order as required by . Olet f _ x = show x in apply_dynamic_node f f (Nothing,Just Crescendo) undefinedASCII pretty printer for .ASCII pretty printer for .ASCII pretty printer for .ASCII pretty printer for  sequence.***8 Safe-Inferred9V(t,f0,k) where t=tuning, f0=fundamental frequency, k=midi note number for f0, n=gamut(t,c,k) where t=tuning (must have 12 divisions of octave), c=cents deviation (ie. constant detune offset), k=midi offset (ie. value to be added to incoming midi note number).(n -> dt#). Function from midi note number n to  Midi_Detune dt\. The incoming note number is the key pressed, which may be distant from the note sounded.A tuning specified bF as a sequence of exact ratios, or as a sequence of possibly inexact .\A real valued division of a semi-tone into one hundred parts, and hence of the octave into 1200 parts.An approximation of a ratio.Divisions of octave. divisions ditone == 12T exact ratios of . ing variant.Possibly inexact  of tuning.B  A . Variant of  that includes octave at right.2Convert from interval in cents to frequency ratio. :map cents_to_ratio [0,701.9550008653874,1200] == [1,3/2,2]Possibly inexact  s of tuning.'Cyclic form, taking into consideration .T2 exact ratios reconstructed from possibly inexact  of . vlet r = [1,17/16,9/8,13/11,5/4,4/3,7/5,3/2,11/7,5/3,16/9,15/8] in reconstructed_ratios 1e-2 werckmeister_iii == Just rConvert from a  ratio to cents. Llet r = [0,498,702,1200] in map (round . fratio_to_cents) [1,4/3,3/2,2] == rType specialised .Type specialised . A .Construct an exact V that approximates  to within epsilon. <map (reconstructed_ratio 1e-5) [0,700,1200] == [1,442/295,2] -ratio_to_cents (442/295) == 699.9976981706734 Frequency n cents from f. aimport Music.Theory.Pitch map (cps_shift_cents 440) [-100,100] == map octpc_to_cps [(4,8),(4,10)] Interval in cents from p to q, ie.  of p  q. 4cps_difference_cents 440 (octpc_to_cps (5,2)) == 500 `let abs_dif i j = abs (i - j) in cps_difference_cents 440 (fmidi_to_cps 69.1) `abs_dif` 10 < 1e9The Syntonic comma. syntonic_comma == 81/80The Pythagorean comma.  pythagorean_comma == 3^12 / 2^19Mercators comma. mercators_comma == 3^53 / 2^84 Calculate n th root of x. 612 `nth_root` 2 == twelve_tone_equal_temperament_comma512-tone equal temperament comma (ie. 12th root of 2). 9twelve_tone_equal_temperament_comma == 1.0594630943592953Make n division equal temperament.12-tone equal temperament. +cents equal_temperament_12 == [0,100..1100]19-tone equal temperament.31-tone equal temperament.53-tone equal temperament.72-tone equal temperament. Vlet r = [0,17,33,50,67,83,100] in take 7 (map round (cents equal_temperament_72)) == rRaise or lower the frequency q3 by octaves until it is in the octave starting at p. "fold_cps_to_octave_of 55 392 == 98Harmonic series on n.n elements of . plet r = [55,110,165,220,275,330,385,440,495,550,605,660,715,770,825,880,935] in harmonic_series_cps_n 17 55 == rSub-harmonic series on n.n elements of . let r = [1760,880,587,440,352,293,251,220,196,176,160,147,135,126,117,110,104] in map round (subharmonic_series_cps_n 17 1760) == rnth partial of f1, ie. one indexed. (map (partial 55) [1,5,3] == [55,275,165]'Fold ratio until within an octave, ie. 1  n  2. /map fold_ratio_to_octave [2/3,3/4] == [4/3,3/2]!The interval between two pitches p and q1 given as ratio multipliers of a fundamental is q  p1. The classes over such intervals consider the  of both p to q and q to p. ?map ratio_interval_class [2/3,3/2,3/4,4/3] == [3/2,3/2,3/2,3/2]%Derivative harmonic series, based on kth partial of f1. import Music.Theory.Pitch let {r = [52,103,155,206,258,309,361,412,464,515,567,618,670,721,773] ;d = harmonic_series_cps_derived 5 (octpc_to_cps (1,4))} in map round (take 15 d) == r Harmonic series to nth harmonic (folded). Eharmonic_series_folded 17 == [1,17/16,9/8,5/4,11/8,3/2,13/8,7/4,15/8] mlet r = [0,105,204,386,551,702,841,969,1088] in map (round . ratio_to_cents) (harmonic_series_folded 17) == r  variant of  . Wmap round (harmonic_series_folded_c 21) == [0,105,204,298,386,471,551,702,841,969,1088] 12-tone tuning of first 21! elements of the harmonic series. {cents_i harmonic_series_folded_21 == [0,105,204,298,386,471,551,702,841,969,1088] divisions harmonic_series_folded_21 == 11 -Give cents difference from nearest 12ET tone. Wlet r = [50,-49,-2,0,2,49,50] in map cents_et12_diff [650,651,698,700,702,749,750] == r Fractional form of  .'The class of cents intervals has range (0,600). 5map cents_interval_class [50,1150,1250] == [50,50,50] hlet r = concat [[0,50 .. 550],[600],[550,500 .. 0]] in map cents_interval_class [1200,1250 .. 2400] == rFractional form of .Always include the sign, elide 0.'Given brackets, print cents difference. with parentheses. 2map cents_diff_text [-1,0,1] == ["(-1)","","(+1)"] with markdown superscript (^). with HTML superscript ( sup). for . import Music.Theory.Tuning.Gann let f = d12_midi_tuning_f (la_monte_young,-74.7,-3) octpc_to_midi (-1,11) == 11 map (round . midi_detune_to_cps . f) [62,63,69] == [293,298,440] for .<     <     <     9     9 Safe-Inferred{Set of 1. interval size (cents), 2. intervals as product of powers of primes, 3. frequency ratio and 4. harmonicity value. Barlow's indigestibility function for prime numbers. Amap barlow [1,2,3,5,7,11,13] == [0,1,8/3,32/5,72/7,200/11,288/13]Generate list of factors of n from x. factor primes 315 == [3,3,5,7] n from . prime_factors 315 == [3,3,5,7]>Collect number of occurences of each element of a sorted list. 3multiplicities [1,1,1,2,2,3] == [(1,3),(2,2),(3,1)] A . *prime_factors_m 315 == [(3,2),(5,1),(7,1)]Merging function for .4Collect the prime factors in a rational number given as a numerator/ denominator pair (n,m). Prime factors are listed in ascending order with their positive or negative multiplicities, depending on whether the prime factor occurs in the numerator or the denominator (after cancelling out common factors). rational_prime_factors_m (16,15) == [(2,4),(3,-1),(5,-1)] rational_prime_factors_m (10,9) == [(2,1),(3,-2),(5,1)] rational_prime_factors_m (81,64) == [(2,-6),(3,4)] rational_prime_factors_m (27,16) == [(2,-4),(3,3)] rational_prime_factors_m (12,7) == [(2,2),(3,1),(7,-1)] Variant of & giving results in a table up to the n th prime. 3rational_prime_factors_t 6 (12,7) == [2,1,0,-1,0,0] +Compute the disharmonicity of the interval (p,q)% using the prime valuation function pv. Bmap (disharmonicity barlow) [(9,10),(8,9)] ~= [12.733333,8.333333]!The reciprocal of  . >map (harmonicity barlow) [(9,10),(8,9)] ~= [0.078534,0.120000]" Variant of ! with  input.# ().$Make X Y pair of n.%Table 2 (p.45) length (table_2 0.06) == 24&Pretty printer for  values. ,mapM_ (putStrLn . table_2_pp) (table_2 0.06)  0.000 | 0 0 0 0 0 0 | 1:1 | Infinity 111.731 | 4 -1 -1 0 0 0 | 15:16 | 0.076531 182.404 | 1 -2 1 0 0 0 | 9:10 | 0.078534 203.910 | -3 2 0 0 0 0 | 8:9 | 0.120000 231.174 | 3 0 0 -1 0 0 | 7:8 | 0.075269 266.871 | -1 -1 0 1 0 0 | 6:7 | 0.071672 294.135 | 5 -3 0 0 0 0 | 27:32 | 0.076923 315.641 | 1 1 -1 0 0 0 | 5:6 | 0.099338 386.314 | -2 0 1 0 0 0 | 4:5 | 0.119048 407.820 | -6 4 0 0 0 0 | 64:81 | 0.060000 435.084 | 0 2 0 -1 0 0 | 7:9 | 0.064024 498.045 | 2 -1 0 0 0 0 | 3:4 | 0.214286 519.551 | -2 3 -1 0 0 0 | 20:27 | 0.060976 701.955 | -1 1 0 0 0 0 | 2:3 | 0.272727 764.916 | 1 -2 0 1 0 0 | 9:14 | 0.060172 813.686 | 3 0 -1 0 0 0 | 5:8 | 0.106383 884.359 | 0 -1 1 0 0 0 | 3:5 | 0.110294 905.865 | -4 3 0 0 0 0 | 16:27 | 0.083333 933.129 | 2 1 0 -1 0 0 | 7:12 | 0.066879 968.826 | -2 0 0 1 0 0 | 4:7 | 0.081395 996.090 | 4 -2 0 0 0 0 | 9:16 | 0.107143 1017.596 | 0 2 -1 0 0 0 | 5:9 | 0.085227 1088.269 | -3 1 1 0 0 0 | 8:15 | 0.082873 1200.000 | 1 0 0 0 0 0 | 1:2 | 1.000000 !"#$%& !"#$%& !"#$%& !"#$%&: Safe-Inferred' Ratios for (. olet c = [0,114,204,294,408,498,612,702,816,906,996,1110] in map (round . ratio_to_cents) harrison_ditone_r == c( Ditone/pythagorean tuning, see 7http://www.billalves.com/porgitaro/ditonesettuning.html Kcents_i harrison_ditone == [0,114,204,294,408,498,612,702,816,906,996,1110]'('('('(; Safe-Inferred*HMC slendro tuning. ,cents_i alves_slendro == [0,231,498,765,996],HMC  pelog bem tuning. .cents_i alves_pelog_bem == [0,231,316,702,814].HMC pelog 2,3,4,6,7 tuning. 1cents_i alves_pelog_barang == [0,386,471,857,969]0HMC  pelog barang tuning. 0cents_i alves_pelog_23467 == [0,386,471,702,969])*+,-./0)*+,-./0)*+,-./0)*+,-./0< Safe-Inferred1 Cents for 2. ^let c = [0,76,193,310,386,503,580,697,773,890,1007,1083] in map round pietro_aaron_1523_c == c2/Pietro Aaron (1523) meantone temperament, see $http://www.kylegann.com/histune.html Mcents_i pietro_aaron_1523 == [0,76,193,310,386,503,580,697,773,890,1007,1083]3"Andreas Werckmeister (1645-1706),  $http://www.kylegann.com/histune.html.4 Cents for 5. ^let c = [0,94,196,298,392,500,592,698,796,894,1000,1092] in map round thomas_young_1799_c == c5'Thomas Young (1799), Well Temperament,  $http://www.kylegann.com/histune.html. Mcents_i thomas_young_1799 == [0,94,196,298,392,500,592,698,796,894,1000,1092]6 Ratios for 7.7Gioseffo Zarlino, 1588, see  #http://www.kylegann.com/tuning.html. kdivisions zarlino == 16 cents_i zarlino == [0,71,182,204,294,316,386,498,569,590,702,773,884,996,1018,1088]8 Ratios for 9. nlet c = [0,177,204,240,471,444,675,702,738,969,942,1173] in map (round . ratio_to_cents) la_monte_young_r == c9.La Monte Young's "The Well-Tuned Piano", see  http://www.kylegann.com/wtp.html. Jcents_i la_monte_young == [0,177,204,240,471,444,675,702,738,969,942,1173]: Ratios for ;. llet c = [0,105,204,298,386,471,551,702,841,906,969,1088] in map (round . ratio_to_cents) ben_johnston_r == c;9Ben Johnston's "Suite for Microtonal Piano" (1977), see #http://www.kylegann.com/tuning.html Hcents_i ben_johnston == [0,105,204,298,386,471,551,702,841,906,969,1088]< Ratios for =.=Kyle Gann, _Arcana XVI_, see  #http://www.kylegann.com/Arcana.html. let r = [0,84,112,204,267,316,347,386,471,498,520,583,663,702,734,814,845,884,898,969,1018,1049,1088,1161] in cents_i gann_arcana_xvi == r> Ratios for ?.?"Kyle Gann, _Superparticular_, see  "http://www.kylegann.com/Super.html. $divisions gann_superparticular == 22 let r = [0,165,182,204,231,267,316,386,435,498,551,583,617,702,782,765,814,884,933,969,996,1018] in cents_i gann_superparticular == r123456789:;<=>?123456789:;<=>?123456789:;<=>?123456789:;<=>?= Safe-Inferred @Odd numbers to n. odd_to 7 == [1,3,5,7]AGenerate initial row for n. row 7 == [1,5/4,3/2,7/4]BGenerate initial column for n. column 7 == [1,8/5,4/3,8/7]C]^ A .DGiven row and column generate matrix value at (i,j). #inner (row 7,column 7) (1,2) == 6/5FMeyer table in form (r,c,n).  meyer_table_indices 7 == [(0,0,1/1),(0,1,5/4),(0,2,3/2),(0,3,7/4) ,(1,0,8/5),(1,1,1/1),(1,2,6/5),(1,3,7/5) ,(2,0,4/3),(2,1,5/3),(2,2,1/1),(2,3,7/6) ,(3,0,8/7),(3,1,10/7),(3,2,12/7),(3,3,1/1)]GMeyer table as set of rows. meyer_table_rows 7 == [[1/1, 5/4, 3/2,7/4] ,[8/5, 1/1, 6/5,7/5] ,[4/3, 5/3, 1/1,7/6] ,[8/7,10/7,12/7,1/1]] 'let r = [[ 1/1, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8] ,[16/9, 1/1, 10/9, 11/9, 4/3, 13/9, 14/9, 5/3] ,[ 8/5, 9/5, 1/1, 11/10, 6/5, 13/10, 7/5, 3/2] ,[16/11, 18/11, 20/11, 1/1, 12/11, 13/11, 14/11, 15/11] ,[ 4/3, 3/2, 5/3, 11/6, 1/1, 13/12, 7/6, 5/4] ,[16/13, 18/13, 20/13, 22/13, 24/13, 1/1, 14/13, 15/13] ,[ 8/7, 9/7, 10/7, 11/7, 12/7, 13/7, 1/1, 15/14] ,[16/15, 6/5, 4/3, 22/15, 8/5, 26/15, 28/15, 1/1]] in meyer_table_rows 15 == rHThird element of three-tuple.ISet of unique ratios in n table. Celements 7 == [1,8/7,7/6,6/5,5/4,4/3,7/5,10/7,3/2,8/5,5/3,12/7,7/4] melements 9 == [1,10/9,9/8,8/7,7/6,6/5,5/4,9/7,4/3,7/5,10/7 ,3/2,14/9,8/5,5/3,12/7,7/4,16/9,9/5]JNumber of unique elements at n table. -map degree [7,9,11,13,15] == [13,19,29,41,49]K +http://en.wikipedia.org/wiki/Farey_sequence let r = [[0,1/2,1] ,[0,1/3,1/2,2/3,1] ,[0,1/4,1/3,1/2,2/3,3/4,1] ,[0,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,1] ,[0,1/6,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,5/6,1]] in map farey_sequence [2..6] == r @ABCDEFGHIJK @ABCDEFGHIJK @ABCDEFGHIJK @ABCDEFGHIJK> Safe-InferredL Ratios for M. jlet c = [0,90,204,294,408,498,612,702,792,906,996,1110] in map (round . ratio_to_cents) pythagorean_r == cMPythagorean tuning,  :http://www.microtonal-synthesis.com/scale_pythagorean.html. bdivisions pythagorean == 12 cents_i pythagorean == [0,90,204,294,408,498,612,702,792,906,996,1110]N Ratios for O. qlet c = [0,112,204,316,386,498,590,702,814,884,996,1088] in map (round . ratio_to_cents) five_limit_tuning_r == cO/Five-limit tuning (five limit just intonation). Mcents_i five_limit_tuning == [0,112,204,316,386,498,590,702,814,884,996,1088]P Ratios for Q. let c = [0,112,204,316,386,498,583,702,814,884,1018,1088] in map (round . ratio_to_cents) septimal_tritone_just_intonation == cQ'Septimal tritone Just Intonation, see >http://www.microtonal-synthesis.com/scale_just_intonation.html ]cents_i septimal_tritone_just_intonation == [0,112,204,316,386,498,583,702,814,884,1018,1088]R Ratios for S. ylet c = [0,112,204,316,386,498,583,702,814,884,969,1088] in map (round . ratio_to_cents) seven_limit_just_intonation == cSSeven limit Just Intonation. Wcents_i seven_limit_just_intonation == [0,112,204,316,386,498,583,702,814,884,969,1088]TApproximate ratios for U. flet c = [0,90,193,294,386,498,590,697,792,890,996,1088] in map (round.to_cents) kirnberger_iii_ar == cU 9http://www.microtonal-synthesis.com/scale_kirnberger.html. Icents_i kirnberger_iii == [0,90,193,294,386,498,590,697,792,890,996,1088]W0Vallotti & Young scale (Vallotti version), see  =http://www.microtonal-synthesis.com/scale_vallotti_young.html. Dcents_i vallotti == [0,94,196,298,392,502,592,698,796,894,1000,1090]Y1Mayumi Reinhard 13-limit Just Intonation scale,  7http://www.microtonal-synthesis.com/scale_reinhard.html. Lcents_i mayumi_reinhard == [0,128,139,359,454,563,637,746,841,911,1072,1183]Z Ratios for [. length lou_harrison_16_r == 16 let c = [0,112,182,231,267,316,386,498,603,702,814,884,933,969,1018,1088] in map (round . ratio_to_cents) lou_harrison_16_r == c[1Lou Harrison 16 tone Just Intonation scale, see :http://www.microtonal-synthesis.com/scale_harrison_16.html ilet r = [0,112,182,231,267,316,386,498,603,702,814,884,933,969,1018,1088] in cents_i lou_harrison_16 == r\ Ratios for ].]!Harry Partch 43 tone scale, see 5http://www.microtonal-synthesis.com/scale_partch.html 2cents_i partch_43 == [0,22,53,84,112,151,165 ,182,204,231,267,294,316 ,347,386,418,435 ,471,498,520,551,583,617,649 ,680,702,729,765,782,814,853,884,906,933 ,969,996,1018,1035,1049,1088,1116,1147,1178]^ Ratios for _._1Ben Johnston 25 note just enharmonic scale, see :http://www.microtonal-synthesis.com/scale_johnston_25.htmlLMNOPQRSTUVWXYZ[\]^_LMNOPQRSTUVWXYZ[\]^_LMNOPQRSTUVWXYZ[\]^_LMNOPQRSTUVWXYZ[\]^_? Safe-Inferred`NThree interlocking harmonic series on 1:5:3, by Larry Polansky in "Psaltery". import qualified Music.Theory.Tuning.Scala as T let fn = "/home/rohan/opt/scala/scl/polansky_ps.scl" s <- T.load fn T.scale_pitch_representations s == (0,50) 1 : Data.Either.rights (T.scale_pitches s) == psalterya of `. length psaltery == 51 && length psaltery_o == 21 psaltery_o == [1,65/64,33/32,17/16,35/32,9/8,75/64,39/32 ,5/4,21/16,85/64,11/8,45/32 ,3/2,25/16,51/32,13/8,27/16,55/32,7/4,15/8]`a`a`a`a@ Safe-Inferred j The set of K slendro tunings. lmap length k_set == replicate (length k_set) 5 minimum (concat k_set) == 206 maximum (concat k_set) == 268.5kPGiven a set of equal length lists calculate the average value of each position. /calculate_averages [[1,2,3],[3,2,1]] == [2,2,2]l Averages of K set, p. 10. 8k_averages == [233.8125,245.0625,234.0,240.8125,251.875]u The set of GM) (Gadja Mada University) slendro tunings. nmap length gm_set == replicate (length gm_set) 5 minimum (concat gm_set) == 218 maximum (concat gm_set) == 262v Averages of GM set, p. 10. 6gm_averages == [234.0,240.25,247.625,243.125,254.0625]wVAssociation list giving interval boundaries for interval class categories (pp.10-11).xCategorise an interval.yPad % to right with spaces until at least n characters. (map (pad 3) ["S","E-L"] == ["S ","E-L"]z+Pretty interval category table (pp. 10-11). i_category_table k_set == ["S L S S L " ,"S L S S L " ,"L L S S S " ,"L S S S L " ,"S S L S L " ,"S E-L S L L " ,"L E E S S " ,"S S S-E L L "] i_category_table gm_set == ["S L E-L E L " ,"L S-E E S L " ,"S S-E S L S-E" ,"S L L S L " ,"S S-E E-L S L " ,"S S-E E E L " ,"S-E S L E L " ,"S S E-L L L "]{Rational tuning derived from v, p.11. ]polansky_1984_r == sort polansky_1984_r polansky_1984_r == [1/1,8/7,21/16,512/343,12/7,96/49] Simport Music.Theory.List d_dx polansky_1984_r == [1/7,19/112,989/5488,76/343,12/49]| of {. Rimport Music.Theory.List map round (d_dx polansky_1984_c) == [231,240,223,240,231]bcdefghijklmnopqrstuvwxyz{|bcdefghijklmnopqrstuvwxyz{|bcdefghijklmtsrqponuvwxyz{|bcdefghijklmnopqrstuvwxyz{|A Safe-Inferred}9The tuning has four octaves, these ratios are per-octave.~Four-octave tuning. import Data.List.Split Blet r = [[ 0, 84, 204, 316, 386, 498, 583, 702, 814, 884, 969,1088] ,[1200,1284,1404,1516,1586,1698,1783,1902,2014,2084,2169,2288] ,[2400,2453,2604,2716,2786,2871,2951,3102,3214,3241,3369,3488] ,[3600,3684,3804,3867,3986,4098,4151,4302,4414,4506,4569,4688]] in chunksOf 12 (cents_i ps5_jpr) == r let r = [[0,84,204,316,386,498,583,702,814,884,969,1088] ,[0,84,204,316,386,498,583,702,814,884,969,1088] ,[0,53,204,316,386,471,551,702,814,841,969,1088] ,[0,84,204,267,386,498,551,702,814,906,969,1088]] chunksOf 12 (map (`mod` 1200) (cents_i ps5_jpr))}~}~}~}~B Safe-Inferred Ratios for . llet r = [0,112,204,316,386,498,610,702,814,884,996,1088] in map (round . ratio_to_cents) riley_albion_r == rDRiley's five-limit tuning as used in _The Harp of New Albion_, see  1http://www.ex-tempore.org/Volx1/hudson/hudson.htm. Hcents_i riley_albion == [0,112,204,316,386,498,610,702,814,884,996,1088]C Safe-Inferred3A scale has a description, a degree, and a list of es.A .scl pitch is either in Cents or is a .Text description of scale.#The degree of the scale (number of es).The es at . The last  element of the scale (ie. the ocatve).Is  perfect, ie.  of 2 or Cents of 1200.A pair giving the number of Cents and number of  pitches at . Pitch as , conversion by ]_ if necessary. Pitch as V, conversion by  if necessary, hence epsilon.KMake scale pitches uniform, conforming to the most promininent pitch type.Scale as list of  (ie. ) with 0 prefix.Scale as list of V (ie. ) with 1 prefix.Comment lines being with !.Remove r.Logical or of list of predicates.Remove to end of line ! comments.Remove comments and null lines. .filter_comments ["!a","b","","c"] == ["b","c"]Delete trailing .,  fails for 700..>Pitches are either cents (with decimal point) or ratios (with /). ?map pitch ["700.0","3/2","2"] == [Left 700,Right (3/2),Right 2]#Pitch lines may contain commentary.Parse .scl file.Load .scl file. s <- load "/home/rohan/data/scala/81/scl/xenakis_chrom.scl" scale_pitch_representations s == (6,1) scale_ratios 1e-3 s == [1,21/20,29/23,179/134,280/187,11/7,100/53,2]Subset of files in dir with an extension in ext. Load all .scl files at dir. db <- load_dir "/home/rohan/data/scala/81/scl" length db == 4496 length (filter ((== 0) . scale_degree) db) == 0 length (filter (== Just (Right 2)) (map scale_octave db)) == 3855 let r = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 ,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44 ,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64 ,65,66,67,68,69,70,71,72,74,75,77,78,79,80,81,84,87,88 ,90,91,92,95,96,99,100,101,105,110,112,117,118,130,140,171 ,180,271,311,342,366,441,612] in nub (sort (map scale_degree db)) == r let r = ["Xenakis's Byzantine Liturgical mode, 5 + 19 + 6 parts" ,"Xenakis's Byzantine Liturgical mode, 12 + 11 + 7 parts" ,"Xenakis's Byzantine Liturgical mode, 7 + 16 + 7 parts"] in filter (isInfixOf "Xenakis") (map scale_description db) == r 0length (filter (not . perfect_octave) db) == 544 EmapM_ (putStrLn.scale_description) (filter (not . perfect_octave) db)D Safe-Inferred"Construct an isomorphic layout of r rows and c& columns with an upper left value of (i,j).!A minimal isomorphic note layout. olet [i,j,k] = mk_isomorphic_layout 3 5 (3,-4) in [i,take 4 j,(2,-4):take 4 k] == minimal_isomorphic_note_layout3Make a rank two regular temperament from a list of (i,j)$ positions by applying the scalars a and b. Syntonic tuning system based on  of 5 rows and 7 columns starting at (3,-4) and a  with a of 1200 and indicated b. of 697. divisions syntonic_697 == 17 jlet c = [0,79,194,273,309,388,467,503,582,697,776,812,891,970,1006,1085,1164] in cents_i syntonic_697 == c of 702. divisions syntonic_702 == 17 ilet c = [0,24,114,204,294,318,408,498,522,612,702,792,816,906,996,1020,1110] in cents_i syntonic_702 == cE Safe-Inferred Approximate ratios for . plet c = [0,90,192,294,390,498,588,696,792,888,996,1092] in map (round . ratio_to_cents) werckmeister_iii_ar == c Cents for .2Werckmeister III, Andreas Werckmeister (1645-1706) Kcents_i werckmeister_iii == [0,90,192,294,390,498,588,696,792,888,996,1092]Approximate ratios for . plet c = [0,82,196,294,392,498,588,694,784,890,1004,1086] in map (round . ratio_to_cents) werckmeister_iv_ar == c Cents for .1Werckmeister IV, Andreas Werckmeister (1645-1706) Kcents_i werckmeister_iv == [0,82,196,294,392,498,588,694,784,890,1004,1086]Approximate ratios for . olet c = [0,96,204,300,396,504,600,702,792,900,1002,1098] in map (round . ratio_to_cents) werckmeister_v_ar == c Cents for .0Werckmeister V, Andreas Werckmeister (1645-1706) Jcents_i werckmeister_v == [0,96,204,300,396,504,600,702,792,900,1002,1098] Ratios for . olet c = [0,91,196,298,395,498,595,698,793,893,1000,1097] in map (round . ratio_to_cents) werckmeister_vi_r == c1Werckmeister VI, Andreas Werckmeister (1645-1706) Kcents_i werckmeister_vi == [0,91,196,298,395,498,595,698,793,893,1000,1097]    FNone% () joins ( equivalent intervals from morphologies m and n.: () determines an interval given a sequence and an index.Distance function, ordinarily n below is in , u or .] A . A . A f.Square. A f. A  A f. A  A f.City block metric, p.296 (city_block_metric (-) (1,2) (3,5) == 2+3(Two-dimensional euclidean metric, p.297. 0euclidean_metric_2 (-) (1,2) (3,5) == sqrt (4+9)n-dimensional euclidean metric geuclidean_metric_l (-) [1,2] [3,5] == sqrt (4+9) euclidean_metric_l (-) [1,2,3] [2,4,6] == sqrt (1+4+9) Cube root. map cbrt [1,8,27] == [1,2,3]n-th root "map (nthrt 4) [1,16,81] == [1,2,3]'Two-dimensional Minkowski metric, p.297 minkowski_metric_2 (-) 1 (1,2) (3,5) == 5 minkowski_metric_2 (-) 2 (1,2) (3,5) == sqrt (4+9) minkowski_metric_2 (-) 3 (1,2) (3,5) == cbrt (8+27)n-dimensional Minkowski metric rminkowski_metric_l (-) 2 [1,2,3] [2,4,6] == sqrt (1+4+9) minkowski_metric_l (-) 3 [1,2,3] [2,4,6] == cbrt (1+8+27)Integration with f. Gd_dx (-) [0,2,4,1,0] == [2,2,-3,-1] d_dx (-) [2,3,0,4,1] == [1,-3,4,-3]B  A . Kd_dx_abs (-) [0,2,4,1,0] == [2,2,3,1] d_dx_abs (-) [2,3,0,4,1] == [1,3,4,3]*Ordered linear magnitude (no delta), p.300 -olm_no_delta' [0,2,4,1,0] [2,3,0,4,1] == 1.25-Ordered linear magintude (general form) p.302 wolm_general (abs_dif (-)) [0,2,4,1,0] [2,3,0,4,1] == 1.25 olm_general (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 4.6f at indices i and i+1 of x. 5map (ix_dif (-) [0,1,3,6,10]) [0..3] == [-1,-2,-3,-4] A  4map (abs_ix_dif (-) [0,2,4,1,0]) [0..3] == [2,2,3,1] A  rmap (sqr_abs_ix_dif (-) [0,2,4,1,0]) [0..3] == [4,4,9,1] map (sqr_abs_ix_dif (-) [2,3,0,4,1]) [0..3] == [1,9,16,9]:Ordered linear magintude (generalised-interval form) p.305 olm (abs_dif dif_r) (abs_ix_dif dif_r) (const 1) [1,5,12,2,9,6] [7,6,4,9,8,1] == 4.6 olm (abs_dif dif_r) (abs_ix_dif dif_r) maximum [1,5,12,2,9,6] [7,6,4,9,8,1] == 0.46(Second order binomial coefficient, p.307 Jmap second_order_binonial_coefficient [2..10] == [1,3,6,10,15,21,28,36,45] of  i. Udirection_interval [5,9,3,2] == [LT,GT,GT] direction_interval [2,5,6,6] == [LT,LT,EQ]Histogram of list of ks. ord_hist [LT,GT,GT] == (1,0,2) Histogram of  directions of adjacent elements, p.312. Kdirection_vector [5,9,3,2] == (1,0,2) direction_vector [2,5,6,6] == (2,1,0)*Unordered linear direction, p.311 (Fig. 5) ?uld [5,9,3,2] [2,5,6,6] == 2/3 uld [5,3,6,1,4] [3,6,1,4,2] == 0Ordered linear direction, p.312 direction_interval [5,3,6,1,4] == [GT,LT,GT,LT] direction_interval [3,6,1,4,2] == [LT,GT,LT,GT] old [5,3,6,1,4] [3,6,1,4,2] == 1&Ordered combinatorial direction, p.314 Aocd [5,9,3,2] [2,5,6,6] == 5/6 ocd [5,3,6,1,4] [3,6,1,4,2] == 4/5(Unordered combinatorial direction, p.314 ucd [5,9,3,2] [2,5,6,6] == 5/6 ucd [5,3,6,1,4] [3,6,1,4,2] == 0 ucd [5,3,7,6] [2,1,2,1] == 1/2 ucd [2,1,2,1] [8,3,5,4] == 1/3 ucd [5,3,7,6] [8,3,5,4] == 1/3, Fig.9, p.318 let r = [[2,3,1,4] ,[1,3,6] ,[4,7] ,[3]] in combinatorial_magnitude_matrix (abs_dif (-)) [5,3,2,6,9] == r2Unordered linear magnitude (simplified), p.320-321 qlet r = abs (sum [5,4,3,6] - sum [12,2,11,7]) / 4 in ulm_simplified (abs_dif (-)) [1,6,2,5,11] [3,15,13,2,9] == r >ulm_simplified (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 3,Ordered combinatorial magnitude (OCM), p.323 iocm (abs_dif (-)) [1,6,2,5,11] [3,15,13,2,9] == 5.2 ocm (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 3.6,Ordered combinatorial magnitude (OCM), p.323 ocm_absolute_scaled (abs_dif (-)) [1,6,2,5,11] [3,15,13,2,9] == 0.4 ocm_absolute_scaled (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 54/(15*11)++++GNonedA method is a sequence of changes, if symmetrical only have the changes are given and the lead end.EA change either swaps all adjacent bells, or holds a subset of bells.Compete list of s at , writing out symmetries.Parse a change notation. Amap parse_change ["-","x","38"] == [Swap_All,Swap_All,Hold [3,8]]Separate changes. isplit_changes "-38-14-1258-36-14-58-16-78" split_changes "345.145.5.1.345" == ["345","145","5","1","345"]Parse 5 from the sequence of changes with possible lead end. 5parse_method ("-38-14-1258-36-14-58-16-78",Just "12")!Swap elemets of two-tuple (pair). swap_pair (1,2) == (2,1)Flatten list of pairs. %flatten_pairs [(1,2),(3,4)] == [1..4] Swap all adjacent pairs at list. &swap_all [1 .. 8] == [2,1,4,3,6,5,8,7]Parse abbreviated & notation, characters are hexedecimal. to_abbrev "38A" == [3,8,10]Given a ' notation, generate permutation cycles. Ulet r = [Right (1,2),Left 3,Right (4,5),Right (6,7),Left 8] in gen_swaps 8 [3,8] == r Rlet r = [Left 1,Left 2,Right (3,4),Right (5,6),Right (7,8)] gen_swaps 8 [1,2] == rTwo-tuple to two element list.3Swap notation to plain permutation cycles notation. olet n = [Left 1,Left 2,Right (3,4),Right (5,6),Right (7,8)] in swaps_to_cycles n == [[1],[2],[3,4],[5,6],[7,8]]/One-indexed permutation cycles to zero-indexed. Wlet r = [[0],[1],[2,3],[4,5],[6,7]] in to_zero_indexed [[1],[2],[3,4],[5,6],[7,8]] == rApply abbreviated  notation, given cardinality. :swap_abbrev 8 [3,8] [2,1,4,3,6,5,8,7] == [1,2,4,6,3,8,5,7]Apply a .Apply a =, gives next starting sequence and the course of the method. let r = ([1,2,4,5,3] ,[[1,2,3,4,5],[2,1,3,4,5],[2,3,1,4,5],[3,2,4,1,5],[3,4,2,5,1] ,[4,3,2,5,1],[4,2,3,1,5],[2,4,1,3,5],[2,1,4,3,5],[1,2,4,3,5]]) in apply_method cambridgeshire_slow_course_doubles [1..5] == rIteratively apply a > until it closes (ie. arrives back at the starting sequence). Elength (closed_method cambridgeshire_slow_course_doubles [1..5]) == 3t of  with initial sequence appended.#Cambridgeshire Slow Course Doubles. Jhttps://rsw.me.uk/blueline/methods/view/Cambridgeshire_Slow_Course_Doubles Elength (closed_method cambridgeshire_slow_course_doubles [1..5]) == 3"Double Cambridge Cyclic Bob Minor. Ihttps://rsw.me.uk/blueline/methods/view/Double_Cambridge_Cyclic_Bob_Minor Dlength (closed_method double_cambridge_cyclic_bob_minor [1..6]) == 5Hammersmith Bob Triples ?https://rsw.me.uk/blueline/methods/view/Hammersmith_Bob_Triples :length (closed_method hammersmith_bob_triples [1..7]) == 6Cambridge Surprise Major. @https://rsw.me.uk/blueline/methods/view/Cambridge_Surprise_Major ;length (closed_method cambridge_surprise_major [1..8]) == 7Smithsonian Surprise Royal. Bhttps://rsw.me.uk/blueline/methods/view/Smithsonian_Surprise_Royal >length (closed_method smithsonian_surprise_royal [1..10]) == 9H Safe-InferredBA  parser.Linear form of , an ascending sequence of . Linear term.Linear state.  is the start time of the term, C is the active tempo & therefore the reciprocal of the duration,  is the part label.KVoices are named as a sequence of left and right directions within nested  structures. Time point.Recursive temporal structure.Tempo multiplierParallelSequenceIsolate Leaf node3Terms are the leaf nodes of the temporal structure.&Tempo is rational. The duration of a  is the reciprocal of the  that is in place at the . Types of  nodes. The different & modes are indicated by bracket types. Pretty printer for ), given pretty printer for the term type.   of C.=Analyse a Par node giving (duration,LHS-tempo-*,RHS-tempo-*). -par_analyse 1 Par_Left (nseq "cd") (nseq "efg") == (2,1,3/2) par_analyse 1 Par_Right (nseq "cd") (nseq "efg") == (3,2/3,1) par_analyse 1 Par_Min (nseq "cd") (nseq "efg") == (2,1,3/2) par_analyse 1 Par_Max (nseq "cd") (nseq "efg") == (3,2/3,1) par_analyse 1 Par_None (nseq "cd") (nseq "efg") == (3,1,1)Duration element of .&Calculate final tempo and duration of . of .Start time of . Duration of  (reciprocal of tempo). End time of . Linearise  given initial , ascending by construction.Merge two ascending .Set of unique  at . Multiply  by n , and divide  by n.?After normalisation all start times and durations are integral.FAll leftmost voices are re-written to the last non-left turning point. ]map voice_normalise ["","l","ll","lll"] == replicate 4 "" voice_normalise "lllrlrl" == "rlrl"j  Unique s at .The duration of . Locate an ! that is active at the indicated  and in the indicated .#Calculate grid (phase diagram) for .  of .!Bel type phase diagram for  of 0. Optionally print whitespace between columns." of !.#Infix form for .$ of . _lseq [Node Rest] == Node Rest lseq [Node Rest,Node Continue] == Seq (Node Rest) (Node Continue)% of .&$ of ' Variant of & where _ is read as  and - as .( of , this is the default .) of .*$ of  of ).+ Verify that   of = is S.,Run =, and print both   and !. 5bel_ascii_pp "{i{ab,{c[d,oh]e,sr{p,qr}}},{jk,ghjkj}}"-Parse  . P.parse p_rest "" "-".Parse  . P.parse p_nrests "" "3"/Parse  . P.parse p_continue "" "_"0Parse   . P.parse p_char_value "" "a"1Parse  . &P.parse (P.many1 p_char_term) "" "-_a"2Parse  . &P.parse (P.many1 p_char_node) "" "-_a"3Parse positive . P.parse p_integer "" "3"4Parse positive V. 8P.parse (p_rational `P.sepBy` (P.char ',')) "" "3%5,2/3"5Parse positive U. TP.parse p_double "" "3.5" P.parse (p_double `P.sepBy` (P.char ',')) "" "3.5,7.2,1.0"6Parse positive number as V. 8P.parse (p_number `P.sepBy` (P.char ',')) "" "7%2,3.5,3"7Parse . #P.parse (P.many1 p_mul) "" "/3*3/2"8Given parser for  a , generate  parser.98 of <. P.parse p_char_iso "" "{abcde}":Given parser for  a , generate  parser.;: of <. HP.parse p_char_par "" "{ab,{c,de}}" P.parse p_char_par "" "{ab,~(c,de)}"<Parse  . 'P.parse (P.many1 p_char_bel) "" "-_a*3"=Run parser for  of .K      !"#$%&'()*+,-./0123456789:;<=K      !"#$%&'()*+,-./0123456789:;<=K      !"#$%&'()*+,-./0123456789:;<=>      !"#$%&'()*+,-./0123456789:;<=I Safe-Inferred>, with 12-ET/24-ET tuning deviation given in .?Tuple indicating nearest  to  frequency with ET( frequency, and deviation in hertz and .@ and .A)12-tone equal temperament table equating 3 and frequency over range of human hearing, where A4 = 440hz. olength tbl_12et == 132 let min_max l = (minimum l,maximum l) min_max (map (round . snd) tbl_12et) == (16,31609)B%24-tone equal temperament variant of A. Ilength tbl_24et == 264 min_max (map (round . snd) tbl_24et) == (16,32535)C Given an ET* table (or like) find bounds of frequency. ]let r = Just (at_pair octpc_to_pitch_cps ((3,11),(4,0))) in bounds_et_table tbl_12et 256 == rDC of A.  map bounds_12et_tone (hsn 17 55)En-decimal places. ndp 3 (1/3) == "0.333"F Pretty print ?.HForm ? for  frequency by consulting table. let {f = 256 ;f' = octpc_to_cps (4,0) ;r = (f,Pitch C Natural 4,f',f-f',fratio_to_cents (f/f'))} in nearest_et_table_tone tbl_12et 256 == rIH for A.JH for B. Wlet r = "55.0 A1 55.0 0.0 0.0" in unwords (hs_r_pitch_pp 1 (nearest_24et_tone 55)) == rK4Monzo 72-edo HEWM notation. The domain is (-9,9). .http://www.tonalsoft.com/enc/number/72edo.aspx ]let r = ["+",">","^","#<","#-","#","#+","#>","#^"] in map alteration_72et_monzo [1 .. 9] == r blet r = ["-","<","v","b>","b+","b","b-","b<","bv"] in map alteration_72et_monzo [-1,-2 .. -9] == rLGiven a midi note number and 1/6 deviation determine  and frequency. let {f = pitch'_pp . fst . pitch_72et ;r = "C4 C+4 C>4 C^4 C#<4 C#-4 C#4 C#+4 C#>4 C#^4"} in unwords (map f (zip (repeat 60) [0..9])) == r let {f = pitch'_pp . fst . pitch_72et ;r = "A4 A+4 A>4 A^4 Bb<4 Bb-4 Bb4 Bb+4 Bb>4 Bv4"} in unwords (map f (zip (repeat 69) [0..9])) let {f = pitch'_pp . fst . pitch_72et ;r = "Bb4 Bb+4 Bb>4 Bv4 B<4 B-4 B4 B+4 B>4 B^4"} in unwords (map f (zip (repeat 70) [0..9])) == rM)72-tone equal temperament table equating 3 and frequency over range of human hearing, where A4 = 440hz. Ilength tbl_72et == 792 min_max (map (round . snd) tbl_72et) == (16,33167)NH for M. Zlet r = "324.0 E<4 323.3 0.7 3.5" in unwords (hs_r_pp pitch'_pp 1 (nearest_72et_tone 324)) hlet {f = take 2 . hs_r_pp pitch'_pp 1 . nearest_72et_tone . snd} in mapM_ (print . unwords . f) tbl_72etOExract > from ?.PNearest 12-ET > to indicated frequency (hz). +nearest_pitch_detune_12et 452.8929841231365QNearest 24-ET > to indicated frequency (hz). +nearest_pitch_detune_24et 452.8929841231365RGiven near function, f0 and ratio derive >.SFrequency (hz) of >. 9pitch_detune_to_cps (octpc_to_pitch pc_spell_ks (4,9),50)TR of IUR of JWMarkdown pretty-printer for >.XHTML pretty-printer for >.YNo-octave variant of W.ZNo-octave variant of X.>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ@ABCD?EFGHIJKLMN>OPQRSTUVWXYZ>?@ABCDEFGHIJKLMNOPQRSTUVWXYZJ Safe-Inferred [(Kanjutmesem Slendro (S1,S2,S3,S5,S6,S1') -L.d_dx kanjutmesem_s == [252,238,241,236,253]\,Kanjutmesem Pelog (P1,P2,P3,P4,P5,P6,P7,P1') 5L.d_dx kanjutmesem_p == [141,141,272,140,115,172,246]]#Darius Slendro (S1,S2,S3,S5,S6,S1') OL.d_dx darius_s == [204,231,267,231,267] ax_r darius_s == [9/8,8/7,7/6,8/7,7/6]^*Madeleine Pelog (P1,P2,P3,P4,P5,P6,P7,P1') oL.d_dx madeleine_p == [139,128,336,99,94,173,231] ax_r madeleine_p == [13/12,14/13,17/14,18/17,19/18,21/19,8/7]_&Lipur Sih Slendro (S1,S2,S3,S5,S6,S1') +L.d_dx lipur_sih_s == [273,236,224,258,256]`*Lipur Sih Pelog (P1,P2,P3,P4,P5,P6,P7,P1') /L.d_dx lipur_sih_p == [110,153,253,146,113,179]a5Idealized ET Slendro, 5-tone equal temperament (p.17) .L.d_dx idealized_et_s == [240,240,240,240,240]b=Idealized ET Pelog, subset of 9-tone equal temperament (p.17) DL.d_dx idealized_et_p == [400/3,800/3,400/3,400/3,400/3,400/3,800/3]c)Reconstruct approximate ratios to within 1e-3 from intervals. [\]^_`abc [\]^_`abc [\]^_`abc [\]^_`abcK Safe-InferreddA Sieve.ee of two dsff of two dsg Primitive d of modulo and indexhh di Synonym for jThe f of a list of ds, ie.  f.kThe e of a list of ds, ie.  e.lUnicode synonym for f.mUnicode synonym for e.n Variant of g, ie.  g. l 15 19 == L (15,19)ounicode synonym for n.pIn a normal d m is  i. !normalise (L (15,19)) == L (15,4)qPredicate to test if a d is normal. is_normal (L (15,4)) == TruerPredicate to determine if an i is an element of the d. xmap (element (L (3,1))) [1..4] == [True,False,False,True] map (element (L (15,4))) [4,19 .. 49] == [True,True,True,True]s$Construct the sequence defined by a d`. Note that building a sieve that contains an intersection clause that has no elements gives _|_. dlet {d = [0,2,4,5,7,9,11] ;r = d ++ map (+ 12) d} in take 14 (build (union (map (l 12) d))) == rt Variant of s that gives the first n places of the y of d. buildn 6 (union (map (l 8) [0,3,6])) == [0,3,6,8,11,14] buildn 12 (L (3,2)) == [2,5,8,11,14,17,20,23,26,29,32,35] buildn 9 (L (8,0)) == [0,8,16,24,32,40,48,56,64] buildn 3 (L (3,2) ") L (8,0)) == [8,32,56] buildn 12 (L (3,1) "* L (4,0)) == [0,1,4,7,8,10,12,13,16,19,20,22] buildn 14 (5"4 "* 3"2 "* 7"3) == [2,3,4,5,8,9,10,11,14,17,19,20,23,24] buildn 6 (3"0 "* 4"0) == [0,3,4,6,8,9] buildn 8 (5"2 ") 2"0 "* 7"3) == [2,3,10,12,17,22,24,31] buildn 12 (5"1 "* 7"2) == [1,2,6,9,11,16,21,23,26,30,31,36] Ebuildn 10 (3"2 ") 4"7 "* 6"9 ") 15"18) == [3,11,23,33,35,47,59,63,71,83] let {s = 3"2")4"7")6"11")8"7 "* 6"9")15"18 "* 13"5")8"6")4"2 "* 6"9")15"19 ;s' = 24"23 "* 30"3 "* 104"70} in buildn 16 s == buildn 16 s' Dbuildn 10 (24"23 "* 30"3 "* 104"70) == [3,23,33,47,63,70,71,93,95,119] Zlet r = [2,3,4,5,8,9,10,11,14,17,19,20,23,24,26,29,31] in buildn 17 (5"4 "* 3"2 "* 7"3) == r [let r = [0,1,3,6,9,10,11,12,15,16,17,18,21,24,26,27,30] in buildn 17 (5"1 "* 3"0 "* 7"3) == r _let r = [0,2,3,4,6,7,9,11,12,15,17,18,21,22,24,25,27,30,32] in buildn 19 (5"2 "* 3"0 "* 7"4) == ru"Standard differentiation function. Xdifferentiate [1,3,6,10] == [2,3,4] differentiate [0,2,4,5,7,9,11,12] == [2,2,1,2,2,2,1]v=Euclid's algorithm for computing the greatest common divisor. euclid 1989 867 == 51wBachet De Mziriac's algorithm. )de_meziriac 15 4 == 3 && euclid 15 4 == 1xAttempt to reduce the e of two g nodes to a singular g node. reduce_intersection (3,2) (4,7) == Just (12,11) reduce_intersection (12,11) (6,11) == Just (12,11) reduce_intersection (12,11) (8,7) == Just (24,23)y Reduce the number of nodes at a d. reduce (L (3,2) "* Empty) == L (3,2) reduce (L (3,2) ") Empty) == L (3,2) reduce (L (3,2) ") L (4,7)) == L (12,11) reduce (L (6,9) ") L (15,18)) == L (30,3) flet s = 3"2")4"7")6"11")8"7 "* 6"9")15"18 "* 13"5")8"6")4"2 "* 6"9")15"19 in reduce s == (24"23 "* 30"3 "* 104"70) flet s = 3"2")4"7")6"11")8"7 "* 6"9")15"18 "* 13"5")8"6")4"2 "* 6"9")15"19 in reduce s == (24"23 "* 30"3 "* 104"70)defghijklmnopqrstuvwxydefghijklmnopqrstuvwxyidhgfejklmnopqrstuvwxydhgfeijklmnopqrstuvwxylmoL Safe-Inferred zT-related rotations of p. 5t_rotations 12 [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]]{T/I-related rotations of p. lti_rotations 12 [0,1,3] == [[0,1,3],[0,2,11],[0,9,10] ,[0,9,11],[0,2,3],[0,1,10]]|5Variant with default value for empty input list case.}2Prime form rule requiring comparator, considering z.~2Prime form rule requiring comparator, considering {.CForte comparison function (rightmost first then leftmost outwards). +forte_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == LTForte prime form, ie.  cmp_prime of . Nforte_prime 12 [0,1,3,6,8,9] == [0,1,3,6,8,9] forte_prime 5 [0,1,4] == [0,1,2] /S.set (map (forte_prime 5) (S.powerset [0..4])),Transpositional equivalence prime form, ie. } of . @(forte_prime 12 [0,2,3],t_prime 12 [0,2,3]) == ([0,1,3],[0,2,3])Interval class of i interval i. umap (ic 5) [1,2,3,4] == [1,2,2,1] map (ic 12) [5,6,7] == [5,6,5] map (ic 12 . to_Z 12) [-13,-1,0,1,13] == [1,1,0,1,1])Forte notation for interval class vector. %icv 12 [0,1,2,4,7,8] == [3,2,2,3,3,2]GBasic interval pattern, see Allen Forte "The Basic Interval Patterns" JMT 17/2 (1973):234-272bip 0t95728e3416 11223344556 =bip 12 [0,10,9,5,7,2,8,11,3,4,1,6] == [1,1,2,2,3,3,4,4,5,5,6] z{|}~ z{|}~ z{|}~ z{|}~MNone  Synonym for .T-related rotations of p. 2t_rotations [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]]T/I-related rotations of p. fti_rotations [0,1,3] == [[0,1,3],[0,2,11],[0,9,10] ,[0,9,11],[0,2,3],[0,1,10]]Forte prime form, ie.  cmp_prime of  forte_cmp. *forte_prime [0,1,3,6,8,9] == [0,1,3,6,8,9],Transpositional equivalence prime form, ie.  t_cmp_prime of  forte_cmp. :(forte_prime [0,2,3],t_prime [0,2,3]) == ([0,1,3],[0,2,3])(The set-class table (Forte prime forms). length sc_table == 2247Lookup a set-class name. The input set is subject to  before lookup. ?sc_name [0,2,3,6,7] == "5-Z18" sc_name [0,1,4,6,7,8] == "6-Z17"*Lookup a set-class given a set-class name. sc "6-Z17" == [0,1,2,4,7,8]-List of set classes (the set class universe). .let r = [("0-1",[0,0,0,0,0,0]) ,("1-1",[0,0,0,0,0,0]) ,("2-1",[1,0,0,0,0,0]) ,("2-2",[0,1,0,0,0,0]) ,("2-3",[0,0,1,0,0,0]) ,("2-4",[0,0,0,1,0,0]) ,("2-5",[0,0,0,0,1,0]) ,("2-6",[0,0,0,0,0,1]) ,("3-1",[2,1,0,0,0,0]) ,("3-2",[1,1,1,0,0,0]) ,("3-3",[1,0,1,1,0,0]) ,("3-4",[1,0,0,1,1,0]) ,("3-5",[1,0,0,0,1,1]) ,("3-6",[0,2,0,1,0,0]) ,("3-7",[0,1,1,0,1,0]) ,("3-8",[0,1,0,1,0,1]) ,("3-9",[0,1,0,0,2,0]) ,("3-10",[0,0,2,0,0,1]) ,("3-11",[0,0,1,1,1,0]) ,("3-12",[0,0,0,3,0,0]) ,("4-1",[3,2,1,0,0,0]) ,("4-2",[2,2,1,1,0,0]) ,("4-3",[2,1,2,1,0,0]) ,("4-4",[2,1,1,1,1,0]) ,("4-5",[2,1,0,1,1,1]) ,("4-6",[2,1,0,0,2,1]) ,("4-7",[2,0,1,2,1,0]) ,("4-8",[2,0,0,1,2,1]) ,("4-9",[2,0,0,0,2,2]) ,("4-10",[1,2,2,0,1,0]) ,("4-11",[1,2,1,1,1,0]) ,("4-12",[1,1,2,1,0,1]) ,("4-13",[1,1,2,0,1,1]) ,("4-14",[1,1,1,1,2,0]) ,("4-Z15",[1,1,1,1,1,1]) ,("4-16",[1,1,0,1,2,1]) ,("4-17",[1,0,2,2,1,0]) ,("4-18",[1,0,2,1,1,1]) ,("4-19",[1,0,1,3,1,0]) ,("4-20",[1,0,1,2,2,0]) ,("4-21",[0,3,0,2,0,1]) ,("4-22",[0,2,1,1,2,0]) ,("4-23",[0,2,1,0,3,0]) ,("4-24",[0,2,0,3,0,1]) ,("4-25",[0,2,0,2,0,2]) ,("4-26",[0,1,2,1,2,0]) ,("4-27",[0,1,2,1,1,1]) ,("4-28",[0,0,4,0,0,2]) ,("4-Z29",[1,1,1,1,1,1]) ,("5-1",[4,3,2,1,0,0]) ,("5-2",[3,3,2,1,1,0]) ,("5-3",[3,2,2,2,1,0]) ,("5-4",[3,2,2,1,1,1]) ,("5-5",[3,2,1,1,2,1]) ,("5-6",[3,1,1,2,2,1]) ,("5-7",[3,1,0,1,3,2]) ,("5-8",[2,3,2,2,0,1]) ,("5-9",[2,3,1,2,1,1]) ,("5-10",[2,2,3,1,1,1]) ,("5-11",[2,2,2,2,2,0]) ,("5-Z12",[2,2,2,1,2,1]) ,("5-13",[2,2,1,3,1,1]) ,("5-14",[2,2,1,1,3,1]) ,("5-15",[2,2,0,2,2,2]) ,("5-16",[2,1,3,2,1,1]) ,("5-Z17",[2,1,2,3,2,0]) ,("5-Z18",[2,1,2,2,2,1]) ,("5-19",[2,1,2,1,2,2]) ,("5-20",[2,1,1,2,3,1]) ,("5-21",[2,0,2,4,2,0]) ,("5-22",[2,0,2,3,2,1]) ,("5-23",[1,3,2,1,3,0]) ,("5-24",[1,3,1,2,2,1]) ,("5-25",[1,2,3,1,2,1]) ,("5-26",[1,2,2,3,1,1]) ,("5-27",[1,2,2,2,3,0]) ,("5-28",[1,2,2,2,1,2]) ,("5-29",[1,2,2,1,3,1]) ,("5-30",[1,2,1,3,2,1]) ,("5-31",[1,1,4,1,1,2]) ,("5-32",[1,1,3,2,2,1]) ,("5-33",[0,4,0,4,0,2]) ,("5-34",[0,3,2,2,2,1]) ,("5-35",[0,3,2,1,4,0]) ,("5-Z36",[2,2,2,1,2,1]) ,("5-Z37",[2,1,2,3,2,0]) ,("5-Z38",[2,1,2,2,2,1]) ,("6-1",[5,4,3,2,1,0]) ,("6-2",[4,4,3,2,1,1]) ,("6-Z3",[4,3,3,2,2,1]) ,("6-Z4",[4,3,2,3,2,1]) ,("6-5",[4,2,2,2,3,2]) ,("6-Z6",[4,2,1,2,4,2]) ,("6-7",[4,2,0,2,4,3]) ,("6-8",[3,4,3,2,3,0]) ,("6-9",[3,4,2,2,3,1]) ,("6-Z10",[3,3,3,3,2,1]) ,("6-Z11",[3,3,3,2,3,1]) ,("6-Z12",[3,3,2,2,3,2]) ,("6-Z13",[3,2,4,2,2,2]) ,("6-14",[3,2,3,4,3,0]) ,("6-15",[3,2,3,4,2,1]) ,("6-16",[3,2,2,4,3,1]) ,("6-Z17",[3,2,2,3,3,2]) ,("6-18",[3,2,2,2,4,2]) ,("6-Z19",[3,1,3,4,3,1]) ,("6-20",[3,0,3,6,3,0]) ,("6-21",[2,4,2,4,1,2]) ,("6-22",[2,4,1,4,2,2]) ,("6-Z23",[2,3,4,2,2,2]) ,("6-Z24",[2,3,3,3,3,1]) ,("6-Z25",[2,3,3,2,4,1]) ,("6-Z26",[2,3,2,3,4,1]) ,("6-27",[2,2,5,2,2,2]) ,("6-Z28",[2,2,4,3,2,2]) ,("6-Z29",[2,2,4,2,3,2]) ,("6-30",[2,2,4,2,2,3]) ,("6-31",[2,2,3,4,3,1]) ,("6-32",[1,4,3,2,5,0]) ,("6-33",[1,4,3,2,4,1]) ,("6-34",[1,4,2,4,2,2]) ,("6-35",[0,6,0,6,0,3]) ,("6-Z36",[4,3,3,2,2,1]) ,("6-Z37",[4,3,2,3,2,1]) ,("6-Z38",[4,2,1,2,4,2]) ,("6-Z39",[3,3,3,3,2,1]) ,("6-Z40",[3,3,3,2,3,1]) ,("6-Z41",[3,3,2,2,3,2]) ,("6-Z42",[3,2,4,2,2,2]) ,("6-Z43",[3,2,2,3,3,2]) ,("6-Z44",[3,1,3,4,3,1]) ,("6-Z45",[2,3,4,2,2,2]) ,("6-Z46",[2,3,3,3,3,1]) ,("6-Z47",[2,3,3,2,4,1]) ,("6-Z48",[2,3,2,3,4,1]) ,("6-Z49",[2,2,4,3,2,2]) ,("6-Z50",[2,2,4,2,3,2]) ,("7-1",[6,5,4,3,2,1]) ,("7-2",[5,5,4,3,3,1]) ,("7-3",[5,4,4,4,3,1]) ,("7-4",[5,4,4,3,3,2]) ,("7-5",[5,4,3,3,4,2]) ,("7-6",[5,3,3,4,4,2]) ,("7-7",[5,3,2,3,5,3]) ,("7-8",[4,5,4,4,2,2]) ,("7-9",[4,5,3,4,3,2]) ,("7-10",[4,4,5,3,3,2]) ,("7-11",[4,4,4,4,4,1]) ,("7-Z12",[4,4,4,3,4,2]) ,("7-13",[4,4,3,5,3,2]) ,("7-14",[4,4,3,3,5,2]) ,("7-15",[4,4,2,4,4,3]) ,("7-16",[4,3,5,4,3,2]) ,("7-Z17",[4,3,4,5,4,1]) ,("7-Z18",[4,3,4,4,4,2]) ,("7-19",[4,3,4,3,4,3]) ,("7-20",[4,3,3,4,5,2]) ,("7-21",[4,2,4,6,4,1]) ,("7-22",[4,2,4,5,4,2]) ,("7-23",[3,5,4,3,5,1]) ,("7-24",[3,5,3,4,4,2]) ,("7-25",[3,4,5,3,4,2]) ,("7-26",[3,4,4,5,3,2]) ,("7-27",[3,4,4,4,5,1]) ,("7-28",[3,4,4,4,3,3]) ,("7-29",[3,4,4,3,5,2]) ,("7-30",[3,4,3,5,4,2]) ,("7-31",[3,3,6,3,3,3]) ,("7-32",[3,3,5,4,4,2]) ,("7-33",[2,6,2,6,2,3]) ,("7-34",[2,5,4,4,4,2]) ,("7-35",[2,5,4,3,6,1]) ,("7-Z36",[4,4,4,3,4,2]) ,("7-Z37",[4,3,4,5,4,1]) ,("7-Z38",[4,3,4,4,4,2]) ,("8-1",[7,6,5,4,4,2]) ,("8-2",[6,6,5,5,4,2]) ,("8-3",[6,5,6,5,4,2]) ,("8-4",[6,5,5,5,5,2]) ,("8-5",[6,5,4,5,5,3]) ,("8-6",[6,5,4,4,6,3]) ,("8-7",[6,4,5,6,5,2]) ,("8-8",[6,4,4,5,6,3]) ,("8-9",[6,4,4,4,6,4]) ,("8-10",[5,6,6,4,5,2]) ,("8-11",[5,6,5,5,5,2]) ,("8-12",[5,5,6,5,4,3]) ,("8-13",[5,5,6,4,5,3]) ,("8-14",[5,5,5,5,6,2]) ,("8-Z15",[5,5,5,5,5,3]) ,("8-16",[5,5,4,5,6,3]) ,("8-17",[5,4,6,6,5,2]) ,("8-18",[5,4,6,5,5,3]) ,("8-19",[5,4,5,7,5,2]) ,("8-20",[5,4,5,6,6,2]) ,("8-21",[4,7,4,6,4,3]) ,("8-22",[4,6,5,5,6,2]) ,("8-23",[4,6,5,4,7,2]) ,("8-24",[4,6,4,7,4,3]) ,("8-25",[4,6,4,6,4,4]) ,("8-26",[4,5,6,5,6,2]) ,("8-27",[4,5,6,5,5,3]) ,("8-28",[4,4,8,4,4,4]) ,("8-Z29",[5,5,5,5,5,3]) ,("9-1",[8,7,6,6,6,3]) ,("9-2",[7,7,7,6,6,3]) ,("9-3",[7,6,7,7,6,3]) ,("9-4",[7,6,6,7,7,3]) ,("9-5",[7,6,6,6,7,4]) ,("9-6",[6,8,6,7,6,3]) ,("9-7",[6,7,7,6,7,3]) ,("9-8",[6,7,6,7,6,4]) ,("9-9",[6,7,6,6,8,3]) ,("9-10",[6,6,8,6,6,4]) ,("9-11",[6,6,7,7,7,3]) ,("9-12",[6,6,6,9,6,3]) ,("10-1",[9,8,8,8,8,4]) ,("10-2",[8,9,8,8,8,4]) ,("10-3",[8,8,9,8,8,4]) ,("10-4",[8,8,8,9,8,4]) ,("10-5",[8,8,8,8,9,4]) ,("10-6",[8,8,8,8,8,5]) ,("11-1",[10,10,10,10,10,5]) ,("12-1",[12,12,12,12,12,6])] in let icvs = map icv scs in zip (map sc_name scs) icvs == r Cardinality n subset of . >map (length . scs_n) [1..11] == [1,6,12,29,38,50,38,29,12,6,1]GBasic interval pattern, see Allen Forte "The Basic Interval Patterns" JMT 17/2 (1973):234-272bip 0t95728e3416 11223344556 nbip [0,10,9,5,7,2,8,11,3,4,1,6] == [1,1,2,2,3,3,4,4,5,5,6] bip (pco "0t95728e3416") == [1,1,2,2,3,3,4,4,5,5,6]Interval class of Z12 interval i. ?map ic [5,6,7] == [5,6,5] map ic [-13,-1,0,1,13] == [1,1,0,1,1])Forte notation for interval class vector. "icv [0,1,2,4,7,8] == [3,2,2,3,3,2]    NNone$Predicate for list with cardinality n.Set classes of cardinality n. 5sc_table_n 2 == [[0,1],[0,2],[0,3],[0,4],[0,5],[0,6]]/Minima and maxima of ICV of SCs of cardinality n. -icv_minmax 5 == ([0,0,0,1,0,0],[4,4,4,4,4,2])Pretty printer for . map r_pp [MIN,MAX] == ["+","-"]$ element measure with given funtion. Pretty printer for SATV element. 9satv_e_pp (satv_a [0,1,2,6,7,8]) == "<-1,+2,+0,+0,-1,-0>"Pretty printer for .SATVa measure. qsatv_e_pp (satv_a [0,1,2,6,7,8]) == "<-1,+2,+0,+0,-1,-0>" satv_e_pp (satv_a [0,1,2,3,4]) == "<-0,-1,-2,+0,+0,+0>"SATVb measure. qsatv_e_pp (satv_b [0,1,2,6,7,8]) == "<+4,-4,-5,-4,+4,+3>" satv_e_pp (satv_b [0,1,2,3,4]) == "<+4,+3,+2,-3,-4,-2>" measure. satv_pp (satv [0,3,6,9]) == "(<+0,+0,-0,+0,+0,-0>,<-3,-3,+4,-3,-3,+2>)" satv_pp (satv [0,1,3,4,8]) == "(<-2,+1,-2,-1,-2,+0>,<+2,-3,+2,+2,+2,-2>)" satv_pp (satv [0,1,2,6,7,8]) == "(<-1,+2,+0,+0,-1,-0>,<+4,-4,-5,-4,+4,+3>)" satv_pp (satv [0,4]) == "(<+0,+0,+0,-0,+0,+0>,<-1,-1,-1,+1,-1,-1>)" satv_pp (satv [0,1,3,4,6,9]) == "(<+2,+2,-0,+0,+2,-1>,<-3,-4,+5,-4,-3,+2>)" satv_pp (satv [0,1,3,6,7,9]) == "(<+2,+2,-1,+0,+2,-0>,<-3,-4,+4,-4,-3,+3>)" satv_pp (satv [0,1,2,3,6]) == "(<-1,-2,-2,+0,+1,-1>,<+3,+2,+2,-3,-3,+1>)" satv_pp (satv [0,1,2,3,4,6]) == "(<-1,-2,-2,+0,+1,+1>,<+4,+4,+3,-4,-4,-2>)" satv_pp (satv [0,1,3,6,8]) == "(<+1,-2,-2,+0,-1,-1>,<-3,+2,+2,-3,+3,+1>)" satv_pp (satv [0,2,3,5,7,9]) == "(<+1,-2,-2,+0,-1,+1>,<-4,+4,+3,-4,+4,-2>)" reorganised by . Asatv_minmax (satv [0,1,2,6,7,8]) == ([4,2,0,0,4,3],[1,4,5,4,1,0])Absolute difference.Sum of numerical components of a and b parts of . \satv_n_sum (satv [0,1,2,6,7,8]) == [5,6,5,4,5,3] satv_n_sum (satv [0,3,6,9]) = [3,3,4,3,3,2]SATSIM metric. 4satsim [0,1,2,6,7,8] [0,3,6,9] == 25/46 satsim [0,4] [0,1,3,4,6,9] == 25/34 satsim [0,4] [0,1,3,6,7,9] == 25/34 satsim [0,1,2,3,6] [0,1,2,3,4,6] == 1/49 satsim [0,1,3,6,8] [0,2,3,5,7,9] == 1/49 satsim [0,1,2,3,4] [0,1,4,5,7] == 8/21 satsim [0,1,2,3,4] [0,2,4,6,8] == 4/7 satsim [0,1,4,5,7] [0,2,4,6,8] == 4/7 Table of  measures for all SC pairs. length satsim_table == 24310Histogram of values at . <satsim_table_histogram == T.histogram (map snd satsim_table)ONoneSIM ~icv [0,1,3,6] == [1,1,2,0,1,1] && icv [0,2,4,7] == [0,2,1,1,2,0] sim [0,1,3,6] [0,2,4,7] == 6 sim [0,1,2,4,5,8] [0,1,3,7] == 9ASIM asim [0,1,3,6] [0,2,4,7] == 6/12 asim [0,1,2,4,5,8] [0,1,3,7] == 9/21 asim [0,1,2,3,4] [0,1,4,5,7] == 2/5 asim [0,1,2,3,4] [0,2,4,6,8] == 3/5 asim [0,1,4,5,7] [0,2,4,6,8] == 3/5PNone2Rahn prime form (comparison is rightmost inwards). *rahn_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == GTRahn prime form, ie.  ti_cmp_prime of . )rahn_prime [0,1,3,6,8,9] == [0,2,3,6,7,9] "import Music.Theory.Z12.Forte_1973 let s = [[0,1,3,7,8] ,[0,1,3,6,8,9],[0,1,3,5,8,9] ,[0,1,2,4,7,8,9] ,[0,1,2,4,5,7,9,10]] in all (\p -> forte_prime p /= rahn_prime p) s == TrueQNoneIs p symmetrical under inversion. import Music.Theory.Z12.Forte_1973 map inv_sym (scs_n 2) == [True,True,True,True,True,True] map (fromEnum.inv_sym) (scs_n 3) == [1,0,0,0,0,1,0,0,1,1,0,1]If p is not  then (p,invert 0 p) else P. Dsc_t_ti [0,2,4] == Nothing sc_t_ti [0,1,3] == Just ([0,1,3],[0,2,3])/Transpositional equivalence variant of Forte's sc_tableB. The inversionally related classes are distinguished by labels A and B; the class providing the best normal order (Forte 1973) is always the A class. If neither A nor BF appears in the name of a set-class, it is inversionally symmetrical. _(length sc_table,length t_sc_table) == (224,352) lookup "5-Z18B" t_sc_table == Just [0,2,3,6,7]7Lookup a set-class name. The input set is subject to t_prime before lookup. Et_sc_name [0,2,3,6,7] == "5-Z18B" t_sc_name [0,1,4,6,7,8] == "6-Z17B"*Lookup a set-class given a set-class name. t_sc "6-Z17A" == [0,1,2,4,7,8]List of set classes. Cardinality n subset of . <map (length . t_scs_n) [2..10] == [6,19,43,66,80,66,43,19,6] T-related q that are subsets of p. t_subsets [0,1,2,3,4] [0,1] == [[0,1],[1,2],[2,3],[3,4]] t_subsets [0,1,2,3,4] [0,1,4] == [[0,1,4]] t_subsets [0,2,3,6,7] [0,1,4] == [[2,3,6]] T/I-related q that are subsets of p. ti_subsets [0,1,2,3,4] [0,1] == [[0,1],[1,2],[2,3],[3,4]] ti_subsets [0,1,2,3,4] [0,1,4] == [[0,1,4],[0,3,4]] ti_subsets [0,2,3,6,7] [0,1,4] == [[2,3,6],[3,6,7]]Trivial run length encoder. <rle "abbcccdde" == [(1,'a'),(2,'b'),(3,'c'),(2,'d'),(1,'e')] Inverse of . +rle_decode [(5,'a'),(4,'b')] == "aaaaabbbb" Length of rle encoded sequence. !rle_length [(5,'a'),(4,'b')] == 9T-equivalence n)-class vector (subset-class vector, nCV). t_n_class_vector 2 [0..4] == [4,3,2,1,0,0] rle (t_n_class_vector 3 [0..4]) == [(1,3),(2,2),(2,1),(4,0),(1,1),(9,0)] rle (t_n_class_vector 4 [0..4]) == [(1,2),(3,1),(39,0)]T/I-equivalence n)-class vector (subset-class vector, nCV). ti_n_class_vector 2 [0..4] == [4,3,2,1,0,0] ti_n_class_vector 3 [0,1,2,3,4] == [3,4,2,0,0,1,0,0,0,0,0,0] rle (ti_n_class_vector 4 [0,1,2,3,4]) == [(2,2),(1,1),(26,0)]icv scaled by sum of icv. }dyad_class_percentage_vector [0,1,2,3,4] == [40,30,20,10,0,0] dyad_class_percentage_vector [0,1,4,5,7] == [20,10,20,20,20,10]rel metric. erel [0,1,2,3,4] [0,1,4,5,7] == 40 rel [0,1,2,3,4] [0,2,4,6,8] == 60 rel [0,1,4,5,7] [0,2,4,6,8] == 60RNoneREL function with given ncv function (see  and ).T-equivalence REL function.Kuusi 2001, 7.5.2 let (~=) p q = abs (p - q) < 1e-2 t_rel [0,1,2,3,4] [0,2,3,6,7] ~= 0.44 t_rel [0,1,2,3,4] [0,2,4,6,8] ~= 0.28 t_rel [0,2,3,6,7] [0,2,4,6,8] ~= 0.31T/I-equivalence REL function.Buchler 1998, Fig. 3.38 let (~=) p q = abs (p - q) < 1e-3 let a = [0,2,3,5,7]::[Z12] let b = [0,2,3,4,5,8]::[Z12] let g = [0,1,2,3,5,6,8,10]::[Z12] let j = [0,2,3,4,5,6,8]::[Z12] ti_rel a b ~= 0.593 ti_rel a g ~= 0.648 ti_rel a j ~= 0.509 ti_rel b g ~= 0.712 ti_rel b j ~= 0.892 ti_rel g j ~= 0.707SNone Transpose p by n. tn 4 [1,5,6] == [5,9,10]Invert p about n. 8invert 6 [4,5,6] == [8,7,6] invert 0 [0,1,3] == [0,11,9]Composition of  about 0 and . @tni 4 [1,5,6] == [3,11,10] (invert 0 . tn 4) [1,5,6] == [7,3,2]Modulo 12 multiplication "mn 11 [0,1,4,9] == tni 0 [0,1,4,9]M5, ie.  5. m5 [0,1,3] == [0,5,3]T-related sequences of p. "length (t_related [0,3,6,9]) == 12T/I-related sequences of p. jlength (ti_related [0,1,3]) == 24 length (ti_related [0,3,6,9]) == 24 ti_related [0] == map return [0..11]R/T/I-related sequences of p. Glength (rti_related [0,1,3]) == 48 length (rti_related [0,3,6,9]) == 24T/M/I-related sequences of p.R/T/M/I-related sequences of p.r/R/T/M/I-related sequences of p. Variant of  , transpose p so first element is n. atn_to 5 [0,1,3] == [5,6,8] map (tn_to 0) [[0,1,3],[1,3,0],[3,0,1]] == [[0,1,3],[0,2,11],[0,9,10]] Variant of , inverse about n th element. smap (invert_ix 0) [[0,1,3],[3,4,6]] == [[0,11,9],[3,2,0]] map (invert_ix 1) [[0,1,3],[3,4,6]] == [[2,1,11],[5,4,2]]The standard t-matrix of p. Vtmatrix [0,1,3] == [[0,1,3] ,[11,0,2] ,[9,10,0]]TNone "Serial Operator,of the form rRTMI.INT operator. int [0,1,3,6,10] == [1,2,3,4]Serial operation. sro T4 15659A *sro (rnrtnmi "T4") (pco "156") == [5,9,10]echo 024579 | sro RT4I79B024 =sro (SRO 0 True 4 False True) [0,2,4,5,7,9] == [7,9,11,0,2,4] sro T4I 1563BA `sro (rnrtnmi "T4I") (pco "156") == [3,11,10] sro (SRO 0 False 4 False True) [1,5,6] == [3,11,10]echo 156 | sro T4 | sro T0I732 A(sro (rnrtnmi "T0I") . sro (rnrtnmi "T4")) (pco "156") == [7,3,2]echo 024579 | sro RT4I79B024 5sro (rnrtnmi "RT4I") (pco "024579") == [7,9,11,0,2,4] ksro (SRO 1 True 1 True False) [0,1,2,3] == [11,6,1,4] sro (SRO 1 False 4 True True) [0,1,2,3] == [11,6,1,4]#The total set of serial operations.The set of transposition s.'The set of transposition and inversion s.6The set of retrograde and transposition and inversion s.The set of transposition,M5 and inversion s.$The set of retrograde,transposition,M5 and inversion s.    UNone Cardinality filter <cf [0,3] (cg [1..4]) == [[1,2,3],[1,2,4],[1,3,4],[2,3,4],[]]OCombinatorial sets formed by considering each set as possible values for slot. :cgg [[0,1],[5,7],[3]] == [[0,5,3],[0,7,3],[1,5,3],[1,7,3]](Combinations generator, ie. synonym for . ?sort (cg [0,1,3]) == [[],[0],[0,1],[0,1,3],[0,3],[1],[1,3],[3]]!Powerset filtered by cardinality. cg -r3 0159015019059159 5cg_r 3 [0,1,5,9] == [[0,1,5],[0,1,9],[0,5,9],[1,5,9]]Cyclic interval segment. Synonynm for . cmpl 02468t13579B %cmpl [0,2,4,6,8,10] == [1,3,5,7,9,11] Form cycle.cyc 0560560 cyc [0,5,6] == [0,5,6,0]Diatonic set name. d for diatonic set, m for melodic minor set, o for octotonic set.Diatonic implications. Variant of  that is closer to the pct form.dim 016T1dT1mT0o +dim_nm [0,1,6] == [(1,'d'),(1,'m'),(0,'o')]&Diatonic interval set to interval set.dis 241256 dis [2,4] == [1,2,5,6]Degree of intersection.echo 024579e | doi 6 | sort -u024579A024679B Llet p = [0,2,4,5,7,9,11] in doi 6 p p == [[0,2,4,5,7,9,10],[0,2,4,6,7,9,11]]!echo 01234 | doi 2 7-35 | sort -u13568AB 6doi 2 (T.sc "7-35") [0,1,2,3,4] == [[1,3,5,6,8,10,11]] Forte name.p ) q is true iff p can embed q in sequence.Embedded segment search.echo 23a | ess 01643252B013A9923507A Dess [2,3,10] [0,1,6,4,3,2,5] == [[9,2,3,5,0,7,10],[2,11,0,1,3,10,9]]QCan the set-class q (under prime form algorithm pf) be drawn from the pcset p..Can the set-class q be drawn from the pcset p.Interval cycle filter.echo 22341 | icf22341 "icf [[2,2,3,4,1]] == [[2,2,3,4,1]]$Interval class set to interval sets. ici -c 1231231291A31A9 4ici_c [1,2,3] == [[1,2,3],[1,2,9],[1,10,3],[1,10,9]]5Interval class set to interval sets, concise variant. 4ici_c [1,2,3] == [[1,2,3],[1,2,9],[1,10,3],[1,10,9]]Interval-class segment.icseg 013265e497t8 12141655232 <icseg [0,1,3,2,6,5,11,4,9,7,10,8] == [1,2,1,4,1,6,5,5,2,3,2]Interval segment (INT). Imbrications.* gives the set-classes that can append to p to give q. issb 3-7 6-323-73-23-11 7issb (T.sc "3-7") (T.sc "6-32") == ["3-2","3-7","3-11"]Matrix search.mxs 024579 642 | sort -u6421B9B97642 DT.set (mxs [0,2,4,5,7,9] [6,4,2]) == [[6,4,2,1,11,9],[11,9,7,6,4,2]] Normalize.nrm 01234565432100123456 2nrm [0,1,2,3,4,5,6,5,4,3,2,1,0] == [0,1,2,3,4,5,6]%Normalize, retain duplicate elements. Pitch-class invariances (called pi at pct). pi 0236 1202366320532BB235 Bpci [0,2,3,6] [1,2] == [[0,2,3,6],[5,3,2,11],[6,3,2,0],[11,2,3,5]] Relate sets. rs 0123 641eT1M import Music.Theory.Z12.Morris_1987.Parse rs [0,1,2,3] [6,4,1,11] == [(rnrtnmi "T1M",[1,6,11,4]) ,(rnrtnmi "T4MI",[4,11,6,1])]Relate segments. rsg 156 3BAT4I :rsg [1,5,6] [3,11,10] == [rnrtnmi "T4I",rnrtnmi "r1RT4MI"] rsg 0123 05t3T0M ;rsg [0,1,2,3] [0,5,10,3] == [rnrtnmi "T0M",rnrtnmi "RT3MI"] rsg 0123 4e61RT1M ;rsg [0,1,2,3] [4,11,6,1] == [rnrtnmi "T4MI",rnrtnmi "RT1M"]echo e614 | rsg 0123r3RT1M ?rsg [0,1,2,3] [11,6,1,4] == [rnrtnmi "r1T4MI",rnrtnmi "r1RT1M"]Subsets.Super set-class.spsc 4-11 4-12 5-26[02458] *spsc [T.sc "4-11",T.sc "4-12"] == ["5-26"] spsc 3-11 3-8 4-27[0258] 4-Z29[0137] 1spsc [T.sc "3-11",T.sc "3-8"] == ["4-27","4-Z29"] spsc `fl 3` 6-Z17[012478]  spsc (cf [3] T.scs) == ["6-Z17"]    VNoneA  parser.Boolean  for given .Parse .1Parse a Morris format serial operator descriptor. +rnrtnmi "r2RT3MI" == SRO 2 True 3 True TrueParse a pitch class object string. Each V is either a number, a space which is ignored, or a letter name for the numbers 10 (t or a or A ) or 11 (e or B or b). 2pco "13te" == [1,3,10,11] pco "13te" == pco "13ab"W Safe-Inferred--CSV table, ie. a table with perhaps a header.8Plain list representation of a two-dimensional table of aQ in row-order. Tables are regular, ie. all rows have equal numbers of columns. CSV options.When writing a CSV file should the delimiters be aligned, ie. should columns be padded with spaces, and if so at which side of the data?2When reading a CSV file is the first row a header?#Inclusive range of cell references. Cell reference, column then row."Inclusive range of row references.1-indexed row reference.%Inclusive range of column references. AD indexed case-insensitive column references. The column following Z is AA. Zero index of . ECase folding letter to index function. Only valid for ASCII letters. [map letter_index ['A' .. 'Z'] == [0 .. 25] map letter_index ['a','d' .. 'm'] == [0,3 .. 12] Inverse of  . 0map index_letter [0,3 .. 12] == ['A','D' .. 'M']Translate column reference to 0-index. W:set -XOverloadedStrings map column_index ["A","c","z","ac","XYZ"] == [0,2,25,28,17575]NColumn reference to interior index within specified range. Type specialised `a. wmap (Data.Ix.index ('A','Z')) ['A','C','Z'] == [0,2,25] map (interior_column_index ("A","Z")) ["A","C","Z"] == [0,2,25] imap (Data.Ix.index ('B','C')) ['B','C'] == [0,1] map (interior_column_index ("B","C")) ["B","C"] == [0,1] Inverse of . Wlet c = ["A","Z","AA","AZ","BA","BZ","CA"] in map column_ref [0,25,26,51,52,77,78] == c %column_ref (0+25+1+25+1+25+1) == "CA"Type specialised . column_ref_pred "DF" == "DE"Type specialised . column_ref_succ "DE" == "DF" Bimap of . Gcolumn_indices ("b","p") == (1,15) column_indices ("B","IT") == (1,253)Type specialised `b. \column_range ("L","R") == ["L","M","N","O","P","Q","R"] Data.Ix.range ('L','R') == "LMNOPQR"Type specialised `c. map (column_in_range ("L","R")) ["A","N","Z"] == [False,True,False] map (column_in_range ("L","R")) ["L","N","R"] == [True,True,True] map (Data.Ix.inRange ('L','R')) ['A','N','Z'] == [False,True,False] map (Data.Ix.inRange ('L','R')) ['L','N','R'] == [True,True,True]Type specialised `d. _map column_range_size [("A","Z"),("AA","ZZ")] == [26,26 * 26] Data.Ix.rangeSize ('A','Z') == 26Type specialised `b.0The standard uppermost leftmost cell reference, A1. +Just cell_ref_minima == parse_cell_ref "A1"<Cell reference parser for standard notation of (column,row). )parse_cell_ref "CC348" == Just ("CC",348)Cell reference pretty printer. !cell_ref_pp ("CC",348) == "CC348"Translate cell reference to 0-indexed pair. Ycell_index ("CC",348) == (80,347) Data.Ix.index (("AA",1),("ZZ",999)) ("CC",348) == 54293Type specialised `b, cells are in column-order. >cell_range (("AA",1),("AC",1)) == [("AA",1),("AB",1),("AC",1)] flet r = [("AA",1),("AA",2),("AB",1),("AB",2),("AC",1),("AC",2)] in cell_range (("AA",1),("AC",2)) == r <Data.Ix.range (('A',1),('C',1)) == [('A',1),('B',1),('C',1)] alet r = [('A',1),('A',2),('B',1),('B',2),('C',1),('C',2)] in Data.Ix.range (('A',1),('C',2)) == r Variant of  in row-order. dlet r = [(AA,1),(AB,1),(AC,1),(AA,2),(AB,2),(AC,2)] in cell_range_row_order (("AA",1),("AC",2)) == rMDefault CSV options, no header, comma delimiter, no linebreaks, no alignment. Read  from CSV file.!Read  only with ."Read and process CSV .$Write  to CSV file.%Write  only (no header).&0"-indexed (row,column) cell lookup.' Row data.( Column data.)Lookup value across columns.*Table cell lookup.+04-indexed (row,column) cell lookup over column range.,Range of cells from row.- Translate  to . It is assumed that the ; is regular, ie. all rows have an equal number of columns. Hlet a = table_to_array [[0,1,3],[2,4,5]] in (bounds a,indices a,elems a) K> (((A,1),(C,2)) > ,[(A,1),(A,2),(B,1),(B,2),(C,1),(C,2)] > ,[0,2,1,4,3,5]).- of  .<      !"#$%&'()*+,-./0123455      !"#$%&'()*+,-.<   543210/   !"#$%&'()*+,-.7      !"#$%&'()*+,-./012345X Safe-Inferred 6 Variant of  requiring exact match.7 Variant of 6 that errors on failure.8The required header field.9Midi note data, header is time,on/off,note,velocity/. Translation values for on/off are consulted. let fn = "/home/rohan/cvs/uc/uc-26/daily-practice/2014-08-13.1.csv" csv_midi_note_data_read' ("ON","OFF") fn :: IO [(Double,Either String String,Double,Double)]: Variant of 9 that errors on non on/off data.;Tseq form of csv_read_midi_note_data.<Translate from Tseq form to Wseq form.=Off-velocity is zero.>Writer.?Tseq form of >. 6789:;<=>? 6789:;<=>? 6789:;<=>? 6789:;<=>?efghijklmnopqrstuvwxyz{|}~              ]            e            ! " # $ " % & ' ( ) ) * + , - . / 0 1 2 3 4 56|}~789:;<=>?@A BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ~      !"#$%&'()*+,-./0123456789:;<=>79: ? @ A B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!{!|!}"~""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""###############$$$$$$$$$$$$% % % % % % % %%%%%%%%%%%%%%%%%%% %!%"%#%$%%%&%'%(%)%*%+%,%-%.%/%0%1%2%3%4%5%6%7%8%9%:%;%<&=&>&?&@&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&[&\&]&^&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&{&|&}&~&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& & & & & &&&&&&&&&&&&&&&&&&& &!&"&#&$&%&&&'&(&)&*&+&,&-&.&/&0&1&2&3&4&5&6&7&8&9&:&;&<&=&>&?&@&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&[&\&]&^&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&{&|&}&~&&&&&&&&&&&&&&&&&&&&&&''''''''''''''(((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))***++,,,,,-----..............//00111111 1 1 1 1 1 1111111111111111111 1!1"1#1$1%1&1'1(1)1*1+1,1-1.1/101112131415161718191:2;2<2=2>2?2@2A2B2C2D2E2F2G2H2I2J2K2L2M2N2O2P2Q2R2S2T2U2|2V2 2W2~22z2{212X2Y2Z2[2\2]2^2_2`2a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p3q3q3r3s3t3u3v3w3x3y3z3{3|3}3~33333333333333333333333333334444444444444455555555555666666666666666666666666666666666666666666666666666666666677777777777777777}777777777777 7 7 7 7 77777777788888888888 8!8"8#8$8%8&8'8(8)8*8+8,8-8.8/808182838485868788898:8;8<8=8>8?8@8A8B8C8D8E8F8G8H8I8J8K8L8M8N8O8P8Q9R9S9T9U9V9W9y9X9Y9Z9[9\9]9^9_9`:a:b;c;d;e;f;g;h;i;j<k<l<m<n<o<p<q<r<s<t<u<v<w<x<y=z={=|=}=~=======>>>>>>>>>>>>>>>>>>>>??@@@@@@@@@@@@@@@@@@@@@@@@@@@AABBCCC CCCCCCCCCCCCCCCCCCCCCCCDDDDDDEEEEEEEEEEEFFFFFFFFFFFFFFFFFF_FFFFFFFFFFFFFFFFFFFFF F F F F GGGGGGGGGGGGGGGGGGGG G!G"G#G$G%G&G'G(HH)H*H+HH,H-H.H/HCH0H1H2H3H4H5H6H7H8H9H:H;H<H=H>H?H@HAHBHCHDHEHFHGHHHIHJHKHLHMHNHOHPHQHRHSHTHUHVHWHXHYHZH[H\H]H^H_H`HaHbHcHdHeHfHgHhHiHjHkHlHmHnHoHpIqIrIsItIuIvIwIxIyIzI{I|I}I~IIIIIIIIIIIIIIIJJJJJJJJJKKKKSKKTKKKKKKKKKKKKKKKKLLLLLLLLLLLMMMMMMMMMMMMMNN~N NNNNNNNNNNNNNNNNNNNNOOPPQQQQQQQQQQQQQQQQRRRS|S}S~SS7SSSSSSSSSTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUU U U U U UUUUVVWWWWWWWWWWWWW W!W"W#W#W$W%W&W'W(W)W*W+W,W-W.W/W0W1W2W3W4W5W6W7W8W9W:W;W<W=W>W?W@WAWBWCWDWEWFWGWHWIWJWKWLWMWNXOXPXQXRXSXTXUXVXWXXYZ[Y\]Y\^Y\_YZ`abcYYdYefYghYijYklmnoYkpmqrYstYsuYvwYvxY\yY\zYv{mq|Y}~Y}Y}Y}YYYY}Y}Y}Y}Y}Y[Y[Y[mnYkmnYkmnmnmnmqmqmqmqYkYkYkYYYkY}YYYYY}=mq    YYYYYYYYYYY\YYYYYkYkYYYYmnmnYYvYvY\YmqYYYYYiY\Y}mnmnYsYYYYsYsY}mqYkYkYY}Y}Y}YY}YYYY}Y}YYYYkVVVYsYsYYhmt-0.15Music.Theory.Z12.Morris_1974Music.Theory.Z12.LiteratureMusic.Theory.ZMusic.Theory.Z.SROMusic.Theory.Z.Read_1978Music.Theory.UnicodeMusic.Theory.TupleMusic.Theory.Time.NotationMusic.Theory.Time.DurationMusic.Theory.Tiling.Canon Music.Theory.Tiling.Johnson_2004 Music.Theory.Tiling.Johnson_2009Music.Theory.Z12Music.Theory.Z12.TTOMusic.Theory.Z12.Read_1978Music.Theory.MaybeMusic.Theory.MathMusic.Theory.Meter.Barlow_1987Music.Theory.Pitch.NoteMusic.Theory.Pitch.SpellingMusic.Theory.EitherMusic.Theory.FunctionMusic.Theory.DurationMusic.Theory.Duration.NameMusic.Theory.Duration.RQ Music.Theory.Duration.AnnotationMusic.Theory.Time_Signature'Music.Theory.Duration.Name.AbbreviationMusic.Theory.Tempo_MarkingMusic.Theory.Set.ListMusic.Theory.Set.SetMusic.Theory.BjorklundMusic.Theory.ListMusic.Theory.Time.SeqMusic.Theory.Array.MD&Music.Theory.Block_Design.Johnson_2007Music.Theory.PitchMusic.Theory.Pitch.NameMusic.Theory.ClefMusic.Theory.Instrument.ChoirMusic.Theory.IntervalMusic.Theory.Interval.NameMusic.Theory.Interval.SpellingMusic.Theory.Key#Music.Theory.Pitch.Spelling.ClusterMusic.Theory.PermutationsMusic.Theory.CombinationsMusic.Theory.Permutations.List"Music.Theory.Contour.Polansky_1992Music.Theory.Xenakis.S4Music.Theory.Duration.CTMusic.Theory.Duration.RQ.Tied!Music.Theory.Duration.RQ.Division%Music.Theory.Duration.Sequence.NotateMusic.Theory.Dynamic_MarkMusic.Theory.Tuning!Music.Theory.Interval.Barlow_1987Music.Theory.Tuning.AlvesMusic.Theory.Tuning.Alves_1997Music.Theory.Tuning.GannMusic.Theory.Tuning.Meyer_1929(Music.Theory.Tuning.Microtonal_Synthesis!Music.Theory.Tuning.Polansky_1978!Music.Theory.Tuning.Polansky_1984"Music.Theory.Tuning.Polansky_1985cMusic.Theory.Tuning.RileyMusic.Theory.Tuning.ScalaMusic.Theory.Tuning.Syntonic Music.Theory.Tuning.Werckmeister!Music.Theory.Metric.Polansky_1996%Music.Theory.Permutations.Morris_1984Music.Theory.Time.Bel1990.RMusic.Theory.Tuning.ET!Music.Theory.Tuning.Polansky_1990Music.Theory.Xenakis.SieveMusic.Theory.Z.Forte_1973Music.Theory.Z12.Forte_1973 Music.Theory.Metric.Buchler_1998Music.Theory.Metric.Morris_1980Music.Theory.Z12.Rahn_1980Music.Theory.Z12.Castren_1994Music.Theory.Z12.Lewin_1980Music.Theory.Z12.SROMusic.Theory.Z12.Morris_1987Music.Theory.Z12.Drape_1999"Music.Theory.Z12.Morris_1987.ParseMusic.Theory.Array.CSVMusic.Theory.Array.CSV.Midi Data.Listfilter Data.EitherrightsTfold_to_octave to_cents_rData.IxindexrangeinRange rangeSizefromListall_interval_m all_intervalsc_db lift_unary_Z lift_binary_Zz_addz_subz_mulz_negate z_fromIntegerz_signumz_absto_Zfrom_Z z_complementz_quotz_remz_divz_mod z_quotRemz_divMod z_toIntegertninverttnimn t_related ti_related rti_relatedtn_to invert_ixtmatrixArrayCodearray_pp parse_array array_to_code code_to_array array_to_set set_to_array set_to_codearray_complementarray_is_prime array_augmentenumerate_halfencodedecode encode_prime Unicode_Tableunicode accidentalsnotesrestsclefsT9T8T7T6T5T4T3T2p2_swapt2t2_listt2_swapt2_map t2_zipWitht2_infixt2_join t2_concatt2_sortp3_rotate_leftp3_fstp3_sndp3_thirdt3t3_rotate_leftt3_fstt3_sndt3_thirdt3_map t3_zipWitht3_listt3_infixt3_joinp4_fstp4_sndp4_third p4_fourtht4t4_listt4_fstt4_sndt4_third t4_fourtht4_map t4_zipWitht4_infixt4_joinp5_fstp5_sndp5_third p5_fourthp5_fiftht5t5_listt5_mapt5_fstt5_snd t5_fourtht5_fiftht5_infixt5_joinp6_fstp6_sndp6_third p6_fourthp6_fifthp6_sixtht6t6_listt6_mapt7_listt7_mapt8_listt8_mapt9_listt9_mapMINCSECMINSECFSECfsec_to_minsec minsec_ppfsec_to_mincsec mincsec_ppspan_ppDurationhoursminutesseconds millisecondss_smssms_sread_duration_tuple read_duration show_durationnormalise_minutesnormalise_secondsnormalise_millisecondsnormalise_durationduration_to_tupletuple_to_durationduration_to_hoursduration_to_minutesduration_to_secondshours_to_durationminutes_to_durationseconds_to_duration nil_durationnegate_duration duration_diff$fShowDuration$fReadDurationEVRSp_cyclee_to_seq e_from_seqr_voices rr_voices t_retrogradet_normalr_from_tperfect_tilings_mperfect_tilingselemOrd v_dot_star v_space_ix with_bars v_dot_star_mv_print v_print_mv_print_m_fromp1p2p3p4p4_bp5p7p10p11Z12 z12_modulo z12_showsPreclift_unary_Z12lift_binary_Z12check_negativeto_Z12from_Z12 complement$fNumZ12 $fShowZ12 $fBoundedZ12 $fEnumZ12pcsetm5 maybe_unzip maybe_latch maybe_latch1 maybe_map maybe_eq_by maybe_join' maybe_joinmaybe_predicate maybe_filter filter_maybeintegral_and_fractional_partsinteger_and_fractional_partsfractional_part sawtooth_wave rational_ppratio_pprational_simplifies rational_ndrational_wholerational_whole_err realfloat_ppfloat_pp double_pp num_diff_strS_MMStratification traceShowatat'mod'to_rdiv'indispensibilities lower_psireverse_primesprime_stratification upper_psithinning_tablethinning_table_pprelative_to_lengthrelative_indispensibilities align_meters whole_div whole_quotprolong_stratificationsmeansquare align_s_mm upper_psi' mps_limitmean_square_productmetrical_affinitymetrical_affinity'Spelling Alteration_T' Alteration_T DoubleSharpThreeQuarterToneSharpSharpQuarterToneSharpNaturalQuarterToneFlatFlatThreeQuarterToneFlat DoubleFlatNote_TBAGFDC note_to_pcnote_t_transposegeneric_alteration_to_diffalteration_to_diffalteration_is_12etalteration_to_diff_erralteration_to_fdifffdiff_to_alterationalteration_raise_quarter_tonealteration_lower_quarter_tonealteration_edit_quarter_tonealteration_clear_quarter_tonealteration_symbolalteration_iso_malteration_isoalteration_tonh alteration_t' Spelling_Mpc_spell_natural_mpc_spell_natural pc_spell_kspc_spell_sharp pc_spell_flatfromLeft fromRight predicate_and predicate_all predicate_or predicate_any.:.::.:::.::::.:::::divisiondots multiplier duration_meqduration_compare_meqduration_compare_meq_err order_pair sort_pair sort_pair_mno_dotssum_dur_undottedsum_dur_dottedsum_dursum_dur'$whole_note_division_to_musicxml_typeduration_to_musicxml_typeduration_to_lilypond_type!whole_note_division_to_beam_countduration_beam_countwhole_note_division_pp duration_ppduration_recip_pp $fOrdDurationbreve whole_note half_note quarter_note eighth_notesixteenth_notethirtysecond_note dotted_brevedotted_whole_notedotted_half_notedotted_quarter_notedotted_eighth_notedotted_sixteenth_notedotted_thirtysecond_notedouble_dotted_brevedouble_dotted_whole_notedouble_dotted_half_notedouble_dotted_quarter_notedouble_dotted_eighth_notedouble_dotted_sixteenth_notedouble_dotted_thirtysecond_noteRQrq_to_duration rq_is_cmnrq_to_duration_errwhole_note_division_to_rq rq_apply_dotsduration_to_rqduration_compare_rqrq_modrq_divisible_byrq_is_integral rq_integralrq_derive_tuplet_plainrq_derive_tuplet rq_un_tuplet rq_to_cmn rq_can_notate Duration_A D_Annotation End_Tuplet Begin_TupletTie_Left Tie_Right begin_tupletda_begin_tuplet begins_tupletda_begins_tupletda_ends_tuplet da_tied_right da_tuplet begin_end_cmpbegin_end_cmp_eq group_treeda_group_tuplets break_left sep_balancedda_group_tuplets_nn zip_with_krzip_kr nn_reshape adopt_shape adopt_shape_md_annotated_tied_lrduration_a_tied_lrRational_Time_SignatureComposite_Time_SignatureTime_Signature ts_whole_notets_whole_note_rqts_rqrq_to_ts ts_divisionsts_duration_pulses ts_rewritets_sumcts_rq cts_divisionscts_pulse_to_rqcts_pulse_to_rqwrts_rq rts_divisions rts_deriverts_pulse_to_rqrts_pulse_to_rqwwhqesw'h'q'e's'w''h''q''e''s''_1_2_4_8_16_32_1'_2'_4'_8'_16'_32'_1''_2''_4''_8''_16''_32'' Tempo_Marking rq_to_secondspulse_durationmeasure_durationmeasure_duration_fmetronome_table_wittnermetronome_table_nikkomm_nameset n_powersetpowersetpairstriples expand_set partitionscartesian_product bjorklundxdotiseqiseq_str Compare_Fbracket bracket_lgenericRotate_left rotate_leftgenericRotate_right rotate_rightrotaterotate_r rotations genericAdj2adj2close adj2_cyclic interleaveinterleave_continueinterleave_rotations histogramsegments intersect_lunion_l adj_intersectcycles collate_oncollatewith_keydx_ddx_d'd_dx difference is_subset is_superset subsequenceelem_index_unique find_bounds' find_bounds dropRightdropWhileRightat_headat_last separate_lastindicate_repetitionsadjacent_groupBy group_justall_eq sort_group_onmconstwo_stage_compareordering_invertsort_tosort_onsort_by_two_stagemerge_bymerge_by_two_stagemerge merge_set_by merge_setmerge_by_resolvebimap1On_OffOffOnLseqInterpolation_TLinearNoneWseqTseqPseqIseqDseqUseqpseq_zipwseq_zip seq_tspan tseq_tspan wseq_tspandseq_duriseq_durpseq_durtseq_durwseq_dur wseq_twindow dseq_append iseq_append pseq_append tseq_merge tseq_merge_bytseq_merge_resolve wseq_mergetseq_lookup_window_bytseq_lookup_active_bytseq_lookup_activetseq_lookup_active_by_deftseq_lookup_active_deflerp lseq_tmap lseq_lookuplseq_lookup_errseq_tmapseq_map seq_bimap seq_tfilter seq_filterseq_find seq_map_maybeseq_cat_maybesseq_changed_by seq_changed wseq_tmap_st wseq_tmap_dur seq_partitiontseq_partitionwseq_partition coalesce_f coalesce_m seq_coalesce dseq_coalescedseq_coalesce' iseq_coalesce seq_tcoalescetseq_tcoalescewseq_tcoalescegroup_f tseq_group iseq_group wseq_fill_durdseq_lcmdseq_set_whole tseq_latchwseq_discard_durwseq_remove_overlaps seq_unjoin wseq_unjoin cmp_on_offeither_to_on_offon_off_to_either wseq_on_offwseq_on_off_either wseq_on_off_ftseq_on_off_to_wseq useq_to_dseq dseq_to_tseqdseq_to_tseq_last pseq_to_wseq tseq_to_dseq tseq_to_wseq tseq_to_iseq dseq_to_wseq wseq_to_dseqdseql_to_tseql dseq_tmap pseq_tmap tseq_tmap tseq_bimap wseq_tmapdseq_mappseq_maptseq_mapwseq_map dseq_tfilter iseq_tfilter pseq_tfilter tseq_tfilter wseq_tfilter dseq_filter iseq_filter pseq_filter tseq_filter wseq_filterwseq_map_maybewseq_cat_maybesMD_Table pad_right make_regulardelete_trailing_whitespace md_table_joinmd_number_rows md_table_opt md_table'md_table md_table_showmd_table_column_order md_table_p2 md_table_p3 md_matrixmd_matrix_boldDesignc_7_3_1b_7_3_1d_7_3_1n_7_3_1p_9_3_1b_13_4_1d_13_4_1n_13_4_1b_12_4_3n_12_4_3 Midi_DetunePitch'Pitchnote alterationoctaveOctPCOctave_PitchClassOctave PitchClass pitch'_pppitch'_class_pppitch_clear_quarter_tonepitch_to_octpc pitch_is_12et pitch_to_midipitch_to_fmidi pitch_to_pc pitch_compareoctpc_to_pitch octpc_nrm octpc_trs octpc_to_midioctpc_to_fmidi midi_to_octpc octpc_range midi_to_pitchfmidi_to_pitchpitch_tranposepitch_in_octave_nearestpitch_note_raisepitch_note_lower%pitch_rewrite_threequarter_alterationpitch_edit_octave midi_to_cps fmidi_to_cps pitch_to_cps cps_to_midi cps_to_fmidicps_to_midi_detunemidi_detune_to_cps octpc_to_cps cps_to_octpcparse_iso_pitch_octparse_iso_pitchpitch_pppitch_class_pppitch_class_names_12et pitch_pp_iso pitch_pp_hly pitch_pp_tonh $fOrdPitcha0b0bes0ais0bis0c1d1e1f1g1a1b1ces1des1ees1fes1ges1aes1bes1cis1dis1eis1fis1gis1ais1bis1c2d2e2f2g2a2b2ces2des2ees2fes2ges2aes2bes2cis2dis2eis2fis2gis2ais2bis2cisis2disis2eisis2fisis2gisis2aisis2bisis2ceseh2deseh2eeseh2feseh2geseh2aeseh2beseh2ceh2deh2eeh2feh2geh2aeh2beh2cih2dih2eih2fih2gih2aih2bih2cisih2disih2eisih2fisih2gisih2aisih2bisih2c3d3e3f3g3a3b3ces3des3ees3fes3ges3aes3bes3cis3dis3eis3fis3gis3ais3bis3ceses3deses3eeses3feses3geses3aeses3beses3cisis3disis3eisis3fisis3gisis3aisis3bisis3ceseh3deseh3eeseh3feseh3geseh3aeseh3beseh3ceh3deh3eeh3feh3geh3aeh3beh3cih3dih3eih3fih3gih3aih3bih3cisih3disih3eisih3fisih3gisih3aisih3bisih3c4d4e4f4g4a4b4ces4des4ees4fes4ges4aes4bes4cis4dis4eis4fis4gis4ais4bis4ceses4deses4eeses4feses4geses4aeses4beses4cisis4disis4eisis4fisis4gisis4aisis4bisis4ceseh4deseh4eeseh4feseh4geseh4aeseh4beseh4ceh4deh4eeh4feh4geh4aeh4beh4cih4dih4eih4fih4gih4aih4bih4cisih4disih4eisih4fisih4gisih4aisih4bisih4c5d5e5f5g5a5b5ces5des5ees5fes5ges5aes5bes5cis5dis5eis5fis5gis5ais5bis5ceses5deses5eeses5feses5geses5aeses5beses5cisis5disis5eisis5fisis5gisis5aisis5bisis5ceseh5deseh5eeseh5feseh5geseh5aeseh5beseh5ceh5deh5eeh5feh5geh5aeh5beh5cih5dih5eih5fih5gih5aih5bih5cisih5disih5eisih5fisih5gisih5aisih5bisih5c6d6e6f6g6a6b6ces6des6ees6fes6ges6aes6bes6cis6dis6eis6fis6gis6ais6bis6ceseh6deseh6eeseh6feseh6geseh6aeseh6beseh6ceh6deh6eeh6feh6geh6aeh6beh6cih6dih6eih6fih6gih6aih6bih6cisih6disih6eisih6fisih6gisih6aisih6bisih6c7d7e7f7g7a7b7ces7des7ees7fes7ges7aes7bes7cis7dis7eis7fis7gis7ais7bis7c8cis8d8Clefclef_t clef_octaveClef_T PercussionTrebleAltoTenorBass clef_range clef_suggest clef_zero clef_restrictPart Voice_Rng_TblVoiceSoprano voice_abbrev voice_clefvoice_rng_tbl_stdvoice_rng_tbl_safe lookup_err voice_rng voice_rng_stdvoice_rng_safein_range_inclusive in_voice_rngpossible_voicespossible_voices_stdpossible_voices_safesatb satb_name satb_abbrev ch_satb_seqch_partspart_nm k_ch_groups k_ch_groups' dbl_ch_parts mk_clef_seqInterval interval_typeinterval_qualityinterval_directioninterval_octave Interval_Q AugmentedMajorPerfectMinor Diminished Interval_TSeventhSixthFifthFourthThirdSecondUnison interval_tyinterval_q_tbl interval_qinterval_q_reverseinterval_semitones note_spaninvert_orderingintervalinvert_intervalquality_difference_mquality_differencepitch_transposecircle_of_fifthsparse_interval_typeparse_interval_qualityinterval_type_degreeinterval_quality_ppparse_interval interval_ppstd_interval_namesperfect_fourth perfect_fifth major_seventh i_to_intervalinterval_simplifyKeyMode_T Major_Mode Minor_Mode key_fifthsspell_cluster_c4_tablespell_cluster_c4spell_cluster_cspell_cluster_fspell_cluster_left factorialnk_permutationsn_permutations permutationapply_permutationapply_permutation_cnon_invertible from_cyclespermutations_ncomposetwo_lineone_lineone_line_compactmultiplication_tablenk_combinations combinations permutationsmultiset_permutations Conforms_fBuild_fContour_Descriptioncontour_description_ncontour_description_mContour_Half_Matrixcontour_half_matrix_ncontour_half_matrix_mMatrixreplace all_equalcompare_adjacentadjacent_indices all_indicesgenericFromEnum genericToEnum ord_to_int int_to_ord ord_invertmatrix_fcontour_matrix half_matrix_fcontour_half_matrixcontour_half_matrix_strcontour_descriptioncontour_description_strhalf_matrix_to_descriptioncontour_description_ixuniform no_equalities all_contours implication violations is_possiblepossible_contoursimpossible_contourscontour_description_lmcontour_truncatecontour_is_prefix_of contour_eq_at draw_contourcontour_description_invert build_f_nbuild_sequence build_contourbuild_contour_retrybuild_contour_setbuild_contour_set_nodupex_1ex_2ex_3ex_4$fShowContour_Description$fShowContour_Half_MatrixFaceF_TopF_BottomF_LeftF_RightF_FrontF_BackRelSeqHalf_SeqLabelQ12Q11Q10Q9Q8Q7Q6Q5Q4Q3Q2Q1L2LIG2E2D2full_seqlowerl_onseq_of half_seq_ofhalf_seqreverse_lookuplabel_of complementaryrelaterelate_l relations relations_lapply_relationapply_relationsapply_relations_lfacesviii_6_lviii_7 viii_6b_l viii_6b_p'viii_6b'viii_6bviii_6_relationsviii_6b_relationsCTct_lenct_tsct_markct_tempoct_countCT_NodeCT_EndCT_PreCT_Edge CT_NormalCT_StartCT_MarkPulseMeasure mdv_to_mrq mp_lookup_err mp_comparect_extct_ext1 ct_dv_seq ct_mdv_seqct_rq ct_mp_lookup ct_m_to_rq ct_mark_seq ct_pre_markct_pre_mark_seqct_tempo_lseq_rq ct_tempo_at ct_leadindelay1 ct_measure ct_tempo0 ct_tempo0_err ct_measuresct_dseq'ct_dseq ct_rq_measurect_rq_mp ct_rq_mp_err ct_mp_to_rqRQ_T Tied_Rightrqtrqt_rqrqt_tied is_tied_right rqt_un_tupletrq_rqt rq_tie_lastrqt_to_duration_arqt_can_notate rqt_to_cmn rqt_to_cmn_lrqt_set_to_cmnRQ1_DivRQ_Divrq1_div_to_rq_div rq_div_verifyrq_div_mm_verifyrq_div_to_rq_set_trq_set_t_to_rqt rq_div_seq_rqpartitions_sumpartitions_sum_p rq1_div_univ Simplify_M Simplify_P Simplify_Tall_just all_rightcoalescecoalesce_accum coalesce_sumeither_to_maybe take_sum_bytake_sumtake_sum_by_eqsplit_sum_by_eq split_sum_t_f rqt_split_sum rqt_separaterqt_separate_mrqt_separate_tupletrqt_tuplet_subdividerqt_tuplet_subdivide_seqrqt_tuplet_sanity_ rqt_tuplet_subdivide_seq_sanity_to_measures_rqto_measures_rq_cmnto_measures_tsto_measures_ts_by_eqm_divisions_rqm_divisions_tsto_divisions_rqto_divisions_ts p_tuplet_rqtp_notatem_notate mm_notate meta_table_p meta_table_t default_tabledefault_8_ruledefault_4_rule default_rule m_simplifyp_simplify_rule p_simplify notate_rqpnotate zip_hold_lhszip_hold_lhs_errzip_hold m_ascribeascribe mm_ascribenotate_mm_ascribenotate_mm_ascribe_err group_chd ascribe_chdmm_ascribe_chd Dynamic_Node Hairpin_T End_Hairpin Diminuendo CrescendoDynamic_Mark_TSFFZSFZSFPPSFPSFFPFFFFFFFFFFFFFFMFMPPPPPPPPPPPPPPPPNientedynamic_mark_mididynamic_mark_midi_errmidi_dynamic_markdynamic_mark_dbampmididamp_dbdb_ampimplied_hairpinempty_dynamic_nodedynamic_sequencedelete_redundant_marksdynamic_sequence_setsapply_dynamic_nodedynamic_mark_ascii hairpin_asciidynamic_node_asciidynamic_sequence_asciiCPS_Midi_TuningD12_Midi_Tuning Midi_Tuning_FTuningratios_or_cents octave_ratioCentsApproximate_Ratio divisionsratios ratios_errcentscents_i cents_octavecents_to_ratioapproximate_ratiosapproximate_ratios_cyclicreconstructed_ratiosfratio_to_centsapproximate_ratio_to_centsapproximate_ratioratio_to_centsreconstructed_ratiocps_shift_centscps_difference_centssyntonic_commapythagorean_commamercators_commanth_root#twelve_tone_equal_temperament_commaequal_temperamentequal_temperament_12equal_temperament_19equal_temperament_31equal_temperament_53equal_temperament_72fold_cps_to_octave_ofharmonic_series_cpsharmonic_series_cps_nsubharmonic_series_cpssubharmonic_series_cps_npartialfold_ratio_to_octaveratio_interval_classharmonic_series_cps_derivedharmonic_series_foldedharmonic_series_folded_charmonic_series_folded_21cents_et12_difffcents_et12_diffcents_interval_classfcents_interval_class cents_diff_pp cents_diff_brcents_diff_text cents_diff_mdcents_diff_htmld12_midi_tuning_fcps_midi_tuning_f Table_2_Rowbarlowfactor prime_factorsmultiplicitiesprime_factors_mrational_prime_factors_mrational_prime_factors_tdisharmonicity harmonicity harmonicity_r to_rational from_rationaltable_2 table_2_ppharrison_ditone_rharrison_ditonealves_slendro_r alves_slendroalves_pelog_bem_ralves_pelog_bemalves_pelog_barang_ralves_pelog_barangalves_pelog_23467_ralves_pelog_23467pietro_aaron_1523_cpietro_aaron_1523werckmeister_iii_cthomas_young_1799_cthomas_young_1799 zarlino_rzarlinola_monte_young_rla_monte_youngben_johnston_r ben_johnstongann_arcana_xvi_rgann_arcana_xvigann_superparticular_rgann_superparticularodd_torowcolumn in_oct_mulinnermeyer_table_rckmeyer_table_indicesmeyer_table_rowst3_3elementsdegreefarey_sequence pythagorean_r pythagoreanfive_limit_tuning_rfive_limit_tuning"septimal_tritone_just_intonation_r septimal_tritone_just_intonationseven_limit_just_intonation_rseven_limit_just_intonationkirnberger_iii_arkirnberger_iii vallotti_cvallottimayumi_reinhard_rmayumi_reinhardlou_harrison_16_rlou_harrison_16 partch_43_r partch_43ben_johnston_25_rben_johnston_25psaltery psaltery_o k_manisrenga k_kanjutmesem k_udanriris k_pengawesari k_rarasrumk_hardjanagara k_madukentirk_surakk_setcalculate_averages k_averagesgm_1gm_2gm_3gm_4gm_5gm_6gm_7gm_8gm_set gm_averages i_categories i_categorypadi_category_tablepolansky_1984_rpolansky_1984_c ps5_jpr_rps5_jprriley_albion_r riley_albionEpsilonScalescale_description scale_degree scale_pitches scale_octaveperfect_octavescale_pitch_representations pitch_cents pitch_ratio scale_uniform scale_cents scale_ratios comment_p filter_crp_orremove_eol_commentsfilter_commentsdelete_trailing_pointpitchpitch_lnparseload dir_subsetload_dirmk_isomorphic_layoutminimal_isomorphic_note_layoutrank_two_regular_temperamentmk_syntonic_tuning syntonic_697 syntonic_702werckmeister_iii_arwerckmeister_iii_ar_cwerckmeister_iiiwerckmeister_iv_arwerckmeister_iv_cwerckmeister_ivwerckmeister_v_arwerckmeister_v_cwerckmeister_vwerckmeister_vi_rwerckmeister_viPsiDeltadif_idif_rabs_difsqrsqr_dif sqr_abs_dif sqrt_abs_difcity_block_metriceuclidean_metric_2euclidean_metric_lcbrtnthrtminkowski_metric_2minkowski_metric_ld_dx_abs olm_no_delta' olm_generalix_dif abs_ix_difsqr_abs_ix_difolm olm_no_deltaolm_no_delta_squared second_orderolm_no_delta_second_order!olm_no_delta_squared_second_order!second_order_binonial_coefficientdirection_intervalord_histdirection_vectoruldoldocducdcombinatorial_magnitude_matrixulm_simplifiedocm_zcmocmocm_absolute_scaledMethodChangeHoldSwap_Allmethod_changes parse_change split_changes parse_method is_swap_all swap_pair flatten_pairsswap_all to_abbrev gen_swaps pair_to_listswaps_to_cyclesto_zero_indexed swap_abbrev apply_change apply_method closed_methodclosed_method'"cambridgeshire_slow_course_doubles!double_cambridge_cyclic_bob_minorhammersmith_bob_triplescambridge_surprise_majorsmithsonian_surprise_royalL_BelL_TermL_StTimeBelMulParIsoNodeTermContinueRestValueTempoPar_ModePar_NonePar_MaxPar_Min Par_RightPar_Leftpar_mode_bracketsbel_brackets_matchbel_pp bel_char_pp par_analysepar_durbel_tdurbel_dur lterm_timelterm_durationlterm_end_time bel_linearise lbel_merge lbel_tempilbel_tempo_mullbel_normalisevoice_normalisevoice_eq lbel_voices lbel_duration lbel_lookup lbel_gridbel_grid bel_ascii bel_ascii_pr~>lseqnodenseqcseqparrestnrestsbel_parse_pp_ident bel_ascii_ppp_restp_nrests p_continue p_char_value p_char_term p_char_node p_integer p_rationalp_doublep_numberp_mulp_iso p_char_isop_par p_char_par p_char_belbel_char_parse Pitch_DetuneHS_Roctpc_to_pitch_cpstbl_12ettbl_24etbounds_et_tablebounds_12et_tonendphs_r_pp hs_r_pitch_ppnearest_et_table_tonenearest_12et_tonenearest_24et_tonealteration_72et_monzo pitch_72ettbl_72etnearest_72et_tonehsr_to_pitch_detunenearest_pitch_detune_12etnearest_pitch_detune_24etratio_to_pitch_detunepitch_detune_to_cpsratio_to_pitch_detune_12etratio_to_pitch_detune_24etpitch_detune_in_octave_nearestpitch_detune_mdpitch_detune_htmlpitch_class_detune_mdpitch_class_detune_html kanjutmesem_s kanjutmesem_pdarius_s madeleine_p lipur_sih_s lipur_sih_pidealized_et_sidealized_et_pax_rSieve IntersectionUnionEmptyunion intersection∪∩l⋄ normalise is_normalelementbuildbuildn differentiateeuclid de_meziriacreduce_intersectionreduce t_rotations ti_rotations minimumBy_or t_cmp_prime ti_cmp_prime forte_cmp forte_primet_primeicicvbipSC_Namesc_tablesc_namescscsscs_nSATVMAXMINof_c sc_table_n icv_minmaxr_ppsatv_f satv_e_ppsatv_ppsatv_asatv_bsatv satv_minmax satv_n_sumtwo_part_difference_vectortwo_part_difference_vector_setsatsim satsim_tablesatsim_table_histogramsimasimrahn_cmp rahn_primeinv_symsc_t_ti t_sc_table t_sc_namet_sct_scst_scs_n t_subsets ti_subsetsrle rle_decode rle_lengtht_n_class_vectorti_n_class_vectordyad_class_percentage_vectorrelt_relti_rel tmi_related rtmi_related rrtmi_relatedSROintsrosrossro_Tnsro_TnIsro_RTnIsro_TnMI sro_RTnMIcfcggcgcg_rcisegcmplcycd_nmdimdim_nmdisdoifnhas_essess has_sc_pfhas_scicficiici_cicsegisegimbissbmxsnrmnrm_rpcirsrsgsbspscrnrtnmipco CSV_TableTableCSV_OptCSV_Align_ColumnsCSV_Align_RightCSV_Align_Left CSV_No_AlignCSV_Allow_Linebreaks CSV_DelimiterCSV_Has_Header Cell_RangeCell_Ref Row_RangeRow_Ref Column_Range Column_Refcolumn_ref_string row_index letter_index index_letter column_indexinterior_column_index column_refcolumn_ref_predcolumn_ref_succcolumn_indices column_rangecolumn_in_rangecolumn_range_size row_rangecell_ref_minimaparse_cell_ref cell_ref_pp cell_index cell_rangecell_range_row_order def_csv_optcsv_table_readcsv_table_read'csv_table_withcsv_table_aligncsv_table_writecsv_table_write' table_lookup table_row table_columntable_column_lookup table_celltable_lookup_row_segmenttable_row_segmenttable_to_arraycsv_array_read$fIxColumn_Ref$fEnumColumn_Ref$fOrdColumn_Ref$fEqColumn_Ref$fShowColumn_Ref$fReadColumn_Ref$fIsStringColumn_Ref reads_exact reads_errcsv_midi_note_data_hdrcsv_midi_note_data_read'csv_midi_note_data_readmidi_tseq_readmidi_tseq_to_midi_wseqmidi_wseq_to_midi_tseqcsv_midi_note_data_writemidi_tseq_writebase Control.MonadmsumGHC.Base.mapreturn MonadPluslogict-0.6.0.2Control.Monad.Logic observeAllmaximum Data.MonoidmappendGHC.ReadReadGHC.ShowShowGHC.List concatMapghc-prim GHC.Classesminelem GHC.TypesFalseGHC.EnumBoundedEnum Data.MaybeNothingJustfmapidMaybeDoubleGHC.RealRationalgcd numerator denominatorNumeric showFFloat genericIndexmod fromIntegraldivquotremLeftEitherRight&&all||anyOrdcompare==OrderingLTGTEQcontainers-0.5.5.1 Data.TreeTreebreakzipWithzipsumconcat Fractionalnubsort^multiset-comb-0.2.3Math.Combinatorics.MultisetTrueSTEPleftright bjorklund'foldl1 intersect Data.Tuplefstsnd mapAccumLflip isInfixOf elemIndicesdrop dropWhilegroupBysortBydata-ordlist-0.4.6.1Data.List.OrderedmergeBymergeAll<>GHC.ErrerrormapMaybe catMaybesconst Data.FunctiononChar GHC.UnicodeisSpacecurry transposeshowStringround>=<= enumFromTounfoldrGHC.Num-fromEnumtoEnumIntegralInttakelookup GHC.FloatFloating fromRational/primes-0.2.1.0Data.Numbers.PrimesprimesRatiouncurry%* Text.ReadreadNumReal realToFracabssqrt System.IOputStrLn replicate integer-gmpGHC.Integer.TypeIntegeris_charget_intpredsuccGHC.Arrreads