If the keys are numeric you can multiply the ascending column by 1 and the
descending one by _1, and then apply /:  .

   x=: 5 2$7 4 8 2 8 4 7 2 8 3
   x /: x*"1 ]_1 1
8 2
8 3
8 4
7 2
7 4
   x /: x*"1 ]1 _1
7 4
7 2
8 4
8 3
8 2


On Sat, Jan 19, 2019 at 8:18 AM Jimmy Gauvin <jimmy.gau...@gmail.com> wrote:

> Hi,
>
> I need to sort on two keys, one descending the other asscending.
> (J takes care were ascending or descending
>
> Is there a better way to solve this ?
>
>    ]t=:5 2$7 4 8 2 8 4 7 2 8 3
> 7 4
> 8 2
> 8 4
> 7 2
> 8 3
>    ]tt=: t {~ /:1{"1 t
> 8 2
> 7 2
> 8 3
> 7 4
> 8 4
>    ]tt {~ \:0{"1 tt
> 8 2
> 8 3
> 8 4
> 7 2
> 7 4
>
> Thanks,
>
> Jimmy
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to