File: tally-doc.m2

package info (click to toggle)
macaulay2 1.24.11%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 171,648 kB
  • sloc: cpp: 107,850; ansic: 16,307; javascript: 4,188; makefile: 3,947; lisp: 682; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (28 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
doc ///
  Key
    tally
    (tally, VisibleList)
    (tally, String)
  Headline
    tally the elements of a list, sequence, array, or string
  Usage
    y = tally x
  Inputs
    x:{VisibleList,String}
  Outputs
    y:Tally
  Description
    Text
      It produces a hash table (multiset) @TT "y"@ which tallies the frequencies
      of the occurrences of items in the list or string @TT "x"@, i.e.,
      @TT "y_i"@ is the number of times @TT "i"@ appears in @TT "x"@, or is
      @TT "0"@ if @TT "i"@ doesn't appear in the list or string.
    Example
      y = tally {1,2,3,a,b,1,2,a,1,2,{a,b},{a,b},a}
      y_2
      y_5
      y_{a,b}
      tally "Hello, world!"
  SeeAlso
    Tally
///