The timing is because A. (currently) doesn't "know" that it's being invoked
with i.!n .

FYI, the Jwiki essay *Permutation Index
<https://code.jsoftware.com/wiki/Essays/Permutation_Index> *describes how
A. does its thing.  A. is particularly amusing on large arguments.

   (_1+!30x) A. i.30
29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2
1 0
   A. |. i.30
265252859812191058636308479999999
   !30x
265252859812191058636308480000000



On Mon, May 25, 2020 at 11:51 PM Jan-Pieter Jacobs <
janpieter.jac...@gmail.com> wrote:

> Yes, I just figured it out the same definition.
>
> However, I was very surprised to see perm massively outperforms tap:
>
> timespacex 'a=: perm 10'
> 0.3946 3.18771e8
>    timespacex 'b=: (A.&:i.~ !) 10'
> 2.74118 5.62038e8
>    a-:b
> 1
>
> JVERSION
> Engine: j901/j32/android
> Release-e: commercial/2020-02-09T15:23:16
> Library: 9.01.24
> J Android: 1.4.08/7.1.2/25
> Platform: Android 32 (armeabi-v7a)
> Installer: unknown
> InstallPath: /storage/emulated/0/Android/data/com.jsoftware.j.android/files
> Contact: www.jsoftware.com
>
>
> Perhaps an opportunity for performance improvement in dyadic A. ?
>
> Best regards,
>
> Jan-Pieter
>
> On Mon, May 25, 2020, 22:59 'Mike Day' via Programming <
> programm...@jsoftware.com> wrote:
>
> > If I can’t remember the idiom, I look for “tap.”  My favourite form is
> >       tap =:  A.&i.~ !
> >
> >    (perm-: tap)3. NB. Same results.....
> > 1
> >
> > Cheers,
> >
> > Mike
> > Sent from my iPad
> >
> > > On 25 May 2020, at 21:44, Skip Cave <s...@caveconsulting.com> wrote:
> > >
> > > perm
> > >
> > > 3 : 0
> > >
> > > z=. i.1 0
> > >
> > > for. i.y do. z=. ,/ (0 ,. 1 + z) {"2 1 \:"1 = i. 1 + {: $z end.
> > >
> > > :
> > >
> > > ,/ ({~ perm@#)"1 x comb y
> > >
> > > )
> > >
> > >
> > ----------------------------------------------------------------------
> > 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