[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected behaviour of ly:make-book and ly:make-book-part
From: |
David Kastrup |
Subject: |
Re: Unexpected behaviour of ly:make-book and ly:make-book-part |
Date: |
Sun, 03 Jul 2016 18:48:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Timothy Lanfear <address@hidden> 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