Skip to content

fixes #814 #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading