Thanks Dan, for this elaborate explanation about reformulating HCF. Ran
over it, but no time today. Tomorrow I'll study it in detail.
Yes, feel free to post the recursive one as well.
Hallo Dan Bron, je schreef op 13-03-10 22:38:
> 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
>
>
--
Met vriendelijke groet,
=@@i
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm