From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephan Neuhaus Newsgroups: gmane.emacs.bugs Subject: bug#46750: calc defmath let* behaviour surprising, inconsistent, or wrong Date: Wed, 24 Feb 2021 13:40:50 +0100 Message-ID: <83591a19-5f5a-bd87-6d0b-7317613a88ce@zhaw.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12649"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 To: 46750@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 24 14:33:31 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEuIF-0003AN-5K for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Feb 2021 14:33:31 +0100 Original-Received: from localhost ([::1]:60880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEuIE-0002Px-6E for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Feb 2021 08:33:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEu4G-0006KD-Hz for bug-gnu-emacs@gnu.org; Wed, 24 Feb 2021 08:19:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lEu4G-0007LE-0A for bug-gnu-emacs@gnu.org; Wed, 24 Feb 2021 08:19:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lEu4F-0001X7-TE for bug-gnu-emacs@gnu.org; Wed, 24 Feb 2021 08:19:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stephan Neuhaus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Feb 2021 13:19:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46750 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16141726985809 (code B ref -1); Wed, 24 Feb 2021 13:19:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Feb 2021 13:18:18 +0000 Original-Received: from localhost ([127.0.0.1]:33874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEu3W-0001VX-4y for submit@debbugs.gnu.org; Wed, 24 Feb 2021 08:18:18 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEti1-0000wh-7b for submit@debbugs.gnu.org; Wed, 24 Feb 2021 07:56:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEti0-0002TN-UJ for bug-gnu-emacs@gnu.org; Wed, 24 Feb 2021 07:56:04 -0500 Original-Received: from mail-zr0che01on2087.outbound.protection.outlook.com ([40.107.24.87]:54561 helo=CHE01-ZR0-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEthv-0005p1-Vg for bug-gnu-emacs@gnu.org; Wed, 24 Feb 2021 07:56:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bOWPSpPhumLhvUZ6Hou2bMKv2O245BIC6pbhtuDG7iBEjAAOoONmPXM3EUCZ8mEvRgT30vxKIFFI1/vgIlwnm+4Pcz8tUhDCe3g1xicm88AmZ1dWn3q0NbAEomQsixyvNfCYctds47lJN9AV9FvdJ1yf7svUM4UGtG9CavUDGgtrP9IqzRF66wzRz8tJP0sLYcT7aJdxpp7qB1tXtZjRK+zOEFtOfyLlhom/H8gaqGID7onbQBVhbxsppj58spE1KPco5BKiTcalUw4S9/TQ/O2OTs0Xdn+FJvBNDkqTpx/n3Uz2geNs6sHOLeOj+QyhvoAi3Y63QQfCCig0TL0FLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IHSg7fHOZax7zGCvQOJpJd6y7iO3yjLXWDnt6r67fqs=; b=oTOWD1wL2Gj4HchYh0rYFyoFwD3RL/YRYAv65EpE+crhVtqmFed+LKNww1czjzL02fwZx5KCbHapIw+dEIGIASwdHUVfQCujWr2dYWLB7gfwrhtkg9uMvrjSB5Y+wCGO1yuMTLl3jsRyMpy0KhqwQSHzGXaF8tGT85sTd8yqYpM+MFb29T2dbyZkErrG11uRnXAksq0dmyOCxfpP1ch/1C3LMG8h0AudJ7fWHClsWf4BAlXTdlTC/Lz0hDFZImoQ0sc8GKS9xmW6qU55k46l9D/6HxSZNLEuYP+2aS2KD6p0d1Aa2aHIfFf4lC4r50kkg9uZCt4rRs2+wmKJuk5Yzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=zhaw.ch; dmarc=pass action=none header.from=zhaw.ch; dkim=pass header.d=zhaw.ch; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zhaw.onmicrosoft.com; s=selector2-zhaw-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IHSg7fHOZax7zGCvQOJpJd6y7iO3yjLXWDnt6r67fqs=; b=hV7165UrjySneEwlkqXfs7VMxYlSs7/QG/B2fJdVdgGS/aPvRuFoOruS55DhLCbBTks3RYdhz8wIcdRRr7pUV76rJNJ+AqhtIKWMpS4z7qqKgBj/FkA+y4VnOGnI2ZKJ7KnpwnWnFj3rCosOVHZNKtPHQ6iIF5hnnFmbkFrcTGg= Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=zhaw.ch; Original-Received: from GVAP278MB0485.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:36::12) by GVAP278MB0136.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:22::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Wed, 24 Feb 2021 12:40:51 +0000 Original-Received: from GVAP278MB0485.CHEP278.PROD.OUTLOOK.COM ([fe80::8859:f9f:2ea0:4dea]) by GVAP278MB0485.CHEP278.PROD.OUTLOOK.COM ([fe80::8859:f9f:2ea0:4dea%3]) with mapi id 15.20.3868.034; Wed, 24 Feb 2021 12:40:51 +0000 Content-Language: en-US X-Originating-IP: [2a02:aa12:3202:4780:2db1:3f8b:8b3f:f69] X-ClientProxiedBy: GV0P278CA0065.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:2a::16) To GVAP278MB0485.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:36::12) X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from [IPv6:2a02:aa12:3202:4780:2db1:3f8b:8b3f:f69] (2a02:aa12:3202:4780:2db1:3f8b:8b3f:f69) by GV0P278CA0065.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:2a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Wed, 24 Feb 2021 12:40:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea7c9740-92a0-4be6-117e-08d8d8c16b70 X-MS-TrafficTypeDiagnostic: GVAP278MB0136: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wYSHZpl7cQ9BXINK4KYG1xEyzi6E2CJ6vyiDSunOSNquxX1yMeiMXAa6PpI//3qgieLeaYqMRnvyvbHe5qmbAedyYuJEeTcnIKQOvcLyjUdx1ES66VwaJWcn1V8z8pIhodPkV6OJ0KuKQEJjrHl/LIdaRYyAiEIxWNl7FcZvLW/mGMLPV6X9ZprkcncZgjZ1yIFVPM/cLdGTQ4oBTO6gl95moJvf4vg/dkjvFBsIs4my6x3rVWWwSFxFsw1kKkleAISpn4vEBFyaX4jEQN74tGOsSNzhMYrC0BBll9yxaRBAL/uQviuaCeasSRTdlYLwBrKsyKknSz5xZ2nkE5oOrMzTv54zc6X+IbvFnTUIw7/jw8Q2FG65PjHHWfScoW3H8fxVLhwYCiW4YUV2Mivbr1i+P9c29C7wUWBceR8Vxao6A1n9h4wkPF1ujG2q6IO9NU+VgJkxi/N8e5GSVg1QGcJpAUHUklB/Hlt4mhVTUS4gEduJiQKpVBaH7HWdVdIdKWJA/Pvt0x0UWfFfgOsgKygqZkwG5Yf0deiw77qyr+0gqvGCCOchZsXsj0RBSfS4uPyiza21u4xs0uuPUVUmm6iXD3KNc4uXfAjh0Vy0MIo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GVAP278MB0485.CHEP278.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(346002)(376002)(136003)(39850400004)(8936002)(478600001)(8676002)(6486002)(316002)(5660300002)(16526019)(2616005)(6916009)(52116002)(31686004)(786003)(66556008)(66946007)(186003)(66476007)(83380400001)(36756003)(31696002)(2906002)(44832011)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 78yBihMjxnpq/pdM7CTnsyFLv9RvP4yu91oEZCo+ZTWB3WaXsak7U4lm6KyYtJLqC6A5ZoN6CVkoEOx2dInAqeNZgtAi6LUzrQ5gh1hQ7qi2x2hYA0R4Zwn78uwR4k8aYazU+enhuAK5VP38p+CraVINcw/58oIszFz60Y8NCluCyoYr9hjU32Xlwm6BRDMqVh8dLDrNdhhI6LRrhMrBdam7s5d+FalJ32uPkFWaDFh4MKDixomo+PnXn+3xmIx782dtnJdEroGSqMNRXHSyYhxHTSfMTBAZ0e8rhaxjjhzxVvOOJL6Tp4th1zffWS6CGMsBDVCsShsGqmoW3780a1EEBGvBTsb+ZHyk9calCAyEjvnCLMpjTwmH12GjH7xamwbWzEGSHAm3y0xEo6SWPLCkidQ72rExT+LAK4KGwTZRLBd+j23OfxKpMGfIt74lidASHyjYOs94NV0es6EPOD6+qjdbdkYZzJQDxZRwALuhH6SAkFWkdNEYXwlIsdn0GEFlMa1ZMiQxMVE8RgPi7ZV6Ilko4BnyT+Co/ai8d7Ubl5d//vDTczQIL8qU1BtmL/nUbz+aBtoX5GypUYb1gp7zQD1+SNq5NLgSYQisKDedp1IEPm65R5mqsbx3mOl1f+fj/xbxkTSsClYakQ1BbWqk8iy8hXqaodtNUMZ6VtiGI3BOBsSCFirqLqv8C0IcLD6EAu/yAxgLtZOlfwD658pCrbyBZgRh5Q7LUEBvQTiFtj2U2c9bO0RMAsW3 hfzMRZ8QjkwpcqBLHhGMKAwh+Qqpq9pJngaQtVnxrHLEwpO3lAYOfhzXE4DnBBVKFS9MrRuQ8KkH1VKNn/lyD08OycoyHEaQ0D X-OriginatorOrg: zhaw.ch X-MS-Exchange-CrossTenant-Network-Message-Id: ea7c9740-92a0-4be6-117e-08d8d8c16b70 X-MS-Exchange-CrossTenant-AuthSource: GVAP278MB0485.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2021 12:40:51.7133 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d1a9f9d-201f-4a10-b983-451cf65cbc1e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DTWoozd9M7MR7pzXWHb+IsD5dQNU90GFvQWQzEZ2tyurHDx4OOf3aIIWlt5V6r64 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVAP278MB0136 Received-SPF: pass client-ip=40.107.24.87; envelope-from=neut@zhaw.ch; helo=CHE01-ZR0-obe.outbound.protection.outlook.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 24 Feb 2021 08:18:16 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200713 Archived-At: Dear maintainers I can't seem to understand the calc documentation, or I may have found a bug. You decide :-) My system "GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-09-23, modified by Debian" I'm trying to define a calc function f() for use in org mode. Here is a minimal example of what I've tried. It's not the same function, but it exhibits the same behaviour. Put this text in a buffer with org mode: #+BEGIN_SRC emacs-lisp (defmath f(x) (let* ((m x) (n (+ m 1))) n)) #+END_SRC #+RESULTS: : calcFunc-f | x | y | |-----+--------| | 1.0 | f(1.) | | 1.5 | f(1.5) | | 2.0 | f(2.) | | 2.5 | f(2.5) | | 3.0 | f(3.) | | 3.5 | f(3.5) | | 4.0 | f(4.) | | 4.5 | f(4.5) | | 5.0 | f(5.) | #+TBLFM: $2=f($1) Evaluating the source block (C-c C-c on END_SRC) defines f() successfully. Then hitting C-c C-c on the TBLFM line shoud result in the y column of the table to be filled with the x column, plus 1, which it doesn't. If I directly evaluate x + 1, it works: #+BEGIN_SRC emacs-lisp (defmath f(x) (+ x 1)) #+END_SRC #+RESULTS: : calcFunc-f | x | y | |-----+-----| | 1.0 | 2. | | 1.5 | 2.5 | | 2.0 | 3. | | 2.5 | 3.5 | | 3.0 | 4. | | 3.5 | 4.5 | | 4.0 | 5. | | 4.5 | 5.5 | | 5.0 | 6. | #+TBLFM: $2=f($1) It seems to me that the problem is with the let* special form, which simply doesn't seem to work. let works: #+BEGIN_SRC emacs-lisp (defmath f(x) (let ((n (+ x 2))) n)) #+END_SRC #+RESULTS: : calcFunc-f | x | y | |-----+-----| | 1.0 | 3. | | 1.5 | 3.5 | | 2.0 | 4. | | 2.5 | 4.5 | | 3.0 | 5. | | 3.5 | 5.5 | | 4.0 | 6. | | 4.5 | 6.5 | | 5.0 | 7. | #+TBLFM: $2=f($1) I couldn't find anything in the documentation that would forbid me from using let* in the body of a defmath. I also couldn't find anything that would explain this behaviour. Now I'm not an expert on Lisp, so it's entirely possible that I've done something stupid, or missed something in the documentation, but I can't find out what it might be. Thank you very much for Emacs. After several years of using other editors, I'm coming back to Emacs and I don't think I'll leave it again. Well, except maybe for ed(1). Ed is the standard editor. Cheers Stephan PS: I'm following the instructions in the calc manual for filing a bug. There is no mention of a mailing list or a bug tracker for me to sign up to, so I'd be grateful if you could answer this email, otherwise I might miss requests for more information or the announcement of a resolution.