([ ({.@[, {:@[(]/: *"1 ) }.@]) &.:(({., {.C."1 }.) :.
> ({.C.^:(_1)"1 }.)) (,~{.)~)
>
>(0 3 1 2,:_1 1 _1 1) (foo-: foo_tct) a
> 1
>
> Once more I was remembered to the fact that in the under construction,
> u&.v and u&.:v , v and its inverse are always appli
> Verzonden: donderdag 24 januari 2019 00:11
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Sorting on two keys
>
> > Well, one can argue whether an explicit verb is a one-liner or not.
>
>
> Right, foo is not displayed as a one-liner,
>
>foo
> 4 :
│20864│6.20376e_5│1.29435 │
└──┴─┴──┴┘
JVERSION
Engine: j807/j64nonavx/windows
Release-a: commercial/2019-01-11T11:13:30
Library: 8.06.09
Qt IDE: 1.6.2/5.6.3
Platform: Win 64
Installer: J806 install
InstallPath: j:/program files/j
Contact: www.jsoftware.com
C. did not have an obverse.
R.E. Boss
> -Oorspronkelijk bericht-
> Van: Programming
> Namens Brian Schott
> Verzonden: woensdag 23 januari 2019 14:47
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Sorting on two keys
>
> RE,
>
> Previously I le
RE,
Previously I learned via your code a use of C. that was eye-opening.
This time, I learned via your code how a multi-x can be used in a one liner.
Very good.
On Wed, Jan 23, 2019 at 5:45 AM R.E. Boss wrote:
> If your x variable denotes the columns to be sorted plus the way in which
> that s
|
|0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2|
+---+
R.E. Boss
> -Oorspronkelijk bericht-
> Van: Programming
> Namens Jimmy Gauvin
> Verzonden: dinsdag 22 januari 2019 00:34
> Aan: programm
My intention was to give the most general solution to an actual problem.
R.E. Boss
>
> On Mon, Jan 21, 2019 at 12:10 PM Roger Hui
> wrote:
> (...)
> >
> > It's possible that your interpretation is what was asked in the
> > original question posed by Jimmy Gauvin. No matter, I find my version
HI,
thanks for all the answers, and the insights into J and sorting.
The version applicable to my sorting needs is indeed the classic primary
key, secondary key sort.
And the R.E. Boss version is going into my toolbox.
Jimmy
On Mon, Jan 21, 2019 at 12:10 PM Roger Hui
wrote:
> It's is possible
It's is possible that we have a different interpretation of what is the
problem to be solved. My interpretation is the classic definition of
lexicographic ordering. First, you order by column 0, resulting in groups
of rows with identical values in column 0. Then, within each group, you
order by
>
> On Sat, Jan 19, 2019 at 8:40 AM Roger Hui
> wrote:
>
> > If the keys are numeric you can multiply the ascending column by 1 and
> > the descending one by _1, and then apply /: .
> >
It is not enough to multiply with 1 or _1 for ascending or descending columns.
You might have to reorder th
As I said before, if the data is numeric, for each descending column,
multiply by _1 and for each ascending column, multiply by 1, then apply /:
to the result. This induces a "control array" having the same shape as a
major cell of the argument, with a _1 for descending and a 1 for ascending.
Wha
> -Oorspronkelijk bericht-
> Van: Programming
> Namens R.E. Boss
> Verzonden: zondag 20 januari 2019 12:14
> Aan: programm...@jsoftware.com
> Onderwerp: Re: [Jprogramming] Sorting on two keys
>
>[x=.'abcdefg'{~ 10 2?.@$8<mailto:2?.@$8>
>;/
'Pascal Jasmin' via Programming
> Onderwerp: Re: [Jprogramming] Sorting on two keys
>
>
> t{~/:(10*9-0{"1 t)+1{"1 t
>
> 8 2
>
> 8 3
>
> 8 4
>
> 7 2
>
> 7 4
>
>
>
>
>
> Den lørdag den 19. januar 2019 17.
) 5 2$7 4 8 2 8 4 7 2 8 3
From: Jimmy Gauvin
To: programm...@jsoftware.com
Sent: Saturday, January 19, 2019 11:18 AM
Subject: [Jprogramming] Sorting on two keys
Hi,
I need to sort on two keys, one descending the other asscending.
(J takes care were ascending or descending
if one of the columns is numeric, then negating it will sort the right way.
(\: 1 ,/@(+`-\"1) ]) 5 2$7 4 8 2 8 4 7 2 8 3
From: Jimmy Gauvin
To: programm...@jsoftware.com
Sent: Saturday, January 19, 2019 11:18 AM
Subject: [Jprogramming] Sorting on two
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 wrote:
> Hi,
>
> I nee
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,
Ji
17 matches
Mail list logo