|
From: | David Nalesnik |
Subject: | Re: getting the argument list of a procedure |
Date: | Fri, 6 Mar 2015 11:53:56 -0600 |
>>>>> "D" == David Nalesnik writes:
D> What you are suggesting seems to be analogous to what is already
D> done for the functions on the Scheme functions documentation page
D> I referenced earlier.
Ah, but you've got all you need there already it seems.
'procedure-source will return the body of any defined function, then
just grab the cadr of this to get the lambda-list:
(define (get-proc-args proc)
(cons (procedure-name proc) (cadr (procedure-source proc))))
(begin
(newline)
(display (get-proc-args get-chord-shape))
(newline)
(display (procedure-source get-proc-args)))
will return :
(get-chord-shape shape-code tuning base-chord-shapes)
(lambda (proc) (cons (procedure-name proc) (cadr (procedure-source proc))))
#
(define-syntax defineS
Wrong type to apply: #<Music function #<procedure #f (parser location arg)>>
fatal error: failed files: "c:\\users\\david\\appdata\\local\\temp\\frescobaldi-4kllxf\\tmpma8ecw\\let-syntax.ly"
Exited with return code 1.
I am able to use the define-syntax form within scm/output-lib.scm, but I get the same sort of error when the name of the new function conflicts with a name already in use, as when I try to define the function 'bar' you provided in your example.
I don't understand what is happening when I attempt to define the macro in the LY file, though.
Best,
David
[Prev in Thread] | Current Thread | [Next in Thread] |