[pro] Fwd: The Best Examples of "Code is Data"
Kazimir Majorinc
kazimir at chem.pmf.hr
Sat Sep 25 18:42:01 UTC 2010
On 24.9.2010 14:51, Raymond Wiker wrote:
>
> 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.
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:
>>>> 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. The formulas
>>>> contain logical constants and already defined operators. The
>>>> hypothesis is: all generated propositional expressions are true.
>>>>
>>>> The problem: write the function that tests that hypothesis for
>>>> any generated formula. Optimization is not needed. Simpler is
>>>> better.
>>>>
>>>> I'd use eval instead of defining any new function, as the
>>>> simplest and the most natural solution. What would others do? If
>>>> you'd use eval as well, do you think it is important or rare,
>>>> maybe even 'artificial' example.
>>>>
More information about the pro
mailing list