[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Music-function "arguments" - help
From: |
David Kastrup |
Subject: |
Re: Music-function "arguments" - help |
Date: |
Fri, 07 Dec 2018 01:46:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
mansouraoun <address@hidden> writes:
> Hello,
>
> I'm still quite a beginner in Lilypond and as much as I'm liking how much
> customisable is its notation capabilities, understanding it is driving me
> crazy because sometimes I can pass more than 4 or 5 hours reading manuals
> and blogposts without reaching a simple answer to a simple question.
>
> My current problem is that I'm learning how to write a music function yet
> there's this mysterious element in it "nth argument" that I can't quite
> understand.
That's just a shorthand for "the argument at position n", a
generalization of "1st, 2nd, 3rd, 4th, 5th, 6th"...
> I understood all the other elements: the function syntax and how
> parser and location should be copied literally, the predicate type and
> the body. In this blogpost for example
> https://lilypondblog.org/2015/04/defining-a-music-function/
> <https://lilypondblog.org/2015/04/defining-a-music-function/> Urs
> Liska demonstrates how to create a simple function. In his/her
> example, the nth argument is "my-color". In other examples the
> argument is "paddingHorizontal", or "paddingVertical", or just
> "padding". I searched for hours for a list of those arguments to see
> which one I should use for my need and yet I can't find it anywhere.
It's not a matter of _using_ an argument but of _naming_ an argument.
Basically it is arbitrary as long as it has the form of a Scheme
identifier. For LilyPond, only the position is interesting, namely
whether it is 1st, 2nd, 3rd... in the list of the actual arguments when
calling a music function.
Of course it makes sense to name the argument something that conveys
meaning to you as the one having to _understand_ the code at a later
point of time rather than just _execute_ it, but arg1, arg2, arg3,
arg4... would be totally valid here.
> I just want to create a simple function with an x-offset for dynamic
> texts but i don't know what is the correct argument for this.
There is no "correct" argument name but x-offset would be fine.
--
David Kastrup
- Music-function "arguments" - help, mansouraoun, 2018/12/06
- Re: Music-function "arguments" - help,
David Kastrup <=
- Re: Music-function "arguments" - help, mansouraoun, 2018/12/06
- Re: Music-function "arguments" - help, Urs Liska, 2018/12/06
- Re: Music-function "arguments" - help, mansouraoun, 2018/12/07
- Re: Music-function "arguments" - help, mansouraoun, 2018/12/07
- Re: Music-function "arguments" - help, Urs Liska, 2018/12/07
- Re: Music-function "arguments" - help, Urs Liska, 2018/12/07
- Re: Music-function "arguments" - help, mansouraoun, 2018/12/07
- Re: Music-function "arguments" - help, David Kastrup, 2018/12/07
- Re: Music-function "arguments" - help, mansouraoun, 2018/12/07