unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: incal@dataswamp.org, emacs-devel@gnu.org
Subject: Re: as for Calc and the math library
Date: Sun, 11 Aug 2024 19:13:16 +0000	[thread overview]
Message-ID: <871q2ukh4j.fsf@localhost> (raw)
In-Reply-To: <868qx2j3iv.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> For (1), I was referring to ";;;; Arithmetic routines." in
>> calc.el.
>
> (1) is documentation of Calc data structures.  If you mean the large
> commentary that describes the various form of objects that Calc can
> handle, then what is left to document?

Put this commentary, and other relevant APIs into .texi, explained and
organized aiming for Elisp API users.

>> Now, people must simply know the internal format of special
>> number representations to work with Calc from Elisp.
>> It might be worth (a) putting them into a proper manual (some kind of
>> Calc Lisp API description); (b) maybe creating constructor functions to
>> abstract the types away.
>
> Doesn't (a) already exist in the Calc manual chapter "Data Types"?

Hmm. Yes. Last time, I failed to see them.

> And if not, then you are talking about enhancing the documentation of
> Calc, which is always welcome, but I fail to see how it is a step
> towards a separate library.

The idea is to have a description and overview of what the library
does. It will make the design easier later.

>> For (2), for starters, Calc functions often do not even have
>> docstrings. One simply has to guess(?) or read the code to understand
>> what kinds of values can be passed.
>
> And how is this relevant to (2), which is about refactoring some of
> Calc code into hopefully easier-to-use functions?

If these functions are going to be used from Elisp, they must have
docstrings.

