OOps - it is still recursive.  Perhaps it's unavoidable,

M


On 31/10/2017 14:33, 'Mike Day' via Programming wrote:
Well done!  I too was trying to see how to remove the recursion,

without success.

Have you considered the (trivial) modification,  to rename "r" as "a",

and "a" as something else,  to allow easier comparison with your verb?


BTW,  I'd be interested to see reactions to my offering of a "constructive"

approach,  sent some time yesterday.   I've complicated it somewhat in

slightly reducing the amount of redundancy necessitating filtering out

unsuitable rows,  but won't trouble the forum with those changes yet,

if ever.


Also, apologies to you and Lippu Esa for getting your names wrong.  My

lame excuse is that I was sending messages from iPad,  re work on a laptop.


Mike


On 31/10/2017 09:23, Erling Hellenäs wrote:
parRuskey =: 4 : 0
r=. (i.y) S (x-1);y-1
r </."1 i.y
)

S =: 4 : 0
'k n' =. y
a=.x
r=. (0,_1{.$a)$0
if. k=n do.
  r=.a
else.
  for_i. i.k+1 do.
    r=.r, (i n } a) S k;n-1
  end.
  if. k > 0 do.
    r=.r, (k n } a) S (k-1);n-1
  end.
end.
r
)


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
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