There's an opportunity here for improving idioms like (A.&i.~ !) But, A. is already a lot faster than perm in some other contexts:
!10 3.6288e6 3e6 A. i.10 8 2 4 1 7 0 3 5 6 9 3e6 { perm 10 8 2 4 1 7 0 3 5 6 9 timespacex '3e6 A. i.10' 4e_6 1856 timespacex '3e6 { perm 10' 0.198427 6.3754e8 Makes sense? -- Raul On Tue, May 26, 2020 at 2:51 AM 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