turtlestitch/libraries/word-sentence.xml

1 wiersz
21 KiB
XML
Czysty Zwykły widok Historia

2022-01-05 17:09:51 +00:00
<blocks app="Snap! 7, https://snap.berkeley.edu" version="2"><block-definition s="all but first letter of %&apos;string&apos;" type="reporter" category="operators"><comment w="199" collapsed="false">Takes a text string as input, and reports a new text string containing all but the first character of the input.</comment><header></header><code></code><translations>pt:_ sem o primeiro caractere&#xD;ca:_ sense la primera lletra&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="string"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="all but first letter of %txt"><l></l></custom-block></autolambda><list></list></block><block var="string"/></block></block></script></block><block s="doReport"><block s="reportJoinWords"><block s="reportCDR"><block s="reportTextSplit"><custom-block s="require nonempty %s %s"><block var="string"/><l>All but first of empty word.</l></custom-block><l><option>letter</option></l></block></block></block></block></script></block-definition><block-definition s="all but first word of %&apos;sentence&apos;" type="reporter" category="operators"><comment w="223.000001" collapsed="false">Takes a text string as input, divides it into words treating one or more spaces as a word separator (only spaces count; punctuation is part of the word) and reports a text string containing all but the first word, with one space between words and no spaces at the beginning or end. (Note: consider using SENTENCE➞LIST and processing the resulting list instead of doing recursion on sentences in text string form. List operations are faster.)</comment><header></header><code></code><translations>pt:_ sem a primeira palavra&#xD;ca:_ sense la primera paraula&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="sentence"/><l><option>list</option></l></block><script><block s="doIfElse"><block s="reportListIsEmpty"><block var="sentence"/></block><script><custom-block s="error %txt"><l>All but first of empty sentence.</l></custom-block></script><script><block s="doReport"><block s="reportCDR"><block var="sentence"/></block></block></script></block></script></block><block s="doReport"><custom-block s="list $arrowRight sentence %l"><block s="reportCDR"><custom-block s="require nonempty %s %s"><custom-block s="sentence $arrowRight list %txt"><block var="sentence"/></custom-block><l>All but first of empty sentence.</l></custom-block></block></custom-block></block></script></block-definition><block-definition s="all but last letter of %&apos;string&apos;" type="reporter" category="operators"><comment w="218" collapsed="false">Takes a text string as input, and reports a new text string containing all but the last letter of the input.</comment><header></header><code></code><translations>pt:_ sem o último caractere&#xD;ca:_ sense la darrera lletra&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="string"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="all but last letter of %txt"><l></l></custom-block></autolambda><list></list></block><block var="string"/></block></block></script></block><block s="doReport"><block s="reportJoinWords"><block s="reportListAttribute"><l><option>reverse</option></l><block s="reportCDR"><block s="reportListAttribute"><l><option>reverse</option></l><block s="reportTextSplit"><custom-block s="require nonempty %s %s"><block var="string"/><l>All but first of empty word.</l></custom-block><l><option>letter</option></l></block></block></block></block></block></block></script></block-definition><block-definition s="all but last word of %&apos;sentence&apos;" type="reporter" category="operators"><comment w="211.99999999999997" collapsed="false">Takes a text string as input, divides it into words treating one or more spaces as a word sepa