MathGroup Archive 2001

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

Search the Archive

Unevaluated Expression

  • To: mathgroup at
  • Subject: [mg26962] Unevaluated Expression
  • From: "Hermann Meier" <hmeier at>
  • Date: Tue, 30 Jan 2001 03:38:15 -0500 (EST)
  • Organization: EUnet AG, Switzerland. A KPNQwest Company.
  • Sender: owner-wri-mathgroup at

Dear Mathematica users,

a = 10;
Unprotect[ToString]; SetAttributes[ToString, HoldAll]
gives (as desired) "a", not 10

Then I wanted to prevent the argument in f[x_] := x^2  from
getting evaluated.

Attributes[f] = {HoldAll}
f[x_] := x^2
gives 100.

The longwinded code
ToExpression[ToString[f[a]], InputForm, Hold] /. Hold[f[nr_]] -> nr
First[Level[Composition[Hold][f[#]],{-1}]]& /@ {a,10}

at least manages to give 10 instead of 100.

Is there really no way to prevent the argument in f[x] from firing ?
(I use Mathematica 4.1 for Windows).

With best regards
Hermann Meier

  • Prev by Date: Saving notebooks without graphics
  • Next by Date: Want to use results by Parallel Computing
  • Previous by thread: RE: Saving notebooks without graphics
  • Next by thread: Re: Unevaluated Expression