Re: Scheme expressions on lilypond command line (-e)

2020-10-20 Thread Dave Seidel
This is excellent, Aaron, thanks very much. Learning by example suits me well, and I'm enjoying getting into Scheme. I use Python + Java all day long on the job (in fact used Python to generate all of the music parts of the score I'm working on -- it's originally a Csound piece that was written

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Aaron Hill
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

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Aaron Hill
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))) ) ) partName = #(or (false-if-exception (format #f "S~d" (@ (guile-user)

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
More succinct: #(begin (use-modules (guile-user)) (if (not(defined? 'part)) (define partName "") (define partName (string-append "S" (number->string part))) ) ) though the warning still prints, but that's not a big deal for me. On Mon, Oct 19, 2020 at 10:23 PM Dave Seidel wrote:

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
Interesting. I don't understand the '@' syntax -- been trying to look it up but so far to no avail. Here's what I ended up with: #(begin (use-modules (guile-user)) (if (not(symbol? 'part)) (define part 0) ) (if (= part 0) (define partName "") (define partName (string-append

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Aaron Hill
On 2020-10-19 2:45 pm, Jean Abou Samra wrote: You can ignore the warning that shows up (https://gitlab.com/lilypond/lilypond/-/issues/3613). You can avoid the warning by using the @ syntax: eval-scope.ly \version "2.20.0" #(format #t "\nvalue = ~s" (false-if-exception (@

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
Thanks Jean! I need to read more carefully! On Mon, Oct 19, 2020 at 5:45 PM Jean Abou Samra wrote: > > Le 19/10/2020 à 23:14, Dave Seidel a écrit : > > Hi all, > > I am trying to define a variable on the command line that I can use within > the .ly file. I've tried both > > -e "(define-public

Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Jean Abou Samra
Le 19/10/2020 à 23:14, Dave Seidel a écrit : Hi all, I am trying to define a variable on the command line that I can use within the .ly file. I've tried both -e "(define-public part 1)" and -e "(define part 1)" In the .ly file, I have a Scheme expression #(if (= part 0)

Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
Hi all, I am trying to define a variable on the command line that I can use within the .ly file. I've tried both -e "(define-public part 1)" and -e "(define part 1)" In the .ly file, I have a Scheme expression #(if (= part 0) (define partName "") (define partName (string-append "S"