lilypond-user
[Top][All Lists]
Advanced

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

booleans and conditional compilation?


From: Johannes Waldmann
Subject: booleans and conditional compilation?
Date: Fri, 1 Apr 2016 21:23:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Hi.

Is there a standard way of conditional compilation,
e.g., to turn parts (on any level) of a score on and off?

>From a programmer's standpoint,
I'd want booleans, and branching, something like

let foo = true % or false, somewhere at the top of the file,
               % or even on the command line

% and then (just to show the idea)

...
<<  % (possibly deeply nested)
  { c d
  if foo then   e f  else  c d  endif
  g }
  { e f
  if foo then g a else ... endif
  }
>>

I know I can define variables,
and then (un)comment the use of the variables,
but that does not solve my problem
because then I had to (un)comment all uses of one variable.

I also know I can just use CPP (external preprocessor).
However that seems like a work-around because lilypond
has LISP inside and that sure has booleans and conditionals.

Oh, and I looked up "conditional" in the docs
(D. LilyPond command index) (no results).


... Then I looked it up in the mailing list archive, and found
https://lists.gnu.org/archive/html/lilypond-user/2012-02/msg00786.html

this seems to indicate that I can only switch named parts:
$(if foo thing)  seems to require  \thing?
Then how can I avoid this definition?


- J.

Thanks for answers on the "unfold" question.



reply via email to

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