kopia lustrzana https://github.com/backface/turtlestitch
1 wiersz
86 KiB
XML
1 wiersz
86 KiB
XML
<blocks app="Snap! 7dev, https://snap.berkeley.edu" version="2"><block-definition s="reshape as %'shape' $⍴-1-255-255-0 items of %'data'" type="reporter" category="lists"><comment x="0" y="0" w="180" collapsed="false">The first input is a shape list as in
SHAPE OF. The output is an array with those dimensions containing the atomic items of the second input,
repeating values if more are needed.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="reportReshape"><block var="data"/><block var="shape"/></block></block></script></block-definition><block-definition s="shape of $⍴-1-255-255-0 %'data'" type="reporter" category="lists"><comment x="0" y="0" w="310" collapsed="false">Reports a flat list of the maximum size of the input array along
each dimension: number of rows, number of columns, etc.
"Maximum" because it works even if the array isn't uniformly shaped.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListAttribute"><l><option>dimensions</option></l><block var="data"/></block></block></script></block-definition><block-definition s="max %'a' $⌈-1-255-255-0 %'b'" type="reporter" category="operators"><comment x="0" y="0" w="150.66666666666666" collapsed="false">Reports the greater of its two inputs. Works on strings too.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportMax"><block var="a"/><block var="b"/></block></block></script></block-definition><block-definition s="flatten (ravel) $,-1-255-255-0 %'data'" type="reporter" category="lists"><comment x="0" y="0" w="216" collapsed="false">Reports a flat list of all the atomic elements 
of sublists of the input list.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListAttribute"><l><option>flatten</option></l><block var="data"/></block></block></script></block-definition><block-definition s="rank of $⍴⍴-1-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="240" collapsed="true">Reports the number of dimensions of the input.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListAttribute"><l><option>rank</option></l><block var="array"/></block></block></script></block-definition><block-definition s="inner product helper with %'plus' . %'times' %'a' $nl transposed %'tb'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%repRing"></input><input type="%l"></input><input type="%l"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="a"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIf"><block s="reportNot"><block s="reportIsA"><block s="reportListItem"><l>1</l><block s="reportListItem"><l>1</l><block var="a"/></block></block><l><option>list</option></l></block></block><script><block s="doReport"><block s="reportCONS"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="generalized dotproduct %l %l with sum %repRing product %repRing"><block s="reportListItem"><l>1</l><block var="a"/></block><l/><block var="plus"/><block var="times"/></custom-block></autolambda><list></list></block><block var="tb"/></block><custom-block s="inner product helper with %repRing . %repRing %l %br transposed %l"><block var="plus"/><block var="times"/><block s="reportCDR"><block var="a"/></block><block var="tb"/></custom-block></block></block></script></block><block s="doReport"><block s="reportCONS"><custom-block s="inner product helper with %repRing . %repRing %l %br transposed %l"><block var="plus"/><block var="times"/><block s="reportListItem"><l>1</l><block var="a"/></block><block var="tb"/></custom-block><custom-block s="inner product helper with %repRing . %repRing %l %br transposed %l"><block var="plus"/><block var="times"/><block s="reportCDR"><block var="a"/></block><block var="tb"/></custom-block></block></block></script></block-definition><block-definition s="transpose $⍉-1.5-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="168" collapsed="false">Takes a multidimensional array, and
reports an array whose dimensions
are reversed (as reported by
SHAPE OF). In the case of a
two-dimensional array, does the usual transposition of rows and columns.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportApplyExtension"><l>dta_transpose(list)</l><list><block var="array"/></list></block></block></script></block-definition><block-definition s="reverse row order (column contents) $⦵-1.5-255-255-0 %'list'" type="reporter" category="lists"><comment x="0" y="0" w="286" collapsed="false">Reverses the order of the (toplevel) items of the input.

If the input is a matrix, this means it reverses the order of the rows, which is a reflection through a horizontal axis, as the ⦵ symbol suggests.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListAttribute"><l><option>reverse</option></l><block var="list"/></block></block></script></block-definition><block-definition s="multimap %'function' %'data'" type="reporter" category="other" helper="true"><comment w="215.33333333333334" collapsed="false">Like MAP, but can take any number of lists
as inputs. The lists must all be the same size.
The function input must take a number of inputs
equal to the number of lists. MULTIMAP calls
the function with all the first items, then all the
second items, and so on.</comment><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>lengths</l><l>cols</l></list></block><block s="doSetVar"><l>lengths</l><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportListAttribute"><l><option>length</option></l><l/></block></autolambda><list></list></block><block var="data"/></block></block><block s="doFor"><l>i</l><l>2</l><block s="reportListAttribute"><l><option>length</option></l><block var="lengths"/></block><script><block s="doIf"><block s="reportNot"><block s="reportEquals"><block s="reportListItem"><l>1</l><block var="lengths"/></block><block s="reportListItem"><block var="i"/><block var="lengths"/></block></block></block><script><custom-block s="error %txt"><l>Non-conforming shapes.</l></custom-block></script></block></script></block><block s="doSetVar"><l>cols</l><block s="reportListAttribute"><l><option>columns</option></l><block var="data"/></block></block><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><block var="cols"/></block></block></script></block></script></block-definition><block-definition s="generalized dotproduct %'a' %'b' with sum %'sum' product %'product'" type="reporter" category="other"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%l"></input><input type="%repRing"></input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="reportCombine"><custom-block s="multimap %repRing %mult%l"><block var="product"/><list><block var="a"/><block var="b"/></list></custom-block><block var="sum"/></block></block></script></block-definition><block-definition s="inner product %'a' %'plus' $.-1-255-255-0 %'times' %'b'" type="reporter" category="lists"><comment x="0" y="0" w="252.66666666666666" collapsed="false">Computes a generalized matrix multiplication.

In normal matrix multiplication, each cell of the result
is computed by multiplying individual numbers within
a row of the left input and a column of the right input,
and then adding those products. In APL terms this is
+.× ("plus dot times")
Any dyadic functions can replace addition and multiplication in this algorithm; a common case is
∨.∧ ("or dot and")</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%repRing"></input><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="a"/><l><option>list</option></l></block></block><script><block s="doSetVar"><l>a</l><block s="reportNewList"><list><block var="a"/></list></block></block></script></block><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="b"/><l><option>list</option></l></block></block><script><block s="doSetVar"><l>b</l><block s="reportNewList"><list><block var="b"/></list></block></block></script></block><block s="doIf"><block s="reportAnd"><block s="reportEquals"><block s="reportListItem"><l><option>last</option></l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="a"/></custom-block></block><l>1</l></block><block s="reportGreaterThan"><block s="reportListItem"><l>1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="b"/></custom-block></block><l>1</l></block></block><script><block s="doDeclareVariables"><list><l>ta</l></list></block><block s="doSetVar"><l>ta</l><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block var="a"/></custom-block></block><block s="doSetVar"><l>a</l><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block var="ta"/></autolambda><list></list></block><block s="reportNumbers"><l>1</l><block s="reportListItem"><l>1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="b"/></custom-block></block></block></block></custom-block></block></script></block><block s="doIf"><block s="reportAnd"><block s="reportGreaterThan"><block s="reportListItem"><l><option>last</option></l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="a"/></custom-block></block><l>1</l></block><block s="reportEquals"><block s="reportListItem"><l>1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="b"/></custom-block></block><l>1</l></block></block><script><block s="doSetVar"><l>b</l><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block var="b"/></autolambda><list></list></block><block s="reportNumbers"><l>1</l><block s="reportListItem"><l><option>last</option></l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="a"/></custom-block></block></block></block></block></script></block><block s="doReport"><custom-block s="inner product helper with %repRing . %repRing %l %br transposed %l"><block var="plus"/><block var="times"/><block var="a"/><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block var="b"/></custom-block></custom-block></block></script></block-definition><block-definition s="min %'a' $⌊-1.2-255-255-0 %'b'" type="reporter" category="operators"><comment x="0" y="0" w="211.33333333333334" collapsed="true">Reports the smaller of its two inputs.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportMin"><block var="a"/><block var="b"/></block></block></script></block-definition><block-definition s="combine in rows (reduce by column vectors) %'func' $/-1-255-255-0 %'stuff'" type="reporter" category="lists"><comment x="0" y="0" w="288.6666666666667" collapsed="false">This function has two names because there are two ways
to understand it.

