Skip to content

Commit

Permalink
fixes #814 (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-henz authored Jul 3, 2024
1 parent 2d6eb30 commit f352aa9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xml/chapter4/section2/subsection1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ factorial(5);
<JAVASCRIPT>functions</JAVASCRIPT>
</SPLITINLINE>
work in a normal-order language?
<SOLUTION>
(provided by GitHub user joeng03)
When evaluated in default (‘strict’) mode, the code undergoes applicative order reduction and runs into an infinite loop because it needs to evaluate the arguments of the unless function, but the factorial function does not have a terminating condition.
When evaluated in lazy mode, the code undergoes normal order reduction. It produces the correct output because the unless function is applied before its arguments are evaluated.
</SOLUTION>
</EXERCISE>

<EXERCISE>
Expand Down

0 comments on commit f352aa9

Please sign in to comment.