Symbol Reduce: Difference between revisions
No edit summary |
(→Usage) |
||
Line 15: | Line 15: | ||
2 1 0 0 0 0 0 0 0 0 0 0 1 1 / 'Taste the cake'<br/> | 2 1 0 0 0 0 0 0 0 0 0 0 1 1 / 'Taste the cake'<br/> | ||
TTake<br/> | TTake<br/> | ||
1 1 1 0 / 'take' 'this' 'drop' 'that'<br/> | |||
take this drop<br/> | |||
1 0 0 1 1/ 1 2 3 4 5<br/> | 1 0 0 1 1/ 1 2 3 4 5<br/> | ||
1 4 5 | 1 4 5 | ||
</code> | </code> | ||
==Reduce== | ==Reduce== | ||
The operator to the left of the reduce operator is applied to the values to the right. These operators include | The operator to the left of the reduce operator is applied to the values to the right. These operators include |
Revision as of 02:21, 13 March 2013
/ — Reduce/compress/replicate Operator — Keystroke / — Character 93 or x5D
Note: The APL name of this symbol is compress or {compress}, not reduce, however, reduce or reduction is the usual name for this symbol, but compress is one of the functions.
This symbol performs several different operations depending on whether it is combined with certain other operators
Functions
- L / R compress or replicate R according to value in L
- f/ R reduce operator f on each argument in R
Compress / Replicate
The argument on the left selects the elements on the right to discard, keep, or copy. For each element on the right there is a numeric value on the left indicating how many copies of that element on the right to keep. The number of elements must match. If the number is 0, that element is dropped. If 1, it is kept. If >1, it is copied that many times.
Usage
1 1 0 0 0 0 0 0 0 0 0 0 1 1 / 'Taste the cake'
Take
2 1 0 0 0 0 0 0 0 0 0 0 1 1 / 'Taste the cake'
TTake
1 1 1 0 / 'take' 'this' 'drop' 'that'
take this drop
1 0 0 1 1/ 1 2 3 4 5
1 4 5
Reduce
The operator to the left of the reduce operator is applied to the values to the right. These operators include
- !/ Factorial reduce
- -/ Minus reduce
- +/ Plus reduce
- ×/ Times reduce
- */ Star reduce
- ⍟/ Log reduce
- ○/ Jot reduce
- ∨/ Or reduce
- ∧/ And reduce
- ⍱/ Nor reduce
- ⍲/ Nand reduce
- ⌈/ Maximum
- ⌊/ Minimum
- =/
- ≠/
- ≤/
- </
- >/
- ≥/
Usage
Example
See Also
NARS 2000 Lang Tool Bar |
← | → | + | - | × | ÷ | * | ⍟ | ⌹ | ○ | ! | ? | √ | | | ⌈ | ⌊ | ⊥ | ⊤ | ⊣ | ⊢ | |||
≡ | ≢ | < | ≤ | = | ≥ | > | ≠ | ∨ | ∧ | ⍱ | ⍲ | ↑ | ↓ | ⊂ | ⊃ | ⌷ | ⍋ | ⍒ | |||||
⍳ | ∊ | ⍸ | ⍷ | ∪ | ∩ | ⊆ | ⊇ | ~ | § | π | .. | , | ⍪ | ⍴ | ⌽ | ⊖ | ⍉ | ||||||
/ | \ | ⌿ | ⍀ | ⊙ | ¨ | ⍨ | ⍤ | ⍣ | ⍡ | ⍥ | ⍦ | . | ∘ | ⍠ | ‼ | ⌻ | ∂ | ∫ | ⍞ | ⎕ | ⍎ | ⍕ | |
⋄ | ⍝ | ∇ | ∆ | ⍙ | _ | ⍺ | ⍵ | ¯ | ⍬ | ∞ | ∅ | ||||||||||||
Second Row | i j k | i j k l | g | p | r | v | x |