From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.devel Subject: as for Calc and the math library Date: Sun, 11 Aug 2024 23:50:54 +0200 Message-ID: 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; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5414"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ihor Radchenko , 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 23:51:54 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 1sdGTh-0001Hz-Ka for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Aug 2024 23:51:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdGSv-0001kP-1W; Sun, 11 Aug 2024 17:51:05 -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 1sdGSs-0001jz-5m for emacs-devel@gnu.org; Sun, 11 Aug 2024 17:51:03 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdGSq-0005YQ-9u; Sun, 11 Aug 2024 17:51:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.com; s=s31663417; t=1723413054; x=1724017854; i=dimech@gmx.com; bh=Irtt60dqM9Vo3XmXrv4NRWJP3MLhkbxa7WI24jCL8iM=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:In-Reply-To:References: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=o2Ehcoqjq+71baFO6gHn3K02QxMGa719pqdIZ8PfNyYXNEV5254oPYQu0jt8MAae 6vqg7uVeMUVCuXHnX687Hp/qs1n/VUJgl95PrAje1iJXl2Do/Ip8j68H0LWlA6yon zZAkxTcX4j2G55KkNRm8WeFwx2Qy3O8Ld48bV0b/ME0GhGgFKfJcKrWHjqJfvonYF Ug+hV/fZO0BREcD/tOMkRzbRapsSiEfLvyY4b0v2wJj9XHQQW7HqmlM2RomT3x43/ NQGb4MvX5G1Xj77NSNTNOlTMamq7Y3QaIRGBc7zo4tu5bHYFEBM/16uHr9A9PUFIu qsP9iSnaj4QcZryJlw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [92.251.79.197] ([92.251.79.197]) by web-mail.gmx.net (3c-app-mailcom-bs11.server.lan [172.19.170.179]) (via HTTP); Sun, 11 Aug 2024 23:50:54 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <868qx2j3iv.fsf@gnu.org> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:fuap/Qdztzr2O2Y+QvIUuJBW4vziZrKc0wm7QCrtRaCcPmiJx/1DdJydTebdO5HX60psg o7iIvLHtgeuZZKZALs/Av6BoTkkJlIvca2+mj2MpG8voPKHQFFUGqctKOkYe6U5bnIfccB8a+/jA yuKdOsAWMh/XJSSTZMzeUcmus+t3zV4tKVt/gTUWVZsEyVnN1h+/E5aTbCUVzPXof5cUk1hxQfFT yIlSadFpQSSENi2+DWmIbecn62DPipUnMknEAdUGko0590Kq8Wh5nECdMBW1lUXKSEF6IlnZYtI6 9o= UI-OutboundReport: notjunk:1;M01:P0:5xwPtyeC1XI=;ib2qg+JbQUobQsLtxIAfIfrQqCy fyBxYs27Q39g3NGe/K7682lqC1TAF18FWqiXXlxnS62TLecrFwH8SanQFKt246XXcVsA26O12 PfqSNhoF7UkLod5Wct5UvyeC/+hH7Y6tYaRWXpZRXjKRfaUY4H1P95C2+7YKHRGSSsnIfhaex QbzR1vDsG9kRgApiMD0Ga1LNhVc0op8QFMvJ3jjJMELDKw8f8rUPQAd/XaM8XF3MVyhQVVDIn aWMxIxNBIIUq96D39jjllwil39If/0ZW6WZYDRyml4E83hTiC0jEeFgKS9xoRbTwp7aqbl44l 5VdP09dXeujSPz1FdD/8XpD+CwvvsJ339LpTcoRWn3uHyeLe9emXrb8D2pGFpbTvaxkEUZzd/ ev+waghTbxR6E6mQr0EtNivvlVooN7kI4EKeAd+y2639oBKfY6RNSpqqLu1Yt1EQ4UQHslNPX Fd1yVvb9J2u1uClFAgH6R7ws8n2VTqkHzg3YhmWuvoZCzM5MjiX4tKWQQ5p7ZJoRTeTT3apD6 3/SuJhIKaNydHEZ6z9q/DylAWPGnau6+uwodUYn6Eqk6lJSbBxYnn20PFnKf8uWJLi20GqMA2 hNmRRBwq3mobTKBhvtthJUjNGGeZb4gz4e+Gx50Q3u6yV+UyLJHb+xnjM79efyxxlzMcwbK0F Us6huIS6ZvSbFl6G/95L3k/PE/qaneDng/Len7xY3Q== Received-SPF: pass client-ip=212.227.15.19; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, 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=ham 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:322652 Archived-At: > Sent: Monday, August 12, 2024 at 6:52 AM > From: "Eli Zaretskii" > To: "Ihor Radchenko" > Cc: incal@dataswamp.org, emacs-devel@gnu.org > Subject: Re: as for Calc and the math library > > > From: Ihor Radchenko > > Cc: incal@dataswamp.org, emacs-devel@gnu.org > > Date: Sun, 11 Aug 2024 18:27:16 +0000 > > > > Eli Zaretskii writes: > > > > >> 1. Documenting some Calc data structures > > >> 2. Possibly refactoring some Calc functions to use simpler API. > > >> > > >> It would be a much easier task and can improve the existing > > >> functionality. > > > > > > I don't think I understand well enough what will this entail in > > > practice. Can you show an example of doing this for a couple of > > > functions? > > > > 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? > > > 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 t= o > > abstract the types away. > > Doesn't (a) already exist in the Calc manual chapter "Data Types"? > 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. > > > 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? Well, if the task is focused on refactoring, then we should not change any implementations if we are to test the results before and after, just to be sure things are as we think should be. > > 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. > > > 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)) > >