[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mu-guile: e-mail searching and stats

From: Dirk-Jan C . Binnema
Subject: mu-guile: e-mail searching and stats
Date: Wed, 01 Feb 2012 17:03:44 +0200
User-agent: mu4e 0.9.8; emacs

Hi Guilers,

I've just released version 0.9.8 of mu[1], my e-mail search engine / indexer
(and now also an experimental e-mail client[2] for emacs).

For Guile-users, however, the most interesting part are guile-bindings[3] that
I have added. With those bindings, you can analyze your e-mail corpus, and
generate all kinds of interesting statistics. While I'm no Guile/Scheme expert
by any means, I'm quite happy with the result, and the power it adds to my
program to add being able to script in Guile; note, only Guile 2.0 is

There's a manual[4], which has a lot of examples on how to create little
scripts and generate statistics. As a very simple example, suppose I want to
see the frequency of messages containing the word "hello" in the subject-line
per weekday:

--8<---------------cut here---------------start------------->8---
(use-modules (mu) (mu message) (mu stats))

;; get a list of ("Weekday" . <frequency>) pairs
(define (weekday-table expr)
        (lambda (msg)
          (tm:wday (localtime (mu:date msg)))) expr)
      (lambda (a b) (< (car a) (car b))))))  

  (lambda (elm)
    (format #t "~a: ~a\n" (car elm) (cdr elm)))
    (weekday-table "subject:hello"))
--8<---------------cut here---------------end--------------->8---

and get output like:

Sun: 23
Mon: 19
Tue: 28
Wed: 20
Thu: 27
Fri: 16
Sat: 25

You can also draw graphs of this -- see [3], and there are some examples (in
the examples/ dir), which let you actually do lots of graphs/stats *without*
any coding. But that's not so much heh?!

I'd be happy to hear any feedback or suggestions; I'm eager to learn. I have
some ideas for a next version, including making a simple guile-based procmail
replacement, and hooking things up with mu4e, but let's see what happens...

Happy hacking & thanks to the nice people in #guile for helping me with my



Dirk-Jan C. Binnema                  Helsinki, Finland
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

reply via email to

[Prev in Thread] Current Thread [Next in Thread]