From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.devel Subject: as for Calc and the math library Date: Sun, 11 Aug 2024 00:48:13 +0200 Message-ID: <87bk20yoya.fsf@dataswamp.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="40353"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:fOlgsEd/NTOvVJfJ4GLedFfcmzg= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 11 06:27:39 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 1sd0B9-000ALv-9I for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Aug 2024 06:27:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sd0AP-00043c-Fk; Sun, 11 Aug 2024 00:26:53 -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 1scusr-0006e3-5o for emacs-devel@gnu.org; Sat, 10 Aug 2024 18:48:25 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scusp-0005Ev-D9 for emacs-devel@gnu.org; Sat, 10 Aug 2024 18:48:24 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1scuso-0004Ez-2r for emacs-devel@gnu.org; Sun, 11 Aug 2024 00:48:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TO_NO_BRKTS_PCNT=2.399 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 11 Aug 2024 00:26:51 -0400 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:322626 Archived-At: ;; __________________________________________________________ ;; `````````````````````````````````````````````````````````` ;; | ;; 3 CCUG-ML 60 ;; | ;; __________________________________________________________ ;; `-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`- I have now been using the Calc library a bit! Not a lot. Very little. But I can already say about Calc that it is very good. The code is good as well and as for math it is at a very high level. But it it is too complicated and the entry level is too high. It is advanced math but also an advanced program. We still need a math library that covers like up to the introductory courses at the university. This should be accessible with the familiar Elisp syntax. Every function in math from school and again, maybe including the introductory courses at the university, should be available with Emacs notation. So now, we don't have (** 4 1) ( ^ 4 1) (We do have `expt' but notation is important and should be, for a math library, using "their" symbols and conventions, not ours, as much as possible.) We don't have (defun distance-point (min max) (+ min (/ (- max min) 2.0)) ) Or from Logic, we don't have `nand' i.e. (not (and a b)). [last] All that we don't have, or we do, as Calc can do it - easily. Okay, so we don't need a new generic library. We need a generic library which is a complement to all the basic stuff, we don't have readily available as for now. Out of respect for Calc there is no need to move it, now need for that and no practical reason to. However the new stuff must be totally transparent. When some dude comes home from school/university and wants to try some half-basic stuff, this should work instantly using the Elisp he is used to. It should be "Oh, cool, Emacs has it!" And for a long time, it should be like that for him. If at some much later point, he (or she) moves on to "real Calc", then he is so good we don't have to worry about him anymore. So we should have a CCUG-ML project: the Generic Complementary Math Library Using Calc. Yes, it would be to some small extent *using* Calc but to a huge extent it would just be an interface. But 100% transparent, so one can use Elisp and the common math notation people know from school. No long prefixes, no special notation, nothing, as I now know there is _a lot_ of in Calc. People should be allowed to use the basics of Calc without knowing it! It should just be just like when I looked for `**' and `nand', only this time, they should exist, thru the interface, using Calc. IMO! Here is nand BTW: (defun nand (&rest conditions) (when (member nil conditions) t) ) ;; (nand) ; nil ;; (nand 1 2 3) ; nil ;; (nand nil) ; t ;; (nand 1 2 nil 3) ; t ;; (not (and)) ; nil ;; (not (and 1 2 3)) ; nil ;; (not (and nil)) ; t ;; (not (and 1 2 nil 3)) ; t And here is some Calc: (require 'calc-ext) (require 'cl-lib) ;; (infx "0 < 10") (defun infx (str) (let* ((exp (math-read-expr str)) (fun (car exp)) (new (cons (intern (caar (cl-member fun math-expr-opers :key #'cadr :test #'equal))) (cdr exp)))) (apply (car new) (cdr new)))) -- underground experts united https://dataswamp.org/~incal