[plt-scheme] Eval throwing undefined identifier error

From: Richard Cleis (rcleis at mac.com)
Date: Sun Nov 11 14:08:54 EST 2007

I don't think f can be available to eval until the module is  
completely loaded.  In the following module, eval knows f in the  
function g because eval is used after some program requires the  
module and calls g.

(module b mzscheme
   (require "a.scm")
   (define  (g)
     (display (eval (read (open-input-string "`(,(f 1) ,(f 2))")))))

   (provide g)
   (provide (all-from "a.scm")))


rac


On Nov 11, 2007, at 9:18 AM, Jaime Vargas wrote:

> This is probably related to eval and environments. But in the  
> following code why is f not available to the eval in module-b. How  
> to make it work?
>
> Thanks,
>
> Jaime
>
>
> (module a mzscheme
>   (provide (all-defined))
>   (define (f x) (list x x)))
>
>
> (module b mzscheme
>   (require "a.scm")
>   (define g
>     (let* ((port (open-input-string "`(,(f 1) ,(f 2))"))
>            (input (eval (read port))))
>       (display input))))
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.