|
[Date Index]
[Thread Index]
[Author Index]
Re: Help with Hold
- To: mathgroup at smc.vnet.net
- Subject: [mg100933] Re: [mg100917] Help with Hold
- From: John Fultz <jfultz at wolfram.com>
- Date: Thu, 18 Jun 2009 06:18:27 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
On Thu, 18 Jun 2009 04:52:55 -0400 (EDT), 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?
Not sure if this is the most concise/clever way, but it certainly works. I
assume here that your criteria for choosing 'x' and 'y', but not 'Null' is that
'x' and 'y' are symbols and in the Global` context.
isGlobalSymbol[x_Symbol] := Context[x] === "Global`";
isGlobalSymbol[x_] := False;
SetAttributes[isGlobalSymbol, HoldAll];
List @@ (Hold[x, Null, y, Null, Null] /.
var_?isGlobalSymbol :> ToString[Unevaluated[var]])
Sincerely,
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.
Prev by Date:
Re: PDF import problem
Next by Date:
Re: How can I parse arguments of an expression unevaluated?
Previous by thread:
Re: Help with Hold
Next by thread:
Re: Re: Help with Hold
|