lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: improving Janek's \dynamic function (for combo dynamics)


From: David Kastrup
Subject: Re: improving Janek's \dynamic function (for combo dynamics)
Date: Sun, 27 Aug 2017 22:34:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2017-08-27 11:56 GMT+02:00 David Kastrup <address@hidden>:
>
>> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]