From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Banel Subject: Re: table formula help... Date: Mon, 08 Dec 2014 22:57:38 +0100 Message-ID: <54861ED2.1060908@free.fr> References: <87ppbxfi5f.fsf@ericabrahamsen.net> <54838805.8090705@free.fr> <8761do6t01.fsf@ericabrahamsen.net> <5484CD5C.9070604@free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy6JN-0001iI-M3 for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 16:57:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xy6JI-0006Ql-Rn for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 16:57:45 -0500 Received: from smtp5-g21.free.fr ([212.27.42.5]:64115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy6JI-0006QJ-MN for emacs-orgmode@gnu.org; Mon, 08 Dec 2014 16:57:40 -0500 Received: from [IPv6:2a01:e35:2e21:def0:c90f:b89b:d367:7611] (unknown [IPv6:2a01:e35:2e21:def0:c90f:b89b:d367:7611]) by smtp5-g21.free.fr (Postfix) with ESMTP id 06873D4803C for ; Mon, 8 Dec 2014 22:56:21 +0100 (CET) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Le 08/12/2014 19:02, Michael Brand a =C3=A9crit : > > Good. My opinion is about to replace it with what. > > https://github.com/tbanel/orgaggregate#empty-and-malformed-input-cells > says: > > An input cell may be empty. In this case, it is silently replaced > by zero. In an output cell, if the computed result is zero, it not > output, leaving a blank cell. This allows for empty input cells to > result in empty output cells. > > I understand the intention very well (the proof is in the references > at the bottom ;-) ). Nevertheless I find the compromise goes too far > when in the following example the sum and mean for a0 and b0 are > empty. I would prefer 0 there even when for the time being it is at > the cost of that c results in a sum and mean of 0 too. You instantly found the weakness of the current design! > It would mean to remove the above "In an output cell, if the computed > result is zero, it not output, leaving a blank cell. [...]". I'm inclined to agree with you. Dropping the /zero output becomes blank/ feature would be the best short-term compromise. > Or - when > you want to bother with the implementation - to change it into "If all > input cells of a computation are empty then the result cell is left > empty.". Yes, this is the correct specification. Testing that *all* inputs are bla= nk. Unfortunately, implementing this is a lot of work, because we need to create new data structures to remember whether input fields are blank. > #+TBLNAME: original > | Item | Value | > |------+-------| > | a2 | 1 | > | a2 | 1 | > | a0 | -1 | > | a0 | 1 | > | b2 | 2 | > | b2 | | > | b0 | 0 | > | b0 | | > | c | | > | c | | > > #+BEGIN: aggregate :table original :cols "Item sum(Value) mean(Value)" > | Item | sum(Value) | mean(Value) | > |------+------------+-------------| > | a2 | 2 | 1 | > | a0 | | | > | b2 | 2 | 1 | > | b0 | | | > | c | | | > #+END > > Could you please add this example or something in the same sense to > the unittests.org before any other change? Good idea. I'll do that. > https://github.com/tbanel/orgaggregate#empty-and-malformed-input-cells > continues: > > The empty cell handling may be changed in the futur. For instance, > we may want to compute an average aggregation ignoring empty cells > (right now, empty cells contribute to the average by pulling it > toward zero). > > As I understand orgaggregate already uses Calc vectors. Yes. > Maybe then it > could use and benefit from org-table-make-reference which has the > necessary arguments and asks for a Lisp list? See > testing/lisp/test-org-table.el: > - The application of the mode string variations for TBLFM are in > test-org-table/references/mode-string-*. > - The same variations for org-table-make-reference are in > test-org-table/org-table-make-reference/mode-string-* > Definitely interesting. Someone else has already bumped into the empty cells thing. > Michael Thierry