lilypond-user
[Top][All Lists]
Advanced

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

Unexpected behaviour of ly:make-book and ly:make-book-part


From: Timothy Lanfear
Subject: Unexpected behaviour of ly:make-book and ly:make-book-part
Date: Sun, 3 Jul 2016 17:21:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

While constructing books using Scheme functions, I found some behaviour I did not expect.

The scores are written out in the reverse order from the order of the arguments. Easily fixed by applying the reverse function to the list of scores. Is there a reason for this choice of ordering?

The scores to be written by ly:make-book-part are in a single list argument, whereas the scores for ly:make-book are provided as one score per argument and a variable number of arguments. The documentation strings for the two functions are identical as regards passing the scores. ly:make-book-part's syntax seems more natural.

\version "2.19.44"

scorea = \score { a'1 }
scoreb = \score { b'1 }

mybookpart = #(define-void-function (a b) (ly:score? ly:score?)
  (let* ((bookpart (ly:make-book-part (list a b)))
         (book     (ly:make-book $defaultpaper $defaultheader)))
    (ly:book-add-bookpart! book bookpart)
    (ly:book-process book $defaultpaper $defaultlayout "bookpart")))

mybook = #(define-void-function (a b) (ly:score? ly:score?)
  (let* ((book (ly:make-book $defaultpaper $defaultheader a b)))
    (ly:book-process book $defaultpaper $defaultlayout "book")))

\mybookpart \scorea \scoreb
\mybook \scorea \scoreb

--
Timothy Lanfear, Bristol, UK.




reply via email to

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