guile-user
[Top][All Lists]
Advanced

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

Load external scm files


From: Lovis Suchmann
Subject: Load external scm files
Date: Wed, 04 Dec 2013 13:37:14 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

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?

Thanks in advance. :)

Lovis



reply via email to

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