I guess it works. The problem is that if you did it rank one, that would essentially be the same as applying your verb rank one anyway for this problem.
Also, it's probably better to not actually sum stuff up: dropzeros=. #~ [: +./\ ~:&0 should take advantage of +./ stopping and returning 1 whenever it gets to a 1. I haven't actually run it, so I can't say the performance implications. Marshall -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of gary ng Sent: Sunday, August 29, 2010 7:55 PM To: Programming forum Subject: Re: [Jprogramming] Splitting an integer into its digits On Sun, Aug 29, 2010 at 11:49 AM, Alex Gian <[email protected]> wrote: > Thanks for the tip about the precomputed values, I should have done it > to be fair, since I use it in my Perl comparison, but I forgot as I'm > concentrating on learning J here... It does indeed bring a big > speedup, although I'm pretty sure that my integer-splitting method is > a quite a bit faster than the one you suggest. > > I like the idea of using rank 1 rather than transpose. > > Anyway, fastest I've got so far, and quite an acceptable result to me > would now be specialX -. = +/"1@({&f)@(10&#.inv) if only I could sort > out the leading zero problem. Your not sure if this is an efficient way to do a 'dropWhile (=0)' (#~[:>&0+/\) 0 1 2 3 => 1 2 3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
