mirror of https://github.com/djcb/mu.git
* guile: add mu:count to (mu stats)
This commit is contained in:
parent
11b60b7ca0
commit
99778d1314
|
@ -23,6 +23,7 @@
|
|||
:use-module (ice-9 i18n)
|
||||
:use-module (ice-9 r5rs)
|
||||
:export ( mu:tabulate
|
||||
mu:count
|
||||
mu:average
|
||||
mu:stddev
|
||||
mu:correl
|
||||
|
@ -49,6 +50,17 @@ get back a list like
|
|||
expr)
|
||||
table))
|
||||
|
||||
|
||||
(define* (mu:count #:optional (expr #t))
|
||||
"Count the number of messages matching EXPR. If EXPR is not
|
||||
provided, match /all/ messages."
|
||||
(let ((num 0))
|
||||
(mu:for-each-message
|
||||
(lambda (msg) (set! num (1+ num)))
|
||||
expr)
|
||||
num))
|
||||
|
||||
|
||||
(define (average lst)
|
||||
"Calculate the average of a list LST of numbers, or #f if undefined."
|
||||
(if (null? lst)
|
||||
|
|
Loading…
Reference in New Issue