<span style>Will eval-string work even if the string is the normal mathematical notation?</span><div style>For example, "1+1" or "8*74-2" ?</div><br><div class="gmail_quote">On Thu, Mar 1, 2012 at 2:54 AM, David Van Horn <span dir="ltr"><<a href="mailto:dvanhorn@ccs.neu.edu">dvanhorn@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2/29/12 4:18 PM, ashok bakthavathsalam wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I am looking for something similar to ToExpression<br></div>
<<a href="http://reference.wolfram.com/mathematica/ref/ToExpression.html" target="_blank">http://reference.wolfram.com/<u></u>mathematica/ref/ToExpression.<u></u>html</a>> that is<div class="im"><br>
available in Mathematica. I just want to convert a string to an<br>
expression, and evaluate the expression. As a first pass, my strings<br>
will include only numbers and arithmetic operators, and not even<br>
parentheses.<br>
<br>
If I need to write it, please point me in the direction of the<br>
appropriate pre-defined modules/definitions which I should use.<br>
</div></blockquote>
<br>
Welcome to Racket v5.2.1.6.<br>
> (require mzlib/string)<br>
> (eval-string "(* (sqr 3) pi)")<br>
28.274333882308138<span class="HOEnZb"><font color="#888888"><br>
<br>
David<br>
<br>
</font></span></blockquote></div><br>