MathGroup Archive 2009

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

Search the Archive

Re: HoldForm in defined function doesn't seem to work

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99216] Re: HoldForm in defined function doesn't seem to work
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Thu, 30 Apr 2009 06:21:34 -0400 (EDT)
  • References: <gt9aki$q22$1@smc.vnet.net>

joel.aufgang at gmail.com schrieb:
> I'm struggling to understand why this doesn't work:
> 
> 
> f[x_] = HoldForm[x];
> HoldForm[123 456 789] (* returns "123 x 456 x 789" *)
> f[123 456 789] (* returns"44253432" *)
> 
> I don't understand why the two results are different.   Is there a
> special trick I need to do to be able to define f so that the HoldForm
> works?
> 

the special trick is:

SetAttributes[f,HoldAll]

for what you want to achieve, I would suggest to read the tutorials you
find listed in the documentation at the bottom of this page:

guide/EvaluationControl

hth,

albert


  • Prev by Date: MapAt problem with passing List
  • Next by Date: Differential Equation, pendulum, change of variable plot
  • Previous by thread: Re: HoldForm in defined function doesn't seem to work
  • Next by thread: Re: HoldForm in defined function doesn't seem to work