Symbol Reduce: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
<h1> {compress} &mdash; Reduce/compress/replicate Operator &mdash; Keystroke / &mdash; Character 93 or x5D</h1>
<h1> {compress} &mdash; Reduce Operator &mdash; Keystroke ?ALT+X &mdash; Character 0000</h1>
Note: The APL name of this symbol is <big>compress</big> or '''&#123;compress}''', not '''reduce''', however, reduce or reduction is the usual name for this symbol, but compress is one of the functions.  
Note: The APL name of this symbol is <big>compress</big> or '''&#123;compress}''', not '''reduce'''.
 
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===
<code>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 1 0 0 0 0 0 0 0 0 0 0 1 1 / 'Taste the cake'<br/>
Take<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 1 0 0 0 0 0 0 0 0 0 0 1 1 / 'Taste the cake'<br/>
TTake<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 1 1 0 / 'take' 'this' 'drop' 'that'<br/>
take&nbsp;&nbsp;this drop<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 1 1 1 / 'take' 'this' 'drop' 'that'<br/>
take&nbsp;&nbsp;this drop that<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 0 1 1 / 'take' 'this' 'drop' 'that'<br/>
take&nbsp;&nbsp;drop that<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0 1 1 0 / 'take' 'this' 'drop' 'that'<br/>
this&nbsp;&nbsp;drop<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 0 0 1 1/ 1 2 3 4 5<br/>
1 4 5<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 2 3 4 5 / 1 2 3 4 5<br/>
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5<br/>
</code>
 
==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
* =/ Binary operators
* ≠/
* ≤/
* </
* >/
* ≥/


==Usage==
==Usage==
==Example==
==Example==
==See Also==
==See Also==

Latest revision as of 07:30, 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 1 1 1 / 'take' 'this' 'drop' 'that'
take  this drop that
     1 0 1 1 / 'take' 'this' 'drop' 'that'
take  drop that
     0 1 1 0 / 'take' 'this' 'drop' 'that'
this  drop
     1 0 0 1 1/ 1 2 3 4 5
1 4 5
     1 2 3 4 5 / 1 2 3 4 5
1 2 2 3 3 3 4 4 4 4 5 5 5 5 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
  • =/ Binary operators
  • ≠/
  • ≤/
  • </
  • >/
  • ≥/

Usage

Example

See Also

NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
< = >
~ § π .. ,
/ \ ¨ .
_ ¯
Second Row i j k i j k l g p r v x