lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generate music with scheme


From: Henrik Frisk
Subject: Re: Generate music with scheme
Date: Tue, 12 Apr 2022 05:23:31 +0200



You could also use append-map which will concatenate the lists without
the inner call to make-sequential-music:

%%%%
{
  $(make-sequential-music
   (append-map
    (lambda (x) (list
     #{ $(ly:make-pitch 0 x) 4 #}
     #{ \mark \markup \override #'(font-size . -3) 10 #} ))
    (iota 4 1)))
}
%%%%

In fact, using list-splicing, you can eliminate the outer call to
make-sequential-music as well:

%%%%
{
  $@(append-map
   (lambda (x) (list
    #{ $(ly:make-pitch 0 x) 4 #}
    #{ \mark \markup \override #'(font-size . -3) 10 #} ))
   (iota 4 1))
}
%%%%

Thanks Aaron, that is indeed very neat.
 
Also note the above use of #{ #} to escape music syntax within scheme,
which can often be more abbreviated.

Yes, another thing I had forgotten about!

Best,
/h

reply via email to

[Prev in Thread] Current Thread [Next in Thread]