MathGroup Archive 2003

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

Search the Archive

Evaluation rules and HoldRest

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42613] Evaluation rules and HoldRest
  • From: Matthias <spam at yourself.pl>
  • Date: Fri, 18 Jul 2003 05:25:07 -0400 (EDT)
  • Organization: Rechenzentrum Uni-Mannheim
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

why is this not working as intended?

===
Assert[bool_, failedExpr_] := If[! bool, Evaluate[failedExpr]];
SetAttributes[Assert, HoldRest];
Assert[1 == 1, Print["Assertion violated!"]];
=== 

The code above prints "Assertion violated".  I know that the code behaves 
correctly when replacing ":=" by "=".  I'd like to understand why and would 
appreciate any explanation, or pointer to relevant documentation.

Thanks in advance,

  Matthias


  • Prev by Date: exponentials to sines and cosines
  • Next by Date: Sparse matrices, v.4 vs v.5
  • Previous by thread: RE: exponentials to sines and cosines
  • Next by thread: Re: Evaluation rules and HoldRest