lilypond-user
[Top][All Lists]
Advanced

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

Re: book-predicate


From: Jan-Peter Voigt
Subject: Re: book-predicate
Date: Tue, 28 Feb 2012 10:20:28 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Again: Thank you, David!

So now (with upcoming 2.15.31 or 2.16) one can write functions like:

--snip--
bookif = #(define-scheme-function (parser location book pred)(ly:book? procedure?)
       (if (pred parser location)(collect-bookpart-for-book parser book) ))
--snip--

to conditionally add bookparts or create books:

--snip--
writeBook = #(define-scheme-function (parser location book paper layout file)(ly:book? ly:output-def? ly:output-def? string?)
  (ly:book-process book paper layout file))
--snip--

(I know, it would also work with a scheme?-predicate, but type-safety is IMHO a good thing ;-) )

Cheers, Jan-Peter

On 27.02.2012 10:10, David Kastrup wrote:
Jan-Peter Voigt<address@hidden>  writes:

Am 24.02.2012 um 16:24 schrieb:

Jan-Peter Voigt<address@hidden>  writes:

Hello list,

when I use books or bookparts for (scheme-)function arguments, I
haven't found the predicate for it.
paper-book? is something else, or am I missing something?
Well, you can always use scheme? and file a feature request in the mean
time.
Thank you David,

the scheme?-solution is what I do right now. I will send a feature
request next days.
Don't bother.

commit 09814b549186893c265bcdf835edbe242f6354cf
Author: David Kastrup<address@hidden>
Date:   Sun Feb 26 11:23:39 2012 +0100

     Implement ly:book? and ly:context-def? predicates

Note that a bookpart _is_ a book as well, usually without a paper block
of its own.





reply via email to

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