[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: improving Janek's \dynamic function (for combo dynamics)
From: David Kastrup <dak () gnu ! org>
Date: 2017-08-27 20:34:29
Message-ID: 87d17g7nsa.fsf () fencepost ! gnu ! org
[Download RAW message or body]
Thomas Morley <thomasmorley65@gmail.com> writes:
> 2017-08-27 11:56 GMT+02:00 David Kastrup <dak@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic