MathGroup Archive 2009

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

Search the Archive

Re: Help with Hold


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


  • 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