Pierre-Luc Gauthier <p.luc.gauth...@gmail.com> writes: > So, after reading the "Automated processing of multiple books" thread > and few hours trying to figure this out, I am still not able to make > it work. > The higher order function "for-each" somehow cannot call the > "compilePart" function and Lilyponds GUILE interpreter returns "Wrong > type to apply". > > Why?
Apart from the quoting problem mentioned by Urs, because you are using version 2.18.2; a function defined with "define-void-function" cannot be called as if were a native Scheme function before version 2.19.22 (issue 4421). > Simple tests allowed me to prove that "for-each" *can* call functions > like "display" but not my "compilePart". Yup. For 2.18.2, you can call (ly:music-function-extract compilePart) instead but it will expect you to supply processed versions of all optional arguments. Also, the calling convention as of 2.19.22 no longer includes "parser" and "location" arguments, so if you are working with ly:music-function-extract, your code will not work under newer versions without change. It's more portable to define a Scheme function using named compile-part or compile-part-internal using "define" and call that from inside of your compilePart definition as well as from your for-each loop. Or just upgrade to version 2.19.22 or later and stuff will just work the way you tried. But as of version 2.19.22, you can just leave off the "parser location" arguments anyway. > I am very very new to scheme and let alone scheme inside the pond and > I really got a kick out of this journey finally understanding why > those #, #', #{, #}, $, parser, location, etc were there in the first > place. > > It's really satisfying. Too bad I removed "parser" and "location" arguments by now. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user