Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread Raul Miller
Hmm... you're right. And, simpler, lessThan=: (~:/ * 0 1 -: /:)@,&<&, That said, part of this is also that strings are implied to be rank 1 and not in-and-of themselves boxed, so, maybe: lessThan=: (~:/ * 0 1 -: /:)@,&<&(,"1 L:0) Thanks, -- Raul On Fri, Mar 13, 2020 at 12:40 PM Henry

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread Henry Rich
grade would be faster than sort here I expect. Henry Rich On 3/13/2020 12:25 PM, Raul Miller wrote: That's really a naming thing. It's testing for less than or equals. Your original version also had this character: 'test' ({.@:sort -: {.)@:; 'test' 1 But, yes, you can suppress the

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread Raul Miller
That's really a naming thing. It's testing for less than or equals. Your original version also had this character: 'test' ({.@:sort -: {.)@:; 'test' 1 But, yes, you can suppress the equality part with a further test. Thanks, -- Raul On Fri, Mar 13, 2020 at 12:15 PM 'Jon Hough' via

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread 'Jon Hough' via Programming
Thanks, that's nicer. But even that is not quite correct. 'z' lessThan 'z' 1 perhaps lt=: (({.@:sort -: {.) *. ({.~:{:))@,&<&, On Saturday, March 14, 2020, 12:59:15 AM GMT+9, Raul Miller wrote: Maybe   lessThan=: ({.@:sort -: {.)@,&<&, Thanks, -- Raul On Fri, Mar 13, 2020 at

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread Raul Miller
Maybe lessThan=: ({.@:sort -: {.)@,&<&, Thanks, -- Raul On Fri, Mar 13, 2020 at 11:41 AM 'Jon Hough' via Programming wrote: > > Thanks, > > you are, of course, correct, and I should have thought about it a bit more. I > am trying to make string comparison verbs > and this will make the

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread 'Jon Hough' via Programming
Thanks, you are, of course, correct, and I should have thought about it a bit more. I am trying to make string comparison verbs and this will make the solution a little more ugly. lessThan=: ({.@:sort -: {.)@:; 'abc' lessThan 'def' 1 'z' lessThan 'ab' 1 Needs a little more work for

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread Roger Hui
Y'all may be interested in how Dyalog APL does the TAO (total array ordering). https://www.jsoftware.com/papers/TAOaxioms.htm It's different from J because the arrays are different from J. On Fri, Mar 13, 2020 at 7:19 AM David Mitchell wrote: > This is documented (see Rank sentence in the

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread David Mitchell
This is documented (see Rank sentence in the doc): https://code.jsoftware.com/wiki/Vocabulary/slashco#dyadic The order of priority for ordering-up is: Type: numeric or empty, symbol, character (byte or unicode), and boxed, are so ordered Rank: lower comes before higher Values:

Re: [Jprogramming] String sort, possible bug

2020-03-13 Thread Thomas McGuire
The first 2 of the list have no rank. $ each words $ each words ┌┬┬─┬─┬─┬─┐ │││3│3│4│4│ └┴┴─┴─┴─┴─┘ words =: (1$'a');(1$'z');'zza';'abc';'zabc';’abbb' $ each words ┌─┬─┬─┬─┬─┬─┐ │1│1│3│3│4│4│ └─┴─┴─┴─┴─┴─┘ sort words ┌─┬┬───┬─┬┬───┐ │a│abbb│abc│z│zabc│zza│ └─┴┴───┴─┴┴───┘

[Jprogramming] String sort, possible bug

2020-03-12 Thread 'Jon Hough' via Programming
Consider the wrods: words =: 'a';'z';'zza';'abc';'zabc';'abbb' sort words ┌─┬─┬┬───┬┬───┐ │a│z│abbb│abc│zabc│zza│ └─┴─┴┴───┴┴───┘ the sorted words are not correctly (lexicographically) sorted. If I replace 'z' with 'z ' (space after z character) words =: 'a';'z