lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme question


From: Aaron Hill
Subject: Re: Scheme question
Date: Tue, 14 Jan 2020 17:05:19 -0800
User-agent: Roundcube Webmail/1.3.8

On 2020-01-14 5:01 pm, Arle Lommel wrote:
I am a total neophyte to Scheme, but not to coding. I’ve written a
simple function, but it does not work (I’ve reduced it to just the
problematic lines. Can anyone tell me how to write the line indicated
below?

shifter =
#(define-music-function
  (parser location padding)
  (number?)
  #{
\once \override Accidental.extra-offset = #(cons padding . 0) %<- THIS LINE
  #}
)

The relevant errors it throws when invoked are:

error: GUILE signaled an error for the expression beginning here
warning: type check for `extra-offset' failed; value `#<unspecified>'
must be of type `pair of numbers’

The closest thing I can find to explaining how this works is here:
http://lilypond.org/doc/v2.18/Documentation/extending/scheme-function-definitions

But I’m apparently missing something very obvious.

A pair of numbers would be (cons 1 2) or '(1 . 2) as the quoted shorthand.

Since you have a variable, you would need the quasi-quote feature if you wanted the shorthand: `(,padding . 0) But, (cons padding 0) should work.


-- Aaron Hill



reply via email to

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