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 <[email protected]> wrote:

> 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 "S" (number->string part)))
>   )
> )
>
> which gives me a default value for "part" if not defined on the command
> line. The "partName" variable is used later: if non-null, the script will
> print parts instead of a full score, thus
>
> lilypond -o Hexany_Permutations hexany_permutations.ly
> lilypond -e "(define part 1)" -o Hexany_Permutations_S1
> hexany_permutations.ly
> lilypond -e "(define part 2)" -o Hexany_Permutations_S2
> hexany_permutations.ly
> lilypond -e "(define part 3)" -o Hexany_Permutations_S3
> hexany_permutations.ly
> lilypond -e "(define part 4)" -o Hexany_Permutations_S4
> hexany_permutations.ly
> lilypond -e "(define part 5)" -o Hexany_Permutations_S5
> hexany_permutations.ly
> lilypond -e "(define part 6)" -o Hexany_Permutations_S6
> hexany_permutations.ly
>
> which yields a PDF for the full score and a separate PDF for each part
> (where the instruments are designated as S1 through S6). I guess I could
> probably do it all in a single invocation, but I haven't gotten that far
> yet -- only been using Lilypond for about a week now.
>
> - Dave
>
> On Mon, Oct 19, 2020 at 6:22 PM Aaron Hill <[email protected]>
> wrote:
>
>> 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 (@ (guile-user) value)))
>> %%%%
>>
>> ====
>> > lilypond eval-scope.ly
>> GNU LilyPond 2.20.0
>> Processing `eval-scope.ly'
>> Parsing...
>> value = #f
>> Success: compilation successfully completed
>>
>> > lilypond -e "(define-public value 123)" eval-scope.ly
>> GNU LilyPond 2.20.0
>> Processing `eval-scope.ly'
>> Parsing...
>> value = 123
>> Success: compilation successfully completed
>> ====
>>
>>
>> -- Aaron Hill
>>
>>

Reply via email to