I need a function with DEEP parameter that if it is placed in the body of another function returns the list of the arguments of the ancestor function depending on DEEP parameter.
If DEEP = 0 returns list arguments of its parent function
IF DEEP = 1 returns list arguments of grand parent function and so on
(defun ask-fun (DEEP)
BODY)
BODY is unknown, must be determined.
For example:
(defun parent-fun (a b c)
.......
(ask-fun 0)
.......)
(ask-fun 0) to returns (a b c) the argument list of its parent.
(defun grand-parent-fun (x y z)
.....
(parent-fun a b c)
......)
calling grand-parent-fun function
(grand-parent-fun x y z)
then (ask-fun 1) called from body of parent-fun function to return the list arguments of grand-parent-fun respectively (x y z).
I need that function to create another functions X that do others things in body of parent function of X. For example:
(defun get-arg-sum-fun ()
(apply '+ (ask-fun 1)))
returns the sum of the arguments of parent function of 'get-arg-sum-fun if the arguments are only numbers.
It is an flexible instrument to create a lot of useful functions to calculate expression with arguments of ancestor functions.