lilypond function aliases

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

lilypond function aliases

Gianmaria Lari
Is this the correct way to create a function alias in lilypond or there is a shorter/better way?

\version "2.21.0"
extremelyLongNameFunction  =
#(define-music-function (music) (ly:music?)
   (let ((varOne #{ a b b a #}))
     #{
       $varOne $music $varOne
     #}))

alias = 
#(define-music-function (music) (ly:music?)   
   #{
     \extremelyLongNameFunction $music
   #})

\alias {a}

Thank you, g.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: lilypond function aliases

Gianmaria Lari


On Thu, 4 Apr 2019 at 11:28, Gianmaria Lari <[hidden email]> wrote:
Is this the correct way to create a function alias in lilypond or there is a shorter/better way?

\version "2.21.0"
extremelyLongNameFunction  =
#(define-music-function (music) (ly:music?)
   (let ((varOne #{ a b b a #}))
     #{
       $varOne $music $varOne
     #}))

alias = 
#(define-music-function (music) (ly:music?)   
   #{
     \extremelyLongNameFunction $music
   #})

\alias {a}

Thank you, g.

Apologies, in my previous mail before sending it I make a small change in the code and didn't test it. So I introduced an error: "alias" is a reserved word. So here it is the previous code corrected (I highlighted the relevant change):

\version "2.21.0"
extremelyLongNameFunction  =
#(define-music-function (music) (ly:music?)
   (let ((varOne #{ a b b a #}))
     #{
       $varOne $music $varOne
     #}))

short
#(define-music-function (music) (ly:music?)   
   #{
     \extremelyLongNameFunction $music
   #})

\short {c c c c}

Best regards, g.


 

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: lilypond function aliases

Andrew Bernard
Hi Gianmaria,

Would this do?

\version "2.19.83"
extremelyLongNameFunction  =
#(define-music-function (music) (ly:music?)
   (let ((varOne #{ a b b a #}))
     #{
       $varOne $music $varOne
     #}))


#(define anAlias extremelyLongNameFunction)
\anAlias { c c c c }

That's just Scheme coding, not special in lilypond.

Andrew



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: lilypond function aliases

Gianmaria Lari


On Thu, 4 Apr 2019 at 13:07, Andrew Bernard <[hidden email]> wrote:
Hi Gianmaria,

Would this do?

\version "2.19.83"
extremelyLongNameFunction  =
#(define-music-function (music) (ly:music?)
   (let ((varOne #{ a b b a #}))
     #{
       $varOne $music $varOne
     #}))


#(define anAlias extremelyLongNameFunction)
\anAlias { c c c c }

That's just Scheme coding, not special in lilypond.


If there are no side effect it looks better to me :)
Thank you Andrew!
g.
 

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: lilypond function aliases

David Kastrup
In reply to this post by Gianmaria Lari
Gianmaria Lari <[hidden email]> writes:

> Is this the correct way to create a function alias in lilypond or there is
> a shorter/better way?
>
> \version "2.21.0"
> extremelyLongNameFunction  =
> #(define-music-function (music) (ly:music?)
>    (let ((varOne #{ a b b a #}))
>      #{
>        $varOne $music $varOne
>      #}))
>
> alias =
> #(define-music-function (music) (ly:music?)
>    #{
>      \extremelyLongNameFunction $music
>    #})
>
> \alias {a}

alias = #extremelyLongNameFunction

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: lilypond function aliases

Gianmaria Lari


On Thu, 4 Apr 2019 at 13:28, David Kastrup <[hidden email]> wrote:
Gianmaria Lari <[hidden email]> writes:

> Is this the correct way to create a function alias in lilypond or there is
> a shorter/better way?
>
> \version "2.21.0"
> extremelyLongNameFunction  =
> #(define-music-function (music) (ly:music?)
>    (let ((varOne #{ a b b a #}))
>      #{
>        $varOne $music $varOne
>      #}))
>
> alias =
> #(define-music-function (music) (ly:music?)
>    #{
>      \extremelyLongNameFunction $music
>    #})
>
> \alias {a}

alias = #extremelyLongNameFunction

great :)

Thank you David 

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user