Drop: Difference between revisions

Jump to navigation Jump to search
12 bytes added ,  14:35, 24 October 2019
Miraheze>Marshall
No edit summary
Miraheze>Adám Brudzewsky
Line 32: Line 32:
The arguments to Drop must be valid arguments to [[Take]], and elements of the left argument are matched to [[axes]] of the right in the same way. Like Take, the left argument is subject to [[scalar rank extension]], and in some APLs the right is as well.
The arguments to Drop must be valid arguments to [[Take]], and elements of the left argument are matched to [[axes]] of the right in the same way. Like Take, the left argument is subject to [[scalar rank extension]], and in some APLs the right is as well.


Each axis with a matching left argument element <code>d</code> is modified to remove <code>|d</code> indices, or all of them if <code>|d</code> is larger than the length of the axis. Indices are removed starting from the beginning if <code>d</code> is positive and starting from the end if it is negative (if <code>d</code> is 0, then no indices are removed). Equivalently, for an axis of length <code>l</code>, <code>l-l⌊|d</code> axes are retained—not dropped—from the axis starting from the opposite side: the end if <code>d</code> is positive and the beginning otherwise. If <code>|d</code> is greater than or equal to <code>l</code> for any axis, then the result is [[empty]] and shares a [[prototype]] with the argument.
Each axis with a matching left argument element <code>d</code> is modified to remove <code>|d</code> indices, or all of them if <code>|d</code> is larger than the length of the axis. Indices are removed starting from the beginning if <code>d</code> is positive and starting from the end if it is negative (if <code>d</code> is 0, then no indices are removed). Equivalently, for an axis of length <code>l</code>, <code>l-l⌊|d</code> axes are retained—not dropped—from the axis starting from the opposite side: the end if <code>d</code> is positive and the beginning otherwise. If <code>|d</code> is greater than or equal to <code>l</code> for any axis, then the result is [[empty array|empty]] and shares a [[prototype]] with the argument.


=== APL Model ===
=== APL Model ===

Navigation menu