2;sC      !"#$%&'()*+,-./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 { | } ~             !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL 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/{/|/}/~////000000000000000000000000000000000000000000000000000111223333333333333333333333333333333334444444444444444444444444444444444444444444455 5 5 6 6 7788888899999999999 9!9"9#9$9%9&9'9(9)9*9+9,9-9.9/909192: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>{>|>}>~>>>>>>>>>>>>>??@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@AABBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDEEEEEEEEE E E E E EEEEEEEEEEEEEEEEEEE E!E"E#E$E%E&E'E(E)E*E+E,E-E.E/E0E1E2E3E4E5E6E7E8E9E:E;E<E=E>E?E@EAEBECEDEEEFEGEHEIEJEKELEMENEOEPEQERESETEUEVEWEXEYEZE[E\E]E^E_E`EaEbEcEdEeEfEgEhEiEjEkElEmEnEoEpEqErEsEtEuEvEwExEyEzE{E|E}E~EEEEEEEEEEEEEEEEFFFFFGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIJJ J J J J J J K K L L L L L L L L L L L L M M M M M M M M M M M M M !M "M #M $M %M &M 'M (N )N *O +O ,O -O .O /O 0O 1O 2O 3O 4O 5P 6P 7P 8P 9P :P ;P <P =P >P ?P @P AP BP CP DP EP FP GP HP IP JP KP LP MP NP OP PP QP RP SP TP UQ VQ WQ XQ YQ ZQ [Q \Q ]Q ^Q _Q `Q aQ bQ cQ dQ eR fR gR hR iR jR kR lR mR nS oS pS qS rS sS tS uS vS wS xS yS zT {T |T }U ~U U U U U U U U U U U U U U U U U U U U U U U U U V V W W W W X X X X X X X X X Y Y Y Z Z Z Z Z 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` ba ca da ea fa ga ha ia ja ka la ma na oa pb qb rb sb tb ub vb wb xb yb zb {c |c }c ~c c c c c c c c c c c c c c c c c c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e f f f f f f f f g g g g h h h h h h h h h h h h h h h h h h h h h h h h h h h h !h "h #h $h %h &h 'h (h )h *h +h ,h -h .h /h 0h 1h 2h 3h 4h 5h 6h 7i 8i 9i :i ;i <i =i >i ?i @i Ai Bi Cj Dj Ej Fj Gj Hj Ij Jk Kk Lk Mk Nk Ok Pk Qk Rk Sk Tk Uk Vk Wk Xk Yk Zk [k \l ]l ^l _l `l al bl cl dl el fl gl hl il jl kl ll mm nm om pm qm rm sm tm um vm wm xm ym zm {m |m }m ~m m m m m m m m m m m m m n n n n n n n n n n n o o p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q r r s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s !s "s #s $t %t &t 't (t )t *t +t ,t -t .t /t 0t 1t 2t 3t 4t 5t 6t 7t 8u 9u :u ;u <u =u >u ?u @u Au Bu Cu Du Eu Fu Gu Hu Iu Ju Ku Lu Mu Nu Ou Pu Qu Ru Su Tu Uu Vu Wu Xu Yu Zu [u \u ]u ^u _u `u au bu cu du eu fu gu hu iu ju ku lu mu nu ou pu qu ru su tu uu vu wu xu yu zu {u |u }u ~u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v w w w w w w w w w x x x x x x x x x x x x x x x x x x x x x x y y y y y y y y y y y y z z z z z z z z z z z z 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 { | } ~       Safe   . (L.observeAll (fromList [1..7]) == [1..7] all-interval series. map (length . L.observeAll . all_interval_m) [4,6,8,10] == [2,4,24,288] [0,1,3,2,9,5,10,4,7,11,8,6] `elem` L.observeAll (all_interval_m 12) length (L.observeAll (all_interval_m 12)) == 3856 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 == rSafewSet 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)"SafeUniform two-tuple.Infix . "t2_join ([1,2],[3,4]) == [1,2,3,4]Left rotation. !p3_rotate_left (1,2,3) == (2,3,1)[ of Y. 1t12_foldr1 (+) (1,2,3,4,5,6,7,8,9,10,11,12) == 78\ of Y. *t12_sum (1,2,3,4,5,6,7,8,9,10,11,12) == 78Y  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\Y  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\Y  !"#$%&'()* +,-./0123456789:; <=>?@ABCDEFGHIJ KLM NOPQRSTUVWXYZ[\Y  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\Safe]Type specialised.^#Minutes, seconds, centi-seconds as (min,sec,csec)_Type specialised.`Minutes, seconds as  (min,sec)aFractional seconds.b by 60. sec_to_minsec 123 == (2,3)c Inverse of  sec_minsec. minsec_to_sec (2,3) == 123ed   , assumes q precedes p. "minsec_sub (2,35) (1,59) == (0,36)fd ! , assumes p precedes q. #minsec_diff (1,59) (2,35) == (0,36)gd ". "minsec_add (1,59) (2,35) == (4,34)h# of g +minsec_sum [(1,59),(2,35),(4,34)] == (9,08)iFractional seconds to  (min,sec). ;map fsec_to_minsec [59.49,60,60.51] == [(0,59),(1,0),(1,1)]j_ pretty printer. =map (minsec_pp . fsec_to_minsec) [59,61] == ["00:59","01:01"]lFractional seconds to (min,sec,csec), csec value is $ed. >map fsec_to_mincsec [1,1.5,4/3] == [(0,1,0),(0,1,50),(0,1,33)]m Inverse of  fsec_mincsec.oCenti-seconds to ^. 6map csec_to_mincsec [123,12345] == [(0,1,23),(2,3,45)]p]; pretty printer, concise mode omits centiseconds when zero. Lmap (mincsec_pp_opt True . fsec_to_mincsec) [1,60.5] == ["00:01","01:00.50"]q] pretty printer. clet r = ["00:01.00","00:06.67","02:03.45"] map (mincsec_pp . fsec_to_mincsec) [1,6+2/3,123.45] == rs&Given printer, pretty print time span.]^_`abcdefghijklmnopqrs]^_`abcdefghijklmnopqrsa`_^]bcdefghijklmnopqrs]^_`abcdefghijklmnopqrsSafetDuration stored as hours, minutes, seconds and  milliseconds.zConvert fractional seconds to integral (seconds,milliseconds). s_sms 1.75 == (1,750){ Inverse of z. sms_s (1,750) == 1.75|% function for t tuple.}% function for t. 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 250~& function for t. bshow_duration (Duration 1 35 5 250) == "01:35:05.250" show (Duration 1 15 0 000) == "01:15:00.000"Extract t/ tuple applying filter function at each element 7duration_tuple id (Duration 1 35 5 250) == (1,35,5,250) Inverse of .tuvwxyz{|}~tuxvwyz{|}~tuvwxyz{|}~tuvwxyz{|}~SafeRemove r.Delete trailing ' where ( holds. 2delete_trailing_whitespace " str " == " str"SafeSafe Transform ) function into precise % function. Requires using all the input to produce a single token. The only exception is a singular trailing white space character.Error variant of . of *. space character. Variant of  with default value. ,map (read_def 0) ["2","2:","2\n"] == [2,0,2] Variant of  that errors on +. Variant of *0 requiring exact match, no trailing white space. 3map reads_exact ["1.5","2,5"] == [Just 1.5,Nothing] Variant of  that errors on failure.$Allow commas as thousand separators. let r = [Just 123456,Just 123456,Nothing,Just 123456789] in map read_integral_allow_commas_maybe ["123456","123,456","1234,56","123,456,789"],Read a ratio where the division is given by / instead of % and the integers allow commas. Omap read_ratio_with_div_err ["123,456/7","123,456,789"] == [123456/7,123456789]Read ,', allow commas for thousand separators. Bread_ratio_allow_commas_err "327,680" "177,147" == 327680 / 177147Delete trailing ., - fails for 700..# disallows trailing decimal points. Nmap read_fractional_allow_trailing_point_err ["123.","123.4"] == [123.0,123.4]Type specialised . >map read_maybe_int ["2","2:","2\n"] == [Just 2,Nothing,Just 2]Type specialised .Type specialised .Type specialised .Type specialised . Imap read_maybe_rational ["1","1%2","1/2"] == [Nothing,Just (1/2),Nothing]Type specialised . read_rational "1%4"Error variant of .. read_hex_err "F0B0" == 61616SafeA ' parser.Boolean  for given '.Parse /. Safe Specialised 0. Specialised 1.Invert 2. 'map ord_invert [LT,EQ,GT] == [GT,EQ,LT]Given 2, re-order pair,ASort a pair of equal type values using given comparison function. (sort_pair compare ('b','a') == ('a','b')>Variant where the comparison function may not compute a value. Safe Safe Variant with error text.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 + elements with last 35 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 +. 9maybe_latch1 [Just 1,Nothing,Nothing,Just 4] == [1,1,1,4] of 4. 8maybe_map negate [Nothing,Just 2] == [Nothing,Just (-2)] If either is + then 5, else eq of values.0Join two values, either of which may be missing. of 6Apply predicate inside 7. (maybe_predicate even (Just 3) == Nothing of . blet r = [Nothing,Nothing,Nothing,Just 4] in maybe_filter even [Just 1,Nothing,Nothing,Just 4] == r Variant of  that retains +( as a placeholder for removed elements. ;filter_maybe even [1..4] == [Nothing,Just 2,Nothing,Just 4] Safe http://oeis.org/A000290)The squares of the non-negative integers. Dimport Data.List [0,1,4,9,16,25,36,49,64,81,100] `isInfixOf` a000290 http://oeis.org/A002267 http://oeis.org/A126709ALoh-Shu magic square, attributed to the legendary Fu Xi (Fuh-Hi). http://oeis.org/A126710IJaina inscription of the twelfth or thirteenth century, Khajuraho, India. SafeType specialised 8Type specialised 8Type specialised 8Type specialised 8Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9 Type specialised 9 Type specialised 9 Type specialised 9 Type specialised 9 Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9 Type specialised 9!Type specialised 9"Type specialised 9#Type specialised 9$Type specialised 9%Type specialised 9&Type specialised 9'Type specialised 9(Type specialised 9)Type specialised 9*Type specialised 9+Type specialised 9,Type specialised 9-Type specialised 9.Type specialised 9/Type specialised 90Type specialised 91Type specialised 92Type specialised 93Type specialised 94Type specialised 95Type specialised 96Type specialised 97Type specialised 98Type specialised 99Type specialised 9:Type specialised 9;Type specialised 9<Type specialised 9=Type specialised 9>Type specialised 9?Type specialised 9@Type specialised 9AType specialised 9BType specialised 9CType specialised 9DType specialised 9EType specialised 9FType specialised 9GType specialised 9HType specialised 9IType specialised 9JType specialised 9KType specialised 9LType specialised 9MType specialised 9NType specialised 9OType specialised 9PType specialised 9QType specialised 9RType specialised 9SType specialised 9TType specialised 9UType specialised 9VType specialised 9WType specialised 9XType specialised 9YType specialised 9ZType specialised 9[Type specialised 9\Type specialised 9]Type specialised 9^Type specialised 9_Type specialised 9`Type specialised 9aType specialised 9bType specialised 9cType specialised 9dType specialised 9eType specialised 9fType specialised 9gType specialised 9hType specialised 9iType specialised 9jType specialised 9kType specialised 9lType specialised 9mType specialised 9nType specialised 9oType specialised 9pType specialised 9qType specialised 9rType specialised 9sType specialised 9tType specialised 9uType specialised 9vType specialised 9wType specialised 9xType specialised 9yType specialised 9zType specialised 9{Type specialised 9|Type specialised 9}Type specialised 9~Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9Type specialised 9      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe Real (alias for :). @http://reference.wolfram.com/mathematica/ref/FractionalPart.html ,integral_and_fractional_parts 1.5 == (1,0.5)Type 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]); of .Type specialised .$ of .Type specialised .Is r zero to k decimal places. _map (flip zero_to_precision 0.00009) [4,5] == [True,False] zero_to_precision 4 1.00009 == FalseIs r whole to k decimal places. ;map (flip whole_to_precision 1.00009) [4,5] == [True,False] >http://reference.wolfram.com/mathematica/ref/SawtoothWave.html 2plotTable1 (map sawtooth_wave [-2.0,-1.99 .. 2.0])Pretty printer for < 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 = of n and d is not 1. Nlet r = [False,True,False] in map rational_simplifies [(2,3),(4,6),(5,7)] == r> and ? of rational.Rational as a whole number, or +.Erroring variant.Show rational to n decimal places. vlet r = approxRational pi 1e-100 r == 884279719003555 / 281474976710656 show_rational_decimal 12 r == "3.141592653590" Variant of @. The &C instance for floats resorts to exponential notation very readily. 4[show 0.01,realfloat_pp 2 0.01] == ["1.0e-2","0.01"]Show r as float to k places.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"]A . ;.Round b to nearest multiple of a. map (round_to 0.25) [0,0.1 .. 1] == [0.0,0.0,0.25,0.25,0.5,0.5,0.5,0.75,0.75,1.0,1.0] map (round_to 25) [0,10 .. 100] == [0,0,25,25,50,50,50,75,75,100,100] One-indexed B function. 1map (`oi_mod` 5) [1..10] == [1,2,3,4,5,1,2,3,4,5] One-indexed  function. Amap (`oi_divMod` 5) [1,3 .. 9] == [(0,1),(0,3),(0,5),(1,2),(1,4)]Integral square root function. ymap i_square_root [0,1,4,9,16,25,36,49,64,81,100] == [0 .. 10] map i_square_root [4 .. 16] == [2,2,2,2,2,3,3,3,3,3,3,3,4](0,1) = {x | 0 < x < 1} 0,1= {x | 0 "d x "d 1}(p,q] (0,1] = {x | 0 < x "d 1}[p,q) [0,1) = {x | 0 "d x < 1}    Safe*Type pairing a stratification and a tempo.4A stratification is a tree of integral subdivisions.One indexed variant of C. &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 B with input constraints. mod' (-1) 2 == 1Specialised variant of 9. Variant on D 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 D that requires B be 0. Variant of E that requires F 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.10282Safe Erroring G.H of G.H of .SafezComparison function type.LData.Vector.slice, ie. starting index (zero-indexed) and number of elements. slice 4 5 [1..] == [5,6,7,8,9];Variant of slice with start and end indices (zero-indexed).  section 4 8 [1..] == [5,6,7,8,9],Bracket sequence with left and right values. &bracket ('<','>') "1,2,3" == "<1,2,3>"-The first & middle & last elements of a list. 'unbracket "[12]" == Just ('[',"12",']')%Variant where brackets are sequences. ,bracket_l ("<:",":>") "1,2,3" == "<:1,2,3:>" Relative of splitOn", but only makes first separation. osplitOn "//" "lhs//rhs//rem" == ["lhs","rhs","rem"] separate_at "//" "lhs//rhs//rem" == Just ("lhs","rhs//rem")Splitter comparing single element.#Split before the indicated element. Ysplit_before 'x' "axbcxdefx" == ["a","xbc","xdef","x"] split_before 'x' "xa" == ["","xa"] map (flip split_before "abcde") "ae_" == [["","abcde"],["abcd","e"],["abcde"]] map (flip break "abcde" . (==)) "ae_" == [("","abcde"),("abcd","e"),("abcde","")]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 B #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]]3Rotate list so that is starts at indicated element. Zrotate_starting_from 'c' "abcde" == Just "cdeab" rotate_starting_from '_' "abc" == NothingErroring variant. Sequence of n& adjacent elements, moving forward by k/ places. The last element may have fewer than n7 places, but will reach the end of the input sequence. .adj 3 2 "adjacent" == ["adj","jac","cen","nt"] Variant of  where the last element has n9 places but may not reach the end of the input sequence. *adj' 3 2 "adjacent" == ["adj","jac","cen"]Generic form of .;Adjacent elements of list, at indicated distance, as pairs. adj2 1 [1..5] == [(1,2),(2,3),(3,4),(4,5)] let l = [1..5] in zip l (tail l) == adj2 1 l 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]  . +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] [] == []CInterleave list of lists. Allows lists to be of non-equal lenghts. ointerleave_set ["abcd","efgh","ijkl"] == "aeibfjcgkdhl" interleave_set ["abc","defg","hijkl"] == "adhbeicfjgkl"De-interleave n lists. `deinterleave 2 ".a+b-c" == [".+-","abc"] deinterleave 3 "aeibfjcgkdhl" == ["abcd","efgh","ijkl"])Special case for two-part deinterleaving. 'deinterleave2 ".a+b-c" == (".+-","abc")-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. 4map histogram ["","hohoh"] == [[],[('h',3),('o',2)]]1Elements that appear more than once in the input. 6map duplicates ["duplicates","redundant"] == ["","dn"]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]]I J. .intersect_l [[1,2],[1,2,3],[1,2,3,4]] == [1,2]I K. +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]] Variant of L/ that has a predicate to halt processing, ie. L of M. 8filter_halt (even . fst) ((< 5) . snd) (zip [1..] [0..]) Replace all p with q in s. greplace "_x_" "-X-" "an _x_ string" == "an -X- string" replace "ab" "cd" "ab ab cd ab" == "cd cd cd cd" Replace the i th value at ns with x. !replace_at "test" 2 'n' == "tent"Equivalent to N O P f. slet r = [[(1,'a'),(1,'b')],[(2,'c')],[(3,'d'),(3,'e')],[(4,'f')]] in group_on fst (zip [1,1,2,3,3,4] "abcdef") == rGiven accesors for key and value collate adjacent values. of Q and R. <collate_adjacent (zip "TDD" "xyz") == [('T',"x"),('D',"yz")]S prior to . flet r = [('A',"a"),('B',"bd"),('C',"ce"),('D',"f")] in collate_on fst snd (zip "ABCBCD" "abcdef") == r of Q and R. ecollate (zip "TDD" "xyz") == [('D',"yz"),('T',"x")] collate (zip [1,2,1] "abc") == [(1,"ac"),(2,"b")] Reverse of %, inverse if order is not considered. 1uncollate [(1,"ac"),(2,"b")] == zip [1,1,2] "acb"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 T. >dx_d' 5 [1,2,3] == (11,[5,6,8]) dx_d' 0 [1,1,1] == (3,[0,1,2])Apply flip of f between elements of l. 5d_dx_by (,) "abcd" == [('b','a'),('c','b'),('d','c')] Integrate,   /, 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 J of p and q O p. is_subset [1,2] [1,2,3] == TrueIs p a superset of q, ie. H . !is_superset [1,2,3] [1,2] == TrueIs p a subsequence of q, ie. synonym for U. !subsequence [1,2] [1,2,3] == True Variant of V that requires e to be unique in p. *elem_index_unique 'a' "abcda" == undefined&Lookup that errors and prints message.Error variant.W variant with default value.Reverse lookup. Rreverse_lookup 'c' [] == Nothing reverse_lookup 'c' (zip [0..4] ['a'..]) == Just 2 Basis of  , indicates if xR is to the left or right of the list, and it to the right whether equal or not. X? values will be correct if the list is not ascending, however Y- values only make sense for ascending ranges. 5map (find_bounds' compare [(0,1),(1,2)]) [-1,0,1,2,3]=Decide if value is nearer the left or right value of a range. UFind the number that is nearest the requested value in an ascending list of numbers. Dmap (find_nearest_err [0,3.5,4,7]) [-1,1,3,5,7,9] == [0,0,3.5,4,7,7]  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 Special case of . 2map drop_last ["","?","remove"] == ["","","remov"] Variant of Z from right of list. dropRight 1 [1..9] == [1..8] Variant of [ from right of list. .dropWhileRight Data.Char.isDigit "A440" == "A"\ from right. take_right 3 "taking" == "ing"M from right. 2take_while_right Data.Char.isDigit "A440" == "440"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]FSeparate list into an initial list and perhaps the last element tuple. !separate_last' [] == ([],Nothing)Error on null input. "separate_last [1..5] == ([1..4],5)(Replace directly repeated elements with +. Cindicate_repetitions "abba" == [Just 'a',Just 'b',Nothing,Just 'a']] of list and it's own tail. Ezip_with_adj (,) "abcde" == [('a','b'),('b','c'),('c','d'),('d','e')]Type-specialised . of ^. (compare_adjacent [0,1,3,2] == [LT,LT,GT]N 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]]1Reduce sequences of consecutive values to ranges. pgroup_ranges [-1,0,3,4,5,8,9,12] == [(-1,0),(3,5),(8,9),(12,12)] group_ranges [3,2,3,4,3] == [(3,3),(2,4),(3,3)]N on  structure of 7 , ie. all 3 compare equal. nlet r = [[Just 1],[Nothing,Nothing],[Just 4,Just 5]] in group_just [Just 1,Nothing,Nothing,Just 4,Just 5] == r7Predicate to determine if all elements of the list are O. all_equal "aaa" == TrueVariant using _. of S. 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 ` , defer to g."BSequence of comparison functions, continue comparing until not EQ. _compare (1,0) (0,1) == GT n_stage_compare [compare `on` snd,compare `on` fst] (1,0) (0,1) == LT#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"$H of #. &sort_on [1,4,2,3,5] "adbce" == "abcde"%a of !.&a of ".'7Given a comparison function, merge two ascending lists. 'mergeBy compare [1,3,5] [2,4] == [1..5](' ^ P.)b of !.*mergeBy ^.+WMerge list of sorted lists given comparison function. Note that this is not equal to c.,+ of ^. 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.%First non-ascending pair of elements./d of ..0/ ^.1 Variant of e5 that operates on a sorted list, halting. This is f. C16 `elem_ordered` [1,3 ..] == False 16 `elem` [1,3 ..] == undefined2 Variant of g) that operates on a sorted list, halting. k16 `elemIndex_ordered` [1,3 ..] == Nothing 16 `elemIndex_ordered` [0,1,4,9,16,25,36,49,64,81,100] == Just 43Keep right variant of ]', where unused rhs values are returned. Ezip_with_kr (,) [1..3] ['a'..'e'] == ([(1,'a'),(2,'b'),(3,'c')],"de")4A ] variant that always consumes an element from the left hand side (lhs), but only consumes an element from the right hand side (rhs) if the zip function is X and not if YQ. There's also a secondary function to continue if the rhs ends before the lhs.5HFill gaps in a sorted association list, range is inclusive at both ends. let r = [(1,'a'),(2,'x'),(3,'x'),(4,'x'),(5,'b'),(6,'x'),(7,'c'),(8,'x'),(9,'x')] in fill_gaps_ascending' 'x' (1,9) (zip [1,5,7] "abc") == r6Direct definition.7h and i in one pass. 'minmax "minimumandmaximum" == ('a','x')8Apply f& to both elements of a two-tuple, ie. bimap f f.9Append k to the right of l until result has n places. map (pad_right '0' 2 . return) ['0' .. '9'] pad_right '0' 12 "1101" == "110100000000" map (pad_right ' '3) ["S","E-L"] == ["S ","E-L"]:Append k to the left of l until result has n places. *map (pad_left '0' 2 . return) ['0' .. '9'];%Locate first (leftmost) embedding of q in p). Return partial indices for failure at Y. `embedding ("embedding","ming") == Right [1,6,7,8] embedding ("embedding","mind") == Left [1,6,7]=Does q: occur in sequence, though not necessarily adjacently, in p. vis_embedding [1 .. 9] [1,3,7] == True is_embedding "embedding" "ming" == True is_embedding "embedding" "mind" == False?(Enumerate indices for all embeddings of q in p. Nall_embeddings "all_embeddings" "leg" == [[1,4,12],[1,7,12],[2,4,12],[2,7,12]]@Unpack one element list.AErroring variant.BReplace elements at j0 with result of joining with elements from list. let t = Node 0 [Node 1 [Node 2 [],Node 3 []],Node 4 []] putStrLn $ drawTree (fmap show t) let u = (adopt_shape (\_ x -> x) "abcde" t) putStrLn $ drawTree (fmap return u)C Variant of B that considers only 3 elements at j. ilet {s = "a(b(cd)ef)ghi" ;t = group_tree (begin_end_cmp_eq '(' ')') s} in adopt_shape_m (,) [1..13] tD Given an 2 predicate where k opens a group, l closes a group, and `3 continues current group, construct tree from list. ilet {l = "a {b {c d} e f} g h i" ;t = group_tree ((==) '{',(==) '}') l} in catMaybes (flatten t) == l _let {d = putStrLn . drawTree . fmap show} in d (group_tree ((==) '(',(==) ')') "a(b(cd)ef)ghi")ERemove element at index. @remove_ix 5 "remove" == "remov" remove_ix 5 "short" == undefinedIReplace element at i in p by application of f. &replace_ix negate 1 [1..3] == [1,-2,3]JCyclic indexing function. .map (at_cyclic "cycle") [0..9] == "cyclecycle"      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJNoneKFactorial function. (factorial 13,maxBound::Int)L Number of k" element permutations of a set of n elements. 7(nk_permutations 4 3,nk_permutations 13 3) == (24,1716)M Number of nk permutations where n O k. fmap n_permutations [1..8] == [1,2,6,24,120,720,5040,40320] n_permutations 16 `div` 1000000 == 20922789NGenerate 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]OApply permutation f to p. Olet p = permutation [1..4] [4,3,2,1] in apply_permutation p [1..4] == [4,3,2,1]PComposition of O and R. 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]QTrue 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]]R'Generate a permutation from the cycles c. ?apply_permutation (from_cycles [[0,1,2,3]]) [1..4] == [2,3,4,1]S"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]]TComposition 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]UTwo line notation of p. ;two_line (permutation [0,1,3] [1,0,3]) == ([1,2,3],[2,1,3])VOne 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]]W Variant of V 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"X(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 KLMNOPQRSTUVWXKLMNOPQRSTUVWXKLMNOPQRSTUVWXKLMNOPQRSTUVWXNoneYGenerate all permutations. Vpermutations [0,3] == [[0,3],[3,0]] length (permutations [1..5]) == P.n_permutations 5Z2Generate all distinct permutations of a multi-set. :multiset_permutations [0,1,1] == [[0,1,1],[1,1,0],[1,0,1]]\/Calculate number of permutations of a multiset. jlet r = factorial 11 `div` product (map factorial [1,4,4,2]) in multiset_permutations_n "MISSISSIPPI" == r dmultiset_permutations_n "MISSISSIPPI" == 34650 length (multiset_permutations "MISSISSIPPI") == 34650YZ[\YZ[\YZ[\YZ[\None!]Enumeration of set of faces of a cube.dRelation between to f values as a (complementary,permutation) pair.eComplete sequence (ie. #8).fInitial half of e (ie. #4). The complete e is formed by appending the  of the f.gg)s for elements of the symmetric group P4.Complement of a f. =map complement [[4,1,3,2],[6,7,8,5]] == [[8,5,7,6],[2,3,4,1]]Form e from f. 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 f, ie.  or 6. 8map lower [[4,1,3,2],[6,7,8,5]] == [[4,1,3,2],[2,3,4,1]]Application of g p on q. Il_on Q1 I == Q1 l_on D Q12 == Q4 [l_on L L,l_on E D,l_on D E] == [L2,C,B]%Generalisation of Fibonnaci process, f1 is the binary operator giving the next element, p and q are the initial elements.See discussion in: Carlos Agon, Moreno Andreatta, Grard Assayag, and Stphan Schaub. _Formal Aspects of Iannis Xenakis' "Symbolic Music": A Computer-Aided Exploration of Compositional Processes_. Journal of New Music Research, 33(2):145-159, 2004.NNote that the article has an error, printing Q4 for Q11 in the sequence below. 'import qualified Music.Theory.List as T let r = [D,Q12,Q4, E,Q8,Q2, E2,Q7,Q4, D2,Q3,Q11, L2,Q7,Q2, L,Q8,Q11] in (take 18 (fib_proc l_on D Q12) == r,T.duplicates r == [Q2,Q4,Q7,Q8,Q11])+Beginning E then G2 no Q nodes are visited. xlet r = [E,G2,L2,C,G,D,E,B,D2,L,G,C,L2,E2,D2,B] in (take 16 (fib_proc l_on E G2) == r,T.duplicates r == [B,C,D2,E,G,L2]) \import Music.Theory.List let [a,b] = take 2 (segments 18 18 (fib_proc l_on D Q12)) in a == b{The prime numbers that are not factors of 18 are {1,5,7,11,13,17}. They form a closed group under modulo 18 multiplication. let {n = [5,7,11,13,17] ;r = [(5,7,17),(5,11,1),(5,13,11),(5,17,13) ,(7,11,5),(7,13,1),(7,17,11) ,(11,13,17),(11,17,7) ,(13,17,5)]} in [(p,q,(p * q) `mod` 18) | p <- n, q <- n, p < q] == r=The article also omits the 5 after 5,1 in the sequence below. let r = [11,13,17,5,13,11,17,7,11,5,1,5,5,7,17,11,7,5,17,13,5,11,1,11] in take 24 (fib_proc (\p q -> (p * q) `mod` 18) 11 13) == re of g , inverse of . seq_of Q1 == [8,7,5,6,4,3,1,2]f of g, ie.   . half_seq_of Q1 == [8,7,5,6]f of e, ie. \ 4. .complement (half_seq (seq_of Q7)) == [3,4,2,1]Reverse table W. Yreverse_lookup 'b' (zip [1..] ['a'..]) == Just 2 lookup 2 (zip [1..] ['a'..]) == Just 'b'g of e , inverse of . ;label_of [8,7,5,6,4,3,1,2] == Q1 label_of (seq_of Q4) == Q4m if two f s are complementary, ie. form a e. )complementary [4,2,1,3] [8,6,5,7] == True Determine d of fs. ~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])d from g p to q. 2relate_l L L2 == (False,P.listPermute 4 [0,3,1,2]) adjacent f , see also . adjacent gs. vrelations_l [L2,L,A] == [(False,P.listPermute 4 [0,2,3,1]) ,(False,P.listPermute 4 [2,0,1,3])]Apply d to f. Gapply_relation (False,P.listPermute 4 [0,3,1,2]) [1,4,2,3] == [1,3,4,2]Apply sequence of d to initial f. 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]ELabel sequence of Fig. VIII-6. Hexahedral (Octahedral) Group (p. 220) `let r = [I,A,B,C,D,D2,E,E2,G,G2,L,L2,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12] in viii_6_lseq == r%Label sequence of Fig. VIII-7 (p.221) `let r = [I,A,B,C,D,D2,E,E2,G,G2,L,L2,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12] in viii_7_lseq == rFig. 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]] import Music.Theory.Array.MD tlet t = md_matrix_opt show (\x -> "_" ++ x ++ "_") (head viii_7,head viii_7) viii_7 putStrLn $ unlines $ md_table' t'Label sequence of Fig. VIII-6/b (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 f. Rviii_6b_p' == map half_seq_of viii_6b_l nub (map (length . nub) viii_6b_p') == [4] Variant of  with f.Fig. 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])]The sequence of d to give viii_6_l from s. Uapply_relations_l viii_6_relations L2 == viii_6_l length (nub viii_6_relations) == 14The sequence of d to give  viii_6b_l from q. Wapply_relations_l viii_6b_relations I == viii_6b_l length (nub viii_6b_relations) == 10?]^_`abcdefghijklmnopqrstuvwxyz{|}~?]^_`abcdefgjihkrqnmolpstuvwxyz{|}~?ghijklmnopqrstuvwxyz{|}~fed]^_`abc!]^_`abcdefghijklmnopqrstuvwxyz{|}~NonedA 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 "380ETA" == [3,8,10,11,12,13]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] == r8Given two sequences, derive the one-indexed "hold" list. %derive_holds ("12345","13254") == [1]Two-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]) == 3n of  with initial sequence appended. 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]) == 6 @https://rsw.me.uk/blueline/methods/view/Cambridge_Surprise_Major ;length (closed_method cambridge_surprise_major [1..8]) == 7 Bhttps://rsw.me.uk/blueline/methods/view/Smithsonian_Surprise_Royal ylet m = closed_method smithsonian_surprise_royal [1..10] (length m,nub (map length m),sum (map length m)) == (9,[40],360) Chttps://rsw.me.uk/blueline/methods/view/Ecumenical_Surprise_Maximus {let m = closed_method ecumenical_surprise_maximus [1..12] (length m,nub (map length m),sum (map length m)) == (11,[48],528)SafebAlteration 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).)Note sequence as usually understood, ie.  - .Char variant of o. Table of ! and corresponding pitch-classes. Transform  to pitch-class number. !map note_to_pc [C,E,G] == [0,4,7] Inverse of . &mapMaybe pc_to_note [0,4,7] == [C,E,G]Modal transposition of  value. note_t_transpose C 2 == E Parser from ', case insensitive flag. 7mapMaybe (parse_note True) "CDEFGab" == [C,D,E,F,G,A,B]Inclusive set of 3 within indicated interval. This is not equal to p which is not circular. Jnote_span E B == [E,F,G,A,B] note_span B D == [B,C,D] enumFromTo B D == [] Generic form. Transform # to semitone alteration. Returns + for non-semitone alterations. Emap alteration_to_diff [Flat,QuarterToneSharp] == [Just (-1),Nothing]Is  12-ET. Transform  to semitone alteration. 1map alteration_to_diff_err [Flat,Sharp] == [-1,1] Transform = to fractional semitone alteration, ie. allow quarter tones. +alteration_to_fdiff QuarterToneSharp == 0.5,Transform fractional semitone alteration to , ie. allow quarter tones. ymap fdiff_to_alteration [-0.5,0.5] == [Just QuarterToneFlat ,Just QuarterToneSharp]Raise " by a quarter tone where possible. oalteration_raise_quarter_tone Flat == Just QuarterToneFlat alteration_raise_quarter_tone DoubleSharp == NothingLower " by a quarter tone where possible. palteration_lower_quarter_tone Sharp == Just QuarterToneSharp alteration_lower_quarter_tone DoubleFlat == NothingEdit # 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 ThreeQuarterToneFlat Simplify , to standard 12ET by deleting quarter tones. FData.List.nub (map alteration_clear_quarter_tone [minBound..maxBound])Unicode 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*" Inverse of . ;mapMaybe symbol_to_alteration "&m&n&o" == [Flat,Natural,Sharp] Variant of  that also recognises b for  and # for  and x for double sharp.The ISOM ASCII spellings for alterations. Naturals are written as the empty string. zmapMaybe alteration_iso_m [Flat .. Sharp] == ["b","","#"] mapMaybe alteration_iso_m [DoubleFlat,DoubleSharp] == ["bb","x"]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"]5Note & alteration sequence in key-signature spelling.)Table connecting pitch class number with . of . Transform  to . Qlet r = [(-1,"&m"),(0,"&n"),(1,"&o")] in map alteration_t' [Flat,Natural,Sharp] == r333# SafeY5Generalised pitch, given by a generalised alteration. ,Midi note number with integral cents detune. /Midi note number with real-valued cents detune. #Midi note number with cents detune.  Variant of   for incomplete functions. Function to spell a ."Common music notation pitch value.NFractional octave pitch-class (octave is integral, pitch-class is fractional).Fractional midi note number.Midi note number and  duple.0Octaves are integers, the octave of middle C is 4.)Pitch classes are modulo twelve integers. and  duple. Normalise , value, ie. ensure pitch-class is in (0,11). Transpose  value. value to integral midi note number. Inverse of .2Translate from generic octave & pitch-class duple. Normalise . octpc_nrm (4,16) == (5,4)  Transpose . :octpc_trs 7 (4,9) == (5,4) octpc_trs (-11) (4,9) == (3,10)!Enumerate range, inclusive. Doctpc_range ((3,8),(4,1)) == [(3,8),(3,9),(3,10),(3,11),(4,0),(4,1)]" value to integral midi note number. imap octpc_to_midi [(0,0),(2,6),(4,9),(9,0)] == [12,42,69,120] map octpc_to_midi [(0,9),(8,0)] == [21,108]# Inverse of ". *map midi_to_octpc [40,69] == [(2,4),(4,9)]$9 of ".%1Fractional midi to fractional octave pitch-class. fmidi_to_foctpc 69.5 == (4,9.5)&&Octave of fractional midi note number.(5Move fractional midi note number to indicated octave. 2map (fmidi_in_octave 1) [59.5,60.5] == [35.5,24.5]) 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.5.Extract  of  wmap pitch_to_pc [Pitch A Natural 4,Pitch F Sharp 4] == [9,6] map pitch_to_pc [Pitch C Flat 4,Pitch B Sharp 5] == [11,0]/ comparison, implemented via -. Dpitch_compare (Pitch A Natural 4) (Pitch A QuarterToneSharp 4) == LT0Given   function translate from  notation to . <octpc_to_pitch T.pc_spell_sharp (4,6) == Pitch T.F T.Sharp 41Midi note number to . Xlet r = ["C4","E&m4","F&o4"] in map (pitch_pp . midi_to_pitch pc_spell_ks) [60,63,66] == r2QPrint fractional midi note number as ET12 pitch with cents detune in parentheses. &fmidi_et12_cents_pp 66.5 == "F&o4(+50)"3Fractional midi note number to . +fmidi_to_pitch pc_spell_ks 69.25 == Nothing4Erroring variant. import Music.Theory.Pitch.Spelling pitch_pp (fmidi_to_pitch_err pc_spell_ks 65.5) == "F24" pitch_pp (fmidi_to_pitch_err pc_spell_ks 66.5) == "F04" pitch_pp (fmidi_to_pitch_err pc_spell_ks 67.5) == "A-4" pitch_pp (fmidi_to_pitch_err pc_spell_ks 69.5) == "B-4"5Composition of - and then 3. Kimport Music.Theory.Pitch.Name as T import Music.Theory.Pitch.Spelling as T -pitch_tranpose T.pc_spell_ks 2 T.ees5 == T.f56Displacement of q into octave of p.7Octave displacement of m2 that is nearest m1. }let {p = octpc_to_fmidi (2,1);q = map octpc_to_fmidi [(4,11),(4,0),(4,1)]} in map (fmidi_in_octave_nearest p) q == [35,36,37]8Displacement of q into octave above p. dfmidi_in_octave_of 69 51 == 63 fmidi_in_octave_nearest 69 51 == 63 fmidi_in_octave_above 69 51 == 759Displacement of q into octave below p. dfmidi_in_octave_of 69 85 == 61 fmidi_in_octave_nearest 69 85 == 73 fmidi_in_octave_below 69 85 == 61; CPS form of 7. Nmap cps_octave [440,256] == [4,4] round (cps_in_octave_nearest 440 256) == 512<Raise or lower the frequency q3 by octaves until it is in the octave starting at p. &cps_in_octave_above 55.0 392.0 == 98.0?Set 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] == r@Raise Note_T of #, account for octave transposition. 9pitch_note_raise (Pitch B Natural 3) == Pitch C Natural 4ALower Note_T of #, account for octave transposition. 3pitch_note_lower (Pitch C Flat 4) == Pitch B Flat 3BRewrite  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 == qCApply function to  of . @pitch_edit_octave (+ 1) (Pitch A Natural 4) == Pitch A Natural 5DMidi= note number to cycles per second, given frequency of ISO A4.ED 440. 4map midi_to_cps [60,69] == [261.6255653005986,440.0]F Fractional midi= note number to cycles per second, given frequency of ISO A4.GF 440. 7map fmidi_to_cps [69,69.1] == [440.0,442.5488940698553]HG of -, given frequency of ISO A4.IH 440.J2Frequency (cps = cycles per second) to fractional midi4 note number, given frequency of ISO A4 (mnn = 69).KJ 440. Acps_to_fmidi 440 == 69 cps_to_fmidi (fmidi_to_cps 60.25) == 60.25L!Frequency (cycles per second) to midi note number, ie. $ of K. &map cps_to_midi [261.6,440] == [60,69]MD of ", given frequency of ISO A4.NM 440. octpc_to_cps (4,9) == 440O# of L.QIs cents in (-50,+50]. :map cents_is_normal [-250,-75,75,250] == replicate 4 FalseRQ of R.SPIn normal form the detune is in the range (-50,+50] instead of [0,100) or wider. ?map midi_detune_normalise [(60,-250),(60,-75),(60,75),(60,250)]T Inverse of Y, given frequency of ISO A4.U Inverse of Y. 5map midi_detune_to_cps [(69,0),(68,100)] == [440,440]V  to fractional midi note number. 'midi_detune_to_fmidi (60,50.0) == 60.50W  to 1, detune must be precisely at a notateable Pitch. let p = Pitch {note = C, alteration = QuarterToneSharp, octave = 4} in midi_detune_to_pitch T.pc_spell_ks (midi_detune_nearest_24et (60,35)) == pXFractional midi note number to  . 'fmidi_to_midi_detune 60.50 == (60,50.0)YFrequency (in hertz) to  . Imap (fmap round . cps_to_midi_detune) [440.00,508.35] == [(69,0),(71,50)]ZRound detune value to nearest multiple of 50 , normalised. Cmap midi_detune_nearest_24et [(59,70),(59,80)] == [(59,50),(60,00)]\ Printed as fmidi1 value with cents to two places. Must be normal. 7map midi_cents_pp [(60,0),(60,25)] == ["60.00","60.25"]]*Parse possible octave from single integer. &map (parse_octave 2) ["","4","x","11"]^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.`q variant.aPretty printer for  (unicode, see alteration_symbol). Option selects if Naturals are printed. 9pitch_pp_opt (True,True) (Pitch T.E T.Natural 4) == "E&n4"ba( with default options, ie. (False,True). pitch_pp (Pitch T.E T.Natural 4) == "E4" pitch_pp (Pitch T.E T.Flat 4) == "E&m4" pitch_pp (Pitch T.F T.QuarterToneSharp 3) == "F23"ca with options (False,False). <pitch_class_pp (Pitch T.C T.ThreeQuarterToneSharp 0) == "C0"dSequential list of n! pitch class names starting from k. punwords (pitch_class_names_12et 0 12) == "C C&o D E&m E F F&o G A&m A B&m B" pitch_class_names_12et 11 2 == ["B","C"]ePretty printer for  (ISO, ASCII, see alteration_iso). pitch_pp_iso (Pitch E Flat 4) == "Eb4" pitch_pp_iso (Pitch F DoubleSharp 3) == "Fx3" pitch_pp_iso (Pitch C ThreeQuarterToneSharp 4) -- errorfPretty printer for  (ASCII, see alteration_tonh). pitch_pp_hly (Pitch E Flat 4) == "ees4" pitch_pp_hly (Pitch F QuarterToneSharp 3) == "fih3" pitch_pp_hly (Pitch B Natural 6) == "b6"gPretty printer for  (Tonhhe, see alteration_tonh). pitch_pp_tonh (Pitch E Flat 4) == "Es4" pitch_pp_tonh (Pitch F QuarterToneSharp 3) == "Fih3" pitch_pp_tonh (Pitch B Natural 6) == "H6"iC into h. +pitch_class_pp (pc24et_to_pitch 13) == "F0"jPretty printer for .k printed without octave.f      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkle      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkf !"#$%&'(l)*+,-./  0123456789:;<=>?@ABCDEFGHIJKLMNOP QRSTUVW XYZ [\]^_`abcdefghijka      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklSafeXqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Xqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Xqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Xqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe????Safe  *Spelling table for natural (&n) notes only. (Spelling table for sharp (&o) notes only. 'Spelling table for flat (&m) notes only. NSpelling table 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.-Spell using indicated table prepended to and   and  $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)]Lookup  . -map pc_spell_ks [6,8] == [(F,Sharp),(A,Flat)]Use always sharp (&o) spelling. tmap pc_spell_sharp [6,8] == [(F,Sharp),(G,Sharp)] Data.List.nub (map (snd . pc_spell_sharp) [1,3,6,8,10]) == [Sharp]Use 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]1 .                    Safe 6Form of cluster with smallest outer boundary interval. )cluster_normal_order [0,1,11] == [11,0,1]*Normal order starting in indicated octave. =cluster_normal_order_octpc 3 [0,1,11] == [(3,11),(4,0),(4,1)]True if r of cluster is not equal to . Omap cluster_is_multiple_octave [[0,1,11],[1,2,3],[1,2,11]] == [True,False,True]^Spelling table for chromatic and near-chromatic clusters, pitch-classes are in cluster order. Slet f (p,q) = (p == map T.note_alteration_to_pc_err q) in all f spell_cluster_tableSpell an arbitrary sequence of  values. Kfmap (map T.pitch_pp_iso) (spell_cluster_octpc [(3,11),(4,3),(4,11),(5,1)])KSpelling for chromatic clusters. Sequence must be ascending. Pitch class 0 maps to c4, if there is no 0 then all notes are in octave 4. klet f = (fmap (map T.pitch_pp) . spell_cluster_c4) in map f [[11,0],[11]] == [Just ["B3","C4"],Just ["B4"]] Efmap (map T.pitch_pp) (spell_cluster_c4 [10,11]) == Just ["A&o4","B4"] Variant of  that runs pitch_edit_octave. An octave of 4 is the identitiy, 3 an octave below, 5 an octave above. fmap (map T.pitch_pp) (spell_cluster_c 3 [11,0]) == Just ["B2","C3"] fmap (map T.pitch_pp) (spell_cluster_c 3 [10,11]) == Just ["A&o3","B3"]  Variant of  that runs pitch_edit_octave7 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 T.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 pitch_edit_octave* so that the left-most note is in octave o. fmap (map T.pitch_pp) (spell_cluster_left 3 [11,0]) == Just ["B3","C4"] fmap (map T.pitch_pp) (spell_cluster_left 3 [10,11]) == Just ["A&o3","B3"]  !  !  !  !Safe "r then _. set [3,3,3,2,2,1] == [1,2,3]#'Size of powerset of set of cardinality n, ie. 2 s 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]%>Variant where result is sorted and the empty set is not given. <powerset' [1,2,3] == [[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]&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 t. 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  cartesian_product "abc" "" == []+&List form of n-fold cartesian product. xlength (nfold_cartesian_product [[1..13],[1..4]]) == 52 length (nfold_cartesian_product ["abc","de","fgh"]) == 3 * 2 * 3 "#$%&'()*+ "#$%&'()*+ "#$%&'()*+ "#$%&'()*+Safe,-.,-.,-.,-.Safe/ Element of "(sequence,multiplier,displacement).0Tiling (sequence)1Voice.2 Canon of +(period,sequence,multipliers,displacements).3 Sequence.4 Cycle at period. 8take 9 (p_cycle 18 [0,2,5]) == [0,2,5,18,20,23,36,38,41]5Resolve 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]6Infer / 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)7Set of 1 from 2.8u of 7.9Retrograde of 0 , the result 0 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]] == r:The normal form of 0 is the v of t and it's 9. 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]] == r;Derive set of 2 from 0. 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<msum   . &observeAll (fromList [1..7]) == [1..7]= Search for perfect tilings of the sequence 3 using multipliers from m to degree n with k parts.>: of  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 e4 for ordered sequences, which can therefore return 5# when searching infinite sequences. <5 `elemOrd` [0,2..] == False && 10 `elemOrd` [0,2..] == True@A .* diagram of n places of 1. -v_dot_star 18 [0,2..] == "*.*.*.*.*.*.*.*.*."A#A white space and index diagram of n places of 1.1mapM_ (putStrLn . v_space_ix 9) [[0,2..],[1,3..]]>> 0 2 4 6 8> 1 3 5 7BInsert | every n places. =with_bars 6 (v_dot_star 18 [0,2..]) == "*.*.*.|*.*.*.|*.*.*."CVariant with measure length m and number of measures n. 2v_dot_star_m 6 3 [0,2..] == "*.*.*.|*.*.*.|*.*.*."DPrint .* diagram.EVariant to print | at measures.FVariant that discards first k measures./0123456789:;<=>?@ABCDEF/0123456789:;<=>?@ABCDEF32104/56789:;<=>?@ABCDEF/0123456789:;<=>?@ABCDEFSafeG{0,1,2} order 5, p.1v_print 15 (r_voices p1)>> ..***..........> ........*.*.*..> .....*...*...*.> .*....*....*...> *......*......*H{0,1,2} order 7, p.2v_print 21 (r_voices p2)>> ..............***....> ..*.*.*..............> ...*...*...*.........> ........*....*....*..> .....*......*......*.> .*.......*.......*...> *.........*.........*I{0,1} order 4, p.3v_print 8 (r_voices p3)> > *...*... > .**..... > ...*..*. > .....*.*J{0,1} order 5, p.4 mapM_ (v_print 10 . r_voices) p4> > *...*..... > .**....... > ...*....*. > .....*.*.. > ......*..*> > *....*.... > .**....... > ...*..*... > ....*...*. > .......*.*> > *...*..... > .*....*... > ..**...... > .....*..*. > .......*.*KOpen {1,2,3} order 5, p.4v_print 18 (r_voices p4_b)>> ...***............> ........*.*.*.....> .........*...*...*> .*....*....*......> *......*......*...GHIJKGHIJKGHIJKGHIJK SafeLTilework for Clarinet, p.3v_print 36 (rr_voices p3)>&> *.*..*............*.*..*............&> .*.*..*............*.*..*...........&> ........*.*..*............*.*..*....&> ....*..*.*............*..*.*........&> ...........*..*.*............*..*.*.&> ............*..*.*............*..*.*M Tilework for String Quartet, p.5 mapM_ (v_print 24 . r_voices) p5 >> ******......******......> ......******......******>> *.****.*....*.****.*....> ......*.****.*....*.****>> **.***..*...**.***..*...> ......**.***..*...**.***>> *..***.**...*..***.**...> ......*..***.**...*..***NExtra Perfect (p.7)#v_print_m_from 18 6 6 (r_voices p7) >+> **.*..|......|......|......|......|......+> ......|.*.*..|.*....|......|......|......+> ......|......|......|......|.*..*.|....*.+> ......|......|...*..|.*....|...*..|......+> ......|......|....*.|...*..|......|.*....+> ......|*.....|*.....|......|*.....|......+> ....*.|......|......|*.....|......|...*..+> ......|......|......|....*.|......|*.....O#Tilework for Log Drums (2005), p.10v_print 18 (r_voices p10)>> *.*.*.............> .*...*...*........> ...*...*...*......> ......*...*...*...> ........*...*...*.> .............*.*.*P"Self-Similar Melodies (1996), p.11v_print_m 20 5 (r_voices p11)>j> *.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....|*.....*.....*..*..*.|....*.....*.....*...j> ....................|*.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....|*.....*.....*..*..*.j> ....................|....................|*.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....LMNOPLMNOPLMNOPLMNOP!SafeBQA ' parser.RLinear form of W, an ascending sequence of S.S Linear term.TLinear state. V is the start time of the term, aC is the active tempo & therefore the reciprocal of the duration, U is the part label.UKVoices are named as a sequence of left and right directions within nested [ structures.V Time point.WRecursive temporal structure.X Leaf nodeYIsolateZSequence[Parallel\Tempo multiplier]3Terms are the leaf nodes of the temporal structure.a&Tempo is rational. The duration of a ] is the reciprocal of the a that is in place at the ].b Types of [ nodes.hThe different [& modes are indicated by bracket types.jPretty printer for W), given pretty printer for the term type.kj of .l=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)mDuration element of l.n&Calculate final tempo and duration of W.oR of n.pStart time of S.q Duration of S (reciprocal of tempo).r End time of S.s Linearise W given initial T, ascending by construction.tMerge two ascending R.uSet of unique a at R.v Multiply a by n , and divide V by n.w?After normalisation all start times and durations are integral.xFAll leftmost voices are re-written to the last non-left turning point. ]map voice_normalise ["","l","ll","lll"] == replicate 4 "" voice_normalise "lllrlrl" == "rlrl"yO P xzUnique Us at R.{The duration of R.| Locate an S! that is active at the indicated V and in the indicated U.}#Calculate grid (phase diagram) for R.~} of s.Bel type phase diagram for W of '0. Optionally print whitespace between columns.w of .Infix form for Z.I of Z. _lseq [Node Rest] == Node Rest lseq [Node Rest,Node Continue] == Seq (Node Rest) (Node Continue)X of ^. of X Variant of  where _ is read as ` and - as _.[ of f, this is the default b.X of _. of x of . Verify that k of  is 6.Run , and print both k 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 "" "_"Parse ' ^ ]. P.parse p_char_value "" "a"Parse ' ]. &P.parse (P.many1 p_char_term) "" "-_a"Parse ' X. &P.parse (P.many1 p_char_node) "" "-_a"Parse non-negative y. %P.parse p_non_negative_integer "" "3"Parse non-negative <. EP.parse (p_non_negative_rational `P.sepBy` (P.char ',')) "" "3%5,2/3"Parse non-negative :. nP.parse p_non_negative_double "" "3.5" P.parse (p_non_negative_double `P.sepBy` (P.char ',')) "" "3.5,7.2,1.0"Parse non-negative number as <. EP.parse (p_non_negative_number `P.sepBy` (P.char ',')) "" "7%2,3.5,3"Parse \. #P.parse (P.many1 p_mul) "" "/3*3/2"Given parser for W a , generate Y parser. of . P.parse p_char_iso "" "{abcde}"Given parser for W a , generate [ parser. of . HP.parse p_char_par "" "{ab,{c,de}}" P.parse p_char_par "" "{ab,~(c,de)}"Parse W '. 'P.parse (P.many1 p_char_bel) "" "-_a*3"Run parser for W of '.KQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~KQRSTUVWZXY[\]^`_abcdefghijklmnopqrstuvwxyz{|}~Kbcdefghia]^_`WXYZ[\jklmnoVUTSpqrRstuvwxyz{|}~Q>QRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"SafeSequences are either in  or  order. In a modulo mT system, normalise step increments to be either -1 or 1. Non steps raise an error. 1map (normalise_step 6) [-5,-1,1,5] == [1,-1,1,-1]BWyschnegradsky writes the direction sign at the end of the number. (map parse_num_sign ["2+","4-"] == [2,-4]BExpand a chromatic (step-wise) sequence, sign indicates direction. .map vec_expand [2,-4] == [[1,1],[-1,-1,-1,-1]]`Parse the vector notation used in some drawings, a comma separated list of chromatic sequences. eparse_vec Nothing 0 "4-,4+,4-,4+,4-,4+,4-,4+,4-" parse_vec Nothing 0 "2+,2-,2+,2-,2+,2-,2+,2-,2+,18+"Modulo addition..Parse hex colour string, as standard in HTML5. &parse_hex_clr "#e14630" == (225,70,48)Type specialised./Normalise colour by dividing each component by m. 8clr_normalise 255 (parse_hex_clr "#ff0066") == (1,0,0.4) Group sequence into normal (ie. ") order given drawing dimensions.!Printer for pitch-class segments."Index to colour name abbreviation. map u3_ix_ch [0..5] == "ROYGBV" Inverse of . map u3_ch_ix "ROYGBV" == [0..5]1Drawing definition, as written by Wyschnegradsky. KmapM_ (\(c,r) -> putStrLn (unlines ["C: " ++ c,"R: " ++ r])) u3_vec_text_iwbRe-written for local parser and to correct ambiguities and errors (to align with actual drawing). Glet f = parse_vec Nothing 0 in map (\(p,q) -> (f p,f q)) u3_vec_text_rw nlet f (c,r) = putStrLn (unlines ["C: " ++ c,"R: " ++ r]) in mapM_ f (interleave u3_vec_text_iw u3_vec_text_rw) Parse of . Ylet {(c,r) = u3_vec_ix ; c' = map length c} in (length c,c',sum c',length r,map length r)Radial indices (ie. each ray as an index sequence). 4putStrLn $ unlines $ map (map u3_ix_ch) u3_ix_radialColour names in index sequence..Colour values (hex strings) in index sequence. RGB form of .8Notated radial color sequence, transcribed from drawing. Fmap (\(n,c) -> let v = u3_ch_seq_to_vec c in (n,sum v,v)) u3_radial_chBNotated circumferenctial color sequence, transcribed from drawing. 1map (\(n,c) -> (n,u3_ch_seq_to_vec c)) u3_circ_ch;Translate notated sequence to "re-written" vector notation.#Circumference pitch classes, C = 0. Ylet c' = map length dc9_circ in (sum c',c') == (72,[5,6,7,2,3,4,4,3,2,7,7,4,4,3,2,2,3,4]) iw_pc_pp " | " dc9_circRayon pitch classes, C = 0. 7length dc9_rad == 18 putStrLn $ unwords $ map f dc9_radRadial indices. $map length dc9_ix == replicate 72 18!Approximate colours, hex strings.RGB form of colours.%%%##SafeA Sieve.  Primitive  of modulo and index of two s of two s of a  Synonym for yThe  of a list of s, ie. I .The  of a list of s, ie. I .Unicode synonym for .Unicode synonym for . Synonym for .)Pretty-print sieve. Fully parenthesised. Variant of , ie. z . l 15 19 == L (15,19)unicode synonym for .In a normal  m is { i. Cnormalise (L (15,19)) == L (15,4) normalise (L (11,13)) == L (11,2)Predicate to test if a  is normal. ;is_normal (L (15,4)) == True is_normal (L (11,13)) == FalsePredicate to determine if an  is an element of the . xmap (element (L (3,1))) [1..4] == [True,False,False,True] map (element (L (15,4))) [4,19 .. 49] == [True,True,True,True]$Construct the sequence defined by a `. 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))) == r Variant of  that gives the first n places of the  of . 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) == rAgon et. al. p.155 let {a = c (13"3 "* 13"5 "* 13"7 "* 13"9) ;b = 11"2 ;c' = c (11"4 "* 11"8) ;d = 13"9 ;e = 13"0 "* 13"1 "* 13"6 ;f = (a ") b) "* (c' ") d) "* e} in buildn 13 f == [0,1,2,6,9,13,14,19,22,24,26,27,32] Ndifferentiate [0,1,2,6,9,13,14,19,22,24,26,27,32] == [1,1,4,3,4,1,5,3,2,2,1,5] import Music.Theory.Pitch let {n = [0,1,2,6,9,13,14,19,22,24,26,27,32] ;r = "C C2 C&o D&o E2 F0 G A2 B C C&o C0 E"} in unwords (map (pitch_class_pp . pc24et_to_pitch . (`mod` 24)) n) == r Jonchaies Mlet s = map (17") [0,1,4,5,7,11,12,16] in differentiate (buildn 25 (union s))Nekua let s = [24"0,14"2,22"3,31"4,28"7,29"9,19"10,25"13,24"14,26"17,23"21 ,24"10,30"9,35"17,29"24,32"25,30"29,26"21,30"17,31"16] in differentiate (buildn 24 (union s)) Major scale: hlet s = (c(3"2) ") 4"0) "* (c(3"1) ") 4"1) "* (3"2 ") 4"2) "* (c(3"0) ") 4"3) in buildn 7 s == [0,2,4,5,7,9,11] Nomos Alpha:let {s = (c (13"3 "* 13"5 "* 13"7 "* 13"9) ") 11"2) "* (c (11"4 "* 11"8) ") 13"9) "* (13"0 "* 13"1 "* 13"6) ;r = [0,1,2,6,9,13,14,19,22,24,26,27,32,35,39,40,45,52,53,58,61,65,66,71,78,79,84,87,90,91,92,97]} in buildn 32 s == rPsappha (Flint): ulet {s = union [(8"0"*8"1"*8"7)")(5"1"*5"3) ,(8"0"*8"1"*8"2)")5"0 ,8"3")(5"0"*5"1"*5"2"*5"3"*5"4) ,8"4")(5"0"*5"1"*5"2"*5"3"*5"4) ,(8"5"*8"6)")(5"2"*5"3"*5"4) ,8"1")5"2 ,8"6")5"1] ;r = [0,1,3,4,6,8,10,11,12 ,13,14,16,17,19,20,22,23,25 ,27,28,29,31,33,35,36,37,38]} in buildn 27 s == r. R. (Hommage Maurice Ravel) (Squibbs, 1996) Glet {s = union [8"0")(11"0"*11"4"*11"5"*11"6"*11"10) ,8"1")(11"2"*11"3"*11"6"*11"7"*11"9) ,8"2")(11"0"*11"1"*11"2"*11"3"*11"5"*11"10) ,8"3")(11"1"*11"2"*11"3"*11"4"*11"10) ,8"4")(11"0"*11"4"*11"8) ,8"5")(11"0"*11"2"*11"3"*11"7"*11"9"*11"10) ,8"6")(11"1"*11"3"*11"5"*11"7"*11"8"*11"9) ,8"7")(11"1"*11"3"*11"6"*11"7"*11"8"*11"10)] ;r = [0,2,3,4,7,9,10,13,14,16 ,17,21,23,25,29,30,32,34,35,38 ,39,43,44,47,48,52,53,57,58,59 ,62,63,66,67,69,72,73,77,78,82 ,86,87]} in buildn 42 s == r"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]=Euclid's algorithm for computing the greatest common divisor. euclid 1989 867 == 51Bachet De Mziriac's algorithm. )de_meziriac 15 4 == 3 && euclid 15 4 == 1Attempt to reduce the  of two  nodes to a singular  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) Reduce the number of nodes at a . 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) putStrLn $ sieve_pp (reduce s) 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)345$SafeThe modulo function for Z.Is n in (0,m-1).The underlying type i is presumed to be signed... z_sub mod12 0 8 == 4 Zimport Data.Word z_sub mod12 (0::Word8) 8 == 8 ((0 - 8) :: Word8) == 248 248 `mod` 12 == 8Allowing unsigned i is rather inefficient... z_sub :: Integral i => Z i -> i -> i -> i z_sub z p q = if p > q then z (p - q) else let m = z_modulus z in z (p + m - q) Modulus of z. z_modulus mod12 == 12 Universe of . z_univ mod12 == [0..11]Z of  not in given set. Vz_complement mod5 [0,2,3] == [1,4] z_complement mod12 [0,2,4,5,7,9,11] == [1,3,6,8,10]""""%Safe&Twelve-tone operator, of the form TMI. Pretty printer. &Parser, transposition must be decimal. 3map (tto_pp . tto_parse) (words "T5 T3I T11M T9MI")The set of all , given  function. =length (z_tto_univ mod12) == 48 map tto_pp (z_tto_univ mod12)-M is ordinarily 5, but can be specified here. ?map (z_tto_f 5 mod12 (tto_parse "T1M")) [0,1,2,3] == [1,6,11,4]r of  . =z_tto_apply 5 mod12 (tto_parse "T1M") [0,1,2,3] == [1,4,6,11]Find  that that map x to y given m and z. Emap tto_pp (z_tto_rel 5 mod12 [0,1,2,3] [6,4,1,11]) == ["T1M","T4MI"]_ of r of  z. ?map (z_pcset mod12) [[0,6],[6,12],[12,18]] == replicate 3 [0,6]                     &Safe !Diatonic pitch class (Z7) set to chord. Nmap dpcset_to_chord [[0,1],[0,2,4],[2,3,4,5,6]] == [[1,6],[2,2,3],[1,1,1,1,3]] Inverse of . 6map chord_to_dpcset [[1,6],[2,2,3]] == [[0,1],[0,2,4]]Complement, ie. in relation to &. @map dpcset_complement [[0,1],[0,2,4]] == [[2,3,4,5,6],[1,3,5,6]]Interval class predicate (ie. $).Interval to interval class. 'map i_to_ic [0..7] == [0,1,2,3,3,2,1,0]Is chord , ie. is  7. is_chord [2,2,3]Interval vector. iv [2,2,3] == [0,2,1]Comparison function for inv.Interval normal form. >map inf [[2,2,3],[1,2,4],[2,1,4]] == [[2,2,3],[1,2,4],[2,1,4]] Inverse of chord (retrograde). Olet p = [1,2,4] in (inf p,invert p,inf (invert p)) == ([1,2,4],[4,2,1],[2,1,4])!Complement of chord. let r = [[1,1,1,1,3],[1,1,1,2,2],[1,1,2,1,2],[1,1,1,4],[2,1,1,3],[1,2,1,3],[1,2,2,2]] in map complement [[1,6],[2,5],[3,4],[1,1,5],[1,2,4],[1,3,3],[2,2,3]] == r"/Z7 pitch sequence to Z7 interval sequence, ie. ( of . lmap iseq (permutations [0,1,2]) == [[1,1],[6,2],[6,6],[1,5],[5,1],[2,6]] map iseq (permutations [0,1,3]) == [[1,2],[6,3],[5,6],[2,4],[4,1],[3,5]] map iseq (permutations [0,2,3]) == [[2,1],[5,3],[6,5],[1,4],[4,2],[3,6]] map iseq (permutations [0,1,4]) == [[1,3],[6,4],[4,6],[3,3],[3,1],[4,4]] map iseq (permutations [0,2,4]) == [[2,2],[5,4],[5,5],[2,3],[3,2],[4,5]] !"#$%&'( !"#$%&'( !"#$%&'( !"#$%&'('Safe)"Serial operator,of the form rRTMI.0 Printer in rnRTnMI form.21Parse a Morris format serial operator descriptor. -sro_parse "r2RT3MI" == SRO 2 True 3 True True3#The total set of serial operations. [let u = z_sro_univ 3 mod12 zip (map sro_pp u) (map (\o -> z_sro_apply 5 mod12 o [0,1,3]) u)4The set of transposition )s.5'The set of transposition and inversion )s.66The set of retrograde and transposition and inversion )s.7The set of transposition, M5 and inversion )s.8$The set of retrograde,transposition,M5 and inversion )s.99Apply SRO. M is ordinarily 5, but can be specified here. z_sro_apply 5 mod12 (SRO 1 True 1 True False) [0,1,2,3] == [11,6,1,4] z_sro_apply 5 mod12 (SRO 1 False 4 True True) [0,1,2,3] == [11,6,1,4]: Transpose p by n. Gz_sro_tn mod5 4 [0,1,4] == [4,0,3] z_sro_tn mod12 4 [1,5,6] == [5,9,10];Invert p about n. wz_sro_invert mod5 0 [0,1,4] == [0,4,1] z_sro_invert mod12 6 [4,5,6] == [8,7,6] z_sro_invert mod12 0 [0,1,3] == [0,11,9] Aimport Data.Word {- base -} z_sro_invert mod12 (0::Word8) [1,4,8]<Composition of invert about 0 and tn. z_sro_tni mod5 1 [0,1,3] == [1,0,3] z_sro_tni mod12 4 [1,5,6] == [3,11,10] (z_sro_invert mod12 0 . z_sro_tn mod12 4) [1,5,6] == [7,3,2]=Modulo multiplication. 6z_sro_mn mod12 11 [0,1,4,9] == z_tni mod12 0 [0,1,4,9]>T-related sequences of p. llength (z_sro_t_related mod12 [0,3,6,9]) == 12 z_sro_t_related mod5 [0,2] == [[0,2],[1,3],[2,4],[3,0],[4,1]]?T/I-related sequences of p. length (z_sro_ti_related mod12 [0,1,3]) == 24 length (z_sro_ti_related mod12 [0,3,6,9]) == 24 z_sro_ti_related mod12 [0] == map return [0..11]@R/T/I-related sequences of p. _length (z_sro_rti_related mod12 [0,1,3]) == 48 length (z_sro_rti_related mod12 [0,3,6,9]) == 24A Variant of tn , transpose p so first element is n. Zz_sro_tn_to mod12 5 [0,1,3] == [5,6,8] map (z_sro_tn_to mod12 0) [[0,1,3],[1,3,0],[3,0,1]]B Variant of invert, inverse about n th element. map (z_sro_invert_ix mod12 0) [[0,1,3],[3,4,6]] == [[0,11,9],[3,2,0]] map (z_sro_invert_ix mod12 1) [[0,1,3],[3,4,6]] == [[2,1,11],[5,4,2]]CThe standard t-matrix of p. 6z_tmatrix mod12 [0,1,3] == [[0,1,3],[11,0,2],[9,10,0]])*+,-./0123456789:;<=>?@ABC)*+,-./0123456789:;<=>?@ABC)*+,-./0123456789:;<=>?@ABC)*+,-./0123456789:;<=>?@ABC(SafeFRelate sets (TnMI).$ pct rs 0123 641BT1M >map tto_pp (rs 5 mod12 [0,1,2,3] [6,4,1,11]) == ["T1M","T4MI"]GRelate segments.$ pct rsg 156 3BAT4I$ pct rsg 0123 05A3T0M$ pct rsg 0123 4B61RT1M$ pct rsg 0123 B614r3RT1M let sros = map sro_parse . words rsg 5 mod12 [1,5,6] [3,11,10] == sros "T4I r1RT4MI" rsg 5 mod12 [0,1,2,3] [0,5,10,3] == sros "T0M RT3MI" rsg 5 mod12 [0,1,2,3] [4,11,6,1] == sros "T4MI RT1M" rsg 5 mod12 [0,1,2,3] [11,6,1,4] == sros "r1T4MI r1RT1M"FGFGFGFG)SafeH Bit array.ICoding.JPretty printer for H.K Parse PP of H. 4parse_array "01001" == [False,True,False,False,True]L Generate I from H*, 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]) == 6428M Inverse of L. ?code_to_array 13 6428 == map toEnum [1,1,0,0,1,0,0,0,1,1,1,0,0]N Array to set. earray_to_set (map toEnum [1,1,0,0,1,0,0,0,1,1,1,0,0]) == [0,1,4,8,9,10] encode [0,1,4,8,9,10] == 1811O Inverse of N, z is the degree of the array.PL of O. ^set_to_code 12 [0,2,3,5] == 2880 map (set_to_code 12) (T.z_ti_related (flip mod 12) [0,2,3,5])QLogical complement.RThe prime form is the i encoding. 3array_is_prime (set_to_array 12 [0,2,3,5]) == FalseSThe augmentation rule adds 1$ in each empty slot at end of array. Omap array_pp (array_augment (parse_array "01000")) == ["01100","01010","01001"]T4Enumerate 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))U Encoder for W. encode [0,1,3,6,8,9] == 843V Decoder for W. decode 12 843 == [0,1,3,6,8,9]W;Binary encoding prime form algorithm, equalivalent to Rahn. xencode_prime Z.mod12 [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]HIJKLMNOPQRSTUVWHIJKLMNOPQRSTUVWIHJKLMNOPQRSTUVWHIJKLMNOPQRSTUVW*Safe, XY 12. umap negate [0::Z12 .. 0xB] == [0,0xB,0xA,9,8,7,6,5,4,3,2,1] map (+ 5) [0::Z12 .. 11] == [5,6,7,8,9,0xA,0xB,0,1,2,3,4]YMod |.ZCyclic form of }. E[9::Z12,11 .. 3] == [] enumFromThenTo_cyc (9::Z12) 11 3 == [9,11,1,3][Cyclic form of p. B[9::Z12 .. 3] == [] enumFromTo_cyc (9::Z12) 3 == [9,10,11,0,1,2,3]\Convert integral to X. $map to_Z12 [-9,-3,0,13] == [3,9,0,1]^Convert X to integral.`Z12 not in set. +complement [0,2,4,5,7,9,11] == [1,3,6,8,10]a$Z12 to character (10 -> A, 11 -> B). +map z12_to_char [0 .. 11] == "0123456789AB"b$Z12 to character (10 -> A, 11 -> B). )map char_to_z12 "0123456789AB" == [0..11]c Unordered set notation (braces). z12_set_pp [0,1,3] == "{013}"d+Ordered sequence notation (angle brackets). z12_seq_pp [0,1,3] == "<013>"e*Ordered vector notation (square brackets). z12_vec_pp [0,1,3] == "[013]"XYZ[\]^_`abcdeXYZ[\]^_`abcdeYXZ[\]^_`abcdeXYZ[\]^_`abcde+SafefParse 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"ffff,Safeh Encoder for j. encode [0,1,3,6,8,9] == 843i Decoder for j. decode 843 == [0,1,3,6,8,9]j;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]ghijghijghijghij-Safek%Map to pitch-class and reduce to set. pcset [1,13] == [1]lTranspose by n. 8tto_tn 4 [1,5,6] == [5,9,10] tto_tn 4 [0,4,8] == [0,4,8]mInvert about n. @tto_invert 6 [4,5,6] == [6,7,8] tto_invert 0 [0,1,3] == [0,9,11]nComposition of invert about 0 and tn. Ktto_tni 4 [1,5,6] == [3,10,11] (tto_invert 0 . tto_tn 4) [1,5,6] == [2,3,7]oModulo 12 multiplication -tto_mn 11 [0,1,4,9] == tto_invert 0 [0,1,4,9]pM5, ie. mn 5. tto_m5 [0,1,3] == [0,3,5]qT-related sets of p. alength (tto_t_related [0,1,3]) == 12 tto_t_related [0,3,6,9] == [[0,3,6,9],[1,4,7,10],[2,5,8,11]]rT/I-related set of p. clength (tto_ti_related [0,1,3]) == 24 tto_ti_related [0,3,6,9] == [[0,3,6,9],[1,4,7,10],[2,5,8,11]]klmnopqrklmnopqrklmnopqrklmnopqr.SafesINT operator. int [0,1,3,6,10] == [1,2,3,4]ssss/Safet Transpose p by n. sro_tn 4 [1,5,6] == [5,9,10]uInvert p about n. @sro_invert 6 [4,5,6] == [8,7,6] sro_invert 0 [0,1,3] == [0,11,9]vComposition of invert about 0 and tn. Htni 4 [1,5,6] == [3,11,10] (sro_invert 0 . sro_tn 4) [1,5,6] == [7,3,2]wModulo 12 multiplication *sro_mn 11 [0,1,4,9] == sro_tni 0 [0,1,4,9]xM5, ie. mn 5. sro_m5 [0,1,3] == [0,5,3]yT-related sequences of p. &length (sro_t_related [0,3,6,9]) == 12zT/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]) == 24|T/M/I-related sequences of p, duplicates removed.}R/T/M/I-related sequences of p, duplicates removed.~r/R/T/M/I-related sequences of p, duplicates removed. Variant of tn , transpose p so first element is n. isro_tn_to 5 [0,1,3] == [5,6,8] map (sro_tn_to 0) [[0,1,3],[1,3,0],[3,0,1]] == [[0,1,3],[0,2,11],[0,9,10]] Variant of invert, inverse about n th element. {map (sro_invert_ix 0) [[0,1,3],[3,4,6]] == [[0,11,9],[3,2,0]] map (sro_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]]tuvwxyz{|}~tuvwxyz{|}~tuvwxyz{|}~tuvwxyz{|}~0Safe$Common music notation interval. An 2 of k# indicates an ascending interval, l a descending interval, and ` a unison.Interval quality.Interval type or degree.Interval type between Note_T 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 . interval_semitones (interval (Pitch C Sharp 4) (Pitch E Sharp 5)) == 16 interval_semitones (interval (Pitch C Natural 4) (Pitch D Sharp 3)) == -9 Determine  between two Pitches. 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  of . 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 Pitch by an . Ntranspose (Interval Third Diminished LT 0) (Pitch C Sharp 4) == Pitch E Flat 4QMake leftwards (perfect fourth) and and rightwards (perfect fifth) circles from Pitch. 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]q variant.)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'''1Safe2SafeBSimplest 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 13Safe!A common music notation key is a Note_T,  Alteration_T,  triple.+Enumeration of common music notation modes.Pretty printer for . Lower-cased .0There are two modes, given one return the other. of .Enumeration of 42 CMN keys. #length key_sequence_42 == 7 * 3 * 2 Subset of  key_sequenceN not including very eccentric keys (where there are more than 7 alterations). length key_sequence_30 == 30Parallel key, ie.  of .Transposition of .Relative key (ie. 1 with the same number of and type of alterations. ulet k = [(T.C,T.Natural,Major_Mode),(T.E,T.Natural,Minor_Mode)] in map (key_lc_uc_pp . key_relative) k == ["a&n","G&n"]Mediant minor of major key. Ikey_mediant (T.C,T.Natural,Major_Mode) == Just (T.E,T.Natural,Minor_Mode)Pretty-printer where X is written in lower case (lc) and alteration symbol is shown using indicated function. with unicode (uc) alteration. Jmap key_lc_uc_pp [(C,Sharp,Minor_Mode),(E,Flat,Major_Mode)] == ["c&o","E&m"] with ISO alteration. with tonh alteration. Emap key_lc_tonh_pp [(T.C,T.Sharp,Minor_Mode),(T.E,T.Flat,Major_Mode)]Parse  from lc-uc string. import Data.Maybe mlet k = mapMaybe key_lc_uc_parse ["c","E","f&o","ab","G#"] in map key_lc_uc_pp k == ["c&n","E&n","f&o","a&m","G&o"]2Distance along circle of fifths path of indicated ]. A positive number indicates the number of sharps, a negative number the number of flats. key_fifths (T.A,T.Natural,Minor_Mode) == Just 0 key_fifths (T.A,T.Natural,Major_Mode) == Just 3 key_fifths (T.C,T.Natural,Minor_Mode) == Just (-3) key_fifths (T.B,T.Sharp,Minor_Mode) == Just 9 key_fifths (T.E,T.Sharp,Major_Mode) == Just 11 key_fifths (T.B,T.Sharp,Major_Mode) == Nothing Hzip (map key_lc_iso_pp key_sequence_42) (map key_fifths key_sequence_42)Table mapping  to  value.Lookup  value in . }let a = [0,1,-1,2,-2,3,-3,4,-4,5,-5] let f md = map key_lc_iso_pp . mapMaybe (fifths_to_key md) f Minor_Mode a f Major_Mode aFGiven sorted pitch-class set, find simplest implied key in given mode. mapMaybe (implied_key Major_Mode) [[0,2,4],[1,3],[4,10],[3,9],[8,9]] map (implied_key Major_Mode) [[0,1,2],[0,1,3,4]] == [Nothing,Nothing] of .4SafeD = dominant, M = majorcNames and pc-sets for chord types. The name used here is in the first position, alternates follow.'''5Safe        6Safe        7Safe    8Safe~ of .;Read (strictly) a UTF-8 encoded text file, implemented via  Data.Text./, or a default value if the file doesn't exist.Write UTF8 string as file, via  Data.Text. variant using Text for  ISO 8859-1 (Latin 1) encoding. variant using Text for local encoding.9Safe%Unicode non breaking hypen character. non_breaking_hypen == ' '%Unicode non breaking space character. non_breaking_space == ''UNICODE accidental symbols. >let r = "&m&n&o*+,-./0123" in map (toEnum . fst) accidentals == r UNICODE note duration symbols. 4let r = "\]^_`abcd" in map (toEnum . fst) notes == r"UNICODE rest symbols. 3let r = ";<=>?@AB" in map (toEnum . fst) rests == r%UNICODE clef symbols. 4let r = " !"#$%&" in map (toEnum . fst) clefs == r'UNICODE notehead symbols. Hlet r = "CDEFGHIJKLMNOPQRSTUVWXYZ[" in map (toEnum . fst) noteheads == r. 3http://unicode.org/Public/8.0.0/ucd/UnicodeData.txt ~let fn = "/home/rohan/data/unicode.org/Public/8.0.0/ucd/UnicodeData.txt" tbl <- unicode_data_table_read fn length tbl == 29215 !"#$%&'()*+,-./01 !"#$%&'()*+,-./01 !"#$%&'()*+,-./01 !"#$%&'()*+,-./01:Safe2 Synonym for .3T-related rotations of p. 8t_rotations mod12 [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]]4T/I-related rotations of p. rti_rotations mod12 [0,1,3] == [[0,1,3],[0,2,11],[0,9,10] ,[0,9,11],[0,2,3],[0,1,10]]55Variant with default value for empty input list case.62Prime form rule requiring comparator, considering 3.72Prime form rule requiring comparator, considering 4.8CForte comparison function (rightmost first then leftmost outwards). +forte_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == LT9Forte prime form, ie.  cmp_prime of 8. Tforte_prime mod12 [0,1,3,6,8,9] == [0,1,3,6,8,9] forte_prime mod5 [0,1,4] == [0,1,2] eS.set (map (forte_prime mod5) (S.powerset [0..4])) S.set (map (forte_prime mod7) (S.powerset [0..6])):,Transpositional equivalence prime form, ie. 6 of 8. F(forte_prime mod12 [0,2,3],t_prime mod12 [0,2,3]) == ([0,1,3],[0,2,3]);Interval class of interval i. map (ic 12) [0..11] == [0,1,2,3,4,5,6,5,4,3,2,1] map (ic 7) [0..6] == [0,1,2,3,3,2,1] map (ic 5) [1,2,3,4] == [1,2,2,1] map (ic 12) [5,6,7] == [5,6,5] map (ic 12 . to_Z mod12) [-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]>=Generate SC universe, though not in order of the Forte table. let r = [[] ,[0] ,[0,1],[0,2],[0,3] ,[0,1,2],[0,1,3],[0,1,4],[0,2,4] ,[0,1,2,3],[0,1,2,4],[0,1,3,4],[0,1,3,5] ,[0,1,2,3,4],[0,1,2,3,5],[0,1,2,4,5] ,[0,1,2,3,4,5] ,[0,1,2,3,4,5,6]] in sc_univ mod7 == r /sort (sc_univ mod12) == sort (map snd sc_table) AzipWith (\p q -> (p == q,p,q)) (sc_univ mod12) (map snd sc_table)?(The set-class table (Forte prime forms). length sc_table == 224@&Unicode (non-breaking hyphen) variant.AdLookup name of prime form of set class. It is an error for the input not to be a forte prime form. 1forte_prime_name [0,1,4,6] == ("4-Z15",[0,1,4,6])E7Lookup a set-class name. The input set is subject to 9 before lookup. Ksc_name mod12 [0,2,3,6,7] == "5-Z18" sc_name mod12 [0,1,4,6,7,8] == "6-Z17"F/Long name (ie. with enumeration of prime form). 3sc_name_long mod12 [0,1,4,6,7,8] == "6-Z17[012478]"G&Unicode (non-breaking hyphen) variant.H*Lookup a set-class given a set-class name. sc "6-Z17" == [0,1,2,4,7,8]J Cardinality n subset of I. >map (length . scs_n) [1..11] == [1,6,12,29,38,50,38,29,12,6,1]KNVector indicating degree of intersection with inversion at each transposition. 5tics mod12 [0,2,4,5,7,9] == [3,2,5,0,5,2,3,4,1,6,1,4]LLocate Z relation of set class. Dfmap (sc_name mod12) (z_relation_of 12 (sc "7-Z12")) == Just "7-Z36"23456789:;<=>?@ABCDEFGHIJKL23456789:;<=>?@ABCDEFGHIJKL3456789:;<=>2?@ABCDEFGHIJKL23456789:;<=>?@ABCDEFGHIJKL;SafeNIs p symmetrical under inversion. zmap inv_sym (T.scs_n 2) == [True,True,True,True,True,True] map (fromEnum.inv_sym) (T.scs_n 3) == [1,0,0,0,0,1,0,0,1,1,0,1]OIf p is not N then (p,invert 0 p) else +. Dsc_t_ti [0,2,4] == Nothing sc_t_ti [0,1,3] == Just ([0,1,3],[0,2,3])P/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. a(length T.sc_table,length t_sc_table) == (224,352) lookup "5-Z18B" t_sc_table == Just [0,2,3,6,7]Q7Lookup 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"R*Lookup a set-class given a set-class name. t_sc "6-Z17A" == [0,1,2,4,7,8]SList of set classes.T Cardinality n subset of S. <map (length . t_scs_n) [2..10] == [6,19,43,66,80,66,43,19,6]U 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]]V 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]]WTrivial run length encoder. <rle "abbcccdde" == [(1,'a'),(2,'b'),(3,'c'),(2,'d'),(1,'e')]X Inverse of W. +rle_decode [(5,'a'),(4,'b')] == "aaaaabbbb"Y Length of rle encoded sequence. !rle_length [(5,'a'),(4,'b')] == 9ZT-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] == 60MNOPQRSTUVWXYZ[\]MNOPQRSTUVWXYZ[\]MNOPQRSTUVWXYZ[\]MNOPQRSTUVWXYZ[\]<Safe_REL function with given ncv function (see ` and a).`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.31aT/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.707^_`a^_`a^_`a^_`a=SafecT-related rotations of p. 2t_rotations [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]]dT/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]]eForte prime form, ie.  cmp_prime of  forte_cmp. Qforte_prime [0,1,3,6,8,9] == [0,1,3,6,8,9] forte_prime [0,2,3,6,7] == [0,1,4,5,7]f,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])g(The set-class table (Forte prime forms). length sc_table == 224h7Lookup a set-class name. The input set is subject to e before lookup. ?sc_name [0,2,3,6,7] == "5-Z18" sc_name [0,1,4,6,7,8] == "6-Z17"j*Lookup a set-class given a set-class name. sc "6-Z17" == [0,1,2,4,7,8]k-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 == rl Cardinality n subset of k. >map (length . scs_n) [1..11] == [1,6,12,29,38,50,38,29,12,6,1]mGBasic interval pattern, see Allen Forte "The Basic Interval Patterns" JMT 17/2 (1973):234-272pct bip 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]nInterval 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]o)Forte notation for interval class vector. "icv [0,1,2,4,7,8] == [3,2,2,3,3,2]pType specialise...qLocate Z relation of set class. 9fmap sc_name (z_relation_of (sc "7-Z12")) == Just "7-Z36"bcdefghijklmnopqbcdefghijklmnopqcdefbghijklmnopqbcdefghijklmnopq>Safew$Predicate for list with cardinality n.xSet classes of cardinality n. 5sc_table_n 2 == [[0,1],[0,2],[0,3],[0,4],[0,5],[0,6]]y/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])zPretty printer for t. map r_pp [MIN,MAX] == ["+","-"]{r$ 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 r.~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>"r 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>)"r reorganised by t. 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 r. \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)rstuvwxyz{|}~rstuvwxyz{|}~wxytuvsz{|r}~rstuvwxyz{|}~?SafeSIM ~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/5@Safe+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]] let n = "01" in cgg [n,n,n] == ["000","001","010","011","100","101","110","111"](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.pct cg -r3 0159015019059159 5cg_r 3 [0,1,5,9] == [[0,1,5],[0,1,9],[0,5,9],[1,5,9]] Chain pcsegs.$echo 024579 | pct chn T0 3 | sort -u 579468 (RT8M) 579A02 (T5) 8chn_t0 3 [0,2,4,5,7,9] == [[5,7,9,10,0,2],[5,7,9,4,6,8]]echo 02457t | pct chn T0 2 7A0135 (RT5I)7A81B9 (RT9MI) ;chn_t0 2 [0,2,4,5,7,10] == [[7,10,0,1,3,5],[7,10,8,1,11,9]]Cyclic interval segment.echo 014295e38t76 | pct cisg 13A7864529B6 @ciseg [0,1,4,2,9,5,11,3,8,10,7,6] == [1,3,10,7,8,6,4,5,2,9,11,6] Synonynm for  complement.pct cmpl 02468t13579B %cmpl [0,2,4,6,8,10] == [1,3,5,7,9,11] Form cycle.echo 056 | pct cyc0560 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. pct dim 016T1dT1mT0o +dim_nm [0,1,6] == [(1,'d'),(1,'m'),(0,'o')]&Diatonic interval set to interval set. pct dis 241256 dis [2,4] == [1,2,5,6]Degree of intersection."echo 024579e | pct 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 | pct 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. Z12 cycles.Fragmentation of cycles.Pretty printer for . xlet r = "IC cycle vector: <1> <22> <111> <1100> <5> <000000>" in ic_cycle_vector_pp (ic_cycle_vector [0,2,4,5,7,9]) == rFragmentation of cycles.pct frg 024579,Fragmentation of 1-cycle(s): [0-2-45-7-9--]/Fragmentation of 2-cycle(s): [024---] [--579-]2Fragmentation of 3-cycle(s): [0--9] [-47-] [25--]5Fragmentation of 4-cycle(s): [04-] [-59] [2--] [-7-],Fragmentation of 5-cycle(s): [05------4927];Fragmentation of 6-cycle(s): [0-] [-7] [2-] [-9] [4-] [5-]3IC cycle vector: <1> <22> <111> <1100> <5> <000000> putStrLn $ frg_pp [0,2,4,5,7,9]Embedded segment search.echo 23A | pct ess 01643252B013A9923507A Dess [0,1,6,4,3,2,5] [2,3,10] == [[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. Plet d = [0,2,4,5,7,9,11] in has_sc d (complement d) == True has_sc [] [] == TrueInterval cycle filter.echo 22341 | pct icf22341 "icf [[2,2,3,4,1]] == [[2,2,3,4,1]]$Interval class set to interval sets.pct 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.pct 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. tlet r = [[[0,2,4],[2,4,5],[4,5,7],[5,7,9]] ,[[0,2,4,5],[2,4,5,7],[4,5,7,9]]] in imb [3,4] [0,2,4,5,7,9] == r* gives the set-classes that can append to p to give q.pct 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.pct 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.pct 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).pct pi 0236 12 pcseg 0236 pcseg 6320 pcseg 532B pcseg B235 Bpci [1,2] [0,2,3,6] == [[0,2,3,6],[5,3,2,11],[6,3,2,0],[11,2,3,5]]Relate sets (TnMI).pct rs 0123 641eT1M wrs [0,1,2,3] [6,4,1,11] == [(Z.tto_parse "T1M",[1,6,11,4]) ,(Z.tto_parse "T4MI",[4,11,6,1])]Relate segments.pct rsg 156 3BAT4I Brsg [1,5,6] [3,11,10] == [Z.sro_parse "T4I",Z.sro_parse "r1RT4MI"]pct rsg 0123 05t3T0M Crsg [0,1,2,3] [0,5,10,3] == [Z.sro_parse "T0M",Z.sro_parse "RT3MI"]pct rsg 0123 4e61RT1M Crsg [0,1,2,3] [4,11,6,1] == [Z.sro_parse "T4MI",Z.sro_parse "RT1M"]echo e614 | pct rsg 0123r3RT1M Grsg [0,1,2,3] [11,6,1,4] == [Z.sro_parse "r1T4MI",Z.sro_parse "r1RT1M"]Subsets.scc = set class completionpct scc 6-32 16835A49B3AB34B Escc (Z12.sc "6-32") [1,6,8] == [[3,5,10],[4,9,11],[3,10,11],[3,4,11]]Set information.  putStr $ unlines $ si [0,5,3,11]Super set-class.pct spsc 4-11 4-12 5-26[02458] 3spsc [Z12.sc "4-11",Z12.sc "4-12"] == [[0,2,4,5,8]]pct spsc 3-11 3-8 4-27[0258] 4-Z29[0137] :spsc [Z12.sc "3-11",Z12.sc "3-8"] == [[0,2,5,8],[0,1,3,7]]pct spsc `pct fl 3` 6-Z17[012478] (spsc (cf [3] Z12.scs) == [[0,1,2,4,7,8]]!sra = stravinsky rotational arrayecho 019BA7 | pct sra019BA708A96B021A340B812A0923B1056243 let r = [[0,1,9,11,10,7],[0,8,10,9,6,11],[0,2,1,10,3,4] ,[0,11,8,1,2,10],[0,9,2,3,11,1],[0,5,6,2,4,3]] in sra [0,1,9,11,10,7] == rSerial operation.echo 156 | pct sro T459A *sro (Z.sro_parse "T4") [1,5,6] == [5,9,10]echo 024579 | pct sro RT4I79B024 ?sro (Z.SRO 0 True 4 False True) [0,2,4,5,7,9] == [7,9,11,0,2,4]echo 156 | pct sro T4I3BA bsro (Z.sro_parse "T4I") [1,5,6] == [3,11,10] sro (Z.SRO 0 False 4 False True) [1,5,6] == [3,11,10]$echo 156 | pct sro T4 | pct sro T0I732 E(sro (Z.sro_parse "T0I") . sro (Z.sro_parse "T4")) [1,5,6] == [7,3,2]echo 024579 | pct sro RT4I79B024 8sro (Z.sro_parse "RT4I") [0,2,4,5,7,9] == [7,9,11,0,2,4]NVector indicating degree of intersection with inversion at each transposition. @tics [0,2,4,5,7,9] == [3,2,5,0,5,2,3,4,1,6,1,4] map tics Z12.scstmatrixpct tmatrix 12581258 0147 9A14 67A1 @tmatrix [1,2,5,8] == [[1,2,5,8],[0,1,4,7],[9,10,1,4],[6,7,10,1]]3trs = transformations search. Search all RTnMI of p for q.#echo 642 | pct trs 024579 | sort -u5316426421B9642753B97642 llet r = [[5,3,1,6,4,2],[6,4,2,1,11,9],[6,4,2,7,5,3],[11,9,7,6,4,2]] in sort (trs [0,2,4,5,7,9] [6,4,2]) == r3333ASafe2Rahn 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 == TrueBNoneGraph as set of labeled edges.Edge, with label.Graph as set of edges.Edge, no label. Synonym for . of each of . Find first  with given label.Erroring variant.ZSet of nodes with given labels, plus all neighbours of these nodes. (impl = implications)   .Use sel_f of  for directed graphs and  for undirected./Generate a graph given a set of labelled edges.8Variant that supplies '()' as the (constant) edge label. mlet g = G.mkGraph [(0,'a'),(1,'b'),(2,'c')] [(0,1,()),(1,2,())] in g_from_edges_ul [('a','b'),('b','c')] == g(Label sequence of edges starting at one.5Normalised undirected labeled edge (ie. order nodes).2Collate labels for edges that are otherwise equal. of ..Apply predicate to universe of possible edges.&Consider only edges (p,q) where p < q.(Sequence of connected vertices to edges. 9e_path_to_edges "abcd" == [('a','b'),('b','c'),('c','d')]Undirected edge equality.`Is the sequence of vertices a path at the graph, ie. are all adjacencies in the sequence edges.CNoneVertex position function.$Graph type, directed or un-directed.;Graph pretty-printer, (node->shape,node->label,edge->label)!area:opt (area = graph|node|edge)Separate at element. sep1 ':' "graph:layout"Quote s if it includes white space. 6map maybe_quote ["abc","a b c"] == ["abc","\"a b c\""]'Left biased union of association lists p and q. Lassoc_union [(5,"a"),(3,"b")] [(5,"A"),(7,"C")] == [(5,"a"),(3,"b"),(7,"C")]&br = brace, csl = comma separated listDSafe  of . Jconst2 5 undefined undefined == 5 const (const 5) undefined undefined == 5 of predicates. of predicates. alet r = [False,False,True,False,True,False] in map (predicate_all [(> 0),(< 5),even]) [0..5] == r of predicates. of predicates, ie. logical or of list of predicates. alet r = [True,False,True,False,True,True] in map (predicate_any [(== 0),(== 5),even]) [0..5] == r4  4, ie. ((t -> c) -> (a -> b -> t) -> a -> b -> c.4  , ie. 2(t -> d) -> (a -> b -> c -> t) -> a -> b -> c -> d.4  .4  .4  .    88888ESafeNContainer to mark the begin and end of a value. Variant of  where nodes have an Intepolation_T value.)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 {.'Time-point sequence. To express holes a must have an empty6 value. To indicate the duration of the final value a must have a nil (end of sequence) value. /Pattern sequence. The duration is a triple of logical, sounding and forward durations. 5Inter-offset sequence. The duration is the interval before: the value. To indicate the duration of the final value a must have a 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)Start time of sequence. 0wseq_start [((1,2),'a')] == 1 wseq_start [] == 0End time of sequence. Gwseq_end [((1,2),'a')] == 3 wseq_end (useq_to_wseq 0 (1,"linear")) == 6The interval of . "tseq_dur (zip [0..] "abcde|") == 5The interval of . 2wseq_dur (zip (zip [0..] (repeat 2)) "abcde") == 6MPrefix of sequence where the start time precedes or is at the indicate time.Keep only elements that are entirely contained within the indicated temporal window, which is inclusive at the left & right edges, ie. [t0,t1]. Halts processing at end of window. ylet r = [((5,1),'e'),((6,1),'f'),((7,1),'g'),((8,1),'h')] in wseq_twindow (5,9) (zip (zip [1..] (repeat 1)) ['a'..]) == r =wseq_twindow (1,2) [((1,1),'a'),((1,2),'b')] == [((1,1),'a')]Select nodes that are active at indicated time, comparison is inclusive at left and exclusive at right. Halts processing at end of window. Rlet sq = [((1,1),'a'),((1,2),'b')] in map (wseq_at sq) [1,2] == [sq,[((1,2),'b')]] ?wseq_at (zip (zip [1..] (repeat 1)) ['a'..]) 3 == [((3,1),'c')]Select nodes that are active within the indicated window, comparison is inclusive at left and exclusive at right. Halts processing at end of window. Olet sq = [((0,2),'a'),((0,4),'b'),((2,4),'c')] in wseq_at_window sq (1,3) == sq Vwseq_at_window (zip (zip [1..] (repeat 1)) ['a'..]) (3,4) == [((3,1),'c'),((4,1),'d')] Merge comparing only on time.!,Merge, where times are equal compare values."#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_r#.Compare first by start time, then by duration.$#Merge considering only start times.%3Merge set considering both start times & durations.&5Locate nodes to the left and right of indicated time.+Linear interpolation., Temporal map.-This can give + if t precedes the  or if t is after the final element of 8 and that element has an interpolation type other than ..q ing variant.1Map t and e simultaneously.5 variant.6 Variant of .7$If value is unchanged, according to f, replace with +. ~let r = [(1,'s'),(2,'t'),(4,'r'),(6,'i'),(7,'n'),(9,'g')] in seq_cat_maybes (seq_changed_by (==) (zip [1..] "sttrrinng")) == r87 O.9Apply f at time points of .:Apply f at durations of elements of .;#Given a function that determines a voice0 for a value, partition a sequence into voices.<Type specialised ;. 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)]>TGiven 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]?> using  for the join function.@Form of >) 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")) == rBGiven equality@ predicate, simplify sequence by summing durations of adjacent equal' elements. This is a special case of A 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 == rG Post-process N of cmp P Q. \let r = [(0,"a"),(1,"bc"),(2,"de"),(3,"f")] in group_f (==) (zip [0,1,1,2,2,3] ['a'..]) == rH"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'..]) == r etseq_group [(1,'a'),(1,'b')] == [(1,"ab")] tseq_group [(1,'a'),(2,'b'),(2,'c')] == [(1,"a"),(2,"bc")]I,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'..]) == rJ4Set 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") == rL0Scale by lcm so that all durations are integral.MGiven a a default value, a  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"NSort  by start time, ! ought never to be out of order. @wseq_sort [((3,1),'a'),((1,3),'b')] == [((1,3),'b'),((3,1),'a')]O Transform  to  by discaring durations.Q2Determine if sequence has overlapping equal nodes.REdit durations to ensure that nodes don't overlap. If equal nodes begin simultaneously delete the shorter node. If a node extends into a later node shorten the initial duration (apply dur_fn to iot). let sq = [((0,1),'a'),((0,5),'a'),((1,5),'a'),((3,1),'a')] let r = [((0,1),'a'),((1,2),'a'),((3,1),'a')] wseq_has_overlaps (==) sq == True wseq_remove_overlaps (==) id sq == r wseq_has_overlaps (==) (wseq_remove_overlaps (==) id sq) == FalseS;Unjoin elements (assign equal time stamps to all elements).TType specialised.U Shift (displace) onset times by i. +wseq_shift 3 [((1,2),'a')] == [((4,2),'a')]VShift q to end of p and append. Dwseq_append [((1,2),'a')] [((1,2),'b')] == [((1,2),'a'),((4,2),'b')]WI of V Fwseq_concat [[((1,2),'a')],[((1,2),'b')]] == [((1,2),'a'),((4,2),'b')]XFunctor instance.YStructural comparison at ,  compares less than .ZTranslate container types.[Translate container types.]-Add or delete element from accumulated state.^Convert  to  transforming elements to . When merging, end elements precede begin elements at equal times. }let {sq = [((0,5),'a'),((2,2),'b')] ;r = [(0,Begin 'a'),(2,Begin 'b'),(4,End 'b'),(5,End 'a')]} in wseq_begin_end sq == r let {sq = [((0,1),'a'),((1,1),'b'),((2,1),'c')] ;r = [(0,Begin 'a'),(1,End 'a') ,(1,Begin 'b'),(2,End 'b') ,(2,Begin 'c'),(3,End 'c')]} in wseq_begin_end sq == r_[ of ^.`Variant that applies begin and end functions to nodes. let {sq = [((0,5),'a'),((2,2),'b')] ;r = [(0,'A'),(2,'B'),(4,'b'),(5,'a')]} in wseq_begin_end_f Data.Char.toUpper id sq == raResult for each time-point the triple (begin-list,end-list,hold-list). The elements of the end-list have been deleted from the hold list.cThe transition sequence of active elements. zlet w = [((0,3),'a'),((1,2),'b'),((2,1),'c'),((3,3),'d')] wseq_accumulate w == [(0,"a"),(1,"ba"),(2,"cba"),(3,"d"),(6,"")]d Inverse of ^. given a predicate function for locating the end node of a begin node. let {sq = [(0,Begin 'a'),(2,Begin 'b'),(4,End 'b'),(5,End 'a')] ;r = [((0,5),'a'),((2,2),'b')]} in tseq_begin_end_to_wseq (==) sq == rg+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)) == rhVariant where the nil7 value is taken from 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") == ri?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"jThe last element of  is required to be an eof< marker that has no duration and is not represented in the  . A nil value is required in case the  does not begin at 0. [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|") == rkThe last element of  is required to be an eof< marker that has no duration and is not represented in the G. 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|") == rmRequires 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") == rn Inverse of m. The empty! value is used to fill holes in . If values overlap at  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"oGiven a list of  ! (measures) convert to a list of + 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 Only finite / can be cycled, the resulting Wseq is infinite. -take 5 (wseq_cycle [((0,1),'a'),((3,3),'b')])rVariant cycling only n times. (wseq_cycle_n 3 [((0,1),'a'),((3,3),'b')]s of q.      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~FSafeGeneric variant of 0 (p.263).Generic variant of 1 (p.263). Variant of p that, if p is after q, cycles from  to . Fimport Data.Word enum_from_to_cyclic (254 :: Word8) 1 == [254,255,0,1] Variant of p that, if p is after q, enumerates from q to p. Renum_from_to_reverse 5 1 == [5,4,3,2,1] enum_from_to_reverse 1 5 == enumFromTo 1 5All elements in sequence. .(enum_univ :: [Data.Word.Word8]) == [0 .. 255]GSafeMaybe Y of .Maybe X of .HSafePJNormal form, value with occurences count (ie. exponent in notation above)./Midi-note-number -> CPS table, possibly sparse.X(t,f0,k,g) where t=tuning, f0=fundamental frequency, k=midi note number for f0, g=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)..Variant for sparse tunings that require state.(Variant for tunings that are incomplete.(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 F as a sequence of exact ratios, or as a sequence of possibly inexact .yIn both cases, the values are given in relation to the first degree of the scale, which for ratios is 1 and for cents 0.\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. )tn_divisions (equal_temperament 12) == 127 exact ratios of .q ing variant.Possibly inexact  of tuning. $  cents. Variant of cents 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  octave_ratio.Iterate the function f n times, the inital value is x. Irecur_n 5 (* 2) 1 == 32 take (5 + 1) (iterate (* 2) 1) == [1,2,4,8,16,32]JConvert a (signed) number of octaves difference of given ratio to a ratio. map (oct_diff_to_ratio 2) [-3 .. 3] == [1/8,1/4,1/2,1,2,4,8] map (oct_diff_to_ratio (9/8)) [-3 .. 3] == [512/729,64/81,8/9,1/1,9/8,81/64,729/512]DLookup function that allows both negative & multiple octave indices. Xlet map_zip f l = zip l (map f l) map_zip (tn_ratios_lookup werckmeister_vi) [-24 .. 24]DLookup function that allows both negative & multiple octave indices. Amap_zip (tn_approximate_ratios_lookup werckmeister_v) [-24 .. 24]72 exact ratios reconstructed from possibly inexact  of . :l Music.Theory.Tuning.Werckmeister let r = [1,17/16,9/8,13/11,5/4,4/3,7/5,3/2,11/7,5/3,16/9,15/8] tn_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 .  . Qmap (\n -> (n,round (ratio_to_cents (fold_ratio_to_octave_err (n % 1))))) [1..21]Construct an exact < that approximates  to within epsilon. <map (reconstructed_ratio 1e-5) [0,700,1200] == [1,442/295,2] -ratio_to_cents (442/295) == 699.9976981706735 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)) == r96-tone equal temperament.Harmonic series to n"th partial, with indicated octave. harmonic_series 17 2Harmonic 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]-Error if input is less than or equal to zero. 3map fold_ratio_to_octave_err [2/3,3/4] == [4/3,3/2]'Fold ratio until within an octave, ie. 1  n  2. 2map fold_ratio_to_octave [0,1] == [Nothing,Just 1]Sun of numerator & denominator.!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. pmap ratio_interval_class [2/3,3/2,3/4,4/3] == [3/2,3/2,3/2,3/2] map ratio_interval_class [7/6,12/7] == [7/6,7/6]%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) == rHarmonic series to n)th harmonic (folded, duplicated removed). Gharmonic_series_folded_r 17 == [1,17/16,9/8,5/4,11/8,3/2,13/8,7/4,15/8] olet r = [0,105,204,386,551,702,841,969,1088] in map (round . ratio_to_cents) (harmonic_series_folded_r 17) == r variant of .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] == rFractional 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).Lift  to .Lift  to . for . ^let f = d12_midi_tuning_f (equal_temperament 12,0,0) map f [0..127] == zip [0..127] (repeat 0) for 1. The function is sparse, it is only valid for g values from k. alet f = cps_midi_tuning_f (equal_temperament 72,T.midi_to_cps 59,59,72 * 4) map f [59 .. 59 + 72] Generates  given  with keys for all valid MNN. Jimport Sound.SC3.Plot plot_p2_ln [map (fmap round) (gen_cps_tuning_tbl f)] Given an  tbl , a list of CPS c, and a MNN m find the CPS in c that is nearest to the CPS in t for m.Require table be non-sparse.%Given two tuning tables generate the dtt table.$Degree of EFG, ie. sum of exponents. !efg_degree [(3,3),(7,2)] == 3 + 2>Number of tones of EFG, ie. product of increment of exponents. ,efg_tones [(3,3),(7,2)] == (3 + 1) * (2 + 1)FCollate a genus given as a multiset into standard form, ie. histogram. (efg_collate [3,3,3,7,7] == [(3,3),(7,2)]7Factors of EFG given with co-ordinate of grid location. efg_factors [(3,3)] let r = [([0,0],[]),([0,1],[7]),([0,2],[7,7]) ,([1,0],[3]),([1,1],[3,7]),([1,2],[3,7,7]) ,([2,0],[3,3]),([2,1],[3,3,7]),([2,2],[3,3,7,7]) ,([3,0],[3,3,3]),([3,1],[3,3,3,7]),([3,2],[3,3,3,7,7])] in efg_factors [(3,3),(7,2)] == rRatios of EFG, taking n8 as the 1:1 ratio, with indices, folded into one octave. let r = sort $ map snd $ efg_ratios 7 [(3,3),(7,2)] r == [1/1,9/8,8/7,9/7,21/16,189/128,3/2,27/16,12/7,7/4,27/14,63/32] map (round . ratio_to_cents) r == [0,204,231,435,471,675,702,906,933,969,1137,1173]0: 1/1 C 0.000 cents 1: 9/8 D 203.910 cents 2: 8/7 D+ 231.174 cents 3: 9/7 E+ 435.084 cents 4: 21/16 F- 470.781 cents 5: 189/128 G- 674.691 cents 6: 3/2 G 701.955 cents 7: 27/16 A 905.865 cents 8: 12/7 A+ 933.129 cents 9: 7/4 Bb- 968.826 cents 10: 27/14 B+ 1137.039 cents 11: 63/32 C- 1172.736 cents 12: 2/1 C 1200.000 cents let r' = sort $ map snd $ efg_ratios 5 [(5,2),(7,3)] r' == [1/1,343/320,35/32,49/40,5/4,343/256,7/5,49/32,8/5,1715/1024,7/4,245/128] map (round . ratio_to_cents) r' == [0,120,155,351,386,506,583,738,814,893,969,1124] let r'' = sort $ map snd $ efg_ratios 3 [(3,1),(5,1),(7,1)] r'' == [1/1,35/32,7/6,5/4,4/3,35/24,5/3,7/4] map (round . ratio_to_cents) r'' == [0,155,267,386,498,653,884,969] let c0 = [0,204,231,435,471,675,702,906,933,969,1137,1173,1200] let c1 = [0,120,155,351,386,506,583,738,814,893,969,1124,1200] let c2 = [0,155,267,386,498,653,884,969,1200] let f (c',y) = map (\x -> (x,y,x,y + 10)) c' map f (zip [c0,c1,c2] [0,20,40])Generate a line drawing, as a set of (x0,y0,x1,y1) 4-tuples. h=row height, m=distance of vertical mark from row edge, k=distance between rows let e = [[3,3,3],[3,3,5],[3,5,5],[3,5,7],[3,7,7],[5,5,5],[5,5,7],[3,3,7],[5,7,7],[7,7,7]] let e = [[3,3,3],[5,5,5],[7,7,7],[3,3,5],[3,5,5],[5,5,7],[5,7,7],[3,7,7],[3,3,7],[3,5,7]] let e' = map efg_collate e efg_diagram_set (round,25,4,75) e'WWWTISafe{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 P.primes 315 == [3,3,5,7] P.primeFactors 315 == [3,3,5,7] n from primes. map prime_factors [1,4,231,315] == [[],[2,2],[3,7,11],[3,3,5,7]] map P.primeFactors [1,4,231,315] == [[],[2,2],[3,7,11],[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)]  . *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. grational_prime_factors_t 6 (12,7) == [2,1,0,-1,0,0] rational_prime_factors_t 6 (32,9) == [5,-2,0,0,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 > ? pair of n.Table 2 (p.45) 7length (table_2 0.06) == 24 length (table_2 0.04) == 66Pretty 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.000000JSafeHMC slendro tuning. ,cents_i alves_slendro == [0,231,498,765,996] Xscl <- scl_load "slendro_alves" cents_i (scale_tuning 0.01 scl) == cents_i alves_slendro HMC  pelog bem tuning. .cents_i alves_pelog_bem == [0,231,316,702,814] \scl <- scl_load "pelog_alves" cents_i (scale_tuning 0.01 scl) == [0,231,316,471,702,814,969] HMC  pelog barang tuning. 1cents_i alves_pelog_barang == [0,386,471,857,969] HMC pelog 2,3,4,6,7 tuning. 0cents_i alves_pelog_23467 == [0,386,471,702,969]                    KSafe  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 qtn_divisions harrison_ditone == 12 tn_cents_i harrison_ditone == [0,114,204,294,408,498,612,702,816,906,996,1110]        LSafe  Cents for  . ^let c = [0,76,193,310,386,503,580,697,773,890,1007,1083] in map round pietro_aaron_1523_c == c *map ((+ 60) . (/ 100)) pietro_aaron_1523_c /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] import Music.Theory.Tuning.Scala scl <- scl_load "meanquar" cents_i (scale_tuning 0.01 scl) == [0,76,193,310,386,503,579,697,773,890,1007,1083]  Cents for  . ^let c = [0,94,196,298,392,500,592,698,796,894,1000,1092] in map round thomas_young_1799_c == c '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] Uscl <- scl_load "young2" cents_i (scale_tuning 0.01 scl) == cents_i thomas_young_1799  Ratios for zarlino. length zarlino_1588_r == 16 Gioseffo Zarlino, 1588, see  #http://www.kylegann.com/tuning.html. udivisions zarlino_1588 == 16 cents_i zarlino_1588 == [0,71,182,204,294,316,386,498,569,590,702,773,884,996,1018,1088] Rscl <- scl_load "zarlino2" cents_i (scale_tuning 0.01 scl) == cents_i zarlino_1588  Ratios for  . ulet c = [0,105,204,298,386,471,551,702,841,906,969,1088] in map (round . ratio_to_cents) ben_johnston_mtp_1977_r == c 9Ben Johnston's "Suite for Microtonal Piano" (1977), see #http://www.kylegann.com/tuning.html Qcents_i ben_johnston_mtp_1977 == [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 == r \scl <- scl_load "gann_super" cents_i (scale_tuning 0.01 scl) == cents_i gann_superparticular                            MSafe  Ratios for  pythagorean. Pythagorean tuning,  :http://www.microtonal-synthesis.com/scale_pythagorean.html. Jcents_i pythagorean_12 == [0,114,204,294,408,498,612,702,816,906,996,1110] Rscl <- scl_load "pyth_12" cents_i (scale_tuning 0.1 scl) == cents_i pythagorean_12  Ratios for  . qlet c = [0,112,204,316,386,498,590,702,814,884,996,1088] in map (round . ratio_to_cents) five_limit_tuning_r == c UFive-limit tuning (five limit just intonation), Alexander Malcolm's Monochord (1721). Mcents_i five_limit_tuning == [0,112,204,316,386,498,590,702,814,884,996,1088] Uscl <- scl_load "malcolm" cents_i (scale_tuning 0.1 scl) == cents_i five_limit_tuning  Ratios for  . let c = [0,112,204,316,386,498,583,702,814,884,1018,1088] in map (round . ratio_to_cents) septimal_tritone_just_intonation == c 'Septimal tritone Just Intonation, see >http://www.microtonal-synthesis.com/scale_just_intonation.html jlet c = [0,112,204,316,386,498,583,702,814,884,1018,1088] in cents_i septimal_tritone_just_intonation == c bscl <- scl_load "ji_12" cents_i (scale_tuning 0.1 scl) == cents_i septimal_tritone_just_intonation  Ratios for  . ylet c = [0,112,204,316,386,498,583,702,814,884,969,1088] in map (round . ratio_to_cents) seven_limit_just_intonation == c Seven limit Just Intonation. Wcents_i seven_limit_just_intonation == [0,112,204,316,386,498,583,702,814,884,969,1088] Approximate ratios for  . flet c = [0,90,193,294,386,498,590,697,792,890,996,1088] in map (round.to_cents) kirnberger_iii_ar == c  9http://www.microtonal-synthesis.com/scale_kirnberger.html. Icents_i kirnberger_iii == [0,90,193,294,386,498,590,697,792,890,996,1088] Uscl <- scl_load "kirnberger" cents_i (scale_tuning 0.1 scl) == cents_i kirnberger_iii 0Vallotti & 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] Mscl <- scl_load "vallotti" cents_i (scale_tuning 0.1 scl) == cents_i vallotti !.Mayumi Tsuda 13-limit Just Intonation scale,  7http://www.microtonal-synthesis.com/scale_reinhard.html. Icents_i mayumi_tsuda == [0,128,139,359,454,563,637,746,841,911,1072,1183] Pscl <- scl_load "tsuda13" cents_i (scale_tuning 0.1 scl) == cents_i mayumi_tsuda " 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 ximport Music.Theory.Tuning.Scala scl <- scl_load "harrison_16" cents_i (scale_tuning 0.1 scl) == cents_i lou_harrison_16 $ 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] Oscl <- scl_load "partch_43" cents_i (scale_tuning 0.1 scl) == cents_i partch_43 & Ratios for  '. '1Ben Johnston 25 note just enharmonic scale, see :http://www.microtonal-synthesis.com/scale_johnston_25.html Wscl <- scl_load "johnston_25" cents_i (scale_tuning 0.1 scl) == cents_i ben_johnston_25             ! " # $ % & '             ! " # $ % & '             ! " # $ % & '             ! " # $ % & 'NSafe ( 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 == r )DRiley'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] wimport Music.Theory.Tuning.Scala scl <- scl_load "riley_albion" cents_i (scale_tuning 0.01 scl) == cents_i riley_albion ( ) ( ) ( ) ( )OSafe *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] uimport Music.Theory.Tuning.Scala scl <- scl_load "werck3" cents_i (scale_tuning 0.01 scl) == cents_i werckmeister_iii -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] Sscl <- scl_load "werck4" cents_i (scale_tuning 0.01 scl) == cents_i werckmeister_iv 0Approximate ratios for  2. olet c = [0,96,204,300,396,504,600,702,792,900,1002,1098] in map (round . ratio_to_cents) werckmeister_v_ar == c 1 Cents for  2. 20Werckmeister V, Andreas Werckmeister (1645-1706) Jcents_i werckmeister_v == [0,96,204,300,396,504,600,702,792,900,1002,1098] Rscl <- scl_load "werck5" cents_i (scale_tuning 0.01 scl) == cents_i werckmeister_v 3 Ratios for  4 , with supposed correction of 2825 to 4944. olet c = [0,91,186,298,395,498,595,698,793,893,1000,1097] in map (round . ratio_to_cents) werckmeister_vi_r == c 41Werckmeister VI, Andreas Werckmeister (1645-1706) Kcents_i werckmeister_vi == [0,91,186,298,395,498,595,698,793,893,1000,1097] Sscl <- scl_load "werck6" cents_i (scale_tuning 0.01 scl) == cents_i werckmeister_vi * + , - . / 0 1 2 3 4 * + , - . / 0 1 2 3 4 * + , - . / 0 1 2 3 4 * + , - . / 0 1 2 3 4PSafe 5, with 12-ET/24-ET tuning deviation given in . 6Tuple indicating nearest  to  frequency with ET( frequency, and deviation in hertz and .F(cps,nearest-pitch,cps-of-nearest-pitch,cps-deviation,cents-deviation) 70 and N. 80 and N. 9)12-tone equal temperament table equating 3 and frequency over range of human hearing, where A4 has given frequency. tbl_12et_f0 415 : 9 440hz. Hlength tbl_12et == 132 minmax (map (round . snd) tbl_12et) == (16,31609) ;%24-tone equal temperament variant of  9. < ; 440. Hlength tbl_24et == 264 minmax (map (round . snd) tbl_24et) == (16,32535) = Given an ET* table (or like) find bounds of frequency.(import qualified Music.Theory.Tuple as T ^let r = Just (T.t2_map octpc_to_pitch_cps ((3,11),(4,0))) in bounds_et_table tbl_12et 256 == r > = of  :.  map bounds_12et_tone (hsn 17 55) ?n-decimal places. ndp 3 (1/3) == "0.333" @ Pretty print  6. BForm  6 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 == r C B for  :. D B for  <. Wlet r = "55.0 A1 55.0 0.0 0.0" in unwords (hs_r_pitch_pp 1 (nearest_24et_tone 55)) == r E4Monzo 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] == r FGiven a midi note number and 1/6 deviation determine Pitch' 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])) == r G)72-tone equal temperament table equating Pitch'3 and frequency over range of human hearing, where A4 = 440hz. Ilength tbl_72et == 792 min_max (map (round . snd) tbl_72et) == (16,33167) H B for  G. 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_72et IExtract  5 from  6. JNearest 12-ET  5 to indicated frequency (hz). +nearest_pitch_detune_12et 452.8929841231365 KNearest 24-ET  5 to indicated frequency (hz). +nearest_pitch_detune_24et 452.8929841231365 LGiven near function, f0 and ratio derive  5. MFrequency (hz) of  5. 9pitch_detune_to_cps (octpc_to_pitch pc_spell_ks (4,9),50) N L of  C O L of  D QMarkdown pretty-printer for  5. RHTML pretty-printer for  5. SNo-octave variant of  Q. TNo-octave variant of  R. 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 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 7 8 9 : ; < = > 6 ? @ A B C D E F G H 5 I J K L M N O P Q R S T 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S TQSafe V of . W of . Xn = length, m equals multiplier, r = initial ratio. .tun_seq 5 (3/2) 1 == [1/1,3/2,9/8,27/16,81/64] Z/ rounded to nearest multiple of 100, modulo 12. .map (ratio_to_pc 0) [1,4/3,3/2,2] == [0,5,7,0] \[Give all pairs from (l2,l1) and (l3,l2) that are at interval ratios r1 and r2 respectively. ]Pretty printer for pitch class. Dunwords (map pc_pp [0..11]) == "C&n C&o D&n E&m E&n F&n F&o G&n A&m A&n B&m B&n" bZip start-middle-end. ;zip_sme (0,1,2) "abcd" == [(0,'a'),(1,'b'),(1,'c'),(2,'d')] U V W X Y Z [ \ ] ^ _ ` a b c d U V W X Y Z [ \ ] ^ _ ` a b c d V W X Y Z [ \ ] ^ _ ` a b U c d U V W X Y Z [ \ ] ^ _ ` a b c dRSafe e Ratios for  j/. lmy = La Monte Young. wtp = Well-Tuned Piano. ilet c = [0,177,204,240,471,444,675,702,738,969,942,1173] in map (round . T.ratio_to_cents) lmy_wtp_r == c fDThe pitch-class of the key associated with each ratio of the tuning. 9mapMaybe lmy_wtp_ratio_to_pc [1,1323/1024,7/4] == [3,8,0] h;The list of all non-unison ascending intervals possible in  e. length lmy_wtp_univ == 66 iCollated and sorted  h. 0let r_cents_pp = show . round . T.ratio_to_cents (import qualified Music.Theory.Math as T  let f (r,i) = concat [T.ratio_pp r," = " ,r_cents_pp r," = #" ,show (length i)," = " ,unwords (map show i)] 'putStrLn $ unlines $ map f lmy_wtp_uniq 3:2 = 702 = #9 = (3,10) (4,9) (5,10) (6,11) (6,1) (7,0) (7,2) (8,1) (9,2) 7:4 = 969 = #7 = (3,0) (5,2) (6,7) (7,10) (8,9) (11,0) (1,2) 7:6 = 267 = #6 = (4,8) (5,7) (6,2) (7,11) (9,1) (10,0) 9:7 = 435 = #4 = (4,1) (5,0) (6,9) (11,2) 9:8 = 204 = #6 = (3,5) (4,2) (6,8) (7,9) (11,1) (0,2) 21:16 = 471 = #6 = (3,7) (5,9) (6,0) (7,1) (8,2) (10,2) 27:14 = 1137 = #2 = (4,6) (9,11) 27:16 = 906 = #3 = (4,7) (8,11) (9,0) 49:32 = 738 = #3 = (3,11) (5,1) (6,10) 49:36 = 534 = #1 = (5,11) 63:32 = 1173 = #5 = (3,2) (4,5) (8,7) (9,10) (1,0) 49:48 = 36 = #2 = (5,6) (10,11) 81:56 = 639 = #1 = (4,11) 81:64 = 408 = #1 = (4,0) 147:128 = 240 = #3 = (3,6) (5,8) (10,1) 189:128 = 675 = #3 = (3,9) (4,10) (8,0) 441:256 = 942 = #2 = (3,1) (8,10) 567:512 = 177 = #1 = (3,4) 1323:1024 = 444 = #1 = (3,8) jGann, 1993, p.137. Ccents_i lmy_wtp == [0,177,204,240,471,444,675,702,738,969,942,1173] import Data.List import Music.Theory.Tuning.Scala scl <- scl_load "young-lm_piano" cents_i (scale_to_tuning 0.01 scl) == cents_i lmy_wtp let f = d12_midi_tuning_f (lmy_wtp,-74.7,-3) import qualified Music.Theory.Pitch as T T.octpc_to_midi (-1,11) == 11 map (round . T.midi_detune_to_cps . f) [62,63,69] == [293,298,440] map (fmap round . T.midi_detune_normalise . f) [0 .. 127] kRatios for 'lmy_wtp_1964. lTLa Monte Young's initial 1964 tuning for "The Well-Tuned Piano" (Gann, 1993, p.141). Icents_i lmy_wtp_1964 == [0,149,204,240,471,647,675,702,738,969,1145,1173] import Music.Theory.Tuning.Scala let nm = ("young-lm_piano_1964","LaMonte Young's Well-Tuned Piano (1964)") let scl = tuning_to_scale nm lmy_wtp_1964 putStr $ unlines $ scale_pp scl mEuler diagram for  j. let dir = "homerohanswhmtdatandot/" let f = unlines . T.euler_plane_to_dot_rat (3,True) writeFile (dir ++ "euler-wtp.dot") (f lmy_wtp_euler) e f g h i j k l m e f g h i j k l m e f g h i j k l m e f g h i j k l mSSafe nOdd numbers to n. odd_to 7 == [1,3,5,7] oGenerate initial row for n. row 7 == [1,5/4,3/2,7/4] pGenerate initial column for n. column 7 == [1,8/5,4/3,8/7] q  . rGiven row and column generate matrix value at (i,j). #inner (row 7,column 7) (1,2) == 6/5 tMeyer 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)] uMeyer 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 == r vThird element of three-tuple. wSet 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] xNumber of unique elements at n table. -map degree [7,9,11,13,15] == [13,19,29,41,49] y +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 n o p q r s t u v w x y n o p q r s t u v w x y n o p q r s t u v w x y n o p q r s t u v w x yTSafe zMThree interlocking harmonic series on 1:5:3, by Larry Polansky in "Psaltery". import qualified Music.Theory.Tuning.Scala as T scl <- T.scl_load "polansky_ps" T.pitch_representations (T.scale_pitches scl) == (0,50) 1 : Data.Either.rights (T.scale_pitches scl) == psaltery_r { of psaltery. 4length psaltery_r == 51 && length psaltery_o_r == 21 psaltery_o_r == [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] |Tuning derived from  | with  octave_ratio of 2. Fcents_i psaltery_o == [0,27,53,105,155,204,275,342,386,471,491,551,590",702,773,807,841,906,938,969,1088] Zlet r = [0,1200,1902,2400,2786,3102,3369,3600,3804,3986,4151,4302,4441,4569,4688,4800,4905,386,1586,2288,2786,3173,3488,3755,3986,4190,4373,4538,4688,4827,4955,5075,5186,5291 ,702,1902,2604,3102,3488,3804,4071,4302,4506,4688,4853,5004,5142,5271,5390,5502] > in cents_i (T.scale_tuning 0.01 scl) == r z { | z { | z { | z { |USafe  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.5 PGiven a set of equal length lists calculate the average value of each position. /calculate_averages [[1,2,3],[3,2,1]] == [2,2,2]  Averages of K set, p. 10. 8k_averages == [233.8125,245.0625,234.0,240.8125,251.875]  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) == 262  Averages of GM set, p. 10. 6gm_averages == [234.0,240.25,247.625,243.125,254.0625] VAssociation list giving interval boundaries for interval class categories (pp.10-11). Categorise an interval. +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  , 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] ratio_to_cents of  . Rimport Music.Theory.List map round (d_dx polansky_1984_c) == [231,240,223,240,231] } ~   } ~   } ~   } ~  VSafe 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))    WSafe $(last-name,first-name,title,year,hmt tuning,scalaname)    XSafe (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] 5Idealized ET Slendro, 5-tone equal temperament (p.17) .L.d_dx idealized_et_s == [240,240,240,240,240] =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] )Reconstruct approximate ratios to within 1e-3 from intervals. YSafe    ZSafe "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_layout 3Make 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 == c    [Safe A 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 Nothing Error 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) undefined ASCII pretty printer for  . ASCII pretty printer for  . ASCII pretty printer for  . ASCII pretty printer for   sequence.* * *    \Safe &Common music notation durational model division of whole note number of dots tuplet modifier Are multipliers equal?  Is multiplier the identity (ie. 1)? )Compare durations with equal multipliers. Erroring variant of  . #True if neither duration is dotted. 7Sum 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  . 5Standard divisions (from 0 to 256). MusicXML allows -1 as a division (for long). Durations set derived from   with up to k dots. Multiplier of 1. -Table of number of beams at notated division. Lookup  . .whole_note_division_to_beam_count 32 == Just 3 Calculate number of beams at  . Amap duration_beam_count [Duration 2 0 1,Duration 16 0 1] == [0,2]  Table giving MusicXML types for divisions. Lookup  . Dmap whole_note_division_to_musicxml_type [2,4] == ["half","quarter"]  Variant of   extracting   from  , dots & multipler are ignored. 7duration_to_musicxml_type (Duration 4 0 1) == "quarter"  Table giving Unicode symbols for divisions. Lookup  . =map whole_note_division_to_unicode_symbol [1,2,4,8] == "]^_`" Give Unicode string for  . The duration multiplier is not written. Gmap duration_to_unicode [Duration 1 2 1,Duration 4 1 1] == ["]mm","_m"] Give Lilypond notation for  ). Note that the duration multiplier is not written. Kmap duration_to_lilypond_type [Duration 2 0 1,Duration 4 1 1] == ["2","4."]  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."]  instance in terms of  .     ]Safe                                                                ^Safe!         ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8!         ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8!         ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8!         ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8_Safe 9Rational 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  9 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  9 value. 6map whole_note_division_to_rq [1,2,4,8] == [4,2,1,1/2] ?Apply dots to an  9 duration. (map (rq_apply_dots 1) [1,2] == [3/2,7/4] @Convert   to  9 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] A^ function for   via  @. 2half_note `duration_compare_rq` quarter_note == GT B 9 modulo. -map (rq_mod (5/2)) [3/2,3/4,5/2] == [1,1/4,0] CIs p divisible by q , ie. is the ? of p/q O 1. 5map (rq_divisible_by (3%2)) [1%2,1%3] == [True,False] DIs  9 a whole number (ie. is ? O 1. 1map rq_is_integral [1,3/2,2] == [True,False,True] EReturn > of  9 if ? O 1. 4map rq_integral [1,3/2,2] == [Just 1,Nothing,Just 2] F(Derive the tuplet structure of a set of  9 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)] G(Derive the tuplet structure of a set of  9 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) HRemove 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] IIf an  9* 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)] JdPredicate 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 9 : ; < = > ? @ A B C D E F G H I J 9 : ; < = > ? @ A B C D E F G H I J 9 : ; < = > ? @ A B C D E F G H I J 9 : ; < = > ? @ A B C D E F G H I J`Safe K Annotated  . L4Standard music notation durational model annotations TDoes  K begin a tuplet? UDoes  K end a tuplet? VIs  K tied to the the right? WAnnotate a sequence of  K as a tuplet. gimport Music.Theory.Duration.Name da_tuplet (3,2) [(quarter_note,[Tie_Left]),(eighth_note,[Tie_Right])] XGroup tuplets into a . Branch nodes have label +, leaf nodes label 3  K. .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 Y Variant of  that places separator at left. Sbreak_left (== 3) [1..6] == ([1..3],[4..6]) break_left (== 3) [1..3] == ([1..3],[]) Z Variant of  Y& 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 !, unused rhs values are returned. Dzip_kr [1..4] ['a'..'f'] == ([(1,'a'),(2,'b'),(3,'c'),(4,'d')],"ef") ]]* 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')] ^Does a have  N and  M? _Does d have  N and  M? K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ L M N O P K Q R S T U V W X Y Z [ \ ] ^ _ K L M N O P Q R S T U V W X Y Z [ \ ] ^ _aSafe b 9 with  tie right. cBoolean. d Construct  b. e 9 field of  b. fTied field of  b. gIs  b tied right. h b variant of  H. $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)] i Transform  9 to untied  b. rq_rqt 3 == (3,F) j!Tie last element only of list of  9. *rq_tie_last [1,2,3] == [(1,F),(2,F),(3,T)] kTransform a list of  b to a list of  K9. The flag indicates if the initial value is tied left. /rqt_to_duration_a False [(1,T),(1/4,T),(3/4,F)] l b variant of  J. m b variant of  I. ~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)) nList variant of  m. #rqt_to_cmn_l (5,T) == [(4,T),(1,T)] ou  n. 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)] b c d e f g h i j k l m n o b c d e f g h i j k l m n o c b d e f g h i j k l m n o b c d e f g h i j k l m n obNone p Variant of  q where n is 1. q Divisions of n  9 into i equal parts grouped as j0. A quarter and eighth note triplet is written (1,1,[2,1],False). rLift  p to  q. sVerify that grouping j sums to the divisor i. uTranslate from  q to a sequence of  9 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) vTranslate from result of  u to seqeunce of  b. Drq_set_t_to_rqt ([1/5,3/5,1/5],True) == [(1/5,_f),(3/5,_f),(1/5,_t)] wTransform sequence of  q into sequence of  9, 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] xPartitions 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] yThe Z of  x. >map (length . partitions_sum_p) [9..12] == [256,512,1024,2048] zThe set of all  p that sum to n, a variant on  y. kmap (length . rq1_div_univ) [3..5] == [8,16,32] map (length . rq1_div_univ) [9..12] == [512,1024,2048,4096] p q r s t u v w x y z p q r s t u v w x y z q p r s t u v w x y z p q r s t u v w x y zcSafe {A rational time signature is a  | where the parts are <. |,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  9. -map ts_whole_note_rq [(3,8),(2,2)] == [3/2,4]  Duration, in  9, of a measure of indicated  }. "map ts_rq [(3,4),(5,8)] == [3,5/2] ^ P  .  }% derived from whole note duration in  9 form. 8map rq_to_ts [4,3/2,7/4,6] == [(4,4),(3,8),(7,16),(6,4)] #Uniform division of time signature. ts_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] ts_divisions (7,4) == [1,1,1,1,1,1,1] SConvert a duration to a pulse count in relation to the indicated time signature. *ts_duration_pulses (3,8) quarter_note == 2 0Rewrite time signature to indicated denominator. ts_rewrite 8 (3,4) == (6,8) Sum time signatures.  ts_sum [(3,16),(1,2)] == (11,16) The  9 is the  of   of the elements. cts_rq [(3,4),(1,8)] == 3 + 1/2 The divisions are the n 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] == r The  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/4 The  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 { | } ~   { | } ~   } ~  | {  { | } ~  dSafe Click track definition. Types of nodes. -The start of a measure with a rehearsal mark. The start of a regular measure. A regular pulse. ,The start of a pulse group within a measure. 7A regular pulse in a measure prior to a rehearsal mark. The end of the track.  1-indexed.  1-indexed. Transform measures given as  9 divisions to absolute  9 locations. mdv abbreviates measure divisions. 1mdv_to_mrq [[1,2,1],[3,2,1]] == [[0,1,3],[4,7,9]] Lookup function for ( , ) indexed structure. Comparison for ( ,  ) indices. CLatch measures (ie. make measures contiguous, hold previous value). Aunzip (ct_ext 10 'a' [(3,'b'),(8,'c')]) == ([1..10],"aabbbbbccc") =Variant that requires a value at measure one (first measure).   of  .   without measures numbers.   of  . GLatch 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')]) == r !Indicate measures prior to marks. kct_pre_mark [] == [] ct_pre_mark [(1,'A')] == [] ct_pre_mark [(3,'A'),(8,'B')] == [(2,Just ()),(7,Just ())] Contiguous pre-mark sequence. Qct_pre_mark_seq 1 [(1,'A')] == [(1,Nothing)] ct_pre_mark_seq 10 [(3,'A'),(8,'B')] (Interpolating lookup of tempo sequence (.).  Lead-in of (pulse,tempo,count). )Prepend initial element to start of list. delay1 "abc" == "aabc" Initial tempo, if given. Erroring variant.+ + +    eSafe8  Variant of   allowing multiple rules. Predicate function at  . Structure given to  . to decide simplification. The structure is  (ts,start-rq,(left-rq,right-rq)).  Variant of #. If all elements of the list are Just a , then gives Just [a] else gives +. Uall_just (map Just [1..3]) == Just [1..3] all_just [Just 1,Nothing,Just 3] == Nothing  Variant of  that preserves first Y. ^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  to 7 by discarding Y. 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 6 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] == Nothing Recursive 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] == Nothing 6Split 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 m!, used locally for documentation.  Alias for 5!, used locally for documentation.  Variant of   that operates at  b 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  b values in sequences summing to  9* 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  b" sequence cannot be notated (see  lD) 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) d Recursive 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  9! sequence into measures given by  9 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  b 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  b 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  9J 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]) == Nothing Notate 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   to  .  Transform   to set of  . !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  . !Measure simplifier. Apply given  . <Run simplifier until it reaches a fix-point, or for at most limit passes. %Pulse simplifier predicate, which is  m. 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 4 sr ts (Just ts_p) rq  Variant of  " without pulse divisions (derive). Enotate 4 (default_rule [((3,2),0,(2,2)),((3,2),0,(4,2))]) [(3,2)] [6]  Variant of  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 Y 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  KN 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" R   .  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  ; ; ; ; fSafe 7A tempo marking is in terms of a common music notation  . :Duration of a RQ value, in seconds, given indicated tempo. *rq_to_seconds (quarter_note,90) 1 == 60/90 ZThe 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/2  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"    gSafe ;Scan a list of directories until a file is located, or not. Subset of files in dir with an extension in ext. ;If path is not absolute, prepend current working directory. to_absolute_cwd "x"                hSafe- ;A scale has a name, a description, a degree, and a list of  es. 4A nearness value for deriving approximate rationals. An enumeration type for .scl pitch classification. A .scl pitch is either in Cents or is a ,. Derive   from  .  Pitch as , conversion by  if necessary.  Pitch as <, conversion by  if necessary, hence epsilon. A pair giving the number of Cents and number of , pitches. If scale is uniform, give type. (The predominant type of the pitches for  . The name of a scale. Text description of a scale. #The degree of the scale (number of  es). The  es at  . *Ensure degree and number of pitches align. *Raise error if scale doesn't verify, else 6.  The last   element of the scale (ie. the ocatve). Is   perfect, ie. , of 2 or Cents of 1200. !Are all pitches of the same type. KMake scale pitches uniform, conforming to the most promininent pitch type. Scale as list of  (ie.  ) with 0 prefix.  $ of  . Scale as list of < (ie.  ) with 1 prefix.  Require that   be uniformlay of ,s.  Translate   to . If   is uniformly rational,  is rational, else  is in .   is used to recover the < octave if required. Convert  to  . Mtuning_to_scale ("et12","12 tone equal temperament") (T.equal_temperament 12) !Are scales equal (O) at degree and tuning data. db <- scl_load_db let r = [2187/2048,9/8,32/27,81/64,4/3,729/512,3/2,6561/4096,27/16,16/9,243/128,2/1] let Just py = find (scale_eq ("","",12,map Right r)) db scale_name py == "pyth_12" slet c = map T.ratio_to_cents r let Just py' = find (scale_eqv ("","",12,map Left c)) db scale_name py' == "pyth_12" "Are scales equal (O") at degree and tuning data after  . #Comment lines begin with !. $Remove to end of line ! comments. +remove_eol_comments " 1 ! comment" == " 1 " %5Remove comments and null lines and trailing comments. 8filter_comments ["!a","b","","c","d!e"] == ["b","c","d"] &QPitches are either cents (with decimal point, possibly trailing) or ratios (with /). Umap parse_pitch ["700.0","350.","3/2","2"] == [Left 700,Left 350,Right (3/2),Right 2] '#Pitch lines may contain commentary. (Parse .scl file. )Read the environment variable  SCALA_SCL_DIRD, which is a sequence of directories used to locate scala files on. 7setEnv "SCALA_DIST_DIR" "/home/rohan/data/scala/85/scl" * Lookup the  SCALA_SCL_DIRs environment variable, which must exist, and derive the filepath. It is an error if the name has a file extension. 2mapM scl_derive_filename ["young-lm_piano","et12"] +/If the name is an absolute file path and has a .scl& extension, then return it, else run  *. scl_resolve_name "young-lm_piano" scl_resolve_name "/home/rohan/data/scala/85/scl/young-lm_piano.scl" scl_resolve_name "/home/rohan/data/scala/85/scl/unknown-tuning.scl" ,Load .scl file, runs  resolve_scl. s <- scl_load "xenakis_chrom" pitch_representations (scale_pitches s) == (6,1) scale_ratios 1e-3 s == [1,21/20,29/23,179/134,280/187,11/7,100/53,2] -  of  ,. . Load all .scl files at dir. dir <- scl_get_dir dir == ["/home/rohan/data/scala/85/scl","/home/rohan/sw/hmt/data/scl"] let [scl_85_dir,ext_dir] = dir db <- scl_load_dir scl_85_dir length db == 4671 length (filter ((== 0) . scale_degree) db) == 0 length (filter ((/= 1) . head . scale_ratios 1e-3) db) == 0 length (filter ((/= 0) . head . scale_cents) db) == 0 length (filter (== Just (Right 2)) (map scale_octave db)) == 4003 length (filter is_scale_uniform db) == 2816 slet na = filter (not . T.is_ascending . scale_cents) db length na == 121 mapM_ (putStrLn . unlines . scale_stat) na mimport qualified Music.Theory.List as T import Sound.SC3.Plot plot_p2_stp [T.histogram (map scale_degree db)] import Data.List 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 let r = ["LaMonte Young, tuning of For Guitar '58. 1/1 March '92, inv.of Mersenne lute 1" ,"LaMonte Young's Well-Tuned Piano"] in filter (isInfixOf "LaMonte Young") (map scale_description db) == r 0length (filter (not . perfect_octave) db) == 663 /Load Scala data base at  ). Xdb <- scl_load_db mapM_ (putStrLn.unlines.scale_stat) (filter (not . perfect_octave) db) 1 Pretty print   in Scala format. 2 Pretty print   in Scala format. Qs <- scl_load "et19" s <- scl_load "young-lm_piano" putStr $ unlines $ scale_pp s 3scala" distribution directory, given at SCALA_DIST_DIR. Bfmap (== "/home/rohan/opt/build/scala-22-pc64-linux") dist_get_dir 4Load file from  3. 0s <- load_dist_file "intnam.par" length s == 4730                       ! " # $ % & ' ( ) * + , - . / 0 1 2 3 40                       ! " # $ % & ' ( ) * + , - . / 0 1 2 3 40                       ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4.                       ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4iSafe 8Tuning, ratios for each octave. length (concat dr_tuning_oct) == 19 import qualified Music.Theory.Tuning as T map (map (T.ratio_to_cents . t2_to_ratio)) dr_tuning_oct 9Tuning, actual ratios. :Actual scale, in CPS. klet r = [52,69,76,83,92,104,119,138,156,166,185,208,234,260,277,286,311,332,363] in map round dr_scale == r 7 8 9 : ; < = > ? @ A B 7 8 9 : ; < = > ? @ A B 7 8 9 : ; < = > ? @ A B 7 8 9 : ; < = > ? @ A BjSafe CLength prefixed list of  D. D,Interval and name, ie. (3/2,"perfect fifth") ELookup ratio in  C. ,db <- load_intnam intnam_search_ratio db (3/2) == Just (3/2,"perfect fifth") intnam_search_ratio db (2/3) == Nothing intnam_search_ratio db (4/3) == Just (4/3,"perfect fourth") map (intnam_search_ratio db) [3/2,4/3,7/4,7/6,9/7,12/7,14/9] intnam_search_ratio db (31/16) == Just (31/16,"31st harmonic") FLookup interval name in  C, ci = case-insensitive. ;db <- load_intnam intnam_search_description_ci db "didymus" I H of  4 of "intnam.par". 7intnam <- load_intnam fst intnam == length (snd intnam) C D E F G H I C D E F G H I D C E F G H I C D E F G H IkSafe J(mode-count,_,mode-list) K$(start-degree,intervals,description) Q!Search for mode by interval list. RExpect one result. mn <- load_modenam let sq = putStrLn . unlines . mode_stat . fromJust . modenam_search_seq1 mn sq [2,2,1,2,2,2,1] sq [2,1,2,2,1,2,2] sq [2,1,2,2,1,3,1] sq (replicate 6 2) sq [1,2,1,2,1,2,1,2] sq [2,1,2,1,2,1,2,1] sq (replicate 12 1) S$Search for mode by description text. Amap (modenam_search_description mn) ["Messiaen","Xenakis","Raga"] TPretty printer. U6Bracketed integers are a non-implicit starting degree. 7map non_implicit_degree ["4","[4]"] == [Nothing,Just 4] Y+Lines ending with @@ continue to next line. [ Z of  4 of  modenam.par. Imn <- load_modenam let (n,x,m) = mn n == 2125 && x == 15 && length m == n J K L M N O P Q R S T U V W X Y Z [ J K L M N O P Q R S T U V W X Y Z [ K L M N O J P Q R S T U V W X Y Z [ J K L M N O P Q R S T U V W X Y Z [lSafe a2(RECORD-SEPARATOR,FIELD-SEPARATOR,ENTRY-SEPARATOR) \ ] ^ _ ` a b c d e f g h i j k l \ ] ^ _ ` a b c d e f g h i j k l a ` _ ^ ] \ b c d e f g h i j k l \ ] ^ _ ` a b c d e f g h i j k lmSafe uThe sequence of keys at  s. vm if  q is present in Entity. w of  u. xDuplicate keys predicate. y<Find all associations for key using given equality function. z y of O. {nth element of  z. | Variant of  z requiring a unique key. +( indicates there is no entry, it is an q if duplicate keys are present. }m if key exists and is unique. ~Error variant. Default value variant. >Remove all associations for key using given equality function.   of O. Preserves order of occurence. =Collate adjacent entries of existing sequence with equal key. m n o p q r s t u v w x y z { | } ~   m n o p q r s t u v w x y z { | } ~   t s r q p o n m u v w x y z { | } ~   m n o p q r s t u v w x y z { | } ~  nNone Load DB from . Store DB to . rlet fn = "/home/rohan/ut/www-spr/data/db.js" db <- db_load_utf8 fn length db == 1334 db_store_utf8 "/tmp/sp.js" db    oSafe Load  r from .    pNone( HFunction 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. 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)] 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 ^ (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) & 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"] & 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) == LT m2 if contour is all descending, equal or ascending. Vlet c = ["abc","bbb","cba"] in map (uniform.contour_description) c == [True,True,True] m" if contour does not containt any ` 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 == True Are  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) == True Example 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)]0 . 0 *   qNone%   () joins  ( equivalent intervals from morphologies m and n.  : () determines an interval given a sequence and an index. Distance function, ordinarily n below is in ,  or . 9   . 8   .   f. Square.    f.      f.     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]     . 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.6 f at indices i and i+1 of x. 5map (ix_dif (-) [0,1,3,6,10]) [0..3] == [-1,-2,-3,-4]    4map (abs_ix_dif (-) [0,2,4,1,0]) [0..3] == [2,2,3,1]     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 H ^. Udirection_interval [5,9,3,2] == [LT,GT,GT] direction_interval [2,5,6,6] == [LT,LT,EQ] Histogram of list of 2s. 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] == 0 Ordered 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] == r 2Unordered 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)+ + + + rNone  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 3    sNone 'interval (0,11) to interval class (0,6) degree of intersection -The sum of the pointwise absolute difference. 4The number of places that are, pointwise, not equal. loc_dif_n "test" "pest" == 1 degree of intersection  (http://localhost/rd/?t=j&e=2016-04-04.md,                           ! " #,                           ! " #,                           ! " #,                           ! " #tSafe $Clef with octave offset. (Clef enumeration type. .Give 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 == Nothing / Suggest a  $ given a . :map clef_suggest [c2,c4] == [Clef Bass (-1),Clef Treble 0] 0Set  ' to 0. 1Set  ' to be no further than r from 0. $ % & ' ( ) * + , - . / 0 1 $ % & ' ( ) * + , - . / 0 1 ( ) * + , - $ % & ' . / 0 1 $ % & ' ( ) * + , - . / 0 1uSafe A.Specify subset as list of families and scales. TEnumeration of Gamelan scales. W#Enumeration of Gamelan instruments. X'Bonang Barung (horizontal gong, middle) Y&Bonang Panerus (horizontal gong, high) Z%Gender Barung (key&resonator, middle) [&Gender Panembung (key&resonator, high) \/Gender Panembung, Slenthem (key&resonator, low) ]Gong Ageng (hanging gong, low) ^#Gong Suwukan (hanging gong, middle) _Kempul (hanging gong, middle) ` Kempyang (horizontal gong, high) aKenong (horizontal gong, low) bKetuk (horizontal gong, middle) c!Saron Barung, Saron (key, middle) dSaron Demung, Demung (key, low) e!Saron Panerus, Peking (key, high) f+Enumeration of gamelan instrument families. k with error message. l of 0.01. mUniverse pClef appropriate for  W. vConstructor for  B without  frequency or  annotation. wTones are considered  equivalent if they have the same  W and  H. }0Fractional (rational) 24-et midi note number of  B. 0Fractional (rational) 24-et midi note number of  B. Extract subset of  :. Given a  : , find those  Bs that are within  of  Q. Compare  Bs by frequency.  B0s without frequency compare as if at frequency 0. If all f of a are 3 b, then 3 [b], else +.  Orderable if frequency is given.d 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 { | } ~  c 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 { | } ~  d k l f g h i j m W X Y Z [ \ ] ^ _ ` a b c d e n o p q T U V S R Q P L M N O r s H I J K t B C D E F G u v w x y z { | } ~  A ; < = > ? @ : 9 8 @ 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 { | } ~  vSafe Voice & part number. Table giving ranges for  s.  Voice types. "Single character abbreviation for  .  Standard Clef for  . $More or less standard choir ranges,  inclusive. More conservative ranges,  inclusive. Erroring variant. Lookup voice range table. Lookup  . Lookup  . Is p  l and  r. Is p in range for v, (std & safe). )map (in_voice_rng T.c4) [Bass .. Soprano] Given tbl list  s that can sing . std variant. safe variant. Enumeration of SATB voices.  Names of  .   of   as s. k part choir, ordered by voice.   grouped in parts. map (map part_nm) (ch_parts 8) Abreviated name for part. part_nm (Soprano,1) == "S1" k SATB choirs, grouped by choir.  k_ch_groups 2 n of  . Two k! part SATB choirs in score order. %map part_nm (concat (dbl_ch_parts 8))   for  s.     wSafe Given n* in (0,255) make two character hex string. 5mapMaybe byte_hex_pp [0x0F,0xF0,0xF0F] == ["0F","F0"] Erroring variant.  of  of  . &byte_seq_hex_pp [0x0F,0xF0] == "0F F0" &Read two character hexadecimal string.  Load binary U8 sequence from file. Load hexadecimal text U8 sequence from file. Store U81 sequence as hexadecimal text, 16 words per line. xSafe Braille coding data. Elements are: (ASCII HEX,ASCII CHAR,DOT LIST,UNICODE CHAR,MEANING). The dot numbers are in column order. ASCII ' of  . Unicode ' of  .  Dot list of  . ASCII Braille table. Dall id (map (\(x,c,_,_,_) -> x == fromEnum c) braille_table) == True Lookup   value for unicode character. ?braille_lookup_unicode '(' == Just (0x4E,'N',[1,3,4,5],'(',"n") Lookup  , value for ascii character (case invariant). =braille_lookup_ascii 'N' == Just (0x4E,'N',[1,3,4,5],'(',"n") +The arrangement of the 6-dot patterns into decades, sequences of (1,10,3) cells. The cell to the left of the decade is the empty cell, the two cells to the right are the first two cells of the decade shifted right.For each decade there are two extra cells that shift the first two cells of the decade right one place. Subsequent decades are derived by simple transformation of the first. The second is the first with the addition of dot 3, the third adds dots 3 and 6, the fourth adds dot 6. and the fifth shifts the first down one row.The first decade has the 13 of the 16 4-dot patterns, the remaining 3 are in the fifth decade, that is they are the three 4-dot patterns that are down shifts of a 4-dot pattern. alet trimap f (p,q,r) = (f p,f q,f r) let f = map (fromJust . decode) in map (trimap f) braille_64 $Transcribe ASCII to unicode braille. transcribe_unicode "BRAILLE ASCII CHAR GRID" == "(((( ((((((( ( ( (( ((((((( (" transcribe_unicode "BRAILLE HTML TABLE GRID" == "(((( ((((((( ((((((((((( (" MGenerate a character grid using inidicated values for filled and empty cells. Nlet ch = (' ','.') putStrLn$ transcribe_char_grid ch "BRAILLE ASCII CHAR GRID" tlet ch = (white_circle,black_circle) putStrLn$ string_html_table $ transcribe_char_grid ch "BRAILLE HTML TABLE GRID" /Generate 6-dot grid given (white,black) values. 0dots_grid (0,1) [1,2,3,5] == [[1,0],[1,1],[1,0]]  Decoding. let t0 = ["( ((((((%( (((((,((((((((((( (((((/((((%((((((( (((0(=((/(((((2" ,"( (.(=((((("((*(+((>((((((((/(((( ( (0(((/(()(((( ((((*((((((((((($" ,"(.(((((((8(((7(((((.((((((2"] .concatMap (fromMaybe "#" . decode) (concat t0) Start and end unicode indices. All characters, in sequence. .length braille_seq == 256 putStrLn braille_seq The nth character, zero indexed. ,Two element index, 255 * 255 = 65025 places. map braille_ix [100,300] )HTML character encoding (as hex integer). &unwords $ map unicode_html braille_seq White (empty) circle. Black (filled) circle. Shaded (hatched) circle. !Table of one letter contractions.    ySafe                 zSafe 8Bjorklund's algorithm to construct a binary sequence of n bits with k ones such that the k7 ones are distributed as evenly as possible among the (n - k ) zeroes. objorklund (5,9) == [True,False,True,False,True,False,True,False,True] map xdot (bjorklund (5,9)) == "x.x.x.x.x" let {es = [(2,[3,5]),(3,[4,5,8]),(4,[7,9,12,15]),(5,[6,7,8,9,11,12,13,16]) ,(6,[7,13]),(7,[8,9,10,12,15,16,17,18]),(8,[17,19]) ,(9,[14,16,22,23]),(11,[12,24]),(13,[24]),(15,[34])] ;es' = concatMap (\(i,j) -> map ((,) i) j) es} in mapM_ (putStrLn . euler_pp') es' > E(2,3) [] (12) > E(2,5) [] (23) > E(3,4) [] (112) > E(3,5) [] (221) > E(3,8) [] (332) > E(4,7) [] (2221) > E(4,9) [] (2223) > E(4,12) [] (3333) > E(4,15) [] (4443) > E(5,6) [] (11112) > E(5,7) [] (21211) > E(5,8) [] (21212) > E(5,9) [] (22221) > E(5,11) [] (22223) > E(5,12) [] (32322) > E(5,13) [] (32323) > E(5,16) [] (33334) > E(6,7) [] (111112) > E(6,13) [] (222223) > E(7,8) [] (1111112) > E(7,9) [] (2112111) > E(7,10) [] (2121211) > E(7,12) [] (2122122) > E(7,15) [] (2222223) > E(7,16) [] (3223222) > E(7,17) [] (3232322) > E(7,18) [] (3232323) > E(8,17) [] (22222223) > E(8,19) [] (32232232) > E(9,14) [] (212121212) > E(9,16) [] (212221222) > E(9,22) [] (323232322) > E(9,23) [] (323232323) > E(11,12) [] (11111111112) > E(11,24) [] (32222322222) > E(13,24) [] (2122222122222) > E(15,34) [] (322232223222322)  of  . 6map xdot' (bjorklund_r 2 (5,16)) == "" Pretty printer, generalise. Unicode form, ie. . 6euler_pp' (7,12) == "E(7,12) [] (2122122)" ASCII form, ie. x.. 5euler_pp (7,12) == "E(7,12) [x.xx.x.xx.x.] (2122122)" xdot notation for pattern. )map xdot (bjorklund (5,9)) == "x.x.x.x.x" Unicode variant. amap xdot' (bjorklund (5,12)) == "" map xdot' (bjorklund (5,16)) == "" The  & of a pattern is the distance between m values. %iseq (bjorklund (5,9)) == [2,2,2,2,1]   of pattern as compact string. 'iseq_str (bjorklund (5,9)) == "(22221)"                                {Safe  Generate n place bit sequence for x. 8Given bit sequence (most to least significant) generate  value. :set -XBinaryLiterals pack_bitseq [True,False,True,False] == 0b1010 pack_bitseq [True,False,False,True,False,False] == 0b100100 0b100100 == 36   of  . R:set -XBinaryLiterals 0xF0 == 0b11110000 gen_bitseq_pp 8 (0xF0::Int) == "11110000"                    |Safe] }(sum={6,7,8,9}, (yarrow probablity={1,3,5,7}/16, three-coin probablity={2,6}/16, name,signification,symbol)) Line, indicated as sum. 7Lines L6 and L7 are unbroken (since L6 is becoming L7). !&Seven character ASCII string for line. "&Is line (ie. sum) moving (ie. 6 or 9). #COld yin (L6) becomes yang (L7), and old yang (L9) becomes yin (L8). $Hexagrams are drawn upwards. %>Sequence of sum values assigned to ascending four bit numbers. pimport Music.Theory.Bits zip (map (gen_bitseq_pp 4) [0::Int .. 15]) (map line_ascii_pp_err four_coin_sequence) &AGenerate hexagram (ie. sequence of six lines given by sum) using  %. 1four_coin_gen_hexagram >>= putStrLn . hexagram_pp ' of  ". (If  ' then derive it. wh <- four_coin_gen_hexagram putStrLn (hexagram_pp h) maybe (return ()) (putStrLn . hexagram_pp) (hexagram_complement h) )&Names of hexagrams, in King Wen order. length hexagram_names == 64 */Unicode hexagram characters, in King Wen order. Ximport Data.List.Split {- split -} mapM_ putStrLn (chunksOf 8 hexagram_unicode_sequence)          ! " # $ % & ' ( ) * + , - .          ! " # $ % & ' ( ) * + , - .         ! " #  $ % & ' ( ) * + , - .          ! " # $ % & ' ( ) * + , - .}Safe 1#Inclusive range of cell references. 2 Cell reference, column then row. 3"Inclusive range of row references. 41-indexed row reference. 5%Inclusive range of column references. 6AD indexed case-insensitive column references. The column following Z is AA. 9Zero index of  4. :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 . 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" A Bimap of  <. Gcolumn_indices ("b","p") == (1,15) column_indices ("B","IT") == (1,253) BType specialised . \column_range ("L","R") == ["L","M","N","O","P","Q","R"] Data.Ix.range ('L','R') == "LMNOPQR" CType specialised . 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] DType specialised . _map column_range_size [("A","Z"),("AA","ZZ")] == [26,26 * 26] Data.Ix.rangeSize ('A','Z') == 26 EType specialised . F0The standard uppermost leftmost cell reference, A1. +Just cell_ref_minima == parse_cell_ref "A1" G<Cell reference parser for standard notation of (column,row). )parse_cell_ref "CC348" == Just ("CC",348) JCell reference pretty printer. !cell_ref_pp ("CC",348) == "CC348" KTranslate cell reference to 0-indexed pair. Ycell_index ("CC",348) == (80,347) Data.Ix.index (("AA",1),("ZZ",999)) ("CC",348) == 54293 LInverse of cell_index. Yindex_to_cell (80,347) == (Column_Ref "CC",348) index_to_cell (4,5) == (Column_Ref "E",6) NType specialised , 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 O Variant of  N 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)) == r& 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 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O& 6 7 8 V U T S R Q P 5 4 9 3 2 1 : ; < = > ? @ A B C D E F G H I J K L M N O$ 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~Safe Y(column,row), rows descend', ie. down is positive, up is negative. Z (column,row) _Segment  Y into a sequence of unit steps. ~let r = [[(0,0)],[(0,1)],[(0,1),(-1,0)],[(0,1),(0,1),(0,1),(-1,0),(-1,0)]] in map segment_vec [(0,0),(0,1),(-1,1),(-2,3)] == r b-Directions are D=down, L=left, R=right, U=up. cuReads either S|D W|L E|R N|U, reverse lookup gives SWEN. A period indicates (0,0). S=south, W=west, E=east, N=north. g&Direction sequence to cell references. W X Y Z [ \ ] ^ _ ` a b c d e f g W X Y Z [ \ ] ^ _ ` a b c d e f g Z Y [ \ ] ^ _ ` a X b W c d e f g W X Y Z [ \ ] ^ _ ` a b c d e f gNone h i j k l m n o p q r s t u v w x h i j k l m n o p q r s t u v w x i j k h l m n o p q r s t u v w x h i j k l m n o p q r s t u v w xSafe {CSV table, ie. a  | with 7 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?  Alias for , allow linebreaks in fields.  Alias for ', allow characters other than , as delimiter. 2When reading a CSV file is the first row a header? MDefault CSV options, no header, comma delimiter, no linebreaks, no alignment. Read  { from CSV file. Read  | only with  . Read and process CSV  {. Align table according to  ~. Icsv_table_align CSV_No_Align [["a","row","and"],["then","another","one"]]  Pretty-print  {.  of  . Write  | only (no header) with  . 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 Array. 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  . Read irregular CSVE file, ie. rows may have any number of columns, including no columns.# y z { | } ~  # y z { | } ~  # ~  } | { z y y z { | } ~  Safe ((p0=midi-note,p1=velocity,channel,param) rMidi note data, the type parameters are to allow for fractional note & velocity values. The command is a string, on and off- are standard, other commands may be present. @unwords csv_mnd_hdr == "time on/off note velocity channel param"  Channel values are 4-bit (0-15). If r is whole to k/ places then show as integer, else as float to k places. The required header field. Midi note data. let fn = "/home/rohan/cvs/uc/uc-26/daily-practice/2014-08-13.1.csv" m <- csv_mnd_read fn :: IO [MND Double Double] length m == 17655 csv_mnd_write 4 "/tmp/t.csv" m Writer. Translate from Tseq form to Wseq form. Ignores non on/off messages. Tseq form of  8, channel information is retained, off-velocity is zero. Tseq form of   , data is . Message should be note for note data. Midi note/duration data. Writer. Ignores non note messages. Wseq form of  . Wseq form of  . EParse either MND or MNDD data to Wseq, CSV type is decided by header.    Safe dLoad possibly sparse and possibly one-to-many (midi-note-number,cps-frequency) table from CSV file. !load_cps_tbl "/home/rohan/dr.csv" Load scala scl file as . Load scala file and apply . Load scala file and apply . 'Lookup first matching element in table. 8Randomly choose from elements in table, equal weighting. KLoad tuning table with stateful selection function for one-to-many entries. Safe BMatrix indices are written (row,column) & are here _zero_ indexed. -Matrix dimensions are written (rows,columns). Append a sequence of nil$ (or default) values to each row of tbl7 so to make it regular (ie. all rows of equal length).  Translate   by row and column delta. !ix_translate (1,2) (3,4) == (4,6) Modulo   by  . ix_modulo (4,4) (3,7) == (3,3) 8Given number of columns and row index, list row indices. &row_indices 3 1 == [(1,0),(1,1),(1,2)] ;Given number of rows and column index, list column indices. )column_indices 3 1 == [(0,1),(1,1),(2,1)] LAll zero-indexed matrix indices, in row order. This is the order given by r. qmatrix_indices (2,3) == [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2)] sort (matrix_indices (2,3)) == matrix_indices (2,3) Corner indices of given  , in row order. 8matrix_corner_indices (2,3) == [(0,0),(0,2),(1,0),(1,2)] 3Parallelogram corner indices, given as rectangular  ' with an offset for the lower indices. Cparallelogram_corner_indices ((2,3),2) == [(0,0),(0,2),(1,2),(1,4)] Apply   and   for all  , ie. all translations of a shape in row order. The resulting  . sets are not sorted and may have duplicates. Bconcat (all_ix_translations (2,3) [(0,0)]) == matrix_indices (2,3) /Sort sets into row order and remove duplicates.    Safe #Optional header row then data rows. ,Join second table to right of initial table. 2Add a row number column at the front of the table. JMarkdown table, perhaps with header. Table is in row order. Options are pad_left and eq_width. vlet tbl = [["a","bc","def"],["ghij","klm","no","p"]] putStrLn$unlines$"": md_table_opt (True,True," ") (Nothing,tbl) z of  . Variant relying on & 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 o variant.  Three-tuple o variant. rMatrix form, ie. header in both first row and first column, in each case displaced by one location which is empty. tlet h = (map return "abc",map return "efgh") let t = md_matrix "" h (map (map show) [[1,2,3,4],[2,3,4,1],[3,4,1,2]]) putStrLn $ unlines $ md_table' t - - - - - e f g h a 1 2 3 4 b 2 3 4 1 c 3 4 1 2 - - - - - Variant that takes a o function and a header decoration function. MD embolden function.   with o and markdown bold7 annotations for header. the header cells are in bold.    None 7Forte prime forms of the twelve trichordal set classes. length trichords == 12 5Is a pcset self-inversional, ie. is the inversion of p a transposition of p. $map (\p -> (p,self_inv p)) trichords  Pretty printer, comma separated. !pcset_pp [0,3,7,10] == "0,3,7,10" *Pretty printer, hexadecimal, no separator. !pcset_pp_hex [0,3,7,10] == "037A" /Forte prime form of the all-trichord hexachord. 4T.sc_name T.mod12 ath == "6-Z17" T.sc "6-Z17" == ath Is p an instance of  .  Table 1, p.20 length ath_univ == 24  Calculate ( of pcset, which must be an instance of  . ,ath_tni [1,2,3,7,8,11] == T.TTO 3 False True Give label for instance of  -, prime forms are written H and inversions h. ath_pp [1,2,3,7,8,11] == "h3" $The twenty three-element subsets of  . length ath_trichords == 20  of   and p$, ie. the pitch classes that are in   and not in p. !ath_complement [0,1,2] == [4,7,8] p is a pcset, q a sc, calculate pcsets in q that with p form  . math_completions [0,1,2] (T.sc "3-3") == [[6,7,10],[4,7,8]] ath_completions [6,7,10] (T.sc "3-5") == [[1,2,8]]OSelf-inversional pcsets are drawn in a double circle, other pcsets in a circle.9      9      9       9            !"#$%&'()*+,-./0123456789:;< = > ? @ 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 { | } ~                                                                                                                                                         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./01234566789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./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#l#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${$|%}%}%~%%%%%%%%%%%%%%&&&&&&&&&&&&&&\&&&&&^'''''''''''''''''''''''''''''(())))))))))))))))**[************+,,,,--------.//////////////0000000000000000000000000000 0 0 0 0 0000000000000000000 1!1"1#2$2%3&3'3(3)3*3+3,3-3.3/303132333435363738393:3;3<3=3>3?3@3A3B3C3D3E3F4:4G4H4I44444J4K4L4M4N4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4\4]4^4_4`4a4b4c4d4e4f4g4h4i4j4k4l4m5n5o5p5q6r6s7t7u8v8w8x8y8z8{9|9}9~99999999999999999999999999:::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;<<<<================>>>>>>>>>>>>>>>>>>>>>>>>>??@@@@@@@@@@@@@{@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @ @@@ @ AABBBBBBBBBBBBBBBBB B!B"B#B$B%B&B'B(C)C*C+C,C-C.C/C0C1C2C3C4C5C6C7C8C9C:C;C<C=C>C?C@CACBCCDDDEDFDGDHDIDJDKDLDMENEOEPEQERESETEUEVEWEXEYEZE[E\E]E^E_E`EaEbEcEdEeEfEgEhEiEjEkElEmEnEoEpEqErEsEtEuEvEwExEyEzE{E|E}E~EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H !H "H #H $H %H &H 'H (H )H *H +H ,H -H .H /H 0H 1H 2H 3H 4H 5H 6H 7H 8H 9H :I ;I <I =I >I ?I @II AI BI CI DI EI FI GI HI IJ JJ KJ LJ MJ NJ OJ PJ QK RK SL TL UL VL WL XL YL ZL [L \L ]L ^L _M `M aM bM cM dM eM fM gM hM iM jM kM lM mM nM oM pM qM rM sN tN uO vO wO xO yO zO {O |O }O ~O O P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P Q Q Q Q Q_Q Q Q QRQ Q Q Q Q Q Q R R R R R R R R R S S S S S S S S S S S S T T T U U U U U U U U U U U U U U U U U U U U U U U U U U V V W W W W X X X X X X X X X YmY Y Z Z Z Z Z Z [ [ [ [ [ [ [ [ [ [ [ [:[ [ [d[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ ![ "[ #[ $[ %[ &[ '[ ([ )\\\ *\ +\ ,\ -\ .\ /\ 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^ [^ \^ ]^n^ ^^ _^ `^ 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 a a a a a a a a a a a a a b b b b b b b b b b b c c c c c c c c c c c c c c c c c c c c c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e !e "e #e $e %e &e 'e (e )e *e +e ,e -e .e /e 0e 1e 2e 3e 4e 5e 6e 7e 8e 9f :f ;f <f =f >f ?f @f Ag Bg Cg Dg Eh Fh Gh Hh Ih Jhh Kh Lh Mh Nh Oh Ph Qh Rh Sh Th Uh Vh Wh Xh Yh Zh [h \h ]h ^h _h `h ah bh ch dh eh fh gh hh ih jh kh lh mh nh oh phh qh rh sh th ui vi wi xi yi zi {i |i }i ~i i i j j j j j j j k k k k k k k k k k k k k k k k k k l l l ll&l l l l l l l l l l l l m m m mm&m m m m m m m m m m m m m m m m m m m m m m m m m n nnn n n n n n n n o o p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p q q qq q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q r r ss_s !s "ss #ss $s %s &s 's (s )s *s +s ,s -s .s /s 0s 1s 2s 3s 4s 5s 6s 7s 8s 9s :s ;s <s =s >s ?s @s As Bs Cs Ds Es Fs Gs Ht It It Jt Kt Lt Mt Nt Ot Pt Qt Rt St Tt Ut Vt Wt Xt Yt Zt [u \u ]u ^u _u _u `u au bu cu du eu eu fu gu hu iu ju ju ku luuu mu nu ou pu quu Fu ru su tu uu vu wu xu yu zu {u |u }u ~u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u uuuu u u u u u u v v vv Mv Nv Ov v v v v vv v v v v v v v v v v v v v v v v v v v v v v w w w w w w w w w x x x x x x x x x x x x xx x x x x x x x x y y y y y y y y y y y y z z z z z z z z z z !z "zz #{ ${ %{ &{ '{ (| )| *| +| ,| -| .| /| 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| :| ;| <| =| >| ?| @| A| B} C} D} E} F} G} H} 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 1 z  { | } ~                         R     Q '        ! " #$%&$'( )*+,-./.0.12,3456789:;<=>?@ A,B?CDE,FGHGI89J K L89M N O,P,Q89R,S,T,U,V,WDX.Y,Z[\,],^,_`ab cd[e[Gffg[h8ijklmnmo[pqr[s[tfbuvfwfxfyfz8i{[|89}[~[q8989896G[,8ifm8i89G  8i8i8iGG,,8im,.8i`ff,[.,.8i[GG89[[hmt-0.16-G09emlOzkXQ5PBDha8rWcoMusic.Theory.Z12.Morris_1974Music.Theory.Z12.LiteratureMusic.Theory.TupleMusic.Theory.Time.NotationMusic.Theory.Time.DurationMusic.Theory.StringMusic.Theory.ReadMusic.Theory.ParseMusic.Theory.OrdMusic.Theory.MonadMusic.Theory.MaybeMusic.Theory.Math.OEISMusic.Theory.Math.ConvertMusic.Theory.MathMusic.Theory.Meter.Barlow_1987Music.Theory.MapMusic.Theory.ListMusic.Theory.PermutationsMusic.Theory.Permutations.ListMusic.Theory.Xenakis.S4%Music.Theory.Permutations.Morris_1984Music.Theory.Pitch.NoteMusic.Theory.PitchMusic.Theory.Pitch.NameMusic.Theory.Pitch.Note.Name!Music.Theory.Pitch.Spelling.Table#Music.Theory.Pitch.Spelling.ClusterMusic.Theory.Set.ListMusic.Theory.Set.SetMusic.Theory.Tiling.Canon Music.Theory.Tiling.Johnson_2004 Music.Theory.Tiling.Johnson_2009Music.Theory.Time.Bel1990.RMusic.Theory.WyschnegradskyMusic.Theory.Xenakis.SieveMusic.Theory.ZMusic.Theory.Z.TTOMusic.Theory.Z.Clough_1979Music.Theory.Z.SROMusic.Theory.Z.Drape_1999Music.Theory.Z.Read_1978Music.Theory.Z12"Music.Theory.Z12.Morris_1987.ParseMusic.Theory.Z12.Read_1978Music.Theory.Z12.TTOMusic.Theory.Z12.Morris_1987Music.Theory.Z12.SROMusic.Theory.IntervalMusic.Theory.Interval.NameMusic.Theory.Interval.SpellingMusic.Theory.KeyMusic.Theory.Pitch.ChordMusic.Theory.Pitch.Spelling.KeyMusic.Theory.Pitch.SpellingMusic.Theory.Instrument.NamesMusic.Theory.IOMusic.Theory.UnicodeMusic.Theory.Z.Forte_1973Music.Theory.Z12.Castren_1994Music.Theory.Z12.Lewin_1980Music.Theory.Z12.Forte_1973 Music.Theory.Metric.Buchler_1998Music.Theory.Metric.Morris_1980Music.Theory.Z12.Drape_1999Music.Theory.Z12.Rahn_1980Music.Theory.Graph.FGLMusic.Theory.Graph.DotMusic.Theory.FunctionMusic.Theory.Time.SeqMusic.Theory.EnumMusic.Theory.EitherMusic.Theory.Tuning!Music.Theory.Interval.Barlow_1987Music.Theory.Tuning.Alves_1997Music.Theory.Tuning.DB.AlvesMusic.Theory.Tuning.DB.Gann+Music.Theory.Tuning.DB.Microtonal_SynthesisMusic.Theory.Tuning.DB.Riley#Music.Theory.Tuning.DB.WerckmeisterMusic.Theory.Tuning.ETMusic.Theory.Tuning.EulerMusic.Theory.Tuning.Gann_1993Music.Theory.Tuning.Meyer_1929!Music.Theory.Tuning.Polansky_1978!Music.Theory.Tuning.Polansky_1984"Music.Theory.Tuning.Polansky_1985cMusic.Theory.Tuning.DB!Music.Theory.Tuning.Polansky_1990!Music.Theory.Tuning.Sethares_1994Music.Theory.Tuning.SyntonicMusic.Theory.Dynamic_MarkMusic.Theory.DurationMusic.Theory.Duration.Name'Music.Theory.Duration.Name.AbbreviationMusic.Theory.Duration.RQ Music.Theory.Duration.AnnotationMusic.Theory.Duration.RQ.Tied!Music.Theory.Duration.RQ.DivisionMusic.Theory.Time_SignatureMusic.Theory.Duration.CT%Music.Theory.Duration.Sequence.NotateMusic.Theory.Tempo_MarkingMusic.Theory.DirectoryMusic.Theory.Tuning.Scala"Music.Theory.Tuning.Rosenboom_1979"Music.Theory.Tuning.Scala.IntervalMusic.Theory.Tuning.Scala.ModeMusic.Theory.DB.PlainMusic.Theory.DB.CommonMusic.Theory.DB.JSONMusic.Theory.DB.CSV"Music.Theory.Contour.Polansky_1992!Music.Theory.Metric.Polansky_1996Music.Theory.CombinationsMusic.Theory.Graph.Johnson_2014Music.Theory.ClefMusic.Theory.GamelanMusic.Theory.Instrument.ChoirMusic.Theory.ByteMusic.Theory.Braille&Music.Theory.Block_Design.Johnson_2007Music.Theory.BjorklundMusic.Theory.BitsMusic.Theory.Random.I_ChingMusic.Theory.Array.Cell_RefMusic.Theory.Array.DirectionMusic.Theory.Graph.Deacon_1934Music.Theory.Array.CSVMusic.Theory.Array.CSV.Midi.MNDMusic.Theory.Tuning.LoadMusic.Theory.ArrayMusic.Theory.Array.MDMusic.Theory.Z.Boros_1990Music.Theory.Show Data.ListfilterT pc_spell_ksfold_to_octave Data.EitherrightsData.IxindexrangeinRange rangeSizefromListall_interval_m all_intervalsc_dbT12T11T10T9T8T7T6T5T4T3T2p2_swap t2_from_list t2_to_listt2_swapt2_map t2_zipWitht2_infixt2_join t2_concatt2_sortp3_rotate_leftp3_fstp3_sndp3_third t3_from_list t3_to_listt3_rotate_leftt3_fstt3_sndt3_thirdt3_map t3_zipWitht3_infixt3_joinp4_fstp4_sndp4_third p4_fourth t4_from_list t4_to_listt4_fstt4_sndt4_third t4_fourtht4_map t4_zipWitht4_infixt4_joinp5_fstp5_sndp5_third p5_fourthp5_fifth p5_from_list p5_to_list t5_from_list t5_to_listt5_mapt5_fstt5_snd t5_fourtht5_fiftht5_infixt5_joinp6_fstp6_sndp6_third p6_fourthp6_fifthp6_sixth t6_from_list t6_to_listt6_map t7_to_listt7_map t8_to_listt8_mapp8_third t9_to_listt9_map t10_to_listt10_map t11_to_listt11_map t12_to_list t12_from_list t12_foldr1t12_sumMINCSECMinCsecMINSECMinSecFSEC sec_to_minsec minsec_to_sec minsec_binop minsec_sub minsec_diff minsec_add minsec_sumfsec_to_minsec minsec_pp minsec_parsefsec_to_mincsecmincsec_to_fsecmincsec_to_cseccsec_to_mincsecmincsec_pp_opt mincsec_pp mincsec_binopspan_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$fReadDuration $fEqDuration filter_crdelete_trailing_whitespacereads_to_read_precisereads_to_read_precise_err read_mayberead_defread_err reads_exactreads_exact_err read_integral_allow_commas_mayberead_integral_allow_commas_errread_int_allow_commasread_ratio_with_div_errread_ratio_allow_commas_errdelete_trailing_point(read_fractional_allow_trailing_point_errread_maybe_intread_intread_maybe_double read_doubleread_maybe_rational read_rational read_hex_errPis_char parse_int ord_to_int int_to_ord ord_invert order_pair sort_pair sort_pair_mrepeatM_ iterateM_ from_just maybe_unzip maybe_latch maybe_latch1 maybe_map maybe_eq_by maybe_join' maybe_joinmaybe_predicate maybe_filter filter_maybea000290a002267a126709a126710 real_to_floatreal_to_doubledouble_to_floatfloat_to_doubleword8_to_word16word8_to_word32word8_to_word64 word8_to_int8word8_to_int16word8_to_int32word8_to_int64 word8_to_intword8_to_integerword8_to_floatword8_to_doubleword16_to_word8word16_to_word32word16_to_word64word16_to_int8word16_to_int16word16_to_int32word16_to_int64 word16_to_intword16_to_integerword16_to_floatword16_to_doubleword32_to_word8word32_to_word16word32_to_word64word32_to_int8word32_to_int16word32_to_int32word32_to_int64 word32_to_intword32_to_integerword32_to_floatword32_to_doubleword64_to_word8word64_to_word16word64_to_word32word64_to_int8word64_to_int16word64_to_int32word64_to_int64 word64_to_intword64_to_integerword64_to_floatword64_to_double int8_to_word8int8_to_word16int8_to_word32int8_to_word64 int8_to_int16 int8_to_int32 int8_to_int64 int8_to_intint8_to_integer int8_to_floatint8_to_doubleint16_to_word8int16_to_word16int16_to_word32int16_to_word64 int16_to_int8int16_to_int32int16_to_int64 int16_to_intint16_to_integerint16_to_floatint16_to_doubleint32_to_word8int32_to_word16int32_to_word32int32_to_word64 int32_to_int8int32_to_int16int32_to_int64 int32_to_intint32_to_integerint32_to_floatint32_to_doubleint64_to_word8int64_to_word16int64_to_word32int64_to_word64 int64_to_int8int64_to_int16int64_to_int32 int64_to_intint64_to_integerint64_to_floatint64_to_double int_to_word8 int_to_word16 int_to_word32 int_to_word64 int_to_int8 int_to_int16 int_to_int32 int_to_int64int_to_integer int_to_float int_to_doubleinteger_to_word8integer_to_word16integer_to_word32integer_to_word64integer_to_int8integer_to_int16integer_to_int32integer_to_int64integer_to_intinteger_to_floatinteger_to_doubleword8_to_word16_maybeword8_to_word32_maybeword8_to_word64_maybeword8_to_int8_maybeword8_to_int16_maybeword8_to_int32_maybeword8_to_int64_maybeword8_to_int_maybeword16_to_word8_maybeword16_to_word32_maybeword16_to_word64_maybeword16_to_int8_maybeword16_to_int16_maybeword16_to_int32_maybeword16_to_int64_maybeword16_to_int_maybeword32_to_word8_maybeword32_to_word16_maybeword32_to_word64_maybeword32_to_int8_maybeword32_to_int16_maybeword32_to_int32_maybeword32_to_int64_maybeword32_to_int_maybeword64_to_word8_maybeword64_to_word16_maybeword64_to_word32_maybeword64_to_int8_maybeword64_to_int16_maybeword64_to_int32_maybeword64_to_int64_maybeword64_to_int_maybeint8_to_word8_maybeint8_to_word16_maybeint8_to_word32_maybeint8_to_word64_maybeint8_to_int16_maybeint8_to_int32_maybeint8_to_int64_maybeint8_to_int_maybeint16_to_word8_maybeint16_to_word16_maybeint16_to_word32_maybeint16_to_word64_maybeint16_to_int8_maybeint16_to_int32_maybeint16_to_int64_maybeint16_to_int_maybeint32_to_word8_maybeint32_to_word16_maybeint32_to_word32_maybeint32_to_word64_maybeint32_to_int8_maybeint32_to_int16_maybeint32_to_int64_maybeint32_to_int_maybeint64_to_word8_maybeint64_to_word16_maybeint64_to_word32_maybeint64_to_word64_maybeint64_to_int8_maybeint64_to_int16_maybeint64_to_int32_maybeint64_to_int_maybeint_to_word8_maybeint_to_word16_maybeint_to_word32_maybeint_to_word64_maybeint_to_int8_maybeint_to_int16_maybeint_to_int32_maybeint_to_int64_maybeinteger_to_word8_maybeinteger_to_word16_maybeinteger_to_word32_maybeinteger_to_word64_maybeinteger_to_int8_maybeinteger_to_int16_maybeinteger_to_int32_maybeinteger_to_int64_maybeinteger_to_int_maybeRintegral_and_fractional_partsinteger_and_fractional_partsfractional_part real_floorreal_floor_int real_roundreal_round_intzero_to_precisionwhole_to_precision sawtooth_wave rational_ppratio_pprational_simplifies rational_ndrational_wholerational_whole_errshow_rational_decimal realfloat_ppreal_ppfloat_pp double_pp num_diff_strfloor_fround_tooi_mod oi_divMod i_square_rootin_open_intervalin_closed_intervalin_left_half_open_intervalin_right_half_open_intervalS_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'map_lookup_errmap_ix map_ix_err Compare_Fslicesectionbracket unbracket' unbracket unbracket_err bracket_l separate_aton_elem split_beforegenericRotate_left rotate_leftgenericRotate_right rotate_rightrotaterotate_r rotationsrotate_starting_fromrotate_starting_from_erradjadj' genericAdj2adj2close adj2_cyclic interleaveinterleave_set deinterleave deinterleave2interleave_continueinterleave_rotationsgeneric_histogram histogram_by histogram duplicates_by duplicatessegments intersect_lunion_l adj_intersectcycles filter_haltreplace replace_atgroup_oncollate_on_adjacentcollate_adjacent collate_oncollate uncollatewith_keydx_ddx_d'd_dx_byd_dx difference is_subset is_superset subsequenceelem_index_uniquelookup_err_msg lookup_err lookup_defreverse_lookup find_bounds'decide_nearest'decide_nearestfind_nearest_err find_nearestfind_bounds_scl find_bounds drop_last dropRightdropWhileRight take_righttake_while_rightat_headat_lastseparate_last' separate_lastindicate_repetitions zip_with_adjcompare_adjacent_bycompare_adjacentadjacent_groupBy group_ranges group_just all_equalall_eq sort_group_onmconstwo_stage_comparen_stage_comparesort_tosort_onsort_by_two_stagesort_by_n_stagemerge_bymerge_onmerge_by_two_stagemerge merge_set_by merge_setmerge_by_resolvefind_non_ascendingis_ascending_by is_ascending elem_orderedelemIndex_ordered zip_with_krzip_with_perhaps_rhsfill_gaps_ascendingfill_gaps_ascending'minmaxbimap1 pad_rightpad_left embedding embedding_err is_embeddingall_embeddings_mall_embeddingsunlist1 unlist1_err adopt_shape adopt_shape_m group_tree remove_ix operate_ixs select_ixs remove_ixs replace_ix at_cyclic factorialnk_permutationsn_permutations permutationapply_permutationapply_permutation_cnon_invertible from_cyclespermutations_ncomposetwo_lineone_lineone_line_compactmultiplication_table permutationsmultiset_permutationsmultiset_permutations_nFaceF_BackF_FrontF_RightF_LeftF_BottomF_TopRelSeqHalf_SeqLabelABCDD2EE2GG2ILL2Q1Q2Q3Q4Q5Q6Q7Q8Q9Q10Q11Q12 complementfull_seqlowerl_onfib_procseq_of half_seq_ofhalf_seqlabel_of complementaryrelaterelate_l relations relations_lapply_relationapply_relationsapply_relations_lfaces viii_6_lseq viii_7_lseqviii_7 viii_6b_lseq viii_6b_p'viii_6b'viii_6bviii_6_relationsviii_6b_relations $fEqLabel $fOrdLabel $fEnumLabel$fBoundedLabel $fShowLabel$fEqFace $fEnumFace $fBoundedFace $fOrdFace $fShowFaceMethodChangeSwap_AllHoldmethod_changes parse_change split_changes parse_method is_swap_all swap_pair flatten_pairsswap_allnumeric_spelling_tbl to_abbrev gen_swaps derive_holds 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_royalecumenical_surprise_maximus $fEqChange $fShowChange $fEqMethod $fShowMethod Alteration_R Alteration_T DoubleFlatThreeQuarterToneFlatFlatQuarterToneFlatNaturalQuarterToneSharpSharpThreeQuarterToneSharp DoubleSharpNote_TFnote_seqnote_pp note_pc_tbl note_to_pc pc_to_notenote_t_transpose parse_note_t note_spangeneric_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_symbol_tblalteration_symbolsymbol_to_alterationsymbol_to_alteration_isoalteration_iso_tblalteration_iso_malteration_isoalteration_tonhnote_alteration_to_pcnote_alteration_to_pc_errnote_alteration_kspc_note_alteration_ks_tblpc_to_note_alteration_ks alteration_r $fEqNote_T $fEnumNote_T$fBoundedNote_T $fOrdNote_T $fReadNote_T $fShowNote_T$fEqAlteration_T$fEnumAlteration_T$fBoundedAlteration_T$fOrdAlteration_T$fShowAlteration_TPitch_R Midi_Cents Midi_Detune Midi_Detune' Spelling_MSpellingPitchnote alterationoctaveFOctPCFMidiMidiOctPCOctave PitchClassOctave_PitchClassoctave_pitchclass_nrmoctave_pitchclass_trsoctave_pitchclass_to_midimidi_to_octave_pitchclassto_octpc octpc_nrm octpc_trs octpc_range octpc_to_midi midi_to_octpcoctpc_to_fmidifmidi_to_foctpc fmidi_octavefoctpc_to_fmidifmidi_in_octavepitch_clear_quarter_tonepitch_to_octpc pitch_is_12et pitch_to_midipitch_to_fmidi pitch_to_pc pitch_compareoctpc_to_pitch midi_to_pitchfmidi_et12_cents_ppfmidi_to_pitchfmidi_to_pitch_errpitch_tranposefmidi_in_octave_offmidi_in_octave_nearestfmidi_in_octave_abovefmidi_in_octave_belowcps_in_octave'cps_in_octave_nearestcps_in_octave_abovecps_in_octave_above'cps_in_octave_belowpitch_in_octave_nearestpitch_note_raisepitch_note_lower%pitch_rewrite_threequarter_alterationpitch_edit_octavemidi_to_cps_f0 midi_to_cpsfmidi_to_cps_f0 fmidi_to_cpspitch_to_cps_f0 pitch_to_cpscps_to_fmidi_f0 cps_to_fmidi cps_to_midioctpc_to_cps_f0 octpc_to_cps cps_to_octpc cps_octavecents_is_normalmidi_detune_is_normalmidi_detune_normalisemidi_detune_to_cps_f0midi_detune_to_cpsmidi_detune_to_fmidimidi_detune_to_pitchfmidi_to_midi_detunecps_to_midi_detunemidi_detune_nearest_24etmidi_detune_to_midi_cents midi_cents_pp parse_octaveparse_iso_pitch_octparse_iso_pitchparse_iso_pitch_err pitch_pp_optpitch_pppitch_class_pppitch_class_names_12et pitch_pp_iso pitch_pp_hly pitch_pp_tonh pc24et_univpc24et_to_pitch pitch_r_pppitch_r_class_pp $fOrdPitch $fEqPitch $fShowPitch $fEqPitch_R $fShowPitch_Ra0b0bes0ais0bis0c1d1e1f1g1a1b1ces1des1ees1fes1ges1aes1bes1cis1dis1eis1fis1gis1ais1bis1c2d2e2f2g2a2b2ces2des2ees2fes2ges2aes2bes2cis2dis2eis2fis2gis2ais2bis2cisis2disis2eisis2fisis2gisis2aisis2bisis2ceseh2deseh2eeseh2feseh2geseh2aeseh2beseh2ceh2deh2eeh2feh2geh2aeh2beh2cih2dih2eih2fih2gih2aih2bih2cisih2disih2eisih2fisih2gisih2aisih2bisih2c3d3e3f3g3a3b3ces3des3ees3fes3ges3aes3bes3cis3dis3eis3fis3gis3ais3bis3ceses3deses3eeses3feses3geses3aeses3beses3cisis3disis3eisis3fisis3gisis3aisis3bisis3ceseh3deseh3eeseh3feseh3geseh3aeseh3beseh3ceh3deh3eeh3feh3geh3aeh3beh3cih3dih3eih3fih3gih3aih3bih3cisih3disih3eisih3fisih3gisih3aisih3bisih3c4d4e4f4g4a4b4ces4des4ees4fes4ges4aes4bes4cis4dis4eis4fis4gis4ais4bis4ceses4deses4eeses4feses4geses4aeses4beses4cisis4disis4eisis4fisis4gisis4aisis4bisis4ceseh4deseh4eeseh4feseh4geseh4aeseh4beseh4ceh4deh4eeh4feh4geh4aeh4beh4cih4dih4eih4fih4gih4aih4bih4cisih4disih4eisih4fisih4gisih4aisih4bisih4c5d5e5f5g5a5b5ces5des5ees5fes5ges5aes5bes5cis5dis5eis5fis5gis5ais5bis5ceses5deses5eeses5feses5geses5aeses5beses5cisis5disis5eisis5fisis5gisis5aisis5bisis5ceseh5deseh5eeseh5feseh5geseh5aeseh5beseh5ceh5deh5eeh5feh5geh5aeh5beh5cih5dih5eih5fih5gih5aih5bih5cisih5disih5eisih5fisih5gisih5aisih5bisih5c6d6e6f6g6a6b6ces6des6ees6fes6ges6aes6bes6cis6dis6eis6fis6gis6ais6bis6ceseh6deseh6eeseh6feseh6geseh6aeseh6beseh6ceh6deh6eeh6feh6geh6aeh6beh6cih6dih6eih6fih6gih6aih6bih6cisih6disih6eisih6fisih6gisih6aisih6bisih6c7d7e7f7g7a7b7ces7des7ees7fes7ges7aes7bes7cis7dis7eis7fis7gis7ais7bis7c8cis8d8cesesdeseseesesfesesgesesaesesbesescesehdeseheesehfesehgesehaesehbesehcesdeseesfesgesaesbescehdeheehfehgehaehbehcdefgabcihdiheihfihgihaihbihcisdiseisfisgisaisbiscisihdisiheisihfisihgisihaisihbisihcisisdisiseisisfisisgisisaisisbisisSpelling_Tablepc_spell_natural_tblpc_spell_sharp_tblpc_spell_flat_tblpc_spell_ks_tbl pc_spell_tblpc_spell_tbl_kspc_spell_natural_mpc_spell_naturalpc_spell_sharp pc_spell_flatoctpc_to_pitch_ksmidi_to_pitch_ksfmidi_to_pitch_ksmidi_detune_to_pitch_kscluster_normal_ordercluster_normal_order_octpccluster_is_multiple_octavespell_cluster_table spell_clusterspell_cluster_octpcspell_cluster_c4spell_cluster_cspell_cluster_fspell_cluster_leftset n_powersetpowerset powerset'pairstriples expand_set partitionscartesian_productnfold_cartesian_productVSp_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_bp5p7p10p11L_BelL_TermL_StVoiceTimeBelNodeIsoParMulTermValueRestContinueTempoPar_ModePar_Left Par_RightPar_MinPar_MaxPar_Nonepar_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_nodep_non_negative_integerp_non_negative_rationalp_non_negative_doublep_non_negative_numberp_mulp_iso p_char_isop_par p_char_par p_char_belbel_char_parse $fEqPar_Mode$fShowPar_Mode$fEqTerm $fShowTerm$fEqBel $fShowBelRadialCircumferentialnormalise_stepparse_num_sign vec_expand parse_vecadd_m parse_hex_clrparse_hex_clr_int clr_normalise seq_groupiw_pc_ppu3_ix_chu3_ch_ixu3_vec_text_iwu3_vec_text_rw u3_vec_ix u3_ix_radial u3_clr_nm u3_clr_hex u3_clr_rgb u3_radial_ch u3_circ_chu3_ch_seq_to_vecdc9_circdc9_raddc9_ix dc9_clr_hex dc9_clr_rgbu11_circ u11_gen_seq u11_seq_rule ull_rad_textu11_rad u11_clr_hex u11_clr_rgbSieveEmptyUnion Intersection Complementunion intersection∪∩sieve_ppl⋄ normalise is_normalelement i_complementbuildbuildn differentiateeuclid de_meziriacreduce_intersectionreduce $fEqSieve $fShowSieveZis_z_nmod5mod7mod12 lift_unary_Z lift_binary_Zz_addz_subz_mulz_negate z_fromIntegerz_signumz_absto_Zfrom_Z z_modulusz_univ z_complementz_quotz_remdiv_errz_divz_mod z_quotRemz_divMod z_toIntegermod16integral_to_digitis_z16 z16_to_char z16_set_pp z16_seq_pp z16_vec_ppTTOtto_Ttto_Mtto_I tto_identitytto_ppp_tto tto_parse z_tto_univz_tto_f z_tto_apply tto_apply z_tto_relz_pcset$fEqTTO $fShowTTOtranspose_to_zerodpcset_to_chordchord_to_dpcsetdpcset_complementis_ici_to_icis_chordivinf_cmpinfinvertiseqis_z4z_n_univz7_univis_z7SROsro_rsro_Rsro_Tsro_Msro_Isro_ppp_sro sro_parse z_sro_univz_sro_Tn z_sro_TnI z_sro_RTnI z_sro_TnMI z_sro_RTnMI z_sro_applyz_sro_tn z_sro_invert z_sro_tniz_sro_mnz_sro_t_relatedz_sro_ti_relatedz_sro_rti_related z_sro_tn_toz_sro_invert_ix z_tmatrix$fEqSRO $fShowSROrsrsgArrayCodearray_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_primeZ12enumFromThenTo_cycenumFromTo_cycto_Z12 int_to_Z12from_Z12 int_from_Z12 z12_to_char char_to_z12 z12_set_pp z12_seq_pp z12_vec_pppcopcsettto_tn tto_inverttto_tnitto_mntto_m5 tto_t_relatedtto_ti_relatedintsro_tn sro_invertsro_tnisro_mnsro_m5 sro_t_relatedsro_ti_relatedsro_rti_relatedsro_tmi_relatedsro_rtmi_relatedsro_rrtmi_related sro_tn_to sro_invert_ixtmatrixInterval interval_typeinterval_qualityinterval_directioninterval_octave Interval_Q DiminishedMinorPerfectMajor Augmented Interval_TUnisonSecondThirdFourthFifthSixthSeventh interval_tyinterval_q_tbl interval_qinterval_q_reverseinterval_semitonesintervalinvert_intervalquality_difference_mquality_differencepitch_transposecircle_of_fifthsparse_interval_typeparse_interval_qualityinterval_type_degreeinterval_quality_ppparse_intervalparse_interval_err interval_ppstd_interval_names$fEqInterval_T$fEnumInterval_T$fBoundedInterval_T$fOrdInterval_T$fShowInterval_T$fEqInterval_Q$fEnumInterval_Q$fBoundedInterval_Q$fOrdInterval_Q$fShowInterval_Q $fEqInterval$fShowIntervalperfect_fourth perfect_fifth major_seventh i_to_intervalinterval_simplifyKeyMode_T Minor_Mode Major_Modemode_ppmode_identifier_pp mode_parallel mode_pc_seqkey_modekey_sequence_42key_sequence_30 key_parallel key_transpose key_relative key_mediant key_pc_set key_lc_pp key_lc_uc_pp key_lc_iso_ppkey_lc_tonh_ppkey_identifier_ppnote_char_to_keykey_lc_uc_parse key_fifthskey_fifths_tbl fifths_to_key implied_keyimplied_fifthsimplied_key_errimplied_fifths_err $fEqMode_T $fOrdMode_T $fShowMode_TChordCH Chord_Type Diminished_7Half_Diminished Suspended_2 Suspended_4 ExtensionD7M7PCpc_pp extension_tbl extension_dat extension_ppextension_to_pc is_suspendedchord_type_tblchord_type_dat chord_type_ppchord_type_pcset chord_pcsetbass_ppchord_ppm_errorp_note_tp_alteration_t_isop_pcp_mode_m p_chord_type p_extensionp_bassp_chord parse_chord $fEqExtension$fShowExtension$fEqChord_Type$fShowChord_Type $fShowChordpcset_spell_implied_key_fpcset_spell_implied_keyoctpc_spell_implied_keymidi_spell_implied_keyspell_octpc_setspell_midi_setinstrument_db' instrument_dbread_file_utf8_textread_file_utf8read_file_utf8_orwrite_file_utf8read_file_iso_8859_1read_file_locale Unicode_Block Unicode_Table Unicode_Point Unicode_Range Unicode_Indexnon_breaking_hypennon_breaking_spaceunicodeaccidentals_rng_set accidentals notes_rngnotes rests_rngrestsaugmentation_dot clefs_rngclefs notehead_rng noteheadsstem dynamics_rngdynamicsarticulations_rng articulationsunicode_blocksunicode_data_table_readunicode_table_blockunicode_point_hsunicode_table_hsSC_Name t_rotations ti_rotations minimumBy_or t_cmp_prime ti_cmp_prime forte_cmp forte_primet_primeicicvbipsc_univsc_tablesc_table_unicodeforte_prime_name sc_tbl_lookupsc_tbl_lookup_errsc_name'sc_name sc_name_longsc_name_unicodescscsscs_ntics z_relation_ofinv_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_relicv'SATVMINMAXof_c sc_table_n icv_minmaxr_ppsatv_f satv_e_ppsatv_ppsatv_asatv_bsatv satv_minmaxabs_dif satv_n_sumtwo_part_difference_vectortwo_part_difference_vector_setsatsim satsim_tablesatsim_table_histogram$fEqR$fShowRsimasimSIcfcggcgcg_rchn_t0cisegcmplcycd_nmdimdim_nmdoifnfrg_cycfrgic_cycle_vectoric_cycle_vector_ppfrg_hdrfrg_ppess has_sc_pfhas_scicficiici_cicsegisegimbissbmxsnrmnrm_rpcirs1sbsccsi_hdrsi_raw si_raw_ppsispscsrasrotrstrs_mrahn_cmp rahn_primeGRAPH_LEDGE_LGRAPHEDGE G_NODE_SEL_Fg_degree g_partition g_node_lookupg_node_lookup_errug_node_set_impl ml_from_listg_hamiltonian_path_mlug_hamiltonian_path_ml_0g_from_edges_l g_from_edges e_label_seq e_normalise_l e_collate_le_collate_normalised_le_univ_select_edgese_univ_select_u_edgese_path_to_edgese_undirected_eqelem_by e_is_pathPOS_FNG_TYPE G_DIGRAPHG_UGRAPHGR_PP DOT_ATTR_SETDOT_ATTR DOT_VALUEDOT_OPTDOT_KEYsep1 maybe_quote assoc_union dot_key_sep dot_attr_ppdot_attr_set_ppdot_attr_collate dot_attr_ext dot_attr_defgr_pp_lift_node_f gr_pp_id_show br_csl_ppgr_pp_id_br_cslg_type_to_stringg_type_to_edge_symbolg_to_dot g_to_udotconst2 predicate_and predicate_all predicate_or predicate_any.:.::.:::.::::.::::: Begin_EndBeginEndLseqInterpolation_TNoneLinearWseqTseqPseqIseqDseqUseqpseq_zipwseq_zip seq_tspan tseq_tspan wseq_tspan wseq_startwseq_enddseq_duriseq_durpseq_durtseq_durwseq_dur wseq_until wseq_twindowwseq_atwseq_at_window dseq_append iseq_append pseq_append tseq_merge tseq_merge_bytseq_merge_resolve w_compare wseq_mergewseq_merge_settseq_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_latch wseq_sortwseq_discard_durwseq_overlap_fwseq_has_overlapswseq_remove_overlaps seq_unjoin wseq_unjoin wseq_shift wseq_append wseq_concat begin_end_map cmp_begin_endeither_to_begin_endbegin_end_to_eitherbegin_end_partitionbegin_end_trackwseq_begin_endwseq_begin_end_eitherwseq_begin_end_ftseq_begin_end_accumtseq_accumulatewseq_accumulatetseq_begin_end_to_wseq useq_to_dseq useq_to_wseq 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 wseq_cycle' wseq_cycle wseq_cycle_nwseq_cycle_until 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_maybes$fEqInterpolation_T$fEnumInterpolation_T$fShowInterpolation_T $fEqBegin_End$fShowBegin_EndgenericFromEnum genericToEnumenum_from_to_cyclicenum_from_to_reverse enum_univfromLeft fromRightEFG MNN_CPS_TableCPS_Midi_TuningD12_Midi_TuningSparse_Midi_Tuning_ST_FSparse_Midi_Tuning_F Midi_Tuning_FTuningtn_ratios_or_centstn_octave_ratioCentsApproximate_Ratio tn_divisions tn_ratios tn_ratios_errtn_cents tn_cents_itn_cents_octavecents_to_ratiotn_approximate_ratiostn_approximate_ratios_cyclicrecur_noct_diff_to_ratiotn_ratios_lookuptn_approximate_ratios_lookuptn_reconstructed_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_72equal_temperament_96harmonic_seriesharmonic_series_cpsharmonic_series_cps_nsubharmonic_series_cpssubharmonic_series_cps_npartialfold_ratio_to_octave'fold_ratio_to_octave_errfold_ratio_to_octave ratio_nd_summin_byratio_interval_classharmonic_series_cps_derivedharmonic_series_folded_rharmonic_series_folded_charmonic_series_foldedharmonic_series_folded_21cents_et12_difffcents_et12_diffcents_interval_classfcents_interval_class cents_diff_pp cents_diff_brcents_diff_text cents_diff_mdcents_diff_html lift_tuning_flift_sparse_tuning_fd12_midi_tuning_fcps_midi_tuning_fgen_cps_tuning_tbl dtt_lookupdtt_lookup_errgen_dtt_lookup_tblgen_dtt_lookup_f efg_degree efg_tones efg_collate efg_factors efg_ratiosefg_diagram_set $fEqTuning $fShowTuning Table_2_Rowbarlowfactor prime_factorsmultiplicitiesprime_factors_mrational_prime_factors_mrational_prime_factors_tdisharmonicity harmonicity harmonicity_r to_rational from_rationaltable_2 table_2_ppalves_slendro_r alves_slendroalves_pelog_bem_ralves_pelog_bemalves_pelog_barang_ralves_pelog_barangalves_pelog_23467_ralves_pelog_23467harrison_ditone_rharrison_ditonepietro_aaron_1523_cpietro_aaron_1523thomas_young_1799_cthomas_young_1799zarlino_1588_r zarlino_1588ben_johnston_mtp_1977_rben_johnston_mtp_1977gann_arcana_xvi_rgann_arcana_xvigann_superparticular_rgann_superparticularpythagorean_12_rpythagorean_12five_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_tsuda_r mayumi_tsudalou_harrison_16_rlou_harrison_16 partch_43_r partch_43ben_johnston_25_rben_johnston_25riley_albion_r riley_albionwerckmeister_iii_arwerckmeister_iii_ar_cwerckmeister_iiiwerckmeister_iv_arwerckmeister_iv_cwerckmeister_ivwerckmeister_v_arwerckmeister_v_cwerckmeister_vwerckmeister_vi_rwerckmeister_vi Pitch_DetuneHS_Roctpc_to_pitch_cps_f0octpc_to_pitch_cps tbl_12et_f0tbl_12et tbl_24et_f0tbl_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 Euler_Planerat_mulrat_divtun_seq ratio_to_pc all_pairseuler_align_ratcents_pp rat_labelrat_idrat_edge_labelzip_smeeuler_plane_to_doteuler_plane_to_dot_rat lmy_wtp_rlmy_wtp_ratio_to_pclmy_wtp_ratio_to_pc_err lmy_wtp_univ lmy_wtp_uniqlmy_wtplmy_wtp_1964_r lmy_wtp_1964 lmy_wtp_eulerodd_torowcolumn in_oct_mulinnermeyer_table_rckmeyer_table_indicesmeyer_table_rowst3_3elementsdegreefarey_sequence psaltery_r psaltery_o_r 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_categoryi_category_tablepolansky_1984_rpolansky_1984_c ps5_jpr_rps5_jpr Named_Tuningnamed_tuning_t tuning_dbtuning_db_lookup_scl kanjutmesem_s kanjutmesem_pdarius_s madeleine_p lipur_sih_s lipur_sih_pidealized_et_sidealized_et_pax_rfig_1d_hmk_isomorphic_layoutminimal_isomorphic_note_layoutrank_two_regular_temperamentmk_syntonic_tuning syntonic_697 syntonic_702 Dynamic_Node Hairpin_T Crescendo Diminuendo End_HairpinDynamic_Mark_TNientePPPPPPPPPPPPPPMPMFFFFFFFFFFFFFFFFPSFSFPSFPPSFZSFFZdynamic_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_ascii$fEqDynamic_Mark_T$fOrdDynamic_Mark_T$fEnumDynamic_Mark_T$fBoundedDynamic_Mark_T$fShowDynamic_Mark_T $fEqHairpin_T$fOrdHairpin_T$fEnumHairpin_T$fBoundedHairpin_T$fShowHairpin_Tdivisiondots multiplier duration_meq duration_m1duration_compare_meqduration_compare_meq_errno_dotssum_dur_undottedsum_dur_dottedsum_dur sum_dur_err divisions_set duration_setbeam_count_tbl!whole_note_division_to_beam_countduration_beam_countdivision_musicxml_tbl$whole_note_division_to_musicxml_typeduration_to_musicxml_typedivision_unicode_tbl%whole_note_division_to_unicode_symbolduration_to_unicodeduration_to_lilypond_typeduration_recip_ppwhole_note_division_letter_ppduration_letter_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_notewhqsw'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''RQrq_duration_tblrq_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 Tie_RightTie_Left Begin_Tuplet End_Tuplet begin_tupletda_begin_tuplet begins_tupletda_begins_tupletda_ends_tuplet da_tied_right da_tupletda_group_tuplets break_left sep_balancedda_group_tuplets_nnzip_kr nn_reshaped_annotated_tied_lrduration_a_tied_lr$fEqD_Annotation$fShowD_AnnotationRQ_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_univRational_Time_SignatureComposite_Time_SignatureTime_Signature ts_whole_notets_whole_note_rqts_rq ts_comparerq_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_rqwCTct_lenct_tsct_markct_tempoct_countCT_NodeCT_MarkCT_Start CT_NormalCT_EdgeCT_PreCT_EndPulseMeasure 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_rq $fEqCT_Node $fShowCT_Node$fShowCT 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_simplifym_simplify_fixp_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 Tempo_Marking rq_to_secondspulse_durationmeasure_durationmeasure_duration_fmetronome_table_wittnermetronome_table_nikkomm_name path_scan path_scan_err dir_subsetto_absolute_cwdScaleEpsilon Pitch_Type Pitch_Cents Pitch_Ratio pitch_type pitch_cents pitch_ratiopitch_representationsuniform_pitch_typepitch_type_predominant scale_namescale_description scale_degree scale_pitches scale_verifyscale_verify_err scale_octaveperfect_octaveis_scale_uniform scale_uniform scale_cents scale_cents_i scale_ratiosscale_ratios_reqscale_to_tuningtuning_to_scalescale_eq scale_eqv is_commentremove_eol_commentsfilter_comments parse_pitchparse_pitch_ln parse_scl scl_get_dirscl_derive_filenamescl_resolve_namescl_loadscl_load_tuning scl_load_dir scl_load_db scale_statscale_pp dist_get_dirload_dist_file$fEqPitch_Type$fShowPitch_Type t2_to_ratio dr_tuning_oct dr_tuningdr_scaledr_scale_tbl_12etdr_scale_scaladr_scale_tbl_24et dr_chords dr_ratio_seqdr_ratio_seq_histdr_nt dr_nt_pitchINTNAMINTERVALintnam_search_ratiointnam_search_description_ciparse_intnam_entry parse_intnam load_intnamMODENAMMODEmode_starting_degreemode_intervalsmode_description mode_degree modenam_modesmodenam_search_seqmodenam_search_seq1modenam_search_description mode_statnon_implicit_degreeis_non_implicit_degree is_integerparse_modenam_entryjoin_long_lines parse_modenam load_modenamDBRecordEntrySEP sep_plain record_parse record_lookuprecord_lookup_atrecord_has_keyrecord_lookup_uniqdb_parsedb_sort db_load_utf8 record_pp db_store_utf8DB'Record'Entry'record_key_seqrecord_key_histogramrecord_has_duplicate_keysrecord_lookup_byrecord_has_key_uniqrecord_lookup_uniq_errrecord_lookup_uniq_defrecord_delete_by record_delete db_key_set db_lookup_by db_lookupdb_has_duplicate_keysdb_key_histogram db_to_tablerecord_collate'record_collaterecord_uncollateMaybe_List_Of_Stringmaybe_list_to_listlist_to_maybe_list$fFromJSONMaybe_List_Of_String$fToJSONMaybe_List_Of_String$fEqMaybe_List_Of_String$fShowMaybe_List_Of_String Conforms_fBuild_fContour_Descriptioncontour_description_ncontour_description_mContour_Half_Matrixcontour_half_matrix_ncontour_half_matrix_mMatrixadjacent_indices all_indicesmatrix_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_Matrix$fEqContour_Half_Matrix$fOrdContour_Half_Matrix$fEqContour_DescriptionPsiDeltadif_idif_rsqrsqr_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_scalednk_combinations combinationsdifabsdifp2_anddoi_ofloc_dif loc_dif_of loc_dif_in loc_dif_n loc_dif_n_ofmin_vl min_vl_of min_vl_in combinations2set_ppm_getm_doi_of gen_graph_ulgen_graph_ul_ty gen_flt_graphp12_euler_planep12_euler_plane_gr p14_edgesp14_gr p31_f_4_22 p31_e_setp31_gr p114_f_3_7 p114_mk_gr p114_gr_setp125_grp131_gr p148_mk_gr p148_gr_setp162_gr p172_nd_map p172_set_pp p172_gr_set partition_ic p177_gr_set wr_graphsClefclef_t clef_octaveClef_TBassTenorAltoTreble Percussion clef_range clef_suggest clef_zero clef_restrict $fEqClef_T $fOrdClef_T $fShowClef_T$fEqClef $fOrdClef $fShowClefGamelan Tone_GroupTone_Set Instrumentinstrument_nameinstrument_scaleinstrument_pitchesinstrument_frequencies Tone_SubsetTonetone_instrument_name tone_notetone_frequencytone_annotationNote note_scale note_pitch pitch_octave pitch_degree Annotation FrequencyDegreePelogSlendroInstrument_Name Bonang_BarungBonang_Panerus Gender_BarungGender_PanerusGender_Panembung Gong_Ageng Gong_SuwukanKempulKempyangKenongKetuk Saron_Barung Saron_Demung Saron_PanerusInstrument_FamilyBonangGenderGongSaron fromJust_errnear_ratinstrument_family_setinstrument_familyinstrument_name_ppinstrument_name_clefinstrument_name_clef_plainpitch_pp_asciipitch_pp_duple note_degreetone_frequency_err plain_tonetone_equivalenttone_24et_pitchtone_24et_pitch'tone_24et_pitch_detunetone_24et_pitch_detune' tone_fmiditone_24et_fmiditone_12et_pitchtone_12et_pitch'tone_12et_pitch_detunetone_12et_pitch_detune'tone_12et_fmidi tone_familytone_family_errtone_in_family select_tones tone_subset tone_scale tone_pitch tone_degree tone_degree' tone_octave tone_classinstrument_class tone_class_ptone_family_class_ptone_set_near_frequencytone_compare_frequencymap_maybe_uniform instrument instrumentsinstrument_gamut scale_degrees degree_indextone_set_gamuttone_set_instrument $fOrdTone$fEnumInstrument_Family$fBoundedInstrument_Family$fEqInstrument_Family$fOrdInstrument_Family$fShowInstrument_Family$fReadInstrument_Family$fEnumInstrument_Name$fBoundedInstrument_Name$fEqInstrument_Name$fOrdInstrument_Name$fShowInstrument_Name$fReadInstrument_Name $fEnumScale $fEqScale $fOrdScale $fShowScale $fReadScale$fEqNote $fOrdNote $fShowNote$fEqTone $fShowTone$fEqInstrument$fShowInstrumentPart Voice_Rng_TblSoprano voice_abbrev voice_clefvoice_rng_tbl_stdvoice_rng_tbl_safe 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_seq $fEqVoice $fOrdVoice $fEnumVoice$fBoundedVoice $fShowVoice byte_hex_ppbyte_hex_pp_errbyte_seq_hex_pp read_hex_byteread_hex_byte_seq load_byte_seqstore_byte_seqload_hex_byte_seqstore_hex_byte_seqBRAILLE braille_asciibraille_unicode braille_dots braille_tablebraille_lookup_unicodebraille_lookup_ascii braille_64transcribe_unicodetranscribe_char_grid dots_gridstring_html_table braille_rng braille_seq braille_char braille_ix unicode_html white_circle black_circle shaded_circleone_letter_contractionsDesignc_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_3STEPleftright bjorklund' bjorklund bjorklund_r euler_pp_f euler_pp'euler_ppxdotxdot'iseq_strbit_ppbits_pp gen_bitseq pack_bitseq gen_bitseq_ppHexagram Line_StatLineL6L7L8L9 i_ching_chart line_unbroken line_from_bit line_ascii_ppline_is_movingline_complement hexagram_ppfour_coin_sequencefour_coin_gen_hexagramhexagram_has_complementhexagram_complementhexagram_nameshexagram_unicode_sequencehexagram_to_binaryhexagram_from_binarytrigram_unicode_sequence trigram_chart$fEqLine $fShowLine 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 is_cell_refparse_cell_ref_err cell_ref_pp cell_index index_to_cellparse_cell_index cell_rangecell_range_row_order$fIxColumn_Ref$fEnumColumn_Ref$fOrdColumn_Ref$fEqColumn_Ref$fShowColumn_Ref$fReadColumn_Ref$fIsStringColumn_Ref DIRECTION_C DIRECTION_SVECLOC vector_add vector_sub vector_sum apply_vec segment_vec derive_vec unfold_path is_directiondirection_char_to_vector_tbldirection_char_to_vectordirection_to_vectorvector_to_direction_chardir_seq_to_cell_seq gen_graph gen_digraphg8g9g10g11g12g13g_allwrwr_all P5_Writer P5_Parser CSV_TableTableCSV_OptCSV_Align_Columns CSV_No_AlignCSV_Align_LeftCSV_Align_RightCSV_Allow_Linebreaks CSV_DelimiterCSV_Has_Header def_csv_optcsv_table_readcsv_table_read_defcsv_table_withcsv_table_align csv_table_ppcsv_table_writecsv_table_write_def table_lookup table_row table_columntable_column_lookup table_celltable_lookup_row_segmenttable_row_segmenttable_to_arraycsv_array_read csv_field_strcsv_error_recovercsv_row_recovercsv_load_irregularcsv_table_read_p5csv_table_write_p5MNDDEventMNDParamChannel data_value_pp csv_mnd_hdr param_parseparam_pp csv_mnd_parseload_csv csv_mnd_read csv_mnd_writemidi_tseq_to_midi_wseqmidi_wseq_to_midi_tseq mnd_to_tseqcsv_mnd_read_tseqcsv_mnd_write_tseq csv_mndd_hdrcsv_mndd_parse csv_mndd_readcsv_mndd_write mndd_to_wseqcsv_mndd_read_wseqcsv_mndd_write_wseqcsv_midi_parse_wseqcsv_midi_read_wseqChoose_f load_cps_tblload_tuning_sclload_tuning_cpsload_tuning_d12load_tuning_tbldefault_choose_fload_tuning_tbl_stload_tuning_tyload_tuning_st_tyIx Dimensions larray_boundslarray make_regular ix_translate ix_modulo row_indicesmatrix_indicesmatrix_corner_indicesparallelogram_corner_indicesall_ix_translationsall_ix_translations_uniqMD_Table 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_matrix md_matrix_opt md_emboldenmd_matrix_boldGRSCPCSETsingularset_eq tto_tni_univall_tnall_tniuniq_tni pcset_trs trichordsself_invpcset_pp pcset_pp_hexathis_athath_univath_tniath_pp ath_trichordsath_complementath_completionsrealise_ath_seq ath_gr_extendgr_trstable_3 table_3_mdtable_4 table_4_mdtable_5 table_5_mdtable_6 table_6_mdfig_1_grfig_2fig_3fig_3_grfig_4fig_5 uedge_set set_shapegr_pp'gr_ppd_fig_1 d_fig_3_gd_fig_3d_fig_3' d_fig_4_gd_fig_4 d_fig_5_gd_fig_5 d_fig_5_e d_fig_5_g'd_fig_5'base Data.FoldablemsumGHC.Base.mapreturn%logict-0.6.0.2-IvIE0u44i1X7ob5HesINuTControl.Monad.Logic.Class MonadLogicControl.Monad.Logic observeAllmappendfoldr1sumGHC.RealdivModGHC.Num-subtract+foldlroundGHC.ReadReadGHC.ShowShowghc-prim GHC.TypesChar GHC.UnicodeisSpaceText.ParserCombinators.ReadPReadS Text.ReadreadsNothingRatioreadNumericreadHexIntegralGHC.EnumfromEnumtoEnumOrderingJustfmapFalseidMaybe realToFrac fromIntegralDoublefloorRationalgcd numerator denominator showFFloat fromIntegermod Data.OldList genericIndexdivquotremcontainers-0.5.7.1 Data.Map.Baselookupflipfoldl1 intersectGHC.List takeWhilegroupBy GHC.Classes== Data.Functionon Data.TuplefstsndsortOnData.Traversable mapAccumL isInfixOf elemIndicesRightLeftdrop dropWhiletakezipWithcomparenubEQsortBy+data-ordlist-0.4.7.0-D6ij7F9rr5a9kcQtGict4VData.List.OrderedmergeBymergeAll Data.Maybe isNothingelemmember elemIndexminimummaximum TraversableLTGTTrueconcatshow enumFromToGHC.Errerrorsort^,multiset-comb-0.2.4.1-5e2GQQTy2EoHGPnSOqsMCNMath.Combinatorics.Multiset concatMapmin System.IOputStrLn replicate integer-gmpGHC.Integer.TypeIntegercurry>IntenumFromThenTo#text-1.2.2.2-KC7dWoG09dA1F6jKj5GSqhData.Text.Encoding decodeUtf8bytestring-0.10.8.1Data.ByteStringreadFileString!fgl-5.6.0.0-k2vM7sbvmd5KrlOuk9qGpData.Graph.Inductive.GraphnoNodessubgraphData.Graph.Inductive.Query.DFS componentspre neighborsconst&&all||any<mapMaybe catMaybesmaxBoundminBoundEither GHC.FloatFloating fromRational/<=%primes-0.2.1.0-BN5qcmPxb1H2keY7Pz9jFXData.Numbers.Primes primeFactorsuncurry%*Ord Data.TreeTreebreakzip FractionalGHC.IOFilePathunfoldrNumRealabssqrtfromJust Data.RatioapproxRational>=unwords Data.BitsBitspredsuccBool transpose\\