mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MIT-Scheme-devel] tied in knots with environments


From: Taylor R Campbell
Subject: Re: [MIT-Scheme-devel] tied in knots with environments
Date: Thu, 27 Jan 2011 15:56:08 +0000
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/9.0.1

   Date: Thu, 27 Jan 2011 17:31:21 +0200
   From: David Gray <address@hidden>

   I've looked at the manual on using environments but I can't seem
   to get the the system to do what I want. I've set up a band with ScmUtils
   which get loaded up with scheme.ini . However I also load up some
   definitions which plot files using the 'win32 package. If I do
   (ge 'win32) all the plot stuff works ok but I can't access stuff from
   ScmUtils. I almost get it to work if I go back up to the initial
   environment with (ge user-initial-environment) and then
   do (eval (plot '( 1 2 3) '(4 5 6))). This does the plot ok and then informs
   me than #[compiled-procedure 15 ("global" #x32) #xf #xd2f1cd] has been
   called with 1 argument; it requires 2 arguments
   Is this the correct way to call bindings from one environment to the other,
   or did I miss something fundamental?

When you asked Scheme to evaluate (eval (plot '(1 2 3) '(4 5 6))) in
the scmutils user environment, it first evaluated (plot '(1 2 3) '(4 5
6)), which had the effect of plotting something, and then passed the
value (probably some bogus, uninteresting value) as the sole argument
to the EVAL procedure.  The EVAL procedure takes two arguments,
however, not one; hence Scheme signals an error at ths point.

(If you set LOAD-DEBUGGING-INFO-ON-DEMAND? to true, then you will see
the name of the procedure among the #[compiled-procedure ...] gunk in
the error message.  Perhaps we ought to set that to true by default.)

Two things:

1. If you want to evaluate something in another environment, you can
   use GE to switch the REPL into that environment, or you can pass an
   expression and the desired environment to EVAL without switching
   the REPL's environment -- e.g., (eval '(frobnitz-the-windows-cruft)
   (->environment '(win32))).  Note that EVAL is a procedure; if you
   want to pass a literal expression you must quote it.

2. It seems from your description that PLOT is bound in the scmutils
   user environment -- are you sure you need to use the win32 one
   explicitly at all?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]