lilypond-user
[Top][All Lists]
Advanced

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

Re: #(define (bookGenerator please))


From: David Kastrup
Subject: Re: #(define (bookGenerator please))
Date: Tue, 17 Nov 2015 11:43:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Pierre-Luc Gauthier <address@hidden> 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



reply via email to

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