Function Repository Resource:

PrintDefinitionCases

Source Notebook

Find definitions for symbols in a context using a pattern, getting highlighted occurrences of it

Contributed by: Taliesin Beynon (Wolfram Research)

ResourceFunction["PrintDefinitionCases"][context,patt]

finds all definitions of symbols in context that contain patt at any level and prints them, highlighting the occurrences of patt.

Examples

Basic Examples (1) 

Get the definition for a simple function:

In[1]:=
f[x_] := x^2;
In[2]:=
ResourceFunction["PrintDefinitionCases"]["Global`", f[_]]

Scope (1) 

Get definitions for the function fibo:

In[3]:=
fibo[1] = 1;
fibo[2] = 1;
fibo[n_Integer] := fibo[n] = fibo[n - 1] + fibo[n - 2]
In[4]:=
fibo[3]
Out[4]=
In[5]:=
ResourceFunction["PrintDefinitionCases"]["Global`", fibo[_]]

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 25 February 2019

License Information