Example 1:

Inspect the file tst/test3.omt and check the validity of 
reading OpenMath objects from the test file, with repeated
calls to OMGetObject. 

Ensure you don't attempt to read beyond the last object in
the file as GAP will hang.

RequirePackage("openmath");
stream := InputTextFile(Filename(
	DirectoriesPackageLibrary("openmath","tst")[1],"test3.omt"));
OMGetObject(stream);

###############################

Example 2:
Verify that writing an OpenMath object to a stream then reading
it back in doesn't change its value.

RequirePackage("openmath");

g := SymmetricGroup(5);
t := "";
s := OutputTextString(t, true);
OMPutObject(s, g);
CloseStream(s);

s := InputTextString(t);
h := OMGetObject(s);
h = g;

###############################
Example 3:

To test:

OMTest(<object>);

returns true iff Encoding and Decoding in OpenMath is the identity on
<object>.

###########################

Example 4: Printing OM objects

g := SymmetricGroup(5);
OMPrint(g);

###########################

Example 5: Pasting OM objects

stream := InputTextUser(); g := OMGetObject(stream);

#now paste in the following.
#Note: the encoding line is optional.

<?xml version="1.0" encoding="UTF-8"?>


<OMOBJ>
        <OMA>
                <OMS cd="group1" name="Group"/>
                <OMA>
                        <OMS cd="permut1" name="Permutation"/>
                        <OMI> 2 </OMI>
                        <OMI> 3 </OMI>
                        <OMI> 1 </OMI>
                </OMA>
                <OMA>
                        <OMS cd="permut1" name="Permutation"/>
                        <OMI> 2 </OMI>
                        <OMI> 1 </OMI>
                </OMA>

        </OMA>
</OMOBJ>

####################################################################

Example 6: Pasting a list of permutations


stream := InputTextUser();
g := OMGetObject(stream);

<?xml version="1.0" encoding="ISO-8859-1"?>

<OMOBJ>
	<OMA>
		<OMS cd="list1" name="list"/>
		<OMA>
			<OMS cd="permut1" name="Permutation"/>
			<OMI>2</OMI>
			<OMI>3</OMI>
			<OMI>1</OMI>
		</OMA>
		<OMA>
			<OMS cd="permut1" name="Permutation"/>
			<OMI>2</OMI>
			<OMI>1</OMI>
		</OMA>
	</OMA>
</OMOBJ>

####################################################################

Andrew Solomon
St. Andrews
9 March 2000.

