<snapdata remixID="13471860"><project name="Library: Iteration, Composition" app="Snap! 9.0, https://snap.berkeley.edu" version="2"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAAAzlJREFUeF7t10FKY2EQhdFfUXDiFtyPGxB0oAbcidvJJrIeceIkBAevwVkPlOZy6QI5GaeqyHkfPHK2bdu2fAgMCZwJcEje2S8BAQphVECAo/yOC1ADowICHOV3XIAaGBUQ4Ci/4wLUwKiAAEf5HRegBkYFBDjK77gANTAqIMBRfscFqIFRAQGO8jsuQA2MCghwlN9xAWpgVECAo/yOC1ADowICHOV3XIAaGBUQ4Ci/4wLUwKiAAEf5HRegBkYFBDjK77gANTAqIMBRfscFqIFRAQGO8jsuQA2MCghwlN9xAWpgVECAo/yOC1ADowICHOV3XIAaGBUQ4Ci/4wLUwKiAAEf5HRegBkYFBDjK77gANTAqIMBRfscFqIFRAQGO8jsuQA2MCghwlN9xAWpgVECAo/yOC1ADowICHOV3XIAaGBUQ4Ci/4wLUwKiAAL/h3+/36/39fd3e3q6bm5vRh/Sbjwvwm6f78fGxXl5e1ufn53p7e1v39/fr4uJiPT09raurq9/cxH/9bQL8gftwOKzX19d1fX3917eOx+N6fn5e27Z9hemTCwgwCPB0Oq3Hx8d1fn6+7u7ucn2TS4D/+Ap+eHj4egXvdrt1eXkpnZKAAP0JKaWUrRFg5maqJCDAEqQ1mYAAMzdTJQEBliCtyQQEmLmZKgkIsARpTSYgwMzNVElAgCVIazIBAWZupkoCAixBWpMJCDBzM1USEGAJ0ppMQICZm6mSgABLkNZkAgLM3EyVBARYgrQmExBg5maqJCDAEqQ1mYAAMzdTJQEBliCtyQQEmLmZKgkIsARpTSYgwMzNVElAgCVIazIBAWZupkoCAixBWpMJCDBzM1USEGAJ0ppMQICZm6mSgABLkNZkAgLM3EyVBARYgrQmExBg5maqJCDAEqQ1mYAAMzdTJQEBliCtyQQEmLmZKgkIsARpTSYgwMzNVElAgCVIazIBAWZupkoCAixBWpMJCDBzM1USEGAJ0ppMQICZm6mSgABLkNZkAgLM3EyVBARYgrQmExBg5maqJCDAEqQ1mYAAMzdTJQEBliCtyQQEmLmZKgkIsARpTSYgwMzNVElAgCVIazIBAWZupkoCfwBN/Be3THjJawAAAABJRU5ErkJggg==</thumbnail><scenes select="1"><scene name="Library: Iteration, Composition"><notes></notes><hidden></hidden><headers></headers><code></code><blocks><block-definition s="catch %&apos;tag&apos; %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations>de:fange _ _&#xD;ca:agafa _ _&#xD;es:atrapar _ _&#xD;fr:attrape _ _&#xD;pt:captura _ _&#xD;</translations><inputs><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doRun"><block var="action"/><list></list></block></script><list><l>cont</l></list></block></block></script></block-definition><block-definition s="throw %&apos;cont&apos;" type="command" category="control"><header></header><code></code><translations>de:wirf _&#xD;ca:llança _&#xD;es:lanzar _&#xD;fr:lance _&#xD;pt:lança _&#xD;</translations><inputs><input type="%s">catchtag</input></inputs><script><block s="doRun"><block var="cont"/><list></list></block></script></block-definition><block-definition s="catch %&apos;tag&apos; %&apos;value&apos;" type="reporter" category="control"><header></header><code></code><translations>de:fange _ _&#xD;ca:agafa _ _&#xD;es:atrapar _ _&#xD;fr:attrape _ _&#xD;pt:captura _ _&#xD;</translations><inputs><input type="%upvar"></input><input type="%anyUE"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doReport"><block s="evaluate"><block var="value"/><list></list></block></block></script><list><l>cont</l></list></block></block></script></block-definition><block-definition s="throw %&apos;tag&apos; %&apos;value&apos;" type="command" category="control"><header></header><code></code><translations>de:wirf _ _&#xD;ca:llança _ _&#xD;es:lanzar _ _&#xD;fr:lance _ _&#xD;pt:lança _ _&#xD;</translations><inputs><input type="%s">catchtag</input><input type="%s"></input></inputs><script><block s="doRun"><block var="tag"/><list><block var="value"/></list></block></script></block-definition><block-definition s="if %&apos;test&apos; do %&apos;action&apos; and pause all $pause-1-255-220-0" type="command" category="control"><comment x="0" y="0" w="263.3333333333333" collapsed="false">This is a breakpoint block, to be used in debugging.&#xD;The Boolean input specifies the condition under which&#xD;the program should pause.  (Use True for an unconditional breakpoint.)  The intent is that the script should have&#xD;SHOW VARIABLE blocks for the process&apos;s local variables.&#xD;After the pause, this block automatically hides all temporary variables.</comment><header></header><code></code><translations>de:falls _ dann _ und pause $pause-1-255-220-0&#xD;ca:si _ fes _ i atura-ho tot $pause-1-255-220-0&#xD;es:si _ haz _ y páralo todo $pause-1-255-220-0&#xD;fr:si _ faire _ et mettre tout en pause $pause-1-255-220-0&#xD;pt:se _ , então _ e faz pausa em tudo $pause-1-255-220-0&#xD;</translations><inputs><input type="%boolUE"></input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>breakpoint</l></list></block><block s="doIf"><block s="evaluate"><block var="test"/><list></list></block><script><block s="doSetVar"><l>breakpoint</l><block var="test"/></block><block s="doShowVar"><l>breakpoint</l></block><block s="doRun"><block var="action"/><list></list></block><block s="doPauseAll"></block><block s="doHideVar"><l></l></block></script><list></list></block></script></block-definition><block-definition s="ignore %&apos;x&apos;" type="command" category="control"><comment x="0" y="0" w="206.66666666666666" collapsed="false">This block does nothing.&#xD;Use it when you are calling a reporter&#xD;for its side effect and don&apos;t care about&#xD;its return value.</comment><header></header><code></code><translations>de:ignoriere _&#xD;ca:ignora _&#xD;es:ignorar _&#xD;fr:ignore _&#xD;pt:ignora _&#xD;</translations><inputs><input type="%s"></input></inputs></block-definition><block-definition s="cascade %&apos;num&apos; times %&apos;function&apos; %&apos;init&apos; %&apos;#&apos;" type="reporter" category="control"><comment x="0" y="0" w="138" collapsed="false">Call f(f(f(...(f(x))))) n times where the three input slots are n, f, and x from left to right.  The # variable can be used inside f to represent how many times f has been called.</comment><header></header><code></code><translations>pt:o resultado de _ invocações em cascata de _ com argumento inicial _ _&#xD;ca:en cascada _ vegades _ _ _&#xD;</translations><inputs><input type="%n"></input><input type="%repRing"></input><input type="%s"></input><input type="%upvar"></input></inputs><script><block s="doDeclareVariables"><list><l>result</l></list></block><block s="doSetVar"><l>result</l><block var="init"/></block><block s="doSetVar"><l>#</l><l>0</l></block><block s="doRepeat"><block var="num"/><script><block s="doChangeVar"><l>#</l><l>1</l></block><block s="doSetVar"><l>result</l><block s="evaluate"><block var="function"/><list><block var="result"/></list></block></block></script></block><block s="doReport"><block var="result"/></block></script></block-definition><block-definition s="cascade until %&apos;pred&apos; %&apos;function&apos; %&apos;init&apos; %&apos;#&apos;" type="reporter" category="control"><comment x="0" y="0" w="210.47493489583334" collapsed="false">Call f(f(f(...(f(x))))) until condition is true, where the three input slots are condition, f, and x from left to right.  The # variable can be used inside f or condition to indicate how many times f has been called.</comment><header></header><code></code><translations>pt:o resultado da invocação em cascata até que _ de _ com argumento inicial _ _&#xD;ca:en cascada fins _ _ _ _&#xD;</translations><inputs><input type="%predRing"></input><input type="%repRing"></input><input type="%s"></input><input type="%upvar"></input></inputs><script><block s="doDeclareVariables"><list><l>result</l></list></block><block s="doSetVar"><l>result</l><block var="init"/></block><block s="doSetVar"><l>#</l><l>0</l></block><block s="doUntil"><block s="evaluate"><block var="pred"/><list><block var="result"/></list></block><script><block s="doChangeVar"><l>#</l><l>1</l></block><block s="doSetVar"><l>result</l><block s="evaluate"><block var="function"/><list><block var="result"/></list></block></block></script></block><block s="doReport"><block var="result"/></block></script></block-definition><block-definition s="compose %&apos;f&apos; %&apos;g&apos;" type="reporter" category="control"><comment x="0" y="0" w="151.33333333333334" collapsed="false">Returns the function x↦f(g(x)) where f and g are the two inputs.</comment><header></header><code></code><translations>pt:a composição de _ com _&#xD;ca:composa _ _&#xD;</translations><inputs><input type="%repRing"></input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="reifyReporter"><autolambda><block s="evaluate"><block var="f"/><list><block s="evaluate"><block var="g"/><list><l></l></list></block></list></block></autolambda><list></list></block></block></script></block-definition><block-definition s="repeat %&apos;action&apos; until %&apos;pred&apos;" type="command" category="control"><comment x="0" y="0" w="202.66666666666666" collapsed="false">Like the built-in REPEAT UNTIL block, except that the ending condition is not tested until the script has been run the first time.  So the script is run at least once.</comment><header></header><code></code><translations>pt:repete _ até que _ $loop-0.7&#xD;ca:repeteix _ fins _&#xD;</translations><inputs><input type="%cs"></input><input type="%boolUE"></input></inputs><script><block s="doRun"><block var="action"/><list></list></block><block s="doUntil"><block s="evaluate"><block var="pred"/><list></list></block><script><block s="doRun"><block var="action"/><list></list></block></script></block></script></block-definition><block-definition s="repeat %&apos;action&apos; while %&apos;pred&apos;" type="command" category="control"><comment x="0" y="0" w="287.3333333333333" collapsed="false">Run the script repeatedly, as long as the given condition is true.  Runs the script at least once before testing the condition.</comment><header></header><code></code><translations>pt:repete _ enquanto _ $loop-0.7&#xD;ca:repeteix _ mentre _&#xD;</translations><inputs><input type="%cs"></input><input type="%boolUE"></input></inputs><script><block s="doRun"><block var="action"/><list></list></block><block s="doUntil"><block s="reportNot"><block s="evaluate"><block var="pred"/><list></list></block></block><script><block s="doRun"><block var="action"/><list></list></block></script></block></script></block-definition><block-definition s="repeat while %&apos;pred&apos; %&apos;action&apos;" type="command" category="control"><comment x="0" y="0" w="264" collapsed="false">Runs the script repeatedly, as long as the condition is true. Tests the condition before the first time the script is run.  Like the built in REPEAT UNTIL except that in this block the condition must be true, not false.</comment><header></header><code></code><translations>pt:enquanto _ , repete _ $loop-0.7&#xD;</translations><inputs><input type="%boolUE"></input><input type="%cs"></input></inputs><script><block s="doUntil"><block s="reportNot"><block s="evaluate"><block var="pred"/><list></list></block></block><script><block s="doRun"><block var="action"/><list></list></block></script></block></script></block-definition><block-definition s="repeat %&apos;num&apos; %&apos;#&apos; %&apos;action&apos;" type="command" category="control"><comment x="0" y="0" w="171" collapsed="false">Runs the script the specified number of times, like the built-in REPEAT block, but this one provides the # variable that can be used inside the script.  Try&#xD;REPEAT (200)&#xD;                MOVE (#) STEPS&#xD;   RIGHT 92&#xD;with the pen down.</comment><header></header><code></code><translations>pt:repete _ vezes _ _ $loop-0.7&#xD;ca:repeteix _ _ _&#xD;</translations><inputs><input type="%n"></input><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doSetVar"><l>#</l><l>0</l></block><block s="doRepeat"><block var="num"/><script><block s="doChangeVar"><l>#</l><l>1</l></block><block s="doRun"><block var="action"/><list></list></block></script></block></script></block-definition><block-definition s="for %&apos;i&apos; = %&apos;start&apos; step %&apos;step&apos; to %&apos;end&apos; %&apos;action&apos;" type="command" category="control"><comment x="0" y="0" w="247.33333333333334" collapsed="false">The primitive FOR block uses an implicit step of ±1 depending on which of the starting and ending values is larger.  This version allows you to provide an explicit step value.  If the sign of the step input is incompatible with the ordering of the starting and ending values, the script will not be run at all.</comment><header></header><code></code><translations>pt:para _ de _ com passo _ a _ _ $loop-0.7&#xD;ca:per _ = _ incrementant _ fins _ _&#xD;</translations><inputs><input type="%upvar"></input><input type="%n">1</input><input type="%n">1</input><input type="%n">10</input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>test</l></list></block><block s="doSetVar"><l>i</l><block var="start"/></block><block s="doIfElse"><block s="reportVariadicLessThan"><list><block var="step"/><l>0</l></list></block><script><block s="doSetVar"><l>test</l><block s="reifyPredicate"><autolambda><block s="reportVariadicLessThan"><list><block var="i"/><block var="end"/></list></block></autolambda><list></list></block></block></script><script><block s="doSetVar"><l>test</l><block s="reifyPredicate"><autolambda><block s="reportVariadicGreaterThan"><list><block var="i"/><block var="end"/></list></block></autolambda><list></list></block></block></script></block><block s="doUntil"><block s="evaluate"><block var="test"/><list></list></block><script><block s="doRun"><block var="action"/><list></list></block><block s="doChangeVar"><l>i</l><block var="step"/></block></script></block></script></block-definition><block-definition s="let %&apos;a&apos; be %&apos;val&apos; in %&apos;loop&apos; %&apos;body&apos;" type="command" category="control"><comment x="0" y="0" w="238.66666666666666" collapsed="false">Provides LOOP as a function of one input that runs&#xD;the body of the LET with A set to the function input,&#xD;so the body can run itself recursively.&#xD;See COPY block in Variables for an example of use.</comment><header></header><code></code><translations>pt:tendo _ o valor inicial _ , executa _ definido como _&#xD;ca:fes que _ sigui _ al _ _&#xD;</translations><inputs><input type="%upvar"></input><input type="%s"></input><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doSetVar"><l>a</l><block var="val"/></block><block s="doSetVar"><l>loop</l><block s="reifyScript"><script><block s="doSetVar"><l>a</l><block var="new value"/></block><block s="doRun"><block var="body"/><list><block var="a"/></list></block></script><list><l>new value</l></list></block></block><block s="doRun"><block var="loop"/><list><block var="a"/></list></block></script></block-definition></blocks><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="false" hyperops="true" codify="false" inheritance="true" sublistIDs="false" id="323"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAAAXNSR0IArs4c6QAADoVJREFUeF7t1cEJAAAIxDDdf2m3sJ+4wEEQuuMIECBAgACBd4F9XzRIgAABAgQIjAB7AgIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECByxcQFpoRMBzwAAAABJRU5ErkJggg==</pentrails><costumes><list struct="atomic" id="324"></list></costumes><sounds><list struct="atomic" id="325"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites select="1"><sprite name="Sprite" idx="1" x="0" y="0" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="330"><costumes><list struct="atomic" id="331"></list></costumes><sounds><list struct="atomic" id="332"></list></sounds><blocks></blocks><variables></variables><scripts><script x="13.666666666667112" y="19.833333333333712"><custom-block s="catch %upvar %cs"><l>tag</l><script></script><comment w="204.9999999999999" collapsed="false">Input: Script&#xD;Output: Varies&#xD;The block runs the script within. If the tag is runned, it creates a break to run the code outside.&#xD;Example:&#xD;When iterating from 1 to 10, if we want to create a break when item equals to 4, we run tag. Then Snap runs the code outside catch tag.</comment></custom-block></script><script x="325.99999999999363" y="179.00000000000136"><custom-block s="catch %upvar %cs"><l>tag</l><script><block s="doFor"><l>i</l><l>1</l><l>10</l><script><block s="doIf"><block s="reportVariadicEquals"><list><block var="i"/><l>4</l></list></block><script><custom-block s="throw %s"><block var="tag"/></custom-block></script><list></list></block></script></block></script></custom-block><block s="doThinkFor"><l>Hmm...</l><l>2</l></block></script><script x="13.666666666667169" y="205.33333333333508"><custom-block s="throw %s"><l>catchtag</l><comment w="195.9999999999999" collapsed="false">Input: Tag&#xD;Output: Various&#xD;This command block works similar to running a tag. When a tag is thrown, the code outside catch tag is runned.&#xD;Example:&#xD;The same block as before is shown.</comment></custom-block></script><script x="323.3333333333253" y="341.99999999999926"><block s="reportVariadicProduct"><list><l>10</l><custom-block s="catch %upvar %anyUE"><l>tag</l><block s="reportVariadicSum"><list><l>3</l><block s="evaluate"><block s="reifyReporter"><script><block s="doReport"><l>5</l></block></script><list></list></block><list></list></block></list></block></custom-block></list></block></script><script x="10.666666666667112" y="464.24999999999477"><custom-block s="throw %s %s"><l>catchtag</l><l></l><comment w="196.0000000000001" collapsed="false">Input Tag and numbers, string or boolean&#xD;Output: Output of catch tag&#xD;This block throws a tag with a value and runs the remaining block with the input ignoring the block that would&apos;ve run without throw tag.&#xD;Example:&#xD;The catch tag output in this case is 20 instead of 5 due to throw tag which is multiplied with 10 to et 200.</comment></custom-block></script><script x="12.000000000000767" y="338.6666666666667"><custom-block s="catch %upvar %anyUE"><l>tag</l><l></l><comment w="190" collapsed="false">Input: Expression&#xD;Output: Numbers, Strings, boolean &#xD;This is a repoter block which perfoms similar to the catch tag command block.&#xD;Example:&#xD;A catch tag script without throw tag will execute the block and report the result.</comment></custom-block></script><script x="336.666666666664" y="469.16666666666697"><block s="reportVariadicProduct"><list><l>10</l><custom-block s="catch %upvar %anyUE"><l>tag</l><block s="reportVariadicSum"><list><l>3</l><block s="evaluate"><block s="reifyReporter"><script><custom-block s="throw %s %s"><block var="tag"/><l>20</l></custom-block><block s="doReport"><l>5</l></block></script><list></list></block><list></list></block></list></block></custom-block></list></block></script><script x="346.66666666665856" y="10"><custom-block s="catch %upvar %cs"><l>tag</l><script><block s="doFor"><l>i</l><l>1</l><l>10</l><script><block s="doIf"><block s="reportVariadicEquals"><list><block var="i"/><l>4</l></list></block><script><block s="doRun"><block var="tag"/><list></list></block></script><list></list></block></script></block></script></custom-block><block s="doThinkFor"><l>Hmm...</l><l>2</l></block></script><script x="10" y="622.1666666666672"><custom-block s="if %boolUE do %cs and pause all $pause-1-255-220-0"><l/><script></script><comment w="201.33333333333326" collapsed="false">Input: Boolean, script&#xD;Output: Breakpoint display&#xD;This is a breakpoint block, to be used in debugging. The Boolean input specifies the condition under which the program should pause. After the pause, this block automatically hides all temporary variables.</comment></custom-block></script><script x="12.666666666667112" y="881.5000000000006"><custom-block s="cascade %n times %repRing %s %upvar"><l></l><block s="reifyReporter"><script></script><list></list></block><l></l><l>#</l><comment w="209" collapsed="false">Input: Number, function, string&#xD;Output: Number, string&#xD;Call f(f(f(...(f(x))))) n times where the three input slots are n, f, and x from left to right.  The # variable can be used inside f to represent how many times f has been called.&#xD;Example:&#xD;Adding one to three two times report five.</comment></custom-block></script><script x="10.000000000000767" y="744.3333333333346"><custom-block s="ignore %s"><l></l><comment w="206.66666666666666" collapsed="false">Input: Number, strings, boolens, list, scripts&#xD;Output: Nothing&#xD;This block does nothing. Use it when you are calling a reporter for its side effect and don&apos;t care about its return value.&#xD;Example:&#xD;Any block as an input doesn&apos;t report or do anything.</comment></custom-block></script><script x="306.33333333333" y="751.3333333333347"><custom-block s="ignore %s"><block s="reportJoinWords"><list><l>hello </l><l>world</l></list></block></custom-block></script><script x="444.666666666664" y="882.6666666666664"><custom-block s="cascade %n times %repRing %s %upvar"><l>2</l><block s="reifyReporter"><autolambda><block s="reportVariadicSum"><list><l></l><l>1</l></list></block></autolambda><list></list></block><l>3</l><l>#</l></custom-block></script><script x="13.666666666667112" y="1019.4999999999995"><custom-block s="cascade until %predRing %repRing %s %upvar"><block s="reifyPredicate"><script></script><list></list></block><block s="reifyReporter"><script></script><list></list></block><l></l><l>#</l><comment w="210.47493489583334" collapsed="false">Input: Predicate, fuction, number, string&#xD;Output: Numbers, string, boolean&#xD;Call f(f(f(...(f(x))))) until condition is true, where the three input slots are condition, f, and x from left to right.  &#xD;Example:&#xD;Until # becomes 2, add one to three which reports five.</comment></custom-block></script><script x="465.6666666666649" y="1021.4999999999995"><custom-block s="cascade until %predRing %repRing %s %upvar"><block s="reifyPredicate"><autolambda><block s="reportVariadicEquals"><list><block var="#"/><l>2</l></list></block></autolambda><list></list></block><block s="reifyReporter"><autolambda><block s="reportVariadicSum"><list><l></l><l>1</l></list></block></autolambda><list></list></block><l>3</l><l>#</l></custom-block></script><script x="11.666666666666998" y="1156.9999999999998"><custom-block s="compose %repRing %repRing"><block s="reifyReporter"><script></script><list></list></block><block s="reifyReporter"><script></script><list></list></block><comment w="192.33333333333331" collapsed="false">Input: Functions&#xD;Output: Call expressions&#xD;Returns the function x↦f(g(x)) where f and g are the two inputs.&#xD;Example:&#xD;The compose block takes two functions: one adds one to the input and another multiplies the input by 5. It return the function f(g(x)).</comment></custom-block></script><script x="380.66666666666447" y="1158.9666666666676"><block s="evaluate"><block s="reifyReporter"><autolambda><custom-block s="compose %repRing %repRing"><block s="reifyReporter"><autolambda><block s="reportVariadicProduct"><list><l></l><l>5</l></list></block></autolambda><list></list></block><block s="reifyReporter"><autolambda><block s="reportVariadicSum"><list><l></l><l>1</l></list></block></autolambda><list></list></block></custom-block></autolambda><list></list></block><list><l>2</l></list></block></script><script x="15.666666666666998" y="1468.300000000004"><custom-block s="repeat %cs while %boolUE"><script></script><l/><comment w="218.33333333333326" collapsed="false">Input: Script, boolean&#xD;Output: Numbers, string, boolean, list&#xD;Run the script repeatedly, as long as the given condition is true.  Runs the script at least once before testing the condition.&#xD;Example:&#xD;Works simialr to repeat until block, the block keeps looping as long as the while statement is true.</comment></custom-block></script><script x="15.000000000000085" y="1304.2333333333374"><custom-block s="repeat %cs until %boolUE"><script></script><l/><comment w="202.66666666666666" collapsed="false">Input: Script, predicate&#xD;Output: Numbers, scripts, boolean, list&#xD;Like the built-in REPEAT UNTIL block, except that the ending condition is not tested until the script has been run the first time.  So the script is run at least once.&#xD;Example:&#xD;Adding &quot;thing&quot; to a list until the length of the list equalts to 5 creates a list with 5 elements</comment></custom-block></script><script x="311.66666666666583" y="1307.9666666666708"><block s="doDeclareVariables"><list><l>new list</l></list></block><block s="doSetVar"><l>new list</l><block s="reportNewList"><list></list></block></block><custom-block s="repeat %cs until %boolUE"><script><block s="doAddToList"><l>thing</l><block var="new list"/></block><block s="bubble"><block var="new list"/></block></script><block s="reportVariadicEquals"><list><block s="reportListAttribute"><l><option>length</option></l><block var="new list"/></block><l>5</l></list></block></custom-block></script><script x="338.66666666666583" y="1472.4666666666715"><block s="doDeclareVariables"><list><l>new list</l></list></block><block s="doSetVar"><l>new list</l><block s="reportNewList"><list></list></block></block><custom-block s="repeat %cs while %boolUE"><script><block s="doAddToList"><l>thing</l><block var="new list"/></block><block s="bubble"><block var="new list"/></block></script><block s="reportVariadicLessThan"><list><block s="reportListAttribute"><l><option>length</option></l><block var="new list"/></block><l>5</l></list></block></custom-block></script><script x="15.666666666666998" y="1638.3000000000065"><custom-block s="repeat while %boolUE %cs"><l/><script></script><comment w="238" collapsed="false">Input: Script, boolean&#xD;Output: Script&#xD;Runs the script repeatedly, as long as the condition is true. Tests the condition before the first time the script is run.  Like the built in REPEAT UNTIL except that in this block the condition must be true, not false.&#xD;Example:&#xD;To until a code until variable becomes 10, set var to 0 and change var in each iteration.</comment></custom-block></script><script x="393.66666666666583" y="1642.4666666666722"><block s="doDeclareVariables"><list><l>var</l></list></block><block s="doSetVar"><l>var</l><l>0</l></block><custom-block s="repeat while %boolUE %cs"><block s="reportVariadicLessThan"><list><block var="var"/><l>10</l></list></block><script><block s="doChangeVar"><l>var</l><l>1</l></block></script></custom-block><block s="doReport"><block var="var"/></block></script><script x="17.666666666667" y="1796.8000000000025"><custom-block s="repeat %n %upvar %cs"><l></l><l>#</l><script></script><comment w="231.00000000000006" collapsed="false">Input: Numbers, script&#xD;Output: Graphics, numbers, string&#xD;Runs the script the specified number of times, like the built-in REPEAT block, but this one provides the # variable that can be used inside the script.  &#xD;Example:&#xD;The number of repeats can be used to create a recursive graphic.</comment></custom-block></script><script x="373.9999999999991" y="1805.800000000003"><custom-block s="repeat %n %upvar %cs"><l>200</l><l>#</l><script><block s="forward"><block var="#"/></block><block s="turn"><l>92</l></block><block s="down"></block></script></custom-block></script><script x="17.666666666667" y="1938.13333333334"><custom-block s="for %upvar = %n step %n to %n %cs"><l>i</l><l>1</l><l>1</l><l>10</l><script></script><comment w="247.33333333333334" collapsed="false">Input: Numbers, script&#xD;Output: Numbers, list, string&#xD;This block uses an implicit step of ±1 depending on which of the starting and ending values is larger.  This version allows you to provide an explicit step value. The 1st input is start, then step and next input value.&#xD;Example:&#xD;When step = 2 and starting value is 1 and ending value is 10, the block iterates five times: 1, 3, 5, 7, and 9 skipping 2 values.</comment></custom-block></script><script x="490.6666666666656" y="1945.966666666673"><block s="doDeclareVariables"><list><l>list</l></list></block><block s="doSetVar"><l>list</l><block s="reportNewList"><list></list></block></block><custom-block s="for %upvar = %n step %n to %n %cs"><l>i</l><l>1</l><l>2</l><l>10</l><script><block s="doAddToList"><block var="i"/><block var="list"/></block></script></custom-block><block s="doReport"><block var="list"/></block></script><script x="24.666666666667" y="2099.4666666666744"><custom-block s="let %upvar be %s in %upvar %cs"><l>a</l><l></l><l>loop</l><script></script><comment w="235.66666666666663" collapsed="false">Input: Number, script&#xD;Output: Numbers, list, string&#xD;Provides LOOP as a function of one input that runs&#xD;the body of the LET with A set to the function input,&#xD;so the body can run itself recursively.&#xD;Example: &#xD;</comment></custom-block></script><script x="431.99999999999886" y="2105.80000000001"><custom-block s="let %upvar be %s in %upvar %cs"><l>a</l><l>4</l><l>loop</l><script></script></custom-block></script></scripts></sprite></sprites></stage><variables></variables></scene></scenes></project><media name="Library: Iteration, Composition" app="Snap! 9.0, https://snap.berkeley.edu" version="2"></media></snapdata>