lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme: default values?


From: Richard Shann
Subject: Re: Scheme: default values?
Date: Wed, 12 Feb 2014 14:10:28 +0000

You may find problems between scheme 1.8 and the newer 2.0 on this
topic, I don't have the details at my fingertips but the solution
involves creating a macro define-once instead of that (defined? xxx)
test:

;;; for guile 2.0 compatibility define the define-once procedure to work
in guile 1.8
(cond-expand
   (guile-2) ; nothing
   (else ; guile < 2.0
    (define-macro (define-once sym exp)
      `(define ,sym
         (if (module-locally-bound? (current-module) ',sym)
             ,sym
             ,exp)))))

this solution was given to me on the guile-user mailing list, it is
executed at the start of Denemo and after that you can just write
(define-once TACTUS 50) wherever you need to be sure it already is
defined.
HTH
Richard




On Wed, 2014-02-12 at 07:09 +0000, Graham King wrote:
> On Sun, 2014-02-09 at 12:09 +0100, Marc Hohl wrote:
> 
> > I found another solution somewhere buried in my files:
> > 
> > #(define TACTUS
> >     (if (defined? TACTUS)
> >         TACTUS
> >         50))
> > 
> > Perhaps that's something better suited to your needs?
> > 
> > Marc
> > 
> > 
> Brilliant! Thanks Marc.
> Just one minor correction:
>     (if (defined? 'TACTUS)
> (note the quote before the variable name)
> 
> -- Graham 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

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