Carsten Dominik <[EMAIL PROTECTED]> writes: Hello,
> Hi Nicolas, there s no builtin way to deal with this, in particular > with the fact that you want to treat empty fields as non-existing, and > therefore also to ignore the corresponding weight. > > You cou write a Lisp function to do this, though: > > (defun my-wmean (values weights) > (let ((vsum 0) (wsum 0)) > (while (and values weights) > (setq v (pop values) w (pop weights)) > (unless (equal "" v) > (setq vsum (+ vsum (* (string-to-number w) (string-to-number > v))) > wsum (+ wsum (string-to-number w))))) > (/ vsum wsum))) Well, thank you very much: it does the job. I don't want to be picky but I'll investigate on a way to have an empty string instead of a sorry 0 whenever a student hasn't sat for any exam. Finally, I wondered if it would be useful to make it built-in as weighted means are somewhat popular in education. Anyway, thanks again. -- Nicolas Goaziou _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode