Am Sa., 2. März 2019 um 03:41 Uhr schrieb Aaron Hill <lilyp...@hillvisions.com>: > > 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? > > > -- Aaron Hill
Hi Aaron, fold, reduce any many other procedures are not part of core-guile, but of the SRFI-1 module. Nowadays SRFI-1 is present in every ly-file. Not in \paper and \layout, though. I don't know how one could change it. Thus I usually define things outside from layout/paper: #(define foo (lambda (grob) (display (reduce + 0 '(1 2 3 4))) red)) \layout { \context { \Voice \override NoteHead.color = #foo } } { b'4 } Or quick'n dirty: #(define reduce reduce) \layout { \context { \Voice \override NoteHead.color = #(lambda (grob) (display (reduce + 0 '(1 2 3 4))) red) } } { b'4 } Cheers, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user