Stats type
Example
s = Stats().push('a').push('a').push('b') s["a"] # 2 s["b"] # 1 a = ["x", "y", "y"] s = Stats(a) s["x"] # 1 s["y"] # 2
Direct parent types
- HashLike
Base type for user-defined hash-like types. This is a workaround: it's not possible currently no inherit from the built-in Hash type. Direct subtypes: 2
Methods
- init(s:Stats, a:Arr) Source: autoload/Stats.ngs:20
Makes Stats, with each element in the array counted as if push()ed Example
Stats(['a', 'a', 'b']).Hash() # {'a': 2, 'b': 1}
- push(s:Stats, k:Any) Source: autoload/Stats.ngs:28
Increment the named counter Parameters
k the name of the counter to increment Example
Stats().push("a").push("a").push("b")["a"] # 2