Kieren Richard MacMillan <[EMAIL PROTECTED]> writes: > Hello, all -- > > Can anyone tell me why the code > > \version "2.8.1" > barpadding = #(define-music-function (parser location padding music) > (number? ly:music?) > #{ > \once \override Score.BarLine #'space-alist = > #'((first-note extra- > space . $padding)) > $music > #} > ) > { c'1 \barpadding #32.0 { c' c' } c' } > > returns > > ERROR: Wrong type (expecting real number): lilyvartmpa
The reason of the error is the following: When using a $variable inside scheme context in a #{ #} expression, the "$padding" is replaced by a symbol (of the form lilyvartmpNNN), which is bound to value given to padding. That is, this is equivalent to: #(define lilyvartmpa <value of padding>) { \once \override Score.BarLine #'space-alist = #'((first-note extra-space . lilyvartmpa)) {..music..} } '((first-note extra-space . lilyvartmpa)) is a quoted, literal list, and when these data are used, a symbol 'lilyvartmpa is found where a number is expected, hence the cryptic message. Don't use a quoted list where you want to introduce a variable. You can build the list by calling list, cons, etc, or use the dedicated feature: backquote. #`((first-note extra-space . ,lilyvartmpa)) is like writing: #(list (cons 'first-note (cons 'extra-space lilyvartmpa))) where lilyvartmpa will be evaluated. So, as Jan explained, a solution is: #`((first-note extra-space . ,$padding)) ^ | a backquote, not a quote. nicolas _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user