# locate -- locate source code

## Synopsis

• Usage:
locate f
• Inputs:
• Outputs:
• , a list, or null, (filename, start,startcol, stop,stopcol, pos,poscol), respectively

## 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 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, 279, 42, 306, 64, 279, 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, 308, 41, 310, 51, 308, 46) } {1 => (/usr/share/Macaulay2/Core/res.m2, 312, 45, 313, 67, 312, 50) } {2 => (/usr/share/Macaulay2/Core/res.m2, 279, 42, 306, 64, 279, 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.

## Ways to use locate :

• "locate(DocumentTag)" -- see DocumentTag -- the class of all document tags
• "locate(Function)"
• "locate(List)"
• "locate(Nothing)"
• "locate(Pseudocode)"
• "locate(Sequence)"
• "locate(Symbol)"
• "locate(ZZ)"
• "locate(TestInput)" -- see tests -- locate a package's tests

## For the programmer

The object locate is .