lilypond-user
[Top][All Lists]
Advanced

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

Scheme help request: How can else of an if-statement be made to do nothi


From: Matthew Fong
Subject: Scheme help request: How can else of an if-statement be made to do nothing?
Date: Sat, 17 Oct 2020 09:27:57 -0700

Hello everyone,

I've been digging into guile/scheme and LilyPond, and it doesn't appear that else-statements can be empty. Any pointers would be appreciated in advance.

For the example below, I would prefer the else-statement here to do nothing, rather than print an empty markup: \markup { "" }, as doing so creates a small, but observable change in vertical spacing.

% Print markup if a symbol is defined
#(define-markup-command (PrintIfDefined layout props sym text) (symbol? markup?)
    (if (defined? sym)
        ;; Do this if true
        (interpret-markup layout props
            #{ \markup \with-color #'(0.8 0.2 0.2) #text #})
   ;; How do I do nothing here? (empty statement preferred)
   (interpret-markup layout props
       #{ \markup "" #})
)
)

printInfo = 1
\markup \PrintIfDefined #'printInfo "Print this if symbol printInfo is defined"


Many thanks,
mattfong


reply via email to

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