[racket] What is the equivalent of ToExpression in Mathematica?

From: Ashok Bakthavathsalam (ashokb at kggroup.com)
Date: Wed Feb 29 16:33:18 EST 2012

Will eval-string work even if the string is the normal mathematical
notation?
For example, "1+1" or "8*74-2" ?

On Thu, Mar 1, 2012 at 2:54 AM, David Van Horn <dvanhorn at ccs.neu.edu> wrote:

> On 2/29/12 4:18 PM, ashok bakthavathsalam wrote:
>
>> I am looking for something similar to ToExpression
>> <http://reference.wolfram.com/**mathematica/ref/ToExpression.**html<http://reference.wolfram.com/mathematica/ref/ToExpression.html>>
>> that is
>>
>> available in Mathematica. I just want to convert a string to an
>> expression, and evaluate the expression. As a first pass, my strings
>> will include only numbers and arithmetic operators, and not even
>> parentheses.
>>
>> If I need to write it, please point me in the direction of the
>> appropriate pre-defined modules/definitions which I should use.
>>
>
> Welcome to Racket v5.2.1.6.
> > (require mzlib/string)
> > (eval-string "(* (sqr 3) pi)")
> 28.274333882308138
>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120301/8d0c52fe/attachment.html>

Posted on the users mailing list.