MathGroup Archive 2009

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

Search the Archive

Re: Import "HeldExpression" element of MX file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103331] Re: Import "HeldExpression" element of MX file
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Tue, 15 Sep 2009 06:54:41 -0400 (EDT)
  • References: <200909101125.HAA18361@smc.vnet.net> <h8d54o$112$1@smc.vnet.net> <h8nj2l$cfr$1@smc.vnet.net>

On 2009.09.15. 10:25, dr DanW wrote:
> I have been looking at this for a couple of weeks (I may be the poster
> of the "previous question" that started this thread).
>
> I started this with the mistaken impression that a .mx file was simply
> a binary form of a .m file, but I am coming to appreciate that the
> nature of the data stored in these files is fundamentally different.
> Most of Mathematica input is in the form of expressions; a .m file
> stores a literal, ASCII representation of these expressions as could
> be input directly from a keyboard. However, Mathematica interprets
> input expressions to build internal tables of values and attributes,
> which we can get a peek at using Information[], ??, UpValues[], or
> DownValues[].  DumpSave[] creates a binary dump of these internal
> value tables to a .mx file, in a format I am presuming is a close
> mirror of the internal memory registers.
>
> So, when we read in a .mx file, we should not expect to get the
> expressions the programmer typed in (in Held form or otherwise), but
> the somewhat pre-digested form that Mathematica uses internally.  This
> may still provide us some insight into how a function works, but not
> as insightful as seeing the original code.

Based on what the documentation says, I would still expect that when 
using the "HeldExpression" element, Import will return a held list of 
the information that Definition or ?? can already print.

http://reference.wolfram.com/mathematica/ref/format/MX.html

What ?? returns contains everything that's needed to evaluate the 
funtcion, and more: all the original symbol names.  The only thing that 
is lost is explicitly human targeted features of the code, such as 
formatting/indentation/comments.  Of course I was not expecting to get 
these back.

(Note that "HeldExpression" is an element for Import, not for Export)


  • Prev by Date: Re: Re: condense axis
  • Next by Date: PlotRange
  • Previous by thread: Re: Import "HeldExpression" element of MX file
  • Next by thread: Re: how to get the longest ordered sub sequence of a list in