unless this is an exercise in learning clojure, why not use an existing
calculator parser? eg.
https://inst.eecs.berkeley.edu/~cs164/sp05/ta/calculator/Parser.java for a
random example found with a quick google

On Sat, May 15, 2021 at 3:23 PM Blake Watson <dsblakewat...@gmail.com>
wrote:

> Hello,
>
> I've got a situation where I want to allow users some modest calculation
> ability, and I've gone through various evolutions of possibilities, like
> letting them put in raw Clojure code (that I will restrict at some point),
> to (heh) using POI to let them use Excel to specify possibilities (which is
> WAY overkill), to using infix.
>
> https://github.com/rm-hull/infix
>
> This is basically what I want, only expandable. I have some reservations,
> however:
>
> 1. It's no longer maintained.
> 2. It uses the author's own homegrown parser.
> 3. The comparator operators don't seem to work.
> 4. There's no function for "I can't calculate this because I don't know
> the value of X."
>
> All of this is surmountable, of course. The question is, should I surmount
> it? Or should I just start with Instaparse and a calculator grammar. Or is
> there a third way?
>
> ===Blake===
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/CAJAnwPmhNNKYY1yHvND5Z8pKwMnNBXqtox7DZrP%2BVwc5LJndmg%40mail.gmail.com
> <https://groups.google.com/d/msgid/clojure/CAJAnwPmhNNKYY1yHvND5Z8pKwMnNBXqtox7DZrP%2BVwc5LJndmg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAGokn9J6v_CLjZu3vc9S87rbKmUUSSZ%3DSVzweS7t7gONEQmaZw%40mail.gmail.com.

Reply via email to