Skip to content

Commit f352aa9

Browse files
authored
fixes #814 (#1015)
1 parent 2d6eb30 commit f352aa9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

xml/chapter4/section2/subsection1.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ factorial(5);
342342
<JAVASCRIPT>functions</JAVASCRIPT>
343343
</SPLITINLINE>
344344
work in a normal-order language?
345+
<SOLUTION>
346+
(provided by GitHub user joeng03)
347+
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.
348+
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.
349+
</SOLUTION>
345350
</EXERCISE>
346351

347352
<EXERCISE>

0 commit comments

Comments
 (0)