Lisp way: A matrix is a list of rows. This block combines the numbers in each row, producing one value for the entire row.

APL way: A matrix is made of vectors. This block takes each column as a vector, and does vector arithmetic on the columns, producing one column as the result.</comment><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportGreaterThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="stuff"/></custom-block><l>1</l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="combine in rows (reduce by column vectors) %repRing $/-1-255-255-0 %l"><block var="func"/><l/></custom-block></autolambda><list></list></block><block var="stuff"/></block></block></script><script><block s="doReport"><block s="reportCombine"><block var="stuff"/><block var="func"/></block></block></script></block></script></block-definition><block-definition s="%'howmany' deal helper %'data'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><block s="reportEquals"><block var="howmany"/><l>0</l></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doDeclareVariables"><list><l>choices</l><l>index</l></list></block><block s="doSetVar"><l>choices</l><block s="reportNewList"><list></list></block></block><block s="doRepeat"><block var="howmany"/><script><block s="doSetVar"><l>index</l><block s="reportRandom"><l>1</l><block s="reportListAttribute"><l><option>length</option></l><block var="data"/></block></block></block><block s="doAddToList"><block s="reportListItem"><block var="index"/><block var="data"/></block><block var="choices"/></block><block s="doDeleteFromList"><block var="index"/><block var="data"/></block></script></block><block s="doReport"><block var="choices"/></block></script></block></script></block-definition><block-definition s="signum $×-1-255-255-0 %'num'" type="reporter" category="operators"><comment x="0" y="0" w="159.99999999999997" collapsed="false">Reports 1 if the input is positive,
0 if the input is zero,
or -1 if the input is negative.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="num"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="signum $×-1-255-255-0 %n"><l></l></custom-block></autolambda><list></list></block><block var="num"/></block></block></script></block><block s="doIf"><block s="reportListContainsItem"><block s="reportNewList"><list><l>0</l><block s="reportBoolean"><l><bool>false</bool></l></block></list></block><block var="num"/></block><script><block s="doReport"><l>0</l></block></script></block><block s="doReport"><block s="reportQuotient"><block var="num"/><block s="reportMonadic"><l><option>abs</option></l><block var="num"/></block></block></block></script></block-definition><block-definition s="reciprocal $÷-1-255-255-0 %'num'" type="reporter" category="operators"><comment x="0" y="0" w="102.66666666666667" collapsed="false">reports 1 divided
by its input.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportQuotient"><l>1</l><block var="num"/></block></block></script></block-definition><block-definition s="roll $?-1-255-255-0 %'num'" type="reporter" category="operators"><comment x="0" y="0" w="180.66666666666666" collapsed="false">This block reports a random integer between 1 and its input. To roll more than one die, use (for three dice)
roll (reshape as 3 items of 6)
APL: ?3⍴6
Don't use reshape as 3 items of (roll 6), because that would roll one die and report 3 copies of the same random roll. </comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportRandom"><l>1</l><block var="num"/></block></block></script></block-definition><block-definition s="scalar? %'x'" type="predicate" category="other" helper="true"><comment w="199.33333333333334" collapsed="false">Reports True if the input is an APL scalar,
i.e., either an atomic (non-list) value, or
an array (list of lists) of any depth with only
one atomic item, e.g., (list (list (list (3)))).</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="x"/><l><option>list</option></l></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block><block s="doReport"><block s="reportEquals"><block s="reportAtomicCombine"><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="x"/></custom-block><block s="reifyReporter"><autolambda><block s="reportProduct"><l></l><l></l></block></autolambda><list></list></block></block><l>1</l></block></block></script></block-definition><block-definition s="scalar-value helper %'x'" type="reporter" category="other" helper="true"><comment w="200.66666666666666" collapsed="false">The input must be a value for which SCALAR? reports true, i.e., either an atom or a list of any depth but only one scalar item of item of... etc. This function returns the underlying scalar (number, etc.).</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="x"/><l><option>list</option></l></block></block><script><block s="doReport"><block var="x"/></block></script></block><block s="doReport"><custom-block s="scalar-value helper %s"><block s="reportListItem"><l>1</l><block var="x"/></block></custom-block></block></script></block-definition><block-definition s="NAND %'a' $⍲-1.4-255-255-0 %'b'" type="predicate" category="operators"><comment x="0" y="0" w="198.66666666666666" collapsed="false">Reports the not-and of its inputs, in the form
0 for false, 1 for true.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><custom-block s="NOT $~-1-255-255-0 %s"><custom-block s="LCM (and) %n $∧-1.2-255-255-0 %n"><block var="a"/><block var="b"/></custom-block></custom-block></block></script></block-definition><block-definition s="NOR %'a' $⍱-1.4-255-255-0 %'b'" type="predicate" category="operators"><comment x="0" y="0" w="198.66666666666666" collapsed="false">Reports the not-and of its inputs, in the form
0 for false, 1 for true.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><custom-block s="NOT $~-1-255-255-0 %s"><custom-block s="GCD (or) %n $∨-1.2-255-255-0 %n"><block var="a"/><block var="b"/></custom-block></custom-block></block></script></block-definition><block-definition s="%'a' ≤ %'b'" type="predicate" category="operators"><comment x="0" y="0" w="151.33333333333334" collapsed="true">Reports True if the left input is
less than or equal to the right input.

Reports a Snap! Boolean, not an integer 0 or 1.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportLessThanOrEquals"><block var="a"/><block var="b"/></block><comment w="176.66666666666666" collapsed="true">This is the primitive version.</comment></block></script></block-definition><block-definition s="%'a' ≥ %'b'" type="predicate" category="operators"><comment x="0" y="0" w="152.66666666666666" collapsed="false">Reports True if the left input is
greater than than or equal to
the right input.

