[Jprogramming] special coding for stack operations
greg heil
gheil.j at gmail.com
Thu Jul 13 04:15:36 HKT 2006
On 7/12/06, R&S HUI <rhui000 at shaw.ca> 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 <rdmiller at usatoday.com> wrote:
> Using the right hand edge of a list as top of stack:
> swap=: _2 (}. , |.@{.) ]
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
More information about the Programming
mailing list