/usr/share/gap/pkg/openmath/examples is in gap-openmath 11.3.1+ds-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | 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.
LoadPackage("openmath");
stream := InputTextFile(Filename(
DirectoriesPackageLibrary("openmath","tst"),"test3.omt"));
OMGetObject(stream);
# ...
CloseStream( stream );
The same with tst/test5.omt, tst/test6.omt, tst/test_new.omt.
###############################
Example 2:
Verify that writing an OpenMath object to a stream then reading
it back in doesn't change its value.
LoadPackage("openmath");
g := SymmetricGroup(5);
t := "";
s := OutputTextString(t, true);
OMPutObject(s, g);
CloseStream(s);
s := InputTextString(t);
h := OMGetObject(s);
CloseStream(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); CloseStream(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_by_generators"/>
<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>
# Get more examples in dir tst, files test3.omt, test5.omt,
# test6.omt, test_new.omt.
####################################################################
Example 6: Pasting a list of permutations
stream := InputTextUser(); g := OMGetObject(stream); CloseStream(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.
(OpenMath code updated by Alexander Konovalov in April 2009)
|