This is Serialization.info, produced by Macaulay2, version 1.21

Serialization -- reversible conversion of all Macaulay2 objects to strings
**************************************************************************

Description
===========

This package provides the user with the capability of saving Macaulay2 objects
in a file and recovering them later, in another Macaulay2 session.

The implementation is still experimental and preliminary.  Not all types of
objects are handled.

Author
======

  * Daniel R. Grayson (see http://www.math.uiuc.edu/~dan/ ) <dan@math.uiuc.edu>

Version
=======

This documentation describes version 0.1 of Serialization.

Source code
===========

The source code from which this documentation is derived is in the file
Serialization.m2 (see common/share/Macaulay2/Serialization.m2 ).

Exports
=======

  * Functions and commands
      * mark -- mark mutable objects and symbols as not needing
        serialization
      * serialize -- reversible conversion of all Macaulay2
        objects to strings

For the programmer
==================

The object Serialization, is a package (Macaulay2Doc).

mark -- mark mutable objects and symbols as not needing serialization
*********************************************************************

Synopsis
========

  * Usage:
        mark()
  * Consequences:
      * The function serialize, will assume that mutable
        objects currently in existence need not be serialized.

Description
===========

+--------------------------------------------------+
|i1 : X = new Type of List                         |
|                                                  |
|o1 = X                                            |
|                                                  |
|o1 : Type                                         |
+--------------------------------------------------+
|i2 : y = 4                                        |
|                                                  |
|o2 = 4                                            |
+--------------------------------------------------+
|i3 : mark()                                       |
+--------------------------------------------------+
|i4 : x = new X from {1,2,3}                       |
|                                                  |
|o4 = {1, 2, 3}                                    |
|                                                  |
|o4 : X                                            |
+--------------------------------------------------+
|i5 : serialize (symbol x, symbol y)               |
|                                                  |
|o5 = -- -*- mode: M2; coding: utf-8 -*-           |
|     s0:=X -- Type : X                            |
|     s1:=global X -- Symbol : X                   |
|     s2:=1 -- ZZ : 1                              |
|     s3:=2 -- ZZ : 2                              |
|     s4:=3 -- ZZ : 3                              |
|     s5:=newClass(s0,{s2,s3,s4}) -- X : X{1, 2, 3}|
|     s6:=global x -- Symbol : x                   |
|     s7:=global y -- Symbol : y                   |
|     s8:=(s6,s7) -- Sequence : (x,y)              |
|     globalAssignFunction(s1,s0)                  |
|     s6<-s5                                       |
|     s8                                           |
+--------------------------------------------------+

See also
========

  * serialize -- reversible conversion of all Macaulay2
    objects to strings

For the programmer
==================

The object mark, is a function closure (Macaulay2Doc).

serialize -- reversible conversion of all Macaulay2 objects to strings
**********************************************************************

Synopsis
========

  * Usage:
        serialize x
  * Inputs:
      * x, a thing (Macaulay2Doc),
  * Outputs:
      * a string (Macaulay2Doc), which when evaluated, will
        recreate the object x.  The string can be written to a file, and
        load (Macaulay2Doc), can be used to evaluate it later in another
        Macaulay2 session.  Symbols encountered will have their values
        restored.

Description
===========

A convenient thing to serialize is the list of all user symbols provided by
userSymbols (Macaulay2Doc), as in the following example.

+-----------------------------------------------------------------------------+
|i1 : R = QQ[x,y]                                                             |
|                                                                             |
|o1 = R                                                                       |
|                                                                             |
|o1 : PolynomialRing                                                          |
+-----------------------------------------------------------------------------+
|i2 : I = ideal (x^2+y^3-1)                                                   |
|                                                                             |
|            3    2                                                           |
|o2 = ideal(y  + x  - 1)                                                      |
|                                                                             |
|o2 : Ideal of R                                                              |
+-----------------------------------------------------------------------------+
|i3 : S = R/I                                                                 |
|                                                                             |
|o3 = S                                                                       |
|                                                                             |
|o3 : QuotientRing                                                            |
+-----------------------------------------------------------------------------+
|i4 : X = new Type of List                                                    |
|                                                                             |
|o4 = X                                                                       |
|                                                                             |
|o4 : Type                                                                    |
+-----------------------------------------------------------------------------+
|i5 : g = new MutableList                                                     |
|                                                                             |
|o5 = MutableList{}                                                           |
|                                                                             |
|o5 : MutableList                                                             |
+-----------------------------------------------------------------------------+
|i6 : h = new MutableList                                                     |
|                                                                             |
|o6 = MutableList{}                                                           |
|                                                                             |
|o6 : MutableList                                                             |
+-----------------------------------------------------------------------------+
|i7 : g#0 = h                                                                 |
|                                                                             |
|o7 = MutableList{}                                                           |
|                                                                             |
|o7 : MutableList                                                             |
+-----------------------------------------------------------------------------+
|i8 : h#0 = g                                                                 |
|                                                                             |
|o8 = MutableList{...1...}                                                    |
|                                                                             |
|o8 : MutableList                                                             |
+-----------------------------------------------------------------------------+
|i9 : save := serialize userSymbols()                                         |
|                                                                             |
|o9 = -- -*- mode: M2; coding: utf-8 -*-                                      |
|     s0:=QQ -- Ring : QQ                                                     |
|     s1:=global QQ -- Symbol : QQ                                            |
|     s2:=monoid[x..y, Degrees => {2:1}, Heft => {1}] -- GeneralOrderedMonoid |
|     s3:=s0 s2 -- PolynomialRing : R                                         |
|     s4:=global R -- Symbol : R                                              |
|     s5:=s3_{0, 3} -- R : y^3                                                |
|     s6:=s3_{2, 0} -- R : x^2                                                |
|     s7:=-1/1 -- QQ : -1                                                     |
|     s8:=1_s3 -- R : 1                                                       |
|     s9:=s5+s6+s7*s8 -- R : y^3+x^2-1                                        |
|     s10:=ideal(s9) -- Ideal : ideal(y^3+x^2-1)                              |
|     s11:=global I -- Symbol : I                                             |
|     s12:=s3/s10 -- QuotientRing : S                                         |
|     s13:=global S -- Symbol : S                                             |
|     s14:=Type -- Type : Type                                                |
|     s15:=global Type -- Symbol : Type                                       |
|     s16:=List -- Type : List                                                |
|     s17:=global List -- Symbol : List                                       |
|     s18:=newClass(s14,s16,hashTable{}) -- Type : X                          |
|     s19:=global X -- Symbol : X                                             |
|     s20:=MutableList -- Type : MutableList                                  |
|     s21:=global MutableList -- Symbol : MutableList                         |
|     s22:=newClass(s20,{}) -- MutableList : MutableList{...1...}             |
|     s23:=newClass(s20,{}) -- MutableList : MutableList{...1...}             |
|     s24:=global g -- Symbol : g                                             |
|     s25:=global h -- Symbol : h                                             |
|     s26:=s12_{1, 0} -- S : x                                                |
|     s27:=global x -- Symbol : x                                             |
|     s28:=s12_{0, 1} -- S : y                                                |
|     s29:=global y -- Symbol : y                                             |
|     s30:={s11,s4,s13,s19,s24,s25,s27,s29} -- List : {I, R, S, X, g, h, x, y}|
|     s4<-s3                                                                  |
|     s11<-s10                                                                |
|     s13<-s12                                                                |
|     globalAssignFunction(s15,s14)                                           |
|     globalAssignFunction(s17,s16)                                           |
|     globalAssignFunction(s19,s18)                                           |
|     s19<-s18                                                                |
|     globalAssignFunction(s21,s20)                                           |
|     s22#0=s23                                                               |
|     s23#0=s22                                                               |
|     s24<-s23                                                                |
|     s25<-s22                                                                |
|     s27<-s26                                                                |
|     s29<-s28                                                                |
|     s30                                                                     |
|-----------------------------------------------------------------------------|
|: monoid[x..y, Degrees => {2:1}, Heft => {1}]                                |
+-----------------------------------------------------------------------------+
|i10 : clearAll                                                               |
+-----------------------------------------------------------------------------+
|i11 : I                                                                      |
|                                                                             |
|o11 = I                                                                      |
|                                                                             |
|o11 : Symbol                                                                 |
+-----------------------------------------------------------------------------+
|i12 : value save                                                             |
|                                                                             |
|o12 = {I, R, S, X, g, h, x, y}                                               |
|                                                                             |
|o12 : List                                                                   |
+-----------------------------------------------------------------------------+
|i13 : I                                                                      |
|                                                                             |
|             3    2                                                          |
|o13 = ideal(y  + x  - 1)                                                     |
|                                                                             |
|o13 : Ideal of QQ[x..y]                                                      |
+-----------------------------------------------------------------------------+
|i14 : g                                                                      |
|                                                                             |
|o14 = MutableList{...1...}                                                   |
|                                                                             |
|o14 : MutableList                                                            |
+-----------------------------------------------------------------------------+
|i15 : g#0 === h                                                              |
|                                                                             |
|o15 = true                                                                   |
+-----------------------------------------------------------------------------+

For the programmer
==================

The object serialize, is a function closure (Macaulay2Doc).