home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / language / j32.sit / j.rsrc / TEXT_1305_@..txt < prev    next >
Text File  |  1991-06-13  |  2KB  |  13 lines

  1. @.  (Verb)
  2.  
  3. PERMUTE [CYCLE TO/FROM DIRECT] (1)  If p is a permutation of the atoms of i.n, then p is said to be a permutation vector of order n, and if n=#b, then p{b is a permutation of the items of b.
  4.  
  5. @.p yields a list of boxed lists of the atoms of i.#p, called the standard cycle representation of the permutation p. For example, if p=.4 5 2 1 0 3, then @.p is (,2);4 0;5 3 1 because the permutation p moves to position 2 the item 2, to 4 the item 0, to 0 the item 4, to 5 the item 3, to 3 the item 1, and to 1 the item 5. The monad @. is self-inverse; applied to a standard cycle it gives the corresponding direct representation.
  6.  
  7. A given permutation could be represented by cycles in a variety of ways; the standard form is made unique by the following restrictions: the cycles are disjoint and exhaustive (that is, the atoms of the boxed elements together form a permutation vector); each boxed cycle is rotated to begin with its largest element; and the boxed cycles are put in ascending order on their leading elements.
  8.  
  9. PERMUTE (1 _)  If p and c are standard and cycle representations of order #b, then p@.b and c@.b produce the corresponding permutations of items of b. More generally, since the tally of b determines the order of the permutation, the arguments p and c┬ácan be non-standard in ways to be defined. In particular, negative integers down to ΓÇô#b may be used, and are treated as their residues modulo #b.
  10.  
  11. If q is not boxed, and if the elements of (#b)|q are distinct, then q@.b is equivalent to p@.b, where p is the standard form of q given by p=. ((i.n)ΓÇô.n|q),n|q, where n=.#b. In other words, positions occurring in q are moved to the tail end. If q is boxed, the elements of (#b)|>j{q must be distinct for each j, and the boxes are applied in succession: (2 1;3 0 1)@.i.5 is (<2 1)@.(<3 0 1)@.i.5, and  is the standard direct permutation  1 2 3 0 4.
  12.  
  13. The monad @. is extended to non-negative non-standard cases by treating any argument q as a representation of a permutation of order 1+>./,. q.