Re: eval use ?



In article <ftydnVQaTbKTNZ_ZRVn-sw@xxxxxxxxxxxxx>,
jared@xxxxxxxxxxx says...
Majorinc wrote:



<graphics> would be much better done using functions, not eval. Represent
each formula as a function, and use funcall to evaluate.

.....



Unless you are expecting to symbolicly manipulate the formulas, it would
again be better to represent each as a function.

More usual than not, if one uses formulas as values, he want to
syntactically process them.



Not only can they both be done without eval, they can be done much
clearer, faster, and more naturally without eval.
Eval is very very
rarely useful; it's mainly useful for recreating your own REPL. Other
cases are better off using macros or closures, both of which more
cleanly integrate with the rest of Lisp.

Code=data is the single most important idea of Lisp and EVAL is
what make it possible. Lisp can exist without macros and
closures, but without EVAL it is not Lisp any more. Idea that
macros or closures more cleanly integrate with the rest
suggests me that you didn't understood the whole point.

Lisp is originally meant to be suitable for symbolic
processing, unlike Fortran which is suitable for numerical
processing only. If you process *formulas* as values, then eval
is very natural idea in many cases. If you deeply and
definitely despise idea of formulas as data, then eval is
really useless to you - but in that case, I think you use wrong
language.

.



Relevant Pages

  • Re: Paul Grahams teaching style is bad
    ... > say, in a sentence or 3, why macros are a big deal, I would be allowed ... > remaining distinctive features of lisp are a good thing. ... Closures either don't matter at all for 99% of the programs. ... algorithms needed to process these declarations. ...
    (comp.lang.lisp)
  • Re: New book about Common Lisp: Let Over Lambda
    ... I have read every lisp book I've been able to get my hands on ... Lisp macros are not given nearly enough ... I personally consider Let Over Lambda to be an unofficial sequel ... integral parts of the language. ...
    (comp.lang.lisp)
  • Re: LISPPA
    ... > which describes the unification algorithm in Scheme. ... But let's get back to why I think lisp is superior ... optimization macros or reader ... cases where a running program cannot continue running, ...
    (comp.lang.lisp)
  • Re: Macro functionality at runtime?
    ... we don't know what the subtree is yet. ... "Returns a list of tokens matched to subtree. ... > be optimized out by the lisp compiler. ... >> If we have first class macros, ...
    (comp.lang.lisp)
  • Re: What is the main advantage of macros over functions?
    ... if one is allergic to reading Lambda one may better not use ... Lisp authors, doesn't help you much, I'd say. ... >> Readmacros are a completely different mechanism. ... Macros and Readmacros ...
    (comp.lang.lisp)