<div>evaluate string which contains many definitions</div><div><br></div><div>hello~</div><div><br></div><div>I don&#39;t know why the following code doesn&#39;t working at all</div><div><br></div><div>I can eval a-value but not b-func nor c-value</div>
<div><br></div><div>#lang scheme</div><div>(require racket/gui)</div><div>(require 2htdp/batch-io)</div><div>(define-namespace-anchor anchor)</div><div>(define ns (namespace-anchor-&gt;namespace anchor))</div><div>(define content (read-file &quot;./eval.txt&quot;))</div>
<div><br></div><div>(eval (read (open-input-string content)) ns)</div><div><br></div><div>(eval &#39;a-value ns)</div><div>(eval &#39;(b-func) ns)</div><div>(eval &#39;c-value ns)</div><div><br></div><div><br></div><div>===content of eval.txt===</div>
<div>(define a-value 0)</div><div>(define (b-func)</div><div>  (* 2 2))</div><div>(define c-value 3)</div><div>=========================</div><div>I expected </div><div>0 </div><div>4 </div><div>3 </div><div>as a result but </div>
<div> reference to an identifier before its definition: b-func</div><div>arises</div><div><br></div>