Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Serialize an expression along with any needed definitions so that it can be used in another session
ResourceFunction["SerializeWithDefinitions"][expr] serializes expr to a ByteArray along with its dependent definitions. |
Serialize an expression with dependent definitions:
In[1]:= |
Out[4]= |
Definitions are restored when the expression is deserialized:
In[5]:= |
Out[6]= |
The serialized expression is an evaluation that restores definitions before returning the output:
In[7]:= |
In[8]:= |
Out[8]= |
BinarySerialize by itself does not preserve definitions:
In[9]:= |
Out[9]= |
In[10]:= |
Out[10]= |
In[11]:= |
In[12]:= |
Out[12]= |
In[13]:= |
Out[13]= |
Serialize a Dataset:
In[14]:= |
Out[14]= |
Serialize the same Dataset with PerformanceGoal set to "Size":
In[15]:= |
Out[15]= |
Both forms represent the same expression:
In[16]:= |
Out[16]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License