Brian Schott wrote:

>       More recently I have been creating permutation vectors of a
> different sort using "permute" as in the following example inspired by one
> in the J vocabulary, called h.
>
>    ]h =: (2 1; 0 1) C. i.4
> 1 2 0 3
>
>       But h cannot be used in the "from" form h&{"1 to permute other vectors.
> Instead I have found that "amend" in (h})"1~ is effective.
>
>    ]k=: 0 1 2 3,:4 5 6 7
> 0 1 2 3
> 4 5 6 7
>    (h})"1~  k
> 2 0 1 3
> 6 4 5 7

Could you explain what you are getting at here?  The permutation you are
using is not h but its inverse

   hh=:2 0 1 3

and this behaves perfectly normally:

   hh {"1 k
2 0 1 3
6 4 5 7

Amend works rather than select because of this inversion.

Best wishes,

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to