+(define-ly-syntax (composed-markup-list parser location commands markups)
+ ;; `markups' being a list of markups, eg (markup1 markup2 markup3),
+ ;; and `commands' a list of commands with their scheme arguments, in reverse order,
+ ;; eg: ((italic) (raise 4) (bold)), maps the commands on each markup argument, eg:
+ ;; ((bold (raise 4 (italic markup1)))
+ ;; (bold (raise 4 (italic markup2)))
+ ;; (bold (raise 4 (italic markup3))))
+
+ (define (compose arg)
+ (fold
+ (lambda (cmd prev) (append cmd (list prev)))
+ arg
+ commands))
+ (let loop ((markups markups) (completed '()))
+ (cond ((null? markups) (reverse! completed))
+ ((markup? (car markups))
+ (loop (cdr markups)
+ (cons (compose (car markups)) completed)))
+ (else
+ (call-with-values
+ (lambda () (break! markup? markups))
+ (lambda (complex rest)
+ (loop rest
+ (reverse!
+ (make-map-markup-commands-markup-list
+ compose complex) completed))))))))
+
+(define-ly-syntax (property-operation parser location ctx music-type symbol . args)