Load external scm files

2013-12-04 Thread Lovis Suchmann
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)

Re: Load external scm files

2013-12-04 Thread Panicz Maciej Godek
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

Re: Load external scm files

2013-12-04 Thread Ralf Mattes
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 so

Re: Load external scm files

2013-12-04 Thread Panicz Maciej Godek
Oh yes, you're right -- it's because of the behaviour of "load". However, this should solve the problem: (define-macro (define-test-function) `(define (test-function) ,(with-input-from-file "external.scm" read) x)) (note however that it would load only the first sexp from "external.scm

Re: Load external scm files

2013-12-04 Thread dsmich
Lovis Suchmann 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

Re: Load external scm files

2013-12-04 Thread Ralf Mattes
On Wed, Dec 04, 2013 at 12:04:34PM -0500, dsm...@roadrunner.com wrote: > > Sounds like a job for include: > http://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html#index-include > Yes, except Lilypond's main branch strill uses guile-1.8 and that doesn't know 'include. I think

A stack overflow problem.

2013-12-04 Thread R. Clayton
I am running this $ guile -v guile (GNU Guile) 2.0.9-deb+1-1 Copyright (C) 2013 Free Software Foundation, Inc. License LGPLv3+: GNU LGPL 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the exte