<snapdata remixID="12198441"><project name="Programming tools" app="Snap! 9.0, https://snap.berkeley.edu" version="2"><notes>Look inside ((thx 2 other Snap!-users for ideas!) &#xD;&#xD;It&apos;s a work in progress. Some of the functions it contains:&#xD;1. "do": though it may look useless at first sight it’s actually quite handy for a programmer, facilitating code development, debugging and documentation;&#xD;2. "let"+ "be": a mechanism for declaring and at the same time initializing (multiple) variables.&#xD;3. A logging facility, for debugging and optimization.&#xD;4. Commands to modify a variable&apos;s value.&#xD;5. Advanced sorting options.&#xD;6. Memoïzation, both for single&#126; and multi-variable (recursive) functions.</notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAoKADAAQAAAABAAAAeAAAAAAeaS0RAAAE70lEQVR4Ae2dTUhUURTHj6YRQp8uIhywkKQkg4LaiGB+RJgEYWWplDGbLE2sZdt2LQqhRaskkCgQ2vSxEKK1UlBWUBEYkX1QERFC1tiMpmnKOF6unDtzfm7See/ec8/v/2Pue+K8ssbiX8IXBJQIZCvVpSwExgkgICKoEkBAVfwUR0AcUCWAgKr4KY6AOKBKAAFV8VMcAXFAlQACquKnOALigCoBBFTFT3EExAFVAgioip/iCIgDqgQQUBU/xREQB1QJIKAqfoojIA6oEkBAVfwUR0AcUCWAgKr4KY6AOKBKAAFV8VMcAXFAlQACquKnOALigCoBBFTFT3EExAFVAgioip/iCIgDqgQQUBU/xREQB1QJIKAq/tSKDw4OpnZiGp6Vk4ZrNrfk7OVDcvpyqewsbpHRr+tlX1Wb5OfnZwSHLB7Rmx45nr90XJYUd08t9tVAnjQf6JR3gxFpOnRi6vV0+wYB0yixQ2ezZFvV7AXHYiKPr++RGz13Zx8M/BUEDDygyeX9/w74sn+ZNB88I8Pj74Ctk6el3b9cA6ZBZM+GbsvH3G7ZkXtMfn3dMH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ArJdHQOsGKPePgMoBWC+PgNYNUO7/D1q0yPkY2vG8AAAAAElFTkSuQmCC</thumbnail><scenes select="1"><scene name="Programming tools"><notes>Look inside ((thx 2 other Snap!-users for ideas!) &#xD;&#xD;It&apos;s a work in progress. Some of the functions it contains:&#xD;1. "do": though it may look useless at first sight it’s actually quite handy for a programmer, facilitating code development, debugging and documentation;&#xD;2. "let"+ "be": a mechanism for declaring and at the same time initializing (multiple) variables.&#xD;3. A logging facility, for debugging and optimization.&#xD;4. Commands to modify a variable&apos;s value.&#xD;5. Advanced sorting options.&#xD;6. Memoïzation, both for single&#126; and multi-variable (recursive) functions.</notes><palette><category name="Programmimg tools" color="0,116,143,1"/><category name="Under development" color="173,0,45,1"/></palette><hidden></hidden><headers></headers><code></code><blocks><block-definition s="do %&apos;do?&apos; %&apos;introduction&apos; %&apos;action&apos; (done) %&apos;postscript&apos;" type="command" category="Programmimg tools"><comment x="0" y="0" w="354" collapsed="false">WHAT IT DOES: Keep multiple coherent actions together, such that they can easily be moved, copied, commented on, temporarily switched off, deleted, etc&#xD;INPUT:&#xD;1. The first slot is a switch to specify whether the encapsulated code will be executed, or switched off (e.g. for debugging purposes).&#xD;2. In the second slot comments (even multiple lines) may be added.&#xD;3. The third (C-shaped) slot is for the action(-s) to be executed (or not, depending on the switch in slot 1).</comment><header></header><code></code><translations>pt:o texto multilinha _&#xD;</translations><inputs><input type="%b">true</input><input type="%mlt"></input><input type="%cs"></input><input type="%mlt"></input></inputs><script><block s="doIf"><block var="do?"/><script><block s="doRun"><block var="action"/><list></list></block></script><list></list></block></script><scripts><script x="10" y="150.99999999999994"><custom-block s="do %b %mlt %cs (done) %mlt"><l><bool>true</bool></l><l>An example application of the "do" block.&#xD;You&apos;re reading a multiline comment.</l><script><block s="doDeclareVariables"><list><l>home</l></list></block><block s="doSetVar"><l>home</l><block s="getPosition"></block><comment w="138.423828125" collapsed="true">... or on a single block.</comment></block><block s="doGotoObject"><l><option>random position</option></l></block><custom-block s="do %b %mlt %cs (done) %mlt"><l><bool>false</bool></l><l>The action within this "do" block was (temporarily?)&#xD;switched off for debugging reasons.&#xD;Can you guess why?</l><script><block s="doSetVar"><l>home</l><block s="getPosition"></block></block></script><l></l></custom-block><block s="doGotoObject"><block var="home"/></block></script><l></l><comment w="189" collapsed="false">Feel free to add a separate comment on the entire cluster of blocks ...</comment></custom-block></script><script x="10" y="378.6666666666667"><custom-block s="do %b %mlt %cs (done) %mlt"><l/><l>The "do" block may also be used&#xD;as a placeholder for future additions.</l><script></script><l></l></custom-block></script></scripts></block-definition><block-definition s="tbd %&apos;specification&apos;" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%mlt"></input></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="(…)" type="command" category="Programmimg tools"><header></header><code></code><translations></translations><inputs></inputs></block-definition><block-definition s="loop %&apos;act-1&apos; hole %&apos;exit condition&apos; %&apos;act-2&apos;" type="command" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%cs"></input><input type="%predRing"></input><input type="%ca"></input></inputs><script><block s="doRun"><block var="act-1"/><list></list></block><block s="doUntil"><block s="evaluate"><block var="exit condition"/><list></list></block><script><block s="doRun"><block var="act-2"/><list></list></block><block s="doRun"><block var="act-1"/><list></list></block></script></block></script></block-definition><block-definition s="modify %&apos;variable&apos; using %&apos;operator&apos;" type="command" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input><input type="%repRing"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="evaluate"><block var="operator"/><list><block s="evaluate"><block var="variable"/><list></list></block></list></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="multiply %&apos;variable&apos; by %&apos;factor&apos;" type="command" category="Programmimg tools"><comment w="227.0000000000001" collapsed="false">This command works similar to “change … by …”, except it also works if variable is a list.</comment><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input><input type="%n"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="reportVariadicProduct"><list><block s="evaluate"><block var="variable"/><list></list></block><block var="factor"/></list></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="divide %&apos;variable&apos; by %&apos;divisor&apos;" type="command" category="Programmimg tools"><comment w="227.0000000000001" collapsed="false">This command works similar to “change … by …”, except it also works if variable is a list.</comment><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input><input type="%n"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="reportQuotient"><block s="evaluate"><block var="variable"/><list></list></block><block var="divisor"/></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="inc %&apos;variable&apos;" type="command" category="Programmimg tools"><comment w="227.0000000000001" collapsed="false">This command works similar to “change … by …”, except it also works if variable is a list.</comment><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="reportVariadicSum"><list><block s="evaluate"><block var="variable"/><list></list></block><l>1</l></list></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="dec %&apos;variable&apos;" type="command" category="Programmimg tools"><comment w="227.0000000000001" collapsed="false">This command works similar to “change … by …”, except it also works if variable is a list.</comment><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="reportDifference"><block s="evaluate"><block var="variable"/><list></list></block><l>1</l></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="accumulate (SICP), combiner: %&apos;combiner&apos; null-value: %&apos;null value&apos; term: %&apos;term&apos; start-value: %&apos;start value&apos; next: %&apos;next&apos; stop-condition: %&apos;stop condition&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="461.0000000000001" collapsed="false">Reports the accumulated value of a series of terms. Inspired by SICP (par. 1.3.1, exercise 1.32).&#xD;INPUT:&#xD;1. combiner is a reporter detemining how the terms are accumulated, e.g. summation or multiplication.&#xD;2. null-value is the value that, when combined with an arbitrary value, yields that same value. E.g. with summation this is 0, for multiplication and exponentiation: 1.&#xD;3. term is a reporter generating the correponding term from a base value.&#xD;4. start-value is the base value of the first term in the series.&#xD;5. next is a reporter generating the next base value from the current one.&#xD;6. stop-condition is a predicate operating on the base value.&#xD;</comment><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%s"></input><input type="%repRing"></input><input type="%s"></input><input type="%repRing"></input><input type="%predRing"></input></inputs><script><block s="doIf"><block s="evaluate"><block var="stop condition"/><list><block var="start value"/></list></block><script><block s="doReport"><block var="null value"/></block></script><list></list></block><block s="doReport"><block s="evaluate"><block var="combiner"/><list><block s="evaluate"><block var="term"/><list><block var="start value"/></list></block><custom-block s="accumulate (SICP), combiner: %repRing null-value: %s term: %repRing start-value: %s next: %repRing stop-condition: %predRing"><block var="combiner"/><block var="null value"/><block var="term"/><block s="evaluate"><block var="next"/><list><block var="start value"/></list></block><block var="next"/><block var="stop condition"/></custom-block></list></block></block></script></block-definition><block-definition s="increase %&apos;variable&apos; by %&apos;addend&apos;" type="command" category="Programmimg tools"><comment w="227.0000000000001" collapsed="false">This command works similar to “change … by …”, except it also works if variable is a list.</comment><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input><input type="%n"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="reportVariadicSum"><list><block s="evaluate"><block var="variable"/><list></list></block><block var="addend"/></list></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="decrease %&apos;variable&apos; by %&apos;subtrahend&apos;" type="command" category="Programmimg tools"><comment w="227.0000000000001" collapsed="false">This command works similar to “change … by …”, except it also works if variable is a list.</comment><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input><input type="%n"></input></inputs><script><block s="doRun"><block s="reifyScript"><script><block s="doSetVar"><l></l><block s="reportDifference"><block s="evaluate"><block var="variable"/><list></list></block><block var="subtrahend"/></block></block></script><list></list></block><list><block var="variable"/></list></block></script></block-definition><block-definition s="deep reverse %&apos;data&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="182" collapsed="false">Reports the reverse of a list, with each of its sublists deep-reversed.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="data"/></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><block s="doReport"><block s="reportConcatenatedLists"><list><custom-block s="deep reverse %l"><block s="reportCDR"><block var="data"/></block></custom-block><block s="reportNewList"><list><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>1</l><block var="data"/></block><l><option>list</option></l></block><custom-block s="deep reverse %l"><block s="reportListItem"><l>1</l><block var="data"/></block></custom-block><block s="reportListItem"><l>1</l><block var="data"/></block></block></list></block></list></block></block></script><scripts><script x="10" y="245.66666666666669"><custom-block s="deep reverse %l"><block s="reportNewList"><list><l>A</l><block s="reportNewList"><list><l>B</l><l>C</l></list></block></list></block></custom-block></script></scripts></block-definition><block-definition s="I receive %&apos;message&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%txt"><options>any message</options></input></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="%&apos;key&apos; key pressed" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%txt" readonly="true"><options>blast</options></input></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="I am %&apos;somethinged&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%txt"><options>mouse-infested</options></input></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="test %&apos;reporter u/t&apos; %&apos;expected result&apos; %&apos;input&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%s"></input><input type="%mult%s"></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>actual result</l><custom-block s="safely try reporting %anyUE then if %upvar report %anyUE"><block s="evaluate"><block var="reporter u/t"/><block var="input"/></block><l>error</l><l></l></custom-block><list></list></custom-block><block s="doReport"><block s="reportNewList"><list><block var="reporter u/t"/><block var="input"/><block var="expected result"/><block var="actual result"/><block s="reportIfElse"><block s="reportVariadicNotEquals"><list><block var="error"/><l>error</l></list></block><block var="error"/><l></l></block><block s="reportVariadicEquals"><list><block var="actual result"/><block var="expected result"/></list></block></list></block></block></script></block-definition><block-definition s="setting %&apos;which&apos;" type="reporter" category="sensing"><comment x="0" y="0" w="254.66666666666666" collapsed="false">Allows reading global settings programmatically.&#xD;&#xD;Eisenberg&apos;s Law:  Anything you can do from the user interface you should be able to do in your program, and vice versa.  This library is just a beginning; there are many UI controls outside of the Settings menu.</comment><header></header><code></code><translations>pt:o valor da configuração _&#xD;ca:paràmetre _&#xD;</translations><inputs><input type="%s" readonly="true"><options>Project notes&#xD;Project name&#xD;User&#xD;Presentation mode&#xD;Language&#xD;Zoom blocks&#xD;Stage size&#xD;Stage scale&#xD;Retina display support&#xD;Long form input dialog&#xD;Plain prototype labels&#xD;Input sliders&#xD;Execute on slider change&#xD;Clicking sound&#xD;Turbo mode&#xD;Flat design&#xD;Keyboard editing&#xD;Visible stepping&#xD;Thread safe scripts&#xD;Prefer smooth animations&#xD;Flat line ends&#xD;Codification support&#xD;Inheritance support&#xD;Hyper blocks support&#xD;Visible palette</options></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>which</l></list><l>var stage = this.parentThatIsA(StageMorph),&#xD;    ide = stage.parentThatIsA(IDE_Morph),&#xD;    world = stage.parentThatIsA(WorldMorph);&#xD;&#xD;switch (which) {&#xD;    case &apos;Project notes&apos;:&#xD;        return ide.projectNotes;&#xD;    case &apos;Project name&apos;:&#xD;        return ide.projectName;&#xD;    case &apos;User&apos;:&#xD;        return ide.cloud.username;&#xD;    case &apos;Presentation mode&apos;:&#xD;        return ide.isAppMode;&#xD;    case &apos;Language&apos;:&#xD;        return SnapTranslator.language;&#xD;    case &apos;Zoom blocks&apos;:&#xD;        return SyntaxElementMorph.prototype.scale;&#xD;    case &apos;Stage size&apos;:&#xD;        return new List([StageMorph.prototype.dimensions.x,&#xD;                                   StageMorph.prototype.dimensions.y]);&#xD;    case &apos;Stage scale&apos;:&#xD;       return stage.scale;&#xD;    case &apos;Retina display support&apos;:&#xD;        return isRetinaEnabled();&#xD;    case &apos;Long form input dialog&apos;:&#xD;        return InputSlotDialogMorph.prototype.isLaunchingExpanded;&#xD;    case &apos;Plain prototype labels&apos;:&#xD;        return BlockLabelPlaceHolderMorph.prototype.plainLabel;&#xD;    case &apos;Input sliders&apos;:&#xD;        return MorphicPreferences.useSliderForInput;&#xD;    case &apos;Execute on slider change&apos;:&#xD;        return ArgMorph.prototype.executeOnSliderEdit;&#xD;    case &apos;Clicking sound&apos;:&#xD;        return !!BlockMorph.prototype.snapSound;&#xD;    case &apos;Turbo mode&apos;:&#xD;        return stage.isFastTracked;&#xD;    case &apos;Flat design&apos;:&#xD;        return MorphicPreferences.isFlat;&#xD;    case &apos;Keyboard editing&apos;:&#xD;        return !!this.scripts.focus;&#xD;    case &apos;Visible stepping&apos;:&#xD;        return Process.prototype.enableSingleStepping;&#xD;    case &apos;Thread safe scripts&apos;:&#xD;        return stage.isThreadSafe;&#xD;    case &apos;Prefer smooth animations&apos;:&#xD;        return StageMorph.prototype.frameRate &gt; 0;&#xD;    case &apos;Flat line ends&apos;:&#xD;        return SpriteMorph.prototype.useFlatLineEnds;&#xD;    case &apos;Codification support&apos;:&#xD;        return StageMorph.prototype.enableCodeMapping;&#xD;    case &apos;Inheritance support&apos;:&#xD;        return StageMorph.prototype.enableInheritance;&#xD;    case &apos;Hyper blocks support&apos;:&#xD;        return Process.prototype.enableHyperOps;&#xD;    default: return which;&#xD;    case &apos;Visible palette&apos;:&#xD;        return ide.currentCategory;&#xD;}</l></block><list><block var="which"/></list></block></block></script></block-definition><block-definition s="cases: if %&apos;test&apos; then %&apos;result&apos; %&apos;more&apos;" type="command" category="control"><comment x="0" y="0" w="262" collapsed="false">Multi-branched conditional.&#xD;&#xD;If the first (Boolean) input is True, then the script in&#xD;the second (C-slot) input is run, and this block stops.&#xD;&#xD;Additional tests can be added by putting one or more&#xD;ELSE IF blocks in the third (variadic) Boolean slot.&#xD;Use the arrowheads to get the number of Boolean&#xD;slots you need.  Each ELSE IF block provides a Boolean&#xD;slot for a condition to test and a script slot for what to do&#xD;if the condition is True.  You can put an ELSE block in&#xD;the last Boolean input to CASES for a script to run if&#xD;all the tests turn out False.&#xD;&#xD;As soon as a condition is True, no further tests are done&#xD;and no further scripts are run.</comment><header></header><code></code><translations>pt:se _ , então _ _&#xD;ca:casos: si _ llavors _ _&#xD;</translations><inputs><input type="%b"></input><input type="%cs"></input><input type="%mult%boolUE"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doRun"><block var="result"/><list></list></block></script><script><custom-block s="catch %upvar %cs"><l>tag</l><script><block s="doForEach"><l>item</l><block var="more"/><script><block s="doIf"><block s="evaluate"><block var="item"/><list></list></block><script><custom-block s="throw %s"><block var="tag"/></custom-block></script><list></list></block></script></block></script></custom-block></script></block></script></block-definition><block-definition s="else if %&apos;test&apos; then %&apos;action&apos;" type="predicate" category="control"><comment x="0" y="0" w="176" collapsed="false">For use with the CASES block.&#xD;See its help message.</comment><header></header><code></code><translations>pt:senão, se _ , então _&#xD;ca:altrament si _ llavors _&#xD;</translations><inputs><input type="%b"></input><input type="%cs"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doRun"><block var="action"/><list></list></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block></script></block-definition><block-definition s="else %&apos;action&apos;" type="predicate" category="control"><comment x="0" y="0" w="176" collapsed="false">For use with the CASES block.&#xD;See its help message.</comment><header></header><code></code><translations>pt:senão, _&#xD;ca:si no _&#xD;</translations><inputs><input type="%cs"></input></inputs><script><block s="doRun"><block var="action"/><list></list></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block-definition><block-definition s="moveable %&apos;x to&apos; %&apos;y from&apos;" type="predicate" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportVariadicAnd"><list><block s="reportVariadicAnd"><list><block s="reportVariadicGreaterThanOrEquals"><list><block var="x to"/><l>1</l></list></block><block s="reportVariadicLessThanOrEquals"><list><block var="x to"/><block var="pf width"/></list></block></list></block><block s="reportVariadicEquals"><list><block s="reportListItem"><block var="x to"/><block s="reportListItem"><block s="reportVariadicSum"><list><block var="y from"/><l>1</l></list></block><block var="playing field"/></block></block><block var="empty"/></list></block></list></block></block></script></block-definition><block-definition s="move %&apos;particle&apos; %&apos;x from&apos; %&apos;x to&apos; %&apos;y from&apos;" type="command" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReplaceInList"><block var="x to"/><block s="reportListItem"><block s="reportVariadicSum"><list><block var="y from"/><l>1</l></list></block><block var="playing field"/></block><block s="reportListItem"><block var="x from"/><block s="reportListItem"><block var="y from"/><block var="playing field"/></block></block></block><block s="doReplaceInList"><block var="x from"/><block s="reportListItem"><block var="y from"/><block var="playing field"/></block><block var="empty"/></block><block s="doReplaceInList"><l>1</l><block var="particle"/><block var="x to"/></block><block s="doReplaceInList"><l><option>last</option></l><block var="particle"/><block s="reportVariadicSum"><list><block var="y from"/><l>1</l></list></block></block></script></block-definition><block-definition s="new scanner %&apos;data&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="290" collapsed="false">Creates and reports a new scanner, to be assigned to a variable.&#xD;The input may be a list or a text.&#xD;Subsequent CALL-s to the variable will report &#xD;the first, second (etc.) top level item or line, respectively.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><custom-block s="cases: if %b then %cs %mult%boolUE"><block s="reportIsA"><block var="data"/><l><option>text</option></l></block><script><block s="doSetVar"><l>data</l><block s="reportTextSplit"><block var="data"/><l><option>line</option></l></block></block></script><list><custom-block s="else if %b then %cs"><block s="reportNot"><block s="reportIsA"><block var="data"/><l><option>list</option></l></block></block><script><custom-block s="error %txt"><block s="reportJoinWords"><list><l>expectIng a list or a text but getting </l><block var="data"/></list></block></custom-block></script></custom-block></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>index</l><l>0</l><list><custom-block s="%upvar be %s"><l>eof</l><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></custom-block></list></custom-block><block s="doReport"><block s="reifyScript"><script><block s="doIf"><block s="reportVariadicLessThan"><list><block var="index"/><block var="eof"/></list></block><script><block s="doChangeVar"><l>index</l><l>1</l></block><block s="doReport"><block s="reportListItem"><block var="index"/><block var="data"/></block></block></script><list></list></block></script><list></list></block></block></script></block-definition><block-definition s="multiline %&apos;text&apos;" type="reporter" category="operators"><header></header><code></code><translations>pt:o texto multilinha _&#xD;ca:multilínia _&#xD;</translations><inputs><input type="%mlt"></input></inputs><script><block s="doReport"><block var="text"/></block></script></block-definition><block-definition s="rotate %&apos;data&apos; down %&apos;positions&apos;" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%n"></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>length</l><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>normalized positions</l><block s="reportRound"><block s="reportModulus"><block var="positions"/><block var="length"/></block></block><list></list></custom-block><block s="doIf"><block s="reportVariadicOr"><list><block s="reportVariadicEquals"><list><l></l><l>0</l></list></block><block s="reportVariadicLessThanOrEquals"><list><block var="length"/><l>1</l></list></block></list></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><block s="doReport"><block s="reportConcatenatedLists"><list><block s="reportListItem"><block s="reportNumbers"><block s="reportVariadicSum"><list><block var="normalized positions"/><l>1</l></list></block><block var="length"/></block><block var="data"/></block><block s="reportListItem"><block s="reportNumbers"><l>1</l><block var="normalized positions"/></block><block var="data"/></block></list></block></block></script></block-definition><block-definition s="iterate %&apos;a&apos; from %&apos;start value&apos; by %&apos;next&apos; while %&apos;condition&apos; do %&apos;action&apos;" type="command" category="Programmimg tools"><comment x="0" y="0" w="348" collapsed="false">WHAT IT IS: A further development of &quot;LET a BE [] IN loop&quot;.&#xD;WHAT IT DOES: Provide a generalized container for iteration.&#xD;INPUT:&#xD;1. Control variable (upvar) of the iteration process&#xD;2. Start value of the control variable&#xD;3. Reporter producing the next control variable from the current&#xD;4. Predicate of the control variable producing the condition that must be satisfied in order for the script to proceed to the next iteration(-s)&#xD;5. Actions to be performed during each iteration:&#xD;HOW TO USE IT: &quot;Just add code&quot;.&#xD;INTERESTING: It uses recursion when proceeding to the next iteration.   </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="%repRing"></input><input type="%predRing"></input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>loop</l></list></block><block s="doSetVar"><l>a</l><block var="start value"/></block><block s="doSetVar"><l>loop</l><block s="reifyScript"><script><block s="doSetVar"><l>a</l><block var="new value"/></block><block s="doIf"><block s="evaluate"><block var="condition"/><list><block var="a"/></list></block><script><block s="doRun"><block var="action"/><list></list></block><block s="doRun"><block var="loop"/><list><block s="evaluate"><block var="next"/><list><block var="a"/></list></block></list></block></script><list></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><block-definition s="iterate %&apos;a&apos; from %&apos;start value&apos; by %&apos;next&apos; while %&apos;condition&apos; do %&apos;action&apos; (Non-recursive Implementation)" type="command" category="Programmimg tools"><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="%repRing"></input><input type="%predRing"></input><input type="%cs"></input></inputs><script><block s="doSetVar"><l>a</l><block var="start value"/></block><block s="doUntil"><block s="reportNot"><block s="evaluate"><block var="condition"/><list><block var="a"/></list></block></block><script><block s="doRun"><block var="action"/><list></list></block><block s="doSetVar"><l>a</l><block s="evaluate"><block var="next"/><list><block var="a"/></list></block></block></script></block></script></block-definition><block-definition s="simulated CPU-intensive operation %&apos;value&apos; %&apos;delay&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%n"></input></inputs><script><block s="doWait"><block var="delay"/></block><block s="doReport"><block var="value"/></block></script></block-definition><block-definition s="key function %&apos;item&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="prepsort %&apos;data&apos; by %&apos;key function&apos; %&apos;order&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%repRing"></input><input type="%s" readonly="true">HiLo<options>HiLo&#xD;LoHi</options></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>keys</l><block s="reportMap"><block var="key function"/><block var="data"/></block><list></list></custom-block><block s="doReport"><custom-block s="keysort %l by %l order: %s"><block var="data"/><block var="keys"/><block var="order"/></custom-block></block></script></block-definition><block-definition s="new log" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="385" collapsed="true">Creates a new log (for debugging and optimization purposes), and reports it.</comment><header></header><code></code><translations></translations><inputs></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>start time</l><custom-block s="%upvar be %s"><l>preceding time</l><custom-block s="%upvar be %s"><l>current time</l><block s="reportDate"><l><option>time in milliseconds</option></l></block></custom-block></custom-block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>log</l><block s="reportNewList"><list><block s="reportNewList"><list><l>total (ms)</l><l>diff. (ms)</l><l>LABEL</l><l>DATA (opt.)</l></list></block><block s="reportNewList"><list><l>0</l><l>0</l><l>start</l></list></block></list></block><list></list></custom-block><custom-block s="comment %mlt"><l>The log’s first entry is a mere timestamp.&#xD;Its next entries contain at least two (relative) timestamps and a label,&#xD;plus optional data. The entry is created by calling the variable&#xD;identIfying the log; the updated log will then be returned.&#xD;Philosophy:&#xD;1. A new log is generated for every user task.&#xD;2. Limited processing time during logged operation, so as not to cause extra delays. </l></custom-block><block s="doReport"><block s="reifyScript"><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="data (optional)"/><l><option>list</option></l></block></block><script><block s="doSetVar"><l>data (optional)</l><block s="reportNewList"><list><block var="data (optional)"/></list></block></block></script><list></list></block><block s="doSetVar"><l>current time</l><block s="reportDate"><l><option>time in milliseconds</option></l></block></block><block s="doAddToList"><block s="reportCONS"><block s="reportDifference"><block var="current time"/><block var="start time"/></block><block s="reportCONS"><block s="reportDifference"><block var="current time"/><block var="preceding time"/></block><block s="reportCONS"><block var="label"/><block var="data (optional)"/></block></block></block><block var="log"/></block><block s="doSetVar"><l>preceding time</l><block var="current time"/></block><block s="doReport"><block var="log"/></block></script><list><l>label</l><l>data (optional)</l></list></block></block></script><scripts><script x="10" y="510.30000000000035"><custom-block s="let %upvar be %s %mult%s"><l>log 1</l><custom-block s="new log"></custom-block><list></list></custom-block><custom-block s="comment %mlt"><l>Creates a new log (for debugging and optimization purposes), and reports it.</l></custom-block><custom-block s="comment %mlt"><l>The log’s first entry is a mere timestamp.&#xD;Its next entries contain at least a (relative) timestamp and a label,&#xD;plus optional data. The entry is created by calling the variable&#xD;identIfying the log; the updated log will then be returned.</l></custom-block><custom-block s="comment %mlt"><l>Since a grey ring doesn’t accept variadic input, a varidic-to-list converter is used on the calling side:</l></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>A</l><custom-block s="variadic to list %mult%s"><list><l>2</l><l>100</l></list></custom-block></list></block></custom-block><block s="doWait"><l>1</l></block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>A</l><custom-block s="variadic to list %mult%s"><list><l>6</l><l>45</l></list></custom-block></list></block></custom-block><custom-block s="comment %mlt"><l>Even without data it all works this way.</l></custom-block><block s="doReport"><block s="evaluate"><block var="log 1"/><list><l>B</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></block></script></scripts></block-definition><block-definition s="variadic to list %&apos;items&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="177" collapsed="true">Reports variadic input as a list.</comment><header></header><code></code><translations></translations><inputs><input type="%mult%s"></input></inputs><script><block s="doReport"><block var="items"/></block></script></block-definition><block-definition s="comment %&apos;comment&apos;" type="command" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%mlt"></input></inputs></block-definition><block-definition s="select top %&apos;#items&apos; items from %&apos;data&apos; sorted by %&apos;combiner&apos;" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input><input type="%predRing"></input></inputs><script><block s="doIf"><block s="reportVariadicLessThan"><list><block var="#items"/><l>1</l></list></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doIf"><block s="reportListIsEmpty"><block s="reportCDR"><block var="data"/></block></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>first</l><block s="reportCombine"><block var="data"/><block var="combiner"/></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>position</l><block s="reportListIndex"><block var="first"/><block var="data"/></block><list></list></custom-block><block s="doReport"><block s="reportCONS"><block var="first"/><custom-block s="select top %n items from %l sorted by %predRing"><block s="reportDifference"><block var="#items"/><l>1</l></block><block s="reportListItem"><block s="reportConcatenatedLists"><list><block s="reportIfElse"><block s="reportVariadicGreaterThan"><list><block var="position"/><l>1</l></list></block><block s="reportNumbers"><l>1</l><block s="reportDifference"><block var="position"/><l>1</l></block></block><block s="reportNewList"><list></list></block></block><block s="reportIfElse"><block s="reportVariadicLessThan"><list><block var="position"/><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></list></block><block s="reportNumbers"><block s="reportVariadicSum"><list><block var="position"/><l>1</l></list></block><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></block><block s="reportNewList"><list></list></block></block></list></block><block var="data"/></block><block var="combiner"/></custom-block></block></block></script></block-definition><block-definition s="let %&apos;variable&apos; be %&apos;value&apos; %&apos;more variables&apos;" type="command" category="Programmimg tools"><comment x="0" y="0" w="378.99999999999966" collapsed="false">&quot;Let&quot; is a mechanism, available in Scheme, JavaScript and several other languages, to declare and intialize local variables. By default the “let” block supports 1 variable; it can be extended *ad libitum*, using the “be” block.</comment><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%s"></input><input type="%mult%s"></input></inputs><script><block s="doSetVar"><l>variable</l><block var="value"/></block></script><scripts><script x="10" y="91"><custom-block s="%upvar be %s"><l>variable</l><l></l><comment w="396" collapsed="true">This is a &quot;be&quot; block. Its first slot is an upvar. It reports the value (second slot).</comment></custom-block></script><script x="12" y="165.99999999999994"><custom-block s="let %upvar be %s %mult%s"><l>pi</l><l>3.141592654</l><list><custom-block s="%upvar be %s"><l>e</l><l>2.71828182</l></custom-block><custom-block s="%upvar be %s"><l>name</l><l>apple pie</l></custom-block><custom-block s="%upvar be %s"><l>origin</l><custom-block s="%upvar be %s"><l>destination</l><block s="getPosition"></block></custom-block></custom-block></list><comment w="223" collapsed="false">An application example of &quot;tet&quot; + &quot;be&quot;: &quot;origin&quot; and &quot;destination&quot; are initialized with the same &quot;value&quot; (in this case: a list reported by &quot;position&quot;).</comment></custom-block></script></scripts></block-definition><block-definition s="%&apos;variable&apos; be %&apos;value&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="396" collapsed="false">This block implements a &quot;let&quot;-mechanism, similiar to e.g. Scheme and JavaScript. The upvar in slot 1 is a created as local variable, and it&apos;s initialized with the &quot;value&quot; in slot 2, which it also reports,. Several &quot;be&quot;-blocks may be collected in a &quot;let&quot;-block.</comment><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%s"></input></inputs><script><block s="doSetVar"><l>variable</l><block var="value"/></block><block s="doReport"><block var="value"/></block></script></block-definition><block-definition s="keyselect %&apos;selection&apos; from %&apos;data&apos; by %&apos;keys&apos; order %&apos;order&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="350" collapsed="false">WHAT Select the top (n) items from a list, sorted by corresponding keys&#xD;HOW Repeated Selection sort. Keys need to be pre-calculated (= before calling this block)&#xD;INPUT&#xD;1. number of items to be selected&#xD;2. list of items&#xD;3. list of keys corresponding with (2)&#xD;4. order in which keys must be sorted: from hgh to low or from low to high&#xD;INFORMATION for small (n), usually faster than a full sort&#xD;EXAMPLE&#xD;keyselect (5) from (list of applicants) by (list of: priority number for each person, may be a result of a complicated process) order (HiLo = highest priority first)   </comment><header></header><code></code><translations></translations><inputs><input type="%n"><options>1&#xD;all</options></input><input type="%l"></input><input type="%l"></input><input type="%s" readonly="true">HiLo<options>HiLo&#xD;LoHi</options></input></inputs><script><block s="doIf"><block s="reportVariadicOr"><list><block s="reportVariadicEquals"><list><block var="selection"/><l>all</l></list></block><block s="reportVariadicGreaterThanOrEquals"><list><block var="selection"/><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></list></block></list></block><script><block s="doSetVar"><l>selection</l><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></block></script><list></list></block><block s="doIf"><block s="reportVariadicLessThan"><list><block var="selection"/><l>1</l></list></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>combiner</l><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="order"/><l>HiLo</l></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicMax"><list><l></l><l></l></list></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicMin"><list><l></l><l></l></list></block></autolambda><list></list></block></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>first key</l><block s="reportCombine"><block var="keys"/><block var="combiner"/></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>position</l><block s="reportListIndex"><block var="first key"/><block var="keys"/></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>first data item</l><block s="reportListItem"><block var="position"/><block var="data"/></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>remaining indices</l><custom-block s="integers 1 to %n except %n"><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block><block var="position"/></custom-block><list></list></custom-block><block s="doReport"><block s="reportCONS"><block var="first data item"/><custom-block s="keyselect %n from %l by %l order %s"><block s="reportDifference"><block var="selection"/><l>1</l></block><block s="reportListItem"><block var="remaining indices"/><block var="data"/></block><block s="reportListItem"><block var="remaining indices"/><block var="keys"/></block><block var="order"/></custom-block></block></block></script></block-definition><block-definition s="topsort %&apos;selection&apos; from %&apos;data&apos; by %&apos;key function&apos; %&apos;order&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input><input type="%repRing"></input><input type="%s" readonly="true">HiLo<options>HiLo&#xD;LoHi</options></input></inputs><script><block s="doIf"><block s="reportVariadicOr"><list><block s="reportVariadicEquals"><list><block var="selection"/><l>all</l></list></block><block s="reportVariadicGreaterThanOrEquals"><list><block var="selection"/><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></list></block></list></block><script><block s="doReport"><custom-block s="prepsort %l by %repRing %s"><block var="data"/><block var="key function"/><block var="order"/></custom-block></block></script><list></list></block><block s="doIf"><block s="reportVariadicEquals"><list><custom-block s="sorting advice %n %n"><block var="selection"/><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></custom-block><l>sort</l></list></block><script><block s="doReport"><block s="reportListItem"><block s="reportNumbers"><l>1</l><block var="selection"/></block><custom-block s="prepsort %l by %repRing %s"><block var="data"/><block var="key function"/><block var="order"/></custom-block></block></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>keys</l><block s="reportMap"><block var="key function"/><block var="data"/></block><list></list></custom-block><block s="doReport"><custom-block s="keyselect %n from %l by %l order %s"><block var="selection"/><block var="data"/><block var="keys"/><block var="order"/></custom-block></block></script></block-definition><block-definition s="keysort %&apos;data&apos; by %&apos;keys&apos; order: %&apos;order&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="350" collapsed="false">WHAT Reports a new list of data, sorted by corresponding keys&#xD;HOW Using Snap!&apos;s standard SORT on a list of keys and indices. Keys need to be precalculated (= before calling this block).&#xD;INPUT&#xD;1. list of items&#xD;2. list of keys corresponding with (1)&#xD;3. order in which keys must be sorted: from hgh to low or from low to high&#xD;INFORMATION Faster than using standard SORT with a complicated sort key function (especially for large datasets)&#xD;EXAMPLE&#xD;keysort (list of applicants) by: (list of: priority number for each person, may be a result of a complicated process) order: (HiLo = highest priority first)   </comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%l"></input><input type="%s" readonly="true">HiLo<options>HiLo&#xD;LoHi</options></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>comparator</l><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="order"/><l>HiLo</l></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicGreaterThan"><list><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>1</l><l/></block></list></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicLessThan"><list><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>1</l><l/></block></list></block></autolambda><list></list></block></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>indices</l><block s="reportNumbers"><l>1</l><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>a-list</l><block s="reportListAttribute"><l><option>columns</option></l><block s="reportNewList"><list><block var="keys"/><block var="indices"/></list></block></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>sorted a-list</l><custom-block s="$flash sort %l ordering with %predRing"><block var="a-list"/><block var="comparator"/></custom-block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>sorted indices</l><block s="reportListItem"><l><option>last</option></l><block s="reportListAttribute"><l><option>columns</option></l><block var="sorted a-list"/></block></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>sorted data</l><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportListItem"><l></l><block var="data"/></block></autolambda><list></list></block><block var="sorted indices"/></block><list></list></custom-block><block s="doReport"><block var="sorted data"/></block></script></block-definition><block-definition s="sorting advice %&apos;selection&apos; %&apos;datalength&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doIf"><block s="reportVariadicLessThan"><list><block var="datalength"/><l>50</l></list></block><script><block s="doReport"><l>sort</l></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>ln(length)</l><block s="reportMonadic"><l><option>ln</option></l><block var="datalength"/></block><list></list></custom-block><block s="doIf"><block s="reportVariadicLessThan"><list><block var="datalength"/><l>200</l></list></block><script><block s="doReport"><block s="reportIfElse"><block s="reportVariadicLessThan"><list><block var="selection"/><block s="reportVariadicProduct"><list><l>3</l><block var="ln(length)"/></list></block></list></block><l>select</l><l>sort</l></block></block></script><list></list></block><block s="doIf"><block s="reportVariadicLessThan"><list><block var="datalength"/><l>400</l></list></block><script><block s="doReport"><block s="reportIfElse"><block s="reportVariadicLessThan"><list><block var="selection"/><block s="reportVariadicProduct"><list><l>4</l><block var="ln(length)"/></list></block></list></block><l>select</l><l>sort</l></block></block></script><list></list></block><block s="doIf"><block s="reportVariadicLessThan"><list><block var="datalength"/><l>800</l></list></block><script><block s="doReport"><block s="reportIfElse"><block s="reportVariadicLessThan"><list><block var="selection"/><block s="reportVariadicProduct"><list><l>5</l><block var="ln(length)"/></list></block></list></block><l>select</l><l>sort</l></block></block></script><list></list></block><block s="doReport"><block s="reportIfElse"><block s="reportVariadicLessThan"><list><block var="selection"/><block s="reportVariadicProduct"><list><l>6</l><block var="ln(length)"/></list></block></list></block><l>select</l><l>sort</l></block></block></script></block-definition><block-definition s="shuffle %&apos;data&apos; (recursive)" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIf"><block s="reportVariadicLessThanOrEquals"><list><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block><l>1</l></list></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>position</l><block s="reportRandom"><l>1</l><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></block><list></list></custom-block><block s="doReport"><block s="reportCONS"><block s="reportListItem"><block var="position"/><block var="data"/></block><custom-block s="shuffle %l (recursive)"><block s="reportListItem"><custom-block s="integers 1 to %n except %n"><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block><block var="position"/></custom-block><block var="data"/></block></custom-block></block></block></script></block-definition><block-definition s="shuffle %&apos;data&apos; (optimized)" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIf"><block s="reportVariadicLessThanOrEquals"><list><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block><l>1</l></list></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><block s="doDeclareVariables"><list><l>position</l><l>temp</l></list></block><custom-block s="let %upvar be %s %mult%s"><l>working data</l><block s="reportMonadic"><l><option>id</option></l><block var="data"/></block><list></list></custom-block><block s="doFor"><l>low</l><l>1</l><block s="reportDifference"><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block><l>1</l></block><script><block s="doSetVar"><l>position</l><block s="reportRandom"><block var="low"/><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></block></block><block s="doSetVar"><l>temp</l><block s="reportListItem"><block var="low"/><block var="working data"/></block></block><block s="doReplaceInList"><block var="low"/><block var="working data"/><block s="reportListItem"><block var="position"/><block var="working data"/></block></block><block s="doReplaceInList"><block var="position"/><block var="working data"/><block var="temp"/></block></script></block><block s="doReport"><block var="working data"/></block></script></block-definition><block-definition s="integers 1 to %&apos;n&apos; except %&apos;x&apos;" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%n">10</input><input type="%n">5</input></inputs><script><block s="doReport"><block s="reportConcatenatedLists"><list><block s="reportIfElse"><block s="reportVariadicGreaterThan"><list><block var="x"/><l>1</l></list></block><block s="reportNumbers"><l>1</l><block s="reportDifference"><block var="x"/><l>1</l></block></block><block s="reportNewList"><list></list></block></block><block s="reportIfElse"><block s="reportVariadicLessThan"><list><block var="x"/><block var="n"/></list></block><block s="reportNumbers"><block s="reportVariadicSum"><list><block var="x"/><l>1</l></list></block><block var="n"/></block><block s="reportNewList"><list></list></block></block></list></block></block></script></block-definition><block-definition s="cases, default: %&apos;default&apos; special: %&apos;special cases&apos;" type="command" category="Programmimg tools"><comment x="0" y="0" w="343" collapsed="false">WHAT IT DOES Define multi-branch conditional action.&#xD;INPUT&#xD;1. default (C-shape): action to be taken if none of the special cases apply;&#xD;2. special cases (variadic): any number of predicates, usually activating specific actions. Preferably use CASE block for each case.&#xD;&#xD;APPLICATION EXAMPLE, saying the sign of a number (x):&#xD;cases, default: (say(0)), special:&#xD;(case(x &gt; 0) (say(+)))&#xD;(case(x &lt; 0) (say (-)))</comment><header></header><code></code><translations></translations><inputs><input type="%cs"></input><input type="%mult%boolUE"></input></inputs><script><custom-block s="catch %upvar %cs"><l>tag</l><script><block s="doForEach"><l>item</l><block var="special cases"/><script><block s="doIf"><block s="evaluate"><block var="item"/><list></list></block><script><custom-block s="throw %s"><block var="tag"/></custom-block></script><list></list></block></script></block><block s="doRun"><block var="default"/><list></list></block></script></custom-block></script></block-definition><block-definition s="case %&apos;test&apos; %&apos;action&apos;" type="reporter" category="Programmimg tools"><comment x="0" y="0" w="354.9999999999999" collapsed="false">WHAT IT DOES Provide an IF THEN -operation, reporting the result of &quot;IF&quot;&#xD;INPUT&#xD;1. test (Boolean) = condition to be evaluated (result is reported)&#xD;2. action (C-shape) = action to be taken if the test yields true&#xD;APPLICATION To be used in combination with CASES-block&#xD;&#xD;APPLICATION EXAMPLE, saying the sign of a number (x):&#xD;cases, default: (say (0)), special:&#xD;(case (x &gt; 0) (say (+)))&#xD;(case(x &lt; 0) (say (-)))</comment><header></header><code></code><translations></translations><inputs><input type="%b"></input><input type="%cs"></input></inputs><script><block s="doIf"><block var="test"/><script><block s="doRun"><block var="action"/><list></list></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><list></list></block><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block-definition><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><block-definition s="cases: %&apos;special cases&apos; else: %&apos;default&apos;" type="command" category="Under development"><comment x="0" y="0" w="343" collapsed="false">WHAT IT DOES Define multi-branch conditional action.&#xD;INPUT&#xD;1. default (C-shape): action to be taken if none of the special cases apply;&#xD;2. special cases (variadic): any number of predicates, usually activating specific actions. Preferably use CASE block for each case.&#xD;&#xD;APPLICATION EXAMPLE, saying the sign of a number (x):&#xD;cases, default: (say(0)), special:&#xD;(case(x &gt; 0) (say(+)))&#xD;(case(x &lt; 0) (say (-)))</comment><header></header><code></code><translations></translations><inputs><input type="%mult%boolUE"></input><input type="%cs"></input></inputs><script><custom-block s="catch %upvar %cs"><l>tag</l><script><block s="doForEach"><l>item</l><block var="special cases"/><script><block s="doIf"><block s="evaluate"><block var="item"/><list></list></block><script><custom-block s="throw %s"><block var="tag"/></custom-block></script><list></list></block></script></block><block s="doRun"><block var="default"/><list></list></block></script></custom-block></script></block-definition><block-definition s="$flash remove duplicates from %&apos;data&apos;" type="reporter" category="lists"><comment x="0" y="0" w="209" collapsed="false">Reports a new list whose items are the same as in the input list, except that if two or more equal items appear in the input list, only the last one is kept in the result.</comment><header></header><code></code><translations>ca:elimina els duplicats de _&#xD;</translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListItem"><l>1</l><block s="reportListAttribute"><l><option>columns</option></l><block s="reportApplyExtension"><l>dta_analyze(list)</l><list><block var="data"/></list></block></block></block></block></script></block-definition><block-definition s="$flash sort %&apos;data&apos; ordering with %&apos;function&apos;" type="reporter" category="lists"><comment x="0" y="0" w="161.14285714285708" collapsed="false">Reports a sorted version of the list in its first input slot, using the comparison function in the second input slot.  For a list of numbers, using &lt; as the comparison function will sort from low to high; using &gt; will sort from high to low.</comment><header></header><code></code><translations>ca:ordena _ segons criteri _&#xD;</translations><inputs><input type="%l"></input><input type="%predRing"></input></inputs><script><block s="doReport"><block s="reportApplyExtension"><l>lst_sort(list, fn)</l><list><block var="data"/><block var="function"/></list></block></block></script></block-definition><block-definition s="$flash assoc %&apos;key&apos; %&apos;a-list&apos;" type="reporter" category="lists"><comment x="0" y="0" w="289.3333333333333" collapsed="false">The second input is an &quot;association list,&quot; a list of two-item lists.  Each of those smaller lists has a &quot;key&quot; as its first item and a &quot;value&quot; as its second.  ASSOC reports the first key-value pair in the association list whose key matches the first input.</comment><header></header><code></code><translations>ca:associació _ _&#xD;</translations><inputs><input type="%s"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="reportAtomicFindFirst"><block s="reifyPredicate"><autolambda><block s="reportVariadicEquals"><list><block var="key"/><block s="reportListItem"><l>1</l><l/></block></list></block></autolambda><list></list></block><block var="a-list"/></block></block></script></block-definition><block-definition s="☠︎ linked? %&apos;data&apos;" type="predicate" category="lists" helper="true"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportApplyExtension"><l>lst_linked(list)</l><list><block var="data"/></list></block></block></script></block-definition><block-definition s="☠︎ link %&apos;data&apos;" type="reporter" category="lists" helper="true"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="data"/></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="data"/></block><block s="reportCDR"><block var="data"/></block></block></block></script></block-definition><block-definition s="printable %&apos;data&apos;" type="reporter" category="lists"><comment x="0" y="0" w="188.66666666666666" collapsed="false">Takes a (possibly deep) list as input,&#xD;and reports a human-readable text form &#xD;of the list (namely, Lisp notation).&#xD;&#xD;Will not work on circular lists.</comment><header></header><code></code><translations>ca:notació textual de _&#xD;</translations><inputs><input type="%l"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="data"/><l><option>list</option></l></block></block><script><block s="doReport"><block var="data"/></block></script><list></list></block><block s="doIf"><block s="reportListIsEmpty"><block var="data"/></block><script><block s="doReport"><l>()</l></block></script><list></list></block><block s="doReport"><block s="reportJoinWords"><list><l>(</l><block s="reportAtomicCombine"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="printable %l"><l/></custom-block></autolambda><list></list></block><block var="data"/></block><block s="reifyReporter"><autolambda><block s="reportJoinWords"><list><l></l><l> </l><l></l></list></block></autolambda><list></list></block></block><l>)</l></list></block></block></script></block-definition><block-definition s="sentence %&apos;phrase&apos;" type="reporter" category="lists"><comment x="0" y="0" w="302.6666666666667" collapsed="false">SENTENCE is the main constructor for sentences, represented&#xD;as lists of words.  It takes zero or more inputs, each of which can&#xD;be either a list or a text string.  If a list, the input is assumed to be&#xD;a list of words.  If a text string, it is converted to a list of words using&#xD;SENTENCE→LIST.  Then all the lists of words are appended to form a new list of words.&#xD;&#xD;If the inputs are lists of lists rather than lists of words, SENTENCE,&#xD;like APPEND, does only one level of flattening, reporting a list of&#xD;all the items of all the input lists.</comment><header></header><code></code><translations>ca:frase _&#xD;</translations><inputs><input type="%mult%s"></input></inputs><script><block s="doReport"><block s="reportConcatenatedLists"><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportIfElse"><block s="reportIsA"><l></l><l><option>list</option></l></block><l></l><custom-block s="sentence $arrowRight list %txt"><l></l></custom-block></block></autolambda><list></list></block><block var="phrase"/></block></block></block></script></block-definition><block-definition s="$flash zip %&apos;lists&apos;" type="reporter" category="lists"><comment x="0" y="0" w="192" collapsed="false">ZIP takes any number of lists as inputs.  The lists should all be the same length.  ZIP reports a list of lists in which the first item is a list of all the first items, the second item is a list of all the second items, etc.&#xD;Viewing the inputs as the rows of a matrix, ZIP reports its transpose.</comment><header></header><code></code><translations></translations><inputs><input type="%mult%l"></input></inputs><script><block s="doReport"><block s="reportListAttribute"><l><option>columns</option></l><block var="lists"/></block></block></script></block-definition><block-definition s="%&apos;x&apos;" type="reporter" category="lists"><comment x="0" y="0" w="105.33333333333333" collapsed="false">The identity function reports its input.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block var="x"/></block></script></block-definition><block-definition s="multimap %&apos;function&apos; over %&apos;lists&apos;" type="reporter" category="lists"><comment x="0" y="0" w="267.3333333333333" collapsed="false">Takes as input a function of N inputs and N lists.&#xD;The function is called with item 1 of all the lists as its inputs, with item 2 of all the lists as its inputs, and so on.  (The lists should all be the same length.)</comment><header></header><code></code><translations>ca:multi-mapeja _ sobre _&#xD;</translations><inputs><input type="%repRing"></input><input type="%mult%l"></input></inputs><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><block s="evaluate"><block var="function"/><custom-block s="%s"><l></l></custom-block></block></autolambda><list></list></block><custom-block s="$flash zip %mult%l"><block var="lists"/></custom-block></block></block></script></block-definition><block-definition s="sentence $arrowRight list %&apos;text&apos;" type="reporter" category="operators"><comment x="0" y="0" w="196" collapsed="false">Takes a sentence in text string form and reports the sentence as a list of its words.</comment><header></header><code></code><translations>de:Satz $arrowRight Liste _&#xD;ca:frase $arrowRight llista _&#xD;es:frase $arrowRight lista _&#xD;fr:phrase $arrowRight liste _&#xD;pt:uma lista com as palavras da frase _&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doReport"><block s="reportAtomicKeep"><block s="reifyPredicate"><autolambda><block s="reportNot"><block s="reportVariadicEquals"><list><block s="reportTextAttribute"><l><option>length</option></l><l></l></block><l>0</l></list></block></block></autolambda><list></list></block><block s="reportTextSplit"><block var="text"/><l><option>whitespace</option></l></block></block></block></script></block-definition><block-definition s="memo-fib %&apos;n&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doIf"><block s="reportVariadicLessThan"><list><block var="n"/><l>3</l></list></block><script><block s="doReport"><l>1</l></block></script><list></list></block><block s="doReport"><block s="reportVariadicSum"><list><block s="evaluate"><block var="fast fib"/><list><block s="reportDifference"><block var="n"/><l>1</l></block></list></block><block s="evaluate"><block var="fast fib"/><list><block s="reportDifference"><block var="n"/><l>2</l></block></list></block></list></block></block></script></block-definition><block-definition s="memoize %&apos;function&apos;" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>memory</l><block s="reportNewList"><list></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>memoized function</l><block s="reifyScript"><script><custom-block s="let %upvar be %s %mult%s"><l>key</l><block s="reportJoinWords"><list><l>#</l><block var="x"/></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>value</l><block s="reportListItem"><block var="key"/><block var="memory"/></block><list></list></custom-block><block s="doIf"><block s="reportVariadicEquals"><list><block var="value"/><custom-block s="empty"></custom-block></list></block><script><block s="doSetVar"><l>value</l><block s="evaluate"><block var="function"/><list><block var="x"/></list></block></block><block s="doAddToList"><block s="reportNewList"><list><block var="key"/><block var="value"/></list></block><block var="memory"/></block></script><list></list></block><block s="doReport"><block var="value"/></block></script><list><l>x</l></list></block><list></list></custom-block><block s="doReport"><block var="memoized function"/></block></script><scripts><script x="10" y="319.33333333333286"><custom-block s="comment %mlt"><l>Example code of memo-fib function, with (n) as input</l></custom-block><block s="doIf"><block s="reportVariadicLessThanOrEquals"><list><block var="n"/><l>2</l></list></block><script><block s="doReport"><l>1</l></block></script><list></list></block><block s="doReport"><block s="reportVariadicSum"><list><block s="evaluate"><block var="fast fib"/><list><block s="reportDifference"><block var="n"/><l>1</l></block></list></block><block s="evaluate"><block var="fast fib"/><list><block s="reportDifference"><block var="n"/><l>2</l></block></list></block></list></block></block></script><script x="10" y="470.83333333333275"><custom-block s="comment %mlt"><l>In the same example, this variable assiignment needs to be run before all else</l></custom-block><block s="doSetVar"><l>fast fib</l><custom-block s="memoize %repRing"><block s="reifyReporter"><autolambda><custom-block s="memo-fib %n"><l></l></custom-block></autolambda><list></list></block></custom-block></block></script></scripts></block-definition><block-definition s="to do list %&apos;action&apos;" type="command" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%mult%cs"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportListIsEmpty"><block var="action"/></block></block><script><block s="doRun"><block s="reportListItem"><l>1</l><block var="action"/></block><list></list></block><block s="doRun"><block s="reifyScript"><script><custom-block s="to do list %mult%cs"><block s="reportCDR"><block var="action"/></block></custom-block></script><list></list></block><list></list></block></script><list></list></block></script></block-definition><block-definition s="all of %&apos;preds&apos;" type="predicate" category="operators"><comment x="0" y="0" w="248" collapsed="false">Takes any number of Boolean (true/false) inputs (use the left and right arrowheads to adjust the number of input slots) and reports TRUE only if all of the inputs are TRUE, otherwise FALSE.  Like AND but for multiple inputs.</comment><header></header><code></code><translations>pt:todas as afirmações _ são verdadeiras&#xD;ca:tots _ ?&#xD;</translations><inputs><input type="%mult%boolUE"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="preds"/></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><list></list></block><block s="doReport"><block s="reportVariadicAnd"><list><block s="evaluate"><block s="reportListItem"><l>1</l><block var="preds"/></block><list></list></block><custom-block s="all of %mult%boolUE"><block s="reportCDR"><block var="preds"/></block></custom-block></list></block></block></script></block-definition><block-definition s="any of %&apos;preds&apos;" type="predicate" category="operators"><comment x="0" y="0" w="240" collapsed="false">Takes any number of Boolean (true/false) inputs (use the left and right arrowheads to adjust the number of input slots) and reports TRUE if at least one input is TRUE, otherwise FALSE.</comment><header></header><code></code><translations>pt:alguma das afirmações _ é verdadeira&#xD;ca:qualsevol _ ?&#xD;</translations><inputs><input type="%mult%boolUE"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="preds"/></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script><list></list></block><block s="doReport"><block s="reportVariadicOr"><list><block s="evaluate"><block s="reportListItem"><l>1</l><block var="preds"/></block><list></list></block><custom-block s="any of %mult%boolUE"><block s="reportCDR"><block var="preds"/></block></custom-block></list></block></block></script></block-definition><block-definition s="memo-change-options %&apos;amount, largest coin #&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>amount</l><block s="reportListItem"><l>1</l><block var="amount, largest coin #"/></block><list><custom-block s="%upvar be %s"><l>largest coin #</l><block s="reportListItem"><l>2</l><block var="amount, largest coin #"/></block></custom-block></list></custom-block><block s="doIf"><block s="reportVariadicEquals"><list><block var="amount"/><l>0</l></list></block><script><block s="doReport"><l>1</l></block></script><list></list></block><block s="doIf"><block s="reportVariadicOr"><list><block s="reportVariadicLessThan"><list><block var="amount"/><l>0</l></list></block><block s="reportVariadicLessThanOrEquals"><list><block var="largest coin #"/><l>0</l></list></block></list></block><script><block s="doReport"><l>0</l></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>option A</l><block s="evaluate"><block var="fast-change"/><list><block s="reportNewList"><list><block var="amount"/><block s="reportDifference"><block var="largest coin #"/><l>1</l></block></list></block></list></block><list><custom-block s="%upvar be %s"><l>option B</l><block s="evaluate"><block var="fast-change"/><list><block s="reportNewList"><list><block s="reportDifference"><block var="amount"/><block s="reportListItem"><block var="largest coin #"/><block var="coin denominations"/></block></block><block var="largest coin #"/></list></block></list></block></custom-block></list></custom-block><block s="doReport"><block s="reportVariadicSum"><list><block var="option A"/><block var="option B"/></list></block></block></script></block-definition><block-definition s="memo-change-options %&apos;amount&apos; %&apos;largest coin #&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doIf"><block s="reportVariadicEquals"><list><block var="amount"/><l>0</l></list></block><script><block s="doReport"><l>1</l></block></script><list></list></block><block s="doIf"><block s="reportVariadicOr"><list><block s="reportVariadicLessThan"><list><block var="amount"/><l>0</l></list></block><block s="reportVariadicLessThanOrEquals"><list><block var="largest coin #"/><l>0</l></list></block></list></block><script><block s="doReport"><l>0</l></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>option A</l><block s="evaluate"><block var="fast-change"/><list><block s="reportNewList"><list><block var="amount"/><block s="reportDifference"><block var="largest coin #"/><l>1</l></block></list></block></list></block><list><custom-block s="%upvar be %s"><l>option B</l><block s="evaluate"><block var="fast-change"/><list><block s="reportNewList"><list><block s="reportDifference"><block var="amount"/><block s="reportListItem"><block var="largest coin #"/><block var="coin denominations"/></block></block><block var="largest coin #"/></list></block></list></block></custom-block></list></custom-block><block s="doReport"><block s="reportVariadicSum"><list><block var="option A"/><block var="option B"/></list></block></block></script></block-definition><block-definition s="safely try %&apos;action&apos; then if %&apos;error&apos; %&apos;handler&apos;" type="command" category="control"><comment x="0" y="0" w="276" collapsed="false">Catch errors.&#xD;&#xD;Runs the first script.  If it succeeds, nothing else happens.&#xD;But if it has an error (something that would otherwise result&#xD;in a red halo around the block), then the second script is run,&#xD;with the text of the error message that would have been shown in the variable ERROR.</comment><header></header><code></code><translations>pt:tenta executar _ e, em caso de erro _ , executa _&#xD;ca:prova de forma segura _ i si _ _&#xD;</translations><inputs><input type="%cs"></input><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block var="action"/><block var="handler"/><block var="error"/></list></block><block s="doApplyExtension"><l>err_reset</l><list></list></block></script></block-definition><block-definition s="error %&apos;msg&apos;" type="command" category="control"><comment x="0" y="0" w="268.6666666666667" collapsed="false">Throw an error.&#xD;&#xD;Makes a red halo appear around the script that runs it,&#xD;with the input text shown in a speech balloon next to&#xD;the script, just like any Snap! error.&#xD;&#xD;This is useful to put in the second script of SAFELY TRY&#xD;after some other instructions to undo the partial work of&#xD;the first script.</comment><header></header><code></code><translations>pt:lança o erro _&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doApplyExtension"><l>err_error(msg)</l><list><block var="msg"/></list></block></script></block-definition><block-definition s="safely try reporting %&apos;this&apos; then if %&apos;error&apos; report %&apos;that&apos;" type="reporter" category="control"><comment x="0" y="0" w="316.6666666666667" collapsed="false">Catch errors in a reporter.&#xD;&#xD;Evaluates its first input.  If that expression successfully reports a value, this block reports that value.  If the expression causes a Snap! error,&#xD;then the final input slot is evaluated with the text of what would have&#xD;been the error message in variable ERROR.  SAFELY TRY then reports the value of that final expression.&#xD;&#xD;Sometimes you&apos;ll want to throw an error in the final expression.  You&#xD;can put an ERROR block inside a CALL block to do that.</comment><header></header><code></code><translations>ca:prova de forma segura reportant _ i si _ reportant _&#xD;</translations><inputs><input type="%anyUE"></input><input type="%upvar"></input><input type="%anyUE"></input></inputs><script><block s="doDeclareVariables"><list><l>value</l></list></block><custom-block s="safely try %cs then if %upvar %cs"><script><block s="doSetVar"><l>value</l><block s="evaluate"><block var="this"/><list></list></block></block></script><l>err</l><script><block s="doSetVar"><l>error</l><block var="err"/></block><block s="doSetVar"><l>value</l><block s="evaluate"><block var="that"/><list></list></block></block></script></custom-block><block s="doReport"><block var="value"/></block></script></block-definition><block-definition s="empty" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="%&apos;#&apos; for each %&apos;item&apos; of %&apos;data&apos; %&apos;action&apos;" type="command" category="lists"><comment x="0" y="0" w="228.57142857142858" collapsed="false">This block carries out the given script for each item of the given list, like the primitive FOR EACH.&#xD;&#xD;What&apos;s different is that it provides the # variable, which will contain the item number in the list of each item in turn, 1 while processing item 1, and so on.</comment><header></header><code></code><translations>ca:_ per cada _ de _ _&#xD;</translations><inputs><input type="%upvar"></input><input type="%upvar"></input><input type="%l"></input><input type="%ca"></input></inputs><script><block s="doForEach"><l>inner item</l><block var="data"/><script><block s="doSetVar"><l>item</l><block var="inner item"/></block><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="multivar-memoize %&apos;function&apos;" type="reporter" category="Programmimg tools"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input></inputs><script><custom-block s="let %upvar be %s %mult%s"><l>memory</l><block s="reportNewList"><list></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>lookup table</l><block s="reifyScript"><script><block s="doIf"><block s="reportListIsEmpty"><block var="input list"/></block><script><block s="doReport"><block var="memory"/></block></script><list></list></block><custom-block s="let %upvar be %s %mult%s"><l>parent</l><block s="evaluate"><block var="lookup table"/><list><block s="reportCDR"><block var="input list"/></block></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>key</l><block s="reportJoinWords"><list><l>&amp;</l><block s="reportListItem"><l>1</l><block var="input list"/></block></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>child</l><block s="reportListItem"><block var="key"/><block var="parent"/></block><list></list></custom-block><block s="doIf"><block s="reportVariadicEquals"><list><block var="child"/><l></l></list></block><script><custom-block s="let %upvar be %s %mult%s"><l>newborn</l><block s="reportNewList"><list></list></block><list></list></custom-block><block s="doAddToList"><block s="reportNewList"><list><block var="key"/><block var="newborn"/></list></block><block var="parent"/></block><block s="doReport"><block var="newborn"/></block></script><list></list></block><block s="doReport"><block var="child"/></block></script><list><l>input list</l></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>memoized function</l><block s="reifyScript"><script><custom-block s="let %upvar be %s %mult%s"><l>parent</l><block s="evaluate"><block var="lookup table"/><list><block s="reportCDR"><block var="input list"/></block></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>key</l><block s="reportJoinWords"><list><l>&amp;</l><block s="reportListItem"><l>1</l><block var="input list"/></block></list></block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>child</l><block s="reportListItem"><block var="key"/><block var="parent"/></block><list></list></custom-block><block s="doIf"><block s="reportVariadicEquals"><list><block var="child"/><l></l></list></block><script><custom-block s="let %upvar be %s %mult%s"><l>newborn</l><block s="evaluate"><block var="function"/><block var="input list"/></block><list></list></custom-block><block s="doAddToList"><block s="reportNewList"><list><block var="key"/><block var="newborn"/></list></block><block var="parent"/></block><block s="doReport"><block var="newborn"/></block></script><list></list></block><block s="doReport"><block var="child"/></block></script><list><l>input list</l></list></block><list></list></custom-block><block s="doReport"><block var="memoized function"/></block></script></block-definition><block-definition s="fibonacci %&apos;n&apos;" type="reporter" category="Under development"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doIf"><block s="reportVariadicLessThan"><list><block var="n"/><l>3</l></list></block><script><block s="doReport"><l>1</l></block></script><list></list></block><block s="doReport"><block s="reportVariadicSum"><list><custom-block s="fibonacci %n"><block s="reportDifference"><block var="n"/><l>1</l></block></custom-block><custom-block s="fibonacci %n"><block s="reportDifference"><block var="n"/><l>2</l></block></custom-block></list></block></block></script></block-definition></blocks><stage name="General" width="480" height="360" costume="1" 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="3023"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB4KADAAQAAAABAAABaAAAAAAHwbojAAAL30lEQVR4Ae3QMQEAAADCoPVPbQwfiEBhwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIAB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MGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGPgMDI3+AAEeFvcCAAAAAElFTkSuQmCC</pentrails><costumes><list id="3024"><item><ref mediaID="General_cst_47A79113-9632-4E23-B41A-C8691D2C767D"></ref></item></list></costumes><sounds><list struct="atomic" id="3025"></list></sounds><variables></variables><blocks></blocks><scripts><script x="20" y="20"><custom-block s="comment %mlt"><l>To do list (programming tools)</l></custom-block></script><script x="20" y="59"><custom-block s="comment %mlt"><l>To do list (other areas)</l></custom-block><custom-block s="comment %mlt"><l>sorting library</l></custom-block><custom-block s="comment %mlt"><l>graphics library</l></custom-block></script></scripts><sprites select="4"><sprite name="Variables" idx="4" x="0.43767040278430613" y="-0.7302030195333771" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="false" hidden="true" costume="0" color="0,17.59499999999994,175.95,1" pen="tip" id="3038"><costumes><list struct="atomic" id="3039"></list></costumes><sounds><list struct="atomic" id="3040"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="20"><custom-block s="let %upvar be %s %mult%s"><l>variable</l><l></l><list><l></l></list><comment w="378.99999999999966" collapsed="false">&quot;Let&quot; is a mechanism, available in Scheme, JavaScript and several other languages, to declare and intialize local variables. By default the “let” block supports 1 variable; it can be extended *ad libitum*, using the “be” block.</comment></custom-block></script><script x="20" y="101"><custom-block s="%upvar be %s"><l>variable</l><l></l><comment w="396" collapsed="true">This is a &quot;be&quot; block. Its first slot is an upvar. It reports the value (second slot).</comment></custom-block></script><script x="20" y="138.83333333333334"><custom-block s="let %upvar be %s %mult%s"><l>pi</l><l>3.141592654</l><list><custom-block s="%upvar be %s"><l>e</l><l>2.71828182</l></custom-block><custom-block s="%upvar be %s"><l>name</l><l>apple pie</l></custom-block><custom-block s="%upvar be %s"><l>origin</l><custom-block s="%upvar be %s"><l>destination</l><block s="getPosition"></block></custom-block></custom-block></list><comment w="221" collapsed="false">An application example of &quot;tet&quot; + &quot;be&quot;: &quot;origin&quot;, &quot;destination&quot; are initialized with the same &quot;value&quot; (in this case: a list reported by &quot;position&quot;).</comment></custom-block></script><script x="20" y="219.83333333333331"><custom-block s="let %upvar be %s %mult%s"><l>x</l><l>3</l><list></list></custom-block><custom-block s="comment %mlt"><l>Thie following commands work similar to “change … by …”, except they also work if the variable (or other argument) is a list.</l></custom-block><custom-block s="increase %anyUE by %n"><block var="x"/><l>2</l></custom-block><custom-block s="multiply %anyUE by %n"><block var="x"/><l>13</l></custom-block><custom-block s="dec %anyUE"><block var="x"/></custom-block><custom-block s="divide %anyUE by %n"><block var="x"/><l>4</l></custom-block><custom-block s="modify %anyUE using %repRing"><block var="x"/><block s="reifyReporter"><autolambda><block s="reportMonadic"><l><option>sqrt</option></l><l></l></block></autolambda><list></list></block></custom-block><custom-block s="inc %anyUE"><block var="x"/></custom-block><custom-block s="decrease %anyUE by %n"><block var="x"/><l>3</l></custom-block><block s="doReport"><block var="x"/></block></script><script x="20" y="480.33333333333326"><custom-block s="let %upvar be %s %mult%s"><l>a</l><block s="reportNewList"><list><l>10</l><l>20</l></list></block><list></list></custom-block><custom-block s="decrease %anyUE by %n"><block var="a"/><block s="reportNewList"><list><l>1</l><l>2</l></list></block></custom-block><block s="doReport"><block var="a"/></block></script><script x="20" y="570.9999999999999"><block s="doReport"><custom-block s="variadic to list %mult%s"><list><l>A</l><l>1</l><block s="reportNumbers"><l>1</l><l>3</l></block></list></custom-block><comment w="177" collapsed="true">Reports variadic input as a list.</comment></block></script><script x="20" y="617.9999999999999"><block s="doReport"><custom-block s="variadic to list %mult%s"><list><l>A</l></list></custom-block></block></script><script x="20" y="660.9999999999999"><block s="doReport"><custom-block s="variadic to list %mult%s"><list></list></custom-block></block></script></scripts></sprite><sprite name="Calculus" idx="5" x="-57.562329597215694" y="124.26979698046674" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" hidden="true" costume="0" color="188.7,0,124.54200000000003,1" pen="tip" id="3152"><costumes><list struct="atomic" id="3153"></list></costumes><sounds><list struct="atomic" id="3154"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="20"><custom-block s="comment %mlt"><l>This is a series very slowly approximating pi, using the ‘accumulate’ function&#xD;as defined in Structure &amp; Interpretation of Computer Programs (par.1.3.1).</l></custom-block><block s="doReport"><block s="reportVariadicProduct"><list><l>8</l><custom-block s="accumulate (SICP), combiner: %repRing null-value: %s term: %repRing start-value: %s next: %repRing stop-condition: %predRing"><block s="reifyReporter"><autolambda><block s="reportVariadicSum"><list><l></l><l></l></list></block></autolambda><list></list></block><l>0</l><block s="reifyReporter"><autolambda><block s="reportQuotient"><l>1</l><block s="reportVariadicProduct"><list><l></l><block s="reportVariadicSum"><list><l></l><l>2</l></list></block></list></block></block></autolambda><list></list></block><l>1</l><block s="reifyReporter"><autolambda><block s="reportVariadicSum"><list><l></l><l>4</l></list></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicGreaterThan"><list><l></l><l>100000</l></list></block></autolambda><list></list></block></custom-block></list></block></block></script></scripts></sprite><sprite name="Lists" idx="6" x="104.43767040278408" y="70.26979698046671" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="133.977,181.04999999999998,0,1" pen="tip" id="3222"><costumes><list struct="atomic" id="3223"></list></costumes><sounds><list struct="atomic" id="3224"></list></sounds><blocks></blocks><variables></variables><scripts><script x="10" y="20"><custom-block s="comment %mlt"><l>Reports the reverse of a list, with each of its sublists deep-reversed.</l></custom-block><block s="doReport"><custom-block s="deep reverse %l"><block s="reportNewList"><list><l>A</l><block s="reportNewList"><list><l>B</l><l>C</l></list></block></list></block></custom-block></block></script><script x="10" y="92"><block s="doReport"><custom-block s="rotate %l down %n"><block s="reportNumbers"><l>1</l><l>50</l></block><l>-5</l></custom-block></block></script></scripts></sprite><sprite name="Logging" idx="2" x="-16.56232959721524" y="-52.73020301953329" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" hidden="true" costume="0" color="0,78.38700000000001,135.15,1" pen="tip" id="3252"><costumes><list struct="atomic" id="3253"></list></costumes><sounds><list struct="atomic" id="3254"></list></sounds><blocks></blocks><variables></variables><scripts><script x="30" y="30"><custom-block s="let %upvar be %s %mult%s"><l>log 1</l><l></l><list></list></custom-block><custom-block s="comment %mlt"><l>Creates a new log for debugging and optimization purposes), and reports it.&#xD;The log’s first entry is a mere timestamp.&#xD;Its next entries contain at least a (relative) timestamp and a label,&#xD;plus optional data. The entry is created by calling the variable&#xD;identIfying the log; the updated log will then be returned.&#xD;Philosophy:&#xD;1. A new log is generated for every user task.&#xD;2. Minimum processing time during logged operation, so as not to cause extra delays.</l></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>A</l><block s="reportNewList"><list><l>45</l></list></block></list></block></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>B</l><block s="reportNewList"><list></list></block></list></block></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>B</l><l>5</l></list></block></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>B</l></list></block></custom-block><custom-block s="comment %mlt"><l>Variadic input may be emulated by adding a variadic-to-list converter</l></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>A</l><custom-block s="variadic to list %mult%s"><list><l>2</l><l>100</l></list></custom-block></list></block></custom-block><block s="doWait"><l>1</l></block><custom-block s="ignore %s"><block s="evaluate"><block var="log 1"/><list><l>B</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></custom-block><block s="doReport"><block s="evaluate"><block var="log 1"/><list><l>A</l><custom-block s="variadic to list %mult%s"><block s="reportNumbers"><l>1</l><l>3</l></block></custom-block></list></block></block></script><script x="30" y="455"><custom-block s="test %repRing %s %mult%s"><block s="reifyReporter"><autolambda><block s="reportVariadicProduct"><list><l></l><l></l></list></block></autolambda><list></list></block><l>6</l><block s="reportNewList"><list><l>3</l><l>2</l></list></block></custom-block></script><script x="30" y="498"><custom-block s="test %repRing %s %mult%s"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><l>4</l><custom-block s="variadic to list %mult%s"><list><l>16</l></list></custom-block></custom-block></script></scripts></sprite><sprite name="Documentation" idx="3" x="25.43767040278476" y="-43.730203019533235" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" hidden="true" costume="0" color="191.25,0,57.375000000000135,1" pen="tip" id="3382"><costumes><list struct="atomic" id="3383"></list></costumes><sounds><list struct="atomic" id="3384"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="20"><custom-block s="ignore %s"><custom-block s="tbd %mlt"><l>This is an “empty” reporter, a placeholder for work to be done.&#xD;This text slot may be used to write down a concise specification.</l></custom-block></custom-block><custom-block s="comment %mlt"><l>This block doesn’t do anything.&#xD;It merely keeps a comment in the right spot&#xD;within a script.</l></custom-block><custom-block s="(…)"></custom-block></script></scripts></sprite><sprite name="Sorting" idx="7" x="207.43767040278453" y="-150.7302030195334" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" hidden="true" costume="0" color="0,117.30000000000001,117.30000000000001,1" pen="tip" id="3395"><costumes><list struct="atomic" id="3396"></list></costumes><sounds><list struct="atomic" id="3397"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="10"><custom-block s="comment %mlt"><l>This demonstration of PREPSORT vs. SORT takes about 10 secs&#xD;(in Turbo mode)</l></custom-block><custom-block s="let %upvar be %s %mult%s"><l>size</l><l>50</l><list><custom-block s="%upvar be %s"><l>delay</l><l>0.01</l></custom-block></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>data</l><custom-block s="shuffle %l (optimized)"><block s="reportNumbers"><l>1</l><block var="size"/></block></custom-block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>timer</l><custom-block s="new log"></custom-block><list></list></custom-block><custom-block s="ignore %s"><custom-block s="$flash sort %l ordering with %predRing"><block var="data"/><block s="reifyPredicate"><autolambda><block s="reportVariadicGreaterThan"><list><custom-block s="simulated CPU-intensive operation %s %n"><l></l><block var="delay"/></custom-block><custom-block s="simulated CPU-intensive operation %s %n"><l></l><block var="delay"/></custom-block></list></block></autolambda><list></list></block></custom-block></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="timer"/><list><l>A</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></custom-block><custom-block s="ignore %s"><custom-block s="prepsort %l by %repRing %s"><block var="data"/><block s="reifyReporter"><autolambda><custom-block s="simulated CPU-intensive operation %s %n"><l></l><block var="delay"/></custom-block></autolambda><list></list></block><l>HIGH 2 low</l></custom-block></custom-block><block s="doReport"><block s="evaluate"><block var="timer"/><list><l>end</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></block></script><script x="20" y="352.16666666666674"><custom-block s="prepsort %l by %repRing %s"><block var="data"/><block s="reifyReporter"><autolambda><custom-block s="key function %s"><l></l></custom-block></autolambda><list></list></block><l>LoHi</l></custom-block></script><script x="20" y="395.16666666666674"><custom-block s="comment %mlt"><l>This demonstration of partial sort (SELECT TOP ITEMS) takes about 2 secs&#xD;(in Turbo mode)</l></custom-block><custom-block s="let %upvar be %s %mult%s"><l>size</l><l>500000</l><list><custom-block s="%upvar be %s"><l>selection</l><l>95</l></custom-block></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>data</l><custom-block s="shuffle %l (optimized)"><block s="reportNumbers"><l>1</l><block var="size"/></block></custom-block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>timer</l><custom-block s="new log"></custom-block><list></list></custom-block><custom-block s="ignore %s"><block s="reportListItem"><block s="reportNumbers"><l>1</l><block var="selection"/></block><custom-block s="$flash sort %l ordering with %predRing"><block var="data"/><block s="reifyPredicate"><autolambda><block s="reportVariadicLessThan"><list><l></l><l></l></list></block></autolambda><list></list></block></custom-block></block></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="timer"/><list><l>A</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></custom-block><custom-block s="ignore %s"><custom-block s="select top %n items from %l sorted by %predRing"><block var="selection"/><block var="data"/><block s="reifyPredicate"><autolambda><block s="reportVariadicMin"><list><l></l><l></l></list></block></autolambda><list></list></block></custom-block></custom-block><block s="doReport"><block s="evaluate"><block var="timer"/><list><l>end</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></block></script><script x="20" y="705.8333333333336"><custom-block s="select top %n items from %l sorted by %predRing"><l>50</l><block s="reportNumbers"><l>1</l><l>10000</l></block><block s="reifyPredicate"><autolambda><block s="reportVariadicMax"><list><l></l><l></l></list></block></autolambda><list></list></block></custom-block></script><script x="20" y="766.8333333333336"><custom-block s="comment %mlt"><l>This demonstration of partial sort (TOPSORT) takes about 10 secs&#xD;(in Turbo mode)</l></custom-block><custom-block s="let %upvar be %s %mult%s"><l>size</l><l>50</l><list><custom-block s="%upvar be %s"><l>selection</l><l>50</l></custom-block><custom-block s="%upvar be %s"><l>delay</l><l>0.01</l></custom-block></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>data</l><custom-block s="shuffle %l (optimized)"><block s="reportNumbers"><l>1</l><block var="size"/></block></custom-block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>timer</l><custom-block s="new log"></custom-block><list></list></custom-block><custom-block s="ignore %s"><block s="reportListItem"><block s="reportNumbers"><l>1</l><block var="selection"/></block><custom-block s="$flash sort %l ordering with %predRing"><block var="data"/><block s="reifyPredicate"><autolambda><block s="reportVariadicGreaterThan"><list><custom-block s="simulated CPU-intensive operation %s %n"><l></l><block var="delay"/></custom-block><custom-block s="simulated CPU-intensive operation %s %n"><l></l><block var="delay"/></custom-block></list></block></autolambda><list></list></block></custom-block></block></custom-block><custom-block s="ignore %s"><block s="evaluate"><block var="timer"/><list><l>A</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></custom-block><custom-block s="ignore %s"><custom-block s="topsort %n from %l by %repRing %s"><block var="selection"/><block var="data"/><block s="reifyReporter"><autolambda><custom-block s="simulated CPU-intensive operation %s %n"><l></l><block var="delay"/></custom-block></autolambda><list></list></block><l>HiLo</l></custom-block></custom-block><block s="doReport"><block s="evaluate"><block var="timer"/><list><l>end</l><custom-block s="variadic to list %mult%s"><list></list></custom-block></list></block></block></script><script x="626" y="388.83333333333337"><custom-block s="integers 1 to %n except %n"><l>999999</l><l>999000</l></custom-block></script></scripts></sprite><sprite name="I/O" idx="8" x="4.4376704027845335" y="-9.73020301953332" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="0,122.39999999999999,78.33600000000001,1" pen="tip" id="3697"><costumes><list struct="atomic" id="3698"></list></costumes><sounds><list struct="atomic" id="3699"></list></sounds><blocks></blocks><variables></variables><scripts><script x="30" y="20"><custom-block s="let %upvar be %s %mult%s"><l>beginnings</l><custom-block s="multiline %mlt"><l>In the beginning God created heavens and earth.&#xD;Now the earth was formless and empty.&#xD;And God said, “Let there be light”.</l></custom-block><list></list></custom-block><custom-block s="let %upvar be %s %mult%s"><l>read bible</l><custom-block s="new scanner %s"><block var="beginnings"/></custom-block><list></list></custom-block><custom-block s="comment %mlt"><l>Create a new scanner, to be assigned to a variable.&#xD;The input may be a list or a text.&#xD;Subsequent CALL-s to the variable will report &#xD;the first, second (etc.) top level item or line, respectively.</l></custom-block><block s="doSayFor"><block s="evaluate"><block var="read bible"/><list></list></block><l>2</l></block><block s="doSayFor"><block s="evaluate"><block var="read bible"/><list></list></block><l>2</l></block><block s="doSayFor"><block s="evaluate"><block var="read bible"/><list></list></block><l>2</l></block></script><script x="30" y="247.33333333333337"><custom-block s="let %upvar be %s %mult%s"><l>winter olympics</l><block s="reportNewList"><list><block s="reportNewList"><list><l>1920</l><l>Antwerpen</l></list></block><block s="reportNewList"><list><l>1924</l><l>Paris</l></list></block><block s="reportNewList"><list><l>1928</l><l>Amsterdam</l></list></block></list></block><list></list></custom-block><custom-block s="comment %mlt"><l>Using a list as input</l></custom-block><custom-block s="let %upvar be %s %mult%s"><l>read history</l><custom-block s="new scanner %s"><block var="winter olympics"/></custom-block><list></list></custom-block><block s="doSayFor"><block s="evaluate"><block var="read history"/><list></list></block><l>2</l></block><block s="doSayFor"><block s="evaluate"><block var="read history"/><list></list></block><l>2</l></block><block s="doSayFor"><block s="evaluate"><block var="read history"/><list></list></block><l>2</l></block><custom-block s="comment %mlt"><l>If the end of the list / file has already been passed, an error is raised.</l></custom-block><block s="doSayFor"><block s="evaluate"><block var="read history"/><list></list></block><l>2</l></block></script><script x="30" y="524.3333333333334"><custom-block s="comment %mlt"><l>if the input is neither a text nor a list, an error will be raised.</l></custom-block><custom-block s="let %upvar be %s %mult%s"><l>read number</l><custom-block s="new scanner %s"><l>42</l></custom-block><list></list></custom-block></script></scripts></sprite><sprite name="Control" idx="1" x="-24.562329597215466" y="56.269796980466595" heading="90" scale="0.5" volume="100" pan="0" rotation="2" draggable="true" costume="0" color="145.35,0,43.6050000000001,1" pen="tip" id="3814"><costumes><list id="3815"><item><ref mediaID="Control_cst_alonzo"></ref></item></list></costumes><sounds><list struct="atomic" id="3816"></list></sounds><blocks></blocks><variables></variables><scripts><script x="30" y="10"><custom-block s="do %b %mlt %cs (done) %mlt"><l><bool>true</bool></l><l>The "do"-block keeps multiple coherent actions together, such that they can easily be&#xD;moved, copied, commented on, temporarily switched off, deleted, etc&#xD;It may also be used as a placeholder for future additions.</l><script></script><l>Here&apos;s a place for an epilogue perhaps to store some ideas for further development. </l></custom-block></script><script x="30" y="106"><block s="receiveInteraction"><l><option>clicked</option></l></block><custom-block s="do %b %mlt %cs (done) %mlt"><l><bool>true</bool></l><l>An example application of the "do" block.&#xD;This is a multiline comment.</l><script><custom-block s="let %upvar be %s %mult%s"><l>home</l><block s="getPosition"></block><list></list></custom-block><block s="doGotoObject"><l><option>random position</option></l></block><custom-block s="do %b %mlt %cs (done) %mlt"><l><bool>false</bool></l><l>The action within this "do" block was (temporarily?)&#xD;switched off for debugging reasons.&#xD;Can you guess why?</l><script><block s="doSetVar"><l>home</l><block s="getPosition"></block></block></script><l>Hint: how will we get back to where we came from now?</l></custom-block></script><l></l><comment w="358" collapsed="true">Feel free to add a separate comment on the entire cluster of blocks ...</comment></custom-block><custom-block s="do %b %mlt %cs (done) %mlt"><l><bool>false</bool></l><l>The action within this "do-block is apperently an alternative algorithm, switched of for now. </l><script><block s="doSetVar"><l>home</l><block s="getPosition"></block></block><block s="gotoXY"><block s="reportRandom"><l>-240</l><l>239</l></block><block s="reportRandom"><l>-180</l><l>179</l></block></block></script><l>Compared to the other algorithm this one is less concise, and less robust regarding stage size</l></custom-block><block s="doWait"><l>0.1</l></block><block s="doGotoObject"><block var="home"/></block></script><script x="30" y="508.5"><block s="doIf"><l><bool>true</bool></l><script><custom-block s="comment %mlt"><l>This is a primitive alternative for “do”. The advantage of using “if” is that the if-block makes editing easier.</l></custom-block></script><list></list></block></script><script x="30" y="586.3333333333334"><block s="doIfElse"><l><bool>false</bool></l><script><custom-block s="comment %mlt"><l>algorithm A</l></custom-block><custom-block s="(…)"></custom-block><custom-block s="comment %mlt"><l>epilogue</l></custom-block></script><script><custom-block s="comment %mlt"><l>algorithm B&#xD;(an alternative for A)</l></custom-block><custom-block s="(…)"></custom-block></script><comment w="292" collapsed="true">The switch toggles between the &quot;ïf&quot; and &quot;else&quot;-scripts.</comment></block></script><script x="30" y="759.8333333333334"><custom-block s="comment %mlt"><l>This is a demo of the loop/hole construct, which is mostly for fun.&#xD;The hole opens (= the loop ends) when the (exit) condition is met.</l></custom-block><custom-block s="let %upvar be %s %mult%s"><l>count</l><l>0</l><list></list></custom-block><custom-block s="loop %cs hole %predRing %ca"><script><block s="doChangeVar"><l>count</l><l>1</l></block></script><block s="reifyPredicate"><autolambda><block s="reportVariadicGreaterThan"><list><block var="count"/><l>10</l></list></block></autolambda><list></list></block><script><block s="doChangeVar"><l>count</l><l>10</l></block></script></custom-block><block s="doReport"><block var="count"/></block></script><script x="30" y="960.166666666667"><custom-block s="comment %mlt"><l>This is a demo of ITERATE, a further developed version of LET a BE [.] IN loop.&#xD;It provides a generalized container for iteration.&#xD;Interestingly, like the original, it employs recursion internally &#xD;as a mechanism for proceeding to the next iteration.&#xD;TL;DR: “Just add code`.</l></custom-block><custom-block s="iterate %upvar from %s by %repRing while %predRing do %cs"><l>capital</l><l>A</l><block s="reifyReporter"><autolambda><block s="reportUnicodeAsLetter"><block s="reportVariadicSum"><list><block s="reportUnicode"><l></l></block><l>2</l></list></block></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicLessThanOrEquals"><list><l></l><l>G</l></list></block></autolambda><list></list></block><script><block s="doSayFor"><block var="capital"/><l>1</l></block></script></custom-block></script><script x="30" y="1141.0000000000002"><custom-block s="iterate %upvar from %s by %repRing while %predRing do %cs (Non-recursive Implementation)"><l>capital</l><l>A</l><block s="reifyReporter"><autolambda><block s="reportUnicodeAsLetter"><block s="reportVariadicSum"><list><block s="reportUnicode"><l></l></block><l>2</l></list></block></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportVariadicLessThanOrEquals"><list><l></l><l>G</l></list></block></autolambda><list></list></block><script><block s="doSayFor"><block var="capital"/><l>1</l></block></script></custom-block></script><script x="30" y="1262.8333333333335"><custom-block s="let %upvar be %s %mult%s"><l>variable</l><l>-42</l><list></list></custom-block><custom-block s="cases, default: %cs special: %mult%boolUE"><script><custom-block s="comment %mlt"><l>Even if there is no default case (or is there?) ...&#xD;the C-shape could be used for a "do nothing" block like this comment.</l></custom-block></script><list><custom-block s="case %b %cs"><block s="reportVariadicGreaterThan"><list><block var="variable"/><l>0</l></list></block><script><block s="doSayFor"><l>1</l><l>2</l></block></script></custom-block><custom-block s="case %b %cs"><block s="reportVariadicLessThan"><list><block var="variable"/><l>0</l></list></block><script><block s="doSayFor"><l>-1</l><l>2</l></block></script></custom-block></list></custom-block></script></scripts></sprite><sprite name="Memoize" idx="9" x="196" y="-87" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="63.95399999999999,0,168.3,1" pen="tip" id="4035"><costumes><list struct="atomic" id="4036"></list></costumes><sounds><list struct="atomic" id="4037"></list></sounds><blocks></blocks><variables><variable name="fast fib" transient="true"/><variable name="fast-change" transient="true"/><variable name="coin denominations" transient="true"/></variables><scripts><script x="20" y="20"><block s="doSetVar"><l>fast fib</l><custom-block s="memoize %repRing"><block s="reifyReporter"><autolambda><custom-block s="memo-fib %n"><l></l></custom-block></autolambda><list></list></block></custom-block></block><block s="doReport"><custom-block s="memo-fib %n"><l>1000</l></custom-block></block></script><script x="20" y="98"><block s="doSetVar"><l>coin denominations</l><block s="reportNewList"><list><l>1</l><l>2</l><l>5</l><l>10</l><l>20</l><l>50</l><l>100</l><l>200</l></list></block></block><block s="doSetVar"><l>fast-change</l><custom-block s="multivar-memoize %repRing"><block s="reifyReporter"><autolambda><custom-block s="memo-change-options %n %n"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block></block><block s="doReport"><custom-block s="memo-change-options %n %n"><l>4000</l><l>8</l></custom-block></block></script><script x="20" y="201"><custom-block s="fibonacci %n"><l>30</l></custom-block></script></scripts></sprite><watcher scope="Control" s="getCostumeIdx" style="normal" x="10" y="9.999999999999986" color="143,86,227" hidden="true"/><watcher scope="Control" s="getScale" style="normal" x="10" y="124.00000399999999" color="143,86,227" hidden="true"/><watcher var="playing field" style="normal" x="10" y="145.00000599999993" color="243,118,29" hidden="true"/><watcher var="pf width" style="normal" x="10" y="166.0000080000001" color="243,118,29" hidden="true"/><watcher var="pf.height" style="normal" x="10" y="187.00001000000003" color="243,118,29" hidden="true"/><watcher var="sand" style="normal" x="10" y="208.00001199999997" color="243,118,29" hidden="true"/><watcher var="active items" style="normal" x="10" y="338.9999980000002" color="243,118,29" hidden="true"/><watcher var="source y" style="normal" x="10" y="338.9999980000002" color="243,118,29" hidden="true"/><watcher var="empty" style="normal" x="10" y="338.9999980000002" color="243,118,29" hidden="true"/><watcher var="fill material" style="normal" x="10" y="338.9999980000002" color="243,118,29" hidden="true"/><watcher var="source x" style="normal" x="4" y="309.9999979999999" color="243,118,29" hidden="true"/><watcher var="passivated items" style="normal" x="10" y="338.9999980000002" color="243,118,29" hidden="true"/><watcher scope="Memoize" var="fast fib" style="normal" x="10" y="234.000002" color="243,118,29" hidden="true"/><watcher var="log" style="normal" x="38" y="21.999998000000005" color="243,118,29" hidden="true"/><watcher var="fast fib" style="normal" x="0" y="26.999998000000005" color="243,118,29" hidden="true"/><watcher var="fast-change" style="normal" x="10" y="255.000004" color="243,118,29" hidden="true"/><watcher var="coin denominations" style="normal" x="10" y="276.000006" color="243,118,29" hidden="true"/><watcher scope="Memoize" var="fast-change" style="normal" x="10" y="297.000008" color="243,118,29" hidden="true"/><watcher scope="Memoize" var="coin denominations" style="normal" x="10" y="318.00001" color="243,118,29" hidden="true"/></sprites></stage><variables></variables></scene></scenes></project><media name="Programming tools" app="Snap! 9.0, https://snap.berkeley.edu" version="2"><costume name="47A79113-9632-4E23-B41A-C8691D2C767D" center-x="180" center-y="180" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAAFoCAYAAAB65WHVAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAA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DBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBg4G9g6tEAAS57R+8AAAAASUVORK5CYII=" mediaID="General_cst_47A79113-9632-4E23-B41A-C8691D2C767D"/><costume name="alonzo" center-x="45" center-y="60" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAB4CAYAAAByzOU/AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAWqADAAQAAAABAAAAeAAAAADyfffTAAAA00lEQVR4Ae3QgQAAAADDoPlTH+SFUGHAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgy8DAypOAABhK3xbAAAAABJRU5ErkJggg==" mediaID="Control_cst_alonzo"/></media></snapdata>