count multimethod
Methods
- count(e:Eachable1, predicate:Any) Source: stdlib.ngs:1725
Count number of items that satisfy the predicate. Parameters
e Items to look at predicate Test function Returns
IntExample
[1,2,3,11,12].count(X>10) # 2
- count(e:Arr) Source: stdlib.ngs:1739
Count all true values. Parameters
e Items to look at Returns
IntExample
[0,1,2,null,false].count() # 2 (Only 1 and 2 count as true values)
- count(e:Eachable2, predicate:Any) Source: stdlib.ngs:2464
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 Returns
IntExample
{'a': 1, 'b': 2, 'c': 11}.count(F(k, v) v>10) # 1