Re: [Jprogramming] Iteration

2020-03-13 Thread ethiejiesa via Programming
I'll contribute a little prose. Hopefully, it's helpful. In this particular case, notice that > transforms your list of boxes into a 5x6 table: > (6?55);(6?55);(6?55);(6?55);(6?55) 13 4 19 43 3 52 10 1 4 46 52 11 38 12 48 50 54 45 36 54 39 35 53 50 44 1 7 54 11 41

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│ └─┴┴───┴─┴┴───┘

Re: [Jprogramming] Iteration

2020-03-13 Thread ethiejiesa via Programming
Yes, those are not precise terms. I personally think of &. as embodying conjugation (from group theory). For monads, the analogy is often precise: u&.v y <-> v^:_1 u v y But you are right, the idea of conjugation is abstract enough that it is embodied by a dizzingly wide variety of applications:

Re: [Jprogramming] Iteration

2020-03-13 Thread Hauke Rehr
In my opinion, “do” and “undo” is not the idea/concept of &. and doesn’t get across what it actually does. &. is very helpful in a plethora of use cases it is like transform, work in transformed space, transform back (like working with conjugate matrices or in fourier space, e.g.) From my

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 '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 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] Iteration

2020-03-13 Thread Roger Hui
0. It may be helpful to think of &.> as "each". In fact, "each" is defined as such by some J standard library somewhere. Enter "each" in your J session and see what you get. 1. See https://code.jsoftware.com/wiki/Essays/Under for examples of &. , including from daily life (e.g. "under

Re: [Jprogramming] Iteration

2020-03-13 Thread Raul Miller
Here's another approach: ;/6?255#55 Here, I decided that "extended fifty times" really meant that you wanted another 50 copies of that expression (extended linearly). But of course you can tweak the numbers. FYI, -- Raul On Fri, Mar 13, 2020 at 12:49 AM Skip Cave wrote: > > How can I

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] Iteration

2020-03-13 Thread Hauke Rehr
If that’s what was intended, I’d rather write ;/6 (? $~) 55 (adhering to the DRY principle). Am 13.03.20 um 16:22 schrieb Raul Miller: Here's another approach: ;/6?255#55 Here, I decided that "extended fifty times" really meant that you wanted another 50 copies of that expression

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 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, 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] modifiers

2020-03-13 Thread Henry Rich
I think I agree. My vote would be that 'train' refers to any sequence of ARs and that when `:6 said 'train of individual verbs' it meant to say 'the (possibly derived) words created by executing the train of the (possibly derived) words represented by each AR'. I would say that (<,'"') is