scheme function with string

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

scheme function with string

Gianmaria Lari
I have this simple scheme substitution function

myFin = #(define-music-function (m)  (ly:music?)
    #{ \addStringNumber \addFingering $m "1x2x" "x3x4" #}
)

It simply adds some fingering and string numbers on the musical expression argument m. I use like this: 

\myFin {a b c' d'}

I would like to modify "myFin" function adding two more string parameters so that I can pass the fingering strings. In the end I would like to be able to write 

\myFin {a b c' d' "1x2x" "x3x4" }

How can I do it?
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: scheme function with string

David Kastrup
Gianmaria Lari <[hidden email]> writes:

> I have this simple scheme substitution function
>
> myFin = #(define-music-function (m)  (ly:music?)
>     #{ \addStringNumber \addFingering $m "1x2x" "x3x4" #}
> )
>
>
> It simply adds some fingering and string numbers on the musical expression
> argument m. I use like this:
>
> \myFin {a b c' d'}
>
>
> I would like to modify "myFin" function adding two more string parameters
> so that I can pass the fingering strings. In the end I would like to be
> able to write
>
> \myFin {a b c' d' "1x2x" "x3x4" }
>
>
> How can I do it?

You can't because {a b c' d' "1x2x" "x3x4" } is not valid input
in any mode (possibly lyricsmode but it would be really tricky to turn
that into something useful).

You could try for

    \myFin {a b c' d'} "1x2x" "x3x4"

instead which is obviously done using

myFin = #(define-music-function (m a b)  (ly:music? string? string?)
    #{ \addStringNumber \addFingering $m #a #b #}
)


--
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: scheme function with string

Gianmaria Lari


On Mon, 19 Nov 2018 at 16:06, David Kastrup <[hidden email]> wrote:
Gianmaria Lari <[hidden email]> writes:

> I have this simple scheme substitution function
>
> myFin = #(define-music-function (m)  (ly:music?)
>     #{ \addStringNumber \addFingering $m "1x2x" "x3x4" #}
> )
>
>
> It simply adds some fingering and string numbers on the musical expression
> argument m. I use like this:
>
> \myFin {a b c' d'}
>
>
> I would like to modify "myFin" function adding two more string parameters
> so that I can pass the fingering strings. In the end I would like to be
> able to write
>
> \myFin {a b c' d' "1x2x" "x3x4" }
>
>
> How can I do it?

You can't because {a b c' d' "1x2x" "x3x4" } is not valid input
[....]

Sure, sure! It was just a mistake!! Of course I didn't intend to put the strings inside the brackets.

 
You could try for

    \myFin {a b c' d'} "1x2x" "x3x4"

exactly :) 

 
instead which is obviously done using

myFin = #(define-music-function (m a b)  (ly:music? string? string?)
    #{ \addStringNumber \addFingering $m #a #b #}
)

Yes it is obvious also for me. But beside the previous error I probably forgot two or three others insignificant details :) and as usual the Lilypond log was not enough for me.

Thank you David
g.

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