next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: locate

locate -- locate source code

Synopsis

Description

For a symbol interpreted function f, returns a sequence (n,i,c,j,d,k,e) describing the location of the definition in the source code:

The name of the source file is n;

the code occupies line i column c through line j column d;

the central point of interest located at line k column e.

i1 : locate needs

o1 = (/usr/share/Macaulay2/Core/Core.m2, 116, 17, 118, 47, 116,
     ------------------------------------------------------------------------
     20)

o1 : Sequence
i2 : code needs

o2 = /usr/share/Macaulay2/Core/Core.m2:116:18-118:48: --source code:
     needs = filename -> if not filesLoaded#?filename then load filename else (
          (filepath, filetime) := filesLoaded#filename;
          if filetime < fileTime filepath then load filepath)

If f is a sequence, then lookup is applied first, and the location of the resulting function is provided.

i3 : locate(resolution, Module)

o3 = (/usr/share/Macaulay2/Core/res.m2, 280, 42, 307, 64, 280, 47)

o3 : Sequence

In particular, the output of methods can be used as an input to locate.

i4 : locate methods resolution

o4 = {0 => (/usr/share/Macaulay2/Core/res.m2, 309, 41, 311, 51, 309, 46)     }
     {1 => (/usr/share/Macaulay2/Core/res.m2, 313, 45, 314, 67, 313, 50)     }
     {2 => (/usr/share/Macaulay2/Core/res.m2, 280, 42, 307, 64, 280, 47)     }
     {3 => (/usr/share/Macaulay2/Core/monideal.m2, 175, 49, 175, 74, 175, 54)}

o4 : NumberedVerticalList
i5 : methods doc

o5 = {0 => (doc, String)}

o5 : NumberedVerticalList
i6 : locate 0

o6 = (/usr/share/Macaulay2/SimpleDoc.m2, 35, 18, 43,
     ------------------------------------------------------------------------
     13, 36, 56)

o6 : Sequence

If the function f is compiled, or if f is null, then a location is not available and null is returned.

See also

Ways to use locate :

For the programmer

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