I would still advise care, when using $: (or even ^:_), because sometimes you'll need to shut down J (or sometimes even reboot your machine) to deal with the resulting resource consumption.
In the $: cases, you can only have tail call elimination when the result of $: is the result of the verb. If your verb does something with the result of $: you'll need to continue with that after the recursive instance completes. Of course, there's a variety of strategies which can be used here (recursion can be thought of as iterated substitution, for example), but the easiest approaches work best on small problems. (Which pretty much describes our starting point - we just get a different set of viable small problems with TCO. So it winds up being a solution searching for a problem. Luckily, problems can be really popular in some sets.) Thanks, -- Raul On Mon, Feb 23, 2015 at 1:54 PM, Dan Bron <[email protected]> wrote: > Pepe wrote: >> Dan, if you are reading this ... I wonder if you wrote a recursive >> prototype for nest2Box, or if you could write one, which you could >> share. > > Then, later: >> Never mind; I found: >> http://www.jsoftware.com/pipermail/programming/2011-November/025493.html >> and I should be able to take it from there. > > Sorry for the delayed replies, I only catch up with the Forums sporidically > these days. Now, I understand you have few misgivings about $: since: > >> One can now embed anonymous recursive verbs even >> when one is using an official interpreter. > > But still, one caveat about using $: remains! As I wrote in the message > you linked to above: > >> This assumes you trust $: not to abort with a stack error, which it does >> sometimes. Though I'd only expect that with long and deeply-nested >> arguments. > > Though with your recent TCO experiments, I imagine this risk has been > reduced as well [1]. BTW, the whole TCO thing made me feel quite > validated; I advocated (agitated?) for that feature years ago [2,3], and > was shot down on multiple fronts. Vindication! > > -Dan > > PS: I really have to spend some time going through your Mu et al, but > recently, playing with J seems permanently just out of reach, like > Tantalus' apple. > > [1] http://www.jsoftware.com/pipermail/programming/2009-May/014714.html > [2] http://www.jsoftware.com/pipermail/general/2003-August/013578.html > [3] http://www.jsoftware.com/pipermail/programming/2009-December/017357.html > > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
