emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Spreadsheet and weighted means


From: Nicolas Goaziou
Subject: Re: [Orgmode] Spreadsheet and weighted means
Date: Sat, 04 Oct 2008 10:49:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hello,

Carsten Dominik <address@hidden> writes:

> (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)))))
>    (if (= vsum 0) "" (format "%.1f" (/ vsum wsum)))))

But in this case, there's no difference between one who didn't work and
one who just wasn't there: 0 0 and "empty" "empty" will have the same
"empty" mean, won't they ?

>> Finally, I wondered if it would be useful to make it built-in as
>> weighted means are somewhat popular in education.
>
> Well, I could do that, of course. But which version of this function?
> What ouput etc?
> I guess this would then be the original version, which returns a
> number, and which returns 0 if the student has done absolutely
> nothing....

Though it seems more of a rhetorical question, I would be tempted to
answer that any of them would be useful.
On the other hand, I can live with "my-wmean" in my .emacs.

Regards,

-- 
Nicolas Goaziou




reply via email to

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