[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting pitch out of a pair
From: |
Jay Anderson |
Subject: |
Re: Getting pitch out of a pair |
Date: |
Fri, 16 Jan 2015 16:16:47 -0700 |
On Fri, Jan 16, 2015 at 4:02 PM, address@hidden <address@hidden> wrote:
> I store two pitches in a pair variable
> x = #'(b . cis')
>
> But then I want to retrieve each one as a pitch in a music-function
> foo = #(define-music-function (parser location bar) (ly:music?)
> (define from (car x))
> (define to (cdr x))
> #{
> \transpose $from $to $bar
> #}
>
> but when I use this
> \foo a
>
> I get Expecting pitch, found (quote b)
>
> So what am I doing wrong and how can I do it right?
>
> // Anders
> PS! The foo function is just a snippet the real function does a bit more...
pitches = #(cons #{ b #} #{ cis' #})
#(display (ly:pitch? (car pitches))) => #t
Notes:
- It needs to be lilypond and not scheme which interprets the pitches.
The #{ #} do that inside a scheme expression.
- It won't work within a quoted list (e.g. #'(#{ b #} . #{ cis' #})
won't get you pitches.)
-----Jay