From: Deepak Goel
Subject: macro that examines function-definition at run-time?
Date: 
Message-ID: <yz2z8zjshqxi.fsf@rac3.wam.umd.edu>
hello

i needed to define a macro that examines the function-definition, and
would appreciate any help.

Here's what that macro rectify-args would do:

Suppose there is a function ++ that (by its definition) takes 1--4
arguments.

Then (rectify-args ++ 1 2 3 4 5)
would result in: (++ 1 2 3 4).; 
(rectify-args ++) would result in (++ nil).

I think the above example says all for what i need to do.

yes, i could defadvise the function ++, but i do not want to re-advise
every function.  I just want to write a general macro that will help
me rectify the number of args supplied to it.

Thanks.





--Deepak, http://www.glue.umd.edu/~deego
From: Deepak Goel
Subject: Re: macro that examines function-definition at run-time?
Date: 
Message-ID: <yz2zpud2vj49.fsf@rac5.wam.umd.edu>
correction: The 'run-time' in the subject-line should be changed to
'compile-time, sorry about that.  

Basically, just want a macro (not a function, because some of the
'args' to the macro may be special-forms), that before calling the
target function, makes sure that the number of args passed to the
target-function is acceptable.


> Suppose there is a function ++ that (by its definition) takes 1--4
> arguments.
> 
> Then (rectify-args ++ 1 2 3 4 5)
> would result in: (++ 1 2 3 4).; 
> (rectify-args ++) would result in (++ nil).
> 
> I think the above example says all for what i need to do.