17

Is there a way to list all the user-defined variables & function in a Notebook ?

I would like this for the comfort it brings to a notebook overview as well as to spot potential multiple use of a variable name (thus redefining it accidental)

500
  • 6,509
  • 8
  • 46
  • 80

1 Answers1

24

To find names in a context, say in the Global context, try

Names["Global`*"]

--Nasser

Nasser
  • 12,849
  • 6
  • 52
  • 104
  • 4
    More straightforward: `Names[$Context<>"*"]`. – Alexey Popkov May 29 '11 at 07:30
  • & Alexey, Thank You ! Would you think about a way to list separately the Function, Variable or options used ? Many Thanks. – 500 May 29 '11 at 13:16
  • @500, I do not know how to find if it is a function you defined, but for build in function, this is how I do it isFunction[name_String]:=Module[{m}, If[Length[SyntaxInformation[Symbol[name]]]>0,True,False]]; for example: isFunction["Plot"] will return True. this works only for functions which have synatxInformation. – Nasser May 30 '11 at 03:35
  • 1
    Is `Names[$Context<>"*"]` more straightforward because it gives the current context instead of assuming that the current context is Global? – WXB13 Jul 29 '14 at 20:45