[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
create and evaluate function dynamically
- To: email@example.com
- Subject: create and evaluate function dynamically
- From: firstname.lastname@example.org
- Date: Tue, 31 Mar 1992 11:07:10 +0100
I've a pb that begins to drive me really crazzzzzzzzzzzzy (for 'bout two
(As usual with really nerve-racking pb, a poscard is the reward :-)
I want to create and evaluate a function dynamically without calling the
eval function (I would like to use funcall or apply). I have a solution
with eval, but I suppose that it could be done more nicely.
I've the following method :
(defmethod state-run ((self state-class))
(fonc (action self)) ; (action self) is a lambda
(args (arguments self))
(if (not fonc)
; no action (NIL)
; links the unbound variables, ie : creates the eval environment
(progv args (automata-feature-values (owner self) args)
;;; HERE IS the PROBLEM ???????
(apply (function fonc) '())
; save the env, this function works
When I create the state, I do the following for the action slot :
(setf (action state) (quote (lambda nil ,@body)))
The point is : the body of action may contain undeclared variable that are
bound just before evaluation (the progv). After the evaluation, I would to
retrieve the new values
of the variables to save them. Normally the action has no parameter.
I would like to avoid warning (always in search of zero warning code).
Can anybody help me ?
GETA (Groupe d'Etude pour la Traduction Automatique)
BP 53X, 38041 GRENOBLE CEDEX, FRANCE