Nice Hauke
I went tacit and threw in a ,@:<:@:[ on the fork so the single x arguments will
still stack
fd=.(<\) : (,@:<:@:[ { <\@:])"1
fd 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│
└─┴───┴─────┘
1 2 fd n
┌─┬───┐
│1│1 2│
├─┼───┤
│1│1 3│
├─┼───┤
│2│2 1│
├─┼───┤
│2│2 3│
├─┼───┤
│3│3 1│
├─┼───┤
│3│3 2│
└─┴───┘
2 fd n
┌───┐
│1 2│
├───┤
│1 3│
├───┤
│2 1│
├───┤
│2 3│
├───┤
│3 1│
├───┤
│3 2│
└───┘
If it were my choice I would keep zero indexing for the x argument as that is
more consistent for my J use and does not require the decrement to use with {
It also makes the dyadic part a bit simpler.
fd=.(<\) : ({&, <\)"1
Cheers, bob
> On Jun 23, 2020, at 17:05, Hauke Rehr <[email protected]> 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 <[email protected]> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm