Symbol Take
From NARS2000
(Redirected from ↑)
↑ — 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
NARS 2000 Lang Tool Bar |
← | → | + | - | × | ÷ | * | ⍟ | ⌹ | ○ | ! | ? | √ | | | ⌈ | ⌊ | ⊥ | ⊤ | ⊣ | ⊢ | ||
= | ≠ | ≤ | < | > | ≥ | ≡ | ≢ | ∨ | ∧ | ⍱ | ⍲ | ↑ | ↓ | ⊂ | ⊃ | ⌷ | ⍋ | ⍒ | ||||
⍳ | ∊ | ⍸ | ⍷ | ∪ | ∩ | ⊆ | ⊇ | ~ | § | π | .. | , | ⍪ | ⍴ | ⌽ | ⊖ | ⍉ | |||||
/ | \ | ⌿ | ⍀ | ⊙ | ¨ | ⍨ | ⍤ | ⍦ | ⍥ | . | ∘ | ⍠ | ‼ | ⌻ | ⍞ | ⎕ | ⍎ | ⍕ | ||||
⋄ | ⍝ | ∇ | ∆ | ⍙ | _ | ⍺ | ⍵ | ¯ | ⍬ | ∞ | ∅ | b | e | g | p | r | v | x |