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: [mg100976] Re: Help with Hold
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Thu, 18 Jun 2009 20:50:28 -0400 (EDT)
  • References: <h1cv8s$jfg$1@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?
>

Do you want something like this: 

stringList[expr_]:=
List @@ Fold[ReplacePart[#1, #2 -> Extract[#1, #2, ToString]] &, expr,
    Reverse[Sort[pos]]] // InputForm

Clear[x,y]    
hh=Hold[x,Null,y,Null,Null]

In= stringList[hh]
Out={"x", "Null", "y", "Null", Null}

In= y=2; stringLst[hh]
Out={"x", "Null", "2", "Null", Null}


-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: How to define the coefficients of a polynomial to
  • Next by Date: Re: Manipulate function
  • Previous by thread: Re: Help with Hold
  • Next by thread: Solving Polynomial equation