lilypond-user
[Top][All Lists]
Advanced

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

Re: A question about a scheme function with two input notes


From: David Kastrup
Subject: Re: A question about a scheme function with two input notes
Date: Fri, 30 Dec 2022 13:51:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Jean Abou Samra <jean@abou-samra.fr> writes:

> Le 30/12/2022 à 00:19, Alasdair McAndrew a écrit :
>> Thank you SO very much! Such a simple thing ... (as is so often the
>> case, certainly with my queries).  It now works perfectly.
>
>
> Well, as a matter of fact, you're not the first one tripped up by this.
>
> Makes me wonder if we should make it possible to do it like
>
> dStop =
> #(define-music-function
>      (topnote bottomnote)
>      (ly:music? ly:music?)
>    #{
>     << {\topnote} \\ {\bottomnote} >>
>    #})

It would be quite absurd to involve the cost of $/# for a native
construct used as often as \ .

> Unlike # which starts a block in Scheme syntax, \ is LilyPond
> syntax and stops at a brace or such. It also makes a copy, which
> avoids problems like the one explained here:
> https://lilypond.org/doc/v2.25/Documentation/notation/how-to-prevent-sharing-of-music-expressions

$ is exactly the same in that respect.

> However, it doesn't work right now for local variables,
> like function parameters, in #{ ... #}.

I think you may underestimate the cost of magic involved with making #/$
integrate into local Scheme scoping.  If you want Scheme semantics, $
offers those along with Scheme syntax.

-- 
David Kastrup



reply via email to

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