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.
0partialpartial
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.
Reports the greater of its two inputs. Works on strings too.
Reports a flat list of all the atomic elements of sublists of the input list.
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.
1
Reports its input. This is useful to fit a value into a different-type input slot, e.g., number into list slot.
Reports the number of dimensions of the input.
111
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.
111
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.
Recursively deep-inserts the items of the first input into the items of the second input. If the first input is not a list, then it is inserted with IN FRONT OF in the second unless the second also isn't a list, in which case they are combined with LIST.
1
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.
1
Takes a (possibly deep) list as input, and reports a human-readable text form of the list (namely, Lisp notation).
( )
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")
111111
Reports the smaller of its two inputs.
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).
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.
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.
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.
pt:lança o erro _
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.
﹦ ≠ identical to and or is _ a _?
Report a list with left-input random integers in the range 1 to right-input. No number appears more than once in the result.
choicechoice11
Reports 1 if the input is positive, 0 if the input is zero, or -1 if the input is negative.
0false
reports 1 divided by its input.
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.
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.
ab
Takes a dyadic scalar function as input, and hyperizes it, so that it can take lists as inputs.
ab
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)))).
1
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.).
1
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.
ab
Reports the not-and of its inputs, in the form 0 for false, 1 for true.
Reports 1 if the input is False or 0; otherwise reports 0.
Reports the not-and of its inputs, in the form 0 for false, 1 for 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.
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.
Reports 0 if its inputs are equal; reports 1 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.
reports True iff the input is 0 or False.
Reports a Snap! Boolean False if the input is False or 0; reports True otherwise.
Make scalar called with non-singleton input
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 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.
1result
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.
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.)
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 adds new columns, by appending to each row.
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.)
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.
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.
ca:ordena _ segons criteri _ copy of datasplitmerge11#1#2
Compares two vectors for sorting. Compare first items; if those are equal compare second items; etc.
1111
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.
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).
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).
Turns a row-wise (in Lisp terminology) into a column-wise one.
Reverses the order of the columns of the input, which is a reflection through a vertical axis, as the ⏀ symbol suggests.
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.
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.
A hyperblock version of JOIN. The regular JOIN isn't hyperized because it can accept a list as input, representing it as text.
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.
10valueindex
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.
0valueindex