On 11 May 2018 at 17:58, Aaron Hill <lilyp...@hillvisions.com> wrote:
> On 2018-05-11 08:46, David Kastrup wrote: > >> Aaron Hill <lilyp...@hillvisions.com> writes: >> >> On 2018-05-11 06:53, Gianmaria Lari wrote: >>> >>>> Sorry to bother with a simple question. Why this does not work? >>>> >>>> \version "2.19.81" >>>> pit = #(define-music-function >>>> (p) (ly:pitch?) >>>> ) >>>> { \pit c' } >>>> >>> >>> The result is "error: music function cannot return c'". It appears >>> that a simple pitch by itself is not enough to qualify as music. >>> >> >> #{ $p #} >> It's desirable to be able to enter pitches as #{ c' #} and similar. Add >> a duration to get a music expression. >> > > But can you return an incomplete music expression? It seems like that is > the underlying issue why the original code does not work. > > If you change the function to "#{ { $p } #}", it compiles. >>> >> >> Yes, but the duration is not really well-defined here (happens to end up >> as the default duration of the current parser). >> > > True, I was not advocating that this is a useful construct, merely showing > that it results in a minimally valid expression. > yes, I was thinking that the problem was related to the fact that #{ $p #} could be "considered" an incomplete music expression. But the fact that the following code #{ $p $p #} and #{ { $p } #} compiles, make me think that there were something more.... Anyway, should I avoid to write something without duration even if it compiles? For example, should I avoid the following? #{ c $p c #} I considered this useful. Because the function return something with a duration that depends from the previous music and this can be 'practical'... g.
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user