[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting the argument list of a procedure
From: |
anders . vinjar |
Subject: |
Re: getting the argument list of a procedure |
Date: |
Thu, 05 Mar 2015 09:47:10 +0100 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (gnu/linux) |
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
- getting the argument list of a procedure, David Nalesnik, 2015/03/04
- Re: getting the argument list of a procedure, Mattes, 2015/03/04
- Re: getting the argument list of a procedure, Orm Finnendahl, 2015/03/04
- Re: getting the argument list of a procedure, David Nalesnik, 2015/03/04
- Re: getting the argument list of a procedure,
anders . vinjar <=
- Re: getting the argument list of a procedure, Paul Morris, 2015/03/05
- Re: getting the argument list of a procedure, David Nalesnik, 2015/03/05
- Re: getting the argument list of a procedure, anders . vinjar, 2015/03/05
- Re: getting the argument list of a procedure, David Nalesnik, 2015/03/05
- Re: getting the argument list of a procedure, David Nalesnik, 2015/03/06
- Re: getting the argument list of a procedure, anders . vinjar, 2015/03/09