Thanks Valentin, I will definitely use it in my code. But this API change leaves me a bit perplexed. It's the first one I've encountered since LilyPond 2.19.84! For this reason I am crossposting this message with the devel mailing list. Why has forward compatibility not been ensured for this function?
Il sab 8 feb 2025, 17:42 Valentin Petzel <valen...@petzel.at> ha scritto: > Hello Paolo, > > > Is there a way to make this snippet compatible with all LilyPond > > versions starting from 2.19.84? > > You could do something like this > > ``` > requireVersion = > #(define-scheme-function (version then else) > (string? scheme? scheme?) > (define (list< x y) > (if (null? x) > #f > (cond ((< (car x) (car y)) #t) > ((> (car x) (car y)) #f) > (else (list< (cdr x) (cdr y)))))) > (let* ((split (string-split version #\.)) > (nversion (map string->number split)) > (tversion (ly:version))) > (if (list< tversion nversion) > else > then))) > > { > \set Score.proportionalNotationDuration = \requireVersion "2.25.23" > #1/32 > #(ly:make-moment 1 32) > c' c' c' > } > ``` > > to set a different value depending on the Lilypond version. > > Cheers, > Valentin