Reports a Snap! Boolean, not an integer 0 or 1.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportGreaterThanOrEquals"><block var="a"/><block var="b"/></block></block></script></block-definition><block-definition s="XOR %'a' $≠-1-255-255-0 %'b'" type="predicate" category="operators"><comment x="0" y="0" w="190" collapsed="false">Reports False if its inputs are equal;
reports True if its inputs are not equal.
The inputs can have any non-list values.
(Lists are hyperized.) If the inputs are
Booleans (True/False or 1/0), this is
also the exclusive-or function.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><custom-block s="%s scalar %s %s"><block var="a"/><l>≠</l><block var="b"/></custom-block></block></script></block-definition><block-definition s="zero? %'n'" type="predicate" category="other" helper="true"><comment w="202.66666666666666" collapsed="true">reports True iff the input is 0 or False.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportListContainsItem"><block s="reportNewList"><list><l>0</l><block s="reportBoolean"><l><bool>false</bool></l></block></list></block><block var="n"/></block></block></script></block-definition><block-definition s="truth %'n'" type="predicate" category="other" helper="true"><comment w="198.66666666666666" collapsed="false">Reports a Snap! Boolean False if the input
is False or 0; reports True otherwise.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="n"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="truth %s"><l></l></custom-block></autolambda><list></list></block><block var="n"/></block></block></script></block><block s="doReport"><block s="reportIfElse"><block s="reportIsA"><block var="n"/><l><option>Boolean</option></l></block><block var="n"/><block s="reportNot"><block s="reportEquals"><block var="n"/><l>0</l></block></block></block></block></script></block-definition><block-definition s="make scalar %'value'" type="reporter" category="operators" helper="true"><comment w="242.66666666666666" collapsed="false">Turns list of list of ... a single scalar (e.g., ((((x)))) ) into just the scalar. Error if called with anything else.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIf"><custom-block s="scalar? %s"><block var="value"/></custom-block><script><block s="doReport"><custom-block s="scalar-value helper %s"><block var="value"/></custom-block></block></script></block><custom-block s="error %txt"><block s="reportJoinWords"><list><l>Make scalar called with non-singleton input </l><block var="value"/></list></block></custom-block></script></block-definition><block-definition s="$⍳-1.5-255-255-0 %'n'" type="reporter" category="lists"><comment x="0" y="0" w="290.6666666666667" collapsed="false">If the input is a positive integer, reports a list of the numbers
from 1 to that input. (If the input is 0, reports an empty list.)

If the input is a list of positive integers, reports an array with
the shape specified by the input (as in ⍴ reshape) in which
each item is a list of the indices of that item in the array
(so technically the shape has one more dimension
than the input, whose size is the size of the input).

If the input is a list that includes 0, the result is an array whose shape is the part of the input list before the 0, in which every element is empty. If you'd like some other value in every element, MD-MAP a constant function over the result.

For list inputs, the size of the result grows very quickly, more or less the factorial of the size of the input. Snap! will not attempt to compute a result bigger than a few million atomic items.
⍳(⍳ 9) will work (≈ 3 million atoms) but ⍳(⍳ 10) will give an error.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doIfElse"><block s="reportIsA"><block var="n"/><l><option>list</option></l></block><script><block s="doIfElse"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="n"/></custom-block><l>1</l></block><script><block s="doIfElse"><block s="reportListContainsItem"><block var="n"/><l>0</l></block><script><block s="doReport"><block s="reportReshape"><block s="reportNewList"><list></list></block><block s="reportListItem"><block s="reportNumbers"><l>1</l><block s="reportDifference"><block s="reportListIndex"><l>0</l><block var="n"/></block><l>1</l></block></block><block var="n"/></block></block></block></script><script><block s="doReport"><block s="reportReshape"><custom-block s="crossproduct %mult%l"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block s="reportNumbers"><l>1</l><l></l></block></autolambda><list></list></block><block var="n"/></block></custom-block><block s="reportConcatenatedLists"><list><block var="n"/><block s="reportNewList"><list><block s="reportListAttribute"><l><option>length</option></l><block var="n"/></block></list></block></list></block></block></block></script></block></script><script><custom-block s="error %txt"><l>Input to ⍳ can't be a list of lists.</l></custom-block></script></block></script><script><block s="doReport"><block s="reportIfElse"><custom-block s="zero? %n"><block var="n"/></custom-block><block s="reportNewList"><list></list></block><block s="reportNumbers"><l>1</l><block var="n"/></block></block></block></script></block></script></block-definition><block-definition s="where in %'vector' is $⍳-1.5-255-255-0 %'items'" type="reporter" category="lists"><comment x="0" y="0" w="334.6666666666667" collapsed="false">If the rank of the left input is one more than the rank of the right input,
reports the index of the right input in the left input, or if not found,
reports one more than the length of the left input.

If the rank of the left input is equal to the rank of the right input,
reports a vector of the indices of the items of the right input
in the left input (mapping this function over the right input).

If the rank of the left input is more than that of the right input by 2 or more,
reports a vector, the location of the right input in the left in each dimension.

It is an error if the rank of the left input is less than that of the right input.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%s"></input></inputs><script><block s="doDeclareVariables"><list><l>result</l></list></block><block s="doIf"><block s="reportLessThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="vector"/></custom-block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="items"/></custom-block></block><script><custom-block s="error %txt"><l>Left input to ⍳ must have greater or equal rank to right input.</l></custom-block></script></block><block s="doIf"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="vector"/></custom-block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="items"/></custom-block></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="where in %l is $⍳-1.5-255-255-0 %s"><block var="vector"/><l></l></custom-block></autolambda><list></list></block><block var="items"/></block></block></script></block><block s="doIf"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="vector"/></custom-block><block s="reportSum"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="items"/></custom-block><l>1</l></block></block><script><block s="doSetVar"><l>result</l><block s="reportListIndex"><block var="items"/><block var="vector"/></block></block><block s="doReport"><block s="reportIfElse"><custom-block s="zero? %n"><block var="result"/></custom-block><block s="reportSum"><block s="reportListAttribute"><l><option>length</option></l><block var="vector"/></block><l>1</l></block><block var="result"/></block></block></script></block><block s="doSetVar"><l>result</l><block s="reportFindFirst"><block s="reifyPredicate"><autolambda><custom-block s="%l deep contains %s"><l/><block var="items"/></custom-block></autolambda><list></list></block><block var="vector"/></block></block><block s="doIf"><block s="reportEquals"><block var="result"/><l></l></block><script><block s="doReport"><block s="reportSum"><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="vector"/></custom-block><l>1</l></block></block></script></block><block s="doReport"><block s="reportCONS"><block s="reportListIndex"><block var="result"/><block var="vector"/></block><custom-block s="flatten (ravel) $,-1-255-255-0 %l"><custom-block s="where in %l is $⍳-1.5-255-255-0 %s"><block var="result"/><block var="items"/></custom-block></custom-block></block></block></script></block-definition><block-definition s="crossproduct %'lists'" type="reporter" category="lists"><comment x="0" y="0" w="305.3333333333333" collapsed="false">This isn't an APL function, although it's related to the outer product.

It takes any number of lists, and reports a list of all possible tuples with one item from each of the lists. The length of the result is the product of the lengths of the inputs.

