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