Content deleted Content added
Maxeto0910 (talk | contribs) Added short description. Tags: Mobile edit Mobile web edit Advanced mobile edit |
m Fixing bare references Wikipedia:Bare_URLs |
||
Line 97:
Mutual recursion is very common in [[functional programming]], and is often used for programs written in [[Lisp (programming language)|LISP]], [[Scheme (programming language)|Scheme]], [[ML (programming language)|ML]], and similar [[programming language]]s. For example, Abelson and Sussman describe how a [[meta-circular evaluator]] can be used to implement LISP with an eval-apply cycle.<ref>{{Cite book|last=Abelson|first=Harold|url=https://web.mit.edu/alexmv/6.037/sicp.pdf|title=Structure and Interpretation of Computer Programs|last2=Sussman|first2=Gerald Jay|last3=Sussman|first3=Julie|publisher=The MIT Press|year=1996|isbn=978-0262510875|___location=London, England|pages=492}}</ref> In languages such as [[Prolog]], mutual recursion is almost unavoidable.
Some programming styles discourage mutual recursion, claiming that it can be confusing to distinguish the conditions which will return an answer from the conditions that would allow the code to run forever without producing an answer. [[Peter Norvig]] points to a [[design pattern]] which discourages the use entirely, stating:<ref>
{{quote|text=If you have two mutually-recursive functions that both alter the state of an object, try to move almost all the functionality into just one of the functions. Otherwise you will probably end up duplicating code.}}
|