Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Help with Hold

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100951] Re: [mg100917] Help with Hold
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Thu, 18 Jun 2009 20:45:49 -0400 (EDT)
  • References: <200906180852.EAA19966@smc.vnet.net>

Erich Neuwirth wrote:
> How can I transform
> Hold[x,Null,y,Null,Null]
> into
> {"x",Null,"y",Null,Null}
> even if x and/or y have assigned values?
>
>   
Here is one possibility:

In[907]:= Replace[
 Hold[x, Null, y, Null, Null], {Null -> Null,
  v_ :> With[{tmp = ToString[Unevaluated[v]]}, tmp /; True]}, {1}]

Out[907]= Hold["x", Null, "y", Null, Null]

Carl


  • References:
  • Prev by Date: Re: Help with Hold
  • Next by Date: Text and multiple calculations in an IF condition
  • Previous by thread: Re: Help with Hold
  • Next by thread: Re: Help with Hold