Skip to content

Commit

Permalink
fixes #796 (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-henz authored Jul 2, 2024
1 parent 9175403 commit 452c6b7
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions xml/chapter3/section1/subsection3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1091,22 +1091,20 @@ paul_acc("withdraw", "rosebud")(50); // Withdraws 50, should return 40
<SNIPPET>
<EXAMPLE>exercise_3_8_solution_example</EXAMPLE>
<JAVASCRIPT>
function make_f(init) {
return x => {
init = x - init;
return init;
};
let v = -0.5;
function f(x) {
v = x + v;
return v;
}

const f = make_f(1/2);
</JAVASCRIPT>
</SNIPPET>

<SNIPPET HIDE="yes">
<NAME>exercise_3_8_solution_example</NAME>
<JAVASCRIPT>
display(f(1) + f(0));
display(f(0) + f(1));
// try these separately
display(f(0) + f(1)); // returns 0
display(f(1) + f(0)); // returns 1
</JAVASCRIPT>
</SNIPPET>
</SOLUTION>
Expand Down

0 comments on commit 452c6b7

Please sign in to comment.