From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UJFNOkJ7CF8IcQAA0tVLHw (envelope-from ) for ; Fri, 10 Jul 2020 14:29:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QAxLNkJ7CF+AdgAA1q6Kng (envelope-from ) for ; Fri, 10 Jul 2020 14:29:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 47A6D940B77 for ; Fri, 10 Jul 2020 14:29:22 +0000 (UTC) Received: from localhost ([::1]:39994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtu1g-000707-Md for larch@yhetil.org; Fri, 10 Jul 2020 10:29:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtu1H-0006zz-2N for emacs-orgmode@gnu.org; Fri, 10 Jul 2020 10:28:55 -0400 Received: from devianza.investici.org ([198.167.222.108]:55441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtu1A-0004zj-2s for emacs-orgmode@gnu.org; Fri, 10 Jul 2020 10:28:54 -0400 Received: from mx2.investici.org (unknown [127.0.0.1]) by devianza.investici.org (Postfix) with ESMTP id 6105BE0662; Fri, 10 Jul 2020 14:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anche.no; s=stigmate; t=1594391325; bh=/6Kr6L45P6Aqu6ukyHw6rwd6WpcK0bUYtenVKFiSYsM=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=KFzgOIhMTRYCRmwDpPNM3kTFZW6OjEBe3bIXbPu/6NStbeOoYdqze94xfDpzBqTbj gKQ7HeKVoHNjz/0kEY5YAkB+iny+xzaoBUKt49DBeKAZitoAH7Gs+joF47r/FLzbP2 mg8ikMCZaH31m/OuiHb/CiMUGdCXWNzH7MLLqzFM= Received: from [198.167.222.108] (mx2.investici.org [198.167.222.108]) (Authenticated sender: mariotomo@inventati.org) by localhost (Postfix) with ESMTPSA id 2E4EAE0648; Fri, 10 Jul 2020 14:28:43 +0000 (UTC) Subject: Re: empty/nil in table cells To: emacs-orgmode@gnu.org References: <87a7084afo.fsf@nicolasgoaziou.fr> From: Mario Frasca Message-ID: Date: Fri, 10 Jul 2020 09:27:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87a7084afo.fsf@nicolasgoaziou.fr> Content-Type: multipart/alternative; boundary="------------E5C396D93152A3DE1E31CC46" Content-Language: en-US Received-SPF: pass client-ip=198.167.222.108; envelope-from=mario@anche.no; helo=devianza.investici.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/10 10:28:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Brand Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=anche.no header.s=stigmate header.b=KFzgOIhM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.29 X-TUID: MOREyPcDZvUs This is a multi-part message in MIME format. --------------E5C396D93152A3DE1E31CC46 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 09/07/2020 16:59, Nicolas Goaziou wrote: >> and it simplifies a lot writing functions. > How so? thank you Michael, for answering Nicolas' question, in a different and much structured way than I did in my original message. the formula you provided —I reduced it slightly, hard coding a constant— looks like this: (if (> @# 4) (format "%.2f" (/ (apply '+ (subseq '(@I$2..@II$2) (- @# 1 4) (- @# 1))) 4.0)) ""));N my impression is this programs in the spreadsheet something that should be part of the org-table software. if we let references leading outside the table return 'nil instead of raising an error, and represent 'nil by the empty string, then this is enough: (when (> @# 4) (/ (+ @-3$2..$2) 4.0));L%0.2f my suggestion is to associate 'nil with empty cells "both ways", in the sense that a formula returning 'nil causes an empty org-table cell (see above), and that the empty cell, through the L filter evaluates to nil and not to the empty string.  this for symmetry, and for uniformity with reference leading outside the table. regards, MF --------------E5C396D93152A3DE1E31CC46 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 09/07/2020 16:59, Nicolas Goaziou wrote:
and it simplifies a lot writing functions. 
How so?

thank you Michael, for answering Nicolas' question, in a different and much structured way than I did in my original message.

the formula you provided —I reduced it slightly, hard coding a constant— looks like this:

(if (> @# 4) (format "%.2f" (/ (apply '+ (subseq '(@I$2..@II$2) (- @# 1 4) (- @# 1))) 4.0)) ""));N

my impression is this programs in the spreadsheet something that should be part of the org-table software.

if we let references leading outside the table return 'nil instead of raising an error, and represent 'nil by the empty string, then this is enough:

(when (> @# 4) (/ (+ @-3$2..$2) 4.0));L%0.2f

my suggestion is to associate 'nil with empty cells "both ways", in the sense that a formula returning 'nil causes an empty org-table cell (see above), and that the empty cell, through the L filter evaluates to nil and not to the empty string.  this for symmetry, and for uniformity with reference leading outside the table.

regards,

MF

--------------E5C396D93152A3DE1E31CC46--