On Thu, Dec 17, 2009 at 2:03 PM, Dan Bron <[email protected]> wrote: > Thomas Costigliola wrote: >> Recursive solutions, when written clearly, are easy to reason about and >> often seem obviously correct. > > I think this is a fair statement, qualified with "depending on the notion > they express". I do not think all loops would be easier
I also forgot an important qualification: we must be in a purely functional setting, or else everything turns into spaghetti > to understand as recursive calls. It's not the loop we are trying to understand it's the problem (or 'notion' as you referred to above). > > I am leery of recursion in J. It's not that $: & friends always break; the > stack depth is sufficient for many needs, it's just that > I don't even want to *worry* about it. I wish the interpreter optimized tail > calls, and my intuition is that it would be easy to > identify optimizable verbs algebraically. At least the tacit ones. > > -Dan > > PS: The test suite for Markov engines can be found concretely in J here: Thanks, it's lot easier using the rule lexer, no wonder it is part of the problem. BTW I started trying to come up with the state table for dyadic ;: to lex the rule files but I couldn't figure out how to do it in under around 18 states and I thought the table would be to big... I wish there were a specification-to-state-table converter verb where the specification is some text based grammar. > > http://www.jsoftware.com/svn/DanBron/trunk/challenge/RosettaCode/MarkovAlgorithm/MarkovAlgorithm.ijs > > Look for blocks that start with "assert". Or you can get them directly from > the source, the task description on RC: > > http://rosettacode.org/wiki/Markov_Algorithm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
