-----Original Message----- From: David Kastrup <d...@gnu.org> To: msk...@ansuz.sooke.bc.ca CC: lilypond-user <lilypond-user@gnu.org> Subject: Re: Not Nice Review of the LilyPond Date: Sun, 02 Dec 2018 17:00:33 +0100
msk...@ansuz.sooke.bc.ca writes: > On Sun, 2 Dec 2018, David Kastrup wrote: > > is hard. At least LilyPond is a better starting point than > > MusiXTeX. > > But MusiXTeX can do "if" statements. I have a hard time imagining how this is going to hold in a more convincing manner than you could do it with LilyPond. *********** I felt that an "if" would be useful, so I eventually came up with: #(define (iffable? x) (or (string-or-music? x) (markup? x) (ly:score? x) (ly:book? x))) iff = #(define-scheme-function ( flag var ) ( boolean? iffable? ) (if flag (if (string? var) (ly:parser-include-string var) var))) I am sure that better programmers could do something far more elegant, but this works for me. Using this, I can control compilation using variables, with lines such as: \iff \Three "\include \"No3_score.ily\"" Instead of a string as in the example, markups, music etc. can also be included as a result of a successful "iff" test. I also made a \choice routine, which effectively gives an "else" result if the test fails, but I have never actually felt any need to use it. David _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user