Hi Jay, your 'if' statements are not nested properly. See:

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

Just in case you didn't know, you can use de cond conditional for cases
like this, which is much easier to work with:

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

Hope that helps!
Stéfano

El vie., 20 sept. 2019 a las 8:14, Jay Vara (<j...@diljun.com>) escribió:

> 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)
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to