Am 17.01.2015 um 00:21 schrieb and...@andis59.se:
On 2015-01-17 00:16, Jay Anderson wrote:
On Fri, Jan 16, 2015 at 4:02 PM, and...@andis59.se <and...@andis59.se> wrote:
I store two pitches in a pair variable
x = #'(b . cis')


pitches = #(cons #{ b #} #{ cis' #})
#(display (ly:pitch? (car pitches)))  => #t


Ok that works but looks really bad....
I liked the clean way the #'(b . cis') looks.

Is there some other way of storing two pitches and accessing each one in a music-function?

You can encapsulate the ugliness in one more function:

#(define x #f)

setTransposition =
#(define-void-function (parser location a b)
   (ly:pitch? ly:pitch?)
   (set! x (cons #{ #a #} #{ #b #})))

foo =
#(define-music-function (parser location bar) (ly:music?)
   (define from (car x))
   (define to (cdr x))
   #{
     \transpose $from $to $bar
   #})

{
  \setTransposition a b
  \foo a
}


HTH
Urs

// Anders



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to