Derek Atkins wrote: > Quoting Derek Atkins <warl...@mit.edu>: > [snip] >>> Can any Guile/Scheme experts help? > > I found some help, and here's some working code: > > ;#! /usr/bin/guile > (define fred "This is Fred") > > (define (foo bar) > (display fred) (newline) (display bar) (newline) > (display "and now via eval-string...") (newline) > (let ((string1 "(begin (display bar) (newline) (display fred) (newline) > (display bar) (newline))")) > (with-input-from-string string1 (lambda () (local-eval (read) > (the-environment)))) > )) > (foo "Actual parameter") > > > Note that I added the 'begin' because the 'read' will only read in one > s-expression. You could theoretically read in multiple s-expressions > in a loop if you wanted. But this was easier. > > This code works for me. > > -derek > >
I'm making progress with this, but I've hit another snag with local-eval. The following code gives an error (note the extra "(define x 42)": ------ ;#! /usr/bin/guile (define fred "This is Fred") (define (foo bar) (let ((string1 "(begin (display fred) (newline) (display bar) \ (newline) (define x 42) (display x) (newline))")) (with-input-from-string string1 (lambda () (local-eval (read) (the-environment)))))) (foo "Actual parameter") ------ gives ------ ERROR: Bad define placement ------ I found a mention of this issue at http://www.opensubscriber.com/message/guile-u...@gnu.org/9617568.html but I'm not sure whether to give up on local-eval, or just make a rule that the template code can't include 'define', which would be a bit limiting. Any ideas? cheers Chris -- Chris Dennis cgden...@btinternet.com Fordingbridge, Hampshire, UK _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel