[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: arbitrary repeat counter
From: |
Simon Bailey |
Subject: |
Re: arbitrary repeat counter |
Date: |
Wed, 1 Jun 2022 17:19:40 +0100 |
Hi,
On Wed, 1 Jun 2022 at 17:09, Jean Abou Samra - jean at abou-samra.fr
<mailforwards@cloudmails.net> wrote:
> What did not work? This is perfectly valid Scheme:
>
> (set! count (1+ count))
(set! counter (+ counter 1))
was giving an error message. Probably had some misaligned parentheses
or other weirdness. I didn't know about (1+ var) ;)
> You're welcome. To be honest, and simplifying a bit, I had a
> year of unsuccessful attempts to grasp Scheme before Urs'
> Scheme tutorial made me learn as much of Scheme in 4 hours
> as I had learnt in a year, then another year without that kind
> of help to learn LilyPond internals, so if I've managed to write
> something that is similarly turning a year into 4 hours for
> you, I'm quite happy.
Your readthedocs thing really helped; I still need to have a look at
Urs' tutorial. I did some functional programming sometime at the
beginning of the millenium, but 20yrs of OOP is a hard habit to break
;-)
A further definition:
repeatCountingWithTags = #(define-music-function (n music) (index? ly:music?)
#{
<<
\tag #'score \repeat unfold #n { #music }
\tag #'part \repeatCounting #n { #music \bar "!|" }
>>
#})
ebass = \relative c {
\clef bass
\time 7/4
\repeatCountingWithTags 4 { c4. 8 r4 8 r c2. | d4. 4. 4 e2. | 1 r2 r4 | }
}
\new StaffGroup <<
\new Staff \with { instrumentName = "Score" } \keepWithTag #'score \ebass
\new Staff \with { instrumentName = "Part" } \keepWithTag #'part \ebass
>>
and I get the attached output, which is exactly what I want. And it
makes my input files so much easier to read and manage.
Thanks ever so much for your help!
Kind regards,
sb
--
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.
2022-06-01 17_16_44-Untitled (2) [modified] – Frescobaldi.png
Description: PNG image
- Re: arbitrary repeat counter, (continued)
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter,
Simon Bailey <=
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/04
- Re: arbitrary repeat counter, Wols Lists, 2022/06/06
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/06
- Re: arbitrary repeat counter, Wols Lists, 2022/06/06
- Re: arbitrary repeat counter, David Kastrup, 2022/06/06
- Re: arbitrary repeat counter, Wols Lists, 2022/06/06