Each: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Notability is a requirement to be on the wiki, calling things "notable" is useless) |
||
Line 33: | Line 33: | ||
</source> | </source> | ||
=== Mapping === | === Mapping === | ||
It is very common to pair up an entire array with each element of a different array. There are two common ways to do this using Each. The first is to [[enclose]] the argument that is to be used as a whole for each element of the other array: | It is very common to pair up an entire array with each element of a different array. There are two common ways to do this using Each. The first is to [[enclose]] the argument that is to be used as a whole for each element of the other array: | ||
Line 59: | Line 58: | ||
Note how binding a right argument derives a monadic function which still takes its single argument on the right. | Note how binding a right argument derives a monadic function which still takes its single argument on the right. | ||
=== Selecting === | === Selecting === | ||
An enclosed array is a [[scalar]], which is subject to [[scalar extension]]. This can be used to simulate [[Outer Product|outer product]] by a one-sided Each (pair the entire right argument with each element of the left argument, or vice versa). | An enclosed array is a [[scalar]], which is subject to [[scalar extension]]. This can be used to simulate [[Outer Product|outer product]] by a one-sided Each (pair the entire right argument with each element of the left argument, or vice versa). An application of this behavior is the "chipmunk idiom" <source lang=apl inline>X⊃¨⊂Y</source>, which simulates <source lang=apl inline>Y[X]</source> for (possibly nested) [[vector]] Y and [[simple]] X: | ||
<source lang=apl> | <source lang=apl> |