Am 01.10.2013 12:19, schrieb Urs Liska:
Am 01.10.2013 12:17, schrieb Franciszek Boehlke:
lambda (x) (car x) is exactly the same as car. You should be able to write just
  #(map car all-grob-descriptions)
instead.


Thanks. Now I see that it didn't _seem_ to work because I ran the wrong LilyPond version :-[


Hi again,

sorry to have to insist on perhaps basic questions.
As it is the function now works as I want, but not in 2.16.
From the versions I have available to test it works with 2.17.6 onwards and not with 2.17.3 and less.
Somehow I suspect the change between 2.17.3 and .4

My best bet is that

  #{ $@(map (lambda (s) #{ $colorizeDir $s #}) debug-direction-grob-list) #})


in the mapList function is the offending piece of code.


Is there a way to write this so it compiles both with 2.16.2 and with current versions? If that's not possible how would I achieve the same with 2.16.2 (I can do a conditional include if necessary)?


Please refer to the attached version of the function.


TIA
Urs


\version "2.17.4"

% Define appearance
#(cond ((not (defined? 'debug-direction-up-color))
        (define debug-direction-up-color darkgreen)))
#(cond ((not (defined? 'debug-direction-down-color))
        (define debug-direction-down-color blue)))
#(cond ((not (defined? 'debug-direction-grob-list))
        (define debug-direction-grob-list 
          (map car all-grob-descriptions))))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Directions set with ^ and _ %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

colorizeDir =
#(define-music-function (parser location item)
  (symbol-list-or-music?)
  (define (grob-colorize-dir grob)
    (let ((ev (event-cause grob)))
      (case (and ev (ly:event-property ev 'direction))
              ((1) debug-direction-up-color)
              ((-1) debug-direction-down-color)
              (else '()))))
  #{ \tweak color #grob-colorize-dir #item #})

mapList =
#(define-music-function (parser location)()
  #{ $@(map (lambda (s) #{ $colorizeDir $s #}) debug-direction-grob-list) #})


\layout {
  \context {
    \Voice
    \mapList
  }
}

%%%%%%%%%%%%%%%
% Usage example
%%%%%%%%%%%%%%%

{
  a4-.( b)
  a4^( b)
  \stemUp
  a''8 g''( b)\noBeam c' \stemNeutral
  c''4-3\4-"xy"
  c''_3^\4^"xy"
  c''^3_\4_"xy"
  a'-. a'^.
  g'\mf g'^\mf\>
  a' b'\!^\< c''
  b'\!
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to