Compress[]
was introduced in version 6 of Mathematica. It gives a compressed version of expressions represented as a string of ASCII characters. It preserves more information than the InputForm
of expressions (for example it keeps packed arrays packed).
Are the strings returned by Compress
compatible between versions? Can a compressed expression created using version 6 be uncompressed in version 8? What about the reverse (reading a version-8-compressed expression in 6 or 7)?
What happens if a version 8 specific object such as Graph
is uncompressed in version 6 or 7?
Answer
Compress[expr]
will take an expression, convert it to a string, using some form, which would allows to recover the expression later on (most likely InputForm
is used) and compress the string.
If the resulting compressed expression is uncompressed in an earlier version of Mathematica, the result is going to be an expression, which has no code associated with it, so it will, most likely, just remain unevaluated, if executed.
To reiterate, yes, Compress
/Uncompress
is cross version compatible, yet the result obtained on uncompressing, may not evaluate in earlier versions of Mathematica
Comments
Post a Comment