>> For example, take `math-add' - no
>> docstring, and go try adding invalid arguments:
>> 
>> M-: (math-add "foo" '(frac 1 2))
>
> It's a small wonder that you cannot math-add a string, especially
> since none of the objects described in the commentary are any kind of
> string.  More generally, AFAIU these don't have doc strings because
> they are internal functions.
>
> But still, I don't understand the relevance.

I meant this function as a candidate for math library we are
discussing.

>> but somehow not
>> 
>> M-: (math-add 0.1 '(frac 1 10))
>> 
>> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p 2.0)
>>   (math-gcd 2.0 10)
>>   (math-make-frac 2.0 10)
>>   (calc-add-fractions 0.1 (frac 1 10))
>>   (math-add 0.1 (frac 1 10))
>
> You again play against the rules: 0.1 is not a valid object for these
> functions.  Try
>
>   M-: (math-add '(float 1 -1) '(frac 1 10))

My point is that the error message could be nicer.
Something like (wrong-type-argument calc-value-p 2.0)
"integer-or-marker-p" creates an impression that you can only pass
integers there.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



  reply	other threads:[~2024-08-11 19:13 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 22:48 as for Calc and the math library Emanuel Berg
2024-08-11  4:58 ` Eli Zaretskii
2024-08-11 16:45   ` Ihor Radchenko
2024-08-11 16:55     ` Christopher Dimech
2024-08-11 17:05     ` Emanuel Berg
2024-08-11 17:59     ` Eli Zaretskii
2024-08-11 18:17       ` Christopher Dimech
2024-08-11 18:32         ` Eli Zaretskii
2024-08-11 19:53           ` Christopher Dimech
2024-08-11 18:27       ` Ihor Radchenko
2024-08-11 18:38         ` Emanuel Berg
2024-08-12  6:28           ` New Emacs features via Google Summer of Code (or other similar stipend schemes) (was: as for Calc and the math library) Ihor Radchenko
2024-08-12 11:09             ` Eli Zaretskii
2024-08-12 12:10               ` New Emacs features via Google Summer of Code (or other similar stipend schemes) Joel Reicher
2024-08-12 18:59                 ` Ihor Radchenko
2024-08-12 22:28                   ` Pedro
2024-08-14 10:07                     ` Ihor Radchenko
2024-08-15 11:44                     ` Ihor Radchenko
2024-08-12 19:17               ` New Emacs features via Google Summer of Code (or other similar stipend schemes) (was: as for Calc and the math library) Ihor Radchenko
2024-08-13  8:12                 ` New Emacs features via Google Summer of Code (or other similar stipend schemes) Andrea Corallo
2024-08-18 11:48                   ` Ihor Radchenko
2024-08-18 12:35                     ` Eli Zaretskii
2024-08-18 12:52                       ` Ihor Radchenko
2024-08-18 13:39                         ` Eli Zaretskii
2024-08-18 13:56                           ` RTF import/export emacs (was: New Emacs features via Google Summer of Code (or other similar stipend schemes)) Ihor Radchenko
2024-08-18 14:14                             ` Eli Zaretskii
2024-08-18 14:35                               ` Ihor Radchenko
2024-08-18 14:38                                 ` Eli Zaretskii
2024-08-18 17:37                                 ` Jim Porter
2024-08-18 18:16                                   ` Eli Zaretskii
2024-08-18 18:38                                     ` Jim Porter
2024-08-18 19:05                                       ` tomas
2024-08-13 11:02                 ` New Emacs features via Google Summer of Code (or other similar stipend schemes) (was: as for Calc and the math library) Eli Zaretskii
2024-08-18 11:09                   ` Ihor Radchenko
2024-08-18 11:25                     ` Eli Zaretskii
2024-08-18 11:33                     ` Stefan Kangas
2024-08-18 12:47                       ` Ihor Radchenko
2024-08-11 18:52         ` as for Calc and the math library Eli Zaretskii
2024-08-11 19:13           ` Ihor Radchenko [this message]
2024-08-12  2:24             ` Eli Zaretskii
2024-08-11 21:50           ` Christopher Dimech
  -- strict thread matches above, loose matches on Subject: below --
2024-08-12  5:30 arthur miller
2024-08-12 11:00 ` Eli Zaretskii
2024-08-12 11:23   ` Nicolas Martyanoff
2024-08-12 11:46     ` Eli Zaretskii
2024-08-12 12:11       ` Nicolas Martyanoff
2024-08-12 13:22         ` Eli Zaretskii
2024-08-12 13:38           ` Christopher Dimech
2024-08-15  1:59             ` Richard Stallman
2024-08-15  3:06               ` Christopher Dimech
2024-08-15  6:43                 ` Eli Zaretskii
2024-08-15 13:28                   ` Christopher Dimech
2024-08-15 16:39                     ` Eli Zaretskii
2024-08-13  7:16           ` Sv: " arthur miller
2024-08-13 12:12             ` Eli Zaretskii
2024-08-13 13:10               ` Nicolas Martyanoff
2024-08-13 13:30                 ` Eli Zaretskii
2024-08-13 13:48                   ` Nicolas Martyanoff
2024-08-13 21:43               ` Sv: " arthur miller
2024-08-14  5:09                 ` Eli Zaretskii
2024-08-14  8:45                   ` Sv: " arthur miller
2024-08-14  9:56                     ` Nicolas Martyanoff
2024-08-14 10:43                       ` Eli Zaretskii
2024-08-13  5:39       ` Gerd Möllmann
2024-08-14  4:11         ` Gerd Möllmann
2024-08-14  6:23           ` Eli Zaretskii
2024-08-14  6:28             ` Gerd Möllmann
2024-08-14  6:43               ` Eli Zaretskii
2024-08-14 14:00             ` Suhail Singh
2024-08-14 14:20               ` Eli Zaretskii
2024-08-14 15:08                 ` Suhail Singh
2024-08-14 15:31                   ` Eli Zaretskii
2024-08-14 16:00                     ` Suhail Singh
2024-08-14 16:24                       ` Eli Zaretskii
2024-08-14 20:35                       ` Emanuel Berg
2024-08-15  5:00                     ` Sv: " arthur miller
2024-08-15  7:02                       ` Eli Zaretskii
2024-08-15 20:09                         ` Sv: " arthur miller
2024-08-16  5:47                           ` Eli Zaretskii
2024-08-18 16:38                           ` Richard Stallman
2024-08-18 17:27                             ` Christopher Dimech
2024-08-19 12:05                             ` Sv: " arthur miller
2024-08-24  2:59                               ` Richard Stallman
2024-08-24  2:59                               ` Richard Stallman
2024-08-14 14:35               ` Gerd Möllmann
2024-08-14 14:40                 ` Nicolas Martyanoff
2024-08-14 14:47                   ` Gerd Möllmann
2024-08-14 14:49                   ` Eli Zaretskii
2024-08-14  5:29     ` Madhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q2ukh4j.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=incal@dataswamp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).