Skip to content

Commit 28d789e

Browse files
authored
Update SimpleRecursion.md
1 parent eae39f0 commit 28d789e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/SimpleRecursion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A named expression is simply recursive if its body includes references to the ex
88
Fact = λ n . IfThenElse (IsZero n) One (Mult n (Fact (Pred n)))
99
^^^^
1010
````
11-
This is simply recursive because `Fact`'s body includes a reference to `Fact`. To convert this to a raw lambda expression each reference in the right-hand side (`IfThenElse`, `IsZero` etc) is replaced by its definition. This would imply replacing the `Fact` in the right-hand side with the definition of `Fact` (i.e. the right-hand side in its entirety), which includes a reference to `Fact`. We would therefore be stuck in a loop - forever replacing a reference to `Fact` by its definition, only to discover that we have introduced yet another reference to `Fact`.
11+
This is simply recursive because `Fact`'s body includes a reference to `Fact`. To convert this to a raw lambda expression each reference in the right-hand side (`IfThenElse`, `IsZero` etc) is replaced by its definition. This would imply replacing the `Fact` in the right-hand side with the definition of `Fact` (i.e. the right-hand side in its entirety), which obviously includes a reference to `Fact`. We would therefore be stuck in a loop - forever replacing a reference to `Fact` by its definition, only to discover that we have introduced yet another reference to `Fact`.
1212

1313
The solution is to re-formulate the definition of `Fact` and use the Y-combinator.
1414

0 commit comments

Comments
 (0)