Re: Hold[], Evaluate[] and so forth.
- To: mathgroup <mathgroup at yoda.physics.unc.edu>
- Subject: Re: Hold[], Evaluate[] and so forth.
- From: p.kent at imperial.ac.uk
- Date: Sat, 16 Oct 1993 16:18:10 +0100
Dear MathGroup'ers Many thanks for the large amount of correspondence on this matter. The conclusion is that there isn't any way around the problem, if you remove Hold[] the expression will be evaluated, and any evaluation will recurse down through all the levels of the expression. So be it. Now, I detect a certain sentiment among users that Mma's evaluation code is rather aggressive, in that it pounces on anything left unprotected, and chews it up completely. And this is exactly what you want to happen, for most of the time. But there are situations where you don't want this: let me give an explicit example. I'm writing a piece of code which takes a Mma expression as an argument, processes it through TeXForm, merges that with some LaTeX to make a runnable LaTeX file, which is viewed with a DVI viewer on the screen. You can see that this is potentially useful, in that it allows an inexperienced computer user to get a translation of their Mma expressions into standard mathematical form. You can also see that its rather crucial that the original expression remains completely unevaluated in the process, even to the point of simple reordering of sub-expressions into canonical form. By careful use of Hold[] and Evaluate[], I can get the effect that I want, but its quite hard work to keep the evaluator at bay. I'd like to suggest for a future version of Mma, that when a user is programming Mma, (s)he should be allowed more control over what the evaluator is going to do to with the expressions involved. None of this is really relevant to the direct interactive use of Mma as a computer algebra engine. In fact, one often wishes that the Mma evaluator could do more algebraic simplifications than it actually does. Phillip Kent Transitional Mathematics Project Maths Dept Imperial College London.