Hello, everyone. I'm working on creating engravers in scheme. I have the example from here:
http://codereview.appspot.com/181109/show In the example file named, "scheme-engraver.ly" there is this piece of code: (cons 'rest-event (lambda (engraver event) (let* ((x (ly:engraver-make-grob engraver 'TextScript event))) (display (list "caught event" event "\ncreate:\n" x "\n")) (ly:grob-set-property! x 'text "hi")) )) If there's a rest in the notation code like this, "<c-2\6>1 r2", then the above display function will output this: (caught event #<Prob: Stream_event C++: Stream_event((music-cause . #<Prob: Music C++: Music((length . #<Mom 1/2>) (elements) (duration . #<Duration 2 >) (origin . #<location scheme-engraver.ly:23:11>))((display-methods #<procedure #f (rest parser)>) (name . RestEvent) (types general-music event rhythmic-event rest-event)) > ) (length . #<Mom 1/2>) (elements) (duration . #<Duration 2 >) (origin . #<location scheme-engraver.ly:23:11>))((class . rest-event)) > Here's my question. How do I access elements in the event? For example, the duration of the rest is shown above as, "(duration . #<Duration 2>)". I would like to have an "if" statement look at the duration variable and do something based on the value. What would an if for that look like? As you can probably tell, I'm also learning scheme. I've been looking for a reason to learn scheme and the new capability of writing scheme engravers has hooked me! Thanks for the help in advance, this is getting exciting. -Eric _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user