MathGroup Archive 2003

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

Search the Archive

Re: Unevaluated

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44489] Re: Unevaluated
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 12 Nov 2003 08:01:37 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <bopcq6$op3$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a) use ordinary Message[] that you can individual turn on and off
   for that

b) Unevaluated[] prevent the evaluation in a function call of 
   a function that would evaluate its arguments. If you whant to
   write a function that does not evaluate its arguemtns it must have
the
   attribute HoldAll. 

You mean

SetAttributes[tPrint, HoldAll]

tPrint[seq___] /; Testing := Print[seq]
tPrint[___] := Null

Regards  
  Jens


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?
> 
> Any help is appreciated.
> 
> Hans


  • Prev by Date: Re: Re: Derivative of a funtion evaluated at a point in 3D
  • Next by Date: Re: Trying to use Mathematica as "word processor" for my math homework
  • Previous by thread: Re: Unevaluated
  • Next by thread: RE: Unevaluated