MathGroup Archive 2006

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

Search the Archive

Re: ReadList[file,HeldExpression] ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67633] Re: ReadList[file,HeldExpression] ?
  • From: dh <dh at metrohm.ch>
  • Date: Mon, 3 Jul 2006 06:37:31 -0400 (EDT)
  • References: <e85ful$kf8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Mark,
1) read your file as strings to prevent evaluation
2) convert the strings to expressions and wrap these into Hold: 
ToExpression[..,InputForm,Hold]
E.g.:
ToExpression[ ReadList["FileName", "String"], InputForm, Hold]

Daniel

Mark wrote:
> Can someone tell me how to do the following?
> 
> Say I have a Mathematica file go.m with the following two lines:
> 
> a=2;
> c = 3;
> 
> and I want a command ReadCommandsInFile such that
> ReadCommandsInFile["go.m"] produces
> 
> {Hold[Set[a,2]],Hold[Set[c,3]]}
> 
> but I do not want to execute these commands. 
> 
> Mark
> 


  • Prev by Date: Re: Drawing outline of 3D shape
  • Next by Date: Re: Drawing outline of 3D shape
  • Previous by thread: ReadList[file,HeldExpression] ?
  • Next by thread: Re: ReadList[file,HeldExpression] ?