emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46750: closed (calc defmath let* behaviour surprising, inconsistent,


From: GNU bug Tracking System
Subject: bug#46750: closed (calc defmath let* behaviour surprising, inconsistent, or wrong)
Date: Fri, 05 Mar 2021 10:59:02 +0000

Your message dated Fri, 5 Mar 2021 11:58:15 +0100
with message-id <8E655864-6998-4D1E-9BB0-0768FADC0FD8@acm.org>
and subject line Re: bug#46750: calc defmath let* behaviour surprising, 
inconsistent,  or wrong
has caused the debbugs.gnu.org bug report #46750,
regarding calc defmath let* behaviour surprising, inconsistent, or wrong
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
46750: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46750
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: calc defmath let* behaviour surprising, inconsistent, or wrong Date: Wed, 24 Feb 2021 13:40:50 +0100 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0
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.



--- End Message ---
--- Begin Message --- Subject: Re: bug#46750: calc defmath let* behaviour surprising, inconsistent, or wrong Date: Fri, 5 Mar 2021 11:58:15 +0100
5 mars 2021 kl. 11.49 skrev Stephan Neuhaus <stephan.neuhaus@zhaw.ch>:

> I can confirm that the calc that's in the current master branch (development 
> version for 28.1) fixes my problem. You hinted that there were further 
> problems too, but I have only checked that let* now seems to work as 
> intended. Also, to be fair, I have checked that only for my own use case.

Thanks for checking! Marking the bug as closed then.

> Now I'll have to decide whether to build emacs for Debian myself or whether 
> to wait for Debian to adopt emacs >= 28.1.

Well, Emacs release cycles are not known for their brisk pacing; you would have 
to wait for quite a while. (And obviously, we don't mind more people testing 
the development versions!)



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]