The second expression can be simplified to
('0123456789' i. ":)&.>dd
which would make much it easier to understand
and 50% faster.
10&#. b. _1
($&10@>:@(10&(<....@^.))@(1&>.)@(>./)@:|@, #: ]) :.(10&#.)
reveals why 10&#.^:_1 is so much slower and
points to substantial room for improvement
if we decide to do something about it.
----- Original Message -----
From: Devon McCormick <[email protected]>
Date: Wednesday, September 1, 2010 17:03
Subject: Re: [Jprogramming] Splitting an integer into its digits
To: Programming forum <[email protected]>
> dd=. 1e5?2e9
> 6!:2 '(10&#.^:_1 )&.>dd'
> 3.7797712
> 6!:2 '((<''0123456789'')i.&>":&.>)&.>dd'
> 0.15169945
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm