Skip to content

Commit aebf675

Browse files
authored
fixes #836 (#1023)
1 parent 4f11cf0 commit aebf675

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

xml/chapter3/section3/subsection4.xml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -570,21 +570,6 @@ function logical_and(s1, s2) {
570570
}
571571
</JAVASCRIPT>
572572
</SNIPPET>
573-
<SNIPPET HIDE="yes">
574-
<NAME>logical_or</NAME>
575-
<JAVASCRIPT>
576-
function logical_or(s1, s2) {
577-
return s1 === 0 &amp;&amp; s2 === 0
578-
? 0
579-
: s1 === 0 || s1 === 1
580-
? s2 === 0 || s2 === 1
581-
? 1
582-
: error(s2, "invalid signal")
583-
: error(s1, "invalid signal");
584-
}
585-
</JAVASCRIPT>
586-
</SNIPPET>
587-
588573
<PDF_ONLY>
589574
<!-- Figure moved here from earlier for SICP JS pagination -->
590575
<!-- Figure code is copy of code earlier in this file in a WEB_ONLY -->
@@ -673,12 +658,32 @@ function and_gate(a1, a2, output) {
673658
<JAVASCRIPT><JAVASCRIPTINLINE>and_gate</JAVASCRIPTINLINE>.
674659
</JAVASCRIPT>
675660
</SPLITINLINE>
676-
<SNIPPET HIDE="yes">
677-
<NAME>or_gate</NAME>
678-
<REQUIRES>get_signal</REQUIRES>
679-
<REQUIRES>after_delay</REQUIRES>
680-
<REQUIRES>logical_or</REQUIRES>
681-
<JAVASCRIPT>
661+
<LABEL NAME="ex:3_28"/>
662+
<SOLUTION>
663+
<SNIPPET>
664+
<NAME>logical_or</NAME>
665+
<JAVASCRIPT>
666+
// contributed by GitHub user clean99
667+
668+
function logical_or(s1, s2) {
669+
return s1 === 0 &amp;&amp; s2 === 0
670+
? 0
671+
: s1 === 0 || s1 === 1
672+
? s2 === 0 || s2 === 1
673+
? 1
674+
: error(s2, "invalid signal")
675+
: error(s1, "invalid signal");
676+
}
677+
</JAVASCRIPT>
678+
</SNIPPET>
679+
<SNIPPET>
680+
<NAME>or_gate</NAME>
681+
<REQUIRES>get_signal</REQUIRES>
682+
<REQUIRES>after_delay</REQUIRES>
683+
<REQUIRES>logical_or</REQUIRES>
684+
<JAVASCRIPT>
685+
// contributed by GitHub user clean99
686+
682687
function or_gate(a1, a2, output) {
683688
function or_action_function() {
684689
const new_value = logical_or(get_signal(a1),
@@ -690,9 +695,9 @@ function or_gate(a1, a2, output) {
690695
add_action(a2, or_action_function);
691696
return "ok";
692697
}
693-
</JAVASCRIPT>
694-
</SNIPPET>
695-
<LABEL NAME="ex:3_28"/>
698+
</JAVASCRIPT>
699+
</SNIPPET>
700+
</SOLUTION>
696701
</EXERCISE>
697702

698703
<EXERCISE>

0 commit comments

Comments
 (0)