Re: Lisp's QUOTE and Mathematica's "Hold"



Jon Harrop wrote:

i.e., Hold "sticks" with the expression, whereas QUOTE is just a signal to the evaluator to pass its contents through unevaluated. You can't build something as simple as QUOTE in Mathematica because the evaluator will keep evaluating until it stops changing - the CL QUOTE would be a noop in the Mathematica evaluator.


You can see Hold in Mathematica but not QUOTE in Lisp but isn't that more a
function of the pretty printer rather than the evaluation?

No, it's a function of it not being there.

A   => <the value of A>
'A  => A
''A => 'A a.k.a. (QUOTE A)

This distinction is very significant, because QUOTE only 'protects' against one round of evaluation.

(EVAL A)   => <the result of evaluating the value of A>
(EVAL 'A)  => <the value of A>
(EVAL ''A) => A

In a hypothetical Mathematica-like dialect of Lisp,

A          => <the value of A>
'A         => <the value of A>
''A        => <the value of A>
(EVAL A)   => <the value of A>
(EVAL 'A)  => <the value of A>
(EVAL ''A) => <the value of A>


Beyond that, evaluation is completely different. But just looking at QUOTE and Hold, there is an uncanny resemblance.


If you ignore the name, syntax and behaviour. .



Relevant Pages

  • Re: Very poor Lisp performance
    ... I think that's exactly the same as "Hold" in Mathematica. ... i.e., Hold "sticks" with the expression, whereas QUOTE is just a signal ... to the evaluator to pass its contents through unevaluated. ... Prev by Date: ...
    (comp.lang.lisp)
  • Re: Lisps QUOTE and Mathematicas "Hold"
    ... > Both QUOTE and Hold retain subexpressions in unevaluated form. ... >> to the evaluator to pass its contents through unevaluated. ... >> noop in the Mathematica evaluator. ...
    (comp.lang.lisp)
  • Re: Lisp Beginner question
    ... >> because QUOTE works on lists as well as atoms. ... Using ' as an abbreviation for QUOTE ... A question I kept asking myself for the first few dozen hours of my lisp ... experience was "How does the evaluator know when to stop evaluating?" ...
    (comp.lang.lisp)
  • Re: Lisps QUOTE and Mathematicas "Hold"
    ... > Both QUOTE and Hold retain subexpressions in unevaluated form. ... >> to the evaluator to pass its contents through unevaluated. ... >> noop in the Mathematica evaluator. ...
    (comp.lang.lisp)
  • Re: Lisps QUOTE and Mathematicas "Hold"
    ... Both QUOTE and Hold retain subexpressions in unevaluated form. ... > to the evaluator to pass its contents through unevaluated. ... > noop in the Mathematica evaluator. ...
    (comp.lang.lisp)