Aai wrote:
>  e.g. is it possible to avoid 'some' boxing.

I responded:
>  Oh!  Sure.

The final form of the solution I posted to RC is:

           hc10kE     =:  1 1 , exp...@tail
             expand   =:  2+I.@;
             tail     =:  copies&.>^:(<@>:`(<@,@2:))
               copies =:  >: |.@(#!.1 |.)~ 1 j. #;.1 #^:_1 ::1:~ ]~:{.

I added it as an "alternative solution", noting that while it is slightly
more complex, it is exponentially faster.  Should I post the "true
recursive" ($:) formulation as well?

-Dan

PS: I find it appealing that "copies" is a showcase for all the features of
#  : tally, copy in its full generality (i.e. with complex arguments), and
expand, with fit even.  The verb is also a good way to understand how expand
differs from complex copy, and when you'd choose one over the other.  

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to