[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme expressions on lilypond command line (-e)
From: |
Aaron Hill |
Subject: |
Re: Scheme expressions on lilypond command line (-e) |
Date: |
Mon, 19 Oct 2020 20:25:13 -0700 |
User-agent: |
Roundcube Webmail/1.4.9 |
On 2020-10-19 7:51 pm, Dave Seidel wrote:
More succinct:
#(begin
(use-modules (guile-user))
(if (not(defined? 'part))
(define partName "")
(define partName (string-append "S" (number->string part)))
)
)
To be even more succinct, observe the following:
====
Avoid negated predicates by swapping the consequent and alternate.
;;;;
(if (defined? 'part)
(define partName (string-append "S" (number->string part)))
(define partName ""))
;;;;
====
Extract common logic from consequent and alternate.
;;;;
(define partName
(if (defined? 'part)
(string-append "S" (number->string part))
""))
;;;;
====
Use formatted output instead of manual string conversion/concatenation.
;;;;
(define partName
(if (defined? 'part)
(format #f "S~d" part)
""))
;;;;
-- Aaron Hill