[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Default accidental style with timing off
From: |
Aaron Hill |
Subject: |
Re: Default accidental style with timing off |
Date: |
Wed, 22 Apr 2020 15:09:46 -0700 |
User-agent: |
Roundcube Webmail/1.4.2 |
On 2020-04-22 1:10 pm, Fr. Samuel Springuel wrote:
After some more work I came up with the attached redefinition of the
bar which does what I originally asked for. I’d appreciate any scheme
experts critique on what I have as I’m not entirely comfortable with
the way I’m switching in and out of scheme. It works, I’m just not
sure it’s “proper.”
Seems fine.
A pattern I could recommend is defining a named procedure as opposed to
using a lambda with \applyContext:
%%%%
foo = #(define-music-function () ()
(define (proc context)
(do-something-here))
#{ \applyContext #proc #})
%%%%
This keeps potentially complex S-expressions outside LilyPond syntax,
which should improve readability.
Apart from that, I would suggest simplifying your variable names. There
is no need to call something "mything" when "thing" would suffice.
Remember that bindings have scope; and local bindings trump. You only
need unique names if you must have access to both variables.
That said, I would prefer "my-thing" over "mything". You have to be
careful with smooshing words together lest they read poorly. "curnum"
is not ideal as it looks like it could be a word in Latin. "currnum" is
slightly better, but "curr-num" would be the preference if abbreviation
is required.
Mind you, I would sidestep all that by calling it "bar-number":
;;;;
(let* ((score (ly:context-find context 'Score))
(bar-number (ly:context-property score 'internalBarNumber)))
(ly:context-set-property! score 'internalBarNumber (1+ bar-number)))
;;;;
-- Aaron Hill