---- Lovis Suchmann <panlo...@aol.com> wrote: > Hello everyone, > > I'm working with Guile Scheme (with the LilyPond music engraver > software, if someone knows this), and atm I have the problem that I > would like to load an external scheme file in the current environment, like > > ; external.scm > (define x 3) > > ; main.scm > (define (make-test-function) > (load "external.scm") > (lambda () x)) > (define test-function (make-test-function)) > (display (test-function)) ; => 3 > (display x) ; => should create an error because x should not be accessible > > I tried but failed with this and found out it is because 'load' always > uses the top-level environment. Is there another way to load a file in > the current context? Like, in the way as if I just copy-and-pasted the > contents of the file at this exact position? Or do you have any other > suggestions?
Sounds like a job for include: http://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html#index-include -Dale