count multimethod
Methods
- count(e:Eachable1, pattern:Any=method) Source: stdlib.ngs:2703
Count number of items that match the pattern. Parameters
e Items to look at pattern Test function or anything else acceptable by (=~), defaults to Bool.constructors Returns
IntExample
[1,2,3,11,12].count(X>10) # 2
- count(e:Eachable2, predicate:Fun) Source: stdlib.ngs:3456
Count number of key-value pairs in Hash that satisfy the predicate. Parameters
e Something to check, typically a Hash predicate Test function to be called with one key and one value at a time: predicate(k, v) Returns
IntExample
{'a': 1, 'b': 2, 'c': 11}.count(F(k, v) v>10) # 1