diff --git a/xml/chapter3/section1/subsection3.xml b/xml/chapter3/section1/subsection3.xml index d371b55e0..101b341e2 100644 --- a/xml/chapter3/section1/subsection3.xml +++ b/xml/chapter3/section1/subsection3.xml @@ -1091,22 +1091,20 @@ paul_acc("withdraw", "rosebud")(50); // Withdraws 50, should return 40 exercise_3_8_solution_example -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); exercise_3_8_solution_example -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