Recursion on substructures of an argument is not tail recursion. Use
full recursion for that.

Tail recursion can only occur when the result of the function you are
calling will be the result of your current evaluation instance.

Thanks,

-- 
Raul


On Wed, Dec 20, 2017 at 3:34 PM, Dabrowski, Andrew John
<[email protected]> wrote:
> This isn't a complete workaround for tail recursion though.  The while 
> function
>
> F^:test^:_ arg
>
>
> doesn't lend itself e.g. to recursion on substructures of arg.
>
> To exercise my J muscles I've been playing around with 3n+1 problem, and I 
> very quickly ran into stack errors.  Is there a way to expand the stack?
>
>
> On 12/19/2017 06:07 PM, Raul Miller wrote:
>
> J's induction operation ( ^: ) is very similar to tail recursion (in terms
> of data flow) except that it does not have full recursion as one of its
> failure modes.
>
>
>
> ----------------------------------------------------------------------
> 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