emacs-devel
[Top][All Lists]
Advanced

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

Re: I want to add a package to GNU ELPA: infix-notation-calculator


From: Christian Johansson
Subject: Re: I want to add a package to GNU ELPA: infix-notation-calculator
Date: Wed, 18 Aug 2021 11:03:27 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

Eric: calc-embedded is really good, even better than my plugin, thanks for the tip! Storing calculations in variables is a good feature

Stefan: Looks cool, didn't it's possible to do stuff like that, however this project was primarily about testing my parser generator so I wouldn't want to change those parts of the program

Hälsningar / Best Regards
Christian

On 18/08/2021 01:28, Stefan Monnier wrote:
Sure, I think calc and calculator are more full-focused calculators that
require a learning-curve, this plugin is more of an quick ad-hoc calculator
that calculates values like (infix notation)
[...]

Thanks, but I meant to add that to the README or the `Commentary:`.

Also I was thinking more about the documentation on which operations are
supported.  [ IIUC you only support the four basic arithmetic
operations, with standard precedence rules, plus parentheses for
grouping, right?  ]

Also, I was wondering if you had considered implementing the parser with
the following approach:

- read the line with (read-from-string (concat "(" STRING ")"))
- massage the resulting sexp to implement the desired infix syntax.

You could even do the massaging via a macro, where

     (infix 2 + 3 * 5)
     (infix 2 + (3 * 5))
     (infix (2 + ((3) * 5)))

all macroexpand to

     (+ 2 (* 3 5))

so your syntax could be used inside code as well.


         Stefan




reply via email to

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