Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Nathan Baum <nathan_baum@xxxxxxxxxxxxxx>
- Date: Sun, 21 Aug 2005 05:22:12 +0100
Jon Harrop wrote:
Nathan Baum wrote:
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>
No:
You misunderstand me. I mean that the Mathematica equivalent of 'X, which I suppose is just (X), would behave that way.
Mathematica has no _real_ equivalent of Lisp's QUOTE, since Mathematica 'fully evaluates' every expression: i.e. keeps evaluating it until further evaluation will not produce a different value. Hold is possible precisely because Hold[x] evalutes to Hold[x].
Another example of the difference between QUOTE and Hold: = holds its first argument, so assuming b doesn't have a value,
a = b
assigns b to a, but Evaluate overrides Hold so
Evaluate[a] = 42
assigns 42 to b, the result of evaluating a. (Or so the Matgematica documentation tells me)
The Lisp function setq quotes its first argument, so
(setq a 'b)
assigns 'b to a. But eval _doesn't_ override this, and
(setq (eval a) 42)
is an error. .
- Follow-Ups:
- Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Nathan Baum
- Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Jon Harrop
- Re: Lisp's QUOTE and Mathematica's "Hold"
- References:
- Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Ulrich Hobelmann
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Brian Downing
- Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Jon Harrop
- Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Nathan Baum
- Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Jon Harrop
- Very poor Lisp performance
- Prev by Date: Re: Lisp's QUOTE and Mathematica's "Hold"
- Next by Date: Re: Lisp's QUOTE and Mathematica's "Hold"
- Previous by thread: Re: Lisp's QUOTE and Mathematica's "Hold"
- Next by thread: Re: Lisp's QUOTE and Mathematica's "Hold"
- Index(es):
Relevant Pages
|