On 2019-03-01 6:40 pm, Aaron Hill wrote:
I encountered an unexpected error where reduce is unbound when
specifying a lambda within a \context block:

%%%%
\version "2.19.82"
\layout { \context { \Voice
  \override NoteHead.color = #(lambda (grob)
    (display (reduce + 0 '(1 2 3 4))) red)
} }
{ b'4 }
%%%%

Compare to the following snippets that work:

%%%%
\version "2.19.82"
{ \override NoteHead.color = #(lambda (grob)
    (display (reduce + 0 '(1 2 3 4))) red)
  b'4 }
%%%%
\version "2.19.82"
#(define (foo grob)
  (display (reduce + 0 '(1 2 3 4))) red)
\layout { \context { \Voice
  \override NoteHead.color = #foo
} }
{ b'4 }
%%%%

fold is also unbound, although map works fine.

Am I missing a subtlety here, or is this a bug?

I just tried another permutation and it appears to be the \layout block, not the \context block, that is affecting things. The following fails with the same error about reduce being unbound:

%%%%
\version "2.19.82"
\layout {
  #(define (foo grob)
    (display (reduce + 0 '(1 2 3 4))) red)
  \context { \Voice
    \override NoteHead.color = #foo
  }
}
{ b'4 }
%%%%

-- Aaron Hill

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

Reply via email to