24
edits
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
== Outer Product == | == Outer Product == | ||
Outer product is a [[monadic operator]], which will produce a [[dyadic function]] when applied with a [[dyadic function]]. In APL, the outer product is a generalisation of the [https://en.wikipedia.org/wiki/Matrix_multiplication matrix product], which allows not only multiplication, but any [[dyadic function]] given. In short, outer product allows you to apply a given function | Outer product is a [[monadic operator]], which will produce a [[dyadic function]] when applied with a [[dyadic function]]. In APL, the outer product is a generalisation of the [https://en.wikipedia.org/wiki/Matrix_multiplication matrix product], which allows not only multiplication, but any [[dyadic function]] given. In short, outer product allows you to apply a given function on each element of the left array with each element of the right array. Basically, a shortcut for constructing nested [https://en.wikipedia.org/wiki/For_loop for loop]s. | ||
=== Syntax === | === Syntax === | ||
By right, a [[monadic operator]] should be a monograph (i.e. consist of only one character), and the operand should be on the left. However, due to [[legacy reason]], the outer product operator is not only a [[diagraph]] denoted as <source lang=apl inline>∘.</source>, the operand also appears on the right. | By right, a [[monadic operator]] should be a monograph (i.e. consist of only one character), and the operand should be on the left. However, due to [[legacy reason]], the outer product operator is not only a [[diagraph]] denoted as <source lang=apl inline>∘.</source>, the operand also appears on the right instead. | ||
Notably, this syntactical inconsistency is resolved in [[BQN]], where the outer product operator <source lang=bqn inline>⌜</source> abides with the usual operator syntax. Also note that it is called table in BQN. | Notably, this syntactical inconsistency is resolved in [[BQN]], where the outer product operator <source lang=bqn inline>⌜</source> abides with the usual operator syntax. Also note that it is called table in BQN. |
edits