lilypond-user
[Top][All Lists]
Advanced

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

Include file from music function 2.15.18


From: Jay Anderson
Subject: Include file from music function 2.15.18
Date: Sun, 13 Nov 2011 22:52:58 -0700

In working on a large set of hymns pre-2.15.18 I could do something like this (a simplified example):

===============
\version "2.15.18"

function =
#(define-music-function (parser location num) (number?)
  (let ((file (string-append "hymn" (number->string num) ".ily")))
    #{ \include $file #}))

\score
{
  \new Staff \relative c'
  {
    \function #0
  }
}
===============

Error in 2.15.18:
===============
GNU LilyPond 2.15.18
Processing `2.15.18.ly'
Parsing...
<string>:1:10: error: invalid character: `$'
 \include 
          $file 
<string>:1:10: error: syntax error, unexpected $undefined
 \include 
          $file 
2.15.18.ly:6:5: In procedure variable-ref in _expression_ (ly:parse-string-_expression_ clone " \\include $file "):
2.15.18.ly:6:5: variable is unbound: #<variable 7f862c8af440 value: #<undefined>>
===============

The 'let' isn't breaking it because I can do silly things like this:
functionB =
#(define-music-function (parser location num) (number?)
  (let ((str (string-append "hymn" (number->string num) ".ily")))
    #{ c_$str #}))

Essentially, I want to build up the name of the file to include and include it. Is this a bug or should this be done in a fundamentally different way now? Thanks.

-----Jay

reply via email to

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