kopia lustrzana https://github.com/backface/turtlestitch
1 wiersz
17 KiB
XML
1 wiersz
17 KiB
XML
<blocks app="Snap! 6, https://snap.berkeley.edu" version="1"><block-definition s="$flash reverse %'list'" type="reporter" category="lists"><header></header><code></code><translations>de:$flash umgekehrt _
pt:$flash uma lista inversa de _
ca:$flash capgira _
</translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>list</l></list><l>return new List(list.asArray().slice().reverse());</l></block><list><block var="list"/></list></block></block></script></block-definition><block-definition s="$flash analyze %'data'" type="reporter" category="lists"><comment x="0" y="0" w="149" collapsed="false">returns a frequency analysis of the argument list, represented as a two-column table, where the first column contains the unique values and the second column their occurrences</comment><header></header><code></code><translations>pt:$flash as frequências dos itens de _
</translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>list</l></list><l>var dict = new Map(),
 result = [],
 data = list.asArray(),
 len = data.length,
 i;
for (i = 0; i < len; i += 1) {
 if (dict.has(data[i])) {
 dict.set(data[i], dict.get(data[i]) + 1);
 } else {
 dict.set(data[i], 1);
 }
}
dict.forEach(function (value, key) {
 result.push(new List([key, value]));
});
return new List(result);</l></block><list><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash group %'data' by %'fn'" type="reporter" category="lists"><header></header><code></code><translations>pt:o agrupamento dos itens de _ de acordo com _
</translations><inputs><input type="%l"></input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>data</l><l>fn</l><l>proc</l></list><l>return proc.reportAtomicGroup(data, fn);</l></block><list><block var="data"/><block var="fn"/></list></block></block></script></block-definition><block-definition s="$flash sort %'data' by %'fn'" type="reporter" category="lists"><header></header><code></code><translations>pt:uma ordenação de _ com critério _
</translations><inputs><input type="%l"></input><input type="%predRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>data</l><l>fn</l><l>proc</l></list><l>return proc.reportAtomicSort(data, fn);</l></block><list><block var="data"/><block var="fn"/></list></block></block></script></block-definition><block-definition s="histogram of %'data' from: %'floor' to: %'ceiling' interval: %'interval'" type="reporter" category="lists"><header></header><code></code><translations>pt:o histograma de _ entre _ e _ com intervalo _
</translations><inputs><input type="%l"></input><input type="%n"></input><input type="%n"></input><input type="%n">1</input></inputs><script><block s="doReport"><custom-block s="fill %l key: %repRing from: %n to: %n interval: %repRing with: %repRing"><custom-block s="$flash sort %l by %predRing"><custom-block s="$flash analyze %l"><block var="data"/></custom-block><block s="reifyPredicate"><autolambda><block s="reportLessThan"><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>1</l><l/></block></block></autolambda><list></list></block></custom-block><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><block var="floor"/><block var="ceiling"/><block s="reifyReporter"><autolambda><block s="reportSum"><l></l><block var="interval"/></block></autolambda><list></list></block><block s="reifyReporter"><autolambda><block s="reportNewList"><list><l></l><l>0</l></list></block></autolambda><list></list></block></custom-block></block></script></block-definition><block-definition s="histogram of %'data' grouped by: %'key' from: %'floor' to: %'ceiling' interval: %'interval'" type="reporter" category="lists"><header></header><code></code><translations>pt:o histograma de _ agrupado de acordo com _ entre _ e _ com passo _
</translations><inputs><input type="%l"></input><input type="%repRing"></input><input type="%n"></input><input type="%n"></input><input type="%repRing"></input></inputs><script><block s="doReport"><custom-block s="fill %l key: %repRing from: %n to: %n interval: %repRing with: %repRing"><custom-block s="$flash sort %l by %predRing"><custom-block s="$flash group %l by %repRing"><block var="data"/><block var="key"/></custom-block><block s="reifyPredicate"><autolambda><block s="reportLessThan"><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>1</l><l/></block></block></autolambda><list></list></block></custom-block><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><block var="floor"/><block var="ceiling"/><block var="interval"/><block s="reifyReporter"><autolambda><block s="reportNewList"><list><l></l><l>0</l><block s="reportNewList"><list></list></block></list></block></autolambda><list></list></block></custom-block></block></script></block-definition><block-definition s="fill %'data' key: %'key' from: %'floor' to: %'ceiling' interval: %'interval' with: %'generator'" type="reporter" category="lists"><comment x="0" y="0" w="103" collapsed="false">add missing entries to a sorted list. Used for histograms</comment><header></header><code></code><translations>pt:os itens de _ com a chave _ entre _ e _ com passo _ completados por _
</translations><inputs><input type="%l"></input><input type="%repRing"></input><input type="%n"></input><input type="%n"></input><input type="%repRing"></input><input type="%repRing"></input></inputs><script><block s="doIf"><block s="reportGreaterThan"><block var="floor"/><block var="ceiling"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIf"><block s="reportEquals"><block var="data"/><block s="reportNewList"><list></list></block></block><script><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="generator"/><list><block var="floor"/></list></block><custom-block s="fill %l key: %repRing from: %n to: %n interval: %repRing with: %repRing"><block var="data"/><block var="key"/><block s="evaluate"><block var="interval"/><list><block var="floor"/></list></block><block var="ceiling"/><block var="interval"/><block var="generator"/></custom-block></block></block></script></block><block s="doIf"><block s="reportLessThan"><block s="evaluate"><block var="key"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block var="floor"/></block><script><block s="doReport"><custom-block s="fill %l key: %repRing from: %n to: %n interval: %repRing with: %repRing"><block s="reportCDR"><block var="data"/></block><block var="key"/><block var="floor"/><block var="ceiling"/><block var="interval"/><block var="generator"/></custom-block></block></script></block><block s="doIf"><block s="reportEquals"><block s="evaluate"><block var="key"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block var="floor"/></block><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="fill %l key: %repRing from: %n to: %n interval: %repRing with: %repRing"><block s="reportCDR"><block var="data"/></block><block var="key"/><block s="evaluate"><block var="interval"/><list><block var="floor"/></list></block><block var="ceiling"/><block var="interval"/><block var="generator"/></custom-block></block></block></script></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="generator"/><list><block var="floor"/></list></block><custom-block s="fill %l key: %repRing from: %n to: %n interval: %repRing with: %repRing"><block var="data"/><block var="key"/><block s="evaluate"><block var="interval"/><list><block var="floor"/></list></block><block var="ceiling"/><block var="interval"/><block var="generator"/></custom-block></block></block></script></block-definition><block-definition s="pipe %'value' $arrowRight %'pipe'" type="reporter" category="control"><header></header><code></code><translations>pt:a aplicação a _ de _
</translations><inputs><input type="%s"></input><input type="%mult%repRing"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="pipe"/></block><script><block s="doReport"><block var="value"/></block></script></block><block s="doReport"><custom-block s="pipe %s $arrowRight %mult%repRing"><block s="evaluate"><block s="reportListItem"><l>1</l><block var="pipe"/></block><list><block var="value"/></list></block><block s="reportCDR"><block var="pipe"/></block></custom-block></block></script></block-definition><block-definition s="%'text' $arrowRight lower case" type="reporter" category="operators"><header></header><code></code><translations>pt:_ em minúsculas
</translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>txt</l></list><l>return txt.toLowerCase()</l></block><list><block var="text"/></list></block></block></script></block-definition><block-definition s="plot %'data' %'style' at x: %'left' y: %'bottom' width: %'width' height: %'height'" type="command" category="pen"><header></header><code></code><translations>pt:desenha gráfico de barras de _ em (x: _ , y: _ ) com largura _ e altura _
</translations><inputs><input type="%l"></input><input type="%s" readonly="true">bars<options>bars
lines
pie chart</options></input><input type="%n">-200</input><input type="%n">-100</input><input type="%n">400</input><input type="%n">200</input></inputs><script><block s="doIfElse"><block s="reportEquals"><block var="style"/><l>pie chart</l></block><script><block s="doDeclareVariables"><list><l>x</l><l>y</l><l>r</l><l>total</l><l>start</l><l>end</l><l>state</l><l>pen size</l><l>heading</l></list></block><block s="doSetVar"><l>x</l><block s="reportSum"><block var="left"/><block s="reportQuotient"><block var="width"/><l>2</l></block></block></block><block s="doSetVar"><l>y</l><block s="reportSum"><block var="bottom"/><block s="reportQuotient"><block var="height"/><l>2</l></block></block></block><block s="doSetVar"><l>r</l><block s="reportIfElse"><block s="reportLessThan"><block var="height"/><block var="width"/></block><block s="reportQuotient"><block var="height"/><l>2</l></block><block s="reportQuotient"><block var="width"/><l>2</l></block></block></block><block s="doSetVar"><l>total</l><block s="reportCombine"><block var="data"/><block s="reifyReporter"><autolambda><block s="reportSum"><l></l><l></l></block></autolambda><list></list></block></block></block><block s="doSetVar"><l>state</l><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportNewList"><list><l></l><block s="getPenAttribute"><l></l></block></list></block></autolambda><list></list></block><block s="reportNewList"><list><l>hue</l><l>saturation</l><l>brightness</l></list></block></block></block><block s="doSetVar"><l>pen size</l><block s="getPenAttribute"><l><option>size</option></l></block></block><block s="doSetVar"><l>heading</l><block s="direction"></block></block><block s="setPenHSVA"><l><option>hue</option></l><l>0</l></block><block s="setPenHSVA"><l><option>brightness</option></l><l>80</l></block><block s="setPenHSVA"><l><option>saturation</option></l><l>80</l></block><block s="doWarp"><script><block s="doForEach"><l>slice</l><block var="data"/><script><block s="doChangeVar"><l>end</l><block s="reportProduct"><block s="reportQuotient"><block var="slice"/><block var="total"/></block><l>360</l></block></block><block s="gotoXY"><block var="x"/><block var="y"/></block><block s="down"></block><block s="doFor"><l>i</l><block var="start"/><block var="end"/><script><block s="gotoXY"><block s="reportSum"><block var="x"/><block s="reportProduct"><block var="r"/><block s="reportMonadic"><l><option>sin</option></l><block var="i"/></block></block></block><block s="reportSum"><block var="y"/><block s="reportProduct"><block var="r"/><block s="reportMonadic"><l><option>cos</option></l><block var="i"/></block></block></block></block></script></block><block s="gotoXY"><block var="x"/><block var="y"/></block><block s="up"></block><block s="setHeading"><block var="start"/></block><block s="turn"><block s="reportQuotient"><block s="reportDifference"><block var="end"/><block var="start"/></block><l>2</l></block></block><block s="forward"><block s="reportQuotient"><block var="r"/><l>2</l></block></block><block s="floodFill"></block><block s="changePenHSVA"><l><option>hue</option></l><block s="reportQuotient"><l>100</l><block s="reportListLength"><block var="data"/></block></block></block><block s="doSetVar"><l>start</l><block var="end"/></block></script></block><block s="doForEach"><l>setting</l><block var="state"/><script><block s="setPenHSVA"><block s="reportListItem"><l>1</l><block var="setting"/></block><block s="reportListItem"><l>2</l><block var="setting"/></block></block></script></block></script></block><block s="setSize"><block var="pen size"/></block><block s="setHeading"><block var="heading"/></block></script><script><block s="doDeclareVariables"><list><l>ratio</l><l>step</l><l>flat line ends</l><l>col</l><l>sorted</l><l>min</l></list></block><block s="doSetVar"><l>sorted</l><custom-block s="$flash sort %l by %predRing"><block var="data"/><block s="reifyPredicate"><autolambda><block s="reportGreaterThan"><l></l><l></l></block></autolambda><list></list></block></custom-block></block><block s="doIfElse"><block s="reportLessThan"><block s="reportListItem"><l><option>last</option></l><block var="sorted"/></block><l>0</l></block><script><block s="doSetVar"><l>min</l><block s="reportListItem"><l><option>last</option></l><block var="sorted"/></block></block></script><script><block s="doSetVar"><l>min</l><l>0</l></block></script></block><block s="doSetVar"><l>ratio</l><block s="reportQuotient"><block var="height"/><block s="reportDifference"><block s="reportListItem"><l>1</l><block var="sorted"/></block><block var="min"/></block></block></block><block s="doSetVar"><l>step</l><block s="reportQuotient"><block var="width"/><block s="reportListLength"><block var="data"/></block></block></block><block s="doIfElse"><block s="reportGreaterThan"><block var="step"/><l>2</l></block><script><block s="doSetVar"><l>col</l><block s="reportDifference"><block var="step"/><l>1</l></block></block></script><script><block s="doSetVar"><l>col</l><block s="reportProduct"><block var="step"/><l>0.8</l></block></block></script></block><block s="gotoXY"><block var="left"/><block var="bottom"/></block><block s="doIfElse"><block s="reportEquals"><block var="style"/><l>lines</l></block><script><block s="changeXPosition"><block s="reportQuotient"><block var="step"/><l>-2</l></block></block><block s="doWarp"><script><block s="doUntil"><block s="reportEquals"><block s="reportListLength"><block var="data"/></block><l>0</l></block><script><block s="gotoXY"><block s="reportSum"><block s="xPosition"></block><block var="step"/></block><block s="reportSum"><block var="bottom"/><block s="reportProduct"><block s="reportDifference"><block s="reportListItem"><l>1</l><block var="data"/></block><block var="min"/></block><block var="ratio"/></block></block></block><block s="down"></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></block></script></block></script><script><block s="doSetVar"><l>flat line ends</l><block s="reportGlobalFlag"><l><option>flat line ends</option></l></block></block><block s="doSetGlobalFlag"><l><option>flat line ends</option></l><l><bool>true</bool></l></block><block s="setSize"><l>0.5</l></block><block s="down"></block><block s="changeXPosition"><block s="reportQuotient"><block var="step"/><l>2</l></block></block><block s="doWarp"><script><block s="doUntil"><block s="reportEquals"><block s="reportListLength"><block var="data"/></block><l>0</l></block><script><block s="setSize"><block var="col"/></block><block s="changeYPosition"><block s="reportProduct"><block s="reportDifference"><block s="reportListItem"><l>1</l><block var="data"/></block><block var="min"/></block><block var="ratio"/></block></block><block s="setYPosition"><block var="bottom"/></block><block s="setSize"><l>0.5</l></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block><block s="doIfElse"><block s="reportGreaterThan"><block s="reportListLength"><block var="data"/></block><l>0</l></block><script><block s="changeXPosition"><block var="step"/></block></script><script><block s="changeXPosition"><block s="reportQuotient"><block var="step"/><l>2</l></block></block></script></block></script></block></script></block><block s="doSetGlobalFlag"><l><option>flat line ends</option></l><block var="flat line ends"/></block></script></block><block s="up"></block></script></block></script></block-definition></blocks> |