Drop: Difference between revisions

Jump to navigation Jump to search
2 bytes added ,  09:14, 23 October 2019
no edit summary
Miraheze>Marshall
(Created page with "Drop (↓) is a primitive function which removes part of each axis of an array. The removed portions are exactly those that Take would include in its result. Drop...")
 
Miraheze>Marshall
No edit summary
Line 34: Line 34:
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]] and shares a [[prototype]] with the argument.


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


Drop can be modelled using Take with a complementary length:
Drop can be modelled using Take with a complementary length:
Anonymous user

Navigation menu