From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 3LZbF7Md42AZowAAgWs5BA (envelope-from ) for ; Mon, 05 Jul 2021 16:56:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 2MZnErMd42CAXQAAB5/wlQ (envelope-from ) for ; Mon, 05 Jul 2021 14:56:51 +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 875831A749 for ; Mon, 5 Jul 2021 16:56:50 +0200 (CEST) Received: from localhost ([::1]:34070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0Q1h-0000Mr-JL for larch@yhetil.org; Mon, 05 Jul 2021 10:56:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0Q0l-0000Gm-CA for emacs-orgmode@gnu.org; Mon, 05 Jul 2021 10:55:51 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:42788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0Q0i-0004sU-AR for emacs-orgmode@gnu.org; Mon, 05 Jul 2021 10:55:50 -0400 Received: by mail-wm1-x332.google.com with SMTP id j16-20020a05600c1c10b0290204b096b0caso147970wms.1 for ; Mon, 05 Jul 2021 07:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=TydawZtFqOoCP99GlDoWtxzCuntE1m24r1UCtcAyXKw=; b=Y2OQBGwBB7kPmPt4YX6qqtDei+OkPgkiM9xW518dps1AZXvEUlN0SAHVKk8fzPmI9r a6YFOt4a2LvfFopQR16LkCoq1SsG2pljc2wCSvvkDXsZElN6f7hPtg5pblFboWu3a2yA r4zU5mkbsaxVPTH9APqSgcAMADYhFTlYtEsa6I8RYOhSel88Ferb9x+9qjtSfMELsvHm OzDfpxJu+msrEQ7lpuIe0/5qR1HPi4Awy0sVmXXhAqjf3kDVABNG34Ya+SE4idf/6L/O jAC2ZsJ1MBsC4GfN3BFsnPWnv2A0GliMRMFN4pF8wwDTqHWgS3Mb2n+fKMCmHA+zhl/R dqAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=TydawZtFqOoCP99GlDoWtxzCuntE1m24r1UCtcAyXKw=; b=O1N/B0yQBOvlwnFyHx77dAJKmsrugDYYf353ILEC/A9jr0T8aYhIrTocz0cCLogRUg 2K2AZzV7701ejEdRLsSvi4T66JLNCVo3UCOuauex0PjRfyB4UHrkKH8gf2cbVYY3Zdw2 aNdhbp08K14FhKDkzFnk2FAM9g7LwA8ni8BgfGvpYOxhiaJQyOcXK/BErwZHpn+5I/O1 dAih7a6gLCeJst9XQASsrLJumeALH3HAvBc+9pG0/jQJEJaajjO+r5RcEe6wsftjbWMo M+LnSFPPXnIcr20fJkou2fxhHLX7xoMiNapeZP5buJFBNNA39QRvaqmbeiWhU8vuo8Up +UWw== X-Gm-Message-State: AOAM531NIR7BZvuouao96XOPopgyM8d1JiteYe7kdTcHZ5FicuSKBGed NUfI4wGxMr/ODz2onGOD7nQ3Ss5lqk7x896+81MiL66s7eI2BQ== X-Google-Smtp-Source: ABdhPJzOTp6MulSTkioeK27q/0YbXXZN5c0EtNXFW4oyS5a42y/jg75HoX8MTmGGgNuSoGCscx3EEsNtEF4vKVTJ0nc= X-Received: by 2002:a05:600c:3b0b:: with SMTP id m11mr15426564wms.162.1625496946063; Mon, 05 Jul 2021 07:55:46 -0700 (PDT) MIME-Version: 1.0 References: <87h7h9c2nw.fsf@mat.ucm.es> <87zgv0alwt.fsf@ucl.ac.uk> In-Reply-To: <87zgv0alwt.fsf@ucl.ac.uk> From: Tim Visher Date: Mon, 5 Jul 2021 10:55:10 -0400 Message-ID: Subject: Re: how to document/comment a complex org table formula To: Org Mode List Content-Type: multipart/alternative; boundary="0000000000000dbca905c66180fc" Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=tim.visher@gmail.com; helo=mail-wm1-x332.google.com 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625497010; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=TydawZtFqOoCP99GlDoWtxzCuntE1m24r1UCtcAyXKw=; b=VTPk9QEgg0jMTiqTxSOPkwM9v9gRz61WbeSiWEJ6L3OnOBJRnDP3DioFL+ZCv3mruDaIqo LhyLWPsByo92PUskCzBGHVA9XSVXDi+UF9NXItNjft9EdfTNea6NyqdLramUZF0NNfxCj7 8fU5cs0wdSPBt37pS9z7/rDdYnKO+tbkeqKo+clSIGODmBS8BFDyi8Ca8s6E3tS+510fYK N2SaUM0yRGZf2dws4jJ5xBOKoc/aGfDaYnlqXOn0LqWPq24kCWFzmbO52xSzrRV7Ul55bN B8tLRXWAPm5Ay/d7G7NXBZXUMQLOtTV81/DbWSAz74Z6ZzfbGi71zjRuiRzS6g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625497010; a=rsa-sha256; cv=none; b=R1Jek53WM7oNHjDD0o7VDWCzNOfSgPSLpBdlFN/zZgrGwauWsbOI1c6bF/emft4VW+Z5Yb BdY5HH4UTBw8DQ7SLctOddVbdKUJFOo02DP7PzOqu7hX3/JDcA9k4qp1/IgLIua5oYKUaR pF8rpHPUPFjrD1/20iqx264KXAIGq5lXiEXPcClJfTszJu+Ncjzma1QUI1o8qJAWoLjDBz yqoWKA7iFFnFRxPnKEwPCzo7BWGNpPr2AoReQKnSrOHnvTjLbHMgRt6vK1isSQlWNXsvg9 VyWXCDNwVvuTzO+3UKxtiETM2gpVKHRRw13ieZVYdvZqhITK18Kzc31O6Qm7NQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=Y2OQBGwB; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Spam-Score: -3.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=Y2OQBGwB; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Queue-Id: 875831A749 X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: mEE90blsZXbS --0000000000000dbca905c66180fc Content-Type: text/plain; charset="UTF-8" On Mon, Jul 5, 2021 at 10:14 AM Eric S Fraga wrote: > Sorry; I cannot help you directly. > > My rule of thumb is that if formulas are getting too complex to > understand/recall clearly, it's time to use a proper programming > language instead. The nice thing about org is you can have tables as > inputs to and outputs of src blocks... > > My papers often have awk source blocks that process tables to generate > statistics for some (numerical) experiments. > > Spreadsheets, org tables being an example of such, are brilliant tools > for simple calculations but are pretty much "write only programming > languages". > I had never heard of using an org table as input into a source block. That's really interesting. The OP also poses an interesting idea that I have occasionally wanted. I have generally accomplished this by simply including the documentation above or below the table. In other words just having human text around it that says 'This =formula= bit is because of X'. But the idea of a multiline TBLFM syntax seems to be already be almost supported. I was mildly shocked to find that this mostly works ``` |---+---| | a | 1 | | b | 3 | |---+---| | | 4 | #+TBLFM: @2$2=@-1*3 #+TBLFM: @3$2=vsum(@I..II) ``` Note that I don't need the usual `::` separation between formulas. Where it breaks down is that I can't seem to reevaluate the whole table's formula by whacking `C-u C-c C-c` anymore and, obviously, there's no syntax for adding comments. Also I doubt that I'd be able to use any of org's keys for editing formulas. I wonder how hard it would be to extend org's understanding of the TBLFM to allow for this kind of syntax. Once you had it then adding a comment character to it should be very simple. -- In Christ, Timmy V. https://blog.twonegatives.com http://five.sentenc.es --0000000000000dbca905c66180fc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Jul 5, 2021 at 10:14 AM Eric S Fr= aga <e.fraga@ucl.ac.uk> wrot= e:
Sorry; I cannot help you directly.

My rule of thumb is that if formulas are getting too complex to
understand/recall clearly, it's time to use a proper programming
language instead.=C2=A0 The nice thing about org is you can have tables as<= br> inputs to and outputs of src blocks...

My papers often have awk source blocks that process tables to generate
statistics for some (numerical) experiments.

Spreadsheets, org tables being an example of such, are brilliant tools
for simple calculations but are pretty much "write only programming languages".

I had never heard of u= sing an org table as input into a source block. That's really interesti= ng.

The OP also poses an interesting idea that I h= ave occasionally wanted. I have generally accomplished this by simply inclu= ding the documentation above or below the table. In other words just having= human text around it that says 'This =3Dformula=3D bit is because of X= '.

But the idea of a multiline TBLFM syntax se= ems to be already be almost supported. I was mildly shocked to find that th= is mostly works

```
|-= --+---| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
| a | 1= | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
| b | 3 | = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
|---+---| =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
| =C2=A0 | 4 | =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
#+TBLFM: @2$2=3D@-= 1*3 =C2=A0 =C2=A0 =C2=A0
#+TBLFM: @3$2=3Dvsum(@I..II)

```
=

Note that I don't need the usual `::` separat= ion between formulas. Where it breaks down is that I can't seem to reev= aluate the whole table's formula by whacking `C-u C-c C-c` anymore and,= obviously, there's no syntax for adding comments. Also I doubt that I&= #39;d be able to use any of org's keys for editing formulas. I wonder h= ow hard it would be to extend org's understanding of the TBLFM to allow= for this kind of syntax.

Once you had it then add= ing a comment character to it should be very simple.

--

In Christ,

Timmy V.

https://blog.twonegatives.com
http://five.sentenc.es
--0000000000000dbca905c66180fc--