lilypond-user
[Top][All Lists]
Advanced

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

Arbitrary number of arguments in Scheme function?


From: Peter Crighton
Subject: Arbitrary number of arguments in Scheme function?
Date: Wed, 17 Feb 2016 02:19:50 +0100

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) |
}

--
Peter Crighton | Musician & Music Engraver based in Mainz, Germany
http://www.petercrighton.de



reply via email to

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