From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id PCswKVsNRWSIJAEASxT56A (envelope-from ) for ; Sun, 23 Apr 2023 12:50:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0M5RKFsNRWR4DAAAauVa8A (envelope-from ) for ; Sun, 23 Apr 2023 12:50:03 +0200 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 3E58B2DA57 for ; Sun, 23 Apr 2023 12:50:03 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqXGj-0002eP-ND; Sun, 23 Apr 2023 06:48:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqXGg-0002du-OS for emacs-orgmode@gnu.org; Sun, 23 Apr 2023 06:48:31 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqXGd-0000iK-EE for emacs-orgmode@gnu.org; Sun, 23 Apr 2023 06:48:29 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 8F2B1240158 for ; Sun, 23 Apr 2023 12:48:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1682246904; bh=8GO2C95LAT6M72kgtTYcT/HBg6dYBG2x3/Kl7p6lckk=; h=From:To:Cc:Subject:Date:From; b=U3XHnq28CxFqio1xRf4mNctuap+CxQEyu2vy6aW7yiefEhtxx3HqJboUGMHWjyFfV Qfcpw5PQA/pMX67q3Gdy2TQ1IJEKunrQilYSgdZeTLI6nagW3+6rDmXKko7GzKKqS2 P1nbRpcBBu10J8Y04b1hwr9EOn7VuNTCA0QvHkF7rrQZMJgzSfq5YoBA6MrySxcFFj DAaYt0ugUAX0zDyDhLNXq6JNTwboe7Lj6ukaNIFCiSQ/PD0fLW0m5DrKYiSDU137SK VnzAYwuGwUHfqo5n0XhKgukXVgtuyzr/1Sat3XUsO3kS/9EyONb+44CuOxYtoIukSP cWXQ4gPv2wJig== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Q44k00kqmz6twd; Sun, 23 Apr 2023 12:48:23 +0200 (CEST) From: Ihor Radchenko To: Jeff Trull Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] text cell contents have extra parentheses when used in formulas [9.6.4 ( @ /home/jet/.config/emacs/elpa/org-9.6.4/)] In-Reply-To: References: Date: Sun, 23 Apr 2023 10:50:59 +0000 Message-ID: <87leiiub1o.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682247003; a=rsa-sha256; cv=none; b=bJOaEe/F5Q2gDEbrCvhBlcO8kSVeQ77GtKJwOuTeB1NlN6VH19c4jR1nRf2rlKccO4HgaA HDfm3874Pd1wqIoB5X17EBjSMd8tFFhS/w2vBN88F5XIroQWy7I+iX50AqqEsGlIxvkQ1j PfXnJuD2z/RJROfPAMFFsCy1FX65+EuDTQhs5geOvVbMvVR4s5FA8CRxMFEKJQo43lf+pV ZUsVX6vZU+aBBBKI9H2ns1XXf11JqX2jSxyKNvm10i3aQN/8h7W1uztDhpQkx/ojMez1zr c7Axk81XdaUpgmcrX9SmJZYqxDO+OlVDgEeieU4fYqz2q5q7rbIGCDpEO+qymQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=U3XHnq28; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682247003; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=o0qgiZeoqk3hqr23558yAejVFL67OjKsHytXUohzSmk=; b=OJAGqlA+wcjIRg9ZJC/RXLwsALEmesattPRxNygVcCvJcqlyvopytMT0eFwezCx44lO3hY Wp+3lP7gRTMeedsbku6NsIIc/etENyytfUjcmWIq1xpPxzHcjcjR86uyIL4UzuEpx3Z0dm bysaDC68TGGWi3ux/l15qSyTnVqV+xdF+/obBnMyqaOX/MfBSw5iPNoJjQPDw/hAwVutcX 2sxYYM0ILmHmcqqTNWgIKkGVTkUCVuX+H51FEvDjIJ5isb/+H/uwcQ8vJIdAhoiMgGng6w FA+TQgiSzajTM5+5v8/ncsu660mcYTSs2gdaSEhPEXyg8JBVF1FQoqRWvsoqrQ== X-Migadu-Spam-Score: -6.00 X-Spam-Score: -6.00 X-Migadu-Queue-Id: 3E58B2DA57 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=U3XHnq28; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: O3Sop5IhDw3Z Jeff Trull writes: > Expectation: when using cell contents as strings in a formula, the > strings should contain exactly the cell's text contents > > Actual: the resulting string is wrapped in parentheses This is actually expected, although surprising. > I can find nothing in the documentation that suggests this is expected, > and it is quite unintuitive if you want to (for example) filter on > a column. In short, do not use ". For filtering, see 3.5.7 Lookup functions. > #+TITLE: text formula repro > > | Key | Value | > |-----+--------------| > | A | [40, 65, 41] | > | B | [40, 66, 41] | > #+TBLFM: $2="$1" > > Here you can see that the contents of the Key column were wrapped in > parentheses (ASCII 40 and 41) when turned into strings. If you turn formula debugger on (M-x org-table-toggle-formula-debugger), you will see the following (I also added extra explanations): Substitution history of formula Orig: "$1" ;; begin calculation of $1 field value $xyz-> "$1" ;; after handling relative references @r$c-> "$1" ;; after handling cell references $1-> "(A)" ;; after handling column references; the (...) is added ;; because of Calc syntax to ensure that values inside ;; cell are grouped. There is no notion of strings in GNU ;; Calc (AFAIK). So, (...) grouping always represents ;; algebraic Calc expression. Result: [40, 65, 41] ;; (calc-eval "\"(A)\"") Format: NONE Final: [40, 65, 41] As you can see, we passed the formula to GNU Calc. However, "foo" in GNU calc is nothing but a vector of characters. So, $2="$1" is not what you anticipated. You may refer to 3.5.2 Formula syntax for Calc where we put a reference to GNU Calc manual. It is out of scope of Org manual to describe how GNU Calc works. Do note that an alternative formula syntax is using Elisp (see 3.5.3 Emacs Lisp forms as formulas). You can use that syntax if you prefer it over GNU Calc. Canceled. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at