]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/lily-in-scheme.ly
* input/regression/lily-in-scheme.ly: regression test for #{
[lilypond.git] / input / regression / lily-in-scheme.ly
1 \header {
2     texidoc = "LilyPond syntax can be used inside scheme to
3 build music expressions, with the @code{#@{ ... #@}} syntax.
4 Scheme forms can be introduced inside these blocks by escaping 
5 them with a @code{$}, both in a LilyPond context (see the @code{music} variable) or in a Scheme 
6 context (see the @code{$padding} and @code{$(* padding 2)} forms.)"
7 }
8 \version "2.3.4"
9 \paper { raggedright = ##t }
10
11 withPaddingA = #(def-music-function (location padding music) (number? ly:music?)
12                    #{ \override TextScript #'padding = #$padding
13                       $music 
14                       \revert TextScript #'padding #})
15   
16 withPaddingB = #(def-music-function (location padding music) (number? ly:music?)
17                    #{ \override TextScript #'padding = #$(* padding 2)
18                       $music 
19                       \revert TextScript #'padding #})
20   
21 withPaddingC = #(def-music-function (location padding music) (number? ly:music?)
22                    #{ \override TextScript #'padding = #(+ 1 $(* padding 2))
23                       $music 
24                       \revert TextScript #'padding #})
25   
26   \score {
27       \notes {
28           c'^"1"
29           \withPaddingA #2
30             { c'^"2" c'^"3"}
31           c'^"4"
32           \withPaddingB #2
33             { c'^"5" c'^"6"}
34           c'^"7"
35           \withPaddingC #2
36             { c'^"8" c'^"9"}
37           c'^"10"
38       }
39   }