Tally: Difference between revisions

Jump to navigation Jump to search
850 bytes added ,  13:43, 30 April 2020
m
Text replacement - "{{APL built-ins}}" to "{{APL built-ins}}Category:Primitive functions"
Miraheze>Marshall
m (Text replacement - "{{APL built-ins}}" to "{{APL built-ins}}Category:Primitive functions")
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Built-in|Tally|≢}} is a [[primitive function|primitive]] [[monadic function]] which returns the number of [[major cell]]s in its [[argument]]. The Tally of an array is also the first [[element]] of its [[shape]], or 1 if it is a [[scalar]] (since a scalar is its own major cell by convention). Tally counts the first [[axis]] rather than the last because the number of major cells is more useful in [[leading axis theory]].
{{Built-in|Tally|≢}} or '''Count''' is a [[primitive function|primitive]] [[monadic function]] which returns the number of [[major cell]]s in its [[argument]]. The Tally of an array is also the first [[element]] of its [[shape]], or 1 if it is a [[scalar]] (since a scalar is its own major cell by convention). Tally counts the first [[axis]] rather than the last because the number of major cells is more useful in [[leading axis theory]].


== Examples ==
== Examples ==
Line 36: Line 36:
== History ==
== History ==


Tally was introduced in [[J]] using the symbol <source lang=j inline>#</source>, and adopted in APL by [[Dyalog APL 14.0]]. It was later added to [[NARS2000]] and [[GNU APL]] and has been included in many recents APLs based on Dyalog, such as [[ngn/apl]], [[dzaima/APL]], and [[APL\iv]].
Tally was introduced in [[A]] with the name "count" and symbol <source lang=j inline>#</source>. The same notation was carried forward to [[A+]], as well as [[J]] following [[Arthur Whitney]]'s suggestion. The primitive was present in [[NARS2000]] by 2010, with the name "Tally" and symbol <source lang=apl inline>></source><ref>NARS2000 Wiki. [http://wiki.nars2000.org/index.php?title=Tally&oldid=573 Tally]. Old revision: 2010-08-29.</ref>. The symbol <source lang=apl inline>≢</source> for Tally was introduced in [[Dyalog APL 14.0]], and quickly adopted by NARS2000. It was later added to [[GNU APL]] and has been included in many recent APLs based on Dyalog, such as [[ngn/apl]], [[dzaima/APL]], and [[APL\iv]].
 
Before the addition of Tally (and [[Zilde]]), there were numerous ways to get the length of a vector as a scalar:
<source lang=apl>
''⍴⍴v
(⍴0)⍴⍴v
(⍳0)⍴⍴v
(⍴v)[0]
×/⍴v    ⍝ shortest and obscure
0⊥⍴v    ⍝ shortest and obscurest
</source>


== External links ==
== External links ==
Line 47: Line 57:


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Tally.htm Dyalog]
* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Tally.htm Dyalog]
* [http://wiki.nars2000.org/index.php/Tally NARS2000]
* J [http://www.jsoftware.com/help/dictionary/d400.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/number NuVoc]
* J [http://www.jsoftware.com/help/dictionary/d400.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/number NuVoc]
== References ==
<references />
{{APL built-ins}}[[Category:Primitive functions]]

Navigation menu