I don't understand the problem statement.
Henry Rich
On 12/21/2023 10:17 AM, 'Viktor Grigorov' via Programming wrote:
Maybe a table, summation and a sort using that:
(/: ([:+/(>/]))) _10 1 10 20 _30 15 25 30 0
Can't imagine that being efficient, but it's better than nothing. The verb I'd
defined can't deal with rank 2 nouns anyways.
Dec 21, 2023, 14:21 by programm...@jsoftware.com:
Not quite though. Had I 5 hands, that'd be !4 booleans.
Dec 21, 2023, 14:11 by programm...@jsoftware.com:
1 0 0 1 0 /:~ i.5
1 2 4 0 3
On Thursday, December 21, 2023 at 09:03:34 a.m. EST, 'Viktor Grigorov' via
Programming <programm...@jsoftware.com> wrote:
Hey,
Is there an easy way to sort an array with verb returning either 0 or 1, like
the comparison primitives?
The verb that I'd in mind relates to the 2023's advent of code's day 7: given
two equal length hands, which one has the first high card. Which one can write
as:
'K2345' ( 2 | 0 { [: I. [: , [: (<,.>)/ ,: & ('23456789TJQKA'i.]) ) 'KJ2KA'
0 NB. here meaning left is not greater right
Cheers,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm