[plt-scheme] Question about eval and environments

From: Mike J. Bell (ckimyt at gmail.com)
Date: Fri Oct 26 10:31:57 EDT 2007

This isn't too bad!

Hey thanks to everyone (Chongkai, Jens, Robby, and Dave) for
replying...that's a wealth of information.  I've got a lot more reading to
do!!!

Mike

On 10/26/07, Dave Gurnell <d.j.gurnell at gmail.com> wrote:
>
> I don't know if this helps: if you're prepared to permanently add
> (set! x ...) to your code you could do this:
>
>    > (define debug-enabled?
>        (make-parameter #t))
>
>    > (define (debug-hook x)
>        (if (debug-enabled?)
>            (begin (display "DEBUG> ")
>                   (let ([fn (eval (read))])
>                     (fn x)))
>            x))
>
>
>
>    > (define (run-test)
>        (define x 10)
>        (set! x (debug-hook x))
>        (display x)
>        (newline))
>
>    > (run-test)
>
>    DEBUG> (lambda (x) (* x 10))
>    100
>
> You could get rid of the set! with a macro, although it would still
> be there in reality of course.
>
> Cheers,
>
> -- Dave
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
Mike J. Bell on gmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20071026/5d3cd42e/attachment.html>

Posted on the users mailing list.