From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marco Wahl Subject: Re: ob-calc duplicate stack-element issue Date: Wed, 18 Mar 2020 17:23:39 +0100 Message-ID: <8436a5ljhw.fsf@gmail.com> References: <9eed12f5-face-eb4f-4006-e8ee7890e0a9@webbedtables.de> <84fte5lnyd.fsf@gmail.com> <87fte57jd2.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33308) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEbTt-0005C6-De for emacs-orgmode@gnu.org; Wed, 18 Mar 2020 12:23:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEbTs-0003dp-Cu for emacs-orgmode@gnu.org; Wed, 18 Mar 2020 12:23:45 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:54496) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEbTr-0003ct-FB for emacs-orgmode@gnu.org; Wed, 18 Mar 2020 12:23:43 -0400 Received: by mail-wm1-x329.google.com with SMTP id n8so4125702wmc.4 for ; Wed, 18 Mar 2020 09:23:42 -0700 (PDT) In-Reply-To: <87fte57jd2.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Wed, 18 Mar 2020 15:50:17 +0000") 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: e.fraga@ucl.ac.uk Cc: Heiko Schmidt , emacs-orgmode@gnu.org Eric S Fraga writes: > On Wednesday, 18 Mar 2020 at 15:47, Marco Wahl wrote: >> AFAICS at the org babel calc evaluation the last value of the calc stack >> gets dropped. >> >> So your workaround is okay, I think. You can just write any dummy >> element at the bottom of each block e.g. just 0. No need of >> duplication. Looks a bit hackish to me but so what? > > Indeed hackish. But it does beg the question: why does ob-calc pop the > stack? I cannot see any use case given that the stack is essentially > infinite and can be safely ignored (in most if not all cases). > > Could the solution be to simply remove the =(calc-pop 1)= line at the > end of =org-babel-execute:calc= function? > > Just a thought. Possibly the originators thought about the typical use of calc blocks as units which reduce to the top element of the stack. In this case the calc-pop would be the right step to clean the stack. Just another thought. Ciao, -- Marco