Macaulay2 » Documentation
Packages » Macaulay2Doc » reading the documentation » examples
next | previous | forward | backward | up | index | toc

examples -- list the examples in documentation

Description

The output is returned as a Net of height 0, so the examples will be displayed indented by just white space, allowing immediate entry.

i1 : ex := examples(resolution, Ideal)

o1 = -- examples for tag: resolution(Ideal)
     -- ${prefix}/share/Macaulay2/OldChainComplexes/docs/doc10.m2:254:0
     R = ZZ[a..d]
     I = ideal(a,b,c,d)
     C = res I
     C_2
     C.dd_2
i2 : last capture ex 

o2 = 
     i1 : -- examples for tag: resolution(Ideal)
          -- ${prefix}/share/Macaulay2/OldChainComplexes/docs/doc10.m2:254:0
          R = ZZ[a..d]

     o1 = R

     o1 : PolynomialRing

     i2 : I = ideal(a,b,c,d)

     o2 = ideal (a, b, c, d)

     o2 : Ideal of R

     i3 : C = res I

           1      4      6      4      1
     o3 = R  <-- R  <-- R  <-- R  <-- R  <-- 0
                                              
          0      1      2      3      4      5

     o3 : ChainComplex

     i4 : C_2

           6
     o4 = R

     o4 : R-module, free, degrees {6:2}

     i5 : C.dd_2

     o5 = {1} | -b 0  -c 0  0  -d |
          {1} | a  -c 0  0  -d 0  |
          {1} | 0  b  a  -d 0  0  |
          {1} | 0  0  0  c  b  a  |

                  4      6
     o5 : Matrix R  <-- R

     i6 : 

Alternatively, one could use print to display them with no indentation.

i3 : print ex
-- examples for tag: resolution(Ideal)
-- ${prefix}/share/Macaulay2/OldChainComplexes/docs/doc10.m2:254:0
R = ZZ[a..d]
I = ideal(a,b,c,d)
C = res I
C_2
C.dd_2

If the input is an integer, then the examples will correspond to the documentation node with that index in the last call to about.

i4 : about firstFunction

o4 = {0 => FirstPackage :: firstFunction    }
     {1 => FirstPackage :: firstFunction(ZZ)}

o4 : NumberedVerticalList
i5 : examples 0

o5 = -- examples for tag: firstFunction
     -- ${prefix}/share/Macaulay2/FirstPackage.m2:53:0
     firstFunction 1
     firstFunction 0

If the input is a list, then the examples for all of its elements will be gathered into a single net.

i6 : examples about firstFunction

o6 = -- examples for tag: firstFunction
     -- examples for tag: firstFunction(ZZ)
     -- ${prefix}/share/Macaulay2/FirstPackage.m2:53:0
     firstFunction 1
     firstFunction 0

See also

Ways to use examples:

  • examples(DocumentTag)
  • examples(List)
  • examples(Thing)
  • examples(ZZ)

For the programmer

The object examples is a method function with a single argument.


The source of this document is in Macaulay2Doc/functions/examples-doc.m2:134:0.