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

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Wed Feb 29 16:24:31 EST 2012

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> 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


Posted on the users mailing list.