lilypond-user
[Top][All Lists]
Advanced

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

Re: Arbitrary number of arguments in Scheme function?


From: David Kastrup
Subject: Re: Arbitrary number of arguments in Scheme function?
Date: Wed, 17 Feb 2016 14:02:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Peter Crighton <address@hidden> writes:

> Hello,
>
> I am working on a Scheme function that improves ties when writing in
> rhythmic notation (improvisationOn). Now I have the problem that I
> don’t know how many post events a duration might have – my current
> function works only for one event (the tie).
> Can this function be made more general for an arbitrary number of post
> events? And ideally I’d also like it to be expecting either
> ly:duration? or ly:music?, since I might also be writing c8~, instead
> of 8~.
>
>
> \version "2.19.33"
>
> tieFixSlash = #(define-music-function (parser location rhythm
> tie)(ly:duration? ly:event?)
>                  #{
>                    \shape #'((0.5 . 0) (0.5 . 0) (0.8 . 0) (0.8 . 0)) Tie
>                    $rhythm $tie
>                    \once \override TieColumn.tie-configuration = #'((2 . 1))
>                  #})
>
> \new Voice \with {
>   \consists "Pitch_squash_engraver"
> } {
>   \improvisationOn
>   8 8 8 \tieFixSlash 8~ 8 8 8 8 |
>   8 8 8 \tieFixSlash 8(~ 8 8 8 8) |
> }

Sigh.  I don't really see much of an option other than accepting 8 and
consequently also 8(~ as an expression of type ly:music? (assuming that
8 is not accepted as either number or duration) and then dissembling its
'articulations field.

That requires a change in the parser.  If you put up a respective
request, I'll take a look whether I can implement it in one of the next
versions.

-- 
David Kastrup



reply via email to

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