+
+\version "2.19.21"
+
+
\header {
-texidoc = "with \\applycontext, \\properties can be modified
+texidoc = "With @code{\\applyContext}, @code{\\properties} can be modified
procedurally. Applications include: checking bar numbers, smart
-octavation. "
+octavation.
+
+
+This example prints a bar-number during processing on stdout.
+"
}
-\score { \notes \relative c'' {
- c1 c1
+\layout { ragged-right= ##t }
+
- %% todo: should put something interesting in the .tex output.
-
- \applycontext #(lambda (tr)
- (let* ((bn (ly:get-context-property tr 'currentBarNumber)))
- (if (= bn 3)
- #t
- (format #t "We were called in ~a" bn))
- ))
+\relative {
+ c''1 c1
- c1 c1
-}}
+ %% todo: should put something interesting in the .tex output.
+
+ \applyContext
+ #(lambda (tr)
+ (ly:progress "\nWe were called in bar number ~a.\n"
+ (ly:context-property tr 'currentBarNumber)))
+ c1 c1
+}