lilypond-user
[Top][All Lists]
Advanced

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

Re: Need help creating Scheme functions to automate includes of many sco


From: Urs Liska
Subject: Re: Need help creating Scheme functions to automate includes of many scores in a project
Date: Tue, 26 Jun 2018 07:46:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0



Am 25.06.2018 um 21:19 schrieb Nah:
I have a project with 100+ scores, each in their own file. I tried to create a Scheme function to \include each of them. After searching the archive, I got the general idea of why my solution isn't working. However, I didn't find something like a snippet that I could coax into what I want. I have programming experience in C, Python, etc., but I'm still pretty clueless with Scheme.

What I want is a function that does something like:
foreach fname #{ \include #fname #}

In Python, I would just read all the filenames in the directory, sort them, then run the foreach. Can I do something like that in Scheme? And how do I put the result in a form that will work with \include?

openLilyLib's oll-core has the tool \includePattern that can be used directly for your cause. See https://github.com/openlilylib/oll-core/blob/master/util/usage/include-pattern.ly for an example file and https://github.com/openlilylib/oll-core/blob/master/util/include-pattern.ily for the implementation. What you really need (i.e. the function you might tweak into your own set-up) is the for-each starting on line 79.

HTH
Urs



reply via email to

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