Jump to content

Y combinator: Difference between revisions

m
→‎{{header|Dhall}}: Tidied a minor typo.
m (→‎{{header|Dhall}}: Tidied a minor typo.)
Line 2,124:
=={{header|Dhall}}==
 
Dhall is not a turing complete language, so there's no way to implement the real Y combinator. That being said, you can replicate the effects of the Y combinator to any arbitrary but finite recursion depth using the builtin function Natural/Fold, which acts as a bounded fixed-point combinator that takes a natural argument to describe how harfar to recurse.
 
Here's an example using Natural/Fold to define recursive definitions of fibonacci and factorial:
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.