Timothy Lanfear <[email protected]> writes: > 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
LilyPond's code in lily/book.cc and lily/book-scheme.cc looks rather puzzling. Someone would need to go through with a big rake and get it to behave consistently. Particularly when adding more than one element at once, it does not look like keeping order has been given much thought. -- David Kastrup _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
