From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cDElB0O8ml9lOwAA0tVLHw (envelope-from ) for ; Thu, 29 Oct 2020 12:57:39 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yBryAkO8ml9pPwAAB5/wlQ (envelope-from ) for ; Thu, 29 Oct 2020 12:57:39 +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 6B73F9400BF for ; Thu, 29 Oct 2020 12:57:38 +0000 (UTC) Received: from localhost ([::1]:34946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kY7Um-00083X-Kd for larch@yhetil.org; Thu, 29 Oct 2020 08:57:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kY7Eb-0004cl-Fe for emacs-orgmode@gnu.org; Thu, 29 Oct 2020 08:40:53 -0400 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:47620 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kY7EW-0000B6-2g for emacs-orgmode@gnu.org; Thu, 29 Oct 2020 08:40:53 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kY7ER-0001J0-Rm for emacs-orgmode@gnu.org; Thu, 29 Oct 2020 13:40:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: =?UTF-8?Q?Re=3a_Bug=3a_Can=e2=80=99t_assign_to_hline_relative_refer?= =?UTF-8?Q?ence?= Date: Thu, 29 Oct 2020 19:40:37 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/29 08:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.261, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=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.41 X-TUID: gFu8Za1smHsK 2020-10-23 Dante Catalfamo wrote: > That seems to work for the most part, but now I'm experiencing a strange > difference when evaluating. If I use a formula like > > #+TBLFM:@2$3..@23$3=if($2!=0,12*$2,$3);%.2f::@24$2=vsum(@I..@II);%.2f::@24$3=vsum(@I..@II);%.2f > > The column gets evaluated first, then the sum at the bottom gets > evaluated, resulting in what I'd expect. But if I use a formula like > > #+TBLFM:@<<$3..@>>$3=if($2!=0,12*$2,$3);%.2f::@24$2=vsum(@I..@II);%.2f::@24$3=vsum(@I..@II);%.2f > > The sum gets calculated first, and the column after, meaning the sum > doesn't reflect any changes made before calculation. I find this pretty > strange considering the formulas are in the same order. Do formulas > involving relative references get calculated last for some reason? Interesting... However my curiosity is not strong enough to find appropriate place in the code. Either I never tried such combination of references (I use @>$2=... for the last row) or I have not expected reliable evaluation order and just hit C-c C-c several times. It seems that single cell formulas are calculated later than ranges | a | c | b | |---+---+---| | 2 | | | | 3 | | | | 4 | | | | 5 | | | | 6 | | | | 7 | | | |---+---+---| | | | | #+TBLFM: @<<$3..@>>$3=$1*2 :: @<<$2..@<<<$2=$3*3 :: @5$2..@6$2=$3*4 :: @4$2=$3*5 :: @>>$2=$3*6 | a | c | b | |---+----+----| | 2 | 0 | 4 | | 3 | 0 | 6 | | 4 | 0 | 8 | | 5 | 0 | 10 | | 6 | 0 | 12 | | 7 | 84 | 14 | |---+----+----| | | | | #+TBLFM: @<<$3..@>>$3=$1*2 :: @<<$2..@<<<$2=$3*3 :: @5$2..@6$2=$3*4 :: @4$2=$3*5 :: @>>$2=$3*6 Notice zeroes for @<<..@<<< but not for @>>. Even more funny that @>>>>>>>$2..@>>>>>>$2=$3 instead of @<<$3..@<<<$3 give non-zero values for the second and third rows. Anyway I do not plan to memorize such rules. By the way, I have noticed that @<<$3..@>>$3=... likely could be replaced by just $3=... and it is evaluated quite early in such form. Skimming through the manual previous times, I missed the point of "column formulas" https://orgmode.org/manual/Column-formulas.html or [[info:org#Column formulas]] and have noticed the details just today.