David Kastrup <d...@gnu.org> writes: > Stefan Thomas <kontrapunktste...@googlemail.com> writes: > >> Dear community, >> because I'm awfully bad in mathematics I wrote a function for >> calculating the correct length of multimeasure rests. >> Although it doesn't cause a crash (which is a huge sucess for me as a >> "programmer"), it doesn't work as expected. Instead of showing one >> goupt of multimeasure rests, it shows every single multimeasure rest. >> Does someone have an idea to avoid the problem? > > *x is not a shorthand for \repeat unfold but a duration modifier. > >> Here is my snippet: >> %%%%%%%%%%%%%%%%% >> \version "2.14.2" >> xR = #(define-music-function (parser location ANFANG LAST x ) >> (number? number? ly:music? ) >> #{ % >> \repeat unfold $(+ 1(- LAST ANFANG)) $x >> #}) >> \layout { \context { \Score skipBars = ##t } } >> \new Staff { >> R1*5 % this works as expected >> \xR #6 #11 R1 % this, unfortunately, not, it shows 6 single >> barrests >> c'1 >> } > > If you can't keep your newsreader from completely mangling examples (it > contains unbreakable spaces as well as line breaks in comments), you > should likely try attaching the examples as a file instead.
Actually, this was because you sent the mail as a mixed HTML/plain text mail. You'll make the average reader of mailing list articles (and of mail in general) quite happier if you stop your mail client from wastefully creating duplicate HTML content that is not even properly usable (in this case). Switching to the plain text copy, I got the example out fine. Try the following: %%%%%%%%%%%%%%%%% \version "2.14.2" xR = #(define-music-function (parser location ANFANG LAST x ) (number? number? ly:music? ) #{ \scaleDurations #$(cons (+ 1(- LAST ANFANG)) 1) $x #}) \layout { \context { \Score skipBars = ##t } } \new Staff { R1*5 % this works as expected \xR #6 #11 R1 % this, unfortunately, not, it shows 6 single barrests c'1 } I can't vouch for it being correct, not having 2.14 along anymore (the syntax for 2.15.22 is slightly different and one could do this much easier anyway). -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user