guile-user
[Top][All Lists]
Advanced

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

Re: Load external scm files


From: Ralf Mattes
Subject: Re: Load external scm files
Date: Wed, 4 Dec 2013 14:48:10 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Dec 04, 2013 at 02:52:10PM +0100, Panicz Maciej Godek wrote:
> This looks like a job for a macro!
> 
> (define-macro (define-test-function)
>   `(define (test-function)
>      ,(load "external.scm")
>      x))
> 
> (define-test-function)
> 
> (test-function)
> ; ==> 3

No  - this doesn't solve the OP's question.
Even with your macro, x is still defined in 
the toplevel. Try this:

(display (test-function)) 
(display x)  ; visible from the toplevel
(set! x 42)
(display (test-function)) ; Outsch!

Cheers, Ralf Mattes





reply via email to

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