---------- Forwarded message ---------- From: Raymond Wiker rwiker@gmail.com Date: Fri, Sep 24, 2010 at 2:51 PM Subject: Re: [pro] The Best Examples of "Code is Data" To: Kazimir Majorinc kazimir@chem.pmf.hr
I do not think that this is a case where eval is needed, and it is not a case where eval is likely to be either the best or the simplest solution.
Instead of using list-construction operations to construct a "function" to be eval'd, you can use the function-construction operator (lambda, that is). In addition to being more conventional (simply by not using eval), it also gives you a mechanism for passing parameters into your functions without resorting to specials. Two mechanisms, in fact - you can use ordinary parameters and closed-over variables.
On Thu, Sep 23, 2010 at 9:53 PM, Kazimir Majorinc kazimir@chem.pmf.hr wrote:
On 24.9.2010 14:51, Raymond Wiker wrote:
But it is not simpler than 'eval'. One would use, for example, #'(lambda ()T) instead of 'T. Rewriting this part
The program generates propositional formulas S1, S2, ... using some experimental algorithm. S1, ..., Sn are needed for generation of Sn+1, as typical in deductive systems.
using functions instead of formulas is harder; the functions can be funcalled, and used as building blocks for larger functions. Same like formulas. So far so good. However, some essential operations on formulas (substitution, unification, rules or inference ...) require analysis of the formula.
Similar analysis of the function could be done only by transforming it back into formula with (caddr (function-lambda-expression Si)), and it is not simpler, even if it work, what is not guaranteed according to Hyperspec.
Kazimir Majorinc: