Search code examples
juliabuilt-in

How to find the list of all builtin functions of Julia


How to get the list of all built-in functions of Julia Programming Language?

Once the Julia command line is started, what functions can I use and how to get the list of builtins?

I mean without importing any modules from the standard library (e.g. using LinearAlgebra).

For Python it is documented here: https://docs.python.org/3/library/functions.html

Is there a similar documentation for Julia?


Solution

  • Assuming you want to get it programmatically, first you need the list of loaded modules:

    julia> modules= [mod for mod in getfield.(Ref(Main),names(Main)) 
                     if typeof(mod)==Module && mod != Main]
    3-element Vector{Module}:
     Base
     Core
     InteractiveUtils
    

    Now you having the list of modules you can do:

    julia> vcat(( filter!(f -> typeof(f) <: Function, 
                  getfield.(Ref(m), names(m)))  for m in modules)...)
    835-element Vector{Any}:
     ! (generic function with 4 methods)
     != (generic function with 4 methods)
     !== (generic function with 1 method)
     rem (generic function with 142 methods)
     & (generic function with 17 methods)
     adjoint (generic function with 48 methods)
     * (generic function with 310 methods)
     + (generic function with 207 methods)
     - (generic function with 211 methods)
     / (generic function with 137 methods)
     // (generic function with 8 methods)
     (::Colon) (generic function with 16 methods)
     < (generic function with 74 methods)
     ⋮
     clipboard (generic function with 3 methods)
     code_llvm (generic function with 8 methods)
     code_native (generic function with 5 methods)
     code_warntype (generic function with 4 methods)
     edit (generic function with 9 methods)
     less (generic function with 5 methods)
     methodswith (generic function with 4 methods)
     peakflops (generic function with 2 methods)
     subtypes (generic function with 2 methods)
     supertypes (generic function with 1 method)
     varinfo (generic function with 4 methods)
     versioninfo (generic function with 2 methods)