Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2011

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

Search the Archive

Re: Preprocessing file input

  • To: mathgroup at
  • Subject: [mg121283] Re: Preprocessing file input
  • From: David Bailey <dave at>
  • Date: Wed, 7 Sep 2011 05:40:36 -0400 (EDT)
  • Delivered-to:
  • References: <j44jkp$8s3$>

On 06/09/2011 08:55, Wolfgang Windsteiger wrote:
> Hi everyone,
> is there some hook for preprocessing expressions when they are read from
> a file. I'm looking for an analogon to $Pre, which applies to each
> expression read from a file. E.g. I have file.m containing
> expr1
> expr2
> expr3
> and when I do
> <<file.m
> what I would like to happen is
> $PreFile[expr1]
> $PreFile[expr1]
> $PreFile[expr1]
> Is there something like $PreFile???
> Thanks for any suggestion,
> WW.
Not exactly, but if you open the file as an input stream with OpenRead, 
you can read expressions using:


The expressions are returned unevaluated, wrapped in Hold, so you can 
apply whatever function you want at that point.

David Bailey

  • Prev by Date: Re: CDF files now on Gyre&Gimble (math blog)
  • Next by Date: Re: two coupled differential equations
  • Previous by thread: Re: Preprocessing file input
  • Next by thread: Invoking pdflatex from a notebook