Skip to content

Commit 3e7432a

Browse files
committed
fixes #796
1 parent 7b7e2a5 commit 3e7432a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

xml/chapter3/section1/subsection3.xml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,22 +1091,20 @@ paul_acc("withdraw", "rosebud")(50); // Withdraws 50, should return 40
10911091
<SNIPPET>
10921092
<EXAMPLE>exercise_3_8_solution_example</EXAMPLE>
10931093
<JAVASCRIPT>
1094-
function make_f(init) {
1095-
return x => {
1096-
init = x - init;
1097-
return init;
1098-
};
1094+
let v = -0.5;
1095+
function f(x) {
1096+
v = x + v;
1097+
return v;
10991098
}
1100-
1101-
const f = make_f(1/2);
11021099
</JAVASCRIPT>
11031100
</SNIPPET>
11041101

11051102
<SNIPPET HIDE="yes">
11061103
<NAME>exercise_3_8_solution_example</NAME>
11071104
<JAVASCRIPT>
1108-
display(f(1) + f(0));
1109-
display(f(0) + f(1));
1105+
// try these separately
1106+
display(f(0) + f(1)); // returns 0
1107+
display(f(1) + f(0)); // returns 1
11101108
</JAVASCRIPT>
11111109
</SNIPPET>
11121110
</SOLUTION>

0 commit comments

Comments
 (0)