Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Raul Miller
In that case, if your originally supplied list was D, L=: ;{.D P=: }.D As for the extra boxing, consider this alternative: ;(C.~ <)~&.> ::]/|. D Thanks, -- Raul On Sat, May 30, 2020 at 5:53 PM Hauke Rehr wrote: > > the verb would need to apply to L;P > (in my current implementation s

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Hauke Rehr
the verb would need to apply to L;P (in my current implementation since that’s what the mentioned iteration spits out) I don’t understand why the boxed pairs are boxed again in your last solution but I guess I’ll figure that one out I never learned ::, that might be the reason maybe I should have

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Raul Miller
Hmm.. In the current J902 release, if your 50 element list was unboxed in L and your pairs were boxes in P, you could do ;C.&.(a:`>) ::]/|. L;P or L ] F..(C. ::]) P (Caution: lately I've been getting spelling errors, copying and pasting from email into a J session -- this is because when

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Hauke Rehr
As I said, y is a boxed list the first item of which contains some vector V which needs permutation. All the other items contain a list of two values, that’s why I said they represent transpositions. I could as well have built their product and then applied that permutation to the vector. I only

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Brian Schott
Could you please give a sample of your use of your swap. I can't understand your description or the input(s). Thanks, On Sat, May 30, 2020 at 3:27 AM Hauke Rehr wrote: [snip] My last use case was a boxed list consisting of > a 1-d array and a set of transpositions I produced. > I wrote (I bet

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Raul Miller
For something like your 'swap', having example arguments helps, so: (i.3) swap 'abcd' bcad So your reduction swap&.>/@:|. suggests you were working with permutation indices, possibly of the same length (though if that were the case, there wouldn't have been any need for boxing -- but the other

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Hauke Rehr
As with natural languages, it doesn’t get you fluent gaining a large thesaurus only. If you learn the grammar (there are two of them in J: the set of production rules called a grammar; and the natural language grammar terms used; here I am mostly concerned with the latter) with the words, you’ll b