Re: Mathematica like eval

2014-06-16 Thread Dilvan
Hi, Thanks for both answers. I will try to find the relevant text in Joy of Clojure (I have access to the first edition). I followed the expresso https://github.com/clojure-numerics/expresso link, but I am not interested in mathematical expressions. Refining my question: I am more

Re: Mathematica like eval

2014-06-16 Thread kovas boguta
So I've thought about this quite a bit (as have some other people, like Brandon Bloom), and started working on a library a while back exploring some ideas https://github.com/kovasb/term The main idea of term is to take any expression and turn unbound symbols into datatypes that satisfy

Re: Mathematica like eval

2014-06-16 Thread Brandon Bloom
Since my ears are ringing, I'll chime in. There's a few things to separate out here: 1) Symbolic math 2) Term rewriting 3) Staged computation Mathematica can provide all three to varying degrees. Espresso targets symbolic mathematics. Kovas' work is about term rewriting as a computational

Re: Mathematica like eval

2014-06-14 Thread Maik Schünemann
Hi, You can use expresso https://github.com/clojure-numerics/expresso for this: (use 'numeric.expresso.core) (def e (ex (+ 8 a (* 9 (+ 2 b)) 2))) ;= (+ 8 a (* 9 (+ 2 b)) 2) This expression can now be manipulated by expresso to simplify it, solve it, etc. you can substitute a and b for its values

Mathematica like eval

2014-06-13 Thread Dilvan
Hi all, I'm a novice to Clojure (but not to programming). I'm looking for an implementation of an eval function to eval expression like Mathematica does. For instance, in Mathematica the expression: 8 + a + 9 (2 + b) + 2 if a and b are not bound, translates to Plus[10, a,

Re: Mathematica like eval

2014-06-13 Thread Christopher Small
There is a nice example of something similar to this in Joy of Clojure (2nd edition anyway; not sure about first). It only shows you how to do contextual-evaluation, and doesn't return a function if some set of the symbols are not mapped in the context, but I'll bet you could modify the