2017-08-27 22:34 GMT+02:00 David Kastrup <d...@gnu.org>: > You are right that fold-matches is probably not worth the trouble in > brain contortion here: processing the result from list-matches should be > good enough without overflowing memory.
I now come up with (only markup again): #(define-markup-command (dyn-test-II layout props strg)(string?) #:properties ((reg-exp "\\{[^{}]*\\}") (separators (char-set #\{ #\})) (dynamcs (char-set #\f #\m #\p #\r #\s #\z))) (interpret-markup layout props (make-line-markup (map (lambda (s) (let* ((matches (list-matches reg-exp s))) (if (null? matches) s (let* ((poss-dyns (map match:substring matches))) (append-map (lambda (p-d) (let* ((cand (string-trim-both p-d separators))) (if (string-every char-set:dynamics cand) (make-concat-markup (list (make-concat-markup (map match:prefix matches)) (make-dynamic-markup cand) (make-concat-markup (map match:suffix matches)))) p-d))) poss-dyns))))) (string-split strg #\space))))) \markup \dyn-test-II #"poco {f}, but {p} sub. {ma} non troppo" Though, if I split the string anyway (splitting at #\space should do no harm, imho), it's probably cheaper to go for string-match instead of list-matches. Not sure... Cheers, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user