<blocksapp="Snap! 4.0, http://snap.berkeley.edu"version="1"><block-definitions="cascade %'num' times %'function' %'init' %'#'"type="reporter"category="control"><commentx="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><inputs><inputtype="%n"></input><inputtype="%repRing"></input><inputtype="%s"></input><inputtype="%upvar"></input></inputs><script><blocks="doDeclareVariables"><list><l>result</l></list></block><blocks="doSetVar"><l>result</l><blockvar="init"/></block><blocks="doSetVar"><l>#</l><l>0</l></block><blocks="doRepeat"><blockvar="num"/><script><blocks="doChangeVar"><l>#</l><l>1</l></block><blocks="doSetVar"><l>result</l><blocks="evaluate"><blockvar="function"/><list><blockvar="result"/></list></block></block></script></block><blocks="doReport"><blockvar="result"/></block></script></block-definition><block-definitions="cascade until %'pred' %'function' %'init' %'#'"type="reporter"category="control"><commentx="0"y="0"w="90"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><inputs><inputtype="%predRing"></input><inputtype="%repRing"></input><inputtype="%s"></input><inputtype="%upvar"></input></inputs><script><blocks="doDeclareVariables"><list><l>result</l></list></block><blocks="doSetVar"><l>result</l><blockvar="init"/></block><blocks="doSetVar"><l>#</l><l>0</l></block><blocks="doUntil"><blocks="evaluate"><blockvar="pred"/><list><blockvar="result"/></list></block><script><blocks="doChangeVar"><l>#</l><l>1</l></block><blocks="doSetVar"><l>result</l><blocks="evaluate"><blockvar="function"/><list><blockvar="result"/></list></block></block></script></block><blocks="doReport"><blockvar="result"/></block></script></block-definition><block-definitions="compose %'f' %'g'"type="reporter"category="control"><commentx="0"y="0"w="90"collapsed="false">Returns the function f(g(x)) where f and g are the two inputs.</comment><header></header><code></code><inputs><inputtype="%repRing"></input><inputtype="%repRing"></input></inputs><script><blocks="doReport"><blocks="reifyReporter"><autolambda><blocks="evaluate"><blockvar="f"/><list><blocks="evaluate"><blockvar="g"/><list><l></l></list></block></list></block></autolambda><list></list></block></block></script></block-definition><block-definitions="repeat %'action' until %'pred'"type="command"category="control"><commentx="0"y="0"w="90"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><inputs><inputtype="%cs"></input><inputtype="%boolUE"></input></inputs><script><blocks="doRun"><blockvar="action"/><list></list></block><blocks="doUntil"><blocks="evaluate"><blockvar="pred"/><list></list></block><script><blocks="doRun"><blockvar="action"/><list></list></block></script></block></script></block-definition><block-definitions="repeat %'action' while %'pred'"type="command"category="control"><commentx="0"y="0"w="90"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><inputs><inputtype="%cs"></input><inputtype="%boolUE"></input></inputs><script><blocks="doRun"><blockvar="action"/><list></list></block><blocks="doUntil"><blocks="reportNot"><blocks="evaluate"><blockvar="pred"/><list></list></block></block><script><blocks="doRun"><blockvar="act