Hi David.

    D> However, this feels a little hacky to me, and I'm hoping that
    D> there's some better technique available to get at the names
    D> assigned to the arguments.

If you've got access to the actual scheme-code where the definitions
takes place it should be possible to use rewrite macros.

Something along the lines below would give you a table (an ordinary list
here) 'procargstable keeping the procedure-name and the verbatim
argument-list:

   (define procargstable '())

   (let-syntax ((defineS
                  (syntax-rules ()
                    ((defineS (proc . args) body)
                     (begin
                       (set! procargstable (cons '(proc args) procargstable))
                       (define (proc . args) body))))))
     (defineS (foo a b)
       (+ a b)))

   (display procargstable)
=> ((foo (a b)))

or perhaps shadow define while doing your work (fex. loading a .scm-file
with the definitions):

   (define-syntax defineS
     (syntax-rules ()
       ((defineS (proc . args) body)
        (begin
          (set! procargstable (cons '(proc args) procargstable))
          (define (proc . args) body)))))

   (defineS (bar a b)
     (+ a b))

=> (display procargstable)
=> ((bar (a b)) (foo (a b)))

I'd actually be a bit surprised if LilyPond didn't use specialised
macros for defining its functions already, meaning you could just
specialize these a bit further...

Where do we find the definitions in LY?

Cheers,

-anders


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

Reply via email to