As a little note, you could use the special code >./@, to shorten the last little snippet from ((>./)@:|@,) to ((>./@,)@:|), which cuts off about half the time of the left side of the fork. (not much relative to the total, but worth looking at).
Marshall -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Roger Hui Sent: Wednesday, September 01, 2010 8:28 PM To: Programming forum Subject: Re: [Jprogramming] Splitting an integer into its digits 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