The result gets very big very quickly. Snap! will refuse to do this computation if the result would be more than a few million atomic items. (crossproduct (⍳(⍳9))) makes about 3 million atomic items; (crossproduct (⍳(⍳10))) gives an error message.</comment><header></header><code></code><translations></translations><inputs><input type="%mult%l"></input></inputs><script><block s="doReport"><block s="reportApplyExtension"><l>dta_crossproduct(list)</l><list><block var="lists"/></list></block></block></script></block-definition><block-definition s="%'array' deep contains %'value'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%s"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="array"/><l><option>list</option></l></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block><block s="doIf"><block s="reportListContainsItem"><block var="array"/><block var="value"/></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block><block s="doReport"><custom-block s="combine in rows (reduce by column vectors) %repRing $/-1-255-255-0 %l"><block s="reifyReporter"><autolambda><block s="reportOr"><l/><l/></block></autolambda><list></list></block><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="%l deep contains %s"><l/><block var="value"/></custom-block></autolambda><list></list></block><block var="array"/></block></custom-block></block></script></block-definition><block-definition s="which of %'items' $ϵ-1-255-255-0 contained in %'array'" type="reporter" category="lists"><comment x="0" y="0" w="214.66666666666666" collapsed="false">Reports an array of Booleans the same shape
as the left input, indicating which of the atoms
in the left input appear anywhere in the right
input. 
(The structure of the right input doesn't matter.)</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportIsA"><block var="items"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><custom-block s="which of %s $ϵ-1-255-255-0 contained in %l"><l></l><custom-block s="flatten (ravel) $,-1-255-255-0 %l"><block var="array"/></custom-block></custom-block></autolambda><list></list></block><block var="items"/></block></block></script><script><block s="doReport"><block s="reportListContainsItem"><custom-block s="flatten (ravel) $,-1-255-255-0 %l"><block var="array"/></custom-block><block var="items"/></block></block></script></block></script></block-definition><block-definition s="catenate %'left' $,-1-255-255-0 %'right'" type="reporter" category="lists"><comment x="0" y="0" w="190.66666666666666" collapsed="false">Like append, but:

A scalar input is treated as an array the same shape as the other input except that the last item of the shape is 1.

If the two inputs are of different ranks,
the function is mapped over the larger ranked input.

Catenate adds new columns, by appending to each row.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="left"/><l><option>list</option></l></block></block><script><block s="doIfElse"><block s="reportGreaterThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="right"/></custom-block><l>1</l></block><script><block s="doSetVar"><l>left</l><custom-block s="reshape as %l $⍴-1-255-255-0 items of %l"><block s="reportConcatenatedLists"><list><custom-block s="drop %n $↓-1-255-255-0 from %l"><l>-1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="right"/></custom-block></custom-block><block s="reportNewList"><list><l>1</l></list></block></list></block><block s="reportNewList"><list><block var="left"/></list></block></custom-block></block></script><script><block s="doSetVar"><l>left</l><block s="reportNewList"><list><block var="left"/></list></block></block></script></block></script></block><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="right"/><l><option>list</option></l></block></block><script><block s="doIfElse"><block s="reportGreaterThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><l>1</l></block><script><block s="doSetVar"><l>right</l><custom-block s="reshape as %l $⍴-1-255-255-0 items of %l"><block s="reportConcatenatedLists"><list><custom-block s="drop %n $↓-1-255-255-0 from %l"><l>-1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="left"/></custom-block></custom-block><block s="reportNewList"><list><l>1</l></list></block></list></block><block s="reportNewList"><list><block var="right"/></list></block></custom-block></block></script><script><block s="doSetVar"><l>right</l><block s="reportNewList"><list><block var="right"/></list></block></block></script></block></script></block><block s="doIf"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="right"/></custom-block></block><script><block s="doIfElse"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><l>1</l></block><script><block s="doReport"><block s="reportConcatenatedLists"><list><block var="left"/><block var="right"/></list></block></block></script><script><block s="doReport"><custom-block s="multimap %repRing %mult%l"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><l></l><l></l></custom-block></autolambda><list></list></block><list><block var="left"/><block var="right"/></list></custom-block></block></script></block></script></block><block s="doIfElse"><block s="reportLessThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="right"/></custom-block></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><block var="left"/><l></l></custom-block></autolambda><list></list></block><block var="right"/></block></block></script><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><l></l><block var="right"/></custom-block></autolambda><list></list></block><block var="left"/></block></block></script></block></script></block-definition><block-definition s="scalar value %'value'" type="reporter" category="lists"><comment x="0" y="0" w="221.33333333333334" collapsed="false">If the input is a nesting of length=1 lists, which
APL treats as a scalar (the innermost item)
for many purposes, report that innermost scalar.
Otherwise, report the input as is.

Exposing this block for users is important because Snap! /does not/ treat such a nesting
as a scalar, so you might need to use this in
translating an APL program to Snap!.
(But the functions in the APL library already use
this block as needed.)</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="reportIfElse"><custom-block s="scalar? %s"><block var="value"/></custom-block><custom-block s="scalar-value helper %s"><block var="value"/></custom-block><block var="value"/></block></block></script></block-definition><block-definition s="grade up $⍋-1.5-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="190.66666666666666" collapsed="false">Reports a vector of indices of the items of the input, in order of the values of the items, so that

item (grade up (foo)) of (foo)

reports the items in sorted order, smallest to largest. For a matrix, sorts the rows based on their first items, or if those are equal, based on their second items, etc.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block s="reportListItem"><l><option>last</option></l><l/></block></autolambda><list></list></block><custom-block s="$flash sort %l ordering with %predRing"><custom-block s="multimap %repRing over %mult%l"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><l></l><l></l></custom-block></autolambda><list></list></block><list><block var="array"/><custom-block s="$⍳-1.5-255-255-0 %n"><block s="reportListAttribute"><l><option>length</option></l><block var="array"/></block></custom-block></list></custom-block><block s="reifyPredicate"><autolambda><custom-block s="sort helper %l %l"><l/><l/></custom-block></autolambda><list></list></block></custom-block></block></block></script></block-definition><block-definition s="sort helper %'rowA' %'rowB'" type="reporter" category="other" helper="true"><comment w="166" collapsed="false">Compares two vectors for sorting.
Compare first items; if those are equal compare second items; etc.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%l"></input></inputs><script><block s="doIf"><block s="reportListIsEmpty"><block var="rowA"/></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block><block s="doIf"><block s="reportListIsEmpty"><block var="rowB"/></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block><block s="doIf"><block s="reportLessThan"><block s="reportListItem"><l>1</l><block var="rowA"/></block><block s="reportListItem"><l>1</l><block var="rowB"/></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block><block s="doIf"><block s="reportGreaterThan"><block s="reportListItem"><l>1</l><block var="rowA"/></block><block s="reportListItem"><l>1</l><block var="rowB"/></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block><block s="doReport"><custom-block s="sort helper %l %l"><block s="reportCDR"><block var="rowA"/></block><block s="reportCDR"><block var="rowB"/></block></custom-block></block></script></block-definition><block-definition s="grade down $⍒-1.5-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="190.66666666666666" collapsed="false">Reports a vector of indices of the items of the input, in order of the values of the items, so that

item (grade down (foo)) of (foo)

reports the items in sorted order, largest to smallest. For a matrix, sorts the rows based on their first items, or if those are equal, based on their second items, etc.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block s="reportListItem"><l><option>last</option></l><l/></block></autolambda><list></list></block><custom-block s="$flash sort %l ordering with %predRing"><custom-block s="multimap %repRing over %mult%l"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><l></l><l></l></custom-block></autolambda><list></list></block><list><block var="array"/><custom-block s="$⍳-1.5-255-255-0 %n"><block s="reportListAttribute"><l><option>length</option></l><block var="array"/></block></custom-block></list></custom-block><block s="reifyPredicate"><autolambda><custom-block s="NOT $~-1-255-255-0 %s"><custom-block s="sort helper %l %l"><l/><l/></custom-block></custom-block></autolambda><list></list></block></custom-block></block></block></script></block-definition><block-definition s="select rows (compress columns) %'Booleans' $/-1-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="210.66666666666666" collapsed="false">The left input must be a vector of Booleans
(either Snap! form or APL form); the right input must be an array whose first dimension is equal to the length of the left input. The block reports an array of the same rank as the right input, containing only those items (rows, for a matrix) for which the corresponding Boolean is True (or 1).</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%l"></input></inputs><script><block s="doReport"><custom-block s="rowize vector %l"><block s="reportAtomicKeep"><block s="reifyPredicate"><autolambda><custom-block s="truth %s"><block s="reportListItem"><block var="index"/><block var="Booleans"/></block></custom-block></autolambda><list><l>value</l><l>index</l></list></block><block var="array"/></block></custom-block></block></script></block-definition><block-definition s="rowize vector %'vec'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportIfElse"><block s="reportAnd"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="vec"/></custom-block><l>2</l></block><block s="reportEquals"><block s="reportListItem"><l>2</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="vec"/></custom-block></block><l>1</l></block></block><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><block var="vec"/></block><block var="vec"/></block></block></script></block-definition><block-definition s="select columns (compress rows) %'bool' $⌿-1.5-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="219.33333333333334" collapsed="false">The left input must be a vector of Booleans
(either Snap! form or APL form); the right input must be an array whose last dimension is equal to the length of the left input. The block reports an array of the same rank as the right input, containing only those items (columns, for a matrix) for which the corresponding Boolean is True (or 1).</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%l"></input></inputs><script><block s="doReport"><custom-block s="columnwise %repRing %l"><block s="reifyReporter"><autolambda><custom-block s="select rows (compress columns) %l $/-1-255-255-0 %l"><block var="bool"/><l/></custom-block></autolambda><list></list></block><block var="array"/></custom-block></block></script></block-definition><block-definition s="columnwise %'function' %'data'" type="reporter" category="control" helper="true"><comment w="212" collapsed="false">Turns a row-wise (in Lisp terminology) function
into a column-wise one.</comment><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doReport"><custom-block s="rowize vector %l"><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block s="evaluate"><block var="function"/><list><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block var="data"/></custom-block></list></block></custom-block></custom-block></block></script></block-definition><block-definition s="reverse column order (row contents) $⏀-1-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="206" collapsed="false">Reverses the order of the columns of the input, which is a reflection through a vertical axis, as the ⏀ symbol suggests.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><custom-block s="columnwise %repRing %l"><block s="reifyReporter"><autolambda><custom-block s="reverse row order (column contents) $⦵-1.5-255-255-0 %l"><l/></custom-block></autolambda><list></list></block><block var="array"/></custom-block></block></script></block-definition><block-definition s="combine in columns (reduce by row vectors) %'function' $⌿-1.5-255-255-0 %'array'" type="reporter" category="lists"><comment x="0" y="0" w="285.3333333333333" collapsed="false">This function has two names because there are two ways
to understand it.

Lisp way: A matrix is a list of rows. This block turns it into a list of columns, and combines the numbers in each column, producing one value for the entire column.

APL way: A matrix is made of vectors. This block takes each row as a vector, and does vector arithmetic on the rows, producing one row as the result.</comment><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doReport"><custom-block s="columnwise %repRing %l"><block s="reifyReporter"><autolambda><custom-block s="combine in rows (reduce by column vectors) %repRing $/-1-255-255-0 %l"><block var="function"/><l/></custom-block></autolambda><list></list></block><block var="array"/></custom-block></block></script></block-definition><block-definition s="catenate vertically %'left' $⍪-1.5-255-255-0 %'right'" type="reporter" category="lists"><comment x="0" y="0" w="190.66666666666666" collapsed="false">Like append, but:

A scalar input is treated as a vector
of length 1.

If the two inputs are of different ranks,
the function is mapped over the larger ranked input.

Catenate vertically adds new rows, by appending to each column.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="left"/><l><option>list</option></l></block></block><script><block s="doIfElse"><block s="reportGreaterThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="right"/></custom-block><l>1</l></block><script><block s="doSetVar"><l>left</l><custom-block s="reshape as %l $⍴-1-255-255-0 items of %l"><block s="reportConcatenatedLists"><list><block s="reportNewList"><list><l>1</l></list></block><custom-block s="drop %n $↓-1-255-255-0 from %l"><l>1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="right"/></custom-block></custom-block></list></block><block s="reportNewList"><list><block var="left"/></list></block></custom-block></block></script><script><block s="doSetVar"><l>left</l><block s="reportNewList"><list><block var="left"/></list></block></block></script></block></script></block><block s="doIf"><block s="reportNot"><block s="reportIsA"><block var="right"/><l><option>list</option></l></block></block><script><block s="doIfElse"><block s="reportGreaterThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><l>1</l></block><script><block s="doSetVar"><l>right</l><custom-block s="reshape as %l $⍴-1-255-255-0 items of %l"><block s="reportConcatenatedLists"><list><block s="reportNewList"><list><l>1</l></list></block><custom-block s="drop %n $↓-1-255-255-0 from %l"><l>1</l><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="left"/></custom-block></custom-block></list></block><block s="reportNewList"><list><block var="right"/></list></block></custom-block></block></script><script><block s="doSetVar"><l>right</l><block s="reportNewList"><list><block var="right"/></list></block></block></script></block></script></block><block s="doIf"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="right"/></custom-block></block><script><block s="doIfElse"><block s="reportEquals"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><l>1</l></block><script><block s="doReport"><block s="reportConcatenatedLists"><list><block var="left"/><block var="right"/></list></block></block></script><script><block s="doReport"><custom-block s="transpose $⍉-1.5-255-255-0 %l"><custom-block s="catenate %s $,-1-255-255-0 %s"><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block var="left"/></custom-block><custom-block s="transpose $⍉-1.5-255-255-0 %l"><block var="right"/></custom-block></custom-block></custom-block></block></script></block></script></block><block s="doIfElse"><block s="reportLessThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="left"/></custom-block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="right"/></custom-block></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><block var="left"/><l></l></custom-block></autolambda><list></list></block><block var="right"/></block></block></script><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="catenate %s $,-1-255-255-0 %s"><l></l><block var="right"/></custom-block></autolambda><list></list></block><block var="left"/></block></block></script></block></script><scripts><script x="254" y="497.7777777777774"><custom-block s="multimap %repRing %mult%l"><block s="reifyReporter"><script></script><list></list></block><list><l/><l/></list></custom-block></script></scripts></block-definition><block-definition s="%'a' scalar join %'b'" type="reporter" category="operators"><comment x="0" y="0" w="219.33333333333334" collapsed="false">A hyperblock version of JOIN. The regular JOIN isn't hyperized because it can accept a list as input, representing it as text.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><block s="reportJoinWords"><list><l></l><l></l></list></block></autolambda><list></list></block></custom-block><list><block var="a"/><block var="b"/></list></block></block></script></block-definition><block-definition s="take %'howmany' $↑-1-255-255-0 from %'array'" type="reporter" category="lists"><comment x="0" y="0" w="272" collapsed="false">A positive left input selects the first n items of the right input.
A negative left input selects the last abs(n) items
of the right input.

If the right input is a matrix, a numeric left input selects rows;
the left input may also be a two-item vector, in which case
the first number is applied to the rows
and the second number is applied to the columns.
Similarly for higher-dimension arrays. </comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="howmany"/><l><option>number</option></l></block><script><block s="doReport"><block s="reportIfElse"><block s="reportLessThan"><block var="howmany"/><l>0</l></block><block s="reportListItem"><block s="reportSum"><custom-block s="$⍳-1.5-255-255-0 %n"><block s="reportMonadic"><l><option>abs</option></l><block var="howmany"/></block></custom-block><block s="reportSum"><block s="reportListAttribute"><l><option>length</option></l><block var="array"/></block><block var="howmany"/></block></block><block var="array"/></block><block s="reportListItem"><custom-block s="$⍳-1.5-255-255-0 %n"><block var="howmany"/></custom-block><block var="array"/></block></block></block></script></block><block s="doIf"><block s="reportGreaterThan"><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="howmany"/></custom-block><l>1</l></block><script><custom-block s="error %txt"><l>Left input to take can't be a matrix.</l></custom-block></script></block><block s="doIf"><block s="reportGreaterThan"><block s="reportListAttribute"><l><option>length</option></l><block var="howmany"/></block><custom-block s="rank of $⍴⍴-1-255-255-0 %l"><block var="array"/></custom-block></block><script><custom-block s="error %txt"><l>Length of item vector > rank of array in take.</l></custom-block></script></block><block s="doReport"><block s="reportListItem"><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportIfElse"><block s="reportLessThan"><block var="value"/><l>0</l></block><block s="reportSum"><custom-block s="$⍳-1.5-255-255-0 %n"><block s="reportMonadic"><l><option>abs</option></l><block var="value"/></block></custom-block><block s="reportSum"><block s="reportListItem"><block var="index"/><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="array"/></custom-block></block><block var="value"/></block></block><custom-block s="$⍳-1.5-255-255-0 %n"><block var="value"/></custom-block></block></autolambda><list><l>value</l><l>index</l></list></block><block var="howmany"/></block><block var="array"/></block></block></script></block-definition><block-definition s="drop %'howmany' $↓-1-255-255-0 from %'array'" type="reporter" category="lists"><comment x="0" y="0" w="306" collapsed="false">A positive left input selects all but the first n items of the right input.
A negative left input selects all but the last abs(n) items
of the right input.

If the right input is a matrix, a numeric left input selects rows;
the left input may also be a two-item vector, in which case
the first number is applied to the rows
and the second number is applied to the columns.
Similarly for higher-dimension arrays. </comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input></inputs><script><block s="doIf"><block s="reportIsA"><block var="howmany"/><l><option>number</option></l></block><script><block s="doReport"><custom-block s="take %n $↑-1-255-255-0 from %l"><block s="reportProduct"><block s="reportMonadic"><l><option>neg</option></l><custom-block s="signum $×-1-255-255-0 %n"><block var="howmany"/></custom-block></block><block s="reportDifference"><block s="reportListAttribute"><l><option>length</option></l><block var="array"/></block><block s="reportMonadic"><l><option>abs</option></l><block var="howmany"/></block></block></block><block var="array"/></custom-block></block></script></block><block s="doReport"><custom-block s="take %n $↑-1-255-255-0 from %l"><block s="reportMap"><block s="reifyReporter"><autolambda><block s="reportIfElse"><block s="reportLessThan"><block var="value"/><l>0</l></block><block s="reportSum"><block s="reportListItem"><block var="index"/><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="array"/></custom-block></block><block var="value"/></block><block s="reportDifference"><block var="value"/><block s="reportListItem"><block var="index"/><custom-block s="shape of $⍴-1-255-255-0 %l"><block var="array"/></custom-block></block></block></block></autolambda><list><l>value</l><l>index</l></list></block><block var="howmany"/></block><block var="array"/></custom-block></block></script></block-definition><block-definition s="error %'msg'" type="command" category="control"><comment x="0" y="0" w="268.6666666666667" collapsed="false">Throw an error.

Makes a red halo appear around the script that runs it,
with the input text shown in a speech balloon next to
the script, just like any Snap! error.

This is useful to put in the second script of SAFELY TRY
after some other instructions to undo the partial work of
the first script.</comment><header></header><code></code><translations>pt:lança o erro _
</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="simple log base %'b' of %'n'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportQuotient"><block s="reportMonadic"><l><option>ln</option></l><block var="n"/></block><block s="reportMonadic"><l><option>ln</option></l><block var="b"/></block></block></block></script></block-definition><block-definition s="simple permutations of %'r' items out of %'n'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportIfElse"><block s="reportEquals"><block var="r"/><l>0</l></block><l>1</l><block s="reportAtomicCombine"><block s="reportNumbers"><block s="reportSum"><block s="reportDifference"><block var="n"/><block var="r"/></block><l>1</l></block><block var="n"/></block><block s="reifyReporter"><autolambda><block s="reportProduct"><l></l><l></l></block></autolambda><list></list></block></block></block></block></script></block-definition><block-definition s="simple combs %'r' out of %'n'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportQuotient"><custom-block s="simple permutations of %n items out of %n"><block var="r"/><block var="n"/></custom-block><custom-block s="factorial $!-1-255-255-0 %n"><block var="r"/></custom-block></block></block></script></block-definition><block-definition s="numbers from %'from' to %'to' ascending" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="simple numbers from %n to %n ascending"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block><list><block var="from"/><block var="to"/></list></block></block></script></block-definition><block-definition s="simple gcd %'a' %'b'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doIf"><block s="reportEquals"><block var="b"/><l>0</l></block><script><block s="doReport"><block var="a"/></block></script></block><block s="doReport"><custom-block s="simple gcd %n %n"><block var="b"/><block s="reportModulus"><block var="a"/><block var="b"/></block></custom-block></block></script></block-definition><block-definition s="de-boolean %'n'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doIfElse"><block s="reportIsA"><block var="n"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="de-boolean %s"><l></l></custom-block></autolambda><list></list></block><block var="n"/></block></block></script><script><block s="doReport"><block s="reportIfElse"><custom-block s="zero? %n"><block var="n"/></custom-block><l>0</l><block s="reportIfElse"><block s="reportEquals"><block var="n"/><block s="reportBoolean"><l><bool>true</bool></l></block></block><l>1</l><block var="n"/></block></block></block></script></block></script></block-definition><block-definition s="simple lcm %'a' %'b'" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doIf"><block s="reportEquals"><block var="b"/><l>0</l></block><script><block s="doReport"><block var="b"/></block></script></block><block s="doReport"><block s="reportProduct"><block var="a"/><block s="reportQuotient"><block var="b"/><custom-block s="simple gcd %n %n"><block var="a"/><block var="b"/></custom-block></block></block></block></script></block-definition><block-definition s="simple numbers from %'from' to %'to' ascending" type="reporter" category="other" helper="true"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportIfElse"><block s="reportGreaterThan"><block var="from"/><block var="to"/></block><block s="reportNewList"><list></list></block><block s="reportNumbers"><block var="from"/><block var="to"/></block></block></block></script></block-definition><block-definition s="$flash sort %'data' ordering with %'function'" 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 < as the comparison function will sort from low to high; using > will sort from high to low.</comment><header></header><code></code><translations>ca:ordena _ segons criteri _
</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><scripts><script x="12" y="147.55555555555554"><block s="doDeclareVariables"><list><l>even items</l><l>odd items</l><l>merge</l><l>split</l><l>copy of data</l><l>id</l></list></block><block s="doSetVar"><l>id</l><block s="reifyScript"><script><block s="doReport"><l></l></block></script><list></list></block></block><block s="doSetVar"><l>copy of data</l><block s="reportMap"><block var="id"/><block var="data"/></block></block><block s="doSetVar"><l>split</l><block s="reifyScript"><script><block s="doSetVar"><l>even items</l><block s="reportNewList"><list></list></block></block><block s="doSetVar"><l>odd items</l><block s="reportNewList"><list></list></block></block><block s="doUntil"><block s="reportListIsEmpty"><block var="copy of data"/></block><script><block s="doAddToList"><block s="reportListItem"><l>1</l><block var="copy of data"/></block><block var="odd items"/></block><block s="doDeleteFromList"><l>1</l><block var="copy of data"/></block><block s="doIf"><block s="reportNot"><block s="reportListIsEmpty"><block var="copy of data"/></block></block><script><block s="doAddToList"><block s="reportListItem"><l>1</l><block var="copy of data"/></block><block var="even items"/></block><block s="doDeleteFromList"><l>1</l><block var="copy of data"/></block></script></block></script></block></script><list></list></block></block><block s="doSetVar"><l>merge</l><block s="reifyScript"><script><block s="doIf"><block s="reportEquals"><block var="#1"/><block s="reportNewList"><list></list></block></block><script><block s="doReport"><block var="#2"/></block></script></block><block s="doIf"><block s="reportEquals"><block var="#2"/><block s="reportNewList"><list></list></block></block><script><block s="doReport"><block var="#1"/></block></script></block><block s="doIfElse"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="#1"/></block><block s="reportListItem"><l>1</l><block var="#2"/></block></list></block><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="#1"/></block><block s="evaluate"><block var="merge"/><list><block s="reportCDR"><block var="#1"/></block><block var="#2"/></list></block></block></block></script><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="#2"/></block><block s="evaluate"><block var="merge"/><list><block var="#1"/><block s="reportCDR"><block var="#2"/></block></list></block></block></block></script></block></script><list><l>#1</l><l>#2</l></list></block></block><block s="doIf"><block s="reportEquals"><block var="data"/><block s="reportNewList"><list></list></block></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIf"><block s="reportEquals"><block s="reportCDR"><block var="data"/></block><block s="reportNewList"><list></list></block></block><script><block s="doReport"><block var="data"/></block></script></block><block s="doRun"><block var="split"/><list></list></block><block s="doReport"><block s="evaluate"><block var="merge"/><list><custom-block s="$flash sort %l ordering with %predRing"><block var="odd items"/><block var="function"/></custom-block><custom-block s="$flash sort %l ordering with %predRing"><block var="even items"/><block var="function"/></custom-block></list></block></block></script></scripts></block-definition><block-definition s="☠︎ linked? %'data'" 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 %'data'" 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></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 %'data'" type="reporter" category="lists"><comment x="0" y="0" w="188.66666666666666" collapsed="false">Takes a (possibly deep) list as input,
and reports a human-readable text form 
of the list (namely, Lisp notation).

Will not work on circular lists.</comment><header></header><code></code><translations></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></block><block s="doIf"><block s="reportListIsEmpty"><block var="data"/></block><script><block s="doReport"><l>()</l></block></script></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="%'x'" 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 %'function' over %'lists'" 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.
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></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><block s="reportListAttribute"><l><option>columns</option></l><block var="lists"/></block></block></block></script></block-definition><block-definition s="scalar -> hyper %'func'" type="reporter" category="control" helper="true"><comment w="218" collapsed="false">Takes a dyadic scalar function as input, and
hyperizes it, so that it can take lists as inputs.

Don't use on slow functions (this has compiled map calls). Meant for use on primitives.</comment><header></header><code></code><translations></translations><inputs><input type="%repRing"></input></inputs><script><block s="doDeclareVariables"><list><l>hyper func</l><l>scalarized</l></list></block><block s="doSetVar"><l>hyper func</l><block s="reifyReporter"><script><block s="doWarp"><script><block s="doIfElse"><custom-block s="scalar? %s"><block var="a"/></custom-block><script><block s="doIfElse"><custom-block s="scalar? %s"><block var="b"/></custom-block><script><block s="doReport"><block s="evaluate"><block var="func"/><list><custom-block s="scalar-value helper %s"><block var="a"/></custom-block><custom-block s="scalar-value helper %s"><block var="b"/></custom-block></list></block></block></script><script><block s="doSetVar"><l>scalarized</l><custom-block s="scalar-value helper %s"><block var="a"/></custom-block></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportAtomicFindFirst"><block s="reifyPredicate"><autolambda><block s="reportIsA"><l></l><l><option>list</option></l></block></autolambda><list></list></block><block var="b"/></block></block><script><block s="doReport"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block s="evaluate"><block var="func"/><list><block var="scalarized"/><l></l></list></block></autolambda><list></list></block><block var="b"/></block></block></script></block><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><block s="evaluate"><block var="hyper func"/><list><block var="scalarized"/><l></l></list></block></autolambda><list></list></block><block var="b"/></block></block></script></block></script><script><block s="doIfElse"><custom-block s="scalar? %s"><block var="b"/></custom-block><script><block s="doSetVar"><l>scalarized</l><custom-block s="scalar-value helper %s"><block var="b"/></custom-block></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportAtomicFindFirst"><block s="reifyPredicate"><autolambda><block s="reportIsA"><l></l><l><option>list</option></l></block></autolambda><list></list></block><block var="a"/></block></block><script><block s="doReport"><block s="reportAtomicMap"><block s="reifyReporter"><autolambda><block s="evaluate"><block var="func"/><list><l></l><block var="scalarized"/></list></block></autolambda><list></list></block><block var="a"/></block></block></script></block><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><block s="evaluate"><block var="hyper func"/><list><l></l><block var="scalarized"/></list></block></autolambda><list></list></block><block var="a"/></block></block></script><script><block s="doIf"><block s="reportAnd"><block s="reportEquals"><l></l><block s="reportAtomicFindFirst"><block s="reifyPredicate"><autolambda><block s="reportIsA"><l></l><l><option>list</option></l></block></autolambda><list></list></block><block var="a"/></block></block><block s="reportEquals"><l></l><block s="reportAtomicFindFirst"><block s="reifyPredicate"><autolambda><block s="reportIsA"><l></l><l><option>list</option></l></block></autolambda><list></list></block><block var="b"/></block></block></block><script><block s="doReport"><custom-block s="multimap %repRing over %mult%l"><block var="func"/><list><block var="a"/><block var="b"/></list></custom-block></block></script></block><block s="doReport"><custom-block s="multimap %repRing over %mult%l"><block var="hyper func"/><list><block var="a"/><block var="b"/></list></custom-block></block></script></block></script></block></script></block></script><list><l>a</l><l>b</l></list></block></block><block s="doReport"><block var="hyper func"/></block></script></block-definition><block-definition s="log base %'b' $⍟-1.5-255-255-0 %'x'" type="reporter" category="operators"><comment x="0" y="0" w="212" collapsed="false">Computes logarithms in any base.

The base is the left input. It's usual in APL that if there's a main data input and some sort of control input, the latter comes on the left. This is because APL syntax, unless you use parentheses, groups computations from right to left.

APL has a monadic version of this function that computes natural logs (log to the base e).</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="simple log base %n of %n"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block><list><block var="b"/><block var="x"/></list></block></block></script></block-definition><block-definition s="combs %'r' at a time $!-1-255-255-0 of %'n'" type="reporter" category="operators"><comment x="0" y="0" w="218.66666666666666" collapsed="false">Computes the number of combinations of right-input things taken left-input at a time, otherwise known as the elements of Pascal's triangle. This block shares the ! symbol with the monadic factorial function, because the formula for computing this function uses factorials.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="simple combs %n out of %n"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block><list><block var="r"/><block var="n"/></list></block></block></script></block-definition><block-definition s="factorial $!-1-255-255-0 %'n'" type="reporter" category="operators"><comment x="0" y="0" w="172.66666666666666" collapsed="false">The factorial of a positive integer n is the product of the integers from 1 to n.

In real APL, the domain of this function is extended beyond integers to compute the gamma function.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doIfElse"><block s="reportIsA"><block var="n"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="factorial $!-1-255-255-0 %n"><l></l></custom-block></autolambda><list></list></block><block var="n"/></block></block></script><script><block s="doReport"><block s="reportIfElse"><custom-block s="zero? %n"><block var="n"/></custom-block><l>1</l><block s="reportAtomicCombine"><block s="reportNumbers"><l>1</l><block var="n"/></block><block s="reifyReporter"><autolambda><block s="reportProduct"><l></l><l></l></block></autolambda><list></list></block></block></block></block></script></block></script></block-definition><block-definition s="%'a' scalar %'pred' %'b'" type="predicate" category="operators"><comment x="0" y="0" w="190" collapsed="false">Acts just like the function selected from
the pulldown menu, but hyperized, so
comparing two equal-sized lists reports
a list of the same length as the inputs,
with the results of item-by-item comparisons.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s" readonly="true">﹦<options>﹦
≠
identical to
and
or
is _ a _?</options></input><input type="%s"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reportListItem"><block s="reportListIndex"><block var="pred"/><block s="reportNewList"><list><l>﹦</l><l>≠</l><l>identical to</l><l>and</l><l>or</l><l>is _ a _?</l></list></block></block><block s="reportNewList"><list><block s="reifyPredicate"><autolambda><block s="reportEquals"><l></l><l></l></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportNotEquals"><l></l><l></l></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportIsIdentical"><l></l><l></l></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportAnd"><l/><l/></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportOr"><l/><l/></block></autolambda><list></list></block><block s="reifyPredicate"><autolambda><block s="reportIsA"><l></l><l></l></block></autolambda><list></list></block></list></block></block></custom-block><list><block var="a"/><block var="b"/></list></block></block></script></block-definition><block-definition s="GCD (or) %'a' $∨-1.2-255-255-0 %'b'" type="reporter" category="operators"><comment x="0" y="0" w="230.66666666666666" collapsed="false">Reports the greatest common divisor of its inputs.
If the inputs are values in {0,1} then this is equivalent to the logical OR of the values, with 0=False, 1=True. Hence the APL symbol ∨.
Also accepts Snap! Booleans as inputs.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="simple gcd %n %n"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block><list><custom-block s="de-boolean %s"><block var="a"/></custom-block><custom-block s="de-boolean %s"><block var="b"/></custom-block></list></block></block></script></block-definition><block-definition s="LCM (and) %'a' $∧-1.2-255-255-0 %'b'" type="reporter" category="operators"><comment x="0" y="0" w="230.66666666666666" collapsed="false">Reports the least common multiple of its inputs.
If the inputs are values in {0,1} then this is equivalent to the logical AND of the values, with 0=False, 1=True. Hence the APL symbol ∧.
Also accepts Snap! Booleans as inputs.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="simple lcm %n %n"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block><list><custom-block s="de-boolean %s"><block var="a"/></custom-block><custom-block s="de-boolean %s"><block var="b"/></custom-block></list></block></block></script></block-definition><block-definition s="NOT $~-1-255-255-0 %'p'" type="reporter" category="operators"><comment x="0" y="0" w="167.33333333333334" collapsed="false">Reports 1 if the input is False or 0;
otherwise reports 0.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="reportDifference"><l>1</l><custom-block s="signum $×-1-255-255-0 %n"><block s="reportMonadic"><l><option>abs</option></l><block var="p"/></block></custom-block></block></block></script></block-definition><block-definition s="permutations of %'r' items out of %'n'" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="simple permutations of %n items out of %n"><l></l><l></l></custom-block></autolambda><list></list></block></custom-block><list><block var="r"/><block var="n"/></list></block></block></script></block-definition><block-definition s="identity $+-1-255-255-0 %'x'" type="reporter" category="operators"><comment x="0" y="0" w="210.00000000000003" collapsed="false">Reports its input.
This is useful to fit a value into a different-type input slot, e.g., number into list slot.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="reportMonadic"><l><option>id</option></l><block var="x"/></block></block></script></block-definition><block-definition s="deep map %'function' over %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportIsA"><block var="data"/><l><option>list</option></l></block><script><block s="doReport"><block s="reportMap"><block s="reifyReporter"><autolambda><custom-block s="deep map %repRing over %l"><block var="function"/><l/></custom-block></autolambda><list></list></block><block var="data"/></block></block></script><script><block s="doReport"><block s="evaluate"><block var="function"/><list><block var="data"/></list></block></block></script></block></script></block-definition><block-definition s="%'howmany' deal $?-1-255-255-0 %'range'" type="reporter" category="operators"><comment x="0" y="0" w="177.33333333333334" collapsed="false">Report a list with left-input random integers in the range 1 to right-input.
No number appears more than once
in the result. The left input must be less than or equal to the right input.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="evaluate"><custom-block s="scalar -> hyper %repRing"><block s="reifyReporter"><autolambda><custom-block s="%n deal helper %l"><l></l><block s="reportNumbers"><l>1</l><l></l></block></custom-block></autolambda><list></list></block></custom-block><list><block var="howmany"/><block var="range"/></list></block></block></script></block-definition><block-definition s="outer product %'a' $○.-1-255-255-0 %'function' %'b'" type="reporter" category="lists"><comment x="0" y="0" w="297.99999999999994" collapsed="false">Given two arrays A and B, reports an array whose dimensions are
APPEND(SHAPE OF (A), SHAPE OF (B))
in which each atomic item of the result is computed by applying the dyadic function input to an item of A and an item of B.</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportIsA"><block var="a"/><l><option>list</option></l></block><script><block s="doIf"><block s="reportListIsEmpty"><block var="a"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><custom-block s="outer product %l $○.-1-255-255-0 %repRing %l"><block s="reportListItem"><l>1</l><block var="a"/></block><block var="function"/><block var="b"/></custom-block><custom-block s="outer product %l $○.-1-255-255-0 %repRing %l"><block s="reportCDR"><block var="a"/></block><block var="function"/><block var="b"/></custom-block></block></block></script><script><block s="doIfElse"><block s="reportIsA"><block var="b"/><l><option>list</option></l></block><script><block s="doIf"><block s="reportListIsEmpty"><block var="b"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><custom-block s="outer product %l $○.-1-255-255-0 %repRing %l"><block var="a"/><block var="function"/><block s="reportListItem"><l>1</l><block var="b"/></block></custom-block><custom-block s="outer product %l $○.-1-255-255-0 %repRing %l"><block var="a"/><block var="function"/><block s="reportCDR"><block var="b"/></block></custom-block></block></block></script><script><block s="doReport"><block s="evaluate"><block var="function"/><list><block var="a"/><block var="b"/></list></block></block></script></block></script></block></script></block-definition></blocks> |