Hi Rick, I think we've both encountered the same concerns with coding style in Clojure. I can't really say which is better - a large list of conditions or a mutually recursive implementation. I have a feeling that it depends on your fluency in functional languages. For me, I'm relatively new to the functional scene and so I tend to find sequential code to be rhythmic, like you. On the other hand, I can certainly see how somebody who thinks more functionally would be able to clearly read the twists and turns of mutual recursion, and it seems like a solution with many functions would be more modular and therefore easily extensible.
Also, I wouldn't say that trampolining isn't widely understood. There's just not many use cases for it in the types of projects we've been doing. I remember a time when recursion was difficult but the intricacies passed very fast once I stuck to it :) ~ Kai On Jul 3, 6:13 pm, Rick Moynihan <rick.moyni...@gmail.com> wrote: > Hi Kai, > > 2009/7/2 Kai <poki...@gmail.com>: > > > @Rick > > > I got fairly far into this before I had problems with stack overflows. > > I found out later than I needed knowledge of trampoline and mutual > > recursion to solve the issue. I think the approach still has potential > > but the setback forced me to consider other options. This lead me to > > implement the stack local in the recursive definition of parse-code. > > Thanks for your comprehensive answer. I've read about > mutually-recursive functions but never really known where these issues > might occur in the wild outside of Stuart's discussion of trampolines > in Programming Clojure. As I wrote my previous email I began to > suspect by the liberal recur's that this was the case (it's amazing > the amount of times through writing an email asking a question about > some code you stumble upon the solution), though I'm really glad > you've cleared this up for me. > > Is it fair to say that you've made a trade off here? i.e. it seems > you're trading off the costs associated with having a large function > definition against the less widely understood techniques of mutual > recursion and trampolining? If so I'm inclined to agree that this is > a fair trade off, particularly because of the rhythmic nature of the > code and of course the fact that by using recur you're codifying a > guarantee to your readers that you're tail calling. > > I am now curious as to whether or not this program would be clearer > with trampolines. > > Thanks again for sharing and enlightening us with your discussion! > > R. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---