lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying variables and parameter values


From: David Sumbler
Subject: Re: Displaying variables and parameter values
Date: Fri, 22 Jan 2016 21:18:45 +0000

On Tue, 2016-01-19 at 16:26 +0100, Simon Albrecht wrote:
> On 19.01.2016 16:20, David Sumbler wrote:
> > Is there a way of displaying the current value of particular variables
> > and parameters during Lilypond compilation?
> 
> Of course, e.g. with
> #(format "Variable ‘foo’ currently has the value ~a\n" foo)
> where foo is the variable, ~a references the next argument after the 
> string and \n outputs a newline.
> You should be able to insert this everywhere.

Trying this with a variable I have set myself, I find that within a
music expression it generates an error, and outside it produces nothing
at all.

On Tue, 19 Jan 2016 16:27:51 +0100, Urs Liska wrote:
>         Of course. For example:
>         
>         var = "three"
>         
>         #(display var)
>         #(newline)
>         
>         #(ly:message var)
>         
>         varList = #'(one two three)
>         #(ly:message (format "~a" varList))
>         
>         #(display varLIst)
>         #(newline)

I found that the first, i.e. #(display var), works both within and
outside a music expression - thanks.

The other forms I found did not work well, producing a "Wrong type
argument in position 1 (expecting string)" message.  Also both varList
forms only report the first item.

I am obviously doing something wrong, but I can't imagine what.

What I should really like to be able to do is to display the current
value of a variable such as Score.MetronomeMark.X-offset within a music
expression, but I can't seem to achieve this even with the #(display
var) form - I suspect that the variable has to be expressed in a
different format.

Can it be done?

David










reply via email to

[Prev in Thread] Current Thread [Next in Thread]