Re: [Jprogramming] Rank difficulties

2023-09-06 Thread 'Rob Hodgkinson' via Programming
I should have read Henry’s more carefully (sorry Henry), very similar approach, bust the display of the ‘slices’ differs. 1 HR a 0 12 4 16 8 20 1 13 5 17 9 21 2 14 6 18 10 22 3 15 7 19 11 23 1 T a 0 1 2 3 12 13 14 15 4 5 6 7 16 17 18 19 8 9 10 11 20 21 22 23 > On

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread 'Rob Hodgkinson' via Programming
Very nice Ben, your TT is “hard coded to rank 3”, so fails on other than rank 3. I “tinkered” by replacing 0 1 2 with i. $ $, and converted to tacit using 13 : which worked, but less readable... ]a=:i.2 3 4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ]b=:i.2 2 0

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Ben Gorte
Still not quite sure what you mean, but how about: ]n =: i.2 3 4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1{0 T n NB. -: 1{n 12 13 14 15 16 17 18 19 20 21 22 23 1{1 T n 4 5 6 7 16 17 18 19 1{2 T n 1 5 9 13 17 21 If that's the one, then T would be: T =: {{

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Piet de Jong
This works! Except the ordering of the axes is slightly unusual to my way of thinking. For example suppose m=.i.3 3 3 is the “cube" be sliced and v is your verb. Then the items of (0 v m) has successive items “going back” into the cube. The items (1 v m) are the horizontal slices. The items of (2

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Piet de Jong
Getting close. But wish I could avoid the annoying “column” vectors on some of the slices. This would be an annoying hurdle in the further slice processing. > On 7 Sep 2023, at 08:50, 'robert therriault' via Programming > wrote: > > Is this closer to what you are looking for Piet? > >

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread 'robert therriault' via Programming
Is this closer to what you are looking for Piet? [n=: i. 3 3 3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 slice=: ;@{"]: 0 (2 slice) n 0 1 2 9 10 11 18 19 20 1 (2 slice) n 3 4 5 12 13 14 21 22 23 2 (2 slice) n 6 7 8 15 16 17 24 25

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Henry Rich
Since you want all the slices, what you are looking for is a transpose. Maybe ~.@(, i.@#) |: ] Untested. Henry Rich On Wed, Sep 6, 2023, 6:10 PM Piet de Jong wrote: > Here is my “wish" > > A dyadic (tacit) verb such that x v y gives all the slices of y along > dimension x, where x is integer

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Piet de Jong
Here is my “wish" A dyadic (tacit) verb such that x v y gives all the slices of y along dimension x, where x is integer. That is to say i{ x v y is slice i of the array y along dimension x. Thanks for all your help! > On 7 Sep 2023, at 08:04, 'robert therriault' via Programming > wrote:

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread 'robert therriault' via Programming
Or something like this? [n =. i. 2 2 2 0 1 2 3 4 5 6 7 ,./ n 0 1 4 5 2 3 6 7 ($ $ (,@,./)) n 0 1 4 5 2 3 6 7 Cheers, bob > On Sep 6, 2023, at 14:49, 'robert therriault' via Programming > wrote: > > Hi Piet, > > Maybe show us what you would want to do with higher dimensions? Or a

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Piet de Jong
I’m looking for a verb that does the relevant slicing. Hopefully the verb can be used to slice on any dimension. > On 7 Sep 2023, at 07:26, Brian Schott wrote: > > Does this help? > > ,./0 1 {"1 m > 0 2 > 1 3 > > > -- > (B=) <-my sig > Brian Schott > --

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread 'robert therriault' via Programming
Hi Piet, Maybe show us what you would want to do with higher dimensions? Or a less symmetric 2 dimensional shape? For shape 2 2, I would use the even simpler |: m 0 2 1 3 Hope this helps. Cheers, bob > On Sep 6, 2023, at 14:26, Brian Schott wrote: > > ,./0 1 {"1 m ---

Re: [Jprogramming] Rank difficulties

2023-09-06 Thread Brian Schott
Does this help? ,./0 1 {"1 m 0 2 1 3 -- (B=) <-my sig Brian Schott -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Rank difficulties

2023-09-06 Thread Piet de Jong
Apologies if this is an ignorant question. (Always learning) I want to take “slices” of a multidimensional array. For simplicity suppose the array is 2 dimensional (This is not my actual situation but illustrates my difficulties) m=. i.2 2 The two horizontal slices are 0{m and 1{m or more simp