Symbol Take

From NARS2000
(Redirected from ↑)
Jump to navigationJump to search

↑ — Take symbol — Keystroke(usually) ALT+y ; Character (⎕UCS) 8593

Usage

Dyadic function A↑B - where A is the number of elements to take and B is the vector or array to operate on. Take first(A is positive) n or last(A is negative) n elements of an array. Take and Rho share a similar property - the left argument specifies the size of the resultant array.

Examples

      5↑1    ⍝Take the first 5 elements, given scalar integer 1
1 0 0 0 0    ⍝Result creates a vector of 5 elements, since only a single scalar was present, 4 additional zeroes are appended to the vector.

      ¯4↑45 78 33 99 10 11 12 13  ⍝Take the last 4 elements, given a vector of 8 integers
10 11 12 13   ⍝APL/NARS Interpreter returns the last 4 elements, a vector.

      ¯5↑'abcdefghijklmnop'  
lmnop     ⍝Result is the last 5 elements from the alphabet sub-string(take's right argument), result is similarly a string.

      A←3 4⍴⍳12   ⍝Store a 3-row by 4-column matrix of the set of integers from 1 through 12 in variable A
      A   ⍝Display the contents of variable A, which has 3 rows and 4 columns of consecutive integers:
1  2  3  4
5  6  7  8
9 10 11 12
      2 3↑A    ⍝Take just the FIRST 2 rows and 3 columns of variable A, display the requested results:
1 2 3
5 6 7

      ¯2 3↑A   ⍝Take the LAST 2 rows and FIRST 3 columns of variable A, display the results:
5  6  7
9 10 11

      4 5↑A    ⍝Take 4 rows and 5 columns of variable A, ZEROES are APPENDED when left arguments exceed array sizes of a NUMERIC matrix.
1  2  3  4 0
5  6  7  8 0
9 10 11 12 0
0  0  0  0 0

      ¯4 ¯5↑A  ⍝Take negative 4 rows and negative 5 cols of variable A. Result: ZEROES are PREFIXED onto numeric matrix A:
0 0  0  0  0
0 1  2  3  4
0 5  6  7  8
0 9 10 11 12

See Also

  • Rho: ⍴ especially Dyadic rho and it's leftmost argument


{{#ifeq:{{{en}}}|4||title="match" style="border-width:thick; border-color:blue; background-color:yellow;"|≡ {{#ifeq:{{{en}}}|7||title="iota" style="border-width:thick; border-color:blue; background-color:yellow;" |⍳ {{#ifeq:{{{en}}}|9||title="slash" style="border-width:thick; border-color:blue; background-color:yellow;" |/ {{#ifeq:{{{en}}}|11||title="diamond" style="border-width:thick; border-color:blue; background-color:yellow;" |⋄ {{#switch: {{{en}}}
NARS 2000 Lang
Tool
Bar

{{#ifeq:{{{en}}}|1||title="assign" style="border-width:thick; border-color:blue; background-color:yellow;" |←

→ bgcolor=cyan title="assign" |← → }}

{{#ifeq:{{{en}}}|2||title="plus" style="border-width:thick; border-color:blue; background-color:yellow;" |+

- × ÷ * ⍟ ⌹ ○ ! ? √ bgcolor=cyan title="plus" |+ - × ÷ * ⍟ ⌹ ○ ! ? √ }}

{{#ifeq:{{{en}}}|3||title="mod" style="border-width:thick; border-color:blue; background-color:yellow;" ||

⌈ ⌊ ⊥ ⊤ ⊣ ⊢
⌈ ⌊ ⊥ ⊤ ⊣ ⊢
≢ < ≤ = ≥ > ≠ bgcolor=cyan title="match" |≡ ≢ < ≤ = ≥ > ≠ }}

{{#ifeq:{{{en}}}|5||title="down caret" style="border-width:thick; border-color:blue; background-color:yellow;" |∨

∧ ⍱ ⍲ bgcolor=cyan title="down caret" |∨ ∧ ⍱ ⍲ }}

{{#ifeq:{{{en}}}|6||title="take" style="border-width:thick; border-color:blue; background-color:yellow;" |↑

↓ ⊂ ⊃ ⌷ ⍋ ⍒
↓ ⊂ ⊃ ⌷ ⍋ ⍒
∊ ⍸ ⍷ ∪ ∩ ⊆ ⊇ ~ § π .. bgcolor=cyan title="iota" |⍳ ∊ ⍸ ⍷ ∪ ∩ ⊆ ⊇ ~ § π .. }}

{{#ifeq:{{{en}}}|8||title="comma" style="border-width:thick; border-color:blue; background-color:yellow;" |,

⍪ ⍴ ⌽ ⊖ ⍉
⍪ ⍴ ⌽ ⊖ ⍉
\ ⌿ ⍀ ⊙ ¨ ⍨ ⍤ ⍡ ⍥ ⍦ . ∘ ⍠ ‼ ⌻ ∂ ∫ bgcolor=cyan title="slash" |/ \ ⌿ ⍀ ⊙ ¨ ⍨ ⍤ ⍣ ⍡ ⍥ ⍦ . ∘ ⍠ ‼ ⌻ ∂ ∫ }}

{{#ifeq:{{{en}}}|10||title="quotequad" style="border-width:thick; border-color:blue; background-color:yellow;" |⍞

⎕ ⍎ ⍕
⎕ ⍎ ⍕
⍝ ∇ ∆ ⍙ _ ⍺ ⍵ bgcolor=cyan title="diamond" |⋄ ⍝ ∇ ∆ ⍙ _ ⍺ ⍵ }}

{{#ifeq:{{{en}}}|12||title="neg" style="border-width:thick; border-color:blue; background-color:yellow;" |¯

⍬ ∞ title="neg" |¯ ⍬ ∞ ∅
colspan=8 |Second Row i j k a b e g p r v x z colspan=8 |Second Row i j k a b e g p r v x z colspan=8 |Second Row i j k a b e g p r v x z colspan=6 |Second Row i j k i j k l g p r v x

}}