What is the cleanest way to evaluate a LaTeX expression within CL?

If I have a string like “3 + 4” (not as a result of an expression component), what is the easiest way to evaluate it?

The best I have so far is

answer = simpleFunction(question_string).evaluateAt(0)

But that seems like a strange way to implement it. Is there a way to avoid creating a function simply to pass a dummy argument?

1 Like

numericValue(“3+4”) should work.

2 Likes

Of course!

I can see it now in the list of functions. For some reason I thought it had to be a method and I was hoping to turn a string into an expression object so that I could do e.numericValue, but this is much better.

Thanks Eric