Skip to content

Commit 59a3725

Browse files
authored
fixes #802 (#1010)
1 parent 452c6b7 commit 59a3725

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

xml/chapter3/section3/subsection1.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ set_to_wow(z2);
14411441
<JAVASCRIPT>function</JAVASCRIPT>
14421442
</SPLITINLINE>
14431443
<SNIPPET EVAL="yes">
1444+
<NAME>count_pairs</NAME>
14441445
<INDEX><DECLARATION>count_pairs</DECLARATION><FRAGILE/></INDEX>
14451446
<SCHEME>
14461447
(define (count-pairs x)
@@ -1476,18 +1477,18 @@ function count_pairs(x) {
14761477
<SOLUTION>
14771478
<SNIPPET>
14781479
<NAME>exercise_3_16_solution</NAME>
1480+
<REQUIRES>count_pairs</REQUIRES>
14791481
<EXAMPLE>exercise_3_16_solution_example</EXAMPLE>
14801482
<SCHEME>
14811483
</SCHEME>
14821484
<JAVASCRIPT>
1483-
const cycle = make_cycle(three_list);
1484-
14851485
const three_list = list("a", "b", "c");
1486-
1487-
const one = pair("a", "b");
1488-
const three = pair(one, one);
1489-
const four = pair(three, "c");
1490-
const seven = pair(three, three);
1486+
const one = pair("d", "e");
1487+
const two = pair(one, one);
1488+
const four_list = pair(two, "f");
1489+
const seven_list = pair(two, two);
1490+
const cycle = list("g", "h", "i");
1491+
set_tail(tail(tail(cycle)), cycle);
14911492
</JAVASCRIPT>
14921493
</SNIPPET>
14931494

@@ -1496,8 +1497,8 @@ const seven = pair(three, three);
14961497
<JAVASCRIPT>
14971498
// return 3; return 4; return 7;
14981499
display(count_pairs(three_list));
1499-
display(count_pairs(four));
1500-
display(count_pairs(seven));
1500+
display(count_pairs(four_list));
1501+
display(count_pairs(seven_list));
15011502

15021503
// never return at all
15031504
display(count_pairs(cycle));

0 commit comments

Comments
 (0)