在Mathematica中,可以从例如List执行命令开始获取所有内置函数的名称
Names["List`*"]
Run Code Online (Sandbox Code Playgroud)
此外
Names["context`*"]
Run Code Online (Sandbox Code Playgroud)
列出指定上下文中的所有符号.例如
Names["Global`*"]
Run Code Online (Sandbox Code Playgroud)
给出所有内置符号的名称(以及用户在全局上下文中定义的符号,如果有的话).
Matlab/Octave中是否有类似的结构?
在Octave中,您可以使用以下功能:
__operators__ : Undocumented
__keywords__ : Undocumented
__builtins__ : Undocumented
__list_functions__ : Return a list of all functions (.m and .oct functions) in the load path or in the specified directory.
localfunctions : Return a list of all local functions, i.e., subfunctions, within the current file.
Run Code Online (Sandbox Code Playgroud)
和未记录的函数__dump_symtab_info__,转储包含不同范围内的函数和变量名称的符号表:
__dump_symtab_info__ (scope) : Dump symbol table of the given scope
__dump_symtab_info__ (__current_scope__) : Dump symbol table of the current scope
__dump_symtab_info__ ("functions") : Dump globally visible functions from symbol table
__dump_symtab_info__ ("scopes") : List available scopes
__dump_symtab_info__ () : Everything
Run Code Online (Sandbox Code Playgroud)