lilypond-user
[Top][All Lists]
Advanced

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

Scheme question


From: Jay Vara
Subject: Scheme question
Date: Fri, 20 Sep 2019 12:13:01 +0100

I have defined three pair lists nameCpitch, nameEpitch, nameGpitch and nameApitch.

I want to assign nameold to one of the four depending on the value of pitch.

I set pitch to G and have a set of if statements to define nameold.

However it is not working.  When I print one of the lists I defined, it prints correctly but the list nameold does not. I imagine that someone who knows scheme could spot my error immediately.

Here is the code

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\version "2.19.83"

nameCpitch =
#`(("c" . "C")
    ("cis" . "C#")
    ("des" . "Db")
    ("d" . "D")
    ("b" . "B")
    ("bis" . "B#"))

nameEpitch =
#`(("c" . "E")
    ("cis" . "F")
    ("des" . "F")
    ("d" . "F#")
    ("b" . "D#")
    ("bis" . "E"))
nameGpitch =
#`(("c" . "G")
    ("cis" . "Ab")
    ("des" . "Ab")
    ("d" . "A")
    ("b" . "F#")
    ("bis" . "G"))
nameApitch =
#`(("c" . "A")
    ("cis" . "Bb")
    ("des" . "Bb")
    ("d" . "B")
    ("b" . "G#")
    ("bis" . "A"))

pitch = G

#(define nameold (if (equal? pitch "C")
   (nameCpitch (if(equal? pitch "E")
     (nameEpitch (if (equal? pitch "G")
       (nameGpitch (if (equal? pitch "A")
         nameApitch nameCpitch))))))))

#(display nameCpitch)

#(display nameold)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


reply via email to

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