lilypond-devel
[Top][All Lists]
Advanced

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

Re: music function to be included somewhere in scm/*


From: Urs Liska
Subject: Re: music function to be included somewhere in scm/*
Date: Wed, 14 Dec 2016 10:59:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0


Am 14.12.2016 um 10:43 schrieb Alexander Kobel:
>> Q2: Obviously the definition of \autoextenders does not match the coding
>> style used in scm/*. It does not even
>> work if it is added to music-functions.scm. Some advice is needed ...
>> the extending-manual is not a real help in
>> this case.
>
> I think you mixed up define-music-function and a plain Scheme define.
> IIUC, define-music-function creates an anonymous function with some
> syntactic sugar (e.g., type-checking of the additional arguments past
> parser and location) which is then assigned to a variable:
>
> function = #(define-music-function
>              (parser location arg1 arg2)
>              (arg1-type-check? arg2-type-check?)
>              ...)
>
> That's used in user space and relies on Lilypond's parser, for the
> assignment of the anonymous function. So if we use that, it must go to
> some .ly file with my original syntax; e.g. ly/lyrics-tkit.ly, is apt.
>
> Otherwise, it can go to a .scm file as just
> (define (autoextenders lyrics)
>  (music-map ...))
>

Not having looked into the actual code I'd like to add that within a
.scm file you'd define a music function as in Knut's original email -
but without the starting hash sign.
But music-functions.scm doesn't seem to use this syntax and does plain
defines (or define-public).

Urs


reply via email to

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