lilypond-user
[Top][All Lists]
Advanced

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

Re: Not Nice Review of the LilyPond


From: David Sumbler
Subject: Re: Not Nice Review of the LilyPond
Date: Sun, 02 Dec 2018 18:04:45 +0000

-----Original Message-----
From: David Kastrup <address@hidden>
To: address@hidden
CC: lilypond-user <address@hidden>
Subject: Re: Not Nice Review of the LilyPond
Date: Sun, 02 Dec 2018 17:00:33 +0100

address@hidden 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





reply via email to

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