Folks,

consider the following example: I want to keep a book in a variable and use it as a function argument. But a variable containing a \book seems to fail to match the ly:book? predicate in function argument checking.

How can this be explained?

As a workaround, I can use a no-parameter function that returns a book. But I'd still like to understand what's happening here.

Lukas



\version "2.25.25"

myScore = \score { a4 }

bookVariable =
\book {
  \myScore
}

bookFunction =
#(define-scheme-function () ()
   #{
     \book {
       \myScore
     }
   #})

useBook =
#(define-void-function (book) (ly:book?)
   (ly:message "I'm doing something with this book now."))

% \useBook \bookVariable % <<<<<<<< This fails. Why?
\useBook \bookFunction


Reply via email to