Mutual recursion: Difference between revisions

m
Line 936:
Forward declarations are not an issue in Ursala, which allows any
definition to depend on any symbol declared in within the same
scope. However, cyclic dependences are not allowedunderstood unless the
programmer isexplicitly preparedaccounts tofor explaintheir what they meansemantics. If the recurrence
can be solved using a fixed point combinator, the compiler can be
directed to use one by the #fix directive. Aas fixedshown, pointin combinatorthis case
with one of a family of functional fixed point combinators from
appropriate for first order functions is available as a library
a library. (There are easier ways to define these functions in Ursala
function, as shown below. User defined fixed point combinators
than by mutual recursion, but fixed points have other applications.)
allowing recursive definitions of things other than functions are also
possible. Note that this feature is rarely needed for defining
functions because the language
provides other more convenient mechanisms.
 
<lang Ursala>
Line 952 ⟶ 949:
#import sol
 
#fix general_function_fixer 0
#fix extensional_function_fixer
 
F = ~&?\1! difference^/~& M+ F+ predecessor
Line 966 ⟶ 963:
<1,1,2,2,3,3,4,5,5,6,6,7,8,8,9,9,10,11,11,12>,
<0,0,1,2,2,3,4,4,5,6,6,7,7,8,9,9,10,11,11,12>)</pre>
 
 
=={{header|x86 assembly}}==
Anonymous user