[racket] evaluate string which contains many definitions
evaluate string which contains many definitions
hello~
I don't know why the following code doesn't working at all
I can eval a-value but not b-func nor c-value
#lang scheme
(require racket/gui)
(require 2htdp/batch-io)
(define-namespace-anchor anchor)
(define ns (namespace-anchor->namespace anchor))
(define content (read-file "./eval.txt"))
(eval (read (open-input-string content)) ns)
(eval 'a-value ns)
(eval '(b-func) ns)
(eval 'c-value ns)
===content of eval.txt===
(define a-value 0)
(define (b-func)
(* 2 2))
(define c-value 3)
=========================
I expected
0
4
3
as a result but
reference to an identifier before its definition: b-func
arises
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101117/00642c00/attachment.html>