Drop: Difference between revisions

Jump to navigation Jump to search
4 bytes removed ,  11:46, 25 October 2019
class= → lang=
Miraheze>Adám Brudzewsky
No edit summary
Miraheze>Adám Brudzewsky
(class= → lang=)
Line 4: Line 4:


Use Drop to remove leading or trailing [[elements]] from a [[vector]]:
Use Drop to remove leading or trailing [[elements]] from a [[vector]]:
<source class=apl>
<source lang=apl>
       3 ↓ 5 4 3 2 1
       3 ↓ 5 4 3 2 1
2 1
2 1
Line 12: Line 12:


Removing more elements than the length of the axis gives an [[empty]] result:
Removing more elements than the length of the axis gives an [[empty]] result:
<source class=apl>
<source lang=apl>
       ¯8 ↓ 5 4 3 2 1
       ¯8 ↓ 5 4 3 2 1


Line 19: Line 19:


When the right argument is a multidimensional array, one element from the left argument is used for each axis. In a language that supports [[axis specification]] for Take, or allows a short left argument, you can specify drop amounts for only some axes: other axes will remain unchanged.
When the right argument is a multidimensional array, one element from the left argument is used for each axis. In a language that supports [[axis specification]] for Take, or allows a short left argument, you can specify drop amounts for only some axes: other axes will remain unchanged.
<source class=apl>
<source lang=apl>
       2 3 ↓ ⍳4 5
       2 3 ↓ ⍳4 5
┌───┬───┐
┌───┬───┐
Line 37: Line 37:


Drop can be modelled using Take with a complementary length:
Drop can be modelled using Take with a complementary length:
<source class=apl>
<source lang=apl>
Drop ← {
Drop ← {
     s ← ⍴⍵
     s ← ⍴⍵

Navigation menu