On Mon, Jul 6, 2009 at 8:31 PM, Viktor
Cerovski<[email protected]> wrote:
> g =: ((<.,>.){.),}...@]
> shift1 =: g`,/
> shift2 =: ,`g/
> PGSort=:shi...@shift1^:(>....@-:@#)
>
> PGSortSee=:shi...@shift1^:(i.@>:@>....@-:@#)
Alternatively:
swap1=: # {.&, _2 (<.,>.)/\ ]
swap2=: {. , sw...@}.
pgs=: sw...@swap2^:_
pgsSee=: sw...@swap2^:a:
(of course, this only works in domains of <. and >.)
On Tue, Jul 7, 2009 at 3:27 AM, Vic Drastik<[email protected]> wrote:
> Easy and elegant in Basic:
>
> FOR i = 1 TO UBOUND(x[])
> IF x[i-1] > x[i] THEN SWAP x[i-1],x[i] : i = i + (i>1)<<1
> NEXT i
This is the wrong forum for that, but I am pretty
sure need visual basic for this. This would
not have worked on the versions of basic which
I have used.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm