The first example is lesser, my bad!
Dec 21, 2023, 15:27 by programm...@jsoftware.com: > I have a list that I would like to sort using a verb that outputs 0 or 1, > depending on the two items compared. Since there are length-1 factorial > possible pairings and hence booleans, I'd thought of the table. > > Here, the items are hands of playing cards. One hand is greater than another, > if at any one the position, starting checking from the first, it holds a > greater card. The types of card get assigned 0 through 12. > > 2AAAA is greater than A2222 > 23452 is lesser than 23453 > > > Dec 21, 2023, 15:19 by henryhr...@gmail.com: > >> 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 >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm