Re: repeat index

2017-11-24 Thread bb
Sorry, interpreted this repetition as a scheme topic.

Regards

Am 24.11.2017 um 13:43 schrieb David Kastrup:
> bb  writes:
>
>> Do you think that as a proper question for a lilipond user blog?
> The software is called "LilyPond", and LilyPond-user is not a blog but a
> mailing list.  Apart from that, the answer is most emphatically yes.
> This is a question about common LilyPond usage.  It is not trivial,
> there is no cut&dried answer in the docs, but it's at user-attainable
> level.  This is very much what this mailing list is for.
>
>> I think a scheme blog might be a better place for that problem.
> Nonsense.  The problems involved here are LilyPond problems, not general
> Scheme problems.
>
>> I cannot help, but what however, whatever do you think that code to do?
> Uh, have you even been following the discussion?  Once you don't view
> this as a blog but a mailing list, you'll realize that there are
> _threads_ consisting of mails and answers to those mails.  Your mail
> reading software (or at least a mailing list aggregator if you prefer
> blog-like treatment) should provide you with the necessary context in
> form of the mailing list threads.
>


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread Gianmaria Lari
It works fantastically well. To automatically generate exercise this is
more than great.
Thanks a lot David!
g.

On 24 November 2017 at 10:55, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > On 20 November 2017 at 23:01, David Kastrup  wrote:
> >>
> >> whatever =
> >> #(define-music-function (pattern) (ly:music?)
> >>   #{ \fixed c' {
> >>#@(map
> >>(lambda (p)
> >>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern
> #})
> >>(iota 8))
> >>  } #})
> >>
> >> \whatever {c d e f}
> >> \whatever {f e d c}
> >> \whatever {a c e g}
> >>
> >
> > I tried the above code but without success. When I tried it few days ago
> I
> > was thinking there was some simple to solve problem  and I didn't write
> you
> > immediately; I wanted to try to solve the problem by myself but I have
> not
> > been able to do it.
> >
> > This is the complete code according what you wrote (I hope I didn't
> > introduce any errors):
> >
> > \version "2.19.80"
> > scale = {c d e f g a b }
> >
> > whatever =
> > #(define-music-function (pattern) (ly:music?)
> >   #{ \fixed c' {
> >#@(map
> >(lambda (p)
> >  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern
> #})
> >(iota 8))
> >  } #})
> >
> > \whatever {c d e f}
> > \whatever {a c e g}
> >
> >
> > It looks that #(ly:make-pitch -1 p) inside this function does not
> decrease
> > the value of p. So the result is always the same _non transposed_
> sequence.
> > There is also a strange (to me) problem with the octave that's too high
> ( I
> > have been able to solve it but I don't understand why it happens).
> >
> > The same code outside the function works well:
> >
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #})
> >   (iota 8))
> > }
> >
> >
> > What's the issue?
>
> Sorry, my fault.  The result is sky-high pitches.  That's typical for
> "failure to copy": here #pattern is used over and over again and being
> (destructively) transposed every time.
>
> The solution is simply to write $pattern (which _does_ copy, as does
> \scale) instead of #pattern in the function.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread David Kastrup
bb  writes:

> Do you think that as a proper question for a lilipond user blog?

The software is called "LilyPond", and LilyPond-user is not a blog but a
mailing list.  Apart from that, the answer is most emphatically yes.
This is a question about common LilyPond usage.  It is not trivial,
there is no cut&dried answer in the docs, but it's at user-attainable
level.  This is very much what this mailing list is for.

> I think a scheme blog might be a better place for that problem.

Nonsense.  The problems involved here are LilyPond problems, not general
Scheme problems.

> I cannot help, but what however, whatever do you think that code to do?

Uh, have you even been following the discussion?  Once you don't view
this as a blog but a mailing list, you'll realize that there are
_threads_ consisting of mails and answers to those mails.  Your mail
reading software (or at least a mailing list aggregator if you prefer
blog-like treatment) should provide you with the necessary context in
form of the mailing list threads.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread bb
Do you think that as a proper question for a lilipond user blog? I think
a scheme blog might be a better place for that problem.

I cannot help, but what however, whatever do you think that code to do?

Regards

Am 24.11.2017 um 10:45 schrieb Gianmaria Lari:
>
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>        #@(map
>            (lambda (p)
>              #{ \modalTranspose c #(ly:make-pitch -1 p) \scale
> #pattern #})
>            (iota 8))
>      } #})
>
> \whatever {c d e f}
> \whatever {f e d c}
> \whatever {a c e g}
>
>
> I tried the above code but without success. When I tried it few days
> ago I was thinking there was some simple to solve problem  and I
> didn't write you immediately; I wanted to try to solve the problem by
> myself but I have not been able to do it.
>
> This is the complete code according what you wrote (I hope I didn't
> introduce any errors):
>
> \version "2.19.80"
> scale = {c d e f g a b }
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>        #@(map
>            (lambda (p)
>              #{ \modalTranspose c #(ly:make-pitch -1 p) \scale
> #pattern #})
>            (iota 8))
>      } #})
>
> \whatever {c d e f}
> \whatever {a c e g}
>
>  
> It looks that #(ly:make-pitch -1 p) inside this function does not
> decrease the value of p. So the result is always the same _non
> transposed_ sequence. There is also a strange (to me) problem with the
> octave that's too high ( I have been able to solve it but I don't
> understand why it happens).
>
> The same code outside the function works well:
>
> \fixed c' {
>   #@(map
>       (lambda (p)
>         #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e
> f} #})
>       (iota 8))
> }
>
>
> What's the issue?
> Thank you, g.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread David Kastrup
Gianmaria Lari  writes:

> On 20 November 2017 at 23:01, David Kastrup  wrote:
>>
>> whatever =
>> #(define-music-function (pattern) (ly:music?)
>>   #{ \fixed c' {
>>#@(map
>>(lambda (p)
>>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>>(iota 8))
>>  } #})
>>
>> \whatever {c d e f}
>> \whatever {f e d c}
>> \whatever {a c e g}
>>
>
> I tried the above code but without success. When I tried it few days ago I
> was thinking there was some simple to solve problem  and I didn't write you
> immediately; I wanted to try to solve the problem by myself but I have not
> been able to do it.
>
> This is the complete code according what you wrote (I hope I didn't
> introduce any errors):
>
> \version "2.19.80"
> scale = {c d e f g a b }
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>#@(map
>(lambda (p)
>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>(iota 8))
>  } #})
>
> \whatever {c d e f}
> \whatever {a c e g}
>
>
> It looks that #(ly:make-pitch -1 p) inside this function does not decrease
> the value of p. So the result is always the same _non transposed_ sequence.
> There is also a strange (to me) problem with the octave that's too high ( I
> have been able to solve it but I don't understand why it happens).
>
> The same code outside the function works well:
>
> \fixed c' {
>   #@(map
>   (lambda (p)
> #{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #})
>   (iota 8))
> }
>
>
> What's the issue?

Sorry, my fault.  The result is sky-high pitches.  That's typical for
"failure to copy": here #pattern is used over and over again and being
(destructively) transposed every time.

The solution is simply to write $pattern (which _does_ copy, as does
\scale) instead of #pattern in the function.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-24 Thread Gianmaria Lari
On 20 November 2017 at 23:01, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > On 20 November 2017 at 15:18, David Kastrup  wrote:
> >
> >> Gianmaria Lari  writes:
> >>
> >> > On 20 November 2017 at 12:00, David Kastrup  wrote:
> >> >
> >> >> Gianmaria Lari  writes:
> >>
> >> >> > 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))
> >> >> }
> >> >
> >> > 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?
> >>
> >> What is "all the code"?  I really have no idea what makes you consider
> >> something simple (and your "explanation" below does not help at all
> >> since it is tantamount to "simple depends on the viewer's metrics").
> >> I also have no idea what part of the above you consider "it" to be
> >> encapsulated and what you consider variable.
> >
> > I'm sorry I have not been clear. If you have a look to the following
> source
> > you'll see that the same code is repeated three times (only the variable
> > 'pattern' changes).
> >
> > \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))
> > }
> >
> > pattern = {f e d c}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> > pattern = {a c e g}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> >
> > I was wondering if it was possible to to avoid this redundancy.
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>#@(map
>(lambda (p)
>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>(iota 8))
>  } #})
>
> \whatever {c d e f}
> \whatever {f e d c}
> \whatever {a c e g}
>

I tried the above code but without success. When I tried it few days ago I
was thinking there was some simple to solve problem  and I didn't write you
immediately; I wanted to try to solve the problem by myself but I have not
been able to do it.

This is the complete code according what you wrote (I hope I didn't
introduce any errors):

\version "2.19.80"
scale = {c d e f g a b }

whatever =
#(define-music-function (pattern) (ly:music?)
  #{ \fixed c' {
   #@(map
   (lambda (p)
 #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
   (iota 8))
 } #})

\whatever {c d e f}
\whatever {a c e g}


It looks that #(ly:make-pitch -1 p) inside this function does not decrease
the value of p. So the result is always the same _non transposed_ sequence.
There is also a strange (to me) problem with the octave that's too high ( I
have been able to solve it but I don't understand why it happens).

The same code outside the function works well:

\fixed c' {
  #@(map
  (lambda (p)
#{ \modalTranspose c #(ly:make-pitch -1 p) \scale {c d e f} #})
  (iota 8))
}


What's the issue?
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-20 Thread Gianmaria Lari
That's exactly what I was thinking. Thank you David!

And yes, yesterday I found this part of the manual and I start reading it.

Thanks a lot for your help!
g.

On 20 November 2017 at 23:01, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > On 20 November 2017 at 15:18, David Kastrup  wrote:
> >
> >> Gianmaria Lari  writes:
> >>
> >> > On 20 November 2017 at 12:00, David Kastrup  wrote:
> >> >
> >> >> Gianmaria Lari  writes:
> >>
> >> >> > 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))
> >> >> }
> >> >
> >> > 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?
> >>
> >> What is "all the code"?  I really have no idea what makes you consider
> >> something simple (and your "explanation" below does not help at all
> >> since it is tantamount to "simple depends on the viewer's metrics").
> >> I also have no idea what part of the above you consider "it" to be
> >> encapsulated and what you consider variable.
> >
> > I'm sorry I have not been clear. If you have a look to the following
> source
> > you'll see that the same code is repeated three times (only the variable
> > 'pattern' changes).
> >
> > \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))
> > }
> >
> > pattern = {f e d c}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> > pattern = {a c e g}
> > \fixed c' {
> >   #@(map
> >   (lambda (p)
> > #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
> >   (iota 8))
> > }
> >
> >
> > I was wondering if it was possible to to avoid this redundancy.
>
> whatever =
> #(define-music-function (pattern) (ly:music?)
>   #{ \fixed c' {
>#@(map
>(lambda (p)
>  #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
>(iota 8))
>  } #})
>
> \whatever {c d e f}
> \whatever {f e d c}
> \whatever {a c e g}
>
> It might make sense to read up on the basics of music functions in the
> notation reference.  Simple substitution functions like the above should
> be more or less covered and adding
>
> ... =
> #(define-music-function (pattern) (ly:music?)
>   #{ ... #})
>
> around some LilyPond code is not exactly rocket science.  For that
> reason my question about what you consider simple and what not.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-20 Thread David Kastrup
Gianmaria Lari  writes:

> On 20 November 2017 at 15:18, David Kastrup  wrote:
>
>> Gianmaria Lari  writes:
>>
>> > On 20 November 2017 at 12:00, David Kastrup  wrote:
>> >
>> >> Gianmaria Lari  writes:
>>
>> >> > 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))
>> >> }
>> >
>> > 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?
>>
>> What is "all the code"?  I really have no idea what makes you consider
>> something simple (and your "explanation" below does not help at all
>> since it is tantamount to "simple depends on the viewer's metrics").
>> I also have no idea what part of the above you consider "it" to be
>> encapsulated and what you consider variable.
>
> I'm sorry I have not been clear. If you have a look to the following source
> you'll see that the same code is repeated three times (only the variable
> 'pattern' changes).
>
> \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))
> }
>
> pattern = {f e d c}
> \fixed c' {
>   #@(map
>   (lambda (p)
> #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
>   (iota 8))
> }
>
> pattern = {a c e g}
> \fixed c' {
>   #@(map
>   (lambda (p)
> #{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
>   (iota 8))
> }
>
>
> I was wondering if it was possible to to avoid this redundancy.

whatever =
#(define-music-function (pattern) (ly:music?)
  #{ \fixed c' {
   #@(map
   (lambda (p)
 #{ \modalTranspose c #(ly:make-pitch -1 p) \scale #pattern #})
   (iota 8))
 } #})

\whatever {c d e f}
\whatever {f e d c}
\whatever {a c e g}

It might make sense to read up on the basics of music functions in the
notation reference.  Simple substitution functions like the above should
be more or less covered and adding

... =
#(define-music-function (pattern) (ly:music?)
  #{ ... #})

around some LilyPond code is not exactly rocket science.  For that
reason my question about what you consider simple and what not.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-20 Thread Gianmaria Lari
On 20 November 2017 at 15:18, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > On 20 November 2017 at 12:00, David Kastrup  wrote:
> >
> >> Gianmaria Lari  writes:
>
> >> > 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))
> >> }
> >
> > 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?
>
> What is "all the code"?  I really have no idea what makes you consider
> something simple (and your "explanation" below does not help at all
> since it is tantamount to "simple depends on the viewer's metrics").
> I also have no idea what part of the above you consider "it" to be
> encapsulated and what you consider variable.
>
> > 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.
>
> --
> David Kastrup
>

I'm sorry I have not been clear. If you have a look to the following source
you'll see that the same code is repeated three times (only the variable
'pattern' changes).

\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))
}

pattern = {f e d c}
\fixed c' {
  #@(map
  (lambda (p)
#{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
  (iota 8))
}

pattern = {a c e g}
\fixed c' {
  #@(map
  (lambda (p)
#{ \modalTranspose c #(ly:make-pitch -1 p) \scale \pattern #})
  (iota 8))
}


I was wondering if it was possible to to avoid this redundancy.

And yes, forgot what I tried to define as simpler. In this case it only
makes things more complicated...
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-20 Thread David Kastrup
Gianmaria Lari  writes:

> On 20 November 2017 at 12:00, David Kastrup  wrote:
>
>> Gianmaria Lari  writes:

>> > 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))
>> }
>
> 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?

What is "all the code"?  I really have no idea what makes you consider
something simple (and your "explanation" below does not help at all
since it is tantamount to "simple depends on the viewer's metrics").
I also have no idea what part of the above you consider "it" to be
encapsulated and what you consider variable.

> 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.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: repeat index

2017-11-20 Thread Gianmaria Lari
On 20 November 2017 at 12:00, David Kastrup  wrote:

> Gianmaria Lari  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


Re: repeat index

2017-11-20 Thread David Kastrup
Gianmaria Lari  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

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user