lilypond-user
[Top][All Lists]
Advanced

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

Detecting null markup in Scheme


From: Graham King
Subject: Detecting null markup in Scheme
Date: Fri, 01 Sep 2017 17:35:40 +0100

I have a monstrous music-function that constructs a markup in Scheme and
then decides whether to put it at system-level or staff-level, along the
following lines (much-redacted):

foo = #(define-music-function (args...) (types...)
  (let* ((markupContents #{
            \markup {
               \concat {
                  #markupOne 
                  #markupTwo
               }}
        #})
  (case whereMarkup
     ((system) #{ \mark #markupContents #})
     ((staff)  #{ <>^   #markupContents #})
     (else     #{ \mark \markup \color #red #markupContents #})
  ))
)

The problem is: how best to deal with the case where #markone and
#markuptwo are both empty, i.e. #{ \markup "" #}, and no markup at all
should be attempted?

I've tried variations on:
  ( if ( string=? ( markup->string markupContents ) 
                  ( markup->string empty-markup ))
         (#{ <> #})
         (case whereMarkup ...

but my grasp of Scheme, never very firm, is slipping away.

Grateful for any suggestions, pointers to documentation/tutorials, etc.

-- Graham



reply via email to

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