How do I find out about all the (very) specific functions in julia?

Hi,

I’m working my way through exercism, and looking at community solutions I’m seeing all these very specific functions that I’m coding myself, eg findall

Where should I look to see all the functions julia is providing?

Thanks
Jonathan.

Just read the documentation, for example: https://raw.githubusercontent.com/JuliaLang/docs.julialang.org/assets/julia-1.7.1.pdf

The docs are available in html Julia Documentation · The Julia Language.

findall is in Base: Arrays · The Julia Language

2 Likes

Documentation, packages and code is also searchable on JuliaHub:
Documentation · arrays · JuliaHub

One thing I like to do from the REPL is using apropos which can also be accessed by putting quotation marks around a query in help mode. For example, if I was trying to find a function that looks for matches through a collection (findall) I might look at all the functions whose docstring contains the word “search”.

help?> apropos
search: apropos hasproperty

  apropos([io::IO=stdout], pattern::Union{AbstractString,Regex})

  Search available docstrings for entries containing pattern.

  When pattern is a string, case is ignored. Results are printed to io.

help?> "search"
Base.reverse
Base.include
Base.match
Base.MainInclude.include
Base.LOAD_PATH
Base.replace
Base.findall
Base.require
Base.eachmatch
Base.findfirst
Base.Sys.which
Base.DL_LOAD_PATH
Base.Libc.Libdl.find_library
Base.Libc.Libdl.dlopen
Base.BinaryPlatforms.detect_libstdcxx_version
Base.Sort.searchsortedfirst
Base.Sort.searchsorted
Base.Sort.searchsortedlast
Base.Docs.getdoc
Artifacts.@artifact_str
Artifacts.with_artifacts_directory
NetworkOptions.ca_roots
NetworkOptions.ssh_known_hosts_files
LinearAlgebra.eigvals!
LinearAlgebra.eigen
LinearAlgebra.LAPACK.gels!
Tar.create
InteractiveUtils.methodswith
LibGit2.GitDescribeResult
LibGit2.CheckoutOptions
LibGit2.isbinary
LibGit2.Consts.GIT_CONFIG
LibGit2.Consts.GIT_REPOSITORY_OPEN
REPL.stripmd
Base.Docs.apropos
7 Likes

See also GitHub - tkf/InteractiveCodeSearch.jl: Interactively search Julia code from terminal

4 Likes

methodswith can be very useful if you have an object and want to know what methods you can call on it. For example, for a Date:

julia> using Dates

julia> day = today()
2022-01-05

julia> typeof(day)
Date

julia> methodswith(typeof(day); supertypes=true)
[1] datetime2rata(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/conversions.jl:99
[2] day(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/accessors.jl:59
[3] dayabbr(dt::TimeType; locale) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:189
[4] dayname(dt::TimeType; locale) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:169
[5] dayofmonth(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/accessors.jl:71
[6] dayofquarter(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:662
[7] dayofweek(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:121
[8] dayofweekofmonth(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:222
[9] dayofyear(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:643
[10] daysinmonth(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:619
[11] daysinyear(dt::TimeType) in Dates at /nix/store/h53x3whi685kck84889h2cbaagjbmay8-julia-bin-1.6.5/share/julia/stdlib/v1.6/Dates/src/query.jl:645
[...]
1 Like

You can do this:

using packagename

In the REPL you enter:

packagename. [press tab-key twice]

The dot (.) behind the packagename is necessary. Then you can enter

?packagename.function [return]

i.e.

1 Like