lilypond-devel
[Top][All Lists]
Advanced

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

little scheme problem (convert ly -> xml)


From: bigcab
Subject: little scheme problem (convert ly -> xml)
Date: Thu, 28 Jul 2011 10:11:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10

Hi,


As you know , I have started coding the ly-> xml in scheme,
but  as i want to make the code easier to read, I started to create a list
of callback to retrieve information for example
so I wrote this (for example):

;; once you retrived the good object you just have to extract its value
;; functions to retrieve the value of duration/step/octave
(define function-value-list
        (('duration      . ((lambda(x) (ly:duration-log x))))
        ('step           . ((lambda(x) (ly:pitch-notename x))))
('test . ((lambda(x) (begin (display "salut :") (display x) (display ".\n")))))
        ('octave         . ((lambda(x) (ly:pitch-octave x))))))

;; return false if value is not found
(define (get_value music name )
    (if (assq name function-value-list)
        (let (fun (car(assq name function-value-list)))
            (fun music))
        (#f)))

however , it does not seem to work , because is always says Wrong type to apply: duration even though I never called the function yet... if i am executing it inside a lilypond file

i get this Unbound variable: function-value-list

so I begin to think it is impossible to create a list containing, is it ?

if so, i will have to create each function one by one, so it would be longer and more difficult to edit ...



Thanks very much



reply via email to

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