On 7/12/06, R&S HUI <[EMAIL PROTECTED]> wrote:
What exactly is "swap"?  Is it  name=: (<i,j) C. name  ?

In this context it is as

On 7/12/06, Miller, Raul D <[EMAIL PROTECTED]> wrote:
Using the right hand edge of a list as top of stack:
   swap=: _2 (}. , |[EMAIL PROTECTED]) ]

However it is interesting you asked, as i have been trying to develop
an efficient generalization, which i have been calling swap, that
reverses arbitrary elements in an array. Eg defined as

reverse=:[:|.{  NB. reverse of x{y
amend=: 1 : 'u`[`]}'    NB. amend x{y with u of x{y
swapG=: reverse amend
  (1 2; 2 0) swapG i.4 4
0  1  2  3
4  5  8  7
6  9 10 11
12 13 14 15

But i am not clear on how to make this operation efficient, it is
currently a major fraction of the time budget for my application...

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

Reply via email to