\version "2.18.2" \language "english" piccoloPart = \new Staff { \new Voice { \relative c' { d4 e fs g | a1\fermata | } } } bassPart = \new Staff { \new Voice { \relative c { \clef bass c4 d e f | g1\fermata | } } } #(define compilePart ;; This function is used to do and engrave a book ;; $segment should be a musical expression ;; $name should be a string for the book output suffix (define-void-function (parser location segment name) (ly:music? string?) (let ((paper #{ \paper {} #}) (layout #{ \layout {} #}) (book #{ \book { \score { $segment } } #})) (ly:book-process book paper layout name)))) % _This_ is to test the compilePart function %\compilePart \piccoloPart #"piccolo" %\compilePart \bassPart #"bass" parts = #(list ;; This is a list of parts to be engraved '("piccolo" . #{ \piccoloPart #} ) '("bass" . #{ \bassPart #} )) #(define processAllParts ;; This function is used to call the compilePart function for ;; each part entry in the parts list. (define-void-function (parser location parts) (list?) (map (lambda (p) (let ( (name (car p)) (music (cdr p)) (show (lambda (name thing) ;; This is in the hope to see what's wrong (begin (display (string-append "\nAbout to show " name ":\n\t")) (display thing))))) (begin (show "parser" parser) (show "location" location) (show "name" name) (show "music" music) (compilePart parser location music name) ))) parts))) % _This_ is to call the processAllParts function with % the \parts list. %\processAllParts \parts