Jump to content

Displaying the version number with conditionals (if then) using Scheme

From LilyPond wiki
Revision as of 23:16, 21 November 2025 by Lemzwerg (talk | contribs) (New category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Thanks to its implementation of GUILE, LilyPond makes high level functionalities relatively easy to accomplish.

In this example, the title will mention the current version (i.e. the version the snippet was compiled with, regardless which version was originally used).

\version "2.24"

%% http://lsr.di.unimi.it/LSR/Item?id=264

\paper { tagline = ##f }

#(define pieceTagLine
  (if (not (defined? 'pieceTagLine))
      (string-append "You are running version " (lilypond-version))
      pieceTagLine))

\header{
  title = \pieceTagLine
}

{ c'4 }