On Tue, Oct 12, 2010 at 3:45 PM, 김태윤 wrote:
> what I have to do for change string to evaluatable code?
This should do it:
Welcome to Racket v5.0.1.2.
> (define (string->expr str)
(read (open-input-string str)))
> (string->expr "(+ 1 2)")
'(+ 1 2)
> (eval (string->expr "(+ 1 2)"))
3
Cheers,
hello
I have made kind of calculator
as like following code
#lang scheme
(define ns (make-base-namespace))
(define (calc)
(let ((expression (read)))
(if (eq? expression 'exit)
(exit)
(printf "~A ~n" (eval expression ns
(calc))
(calc)
since I learned big-bang function,
I
2 matches
Mail list logo