From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Spreadsheet and weighted means Date: Sat, 04 Oct 2008 10:49:46 +0200 Message-ID: <87r66w9239.fsf@selenimh.orion.org> References: <87wsh7w589.fsf@selenimh.orion.org> <9136F031-BBCD-4A80-A117-6047C5D3F777@uva.nl> <87y718nu0l.fsf@selenimh.orion.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Km2tP-0004KK-QT for emacs-orgmode@gnu.org; Sat, 04 Oct 2008 04:53:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Km2tO-0004K8-37 for emacs-orgmode@gnu.org; Sat, 04 Oct 2008 04:53:38 -0400 Received: from [199.232.76.173] (port=50479 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Km2tN-0004K5-Tr for emacs-orgmode@gnu.org; Sat, 04 Oct 2008 04:53:37 -0400 Received: from neuf-infra-smtp-out-sp604006av.neufgp.fr ([84.96.92.121]:43162) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Km2tN-0003TB-KL for emacs-orgmode@gnu.org; Sat, 04 Oct 2008 04:53:37 -0400 In-Reply-To: (Carsten Dominik's message of "Wed, 01 Oct 2008 21:26:37 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org Hello, Carsten Dominik 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