Hi Richard, On Wed 27 Feb 2013 15:22, Richard Shann <richard.sh...@virgin.net> writes:
> On Wed, 2013-02-27 at 08:19 -0500, m...@markwitmer.com wrote: >> Richard Shann <richard.sh...@virgin.net> writes: >> >> > (if (not (defined? 'ToggleTripleting::InsideTriplet)) >> > (define ToggleTripleting::InsideTriplet #t)) I'm sorry we were not able to make this case work in Guile 2; it's quite complicated actually. >> You can probably just replace your code with >> >> (define-once ToggleTripleting::InsideTriplet #t) > > Thanks for this - it seems define-once is not defined in guile 1.8 > however You could define it in a prelude somewhere: (cond-expand (guile-2) ; nothing (else ; guile < 2.0 (define-macro (define-once sym exp) `(if (not (defined? ',sym)) (define ,sym ,exp))))) Then you could change all uses of this idiom to use define-once. Note that Guile 2.'s `define-once' is slightly different; it always declares a local definition, and it uses the existing value only if there is already a local definition. In this way imported values get overridden by define-once. Here is a Guile 2-compatible version: (cond-expand (guile-2) ; nothing (else ; guile < 2.0 (define-macro (define-once sym exp) `(define ,sym (if (module-locally-bound? ',sym) ,sym ,val))))) Finally in Guile 2 there is also the `define!' procedure, which makes top-level definitions programmatically. Use it if you need it. But if you can, better to rewrite to use standard Scheme. In general I recommend adding shims to Denemo to make it forward-compatible -- like adding define-once if needed so that it uses the Guile 2.0 idioms, even on 1.8. Good luck, and let us know how it goes. Andy -- http://wingolog.org/