[Jprogramming] Generating multiple length vectors from a single vector
Skip Cave
skip at caveconsulting.com
Wed Jun 24 00:23:42 UTC 2020
Box infix. Doh! I should have known.
I'm so used to using infix for sliding windows:
3,\1 2 3 4 5 6
1 2 3
2 3 4
3 4 5
4 5 6
I forgot infix's other property using a verb left argument, instead of a
noun.
Thanks to Bob & Hauke for reminding me.
Skip
On Tue, Jun 23, 2020 at 7:05 PM Hauke Rehr <hauke.rehr at uni-jena.de> wrote:
> But this does:
>
> tt =: 3 : 0
> <\ y
> :
> (<: x) { <\ y
> )
>
> tt >: i.6
> ┌─┬───┬─────┬───────┬─────────┬───────────┐
> │1│1 2│1 2 3│1 2 3 4│1 2 3 4 5│1 2 3 4 5 6│
> └─┴───┴─────┴───────┴─────────┴───────────┘
> 2 4 5 tt >: i.6
> ┌───┬───────┬─────────┐
> │1 2│1 2 3 4│1 2 3 4 5│
> └───┴───────┴─────────┘
> tt"1 n
> ┌─┬───┬─────┐
> │1│1 2│1 2 3│
> ├─┼───┼─────┤
> │1│1 3│1 3 2│
> ├─┼───┼─────┤
> │2│2 1│2 1 3│
> ├─┼───┼─────┤
> │2│2 3│2 3 1│
> ├─┼───┼─────┤
> │3│3 1│3 1 2│
> ├─┼───┼─────┤
> │3│3 2│3 2 1│
> └─┴───┴─────┘
>
>
> Am 24.06.20 um 01:58 schrieb 'robert therriault' via Programming:
> > Hey Skip,
> >
> > f =. <\
> >
> > should work if you are willing to do f"1
> >
> > or f1=. <\"1 if you want to lock in the rank.
> >
> > Is that what you are looking for?
> >
> > Cheers, bob
> >
> >> On Jun 23, 2020, at 16:50, Skip Cave <skip at caveconsulting.com> wrote:
> >>
> >> ]n=.>:perm 3
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
> --
> ----------------------
> mail written using NEO
> neo-layout.org
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list