Oops, I forgot o=. @:

On Thu, Sep 7, 2023 at 1:27 PM Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:

> > The order of the last two appear "unnatural".  (To my way of thinking at
> least)
> > This seems to beg the question what is the natural order when  slicing.
>
> The answer might depend on the intended usage of the verb that you have in
> mind. If, for example,
> you want to preserve the order of the remaining axes, then Henry's
> suggestion modified by Raul would work,
>
>    $ Y=. i.2 3 4 5
> 2 3 4 5
>
>    slicep=. ~.@(, i.@#@$) |: ]
>
>    (0 1 2 3) ($ o slicep"0 _) Y
> 2 3 4 5
> 3 2 4 5
> 4 2 3 5
> 5 2 3 4
>
> Another possibility is to rotate the axes,
>
>    slicer=. (|. i.@:#@:$@:]) |: ]
>
>    (0 1 2 3) ($ o slicer"0 _) Y
> 2 3 4 5
> 3 4 5 2
> 4 5 2 3
> 5 2 3 4
>
> I hope this helps
>
>
> On Wed, Sep 6, 2023 at 7:58 PM Piet de Jong <pietd...@gmail.com> wrote:
> >
> > 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 v m) are the vertical slices.
> >
> > The order of the last two appear "unnatural".  (To my way of thinking at
> least)
> > This seems to beg the question what is the natural order when  slicing.
> >
> > > On 7 Sep 2023, at 08:32, Henry Rich <henryhr...@gmail.com> wrote:
> > >
> > > 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 <pietd...@gmail.com> 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.   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 <
> > >> programm...@jsoftware.com> wrote:
> > >>>
> > >>> 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 <
> > >> programm...@jsoftware.com> wrote:
> > >>>>
> > >>>> 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 <schott.br...@gmail.com>
> wrote:
> > >>>>>
> > >>>>> ,./0 1 {"1  m
> > >>>>
> > >>>>
> ----------------------------------------------------------------------
> > >>>> 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

Reply via email to