MathGroup Archive 2003

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

Search the Archive

RE: Re: Unevaluated

  • To: mathgroup at
  • Subject: [mg44516] RE: [mg44489] Re: Unevaluated
  • From: "E. Martin-Serrano" <eMartinSerrano at>
  • Date: Thu, 13 Nov 2003 02:27:08 -0500 (EST)
  • Sender: owner-wri-mathgroup at


I posted about the same issue sometime ago and got the same input: "Use
Message[]". I tried, but finally gave up adopting the "debugPrint" approach
(testing for the value of some global symbol that can be turned off and on).
My(?) problem with Message[] was that it is automatically switched off by
the system after having printed some fixed number messages" and this does
not work for debugging.

Now I am wondering whether it could be written a general and simple piece of
software to signal exceptions within a function. In debugging, sometimes the
first thing to sort out is where (no what) something is going wrong. If one
could locate this piece of software inside a/each suspicious function and
print a message with the name of the "place" where the exception occurred it
would make thinks a lot easier. The key point here, would be this piece of
software to be able to "extract" the name of the function where it is
located in.

Any suggestion?

E. Martin-Serrano

-----Original Message-----
From: Jens-Peer Kuska [mailto:kuska at]
To: mathgroup at
Subject: [mg44516] [mg44489] Re: Unevaluated


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
   attribute HoldAll.

You mean

SetAttributes[tPrint, HoldAll]

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


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: Readability confuses mathematica?
  • Next by Date: Re: Re: Just trying to import an image
  • Previous by thread: Re: Unevaluated
  • Next by thread: RE: RE: Part 2 of a recent post on Plot ...