..      !"#$%&'()*+,-. / 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 { | } ~  +Anders Claesson <anders.claesson@gmail.com>None  An array of s ,Construct an array from a list of elements. The list of elements. Slice a ' into contiguous segments of the given D sizes. Each segment size must be positive and they must sum to the  size of the array. Like  but without range checking. The size/length of the given array. w `at` i is the value of w at i, where i is in  [0..size w-1]. Like  but without range checking. =Apply a function to every element of an array and its index. ACreate a new array of the given size that is initialized through  an IO action. BPass a pointer to the array to an IO action; the array may not be  modified through the pointer.     +Anders Claesson <anders.claesson@gmail.com>None A permutation is just a . By convention a permutation  of size n& is understood to be a permutation of [0..n-1]. $The unique permutation length zero. #The unique permutation length one. The identity permutation. )The reverse of the identity permutation. ?Construct a permutation from a list of elements. As opposed to  9 this is a safe function in the sense that the output of   mkPerm xs& is guaranteed to be a permutation of [0..length xs-1].  E.g., mkPerm "baxa" == fromList [2,0,3,1]. @The rank of the given permutation, where the rank is defined as E in [W. Myrvold and F. Ruskey, Ranking and Unranking Permutations in ? Linear Time, Information Processing Letters, 79 (2001) 281-284]. The permutation of size n whose rank is r, where the rank C is defined as in [W. Myrvold and F. Ruskey, Ranking and Unranking A Permutations in Linear Time, Information Processing Letters, 79  (2001) 281-284]. "All permutations of a given size.    +Anders Claesson <anders.claesson@gmail.com>NoneDA permgram consists of a permutation together with a label for each  index of the permutation. The underlying permutation. %The assignment of labels to indices. DThe purpose of this data type is to assign labels to the indices of  a given permutation. BConstruct a permgram from an underlying permutation and a list of  labels. The inverse permgram. It'(s obtained by mirroring the permgram in  the x=y diagonal. BThe size of a permgram is the size of the underlying permutation.   +Anders Claesson <anders.claesson@gmail.com>None8The Simion-Schmidt bijection from Av(123) onto Av(132). >The inverse of the Simion-Schmidt bijection. It is a function  from Av(132) to Av(123). +Anders Claesson <anders.claesson@gmail.com>None The product/composition of u and v: if w = u  v  then w `at ` i = v `at` (u `at` i). .The (left) group action of Perm on itself: if w = u  v  then w `at ` (u `at` i) = v `at` i. +Anders Claesson <anders.claesson@gmail.com>NoneIs the permutation simple? +Anders Claesson <anders.claesson@gmail.com>None One pass of stack-sort. !One pass of bubble-sort.  ! ! ! !+Anders Claesson <anders.claesson@gmail.com>NoneBLexicographically, the next bitmask with the same Hamming weight. ones k m- is the set of indices whose bits are set in  m. Default implementation: < ones m = fromListN (popCount m) $ filter (testBit m) [0..] "<A set is represented by an increasing array of non-negative  integers. Sort and remove duplicates. # subsets n k is the list of subsets of [0..n-1] with k  elements. Lexicographically, the next  with the same Hamming weight.  onesCLong m) gives the indices whose bits are set in m. JLexicographically, the next integral number with the same Hamming weight. "#"# "#+Anders Claesson <anders.claesson@gmail.com>None $*Pattern is just an alias for permutation. % ordiso u v m# determines whether the subword in v specified by  m is order isomorphic to u. & copies p w. is the list of sets that represent copies of p in w. 'w ' p is a predicate determining if w contains the pattern p. (w ( p is a predicate determining if w avoids the pattern p. )w ) ps is a predicate determining if w avoids the patterns ps. *avoiders ps ws is the list of permutations in ws avoiding the  patterns in ps. +9The set of minimal elements with respect to containment. ,9The set of maximal elements with respect to containment. - coeff f v is the coefficient of v when expanding the  permutation statistic f as a sum of permutations/patterns. See E Petter Brndn and Anders Claesson: Mesh patterns and the expansion @ of permutation statistics as sums of permutation patterns, The 3 Electronic Journal of Combinatorics 18(2) (2011),   Dhttp://www.combinatorics.org/ojs/index.php/eljc/article/view/v18i2p5. $%&'()*+,- "#$%&'()*+,- $"%#&'()*+,- $%&'()*+,- +Anders Claesson <anders.claesson@gmail.com>None.,Ration by 0 degrees, i.e. the identity map. / Ration by 90 degrees clockwise. 0(Ration by 2*90 = 180 degrees clockwise. 1(Ration by 3*90 = 270 degrees clockwise. 22Reflection through a horizontal axis (also called >). 30Reflection through a vertical axis (also called =). 42Reflection through the main diagonal (also called <). 5&Reflection through the anti-diagonal. 6EThe dihedral group of order 8 (the symmetries of a square); that is, ' d8 = [r0, r1, r2, r3, s0, s1, s2, s3] 7:The Klein four-group (the symmetries of a non-equilateral  rectangle); that is,  klein4 = [r0, r2, s0, s1] 8 orbit fs x is the orbit of x under the group of function fs. E.g., 6 orbit klein4 "2314" == ["1423","2314","3241","4132"] 9symmetryClasses fs xs* is the list of equivalence classes under  the action of the group of functions fs. :%Symmetry classes with respect to D8. ;(Symmetry classes with respect to Klein4 <"The group theoretical inverse: if  v = inverse u then  v `at` (u `at` i) = i. =)The reverse of the given permutation: if  v = reverse u then  v `at` i = u `at` (n-1-i). >,The complement of the given permutation: if v = complement u then  v `at` i = n - 1 - u `at` i. ? rotate = r1 = inverse . reverse./0123456789:;<=>?./0123456789:;<=>?./0123456789:;?>=<./0123456789:;<=>? +Anders Claesson <anders.claesson@gmail.com>None@The list of (plus) components. A;The list of skew components, also called minus components. BAFor each position, left-to-right, records the largest value seen  thus far. CBFor each position, left-to-right, records the smallest value seen  thus far. DFor each position,  right-to-left!, records the largest value seen  thus far. EFor each position,  right-to-left", records the smallest value seen  thus far. @ABCDE@ABCDE@ABCDE@ABCDE +Anders Claesson <anders.claesson@gmail.com>NoneFThe  direct sum of two permutations. G*The direct sum of a list of permutations. HThe skew sum of two permutations. I(The skew sum of a list of permutations. J inflate w vs is the  inflation of w by vs . It is the  permutation of length sum (map size vs) obtained by replacing  each entry w!i, by an interval that is order isomorphic to vs!i : in such a way that the intervals are order isomorphic to w. In  particular, ( u /+/ v == inflate (mkPerm "12") [u,v] ( u \-\ v == inflate (mkPerm "21") [u,v] FGHIJFGHIJFHGIJFGHIJ +Anders Claesson <anders.claesson@gmail.com>NoneK&The class of increasing permutations. L&The class of decreasing permutations. MAv(1) NAv(12) OAv(21) PAv(123) QAv(132) RAv(213) S7Av(231); also know as the stack sortable permutations. TAv(312) UAv(321) V Av(1243) W Av(1324) X Av(2134) YDAv(s) where s is a string of one or more patterns, using space as a  seperator. ZCThe V-class is Av(132, 231). It is so named because the diagram of 9 a typical permutation in this class is shaped like a V. [The "'>-class is Av(213, 312). It is so named because the diagram of 6 a typical permutation in this class is shaped like a "'. \CThe >-class is Av(132, 312). It is so named because the diagram of 9 a typical permutation in this class is shaped like a >. ]The <>-class is Av(213, 231). It is so named because the diagram of 6 a typical permutation in this class is shaped like a <. ^ The union of Z, [, \ and ]. _GThe class of separable permutations; it is identical to Av(2413,3142). `'The class of layered permutations with k layers. a#The class of layered permutations. b)The class of Fibonacci permutations with k layers. A Fibonacci permutation ? is a layered permutation whose layers are all of size 1 or 2. c'The class of Fibonacci permutations. A Fibonacci permutation is a : layered permutation whose layers are all of size 1 or 2. KLMNOPQRSTUVWXYZ[\]^_`abcKLMNOPQRSTUVWXYZ[\]^_`abcKLMNOPQRSTUVWXYZ[\]^_`abcKLMNOPQRSTUVWXYZ[\]^_`abc+Anders Claesson <anders.claesson@gmail.com>NoneK  !"#$%&'()*+,-@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc +Anders Claesson <anders.claesson@gmail.com>NonedThe number of ascents. An ascent in w is an index i such  that w[i] < w[i+1]. eThe number of descents. A descent in w is an index i such  that w[i] > w[i+1]. fThe number of  excedances : positions i such that w[i] > i. gThe number of  fixed points : positions i such that w[i] == i. hThe number of strong fixed points (also called splitters):  positions i such that w[j] < i for j < i and w[j] > i for j > i. iThe number of cycles: 6 orbits of the permutation when viewed as a function. jThe number of  inversions:  pairs (i,j) such that i < j and w[i] > w[j]. kThe major index is the sum of descents. lThe co-major index is the sum of descents. mThe number of peaks:  positions i such that w[i-1] < w[i] and w[i] > w[i+1]. nThe number of valleys:  positions i such that w[i-1] > w[i] and w[i] < w[i+1]. oThe number of double ascents:  positions i such that w[i-1] < w[i] < w[i+1]. pThe number of double descents:  positions i such that w[i-1] > w[i] > w[i+1]. qThe number of left-to-right minima:  positions i such that w[i] < w[j] for all j < i. rThe number of left-to-right maxima:  positions i such that w[i] > w[j] for all j < i. sThe number of right-to-left minima:  positions i such that w[i] < w[j] for all j > i. tThe number of right-to-left maxima:  positions i such that w[i] > w[j] for all j > i. u<The first (left-most) element in the standardization. E.g.,  head "231" = head (fromList [1,2,0]) = 1. v<The last (right-most) element in the standardization. E.g.,  last "231" = last (fromList [1,2,0]) = 0. w0Length of the left-most increasing run: largest i such that  w[0] < w[1] < ... < w[i-1]. x0Length of the left-most decreasing run: largest i such that  w[0] > w[1] > ... > w[i-1]. y1Length of the right-most increasing run: largest i such that  w[n-i] < ... < w[n-2] < w[n-1]. z1Length of the right-most decreasing run: largest i such that  w[n-i] > ... > w[n-2] > w[n-1]. { The number of components. E.g., [2,0,3,1,4,6,7,5] has three  components: [2,0,3,1], [4] and [6,7,5]. |%The number of skew components. E.g., [5,7,4,6,3,1,0,2] has three  skew components: [5,7,4,6], [3] and [1,0,2]. }8The rank as defined by Elizalde and Pak [Bijections for " refined restricted permutations, J. Comb. Theory, Ser. A, 2004]: 8 maximum [ k | k <- [0..n-1], w[i] >= k for all i < k ] ~9The dimension of a permutation is defined as the largest 3 non-fixed-point, or zero if all points are fixed. The number of small ascents. A  small ascent in w is an index  i such that w[i] + 1 == w[i+1].  The number of small descents. A  small descent in w is an  index i such that w[i] == w[i+1] + 1. 4defghijklmnopqrstuvwxyz{|}~defghijklmnopqrstuvwxyz{|}~defghijklmnopqrstuvwxyz{|}~4defghijklmnopqrstuvwxyz{|}~+Anders Claesson <anders.claesson@gmail.com>None 8The class of permutations. Minimal complete definition: ,   and  . The default implementation of  can be 9 somewhat slow, so you may want to implement it as well. :The standardization map. If there is an underlying linear  order on a then st# is determined by the unique order  preserving map from [0..]! to that order. In any case, the ? standardization map should be equivariant with respect to the 7 group action defined below; i.e., it should hold that  st (u `act` v) == u `act` st v  A (left)  group action of   on a. As for any group  action it should hold that  I (u `act` v) `act` w == u `act` (v `act` w) && idperm n `act` v == v where v,w::a and u::Perm are of size n. CThe size of a permutation. The default implementation derived from   size == size . st %This is not a circular definition as  on   is 5 implemented independently. If the implementation of  is ; slow, then it can be worth while to override the standard < definiton; any implementation should, however, satisfy the  identity above. ,The identity permutation of the given size. 3The group theoretical inverse. It should hold that   inverse == unst . inverse . st (and this is the default implementation. .Predicate determining if two permutations are 3 order-isomorphic. The default implementation uses   u `ordiso` v == u == st v Equivalently, one could use 8 u `ordiso` v == inverse u `act` v == idperm (size u) The inverse of . It should hold that  % unst w == w `act` idperm (P.size w) (and this is the default implementation. 0The list of all permutations of the given size. Lifts a function on  s to one on any permutations. Like % but for functions of two variables. AA String viewed as a permutation of its characters. The alphabet  is ordered as % ['1'..'9'] ++ ['A'..'Z'] ++ ['a'..]  !"#$%&'()*+,-./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 { | } ~  .*5$ sym-0.9Data.CLongArray Data.Perm Data.PermgramMath.Perm.BijectionMath.Perm.GroupMath.Perm.SimpleMath.Perm.SortMath.Perm.Pattern Math.Perm.D8Math.Perm.ComponentMath.Perm.ConstructionsMath.Perm.ClassMath.Perm.StatMath.SymData.Perm.Internal Math.Perm CLongArrayfromListtoListslice unsafeSlicesizeatunsafeAtimap unsafeNew unsafeWithPerm emptypermoneidpermebbmkPermrankunrankpermsPermgrampermlabelLabelpermgraminverse simionSchmidtsimionSchmidt'composeactsimple stackSort bubbleSortSetsubsetsPatternordisocopiesOfcontainsavoids avoidsAllavoidersminimamaximacoeffr0r1r2r3s0s1s2s3d8klein4orbitsymmetryClasses d8Classes klein4Classesreverse complementrotate componentsskewComponents leftMaxima leftMinima rightMaxima rightMinima/+/ directSum\-\skewSuminflateincdecav1av12av21av123av132av213av231av312av321av1243av1324av2134avveecaretgtltwedges separableskLayeredlayered kFibonacci fibonacciascdesexcfpsfpcycinvmajcomajpeakvalldascddeslminlmaxrminrmaxheadlastlirldrrirrdrcompscompepdimasc0des0 Permutationstunstliftlift2baseForeign.C.TypesCLongCArrinlinePerformIO$fOrdCLongArray$fEqCLongArray$fShowCLongArrayc_unrankc_rankPGram constituents joinPermgram$fMonadPermgram$fFunctorPermgram $fOrdPermgram $fEqPermgram$fShowPermgramc_simion_schmidt'c_simion_schmidtmarshalc_act c_composec_simple c_bubblesort c_stacksortnextones normalize nextCLong onesCLong nextIntegralBitmaskc_onesc_nextbitmasks$fBitmaskInteger$fBitmaskCLongc_ordiso avoiders1 c_complement c_reverse c_inversecompsrecords streamAv231 streamVeeunion compositionsboundedCompositionsc_des0c_asc0c_dimc_epc_compc_ldrc_lirc_lmaxc_lminc_ddesc_dascc_vallc_peakc_comajc_majc_invc_cycc_sfpc_fpc_excc_desc_asc$fPermutation[]$fPermutationCLongArray