lilypond-user
[Top][All Lists]
Advanced

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

Re: Different default arpeggio positions


From: Jean Abou Samra
Subject: Re: Different default arpeggio positions
Date: Sat, 3 Dec 2022 13:41:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

Le 02/12/2022 à 23:47, Thomas Morley a écrit :
I know you like pattern matching, though imho it makes things not
always easier for users.



Yes, I like pattern matching. No, I'm not going to stop using it :-)
Sure, you have to learn it, like every construct, but it improves
code clarity IMHO (especially in complex code).


Even for me - I don't understand that (x x)-line:

        \override Arpeggio.positions =
          #(grob-transformer
            'positions
            (lambda (grob original)
              (match original
                ((a . b) (cons (- a 5.0) (+ b 5.0)))
                (x x))))  ;; <==




This was me being too lazy to look up whether
original might be something other than a pair,
like #f, '() or *unspecified*, especially if
the grob suicided itself inside the positions
callback. In such a case, this code would have
returned original unchanged, as

(if (pair? original)
    (cons (- (car original) 5.0) (+ (cdr original) 5.0))
    original)

This case appears not to occur, though, so that precaution
was unnecessary.

Best,
Jean

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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