From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: as for Calc and the math library Date: Sun, 11 Aug 2024 19:13:16 +0000 Message-ID: <871q2ukh4j.fsf@localhost> References: <87bk20yoya.fsf@dataswamp.org> <86zfpjirkg.fsf@gnu.org> <877ccnj9dp.fsf@localhost> <86bk1zhrf5.fsf@gnu.org> <874j7qkj97.fsf@localhost> <868qx2j3iv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7524"; mail-complaints-to="usenet@ciao.gmane.io" Cc: incal@dataswamp.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 11 21:13:01 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sdDzx-0001oW-7B for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Aug 2024 21:13:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdDzG-0004W2-GO; Sun, 11 Aug 2024 15:12:20 -0400 Original-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 1sdDzC-0004Vf-3A for emacs-devel@gnu.org; Sun, 11 Aug 2024 15:12:14 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdDz6-0003TO-Pu for emacs-devel@gnu.org; Sun, 11 Aug 2024 15:12:13 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id BFE90240028 for ; Sun, 11 Aug 2024 21:12:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1723403526; bh=d/DtZYRCbC96guzMYoAcVaRi+gnagKuRjxa7cwEKljU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=G1lOoU1w5SqIJtjuZloPUNszoWD6OPSX3ycenVZQX8FJ/XVOxtdE+0Y6/VlTyRCJz 9ca9MmU/zfKAGXzHqcWcSpN8dhQ9P8PCZghB3thmobWYlXSS+4r2wtJDhZpSnS4hN9 U2IFwn6NkmS38ZT+QXwOLhvsZ34Z4NunUTxnHsHMXghPIRP9KEdvXB6/vsg5SDds3t 64NNWWRotKe7Sbf8Zu0pm6bnqiDJikxAZ16Uk/8BEgfIPnwYWnkig7xIRpYCcGsLsS 6unFUxoMirLQMqg0/8sDldqyL10M/+bEhQSBDvUxImnI4cBE/5IRl65W164Q9Qc8Xs KpeTKH7me2lZA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WhnMV1VdQz9rxT; Sun, 11 Aug 2024 21:12:05 +0200 (CEST) In-Reply-To: <868qx2j3iv.fsf@gnu.org> Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322650 Archived-At: Eli Zaretskii 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 . Support Org development at , or support my work at