A slight variation:
permh=: (- i.) #: i.@!
Thanks again,
--
Raul
On Sun, Oct 31, 2021 at 2:27 PM xash wrote:
>
> With mixed bases, for e.g. 3:
> 3 2 1 #: i. 6
>
> An equivalent function of permh is thus:
> (>:@i.@- #: i.@!) 3
>
> If you want to map arbitrary n to a permutation with unknown
Nice!
(I feel like I should have seen that...)
Thanks,
--
Raul
On Sun, Oct 31, 2021 at 2:27 PM xash wrote:
>
> With mixed bases, for e.g. 3:
> 3 2 1 #: i. 6
>
> An equivalent function of permh is thus:
> (>:@i.@- #: i.@!) 3
>
> If you want to map arbitrary n to a permutation with unknown leng
With mixed bases, for e.g. 3:
3 2 1 #: i. 6
An equivalent function of permh is thus:
(>:@i.@- #: i.@!) 3
If you want to map arbitrary n to a permutation with unknown length,
you could use something like this (I love J for things like !^:_1):
(#:~ [:>:@i.@-@<.@>: !^:_1)"0 (2+i.4) NB. needs specia
(I really do not know the "right" historical terminology for talking
about this, thus the subject line and the odd intro I am using here.)
In the Tower of Hanoi puzzle, we move a stack of disks from one tower
to another, moving only the top piece.
But imagine that we could remove the disks in any