[EMAIL PROTECTED] writes: > Should result in about the same thing as this: > > --- > \notes \context Voice \relative c' { c4. d8 e4. f8 g4. a8 b4. c8 } > --- > > Just to test things, I defined the function 'combine-dur' like this: > > --- > #(define (combine-dur x) > (display "\n===\n") > (let ((a (ly-get-mus-property x 'elements))) > (display (car a)) > (display "\n===\n") > (display (cadr a)) > ) > x) > --- > > I noticed by looking at what displayed that (car a) was the > \myduration sequence and (cadr a) was \music. However, the two > resulting sequences do not act like ordinary lists, and normal mapping > functions do not work. In addition, (car a) is the unevaluated form > of \myduration, with information about how many times to repeat but the > repeats themselves not unfolded. > > At this point I'm at a total loss. Are (car a) and (cadr a) both > valid types of music?
(ly-get-mus-property mus 'elements) returns a possibly non-empty list of music objects. (ly-get-mus-property mus 'element) returns () or a music object. You should always recurse on both, since constructs like \context Voice layer another Music object over their arguments. > If so, why do they return () for every call to > ly-get-mus-property? Can I evaluate nested sequences like nested > lists? Is there a better way to do all this? Repeats happen in interpreting, i.e. after \apply is done, so what you want can not be done. Better write two functions (apply-duration-to-note mus dur) and (apply-durations-to-sequence muslist durlist) use these to write a function that is called like \apply #(lambda (x) (apply-durations-to-sequence (ly-get-mus-property x 'elements) (list (make-duration 2 1) ;; dotted quarter (make-duration 3 0) ;; eighth )) The apply-durations-to-sequence should loop through its 2nd argument for setting durations. When you go this route, be sure to be careful with nesting other music in the { } . Btw, if you finish the code, could we include it in the examples? -- Han-Wen Nienhuys | [EMAIL PROTECTED] | http://www.cs.uu.nl/~hanwen _______________________________________________ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user