Search code examples
octavejulia

Is there an equivalent to Octave's "lookfor" command in Julia?


How to seek a concrete function in Julia? lookfor would make it in Matlab / GNU Octave, how can it be done here?


Solution

  • The equivalent of lookfor is apropos:

    julia> apropos("fourier transform")
    Base.DFT.fft
    
    julia> apropos("concatenate")
    Base.:*
    Base.hcat
    Base.cat
    Base.flatten
    Base.mapslices
    Base.vcat
    Base.hvcat
    Base.SparseArrays.blkdiag
    Core.@doc
    

    Other useful functions, depending on what you're looking for, include methodswith, which can give you a list of methods that are specified for a particular argument type:

    julia> methodswith(Regex)
    25-element Array{Method,1}:
     ==(a::Regex, b::Regex) at regex.jl:370                                                                
     apropos(io::IO, needle::Regex) at docs/utils.jl:397                                                   
     eachmatch(re::Regex, str::AbstractString) at regex.jl:365                                             
     eachmatch(re::Regex, str::AbstractString, ovr::Bool) at regex.jl:362                                  
     ...