[pro] The Best Examples of "Code is Data"

Kazimir Majorinc kazimir at chem.pmf.hr
Tue Sep 14 17:07:35 UTC 2010


On 8.9.2010 0:08, Daniel Weinreb wrote:

> There is an old saying: if you are using "eval", you are
> doing it wrong. So far I have yet to find any significant
> exceptions to this rule.

Look at this:

   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