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: Stefan Monnier
Subject: Re: I want to add a package to GNU ELPA: infix-notation-calculator
Date: Tue, 17 Aug 2021 19:28:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> 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]