On 20 November 2017 at 12:00, David Kastrup <d...@gnu.org> wrote:

> Gianmaria Lari <gianmarial...@gmail.com> writes:
>
> > I have this:
> >
> > \version "2.19.80"
> >
> > scale = {c d e f g a b}
> > pattern = {c d e f}
> >
> > \fixed c' {
> >   \modalTranspose c c \scale \pattern
> >   \modalTranspose c d \scale \pattern
> >   \modalTranspose c e \scale \pattern
> >   \modalTranspose c f \scale \pattern
> >   \modalTranspose c g \scale \pattern
> >   \modalTranspose c a \scale \pattern
> >   \modalTranspose c b \scale \pattern
> >   \modalTranspose c c' \scale \pattern
> > }
> >
> > Is there any (simple) way to rewrite it in a more concise way like this
> for
> > example?
> >
> >   \repeat unfold 7 {
> >     \modalTranspose c "c+index" \scale \pattern
> >   }
>
> What is simple?
>
> \version "2.18.0"
>
> scale = {c d e f g a b}
> pattern = {c d e f}
>
> \fixed c' {
>   #@(map
>       (lambda (p)
>         #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
>       (iota 8))
> }
>
> --
> David Kastrup
>

Thank you David, it works perfectly!

Is there any way to encapsulate it in a function to avoid to write all the
code any time I need it?

* * *

Regarding "simple". Never think seriously about what I mean with "simple".
Maybe:

Suppose that you know well how to informally solve a problem.
Now suppose you have to describe your solution in a formal and algorithmic
way.

Between many formal solution I would say that the simplest one is that one
that better overlap the informal solution.
g.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to