Right, this example demonstrates that the standard recipes 
( http://www.jsoftware.com/pipermail/general/2003-August/015571.html ) to 
convert recursive tail calls to the form (u ^: v ^: _) do not always work 
properly because 'almost' can make success to become failure 
(http://www.jsoftware.com/pipermail/programming/2009-October/016513.html),

   recur=: next^:NotMatch^:_
   
   evolve 'METHINKS IT IS LIKE A WEASEL'
D YPI DS IVJ I LJVEGQEUMASWL

If J had tail recursion (even a 'dumb' one) then presumably the recursive 
version would not only have an augmented domain but would also outperform, at 
least, the workarounds discussed in the 'limit limitation' thread for this and 
for similar situations ( see 
http://www.jsoftware.com/pipermail/general/2005-July/023322.html ).



________________________________
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Sent: Wed, December 23, 2009 6:29:25 PM
Subject: Re: [Jprogramming] Recursive tail calls (WAS: Tacit exercise)

On Wed, Dec 23, 2009 at 5:45 PM, Jose Mario Quintana
<[email protected]> wrote:
>    recur=. ]`([ $: next)@.NotMatch

So... this one is almost like
  recur=: next^:NotMaatch^:_

the difference is the automatic termination
that the latter randomly gets.

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