Re: Lisp's QUOTE and Mathematica's "Hold"
- From: Nathan Baum <nathan_baum@xxxxxxxxxxxxxx>
- Date: Sun, 21 Aug 2005 16:34:21 +0100
Jon Harrop wrote:
So the first example should be:
Release[Hold[3+3]] ==> 3+3 ( ==> 6) eval ''(+ 3 3) ==> (+ 3 3)
As Mathematica's built-in rules are not the same as Lisp's, we should not let the Lisp evaluator evaluate anything for us. You are quite right that Lisp's evaluator works for (+ 3 3) but it should also work for '(+ 3 a 3), to give '(+ 6 a), for example.
With the equivalence that I'm proposing you would then have:
3 ==> 3 '3 ==> 3
Hold[3] ==> Hold[3] ''3 ==> '3
Release[Hold[X]] ==> X (eval ''x) ==> X
>
> Release[Hold[{2, Hold[1+1]}]] ==> {2, Hold[1+1]}
> (eval '`,(list 2 '(+ 1 1))) ==> (2 (+ 1 1))But in that expression, Hold[X] is not longer equivalent to ''X: in the outermost Hold it's equivalent to '`,X, and in the innermost 'X.
If we rewrite the example to obey your equivalence:
(eval ''('2 ''(+ 1 1)))
==> ('2 ''(+ 1 1))which is like Mathematica's
ReleaseHold[Hold[{Hold[2], Hold[Hold[1 + 1]]}]]
==> {Hold[2], Hold[Hold[1 + 1]]}and not at all like
ReleaseHold[Hold[{2, Hold[1+1]}]]
==> {2, Hold[1+1]}We see again that the comparison between Release/Hold and EVAL/QUOTE is ill-founded. It's like saying multiplication and addition are equivalent because 2 + 2 == 2 * 2.
.
- Follow-Ups:
- 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
- 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"
- From: Nathan Baum
- 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: TELNET
- 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):