<snapdata remixID="9298408"><project name="U8L1p3 Writing Recursive Reporters" app="Snap! 5.4, http://snap.berkeley.edu" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAADhUlEQVR4Xu3WsUoqcBzF8V8uOUWLs04NIvQQ6hJC2Av4Ak0Obk4+iFM49gY9i4vYGBG56UXhwg3upnE4h69j4P/3+53zobo6HA6H4kMCogSuAChKnrGnBAAIBGkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkAUBo/wwGIAWkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkAUBo/wwGIAWkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkAUBo/wwGIAWkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkAUBo/wwGIAWkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkAUBo/wwGIAWkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkAUBo/wwGIAWkCAJTGz3AAYkCaAACl8TMcgBiQJgBAafwMByAGpAkA8Mz4F4tFzefz0yur1are39+r1+vVcDis8Xhcr6+vPyas1+vqdDpnTs35OgDP7PL5+bk2m00tl8u6vb2tfr9fNzc3tdvtqt1u19PTU11fX9fX11eNRqMC4M/AAXgmwL+/AT8+Pk4A9/v9CdoR3b+f489brVZNp9PqdrtnTs35OgB/ocvjn97/fbbbbc1ms3p4eKhms/kLk/2eBOCFO5tMJvX5+Xl69fv7uwaDQT0+Ptbd3d2FJ2U8B8AL9vjy8lJvb291/L/w/v6+Go3GBV/PfAqAmb3aXAVAm6oyFwVgZq82VwHQpqrMRQGY2avNVQC0qSpzUQBm9mpzFQBtqspcFICZvdpcBUCbqjIXBWBmrzZXAdCmqsxFAZjZq81VALSpKnNRAGb2anMVAG2qylwUgJm92lwFQJuqMhcFYGavNlcB0KaqzEUBmNmrzVUAtKkqc1EAZvZqcxUAbarKXBSAmb3aXAVAm6oyFwVgZq82VwHQpqrMRQGY2avNVQC0qSpzUQBm9mpzFQBtqspcFICZvdpcBUCbqjIXBWBmrzZXAdCmqsxFAZjZq81VALSpKnNRAGb2anMVAG2qylwUgJm92lwFQJuqMhcFYGavNlcB0KaqzEUBmNmrzVUAtKkqc1EAZvZqcxUAbarKXBSAmb3aXAVAm6oyFwVgZq82VwHQpqrMRQGY2avNVQC0qSpzUQBm9mpzFQBtqspcFICZvdpc9QdyNCO3UNDk7QAAAABJRU5ErkJggg==</thumbnail><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="true" codify="false" inheritance="false" sublistIDs="false" scheduled="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAQUUlEQVR4Xu3bP27bdRzH4d83W8uKxBVg4gpMBTHUdOEASEjAUNhYWZFYYGFA4gAMFHdAUDFwBNi4Agcg3fJFRrbkoBI3KM0rfx6miqT5xE/e0kt23LH4jwABAgQIELh0gXHpFx0kQIAAAQIEFgE2AgIECBAgEAgIcIDuJAECBAgQEGAbIECAAAECgYAAB+hOEiBAgAABAbYBAgQIECAQCAhwgO4kAQIECBAQYBsgQIAAAQKBgAAH6E4SIECAAAEBtgECBAgQIBAICHCA7iQBAgQIEBBgGyBAgAABAoGAAAfoThIgQIAAAQG2AQIECBAgEAgIcIDuJAECBAgQEGAbIECAAAECgYAAB+hOEiBAgAABAbYBAgQIECAQCAhwgO4kAQIECBAQYBsgQIAAAQKBgAAH6E4SIECAAAEBtgECBAgQIBAICHCA7iQBAgQIEBBgGyBAgAABAoGAAAfoThIgQIAAAQG2AQIECBAgEAgIcIDuJAECBAgQEGAbIECAAAECgYAAB+hOEiBAgAABAbYBAgQIECAQCAhwgO4kAQIECBAQYBsgQIAAAQKBgAAH6E4SIECAAAEBtgECBAgQIBAICHCA7iQBAgQIEBBgGyBAgAABAoGAAAf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bbx727ve8O4I556lnrecM8KmXqzfPruecnx4fH7+/eRa8/f3xF3POz57398Y3+EfjoRE4KCDAB4l8AoGrK3AowMuyvLN7hvqsR3GRAb66Sr4zAldTQICv5s/Fd0XguQTOCvD2Jegz35V8zgCfegl7+27rzRu4/nkJevdy+LIsn5z1DuznemA+icAtEBDgW/BD9hBvrsChN2Ht/3OjjcLunxztv5lq7+Xp3e+NT/1Oef9l6010xxgfbL/WqZezBfjm7swjezECAvxiXH1VAgQIECBwpoAAGwgBAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFAQIADdCcJECBAgIAA2wABAgQIEAgEBDhAd5IAAQIECAiwDRAgQIAAgUBAgAN0JwkQIECAgADbAAECBAgQCAQEOEB3kgABAgQICLANECBAgACBQECAA3QnCRAgQICAANsAAQIECBAIBAQ4QHeSAAECBAgIsA0QIECAAIFA4G+SsXx4Uun+IAAAAABJRU5ErkJggg==</pentrails><costumes><list struct="atomic" id="2"></list></costumes><sounds><list struct="atomic" id="3"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites><sprite name="Sprite" idx="1" x="39.88143289462505" y="-0.2557371694207973" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="8"><costumes><list struct="atomic" id="9"></list></costumes><sounds><list struct="atomic" id="10"></list></sounds><blocks></blocks><variables></variables><scripts><comment x="30" y="10" w="593" collapsed="false">Updated by Grant Weber on 02/23/2020&#xD;1920 U8L1p3 Writing Recursive Reporters (starter file)&#xD;Week 11: Recursion II &gt; Unit 8 Lab 1: Recursive Reporters &gt; Writing Recursive Reporters</comment><comment x="30" y="85.19999999999999" w="594" collapsed="false">The factorial function, n!. is defined to be the product of integers from 1 to n.&#xD;1.0 The value of 9! is 362,880. Find the value of 10!.&#xD;2.0 Describe the relationship between 37! and 36!.&#xD;3.0 Use these ideas to build a factorial block using a recursive reporter.</comment><script x="30" y="172.39999999999998"><custom-block s="%s !"><l>10</l><comment w="541.2" collapsed="true">Don&apos;t forget Betty&apos;s advice: base cases are important!</comment></custom-block></script><comment x="30" y="204.2" w="586" collapsed="false">4.0 The phrase &quot;in the course of human events&quot; has 24 letters. How many letters are there in the phrase &quot;When in the course of human events&quot;?</comment><comment x="30" y="354.6" w="583.6" collapsed="false">5.0 Recursion always needs a base case to stop the script from calling itself forever. What sort of base case might we use for this situation?</comment><comment x="30" y="517" w="582" collapsed="false">6.0 Create a letter count block that takes a list of words as input and reports the total number of letters in all the words. The all but first of block may be useful, but there is more than one way to do this.</comment><script x="30" y="580.2"><custom-block s="letter count %l"><block s="reportNewList"><list><l>We</l><l>the</l><l>People</l><l>of</l><l>the</l><l>United</l><l>States</l></list></block></custom-block></script><comment x="30" y="614.6" w="583.6" collapsed="false">7.0 Create your own version of the join words block. This block inputs a list and outputs a string sentence, with spaces:</comment><script x="30" y="665.8"><custom-block s="my join words %l"><block s="reportNewList"><list><l>We</l><l>the</l><l>People</l><l>of</l><l>the</l><l>United</l><l>States</l></list></block></custom-block></script><comment x="30" y="700.2" w="578.8" collapsed="false">8.0 Build this plurals block, then describe how it works. (You&apos;ve already built a simpler version of plurals using map; we want you to see that the same problem can be solved in multiple ways.)</comment><script x="30" y="763.4"><custom-block s="plurals %l"><block s="reportNewList"><list><l>We</l><l>the</l><l>People</l><l>of</l><l>the</l><l>United</l><l>States</l></list></block></custom-block></script><comment x="101.19999999999999" y="265.8" w="513.2" collapsed="false">8.1.3.4:  The count of letters does not include the spaces between words.  So if &quot;in the ... events&quot; has 24 letters, then &quot;WHEN in the ... events&quot; has 4+24=28, since &quot;When&quot; has four.</comment><comment x="110" y="421.79999999999995" w="501.2" collapsed="false">8.1.3.5:  One possible answer is that the number of lettes in a one-word sentence is the number of letters in the word.  But a more elegant answer is that an empty sentence contains zero letters.  Either of these can be used to write the code.</comment><script x="37" y="325"><custom-block s="letter count %l"><block s="reportNewList"><list><l>When</l><l>in</l><l>the</l><l>course</l><l>of</l><l>human</l><l>events</l></list></block></custom-block></script></scripts></sprite></sprites></stage><hidden></hidden><headers></headers><code></code><blocks><block-definition s="label %&apos;text&apos; of size %&apos;size&apos;" type="command" category="pen"><comment x="0" y="0" w="90" collapsed="false">LABEL will stamp text on the stage at the given font size. The direction of the text is the direction the sprite is facing, and color will match the pen color.</comment><header></header><code></code><translations></translations><inputs><input type="%txt">Hello!</input><input type="%n">12</input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>text</l><l>size</l></list><l>var stage = this.parentThatIsA(StageMorph),&#xD;    context = stage.penTrails().getContext(&apos;2d&apos;),&#xD;    rotation = radians(this.direction() - 90),&#xD;    trans = new Point(&#xD;      this.center().x - stage.left(),&#xD;      this.center().y - stage.top()&#xD;    ),&#xD;    isWarped = this.Warped,&#xD;    len,&#xD;    pos;&#xD;&#xD;if (isWarped) {endWarp(); }&#xD;context.save();&#xD;context.font = size + &apos;px monospace&apos;;&#xD;context.textAlign = &apos;left&apos;;&#xD;context.textBaseline = &apos;alphabetic&apos;;&#xD;context.fillStyle = this.color.toString();&#xD;len = context.measureText(text).width;&#xD;trans = trans.multiplyBy(1 / stage.scale);&#xD;context.translate(trans.x, trans.y);&#xD;context.rotate(rotation);&#xD;context.fillText(text, 0, 0);&#xD;context.translate(-trans.x, -trans.y);&#xD;context.restore();&#xD;pos = new Point(&#xD;  len * Math.sin(radians(this.direction())),&#xD;  len * Math.cos(radians(this.direction())));&#xD;pos = pos.add(new Point(this.xPosition(), this.yPosition()));&#xD;this.gotoXY(pos.x, pos.y, false);&#xD;this.changed();&#xD;if (isWarped) {this.startWarp(); }&#xD;stage.changed();</l></block><list><block var="text"/><block var="size"/></list></block></script></block-definition><block-definition s="map %&apos;function&apos; over %&apos;lists&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%mult%l"></input></inputs><script><block s="doWarp"><script><block s="doDeclareVariables"><list><l>mapone</l><l>mapmany</l></list></block><block s="doSetVar"><l>mapone</l><block s="reifyScript"><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="evaluate"><block var="mapone"/><list><block s="reportCDR"><block var="data"/></block></list></block></block></block></script><list><l>data</l></list></block></block><block s="doSetVar"><l>mapmany</l><block s="reifyScript"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportListItem"><l>1</l><block var="data lists"/></block></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="function"/><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><list><block var="data lists"/></list></custom-block></block><block s="evaluate"><block var="mapmany"/><list><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportCDR"><l/></block></autolambda><list></list></block><list><block var="data lists"/></list></custom-block></list></block></block></block></script><list><l>data lists</l></list></block></block><block s="doIfElse"><custom-block s="empty? %l"><block s="reportCDR"><block var="lists"/></block></custom-block><script><block s="doReport"><block s="evaluate"><block var="mapone"/><list><block s="reportListItem"><l>1</l><block var="lists"/></block></list></block></block></script><script><block s="doReport"><block s="evaluate"><block var="mapmany"/><list><block var="lists"/></list></block></block></script></block></script></block></script></block-definition><block-definition s="empty? %&apos;data&apos;" type="predicate" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportEquals"><block var="data"/><block s="reportNewList"><list></list></block></block></block></script></block-definition><block-definition s="keep items such that %&apos;pred&apos; from %&apos;data&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%predRing"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIfElse"><block s="evaluate"><block var="pred"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></block></script><script><block s="doReport"><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></script></block></script></block></script></block-definition><block-definition s="combine with %&apos;function&apos; items of %&apos;data&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="data"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="data"/></block></block></script></block><block s="doReport"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="combine with %repRing items of %l"><block var="function"/><block s="reportCDR"><block var="data"/></block></custom-block></list></block></block></script></block></script></block-definition><block-definition s="if %&apos;test&apos; then %&apos;true&apos; else %&apos;false&apos;" type="reporter" category="control"><header></header><code></code><translations></translations><inputs><input type="%b"></input><input type="%anyUE"></input><input type="%anyUE"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doReport"><block s="evaluate"><block var="true"/><list></list></block></block></script><script><block s="doReport"><block s="evaluate"><block var="false"/><list></list></block></block></script></block></script></block-definition><block-definition s="for %&apos;i&apos; = %&apos;start&apos; to %&apos;end&apos; %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%n">1</input><input type="%n">10</input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>step</l><l>tester</l></list></block><block s="doIfElse"><block s="reportGreaterThan"><block var="start"/><block var="end"/></block><script><block s="doSetVar"><l>step</l><l>-1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportLessThan"><block var="i"/><block var="end"/></block></autolambda><list></list></block></block></script><script><block s="doSetVar"><l>step</l><l>1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportGreaterThan"><block var="i"/><block var="end"/></block></autolambda><list></list></block></block></script></block><block s="doSetVar"><l>i</l><block var="start"/></block><block s="doUntil"><block s="evaluate"><block var="tester"/><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="join words %&apos;words&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%mult%txt"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="words"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="words"/></block></block></script></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportListItem"><l>1</l><block var="words"/></block></block><script><block s="doReport"><custom-block s="join words %mult%txt"><block s="reportCDR"><block var="words"/></block></custom-block></block></script></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportListItem"><l>2</l><block var="words"/></block></block><script><block s="doReport"><custom-block s="join words %mult%txt"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="words"/></block><block s="reportCDR"><block s="reportCDR"><block var="words"/></block></block></block></custom-block></block></script></block><block s="doReport"><block s="reportJoinWords"><list><block s="reportListItem"><l>1</l><block var="words"/></block><l> </l><custom-block s="join words %mult%txt"><block s="reportCDR"><block var="words"/></block></custom-block></list></block></block></script></block></script><scripts><script x="229.00000300000002" y="196.77778077777774"><block s="reportJoinWords"><list><l></l><l></l></list></block></script></scripts></block-definition><block-definition s="list $arrowRight sentence %&apos;data&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doReport"><custom-block s="join words %mult%txt"><block var="data"/></custom-block></block></script></block></script></block-definition><block-definition s="sentence $arrowRight list %&apos;text&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%txt"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportTextSplit"><block var="text"/><l><option>whitespace</option></l></block></block></script></block></script></block-definition><block-definition s="catch %&apos;tag&apos; %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations></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><custom-block s="ignore %s"><l>3</l></custom-block></script></block-definition><block-definition s="throw %&apos;cont&apos;" type="command" category="control"><header></header><code></code><translations></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></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></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="for each %&apos;item&apos; of %&apos;data&apos; %&apos;action&apos;" type="command" category="lists"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%l"></input><input type="%cs"></input></inputs><script><block s="doUntil"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doSetVar"><l>item</l><block s="reportListItem"><l>1</l><block var="data"/></block></block><block s="doRun"><block var="action"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></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"><header></header><code></code><translations></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></block></script></block-definition><block-definition s="word $arrowRight list %&apos;word&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%txt"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportTextSplit"><block var="word"/><l><option>letter</option></l></block></block></script></block></script></block-definition><block-definition s="ignore %&apos;x&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs></block-definition><block-definition s="tell %&apos;sprite&apos; to %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s">Sprite</input><input type="%cs"></input></inputs><script><block s="doRun"><block s="reportAttributeOf"><block var="action"/><block var="sprite"/></block><list></list></block></script></block-definition><block-definition s="ask %&apos;sprite&apos; for %&apos;expression&apos;" type="reporter" category="control"><header></header><code></code><translations></translations><inputs><input type="%s">Sprite</input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportAttributeOf"><block var="expression"/><block var="sprite"/></block><list></list></block></block></script></block-definition><block-definition s="list $arrowRight word %&apos;list&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportJoinWords"><block var="list"/></block></block></script></block></script></block-definition><block-definition s="%&apos;n&apos; !" type="reporter" category="operators"><comment x="0" y="0" w="90" collapsed="false">This could equally well be called FACTORIAL (n)</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doIfElse"><block s="reportEquals"><block var="n"/><l>1</l></block><script><block s="doReport"><l>1</l></block></script><script><block s="doReport"><block s="reportProduct"><block var="n"/><custom-block s="%s !"><block s="reportDifference"><block var="n"/><l>1</l></block></custom-block></block></block></script></block></script></block-definition><block-definition s="letter count %&apos;sentence&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportListIsEmpty"><block var="sentence"/></block><script><block s="doReport"><l>0</l></block></script><script><block s="doReport"><block s="reportSum"><block s="reportStringSize"><block s="reportListItem"><l>1</l><block var="sentence"/></block></block><custom-block s="letter count %l"><block s="reportCDR"><block var="sentence"/></block></custom-block></block></block></script><comment w="171.33333333333334" collapsed="true">EMPTY? is in the Tools library.</comment></block></script><scripts><comment x="14" y="454.2" w="553" collapsed="false">Design:&#xD;&#xD;if n is empty?(sentence) then&#xD;     report zero&#xD;else&#xD;     report ( (length of (item 1 of (sentence))) + (recursive (all but first of (sentence))) )</comment></scripts></block-definition><block-definition s="my join words %&apos;sentence&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportEquals"><block s="reportListLength"><block var="sentence"/></block><l>1</l><comment w="239.33333333333334" collapsed="false">Here we need the singleton-list base case because an n-word sentence has onlty n-1 spaces.</comment></block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="sentence"/></block></block></script><script><block s="doReport"><block s="reportJoinWords"><list><block s="reportListItem"><l>1</l><block var="sentence"/></block><l> </l><custom-block s="my join words %l"><block s="reportCDR"><block var="sentence"/></block></custom-block></list><comment w="414" collapsed="true">The second input to JOIN is a space, indicated in text input boxes by a brown dot.</comment></block></block></script></block></script><scripts><comment x="23" y="413.2" w="493" collapsed="false">Design:&#xD;&#xD;if length of(sentence) = 1  then&#xD;     report item 1 of (sentence)&#xD;else&#xD;     report ( join (item 1 of (sentence) )  ( &quot;) (recursive (all but first of (sentence))) )</comment></scripts></block-definition><block-definition s="plurals %&apos;words&apos;" type="reporter" category="variables"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportListIsEmpty"><block var="words"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script><script><block s="doReport"><block s="reportCONS"><block s="reportJoinWords"><list><block s="reportListItem"><l>1</l><block var="words"/></block><l>s</l></list></block><custom-block s="plurals %l"><block s="reportCDR"><block var="words"/></block></custom-block></block></block></script></block></script></block-definition></blocks><variables></variables></project><media name="U8L1p3 Writing Recursive Reporters" app="Snap! 5.4, http://snap.berkeley.edu" version="1"></media></snapdata>