MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Unevaluated

  • To: mathgroup at
  • Subject: [mg44510] Re: Unevaluated
  • From: Roland Franzius <roland.franzius at>
  • Date: Thu, 13 Nov 2003 02:27:01 -0500 (EST)
  • Organization: Universitaet Hannover
  • References: <bopcq6$op3$>
  • Sender: owner-wri-mathgroup at

Hans-Peter Kunzle wrote:

> Hello,
> I was trying to make a function like 'tPrint[x___]' that would act
> like Print if some global variable Testing was True and do nothing
> if Testing was False. This would allow me to simply add or delete
> the 't' to individually turn on or off some tracing. It would
> be easier than to comment or uncomment the Print statements each
> time.
> But when I tried
> 	tPrint[Unevaluated[x___]]:= If[Testing,Print[x]]
> I found, using TracePrint, that 'x' gets evaluated each time whether
> or not Testing is True.
> Maybe I do not understand properly how Unevaluated operates.
> Is there a way to do what I want?

Your aim might be

SetAttributes[tPrint, HoldAll]
tPrint[x___] := If[Testing, Print[Unevaluated[x]]]


y := Do[tPrint[Unevaluated[1 + k]], {k, 1, 5}]

Do you mean: Don't evaluate x at evaluation time of tPrint[x] and then 
print x Unevaluated?


Roland Franzius

  • Prev by Date: Disabling Groups of Cells
  • Next by Date: AW: Question About Weibull Distribution
  • Previous by thread: Re: Unevaluated
  • Next by thread: RE: Re: Unevaluated