Re: Unevaluated
- To: mathgroup at smc.vnet.net
- Subject: [mg44520] Re: [mg44465] Unevaluated
- From: Dr Bob <drbob at bigfoot.com>
- Date: Thu, 13 Nov 2003 02:27:15 -0500 (EST)
- Organization: Interstellar Corps of Engineers
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
Attributes[tPrint] = {HoldAll}
tPrint[x_] := If[testing, Print[x]]
Bobby
Unevaluated
Subject: [mg44520] [mg44465] Unevaluated
From: Hans-Peter Kunzle <hp.kunzle at ualberta.ca>
To: mathgroup at smc.vnet.net
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?
Any help is appreciated.
Hans