Function Repository Resource:

PositionTooltips

Source Notebook

Display expressions with their elements tool-tipped by position

Contributed by: Michael Sollami and Jesse Friedman

ResourceFunction["PositionTooltips"][expr]

displays the expression expr with element indices in tooltips.

Details and Options

The positions of clicked elements are copied to the clipboard.
ResourceFunction["PositionTooltips"] currently accepts no options.

Examples

Basic Examples (3) 

Display associations as Values with Keys as Tooltips:

In[1]:=
ResourceFunction["PositionTooltips"]@
 AssociationThread[Range[26] + 96 -> Alphabet[]]
Out[1]=

PositionTooltips will tooltip all valid keys-values:

In[2]:=
populations = Sort[Association[# -> #["Population"][[1]] & /@ RandomSample[CountryData[], 5]]];
In[3]:=
ResourceFunction["PositionTooltips"][populations]
Out[3]=

PositionTooltips works on nested expressions:

In[4]:=
ResourceFunction["PositionTooltips"]@{a, b, c, {d, e, b, {g}}}
Out[4]=

As well as mixed expressions involving lists and associations:

In[5]:=
expr = {a, b, c, <|d -> "1", e -> <|"k1" -> 2, "k2" -> 3|>, b -> {g, h}|>};
In[6]:=
ResourceFunction["PositionTooltips"]@expr
Out[6]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 05 June 2020

Related Resources

License Information