Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2540

Re: Get["file.mx"] doesn't work

From Peter Pein <petsie@dordos.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Get["file.mx"] doesn't work
Date 2011-05-20 11:02 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ir5hov$9n$1@smc.vnet.net> (permalink)
References <iqtnbm$io4$1@smc.vnet.net> <ir09p4$20l$1@smc.vnet.net> <ir2vr9$h50$1@smc.vnet.net>

Show all headers | View raw


Am 19.05.2011 13:44, schrieb Albert Retey:
> Hi,
> 
>> There is an interesting alternative to using MX files, which seems to
>> be portable:
>>
>> str=OpenWrite[file,BinaryFormat->True];
>> BinaryWrite[str,Compress[expr],"TerminatedString"]; Close[str];
>>
> 
> Another alternative seems to be WDX (Wolfram Data eXchange) which I am 
> using without problems on a variety of machines and which also seems to 
> be portable, can be used exactly like MX files, is binary, is documented 
> and thus I would consider officially supported. And it is used by the 
> data paclet functionality, so I guess it is reasonably performant and 
> well tested on all systems (an assumption which my experience does 
> support up to now).
> 
> On the other hand that format seems to not be promoted by Wolfram very 
> much. Has anyone any information what the "official" state of that 
> format is, and whether WRI thinks it is save and recommended to be used 
> by ordinary users or not?
> 
> Honestly I could well imagine that WDX basically does something very 
> close to what David suggested :-). If anyone has time to do some 
> performance comparison between the two, I would be interested to hear 
> the results...
> 
> cheers,
> 
> albert
> 
> 
> 

soory to say, Albert, but Ex- and Import is not an easy to handle
alternative to DumpSave:

In[1]:= f[x_]:=x+1
In[2]:= SetDirectory["C:\\Users\\Peter"];
In[3]:= DumpSave["f.mx",f];
In[4]:= Remove[f];
In[5]:= <<"f.mx"
In[6]:= f[a]
Out[6]= 1+a

this should work with an alternative. But:

In[7]:= Export["f.wdx",f];
In[8]:= Remove@f
In[9]:= Import["f.wdx"]
Out[9]= f
In[10]:= f[b]
Out[10]= f[b]

and of course the following leads to a real mess:

In[11]:= f:=Import["f.wdx"]
In[12]:= f[c]
During evaluation of In[12]:= $RecursionLimit::reclim: Recursion depth
of 256 exceeded. >>
During evaluation of In[12]:= $RecursionLimit::reclim: Recursion depth
of 256 exceeded. >>
During evaluation of In[12]:= $RecursionLimit::reclim: Recursion depth
of 256 exceeded. >>
During evaluation of In[12]:= General::stop: Further output of
$RecursionLimit::reclim will be suppressed during this calculation. >>
Out[12]= $Aborted

One would have to find a way to save all (d)ownvalues, upvalues (and
possibly "inbetweenvalues" ;-) ) and to restore them. Not too trivial,
is it?

Cheers,
Peter

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Get["file.mx"] doesn't work "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-05-17 11:49 +0000
  Re: Get["file.mx"] doesn't work David Bailey <dave@removedbailey.co.uk> - 2011-05-18 11:15 +0000
    Re: Get["file.mx"] doesn't work Albert Retey <awnl@gmx-topmail.de> - 2011-05-19 11:44 +0000
      Re: Get["file.mx"] doesn't work Peter Pein <petsie@dordos.net> - 2011-05-20 11:02 +0000
        Re: Get["file.mx"] doesn't work Albert Retey <awnl@gmx-topmail.de> - 2011-05-21 10:47 +0000
    Re: Get["file.mx"] doesn't work Ulf-Dietrich Braumann <braumann@uni-leipzig.de> - 2011-05-20 10:38 +0000

csiph-web