On 2020-10-18 7:52 am, Dave Seidel wrote:
Having articulated the question, I figured out that apparently one can't return a \bookpart from a Scheme function, but it's ok to return a \score,
so I am restructuring my code.

You cannot return a \book or \bookpart but you can do this:

%%%%
\version "2.20.0"

aBook =
#(define-void-function
  (name music)
  (symbol? ly:music?)
  (print-book-with-defaults #{
    \book {
      \bookOutputSuffix $(symbol->string name)
      \score { $music }
    } #}))

\aBook one { c'8 d' ees' f' g' a' bes' c'' }
\aBook two { c'8 des' ees' f' g' aes' bes' c'' }

aBookPart =
#(define-void-function
  (name music)
  (symbol? ly:music?)
  (ly:book-add-bookpart!
   (ly:parser-lookup '$current-book)
   #{ \bookpart {
        \markup \italic $(symbol->string name)
        \score { $music }
      } #}))

\book {
  \bookOutputSuffix "bookparts"
  \aBookPart three { c'8 d' e' fis' g' a' b' c'' }
  \aBookPart four { c'8 d' e' f' g' a' bes' c'' }
}
%%%%


-- Aaron Hill

Reply via email to