>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Voc  !:  Help  Dictionary

Anagram Index A.  1 0 _ Anagram

If T is the table of all !n permutations of order n arranged in lexical order (i.e., /:T is i.!n), then k is said to be the anagram index of the permutation k{T .

A. applied to a cycle or direct permutation yields its anagram index: A. 0 3 2 1 is 5, as are A. 3 2 1 and A.<3 1 and A.0;2;3 1 .
 
  The expression k A. b permutes items of b by the permutation of order #b whose anagram index is k .
 

For example:
   (A. 0 3 2 1) , (A. <3 1)
5 5

   A. |. i.45
119622220865480194561963161495657715064383733759999999999

   <: ! 45x
119622220865480194561963161495657715064383733759999999999

   tap=: i.@! A. i.           NB. Table of all permutations

   (tap 3);(/: tap 3);({/\ tap 3);(/:{/\ tap 3)
+-----+-----------+-----+-----------+
|0 1 2|0 1 2 3 4 5|0 1 2|0 1 5 2 4 3|
|0 2 1|           |0 2 1|           |
|1 0 2|           |1 2 0|           |
|1 2 0|           |2 0 1|           |
|2 0 1|           |1 2 0|           |
|2 1 0|           |1 0 2|           |
+-----+-----------+-----+-----------+
In particular, 1 A. b transposes the last two items of b, and _1 A. b reverses the list of items, and 3 A. b and 4 A. b rotate the last three items of b. For example:
   b=: 'ABCD'

   (0 3 2 1{b);(0 3 2 1 C.b);((<3 1)C.b);(3 4 A.b)
+----+----+----+----+
|ADCB|ADCB|ADCB|ACDB|
|    |    |    |ADBC|
+----+----+----+----+

   (_19 5 A. b) ; (_19 |~ ! # b)
+----+-+
|ADCB|5|
|ADCB| |
+----+-+



>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Voc  !:  Help  Dictionary