[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: newbie: help with Scheme functions
From: |
Aaron Hill |
Subject: |
Re: newbie: help with Scheme functions |
Date: |
Sun, 18 Oct 2020 13:31:40 -0700 |
User-agent: |
Roundcube Webmail/1.4.9 |
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