I think--although I am unclear on your question exactly--that you are
mixing up
   (+/"1@({&f)@digits + [:(-~<./)grp) i.11
With 
   +/"1@({&f)@(digits + [:(-~<./)grp) i.11

In the second one, you would end up taking _1{f. 

But in the first, you first take +/"1@({&f)@digits, which is the correct sum
with leading 0s. Then you subtract 1 for each leading 0 that you added 1
for. In this case, you never take _1{f, so it is unimportant.


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of gary ng
Sent: Monday, August 30, 2010 6:24 PM
To: Programming forum
Subject: Re: [Jprogramming] Splitting an integer into its digits

On Mon, Aug 30, 2010 at 8:22 AM, R.E. Boss <[email protected]> wrote:
> Further improvement:
> @({&f)@digits + [:(-~<./)grp) d'

thanks. After looking at this, I know better what Marshall was talking
about. However, there is still something that I don't quite understand
   (digits + [:(-~<./)grp) i.11
_1 _1
_1  0
_1  1
_1  2
_1  3
_1  4
_1  5
_1  6
_1  7
_1  8
 1  0
   (+/"1@({&f)@digits + [:(-~<./)grp) i.11
0      0
0      1
0      3
0      8
0     27
0    124
0    725
0   5046
0  40327
0 362888
2      1
  (+/"1@({&f)@digits + [:(-~<./)grp) i.11
1 2 4 9 28 125 726 5047 40328 362889 3

What would be the lookup result of _1 { f ? It shows 0 but if I just type -1
{ f, I get something else.

Also where does the extra +1 come from when I put back the +/"1 to the rank
1 row ?

Hope you don't mind for the questions.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to