Thomas Morley <thomasmorle...@gmail.com> writes:

> 2017-08-27 11:56 GMT+02:00 David Kastrup <d...@gnu.org>:
>
>> I was more thinking along the lines of
>>
>> #(define-markup-command (dyn-test layout props strg) (markup?)
>>   (define (fixstring arg)
>>      (let ((res (fold-matches "\\{[^{}*\\}" arg '(0)
>>              (lambda (m prev) ...
>>   (define (fixtree arg)
>>     (cond ((pair? arg) (cons (fixtree (car arg)) (fixtree (cdr arg))))
>>           ((string? arg (fixstring arg)))
>>           (else arg)))
>>
>> Uh, well, you get the drift.
>
> I never really understood all the fold-xxx-procedures and I didn't
> find much usage-examples for fold-matches apart from the trivial one
> in the guile-manual.
> Also, I'm not really familiar with reg-exp.
> So, I'm afraid I'd need some further guidance.
>
> That said, your reg-exp above, "\\{[^{}*\\}", seems not be valid. I
> used: "\\{[^{}*]\\}" not sure whether it's really correct, tho'.

Ouch, sorry for that.  You almost got it:  "\\{[^{}]*\\}" would be
correct (opening brace, an arbitrary number of non-brace characters,
closing brace).

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.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to