diff --git a/en/v1.12-dev/.documenter-siteinfo.json b/en/v1.12-dev/.documenter-siteinfo.json index 4dac407bef7..6070230fb9b 100644 --- a/en/v1.12-dev/.documenter-siteinfo.json +++ b/en/v1.12-dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.12.0-DEV.1896","generation_timestamp":"2025-01-16T02:44:01","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.12.0-DEV.1897","generation_timestamp":"2025-01-16T02:45:20","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/en/v1.12-dev/NEWS/index.html b/en/v1.12-dev/NEWS/index.html index bdc520b7947..49dddb0e127 100644 --- a/en/v1.12-dev/NEWS/index.html +++ b/en/v1.12-dev/NEWS/index.html @@ -6,4 +6,4 @@

Julia v1.12 Release Notes

New language features

  • New option --trim creates smaller binaries by removing code that was not proven to be reachable from the entry points. Entry points can be marked using Base.Experimental.entrypoint (#55047).
  • A new keyword argument usings::Bool has been added to names. By using this, we can now find all the names available in module A by names(A; all=true, imported=true, usings=true). (#54609)
  • the @atomic(...) macro family supports now the reference assignment syntax, e.g. @atomic :monotonic v[3] += 4 modifies v[3] atomically with monotonic ordering semantics. (#54707) The supported syntax allows
    • atomic fetch (x = @atomic v[3]),
    • atomic set (@atomic v[3] = 4),
    • atomic modify (@atomic v[3] += 2),
    • atomic set once (@atomiconce v[3] = 2),
    • atomic swap (x = @atomicswap v[3] = 2), and
    • atomic replace (x = @atomicreplace v[3] 2=>5).
  • New option --task-metrics=yes to enable the collection of per-task timing information, which can also be enabled/disabled at runtime with Base.Experimental.task_metrics(::Bool). (#56320) The available metrics are:
    • actual running time for the task (Base.Experimental.task_running_time_ns), and
    • wall-time for the task (Base.Experimental.task_wall_time_ns).
  • Support for Unicode 16 (#56925).

Language changes

  • When methods are replaced with exactly equivalent ones, the old method is no longer deleted implicitly simultaneously, although the new method does take priority and become more specific than the old method. Thus if the new method is deleted later, the old method will resume operating. This can be useful to mocking frameworks (such as in SparseArrays, Pluto, and Mocking, among others), as they do not need to explicitly restore the old method. While inference and compilation still must be repeated with this, it also may pave the way for inference to be able to intelligently re-use the old results, once the new method is deleted. (#53415)

  • Macro expansion will no longer eagerly recurse into Expr(:toplevel) expressions returned from macros. Instead, macro expansion of :toplevel expressions will be delayed until evaluation time. This allows a later expression within a given :toplevel expression to make use of macros defined earlier in the same :toplevel expression. (#53515)

  • Trivial infinite loops (like while true; end) are no longer undefined behavior. Infinite loops that actually do things (e.g. have side effects or sleep) were never and are still not undefined behavior. (#52999)

  • It is now an error to mark a symbol as both public and exported. (#53664)

Compiler/Runtime improvements

  • Generated LLVM IR now uses actual pointer types instead of passing pointers as integers. This affects llvmcall: Inline LLVM IR should be updated to use i8* or ptr instead of i32 or i64, and remove unneeded ptrtoint/inttoptr conversions. For compatibility, IR with integer pointers is still supported, but generates a deprecation warning. (#53687)

  • A new exception FieldError is now introduced to raise/handle getfield exceptions. Previously getfield exception was captured by fallback generic exception ErrorException. Now that FieldError is more specific getfield related exceptions that can occur should use FieldError exception instead. (#54504)

Command-line option changes

  • The -m/--module flag can be passed to run the main function inside a package with a set of arguments. This main function should be declared using @main to indicate that it is an entry point. (#52103)
  • Enabling or disabling color text in Julia can now be controlled with the NO_COLOR or FORCE_COLOR environment variables. These variables are also honored by Julia's build system (#53742, #56346).
  • --project=@temp starts Julia with a temporary environment. (#51149)
  • New --trace-compile-timing option to report how long each method reported by --trace-compile took to compile, in ms. (#54662)
  • --trace-compile now prints recompiled methods in yellow or with a trailing comment if color is not supported (#55763)
  • New --trace-dispatch option to report methods that are dynamically dispatched (#55848).

Multi-threading changes

  • New types are defined to handle the pattern of code that must run once per process, called a OncePerProcess{T} type, which allows defining a function that should be run exactly once the first time it is called, and then always return the same result value of type T every subsequent time afterwards. There are also OncePerThread{T} and OncePerTask{T} types for similar usage with threads or tasks. (#55793)

Build system changes

  • There are new Makefiles to build Julia and LLVM using the Binary Optimization and Layout Tool (BOLT), see contrib/bolt and contrib/pgo-lto-bolt (#54107).

New library functions

  • logrange(start, stop; length) makes a range of constant ratio, instead of constant step (#39071)
  • The new isfull(c::Channel) function can be used to check if put!(c, some_value) will block. (#53159)
  • waitany(tasks; throw=false) and waitall(tasks; failfast=false, throw=false) which wait multiple tasks at once (#53341).
  • uuid7() creates an RFC 9652 compliant UUID with version 7 (#54834).
  • insertdims(array; dims) allows to insert singleton dimensions into an array which is the inverse operation to dropdims. (#45793)
  • The new Fix type is a generalization of Fix1/Fix2 for fixing a single argument (#54653).

New library features

  • escape_string takes additional keyword arguments ascii=true (to escape all non-ASCII characters) and fullhex=true (to require full 4/8-digit hex numbers for u/U escapes, e.g. for C compatibility) (#55099).
  • tempname can now take a suffix string to allow the file name to include a suffix and include that suffix in the uniquing checking (#53474)
  • RegexMatch objects can now be used to construct NamedTuples and Dicts (#50988)
  • Lockable is now exported (#54595)
  • Base.require_one_based_indexing and Base.has_offset_axes are now public (#56196)
  • New ltruncate, rtruncate and ctruncate functions for truncating strings to text width, accounting for char widths (#55351)
  • isless (and thus cmp, sorting, etc.) is now supported for zero-dimensional AbstractArrays (#55772)
  • invoke now supports passing a Method instead of a type signature making this interface somewhat more flexible for certain uncommon use cases (#56692).
  • Timer(f, ...) will now match the stickiness of the parent task when creating timer tasks, which can be overridden by the new spawn kwarg. This avoids the issue where sticky tasks i.e. @async make their parent sticky (#56745)
  • invoke now supports passing a CodeInstance instead of a type, which can enable

certain compiler plugin workflows (#56660).

  • sort now supports NTuples (#54494)
  • map!(f, A) now stores the results in A, like map!(f, A, A). or A .= f.(A) (#40632).

Standard library changes

  • gcdx(0, 0) now returns (0, 0, 0) instead of (0, 1, 0) (#40989).
  • fd returns a RawFD instead of an Int (#55080).

StyledStrings

JuliaSyntaxHighlighting

  • A new standard library for applying syntax highlighting to Julia code, this uses JuliaSyntax and StyledStrings to implement a highlight function that creates an AnnotatedString with syntax highlighting applied. (#51810)

Package Manager

LinearAlgebra

  • rank can now take a QRPivoted matrix to allow rank estimation via QR factorization (#54283).
  • Added keyword argument alg to eigen, eigen!, eigvals and eigvals! for self-adjoint matrix types (i.e., the type union RealHermSymComplexHerm) that allows one to switch between different eigendecomposition algorithms (#49355).
  • Added a generic version of the (unblocked) pivoted Cholesky decomposition (callable via cholesky[!](A, RowMaximum())) (#54619).
  • The number of default BLAS threads now respects process affinity, instead of using total number of logical threads available on the system (#55574).
  • A new function zeroslike is added that is used to generate the zero elements for matrix-valued banded matrices. Custom array types may specialize this function to return an appropriate result (#55252).
  • The matrix multiplication A * B calls matprod_dest(A, B, T::Type) to generate the destination. This function is now public (#55537).
  • The function haszero(T::Type) is used to check if a type T has a unique zero element defined as zero(T). This is now public (#56223).
  • A new function diagview is added that returns a view into a specific band of an AbstractMatrix (#56175).

Logging

Printf

Profile

  • Profile.take_heap_snapshot takes a new keyword argument, redact_data::Bool, that is true by default. When set, the contents of Julia objects are not emitted in the heap snapshot. This currently only applies to strings. (#55326)
  • Profile.print() now colors Base/Core/Package modules similarly to how they are in stacktraces. Also paths, even if truncated, are now clickable in terminals that support URI links to take you to the specified JULIA_EDITOR for the given file & line number. (#55335)

Random

REPL

  • Using the new usings=true feature of the names() function, REPL completions can now complete names that have been explicitly using-ed. (#54610)
  • REPL completions can now complete input lines like [import|using] Mod: xxx| e.g. complete using Base.Experimental: @op to using Base.Experimental: @opaque. (#54719)
  • the REPL will now warn if it detects a name is being accessed from a module which does not define it (nor has a submodule which defines it), and for which the name is not public in that module. For example, map is defined in Base, and executing LinearAlgebra.map in the REPL will now issue a warning the first time occurs. (#54872)
  • When an object is printed automatically (by being returned in the REPL), its display is now truncated after printing 20 KiB. This does not affect manual calls to show, print, and so forth. (#53959)
  • Backslash completions now print the respective glyph or emoji next to each matching backslash shortcode. (#54800)

SuiteSparse

SparseArrays

Test

  • A failing DefaultTestSet now prints to screen the random number generator (RNG) of the failed test, to help reproducing a stochastic failure which only depends on the state of the RNG. It is also possible seed a test set by passing the rng keyword argument to @testset:
    using Test, Random
     @testset rng=Xoshiro(0x2e026445595ed28e, 0x07bb81ac4c54926d, 0x83d7d70843e8bad6, 0xdbef927d150af80b, 0xdbf91ddf2534f850) begin
         @test rand() == 0.559472630416976
    -end

Dates

Statistics

Distributed

Unicode

DelimitedFiles

InteractiveUtils

  • New macros @trace_compile and @trace_dispatch for running an expression with --trace-compile=stderr --trace-compile-timing and --trace-dispatch=stderr respectively enabled. (#55915)

Deprecated or removed

External dependencies

  • The terminal info database, terminfo, is now vendored by default, providing a better REPL user experience when terminfo is not available on the system. Julia can be built without vendoring the database using the Makefile option WITH_TERMINFO=0. (#55411)

Tooling Improvements

  • A wall-time profiler is now available for users who need a sampling profiler that captures tasks regardless of their scheduling or running state. This type of profiler enables profiling of I/O-heavy tasks and helps detect areas of heavy contention in the system (#55889).
+end

Dates

Statistics

Distributed

Unicode

DelimitedFiles

InteractiveUtils

Deprecated or removed

External dependencies

Tooling Improvements

diff --git a/en/v1.12-dev/base/arrays/index.html b/en/v1.12-dev/base/arrays/index.html index 1e641c33e1a..53a3237c1b4 100644 --- a/en/v1.12-dev/base/arrays/index.html +++ b/en/v1.12-dev/base/arrays/index.html @@ -3,7 +3,7 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Arrays

Constructors and Types

Core.ArrayType
Array{T,N} <: AbstractArray{T,N}

N-dimensional dense array with elements of type T.

source
Core.ArrayMethod
Array{T}(undef, dims)
+

Arrays

Constructors and Types

Core.ArrayType
Array{T,N} <: AbstractArray{T,N}

N-dimensional dense array with elements of type T.

source
Core.ArrayMethod
Array{T}(undef, dims)
 Array{T,N}(undef, dims)

Construct an uninitialized N-dimensional Array containing elements of type T. N can either be supplied explicitly, as in Array{T,N}(undef, dims), or be determined by the length or number of dims. dims may be a tuple or a series of integer arguments corresponding to the lengths in each dimension. If the rank N is supplied explicitly, then it must match the length or number of dims. Here undef is the UndefInitializer.

Examples

julia> A = Array{Float64, 2}(undef, 2, 3) # N given explicitly
 2×3 Matrix{Float64}:
  6.90198e-310  6.90198e-310  6.90198e-310
@@ -20,7 +20,7 @@
 2×4×1 Array{Float64, 3}:
 [:, :, 1] =
  2.26703e-314  2.26708e-314  0.0           2.80997e-314
- 0.0           2.26703e-314  2.26708e-314  0.0
source
Core.ArrayMethod
Array{T}(nothing, dims)
+ 0.0           2.26703e-314  2.26708e-314  0.0
source
Core.ArrayMethod
Array{T}(nothing, dims)
 Array{T,N}(nothing, dims)

Construct an N-dimensional Array containing elements of type T, initialized with nothing entries. Element type T must be able to hold these values, i.e. Nothing <: T.

Examples

julia> Array{Union{Nothing, String}}(nothing, 2)
 2-element Vector{Union{Nothing, String}}:
  nothing
@@ -29,7 +29,7 @@
 julia> Array{Union{Nothing, Int}}(nothing, 2, 3)
 2×3 Matrix{Union{Nothing, Int64}}:
  nothing  nothing  nothing
- nothing  nothing  nothing
source
Core.ArrayMethod
Array{T}(missing, dims)
 Array{T,N}(missing, dims)

Construct an N-dimensional Array containing elements of type T, initialized with missing entries. Element type T must be able to hold these values, i.e. Missing <: T.

Examples

julia> Array{Union{Missing, String}}(missing, 2)
 2-element Vector{Union{Missing, String}}:
  missing
@@ -38,25 +38,25 @@
 julia> Array{Union{Missing, Int}}(missing, 2, 3)
 2×3 Matrix{Union{Missing, Int64}}:
  missing  missing  missing
- missing  missing  missing
source
Core.UndefInitializerType
UndefInitializer

Singleton type used in array initialization, indicating the array-constructor-caller would like an uninitialized array. See also undef, an alias for UndefInitializer().

Examples

julia> Array{Float64, 1}(UndefInitializer(), 3)
+ missing  missing  missing
source
Core.UndefInitializerType
UndefInitializer

Singleton type used in array initialization, indicating the array-constructor-caller would like an uninitialized array. See also undef, an alias for UndefInitializer().

Examples

julia> Array{Float64, 1}(UndefInitializer(), 3)
 3-element Vector{Float64}:
  2.2752528595e-314
  2.202942107e-314
- 2.275252907e-314
source
Core.undefConstant
undef

Alias for UndefInitializer(), which constructs an instance of the singleton type UndefInitializer, used in array initialization to indicate the array-constructor-caller would like an uninitialized array.

See also: missing, similar.

Examples

julia> Array{Float64, 1}(undef, 3)
+ 2.275252907e-314
source
Core.undefConstant
undef

Alias for UndefInitializer(), which constructs an instance of the singleton type UndefInitializer, used in array initialization to indicate the array-constructor-caller would like an uninitialized array.

See also: missing, similar.

Examples

julia> Array{Float64, 1}(undef, 3)
 3-element Vector{Float64}:
  2.2752528595e-314
  2.202942107e-314
- 2.275252907e-314
source
Base.VectorType
Vector{T} <: AbstractVector{T}

One-dimensional dense array with elements of type T, often used to represent a mathematical vector. Alias for Array{T,1}.

See also empty, similar and zero for creating vectors.

source
Base.VectorMethod
Vector{T}(undef, n)

Construct an uninitialized Vector{T} of length n.

Examples

julia> Vector{Float64}(undef, 3)
+ 2.275252907e-314
source
Base.VectorType
Vector{T} <: AbstractVector{T}

One-dimensional dense array with elements of type T, often used to represent a mathematical vector. Alias for Array{T,1}.

See also empty, similar and zero for creating vectors.

source
Base.VectorMethod
Vector{T}(undef, n)

Construct an uninitialized Vector{T} of length n.

Examples

julia> Vector{Float64}(undef, 3)
 3-element Vector{Float64}:
  6.90966e-310
  6.90966e-310
- 6.90966e-310
source
Base.VectorMethod
Vector{T}(nothing, m)

Construct a Vector{T} of length m, initialized with nothing entries. Element type T must be able to hold these values, i.e. Nothing <: T.

Examples

julia> Vector{Union{Nothing, String}}(nothing, 2)
+ 6.90966e-310
source
Base.VectorMethod
Vector{T}(nothing, m)

Construct a Vector{T} of length m, initialized with nothing entries. Element type T must be able to hold these values, i.e. Nothing <: T.

Examples

julia> Vector{Union{Nothing, String}}(nothing, 2)
 2-element Vector{Union{Nothing, String}}:
  nothing
- nothing
source
Base.VectorMethod
Vector{T}(missing, m)

Construct a Vector{T} of length m, initialized with missing entries. Element type T must be able to hold these values, i.e. Missing <: T.

Examples

julia> Vector{Union{Missing, String}}(missing, 2)
+ nothing
source
Base.VectorMethod
Vector{T}(missing, m)

Construct a Vector{T} of length m, initialized with missing entries. Element type T must be able to hold these values, i.e. Missing <: T.

Examples

julia> Vector{Union{Missing, String}}(missing, 2)
 2-element Vector{Union{Missing, String}}:
  missing
- missing
source
Base.MatrixMethod
Matrix{T}(undef, m, n)

Construct an uninitialized Matrix{T} of size m×n.

Examples

julia> Matrix{Float64}(undef, 2, 3)
+ missing
source
Base.MatrixMethod
Matrix{T}(undef, m, n)

Construct an uninitialized Matrix{T} of size m×n.

Examples

julia> Matrix{Float64}(undef, 2, 3)
 2×3 Matrix{Float64}:
  2.36365e-314  2.28473e-314    5.0e-324
  2.26704e-314  2.26711e-314  NaN
@@ -64,24 +64,24 @@
 julia> similar(ans, Int32, 2, 2)
 2×2 Matrix{Int32}:
  490537216  1277177453
-         1  1936748399
source
Base.MatrixMethod
Matrix{T}(nothing, m, n)

Construct a Matrix{T} of size m×n, initialized with nothing entries. Element type T must be able to hold these values, i.e. Nothing <: T.

Examples

julia> Matrix{Union{Nothing, String}}(nothing, 2, 3)
+         1  1936748399
source
Base.MatrixMethod
Matrix{T}(nothing, m, n)

Construct a Matrix{T} of size m×n, initialized with nothing entries. Element type T must be able to hold these values, i.e. Nothing <: T.

Examples

julia> Matrix{Union{Nothing, String}}(nothing, 2, 3)
 2×3 Matrix{Union{Nothing, String}}:
  nothing  nothing  nothing
- nothing  nothing  nothing
source
Base.MatrixMethod
Matrix{T}(missing, m, n)

Construct a Matrix{T} of size m×n, initialized with missing entries. Element type T must be able to hold these values, i.e. Missing <: T.

Examples

julia> Matrix{Union{Missing, String}}(missing, 2, 3)
+ nothing  nothing  nothing
source
Base.MatrixMethod
Matrix{T}(missing, m, n)

Construct a Matrix{T} of size m×n, initialized with missing entries. Element type T must be able to hold these values, i.e. Missing <: T.

Examples

julia> Matrix{Union{Missing, String}}(missing, 2, 3)
 2×3 Matrix{Union{Missing, String}}:
  missing  missing  missing
- missing  missing  missing
source
Base.VecOrMatType
VecOrMat{T}

Union type of Vector{T} and Matrix{T} which allows functions to accept either a Matrix or a Vector.

Examples

julia> Vector{Float64} <: VecOrMat{Float64}
+ missing  missing  missing
source
Base.VecOrMatType
VecOrMat{T}

Union type of Vector{T} and Matrix{T} which allows functions to accept either a Matrix or a Vector.

Examples

julia> Vector{Float64} <: VecOrMat{Float64}
 true
 
 julia> Matrix{Float64} <: VecOrMat{Float64}
 true
 
 julia> Array{Float64, 3} <: VecOrMat{Float64}
-false
source
Core.DenseArrayType
DenseArray{T, N} <: AbstractArray{T,N}

N-dimensional dense array with elements of type T. The elements of a dense array are stored contiguously in memory.

source
Base.StridedArrayType
StridedArray{T, N}

A hard-coded Union of common array types that follow the strided array interface, with elements of type T and N dimensions.

If A is a StridedArray, then its elements are stored in memory with offsets, which may vary between dimensions but are constant within a dimension. For example, A could have stride 2 in dimension 1, and stride 3 in dimension 2. Incrementing A along dimension d jumps in memory by [stride(A, d)] slots. Strided arrays are particularly important and useful because they can sometimes be passed directly as pointers to foreign language libraries like BLAS.

source
Core.GenericMemoryType
GenericMemory{kind::Symbol, T, addrspace=Core.CPU} <: DenseVector{T}

Fixed-size DenseVector{T}.

kind can currently be either :not_atomic or :atomic. For details on what :atomic implies, see AtomicMemory

addrspace can currently only be set to Core.CPU. It is designed to permit extension by other systems such as GPUs, which might define values such as:

module CUDA
+false
source
Core.DenseArrayType
DenseArray{T, N} <: AbstractArray{T,N}

N-dimensional dense array with elements of type T. The elements of a dense array are stored contiguously in memory.

source
Base.StridedArrayType
StridedArray{T, N}

A hard-coded Union of common array types that follow the strided array interface, with elements of type T and N dimensions.

If A is a StridedArray, then its elements are stored in memory with offsets, which may vary between dimensions but are constant within a dimension. For example, A could have stride 2 in dimension 1, and stride 3 in dimension 2. Incrementing A along dimension d jumps in memory by [stride(A, d)] slots. Strided arrays are particularly important and useful because they can sometimes be passed directly as pointers to foreign language libraries like BLAS.

source
Core.GenericMemoryType
GenericMemory{kind::Symbol, T, addrspace=Core.CPU} <: DenseVector{T}

Fixed-size DenseVector{T}.

kind can currently be either :not_atomic or :atomic. For details on what :atomic implies, see AtomicMemory

addrspace can currently only be set to Core.CPU. It is designed to permit extension by other systems such as GPUs, which might define values such as:

module CUDA
 const Generic = bitcast(Core.AddrSpace{CUDA}, 0)
 const Global = bitcast(Core.AddrSpace{CUDA}, 1)
-end

The exact semantics of these other addrspaces is defined by the specific backend, but will error if the user is attempting to access these on the CPU.

Julia 1.11

This type requires Julia 1.11 or later.

source
Core.memoryrefFunction
memoryref(::GenericMemory, index::Integer)
-memoryref(::GenericMemoryRef, index::Integer)

Construct a GenericMemoryRef from a memory object and an offset index (1-based) which can also be negative. This always returns an inbounds object, and will throw an error if that is not possible (because the index would result in a shift out-of-bounds of the underlying memory).

source
memoryref(::GenericMemory)

Construct a GenericMemoryRef from a memory object. This does not fail, but the resulting memory will point out-of-bounds if and only if the memory is empty.

source
Base.SlicesType
Slices{P,SM,AX,S,N} <: AbstractSlices{S,N}

An AbstractArray of slices into a parent array over specified dimension(s), returning views that select all the data from the other dimension(s).

These should typically be constructed by eachslice, eachcol or eachrow.

parent(s::Slices) will return the parent array.

source
Base.getindexMethod
getindex(type[, elements...])

Construct a 1-d array of the specified type. This is usually called with the syntax Type[]. Element values can be specified using Type[a,b,c,...].

Examples

julia> Int8[1, 2, 3]
+end

The exact semantics of these other addrspaces is defined by the specific backend, but will error if the user is attempting to access these on the CPU.

Julia 1.11

This type requires Julia 1.11 or later.

source
Core.memoryrefFunction
memoryref(::GenericMemory, index::Integer)
+memoryref(::GenericMemoryRef, index::Integer)

Construct a GenericMemoryRef from a memory object and an offset index (1-based) which can also be negative. This always returns an inbounds object, and will throw an error if that is not possible (because the index would result in a shift out-of-bounds of the underlying memory).

source
memoryref(::GenericMemory)

Construct a GenericMemoryRef from a memory object. This does not fail, but the resulting memory will point out-of-bounds if and only if the memory is empty.

source
Base.SlicesType
Slices{P,SM,AX,S,N} <: AbstractSlices{S,N}

An AbstractArray of slices into a parent array over specified dimension(s), returning views that select all the data from the other dimension(s).

These should typically be constructed by eachslice, eachcol or eachrow.

parent(s::Slices) will return the parent array.

source
Base.getindexMethod
getindex(type[, elements...])

Construct a 1-d array of the specified type. This is usually called with the syntax Type[]. Element values can be specified using Type[a,b,c,...].

Examples

julia> Int8[1, 2, 3]
 3-element Vector{Int8}:
  1
  2
@@ -91,7 +91,7 @@
 3-element Vector{Int8}:
  1
  2
- 3
source
Base.zerosFunction
zeros([T=Float64,] dims::Tuple)
 zeros([T=Float64,] dims...)

Create an Array, with element type T, of all zeros with size specified by dims. See also fill, ones, zero.

Examples

julia> zeros(1)
 1-element Vector{Float64}:
  0.0
@@ -99,7 +99,7 @@
 julia> zeros(Int8, 2, 3)
 2×3 Matrix{Int8}:
  0  0  0
- 0  0  0
source
Base.onesFunction
ones([T=Float64,] dims::Tuple)
 ones([T=Float64,] dims...)

Create an Array, with element type T, of all ones with size specified by dims. See also fill, zeros.

Examples

julia> ones(1,2)
 1×2 Matrix{Float64}:
  1.0  1.0
@@ -107,7 +107,7 @@
 julia> ones(ComplexF64, 2, 3)
 2×3 Matrix{ComplexF64}:
  1.0+0.0im  1.0+0.0im  1.0+0.0im
- 1.0+0.0im  1.0+0.0im  1.0+0.0im
source
Base.BitArrayType
BitArray{N} <: AbstractArray{Bool, N}

Space-efficient N-dimensional boolean array, using just one bit for each boolean value.

BitArrays pack up to 64 values into every 8 bytes, resulting in an 8x space efficiency over Array{Bool, N} and allowing some operations to work on 64 values at once.

By default, Julia returns BitArrays from broadcasting operations that generate boolean elements (including dotted-comparisons like .==) as well as from the functions trues and falses.

Note

Due to its packed storage format, concurrent access to the elements of a BitArray where at least one of them is a write is not thread-safe.

source
Base.BitArrayMethod
BitArray(undef, dims::Integer...)
+ 1.0+0.0im  1.0+0.0im  1.0+0.0im
source
Base.BitArrayType
BitArray{N} <: AbstractArray{Bool, N}

Space-efficient N-dimensional boolean array, using just one bit for each boolean value.

BitArrays pack up to 64 values into every 8 bytes, resulting in an 8x space efficiency over Array{Bool, N} and allowing some operations to work on 64 values at once.

By default, Julia returns BitArrays from broadcasting operations that generate boolean elements (including dotted-comparisons like .==) as well as from the functions trues and falses.

Note

Due to its packed storage format, concurrent access to the elements of a BitArray where at least one of them is a write is not thread-safe.

source
Base.BitArrayMethod
BitArray(undef, dims::Integer...)
 BitArray{N}(undef, dims::NTuple{N,Int})

Construct an undef BitArray with the given dimensions. Behaves identically to the Array constructor. See undef.

Examples

julia> BitArray(undef, 2, 2)
 2×2 BitMatrix:
  0  0
@@ -117,7 +117,7 @@
 3×1 BitMatrix:
  0
  0
- 0
source
Base.BitArrayMethod
BitArray(itr)

Construct a BitArray generated by the given iterable object. The shape is inferred from the itr object.

Examples

julia> BitArray([1 0; 0 1])
+ 0
source
Base.BitArrayMethod
BitArray(itr)

Construct a BitArray generated by the given iterable object. The shape is inferred from the itr object.

Examples

julia> BitArray([1 0; 0 1])
 2×2 BitMatrix:
  1  0
  0  1
@@ -134,13 +134,13 @@
  0
  1
  0
- 0
source
Base.truesFunction
trues(dims)

Create a BitArray with all values set to true.

Examples

julia> trues(2,3)
+ 0
source
Base.truesFunction
trues(dims)

Create a BitArray with all values set to true.

Examples

julia> trues(2,3)
 2×3 BitMatrix:
  1  1  1
- 1  1  1
source
Base.falsesFunction
falses(dims)

Create a BitArray with all values set to false.

Examples

julia> falses(2,3)
+ 1  1  1
source
Base.falsesFunction
falses(dims)

Create a BitArray with all values set to false.

Examples

julia> falses(2,3)
 2×3 BitMatrix:
  0  0  0
- 0  0  0
source
Base.fillFunction
fill(value, dims::Tuple)
 fill(value, dims...)

Create an array of size dims with every location set to value.

For example, fill(1.0, (5,5)) returns a 5×5 array of floats, with 1.0 in every location of the array.

The dimension lengths dims may be specified as either a tuple or a sequence of arguments. An N-length tuple or N arguments following the value specify an N-dimensional array. Thus, a common idiom for creating a zero-dimensional array with its only location set to x is fill(x).

Every location of the returned array is set to (and is thus === to) the value that was passed; this means that if the value is itself modified, all elements of the filled array will reflect that modification because they're still that very value. This is of no concern with fill(1.0, (5,5)) as the value 1.0 is immutable and cannot itself be modified, but can be unexpected with mutable values like — most commonly — arrays. For example, fill([], 3) places the very same empty array in all three locations of the returned vector:

julia> v = fill([], 3)
 3-element Vector{Vector{Any}}:
  []
@@ -197,7 +197,7 @@
 julia> A # both A[1] and A[2] are the very same vector
 2-element Vector{Vector{Float64}}:
  [42.0, 0.0]
- [42.0, 0.0]
source
Base.fill!Function
fill!(A, x)

Fill array A with the value x. If x is an object reference, all elements will refer to the same object. fill!(A, Foo()) will return A filled with the result of evaluating Foo() once.

Examples

julia> A = zeros(2,3)
+ [42.0, 0.0]
source
Base.fill!Function
fill!(A, x)

Fill array A with the value x. If x is an object reference, all elements will refer to the same object. fill!(A, Foo()) will return A filled with the result of evaluating Foo() once.

Examples

julia> A = zeros(2,3)
 2×3 Matrix{Float64}:
  0.0  0.0  0.0
  0.0  0.0  0.0
@@ -217,11 +217,11 @@
 3-element Vector{Int64}:
  1
  1
- 1
source
Base.emptyFunction
empty(a::AbstractDict, [index_type=keytype(a)], [value_type=valtype(a)])

Create an empty AbstractDict container which can accept indices of type index_type and values of type value_type. The second and third arguments are optional and default to the input's keytype and valtype, respectively. (If only one of the two types is specified, it is assumed to be the value_type, and the index_type we default to keytype(a)).

Custom AbstractDict subtypes may choose which specific dictionary type is best suited to return for the given index and value types, by specializing on the three-argument signature. The default is to return an empty Dict.

source
empty(v::AbstractVector, [eltype])

Create an empty vector similar to v, optionally changing the eltype.

See also: empty!, isempty, isassigned.

Examples

julia> empty([1.0, 2.0, 3.0])
+ 1
source
Base.emptyFunction
empty(a::AbstractDict, [index_type=keytype(a)], [value_type=valtype(a)])

Create an empty AbstractDict container which can accept indices of type index_type and values of type value_type. The second and third arguments are optional and default to the input's keytype and valtype, respectively. (If only one of the two types is specified, it is assumed to be the value_type, and the index_type we default to keytype(a)).

Custom AbstractDict subtypes may choose which specific dictionary type is best suited to return for the given index and value types, by specializing on the three-argument signature. The default is to return an empty Dict.

source
empty(v::AbstractVector, [eltype])

Create an empty vector similar to v, optionally changing the eltype.

See also: empty!, isempty, isassigned.

Examples

julia> empty([1.0, 2.0, 3.0])
 Float64[]
 
 julia> empty([1.0, 2.0, 3.0], String)
-String[]
source
empty(x::Tuple)

Return an empty tuple, ().

source
Base.similarFunction
similar(A::AbstractSparseMatrixCSC{Tv,Ti}, [::Type{TvNew}, ::Type{TiNew}, m::Integer, n::Integer]) where {Tv,Ti}

Create an uninitialized mutable array with the given element type, index type, and size, based upon the given source SparseMatrixCSC. The new sparse matrix maintains the structure of the original sparse matrix, except in the case where dimensions of the output matrix are different from the output.

The output matrix has zeros in the same locations as the input, but uninitialized values for the nonzero locations.

similar(storagetype, axes)

Create an uninitialized mutable array analogous to that specified by storagetype, but with axes specified by the last argument.

Examples:

similar(Array{Int}, axes(A))

creates an array that "acts like" an Array{Int} (and might indeed be backed by one), but which is indexed identically to A. If A has conventional indexing, this will be identical to Array{Int}(undef, size(A)), but if A has unconventional indexing then the indices of the result will match A.

similar(BitArray, (axes(A, 2),))

would create a 1-dimensional logical array whose indices match those of the columns of A.

source
similar(array, [element_type=eltype(array)], [dims=size(array)])

Create an uninitialized mutable array with the given element type and size, based upon the given source array. The second and third arguments are both optional, defaulting to the given array's eltype and size. The dimensions may be specified either as a single tuple argument or as a series of integer arguments.

Custom AbstractArray subtypes may choose which specific array type is best-suited to return for the given element type and dimensionality. If they do not specialize this method, the default is an Array{element_type}(undef, dims...).

For example, similar(1:10, 1, 4) returns an uninitialized Array{Int,2} since ranges are neither mutable nor support 2 dimensions:

julia> similar(1:10, 1, 4)
+String[]
source
empty(x::Tuple)

Return an empty tuple, ().

source
Base.similarFunction
similar(A::AbstractSparseMatrixCSC{Tv,Ti}, [::Type{TvNew}, ::Type{TiNew}, m::Integer, n::Integer]) where {Tv,Ti}

Create an uninitialized mutable array with the given element type, index type, and size, based upon the given source SparseMatrixCSC. The new sparse matrix maintains the structure of the original sparse matrix, except in the case where dimensions of the output matrix are different from the output.

The output matrix has zeros in the same locations as the input, but uninitialized values for the nonzero locations.

similar(storagetype, axes)

Create an uninitialized mutable array analogous to that specified by storagetype, but with axes specified by the last argument.

Examples:

similar(Array{Int}, axes(A))

creates an array that "acts like" an Array{Int} (and might indeed be backed by one), but which is indexed identically to A. If A has conventional indexing, this will be identical to Array{Int}(undef, size(A)), but if A has unconventional indexing then the indices of the result will match A.

similar(BitArray, (axes(A, 2),))

would create a 1-dimensional logical array whose indices match those of the columns of A.

source
similar(array, [element_type=eltype(array)], [dims=size(array)])

Create an uninitialized mutable array with the given element type and size, based upon the given source array. The second and third arguments are both optional, defaulting to the given array's eltype and size. The dimensions may be specified either as a single tuple argument or as a series of integer arguments.

Custom AbstractArray subtypes may choose which specific array type is best-suited to return for the given element type and dimensionality. If they do not specialize this method, the default is an Array{element_type}(undef, dims...).

For example, similar(1:10, 1, 4) returns an uninitialized Array{Int,2} since ranges are neither mutable nor support 2 dimensions:

julia> similar(1:10, 1, 4)
 1×4 Matrix{Int64}:
  4419743872  4374413872  4419743888  0

Conversely, similar(trues(10,10), 2) returns an uninitialized BitVector with two elements since BitArrays are both mutable and can support 1-dimensional arrays:

julia> similar(trues(10,10), 2)
 2-element BitVector:
@@ -229,19 +229,19 @@
  0

Since BitArrays can only store elements of type Bool, however, if you request a different element type it will create a regular Array instead:

julia> similar(falses(10), Float64, 2, 4)
 2×4 Matrix{Float64}:
  2.18425e-314  2.18425e-314  2.18425e-314  2.18425e-314
- 2.18425e-314  2.18425e-314  2.18425e-314  2.18425e-314

See also: undef, isassigned.

source

Basic functions

Base.ndimsFunction
ndims(A::AbstractArray) -> Integer

Return the number of dimensions of A.

See also: size, axes.

Examples

julia> A = fill(1, (3,4,5));
+ 2.18425e-314  2.18425e-314  2.18425e-314  2.18425e-314

See also: undef, isassigned.

source

Basic functions

Base.ndimsFunction
ndims(A::AbstractArray) -> Integer

Return the number of dimensions of A.

See also: size, axes.

Examples

julia> A = fill(1, (3,4,5));
 
 julia> ndims(A)
-3
source
Base.sizeFunction
size(A::AbstractArray, [dim])

Return a tuple containing the dimensions of A. Optionally you can specify a dimension to just get the length of that dimension.

Note that size may not be defined for arrays with non-standard indices, in which case axes may be useful. See the manual chapter on arrays with custom indices.

See also: length, ndims, eachindex, sizeof.

Examples

julia> A = fill(1, (2,3,4));
+3
source
Base.sizeFunction
size(A::AbstractArray, [dim])

Return a tuple containing the dimensions of A. Optionally you can specify a dimension to just get the length of that dimension.

Note that size may not be defined for arrays with non-standard indices, in which case axes may be useful. See the manual chapter on arrays with custom indices.

See also: length, ndims, eachindex, sizeof.

Examples

julia> A = fill(1, (2,3,4));
 
 julia> size(A)
 (2, 3, 4)
 
 julia> size(A, 2)
-3
source
Base.axesMethod
axes(A)

Return the tuple of valid indices for array A.

See also: size, keys, eachindex.

Examples

julia> A = fill(1, (5,6,7));
 
 julia> axes(A)
-(Base.OneTo(5), Base.OneTo(6), Base.OneTo(7))
source
Base.axesMethod
axes(A, d)

Return the valid range of indices for array A along dimension d.

See also size, and the manual chapter on arrays with custom indices.

Examples

julia> A = fill(1, (5,6,7));
+(Base.OneTo(5), Base.OneTo(6), Base.OneTo(7))
source
Base.axesMethod
axes(A, d)

Return the valid range of indices for array A along dimension d.

See also size, and the manual chapter on arrays with custom indices.

Examples

julia> A = fill(1, (5,6,7));
 
 julia> axes(A, 2)
 Base.OneTo(6)
@@ -249,18 +249,18 @@
 julia> axes(A, 4) == 1:1  # all dimensions d > ndims(A) have size 1
 true

Usage note

Each of the indices has to be an AbstractUnitRange{<:Integer}, but at the same time can be a type that uses custom indices. So, for example, if you need a subset, use generalized indexing constructs like begin/end or firstindex/lastindex:

ix = axes(v, 1)
 ix[2:end]          # will work for eg Vector, but may fail in general
-ix[(begin+1):end]  # works for generalized indexes
source
Base.lengthMethod
length(A::AbstractArray)

Return the number of elements in the array, defaults to prod(size(A)).

Examples

julia> length([1, 2, 3, 4])
+ix[(begin+1):end]  # works for generalized indexes
source
Base.lengthMethod
length(A::AbstractArray)

Return the number of elements in the array, defaults to prod(size(A)).

Examples

julia> length([1, 2, 3, 4])
 4
 
 julia> length([1 2; 3 4])
-4
source
Base.keysMethod
keys(a::AbstractArray)

Return an efficient array describing all valid indices for a arranged in the shape of a itself.

The keys of 1-dimensional arrays (vectors) are integers, whereas all other N-dimensional arrays use CartesianIndex to describe their locations. Often the special array types LinearIndices and CartesianIndices are used to efficiently represent these arrays of integers and CartesianIndexes, respectively.

Note that the keys of an array might not be the most efficient index type; for maximum performance use eachindex instead.

Examples

julia> keys([4, 5, 6])
+4
source
Base.keysMethod
keys(a::AbstractArray)

Return an efficient array describing all valid indices for a arranged in the shape of a itself.

The keys of 1-dimensional arrays (vectors) are integers, whereas all other N-dimensional arrays use CartesianIndex to describe their locations. Often the special array types LinearIndices and CartesianIndices are used to efficiently represent these arrays of integers and CartesianIndexes, respectively.

Note that the keys of an array might not be the most efficient index type; for maximum performance use eachindex instead.

Examples

julia> keys([4, 5, 6])
 3-element LinearIndices{1, Tuple{Base.OneTo{Int64}}}:
  1
  2
  3
 
 julia> keys([4 5; 6 7])
-CartesianIndices((2, 2))
source
Base.eachindexFunction
eachindex(A...)
 eachindex(::IndexStyle, A::AbstractArray...)

Create an iterable object for visiting each index of an AbstractArray A in an efficient manner. For array types that have opted into fast linear indexing (like Array), this is simply the range 1:length(A) if they use 1-based indexing. For array types that have not opted into fast linear indexing, a specialized Cartesian range is typically returned to efficiently index into the array with indices specified for every dimension.

In general eachindex accepts arbitrary iterables, including strings and dictionaries, and returns an iterator object supporting arbitrary index types (e.g. unevenly spaced or non-integer indices).

If A is AbstractArray it is possible to explicitly specify the style of the indices that should be returned by eachindex by passing a value having IndexStyle type as its first argument (typically IndexLinear() if linear indices are required or IndexCartesian() if Cartesian range is wanted).

If you supply more than one AbstractArray argument, eachindex will create an iterable object that is fast for all arguments (typically a UnitRange if all inputs have fast linear indexing, a CartesianIndices otherwise). If the arrays have different sizes and/or dimensionalities, a DimensionMismatch exception will be thrown.

See also pairs(A) to iterate over indices and values together, and axes(A, 2) for valid indices along one dimension.

Examples

julia> A = [10 20; 30 40];
 
 julia> for i in eachindex(A) # linear indexing
@@ -275,8 +275,8 @@
            println(i)
        end
 CartesianIndex(1, 1)
-CartesianIndex(2, 1)
source
Base.IndexStyleType
IndexStyle(A)
-IndexStyle(typeof(A))

IndexStyle specifies the "native indexing style" for array A. When you define a new AbstractArray type, you can choose to implement either linear indexing (with IndexLinear) or cartesian indexing. If you decide to only implement linear indexing, then you must set this trait for your array type:

Base.IndexStyle(::Type{<:MyArray}) = IndexLinear()

The default is IndexCartesian().

Julia's internal indexing machinery will automatically (and invisibly) recompute all indexing operations into the preferred style. This allows users to access elements of your array using any indexing style, even when explicit methods have not been provided.

If you define both styles of indexing for your AbstractArray, this trait can be used to select the most performant indexing style. Some methods check this trait on their inputs, and dispatch to different algorithms depending on the most efficient access pattern. In particular, eachindex creates an iterator whose type depends on the setting of this trait.

source
Base.IndexLinearType
IndexLinear()

Subtype of IndexStyle used to describe arrays which are optimally indexed by one linear index.

A linear indexing style uses one integer index to describe the position in the array (even if it's a multidimensional array) and column-major ordering is used to efficiently access the elements. This means that requesting eachindex from an array that is IndexLinear will return a simple one-dimensional range, even if it is multidimensional.

A custom array that reports its IndexStyle as IndexLinear only needs to implement indexing (and indexed assignment) with a single Int index; all other indexing expressions — including multidimensional accesses — will be recomputed to the linear index. For example, if A were a 2×3 custom matrix with linear indexing, and we referenced A[1, 3], this would be recomputed to the equivalent linear index and call A[5] since 1 + 2*(3 - 1) = 5.

See also IndexCartesian.

source
Base.IndexCartesianType
IndexCartesian()

Subtype of IndexStyle used to describe arrays which are optimally indexed by a Cartesian index. This is the default for new custom AbstractArray subtypes.

A Cartesian indexing style uses multiple integer indices to describe the position in a multidimensional array, with exactly one index per dimension. This means that requesting eachindex from an array that is IndexCartesian will return a range of CartesianIndices.

A N-dimensional custom array that reports its IndexStyle as IndexCartesian needs to implement indexing (and indexed assignment) with exactly N Int indices; all other indexing expressions — including linear indexing — will be recomputed to the equivalent Cartesian location. For example, if A were a 2×3 custom matrix with cartesian indexing, and we referenced A[5], this would be recomputed to the equivalent Cartesian index and call A[1, 3] since 5 = 1 + 2*(3 - 1).

It is significantly more expensive to compute Cartesian indices from a linear index than it is to go the other way. The former operation requires division — a very costly operation — whereas the latter only uses multiplication and addition and is essentially free. This asymmetry means it is far more costly to use linear indexing with an IndexCartesian array than it is to use Cartesian indexing with an IndexLinear array.

See also IndexLinear.

source
Base.conj!Function
conj!(A)

Transform an array to its complex conjugate in-place.

See also conj.

Examples

julia> A = [1+im 2-im; 2+2im 3+im]
+CartesianIndex(2, 1)
source
Base.IndexStyleType
IndexStyle(A)
+IndexStyle(typeof(A))

IndexStyle specifies the "native indexing style" for array A. When you define a new AbstractArray type, you can choose to implement either linear indexing (with IndexLinear) or cartesian indexing. If you decide to only implement linear indexing, then you must set this trait for your array type:

Base.IndexStyle(::Type{<:MyArray}) = IndexLinear()

The default is IndexCartesian().

Julia's internal indexing machinery will automatically (and invisibly) recompute all indexing operations into the preferred style. This allows users to access elements of your array using any indexing style, even when explicit methods have not been provided.

If you define both styles of indexing for your AbstractArray, this trait can be used to select the most performant indexing style. Some methods check this trait on their inputs, and dispatch to different algorithms depending on the most efficient access pattern. In particular, eachindex creates an iterator whose type depends on the setting of this trait.

source
Base.IndexLinearType
IndexLinear()

Subtype of IndexStyle used to describe arrays which are optimally indexed by one linear index.

A linear indexing style uses one integer index to describe the position in the array (even if it's a multidimensional array) and column-major ordering is used to efficiently access the elements. This means that requesting eachindex from an array that is IndexLinear will return a simple one-dimensional range, even if it is multidimensional.

A custom array that reports its IndexStyle as IndexLinear only needs to implement indexing (and indexed assignment) with a single Int index; all other indexing expressions — including multidimensional accesses — will be recomputed to the linear index. For example, if A were a 2×3 custom matrix with linear indexing, and we referenced A[1, 3], this would be recomputed to the equivalent linear index and call A[5] since 1 + 2*(3 - 1) = 5.

See also IndexCartesian.

source
Base.IndexCartesianType
IndexCartesian()

Subtype of IndexStyle used to describe arrays which are optimally indexed by a Cartesian index. This is the default for new custom AbstractArray subtypes.

A Cartesian indexing style uses multiple integer indices to describe the position in a multidimensional array, with exactly one index per dimension. This means that requesting eachindex from an array that is IndexCartesian will return a range of CartesianIndices.

A N-dimensional custom array that reports its IndexStyle as IndexCartesian needs to implement indexing (and indexed assignment) with exactly N Int indices; all other indexing expressions — including linear indexing — will be recomputed to the equivalent Cartesian location. For example, if A were a 2×3 custom matrix with cartesian indexing, and we referenced A[5], this would be recomputed to the equivalent Cartesian index and call A[1, 3] since 5 = 1 + 2*(3 - 1).

It is significantly more expensive to compute Cartesian indices from a linear index than it is to go the other way. The former operation requires division — a very costly operation — whereas the latter only uses multiplication and addition and is essentially free. This asymmetry means it is far more costly to use linear indexing with an IndexCartesian array than it is to use Cartesian indexing with an IndexLinear array.

See also IndexLinear.

source
Base.conj!Function
conj!(A)

Transform an array to its complex conjugate in-place.

See also conj.

Examples

julia> A = [1+im 2-im; 2+2im 3+im]
 2×2 Matrix{Complex{Int64}}:
  1+1im  2-1im
  2+2im  3+1im
@@ -286,16 +286,16 @@
 julia> A
 2×2 Matrix{Complex{Int64}}:
  1-1im  2+1im
- 2-2im  3-1im
source
Base.strideFunction
stride(A, k::Integer)

Return the distance in memory (in number of elements) between adjacent elements in dimension k.

See also: strides.

Examples

julia> A = fill(1, (3,4,5));
+ 2-2im  3-1im
source
Base.strideFunction
stride(A, k::Integer)

Return the distance in memory (in number of elements) between adjacent elements in dimension k.

See also: strides.

Examples

julia> A = fill(1, (3,4,5));
 
 julia> stride(A,2)
 3
 
 julia> stride(A,3)
-12
source
Base.stridesFunction
strides(A)

Return a tuple of the memory strides in each dimension.

See also: stride.

Examples

julia> A = fill(1, (3,4,5));
+12
source
Base.stridesFunction
strides(A)

Return a tuple of the memory strides in each dimension.

See also: stride.

Examples

julia> A = fill(1, (3,4,5));
 
 julia> strides(A)
-(1, 3, 12)
source

Broadcast and vectorization

See also the dot syntax for vectorizing functions; for example, f.(args...) implicitly calls broadcast(f, args...). Rather than relying on "vectorized" methods of functions like sin to operate on arrays, you should use sin.(a) to vectorize via broadcast.

Base.Broadcast.broadcastFunction
broadcast(f, As...)

Broadcast the function f over the arrays, tuples, collections, Refs and/or scalars As.

Broadcasting applies the function f over the elements of the container arguments and the scalars themselves in As. Singleton and missing dimensions are expanded to match the extents of the other arguments by virtually repeating the value. By default, only a limited number of types are considered scalars, including Numbers, Strings, Symbols, Types, Functions and some common singletons like missing and nothing. All other arguments are iterated over or indexed into elementwise.

The resulting container type is established by the following rules:

  • If all the arguments are scalars or zero-dimensional arrays, it returns an unwrapped scalar.
  • If at least one argument is a tuple and all others are scalars or zero-dimensional arrays, it returns a tuple.
  • All other combinations of arguments default to returning an Array, but custom container types can define their own implementation and promotion-like rules to customize the result when they appear as arguments.
  • The element type is determined in the same manner as in collect.

A special syntax exists for broadcasting: f.(args...) is equivalent to broadcast(f, args...), and nested f.(g.(args...)) calls are fused into a single broadcast loop.

Examples

julia> A = [1, 2, 3, 4, 5]
+(1, 3, 12)
source

Broadcast and vectorization

See also the dot syntax for vectorizing functions; for example, f.(args...) implicitly calls broadcast(f, args...). Rather than relying on "vectorized" methods of functions like sin to operate on arrays, you should use sin.(a) to vectorize via broadcast.

Base.Broadcast.broadcastFunction
broadcast(f, As...)

Broadcast the function f over the arrays, tuples, collections, Refs and/or scalars As.

Broadcasting applies the function f over the elements of the container arguments and the scalars themselves in As. Singleton and missing dimensions are expanded to match the extents of the other arguments by virtually repeating the value. By default, only a limited number of types are considered scalars, including Numbers, Strings, Symbols, Types, Functions and some common singletons like missing and nothing. All other arguments are iterated over or indexed into elementwise.

The resulting container type is established by the following rules:

  • If all the arguments are scalars or zero-dimensional arrays, it returns an unwrapped scalar.
  • If at least one argument is a tuple and all others are scalars or zero-dimensional arrays, it returns a tuple.
  • All other combinations of arguments default to returning an Array, but custom container types can define their own implementation and promotion-like rules to customize the result when they appear as arguments.
  • The element type is determined in the same manner as in collect.

A special syntax exists for broadcasting: f.(args...) is equivalent to broadcast(f, args...), and nested f.(g.(args...)) calls are fused into a single broadcast loop.

Examples

julia> A = [1, 2, 3, 4, 5]
 5-element Vector{Int64}:
  1
  2
@@ -341,7 +341,7 @@
  "two: 2"
  "three: 3"
  "four: 4"
-
source
Base.Broadcast.broadcast!Function
broadcast!(f, dest, As...)

Like broadcast, but store the result of broadcast(f, As...) in the dest array. Note that dest is only used to store the result, and does not supply arguments to f unless it is also listed in the As, as in broadcast!(f, A, A, B) to perform A[:] = broadcast(f, A, B).

Examples

julia> A = [1.0; 0.0]; B = [0.0; 0.0];
+
source
Base.Broadcast.broadcast!Function
broadcast!(f, dest, As...)

Like broadcast, but store the result of broadcast(f, As...) in the dest array. Note that dest is only used to store the result, and does not supply arguments to f unless it is also listed in the As, as in broadcast!(f, A, A, B) to perform A[:] = broadcast(f, A, B).

Examples

julia> A = [1.0; 0.0]; B = [0.0; 0.0];
 
 julia> broadcast!(+, B, A, (0, -2.0));
 
@@ -360,13 +360,13 @@
 julia> A
 2-element Vector{Float64}:
   1.0
- -2.0
source
Base.Broadcast.@__dot__Macro
@. expr

Convert every function call or operator in expr into a "dot call" (e.g. convert f(x) to f.(x)), and convert every assignment in expr to a "dot assignment" (e.g. convert += to .+=).

If you want to avoid adding dots for selected function calls in expr, splice those function calls in with $. For example, @. sqrt(abs($sort(x))) is equivalent to sqrt.(abs.(sort(x))) (no dot for sort).

(@. is equivalent to a call to @__dot__.)

Examples

julia> x = 1.0:3.0; y = similar(x);
+ -2.0
source
Base.Broadcast.@__dot__Macro
@. expr

Convert every function call or operator in expr into a "dot call" (e.g. convert f(x) to f.(x)), and convert every assignment in expr to a "dot assignment" (e.g. convert += to .+=).

If you want to avoid adding dots for selected function calls in expr, splice those function calls in with $. For example, @. sqrt(abs($sort(x))) is equivalent to sqrt.(abs.(sort(x))) (no dot for sort).

(@. is equivalent to a call to @__dot__.)

Examples

julia> x = 1.0:3.0; y = similar(x);
 
 julia> @. y = x + 3 * sin(x)
 3-element Vector{Float64}:
  3.5244129544236893
  4.727892280477045
- 3.4233600241796016
source
Base.Broadcast.BroadcastFunctionType
BroadcastFunction{F} <: Function

Represents the "dotted" version of an operator, which broadcasts the operator over its arguments, so BroadcastFunction(op) is functionally equivalent to (x...) -> (op).(x...).

Can be created by just passing an operator preceded by a dot to a higher-order function.

Examples

julia> a = [[1 3; 2 4], [5 7; 6 8]];
+ 3.4233600241796016
source
Base.Broadcast.BroadcastFunctionType
BroadcastFunction{F} <: Function

Represents the "dotted" version of an operator, which broadcasts the operator over its arguments, so BroadcastFunction(op) is functionally equivalent to (x...) -> (op).(x...).

Can be created by just passing an operator preceded by a dot to a higher-order function.

Examples

julia> a = [[1 3; 2 4], [5 7; 6 8]];
 
 julia> b = [[9 11; 10 12], [13 15; 14 16]];
 
@@ -376,11 +376,11 @@
  [65 105; 84 128]
 
 julia> Base.BroadcastFunction(+)(a, b) == a .+ b
-true
Julia 1.6

BroadcastFunction and the standalone .op syntax are available as of Julia 1.6.

source

For specializing broadcast on custom types, see

Base.Broadcast.BroadcastStyleType

BroadcastStyle is an abstract type and trait-function used to determine behavior of objects under broadcasting. BroadcastStyle(typeof(x)) returns the style associated with x. To customize the broadcasting behavior of a type, one can declare a style by defining a type/method pair

struct MyContainerStyle <: BroadcastStyle end
-Base.BroadcastStyle(::Type{<:MyContainer}) = MyContainerStyle()

One then writes method(s) (at least similar) operating on Broadcasted{MyContainerStyle}. There are also several pre-defined subtypes of BroadcastStyle that you may be able to leverage; see the Interfaces chapter for more information.

source
Base.Broadcast.AbstractArrayStyleType

Broadcast.AbstractArrayStyle{N} <: BroadcastStyle is the abstract supertype for any style associated with an AbstractArray type. The N parameter is the dimensionality, which can be handy for AbstractArray types that only support specific dimensionalities:

struct SparseMatrixStyle <: Broadcast.AbstractArrayStyle{2} end
+true
Julia 1.6

BroadcastFunction and the standalone .op syntax are available as of Julia 1.6.

source

For specializing broadcast on custom types, see

Base.Broadcast.BroadcastStyleType

BroadcastStyle is an abstract type and trait-function used to determine behavior of objects under broadcasting. BroadcastStyle(typeof(x)) returns the style associated with x. To customize the broadcasting behavior of a type, one can declare a style by defining a type/method pair

struct MyContainerStyle <: BroadcastStyle end
+Base.BroadcastStyle(::Type{<:MyContainer}) = MyContainerStyle()

One then writes method(s) (at least similar) operating on Broadcasted{MyContainerStyle}. There are also several pre-defined subtypes of BroadcastStyle that you may be able to leverage; see the Interfaces chapter for more information.

source
Base.Broadcast.AbstractArrayStyleType

Broadcast.AbstractArrayStyle{N} <: BroadcastStyle is the abstract supertype for any style associated with an AbstractArray type. The N parameter is the dimensionality, which can be handy for AbstractArray types that only support specific dimensionalities:

struct SparseMatrixStyle <: Broadcast.AbstractArrayStyle{2} end
 Base.BroadcastStyle(::Type{<:SparseMatrixCSC}) = SparseMatrixStyle()

For AbstractArray types that support arbitrary dimensionality, N can be set to Any:

struct MyArrayStyle <: Broadcast.AbstractArrayStyle{Any} end
 Base.BroadcastStyle(::Type{<:MyArray}) = MyArrayStyle()

In cases where you want to be able to mix multiple AbstractArrayStyles and keep track of dimensionality, your style needs to support a Val constructor:

struct MyArrayStyleDim{N} <: Broadcast.AbstractArrayStyle{N} end
-(::Type{<:MyArrayStyleDim})(::Val{N}) where N = MyArrayStyleDim{N}()

Note that if two or more AbstractArrayStyle subtypes conflict, broadcasting machinery will fall back to producing Arrays. If this is undesirable, you may need to define binary BroadcastStyle rules to control the output type.

See also Broadcast.DefaultArrayStyle.

source
Base.Broadcast.DefaultArrayStyleType

Broadcast.DefaultArrayStyle{N}() is a BroadcastStyle indicating that an object behaves as an N-dimensional array for broadcasting. Specifically, DefaultArrayStyle is used for any AbstractArray type that hasn't defined a specialized style, and in the absence of overrides from other broadcast arguments the resulting output type is Array. When there are multiple inputs to broadcast, DefaultArrayStyle "loses" to any other Broadcast.ArrayStyle.

source
Base.Broadcast.broadcastableFunction
Broadcast.broadcastable(x)

Return either x or an object like x such that it supports axes, indexing, and its type supports ndims.

If x supports iteration, the returned value should have the same axes and indexing behaviors as collect(x).

If x is not an AbstractArray but it supports axes, indexing, and its type supports ndims, then broadcastable(::typeof(x)) may be implemented to just return itself. Further, if x defines its own BroadcastStyle, then it must define its broadcastable method to return itself for the custom style to have any effect.

Examples

julia> Broadcast.broadcastable([1,2,3]) # like `identity` since arrays already support axes and indexing
+(::Type{<:MyArrayStyleDim})(::Val{N}) where N = MyArrayStyleDim{N}()

Note that if two or more AbstractArrayStyle subtypes conflict, broadcasting machinery will fall back to producing Arrays. If this is undesirable, you may need to define binary BroadcastStyle rules to control the output type.

See also Broadcast.DefaultArrayStyle.

source
Base.Broadcast.DefaultArrayStyleType

Broadcast.DefaultArrayStyle{N}() is a BroadcastStyle indicating that an object behaves as an N-dimensional array for broadcasting. Specifically, DefaultArrayStyle is used for any AbstractArray type that hasn't defined a specialized style, and in the absence of overrides from other broadcast arguments the resulting output type is Array. When there are multiple inputs to broadcast, DefaultArrayStyle "loses" to any other Broadcast.ArrayStyle.

source
Base.Broadcast.broadcastableFunction
Broadcast.broadcastable(x)

Return either x or an object like x such that it supports axes, indexing, and its type supports ndims.

If x supports iteration, the returned value should have the same axes and indexing behaviors as collect(x).

If x is not an AbstractArray but it supports axes, indexing, and its type supports ndims, then broadcastable(::typeof(x)) may be implemented to just return itself. Further, if x defines its own BroadcastStyle, then it must define its broadcastable method to return itself for the custom style to have any effect.

Examples

julia> Broadcast.broadcastable([1,2,3]) # like `identity` since arrays already support axes and indexing
 3-element Vector{Int64}:
  1
  2
@@ -390,16 +390,16 @@
 Base.RefValue{Type{Int64}}(Int64)
 
 julia> Broadcast.broadcastable("hello") # Strings break convention of matching iteration and act like a scalar instead
-Base.RefValue{String}("hello")
source
Base.Broadcast.combine_axesFunction
combine_axes(As...) -> Tuple

Determine the result axes for broadcasting across all values in As.

julia> Broadcast.combine_axes([1], [1 2; 3 4; 5 6])
+Base.RefValue{String}("hello")
source
Base.Broadcast.combine_axesFunction
combine_axes(As...) -> Tuple

Determine the result axes for broadcasting across all values in As.

julia> Broadcast.combine_axes([1], [1 2; 3 4; 5 6])
 (Base.OneTo(3), Base.OneTo(2))
 
 julia> Broadcast.combine_axes(1, 1, 1)
-()
source
Base.Broadcast.combine_stylesFunction
combine_styles(cs...) -> BroadcastStyle

Decides which BroadcastStyle to use for any number of value arguments. Uses BroadcastStyle to get the style for each argument, and uses result_style to combine styles.

Examples

julia> Broadcast.combine_styles([1], [1 2; 3 4])
-Base.Broadcast.DefaultArrayStyle{2}()
source
Base.Broadcast.result_styleFunction
result_style(s1::BroadcastStyle[, s2::BroadcastStyle]) -> BroadcastStyle

Takes one or two BroadcastStyles and combines them using BroadcastStyle to determine a common BroadcastStyle.

Examples

julia> Broadcast.result_style(Broadcast.DefaultArrayStyle{0}(), Broadcast.DefaultArrayStyle{3}())
+()
source
Base.Broadcast.combine_stylesFunction
combine_styles(cs...) -> BroadcastStyle

Decides which BroadcastStyle to use for any number of value arguments. Uses BroadcastStyle to get the style for each argument, and uses result_style to combine styles.

Examples

julia> Broadcast.combine_styles([1], [1 2; 3 4])
+Base.Broadcast.DefaultArrayStyle{2}()
source
Base.Broadcast.result_styleFunction
result_style(s1::BroadcastStyle[, s2::BroadcastStyle]) -> BroadcastStyle

Takes one or two BroadcastStyles and combines them using BroadcastStyle to determine a common BroadcastStyle.

Examples

julia> Broadcast.result_style(Broadcast.DefaultArrayStyle{0}(), Broadcast.DefaultArrayStyle{3}())
 Base.Broadcast.DefaultArrayStyle{3}()
 
 julia> Broadcast.result_style(Broadcast.Unknown(), Broadcast.DefaultArrayStyle{1}())
-Base.Broadcast.DefaultArrayStyle{1}()
source

Indexing and assignment

Base.getindexMethod
getindex(A, inds...)

Return a subset of array A as selected by the indices inds.

Each index may be any supported index type, such as an Integer, CartesianIndex, range, or array of supported indices. A : may be used to select all elements along a specific dimension, and a boolean array (e.g. an Array{Bool} or a BitArray) may be used to filter for elements where the corresponding index is true.

When inds selects multiple elements, this function returns a newly allocated array. To index multiple elements without making a copy, use view instead.

See the manual section on array indexing for details.

Examples

julia> A = [1 2; 3 4]
+Base.Broadcast.DefaultArrayStyle{1}()
source

Indexing and assignment

Base.getindexMethod
getindex(A, inds...)

Return a subset of array A as selected by the indices inds.

Each index may be any supported index type, such as an Integer, CartesianIndex, range, or array of supported indices. A : may be used to select all elements along a specific dimension, and a boolean array (e.g. an Array{Bool} or a BitArray) may be used to filter for elements where the corresponding index is true.

When inds selects multiple elements, this function returns a newly allocated array. To index multiple elements without making a copy, use view instead.

See the manual section on array indexing for details.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -437,7 +437,7 @@
 julia> getindex(A, A .> 2)
 2-element Vector{Int64}:
  3
- 4
source
Base.setindex!Method
setindex!(A, X, inds...)
 A[inds...] = X

Store values from array X within some subset of A as specified by inds. The syntax A[inds...] = X is equivalent to (setindex!(A, X, inds...); X).

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = zeros(2,2);
 
 julia> setindex!(A, [10, 20], [1, 2]);
@@ -447,7 +447,7 @@
 julia> A
 2×2 Matrix{Float64}:
  10.0  30.0
- 20.0  40.0
source
Base.nextindFunction
nextind(A, i)

Return the index after i in A. The returned index is often equivalent to i + 1 for an integer i. This function can be useful for generic code.

Warning

The returned index might be out of bounds. Consider using checkbounds.

See also: prevind.

Examples

julia> x = [1 2; 3 4]
+ 20.0  40.0
source
Base.nextindFunction
nextind(A, i)

Return the index after i in A. The returned index is often equivalent to i + 1 for an integer i. This function can be useful for generic code.

Warning

The returned index might be out of bounds. Consider using checkbounds.

See also: prevind.

Examples

julia> x = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -462,7 +462,7 @@
 CartesianIndex(2, 1)
 
 julia> nextind(x, CartesianIndex(2, 2)) # invalid result
-CartesianIndex(1, 3)
source
Base.previndFunction
prevind(A, i)

Return the index before i in A. The returned index is often equivalent to i - 1 for an integer i. This function can be useful for generic code.

Warning

The returned index might be out of bounds. Consider using checkbounds.

See also: nextind.

Examples

julia> x = [1 2; 3 4]
+CartesianIndex(1, 3)
source
Base.previndFunction
prevind(A, i)

Return the index before i in A. The returned index is often equivalent to i - 1 for an integer i. This function can be useful for generic code.

Warning

The returned index might be out of bounds. Consider using checkbounds.

See also: nextind.

Examples

julia> x = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -477,7 +477,7 @@
 CartesianIndex(1, 2)
 
 julia> prevind(x, CartesianIndex(1, 1)) # invalid result
-CartesianIndex(2, 0)
source
Base.copyto!Method
copyto!(dest, Rdest::CartesianIndices, src, Rsrc::CartesianIndices) -> dest

Copy the block of src in the range of Rsrc to the block of dest in the range of Rdest. The sizes of the two regions must match.

Examples

julia> A = zeros(5, 5);
+CartesianIndex(2, 0)
source
Base.copyto!Method
copyto!(dest, Rdest::CartesianIndices, src, Rsrc::CartesianIndices) -> dest

Copy the block of src in the range of Rsrc to the block of dest in the range of Rdest. The sizes of the two regions must match.

Examples

julia> A = zeros(5, 5);
 
 julia> B = [1 2; 3 4];
 
@@ -491,7 +491,7 @@
  0.0  1.0  2.0  0.0  0.0
  0.0  3.0  4.0  0.0  0.0
  0.0  0.0  0.0  0.0  0.0
- 0.0  0.0  0.0  0.0  0.0
source
Base.copy!Function
copy!(dest::AbstractMatrix, src::UniformScaling)

Copies a UniformScaling onto a matrix.

Julia 1.12

This method is available as of Julia 1.12.

copy!(dst, src) -> dst

In-place copy of src into dst, discarding any pre-existing elements in dst. If dst and src are of the same type, dst == src should hold after the call. If dst and src are vector types, they must have equal offset. If dst and src are multidimensional arrays, they must have equal axes.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also copyto!.

Note

When operating on vector types, if dst and src are not of the same length, dst is resized to length(src) prior to the copy.

Julia 1.1

This method requires at least Julia 1.1. In Julia 1.0 this method is available from the Future standard library as Future.copy!.

source
Base.isassignedFunction
isassigned(array, i) -> Bool

Test whether the given array has a value associated with index i. Return false if the index is out of bounds, or has an undefined reference.

Examples

julia> isassigned(rand(3, 3), 5)
+ 0.0  0.0  0.0  0.0  0.0
source
Base.copy!Function
copy!(dest::AbstractMatrix, src::UniformScaling)

Copies a UniformScaling onto a matrix.

Julia 1.12

This method is available as of Julia 1.12.

copy!(dst, src) -> dst

In-place copy of src into dst, discarding any pre-existing elements in dst. If dst and src are of the same type, dst == src should hold after the call. If dst and src are vector types, they must have equal offset. If dst and src are multidimensional arrays, they must have equal axes.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also copyto!.

Note

When operating on vector types, if dst and src are not of the same length, dst is resized to length(src) prior to the copy.

Julia 1.1

This method requires at least Julia 1.1. In Julia 1.0 this method is available from the Future standard library as Future.copy!.

source
Base.isassignedFunction
isassigned(array, i) -> Bool

Test whether the given array has a value associated with index i. Return false if the index is out of bounds, or has an undefined reference.

Examples

julia> isassigned(rand(3, 3), 5)
 true
 
 julia> isassigned(rand(3, 3), 3 * 3 + 1)
@@ -506,7 +506,7 @@
  #undef
 
 julia> isassigned(v, 1)
-false
source
Base.ColonType
Colon()

Colons (:) are used to signify indexing entire objects or dimensions at once.

Very few operations are defined on Colons directly; instead they are converted by to_indices to an internal vector type (Base.Slice) to represent the collection of indices they span before being used.

The singleton instance of Colon is also a function used to construct ranges; see :.

source
Base.ColonType
Colon()

Colons (:) are used to signify indexing entire objects or dimensions at once.

Very few operations are defined on Colons directly; instead they are converted by to_indices to an internal vector type (Base.Slice) to represent the collection of indices they span before being used.

The singleton instance of Colon is also a function used to construct ranges; see :.

source
Base.IteratorsMD.CartesianIndexType
CartesianIndex(i, j, k...)   -> I
 CartesianIndex((i, j, k...)) -> I

Create a multidimensional index I, which can be used for indexing a multidimensional array A. In particular, A[I] is equivalent to A[i,j,k...]. One can freely mix integer and CartesianIndex indices; for example, A[Ipre, i, Ipost] (where Ipre and Ipost are CartesianIndex indices and i is an Int) can be a useful expression when writing algorithms that work along a single dimension of an array of arbitrary dimensionality.

A CartesianIndex is sometimes produced by eachindex, and always when iterating with an explicit CartesianIndices.

An I::CartesianIndex is treated as a "scalar" (not a container) for broadcast. In order to iterate over the components of a CartesianIndex, convert it to a tuple with Tuple(I).

Examples

julia> A = reshape(Vector(1:16), (2, 2, 2, 2))
 2×2×2×2 Array{Int64, 4}:
 [:, :, 1, 1] =
@@ -532,7 +532,7 @@
 9
 
 julia> A[CartesianIndex((1, 1, 2, 1))]
-5
Julia 1.10

Using a CartesianIndex as a "scalar" for broadcast requires Julia 1.10; in previous releases, use Ref(I).

source
Base.IteratorsMD.CartesianIndicesType
CartesianIndices(sz::Dims) -> R
+5
Julia 1.10

Using a CartesianIndex as a "scalar" for broadcast requires Julia 1.10; in previous releases, use Ref(I).

source
Base.IteratorsMD.CartesianIndicesType
CartesianIndices(sz::Dims) -> R
 CartesianIndices((istart:[istep:]istop, jstart:[jstep:]jstop, ...)) -> R

Define a region R spanning a multidimensional rectangular range of integer indices. These are most commonly encountered in the context of iteration, where for I in R ... end will return CartesianIndex indices I equivalent to the nested loops

for j = jstart:jstep:jstop
     for i = istart:istep:istop
         ...
@@ -565,7 +565,7 @@
 CartesianIndex(3, 4)
 
 julia> CIs .+ CI
-CartesianIndices((5:6, 9:10))

For cartesian to linear index conversion, see LinearIndices.

source
Base.LinearIndicesType
LinearIndices(A::AbstractArray)

Return a LinearIndices array with the same shape and axes as A, holding the linear index of each entry in A. Indexing this array with cartesian indices allows mapping them to linear indices.

For arrays with conventional indexing (indices start at 1), or any multidimensional array, linear indices range from 1 to length(A). However, for AbstractVectors linear indices are axes(A, 1), and therefore do not start at 1 for vectors with unconventional indexing.

Calling this function is the "safe" way to write algorithms that exploit linear indexing.

Examples

julia> A = fill(1, (5,6,7));
+CartesianIndices((5:6, 9:10))

For cartesian to linear index conversion, see LinearIndices.

source
Base.LinearIndicesType
LinearIndices(A::AbstractArray)

Return a LinearIndices array with the same shape and axes as A, holding the linear index of each entry in A. Indexing this array with cartesian indices allows mapping them to linear indices.

For arrays with conventional indexing (indices start at 1), or any multidimensional array, linear indices range from 1 to length(A). However, for AbstractVectors linear indices are axes(A, 1), and therefore do not start at 1 for vectors with unconventional indexing.

Calling this function is the "safe" way to write algorithms that exploit linear indexing.

Examples

julia> A = fill(1, (5,6,7));
 
 julia> b = LinearIndices(A);
 
@@ -579,7 +579,7 @@
  3  6
 
 julia> linear[1,2]
-4
source
Base.to_indicesFunction
to_indices(A, I::Tuple)

Convert the tuple I to a tuple of indices for use in indexing into array A.

The returned tuple must only contain either Ints or AbstractArrays of scalar indices that are supported by array A. It will error upon encountering a novel index type that it does not know how to process.

For simple index types, it defers to the unexported Base.to_index(A, i) to process each index i. While this internal function is not intended to be called directly, Base.to_index may be extended by custom array or index types to provide custom indexing behaviors.

More complicated index types may require more context about the dimension into which they index. To support those cases, to_indices(A, I) calls to_indices(A, axes(A), I), which then recursively walks through both the given tuple of indices and the dimensional indices of A in tandem. As such, not all index types are guaranteed to propagate to Base.to_index.

Examples

julia> A = zeros(1,2,3,4);
+4
source
Base.to_indicesFunction
to_indices(A, I::Tuple)

Convert the tuple I to a tuple of indices for use in indexing into array A.

The returned tuple must only contain either Ints or AbstractArrays of scalar indices that are supported by array A. It will error upon encountering a novel index type that it does not know how to process.

For simple index types, it defers to the unexported Base.to_index(A, i) to process each index i. While this internal function is not intended to be called directly, Base.to_index may be extended by custom array or index types to provide custom indexing behaviors.

More complicated index types may require more context about the dimension into which they index. To support those cases, to_indices(A, I) calls to_indices(A, axes(A), I), which then recursively walks through both the given tuple of indices and the dimensional indices of A in tandem. As such, not all index types are guaranteed to propagate to Base.to_index.

Examples

julia> A = zeros(1,2,3,4);
 
 julia> to_indices(A, (1,1,2,2))
 (1, 1, 2, 2)
@@ -594,7 +594,7 @@
 ([1, 1], 1:2, 3, 4)
 
 julia> to_indices(A, (1,2)) # no shape checking
-(1, 2)
source
Base.checkboundsFunction
checkbounds(A, I...)

Throw an error if the specified indices I are not in bounds for the given array A.

source
checkbounds(Bool, A, I...)

Return true if the specified indices I are in bounds for the given array A. Subtypes of AbstractArray should specialize this method if they need to provide custom bounds checking behaviors; however, in many cases one can rely on A's indices and checkindex.

See also checkindex.

Examples

julia> A = rand(3, 3);
+(1, 2)
source
Base.checkboundsFunction
checkbounds(A, I...)

Throw an error if the specified indices I are not in bounds for the given array A.

source
checkbounds(Bool, A, I...)

Return true if the specified indices I are in bounds for the given array A. Subtypes of AbstractArray should specialize this method if they need to provide custom bounds checking behaviors; however, in many cases one can rely on A's indices and checkindex.

See also checkindex.

Examples

julia> A = rand(3, 3);
 
 julia> checkbounds(Bool, A, 2)
 true
@@ -606,14 +606,14 @@
 true
 
 julia> checkbounds(Bool, A, 1:3, 2:4)
-false
source
Base.checkindexFunction
checkindex(Bool, inds::AbstractUnitRange, index)

Return true if the given index is within the bounds of inds. Custom types that would like to behave as indices for all arrays can extend this method in order to provide a specialized bounds checking implementation.

See also checkbounds.

Examples

julia> checkindex(Bool, 1:20, 8)
+false
source
Base.checkindexFunction
checkindex(Bool, inds::AbstractUnitRange, index)

Return true if the given index is within the bounds of inds. Custom types that would like to behave as indices for all arrays can extend this method in order to provide a specialized bounds checking implementation.

See also checkbounds.

Examples

julia> checkindex(Bool, 1:20, 8)
 true
 
 julia> checkindex(Bool, 1:20, 21)
-false
source
Base.elsizeFunction
elsize(type)

Compute the memory stride in bytes between consecutive elements of eltype stored inside the given type, if the array elements are stored densely with a uniform linear stride.

Examples

julia> Base.elsize(rand(Float32, 10))
-4
source

While most code can be written in an index-agnostic manner (see, e.g., eachindex), it can sometimes be useful to explicitly check for offset axes:

Base.require_one_based_indexingFunction
require_one_based_indexing(A::AbstractArray)
-require_one_based_indexing(A,B...)

Throw an ArgumentError if the indices of any argument start with something other than 1 along any axis. See also has_offset_axes.

Julia 1.2

This function requires at least Julia 1.2.

source
Base.has_offset_axesFunction
has_offset_axes(A)
-has_offset_axes(A, B, ...)

Return true if the indices of A start with something other than 1 along any axis. If multiple arguments are passed, equivalent to has_offset_axes(A) || has_offset_axes(B) || ....

See also require_one_based_indexing.

source

Views (SubArrays and other view types)

A “view” is a data structure that acts like an array (it is a subtype of AbstractArray), but the underlying data is actually part of another array.

For example, if x is an array and v = @view x[1:10], then v acts like a 10-element array, but its data is actually accessing the first 10 elements of x. Writing to a view, e.g. v[3] = 2, writes directly to the underlying array x (in this case modifying x[3]).

Slicing operations like x[1:10] create a copy by default in Julia. @view x[1:10] changes it to make a view. The @views macro can be used on a whole block of code (e.g. @views function foo() .... end or @views begin ... end) to change all the slicing operations in that block to use views. Sometimes making a copy of the data is faster and sometimes using a view is faster, as described in the performance tips.

Base.viewFunction
view(A, inds...)

Like getindex, but returns a lightweight array that lazily references (or is effectively a view into) the parent array A at the given index or indices inds instead of eagerly extracting elements or constructing a copied subset. Calling getindex or setindex! on the returned value (often a SubArray) computes the indices to access or modify the parent array on the fly. The behavior is undefined if the shape of the parent array is changed after view is called because there is no bound check for the parent array; e.g., it may cause a segmentation fault.

Some immutable parent arrays (like ranges) may choose to simply recompute a new array in some circumstances instead of returning a SubArray if doing so is efficient and provides compatible semantics.

Julia 1.6

In Julia 1.6 or later, view can be called on an AbstractString, returning a SubString.

Examples

julia> A = [1 2; 3 4]
+false
source
Base.elsizeFunction
elsize(type)

Compute the memory stride in bytes between consecutive elements of eltype stored inside the given type, if the array elements are stored densely with a uniform linear stride.

Examples

julia> Base.elsize(rand(Float32, 10))
+4
source

While most code can be written in an index-agnostic manner (see, e.g., eachindex), it can sometimes be useful to explicitly check for offset axes:

Base.require_one_based_indexingFunction
require_one_based_indexing(A::AbstractArray)
+require_one_based_indexing(A,B...)

Throw an ArgumentError if the indices of any argument start with something other than 1 along any axis. See also has_offset_axes.

Julia 1.2

This function requires at least Julia 1.2.

source
Base.has_offset_axesFunction
has_offset_axes(A)
+has_offset_axes(A, B, ...)

Return true if the indices of A start with something other than 1 along any axis. If multiple arguments are passed, equivalent to has_offset_axes(A) || has_offset_axes(B) || ....

See also require_one_based_indexing.

source

Views (SubArrays and other view types)

A “view” is a data structure that acts like an array (it is a subtype of AbstractArray), but the underlying data is actually part of another array.

For example, if x is an array and v = @view x[1:10], then v acts like a 10-element array, but its data is actually accessing the first 10 elements of x. Writing to a view, e.g. v[3] = 2, writes directly to the underlying array x (in this case modifying x[3]).

Slicing operations like x[1:10] create a copy by default in Julia. @view x[1:10] changes it to make a view. The @views macro can be used on a whole block of code (e.g. @views function foo() .... end or @views begin ... end) to change all the slicing operations in that block to use views. Sometimes making a copy of the data is faster and sometimes using a view is faster, as described in the performance tips.

Base.viewFunction
view(A, inds...)

Like getindex, but returns a lightweight array that lazily references (or is effectively a view into) the parent array A at the given index or indices inds instead of eagerly extracting elements or constructing a copied subset. Calling getindex or setindex! on the returned value (often a SubArray) computes the indices to access or modify the parent array on the fly. The behavior is undefined if the shape of the parent array is changed after view is called because there is no bound check for the parent array; e.g., it may cause a segmentation fault.

Some immutable parent arrays (like ranges) may choose to simply recompute a new array in some circumstances instead of returning a SubArray if doing so is efficient and provides compatible semantics.

Julia 1.6

In Julia 1.6 or later, view can be called on an AbstractString, returning a SubString.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -634,7 +634,7 @@
  0  4
 
 julia> view(2:5, 2:3) # returns a range as type is immutable
-3:4
source
Base.@viewMacro
@view A[inds...]

Transform the indexing expression A[inds...] into the equivalent view call.

This can only be applied directly to a single indexing expression and is particularly helpful for expressions that include the special begin or end indexing syntaxes like A[begin, 2:end-1] (as those are not supported by the normal view function).

Note that @view cannot be used as the target of a regular assignment (e.g., @view(A[1, 2:end]) = ...), nor would the un-decorated indexed assignment (A[1, 2:end] = ...) or broadcasted indexed assignment (A[1, 2:end] .= ...) make a copy. It can be useful, however, for updating broadcasted assignments like @view(A[1, 2:end]) .+= 1 because this is a simple syntax for @view(A[1, 2:end]) .= @view(A[1, 2:end]) + 1, and the indexing expression on the right-hand side would otherwise make a copy without the @view.

See also @views to switch an entire block of code to use views for non-scalar indexing.

Julia 1.5

Using begin in an indexing expression to refer to the first index requires at least Julia 1.5.

Examples

julia> A = [1 2; 3 4]
+3:4
source
Base.@viewMacro
@view A[inds...]

Transform the indexing expression A[inds...] into the equivalent view call.

This can only be applied directly to a single indexing expression and is particularly helpful for expressions that include the special begin or end indexing syntaxes like A[begin, 2:end-1] (as those are not supported by the normal view function).

Note that @view cannot be used as the target of a regular assignment (e.g., @view(A[1, 2:end]) = ...), nor would the un-decorated indexed assignment (A[1, 2:end] = ...) or broadcasted indexed assignment (A[1, 2:end] .= ...) make a copy. It can be useful, however, for updating broadcasted assignments like @view(A[1, 2:end]) .+= 1 because this is a simple syntax for @view(A[1, 2:end]) .= @view(A[1, 2:end]) + 1, and the indexing expression on the right-hand side would otherwise make a copy without the @view.

See also @views to switch an entire block of code to use views for non-scalar indexing.

Julia 1.5

Using begin in an indexing expression to refer to the first index requires at least Julia 1.5.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -652,7 +652,7 @@
 julia> A
 2×2 Matrix{Int64}:
  0  2
- 0  4
source
Base.@viewsMacro
@views expression

Convert every array-slicing operation in the given expression (which may be a begin/end block, loop, function, etc.) to return a view. Scalar indices, non-array types, and explicit getindex calls (as opposed to array[...]) are unaffected.

Similarly, @views converts string slices into SubString views.

Note

The @views macro only affects array[...] expressions that appear explicitly in the given expression, not array slicing that occurs in functions called by that code.

Julia 1.5

Using begin in an indexing expression to refer to the first index was implemented in Julia 1.4, but was only supported by @views starting in Julia 1.5.

Examples

julia> A = zeros(3, 3);
+ 0  4
source
Base.@viewsMacro
@views expression

Convert every array-slicing operation in the given expression (which may be a begin/end block, loop, function, etc.) to return a view. Scalar indices, non-array types, and explicit getindex calls (as opposed to array[...]) are unaffected.

Similarly, @views converts string slices into SubString views.

Note

The @views macro only affects array[...] expressions that appear explicitly in the given expression, not array slicing that occurs in functions called by that code.

Julia 1.5

Using begin in an indexing expression to refer to the first index was implemented in Julia 1.4, but was only supported by @views starting in Julia 1.5.

Examples

julia> A = zeros(3, 3);
 
 julia> @views for row in 1:3
            b = A[row, :] # b is a view, not a copy
@@ -663,7 +663,7 @@
 3×3 Matrix{Float64}:
  1.0  1.0  1.0
  2.0  2.0  2.0
- 3.0  3.0  3.0
source
Base.parentFunction
parent(A)

Return the underlying parent object of the view. This parent of objects of types SubArray, SubString, ReshapedArray or LinearAlgebra.Transpose is what was passed as an argument to view, reshape, transpose, etc. during object creation. If the input is not a wrapped object, return the input itself. If the input is wrapped multiple times, only the outermost wrapper will be removed.

Examples

julia> A = [1 2; 3 4]
+ 3.0  3.0  3.0
source
Base.parentFunction
parent(A)

Return the underlying parent object of the view. This parent of objects of types SubArray, SubString, ReshapedArray or LinearAlgebra.Transpose is what was passed as an argument to view, reshape, transpose, etc. during object creation. If the input is not a wrapped object, return the input itself. If the input is wrapped multiple times, only the outermost wrapper will be removed.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -676,7 +676,7 @@
 julia> parent(V)
 2×2 Matrix{Int64}:
  1  2
- 3  4
source
Base.parentindicesFunction
parentindices(A)

Return the indices in the parent which correspond to the view A.

Examples

julia> A = [1 2; 3 4];
+ 3  4
source
Base.parentindicesFunction
parentindices(A)

Return the indices in the parent which correspond to the view A.

Examples

julia> A = [1 2; 3 4];
 
 julia> V = view(A, 1, :)
 2-element view(::Matrix{Int64}, 1, :) with eltype Int64:
@@ -684,7 +684,7 @@
  2
 
 julia> parentindices(V)
-(1, Base.Slice(Base.OneTo(2)))
source
Base.selectdimFunction
selectdim(A, d::Integer, i)

Return a view of all the data of A where the index for dimension d equals i.

Equivalent to view(A,:,:,...,i,:,:,...) where i is in position d.

See also: eachslice.

Examples

julia> A = [1 2 3 4; 5 6 7 8]
+(1, Base.Slice(Base.OneTo(2)))
source
Base.selectdimFunction
selectdim(A, d::Integer, i)

Return a view of all the data of A where the index for dimension d equals i.

Equivalent to view(A,:,:,...,i,:,:,...) where i is in position d.

See also: eachslice.

Examples

julia> A = [1 2 3 4; 5 6 7 8]
 2×4 Matrix{Int64}:
  1  2  3  4
  5  6  7  8
@@ -697,7 +697,7 @@
 julia> selectdim(A, 2, 3:4)
 2×2 view(::Matrix{Int64}, :, 3:4) with eltype Int64:
  3  4
- 7  8
source
Base.reinterpretFunction
reinterpret(reshape, T, A::AbstractArray{S}) -> B

Change the type-interpretation of A while consuming or adding a "channel dimension."

If sizeof(T) = n*sizeof(S) for n>1, A's first dimension must be of size n and B lacks A's first dimension. Conversely, if sizeof(S) = n*sizeof(T) for n>1, B gets a new first dimension of size n. The dimensionality is unchanged if sizeof(T) == sizeof(S).

Julia 1.6

This method requires at least Julia 1.6.

Examples

julia> A = [1 2; 3 4]
+ 7  8
source
Base.reinterpretFunction
reinterpret(reshape, T, A::AbstractArray{S}) -> B

Change the type-interpretation of A while consuming or adding a "channel dimension."

If sizeof(T) = n*sizeof(S) for n>1, A's first dimension must be of size n and B lacks A's first dimension. Conversely, if sizeof(S) = n*sizeof(T) for n>1, B gets a new first dimension of size n. The dimensionality is unchanged if sizeof(T) == sizeof(S).

Julia 1.6

This method requires at least Julia 1.6.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -716,7 +716,7 @@
 3×2 reinterpret(reshape, Int64, ::Vector{Tuple{Int64, Int64, Int64}}) with eltype Int64:
  1  4
  2  5
- 3  6
source
reinterpret(T::DataType, A::AbstractArray)

Construct a view of the array with the same binary data as the given array, but with T as element type.

This function also works on "lazy" array whose elements are not computed until they are explicitly retrieved. For instance, reinterpret on the range 1:6 works similarly as on the dense vector collect(1:6):

julia> reinterpret(Float32, UInt32[1 2 3 4 5])
+ 3  6
source
reinterpret(T::DataType, A::AbstractArray)

Construct a view of the array with the same binary data as the given array, but with T as element type.

This function also works on "lazy" array whose elements are not computed until they are explicitly retrieved. For instance, reinterpret on the range 1:6 works similarly as on the dense vector collect(1:6):

julia> reinterpret(Float32, UInt32[1 2 3 4 5])
 1×5 reinterpret(Float32, ::Matrix{UInt32}):
  1.0f-45  3.0f-45  4.0f-45  6.0f-45  7.0f-45
 
@@ -734,7 +734,7 @@
 julia> b = reinterpret(UInt32, Tuple{UInt8, UInt32}[(0x01, 0x00000002)]); # showing will error
 
 julia> b[1]
-ERROR: Padding of type UInt32 is not compatible with type Tuple{UInt8, UInt32}.
source
reinterpret(::Type{Out}, x::In)

Change the type-interpretation of the binary data in the isbits value x to that of the isbits type Out. The size (ignoring padding) of Out has to be the same as that of the type of x. For example, reinterpret(Float32, UInt32(7)) interprets the 4 bytes corresponding to UInt32(7) as a Float32. Note that reinterpret(In, reinterpret(Out, x)) === x

julia> reinterpret(Float32, UInt32(7))
+ERROR: Padding of type UInt32 is not compatible with type Tuple{UInt8, UInt32}.
source
reinterpret(::Type{Out}, x::In)

Change the type-interpretation of the binary data in the isbits value x to that of the isbits type Out. The size (ignoring padding) of Out has to be the same as that of the type of x. For example, reinterpret(Float32, UInt32(7)) interprets the 4 bytes corresponding to UInt32(7) as a Float32. Note that reinterpret(In, reinterpret(Out, x)) === x

julia> reinterpret(Float32, UInt32(7))
 1.0f-44
 
 julia> reinterpret(NTuple{2, UInt8}, 0x1234)
@@ -744,7 +744,7 @@
 0x1234
 
 julia> reinterpret(Tuple{UInt16, UInt8}, (0x01, 0x0203))
-(0x0301, 0x02)
Note

The treatment of padding differs from reinterpret(::DataType, ::AbstractArray).

Warning

Use caution if some combinations of bits in Out are not considered valid and would otherwise be prevented by the type's constructors and methods. Unexpected behavior may result without additional validation.

source
Base.reshapeFunction
reshape(A, dims...) -> AbstractArray
+(0x0301, 0x02)
Note

The treatment of padding differs from reinterpret(::DataType, ::AbstractArray).

Warning

Use caution if some combinations of bits in Out are not considered valid and would otherwise be prevented by the type's constructors and methods. Unexpected behavior may result without additional validation.

source
Base.reshapeFunction
reshape(A, dims...) -> AbstractArray
 reshape(A, dims) -> AbstractArray

Return an array with the same data as A, but with different dimension sizes or number of dimensions. The two arrays share the same underlying data, so that the result is mutable if and only if A is mutable, and setting elements of one alters the values of the other.

The new dimensions may be specified either as a list of arguments or as a shape tuple. At most one dimension may be specified with a :, in which case its length is computed such that its product with all the specified dimensions is equal to the length of the original array A. The total number of elements must not change.

Examples

julia> A = Vector(1:16)
 16-element Vector{Int64}:
   1
@@ -779,7 +779,7 @@
 julia> reshape(1:6, 2, 3)
 2×3 reshape(::UnitRange{Int64}, 2, 3) with eltype Int64:
  1  3  5
- 2  4  6
source
Base.insertdimsFunction
insertdims(A; dims)

Inverse of dropdims; return an array with new singleton dimensions at every dimension in dims.

Repeated dimensions are forbidden and the largest entry in dims must be less than or equal than ndims(A) + length(dims).

The result shares the same underlying data as A, such that the result is mutable if and only if A is mutable, and setting elements of one alters the values of the other.

See also: dropdims, reshape, vec.

Examples

julia> x = [1 2 3; 4 5 6]
+ 2  4  6
source
Base.insertdimsFunction
insertdims(A; dims)

Inverse of dropdims; return an array with new singleton dimensions at every dimension in dims.

Repeated dimensions are forbidden and the largest entry in dims must be less than or equal than ndims(A) + length(dims).

The result shares the same underlying data as A, such that the result is mutable if and only if A is mutable, and setting elements of one alters the values of the other.

See also: dropdims, reshape, vec.

Examples

julia> x = [1 2 3; 4 5 6]
 2×3 Matrix{Int64}:
  1  2  3
  4  5  6
@@ -796,7 +796,7 @@
 julia> dropdims(insertdims(x, dims=(1,2,5)), dims=(1,2,5))
 2×3 Matrix{Int64}:
  1  2  3
- 4  5  6
Julia 1.12

Requires Julia 1.12 or later.

source
Base.dropdimsFunction
dropdims(A; dims)

Return an array with the same data as A, but with the dimensions specified by dims removed. size(A,d) must equal 1 for every d in dims, and repeated dimensions or numbers outside 1:ndims(A) are forbidden.

The result shares the same underlying data as A, such that the result is mutable if and only if A is mutable, and setting elements of one alters the values of the other.

See also: reshape, vec.

Examples

julia> a = reshape(Vector(1:4),(2,2,1,1))
+ 4  5  6
Julia 1.12

Requires Julia 1.12 or later.

source
Base.dropdimsFunction
dropdims(A; dims)

Return an array with the same data as A, but with the dimensions specified by dims removed. size(A,d) must equal 1 for every d in dims, and repeated dimensions or numbers outside 1:ndims(A) are forbidden.

The result shares the same underlying data as A, such that the result is mutable if and only if A is mutable, and setting elements of one alters the values of the other.

See also: reshape, vec.

Examples

julia> a = reshape(Vector(1:4),(2,2,1,1))
 2×2×1×1 Array{Int64, 4}:
 [:, :, 1, 1] =
  1  3
@@ -812,7 +812,7 @@
 2×2×1×1 Array{Int64, 4}:
 [:, :, 1, 1] =
  5  3
- 2  4
source
Base.vecFunction
vec(a::AbstractArray) -> AbstractVector

Reshape the array a as a one-dimensional column vector. Return a if it is already an AbstractVector. The resulting array shares the same underlying data as a, so it will only be mutable if a is mutable, in which case modifying one will also modify the other.

Examples

julia> a = [1 2 3; 4 5 6]
+ 2  4
source
Base.vecFunction
vec(a::AbstractArray) -> AbstractVector

Reshape the array a as a one-dimensional column vector. Return a if it is already an AbstractVector. The resulting array shares the same underlying data as a, so it will only be mutable if a is mutable, in which case modifying one will also modify the other.

Examples

julia> a = [1 2 3; 4 5 6]
 2×3 Matrix{Int64}:
  1  2  3
  4  5  6
@@ -827,7 +827,7 @@
  6
 
 julia> vec(1:3)
-1:3

See also reshape, dropdims.

source
Base.SubArrayType
SubArray{T,N,P,I,L} <: AbstractArray{T,N}

N-dimensional view into a parent array (of type P) with an element type T, restricted by a tuple of indices (of type I). L is true for types that support fast linear indexing, and false otherwise.

Construct SubArrays using the view function.

source

Concatenation and permutation

Base.catFunction
cat(A...; dims)

Concatenate the input arrays along the dimensions specified in dims.

Along a dimension d in dims, the size of the output array is sum(size(a,d) for a in A). Along other dimensions, all input arrays should have the same size, which will also be the size of the output array along those dimensions.

If dims is a single number, the different arrays are tightly packed along that dimension. If dims is an iterable containing several dimensions, the positions along these dimensions are increased simultaneously for each input array, filling with zero elsewhere. This allows one to construct block-diagonal matrices as cat(matrices...; dims=(1,2)), and their higher-dimensional analogues.

The special case dims=1 is vcat, and dims=2 is hcat. See also hvcat, hvncat, stack, repeat.

The keyword also accepts Val(dims).

Julia 1.8

For multiple dimensions dims = Val(::Tuple) was added in Julia 1.8.

Examples

Concatenate two arrays in different dimensions:

julia> a = [1 2 3]
+1:3

See also reshape, dropdims.

source
Base.SubArrayType
SubArray{T,N,P,I,L} <: AbstractArray{T,N}

N-dimensional view into a parent array (of type P) with an element type T, restricted by a tuple of indices (of type I). L is true for types that support fast linear indexing, and false otherwise.

Construct SubArrays using the view function.

source

Concatenation and permutation

Base.catFunction
cat(A...; dims)

Concatenate the input arrays along the dimensions specified in dims.

Along a dimension d in dims, the size of the output array is sum(size(a,d) for a in A). Along other dimensions, all input arrays should have the same size, which will also be the size of the output array along those dimensions.

If dims is a single number, the different arrays are tightly packed along that dimension. If dims is an iterable containing several dimensions, the positions along these dimensions are increased simultaneously for each input array, filling with zero elsewhere. This allows one to construct block-diagonal matrices as cat(matrices...; dims=(1,2)), and their higher-dimensional analogues.

The special case dims=1 is vcat, and dims=2 is hcat. See also hvcat, hvncat, stack, repeat.

The keyword also accepts Val(dims).

Julia 1.8

For multiple dimensions dims = Val(::Tuple) was added in Julia 1.8.

Examples

Concatenate two arrays in different dimensions:

julia> a = [1 2 3]
 1×3 Matrix{Int64}:
  1  2  3
 
@@ -879,7 +879,7 @@
  "aaa"  "bbb"
 
 julia> a * b
-"aaabbb"
source
Base.vcatFunction
vcat(A...)

Concatenate arrays or numbers vertically. Equivalent to cat(A...; dims=1), and to the syntax [a; b; c].

To concatenate a large vector of arrays, reduce(vcat, A) calls an efficient method when A isa AbstractVector{<:AbstractVecOrMat}, rather than working pairwise.

See also hcat, Iterators.flatten, stack.

Examples

julia> v = vcat([1,2], [3,4])
+"aaabbb"
source
Base.vcatFunction
vcat(A...)

Concatenate arrays or numbers vertically. Equivalent to cat(A...; dims=1), and to the syntax [a; b; c].

To concatenate a large vector of arrays, reduce(vcat, A) calls an efficient method when A isa AbstractVector{<:AbstractVecOrMat}, rather than working pairwise.

See also hcat, Iterators.flatten, stack.

Examples

julia> v = vcat([1,2], [3,4])
 4-element Vector{Int64}:
  1
  2
@@ -922,7 +922,7 @@
  6
 
 julia> ans == collect(Iterators.flatten(vs))
-true
source
Base.hcatFunction
hcat(A...)

Concatenate arrays or numbers horizontally. Equivalent to cat(A...; dims=2), and to the syntax [a b c] or [a;; b;; c].

For a large vector of arrays, reduce(hcat, A) calls an efficient method when A isa AbstractVector{<:AbstractVecOrMat}. For a vector of vectors, this can also be written stack(A).

See also vcat, hvcat.

Examples

julia> hcat([1,2], [3,4], [5,6])
+true
source
Base.hcatFunction
hcat(A...)

Concatenate arrays or numbers horizontally. Equivalent to cat(A...; dims=2), and to the syntax [a b c] or [a;; b;; c].

For a large vector of arrays, reduce(hcat, A) calls an efficient method when A isa AbstractVector{<:AbstractVecOrMat}. For a vector of vectors, this can also be written stack(A).

See also vcat, hvcat.

Examples

julia> hcat([1,2], [3,4], [5,6])
 2×3 Matrix{Int64}:
  1  3  5
  2  4  6
@@ -954,7 +954,7 @@
 julia> hcat([1.1, 9.9], Matrix(undef, 2, 0))  # hcat with empty 2×0 Matrix
 2×1 Matrix{Any}:
  1.1
- 9.9
source
Base.hvcatFunction
hvcat(blocks_per_row::Union{Tuple{Vararg{Int}}, Int}, values...)

Horizontal and vertical concatenation in one call. This function is called for block matrix syntax. The first argument specifies the number of arguments to concatenate in each block row. If the first argument is a single integer n, then all block rows are assumed to have n block columns.

Examples

julia> a, b, c, d, e, f = 1, 2, 3, 4, 5, 6
+ 9.9
source
Base.hvcatFunction
hvcat(blocks_per_row::Union{Tuple{Vararg{Int}}, Int}, values...)

Horizontal and vertical concatenation in one call. This function is called for block matrix syntax. The first argument specifies the number of arguments to concatenate in each block row. If the first argument is a single integer n, then all block rows are assumed to have n block columns.

Examples

julia> a, b, c, d, e, f = 1, 2, 3, 4, 5, 6
 (1, 2, 3, 4, 5, 6)
 
 julia> [a b c; d e f]
@@ -979,7 +979,7 @@
  3  4
  5  6
 julia> hvcat((2,2,2), a,b,c,d,e,f) == hvcat(2, a,b,c,d,e,f)
-true
source
Base.hvncatFunction
hvncat(dim::Int, row_first, values...)
 hvncat(dims::Tuple{Vararg{Int}}, row_first, values...)
 hvncat(shape::Tuple{Vararg{Tuple}}, row_first, values...)

Horizontal, vertical, and n-dimensional concatenation of many values in one call.

This function is called for block matrix syntax. The first argument either specifies the shape of the concatenation, similar to hvcat, as a tuple of tuples, or the dimensions that specify the key number of elements along each axis, and is used to determine the output dimensions. The dims form is more performant, and is used by default when the concatenation operation has the same number of elements along each axis (e.g., [a b; c d;;; e f ; g h]). The shape form is used when the number of elements along each axis is unbalanced (e.g., [a b ; c]). Unbalanced syntax needs additional validation overhead. The dim form is an optimization for concatenation along just one dimension. row_first indicates how values are ordered. The meaning of the first and second elements of shape are also swapped based on row_first.

Examples

julia> a, b, c, d, e, f = 1, 2, 3, 4, 5, 6
 (1, 2, 3, 4, 5, 6)
@@ -1038,7 +1038,7 @@
  4             = elements in each 3d slice (4,)
  _____________
  4             = elements in each 4d slice (4,)
-⇒ shape = ((2, 1, 1), (3, 1), (4,), (4,)) with `row_first` = true
source
Base.stackFunction
stack(f, args...; [dims])

Apply a function to each element of a collection, and stack the result. Or to several collections, zipped together.

The function should return arrays (or tuples, or other iterators) all of the same size. These become slices of the result, each separated along dims (if given) or by default along the last dimensions.

See also mapslices, eachcol.

Examples

julia> stack(c -> (c, c-32), "julia")
+⇒ shape = ((2, 1, 1), (3, 1), (4,), (4,)) with `row_first` = true
source
Base.stackFunction
stack(f, args...; [dims])

Apply a function to each element of a collection, and stack the result. Or to several collections, zipped together.

The function should return arrays (or tuples, or other iterators) all of the same size. These become slices of the result, each separated along dims (if given) or by default along the last dimensions.

See also mapslices, eachcol.

Examples

julia> stack(c -> (c, c-32), "julia")
 2×5 Matrix{Char}:
  'j'  'u'  'l'  'i'  'a'
  'J'  'U'  'L'  'I'  'A'
@@ -1048,7 +1048,7 @@
        end
 2×9 Matrix{Float64}:
  1.0  2.0  3.0   10.0   20.0   30.0  0.1   0.2   0.3
- 4.0  5.0  6.0  400.0  500.0  600.0  0.04  0.05  0.06
source
stack(iter; [dims])

Combine a collection of arrays (or other iterable objects) of equal size into one larger array, by arranging them along one or more new dimensions.

By default the axes of the elements are placed first, giving size(result) = (size(first(iter))..., size(iter)...). This has the same order of elements as Iterators.flatten(iter).

With keyword dims::Integer, instead the ith element of iter becomes the slice selectdim(result, dims, i), so that size(result, dims) == length(iter). In this case stack reverses the action of eachslice with the same dims.

The various cat functions also combine arrays. However, these all extend the arrays' existing (possibly trivial) dimensions, rather than placing the arrays along new dimensions. They also accept arrays as separate arguments, rather than a single collection.

Julia 1.9

This function requires at least Julia 1.9.

Examples

julia> vecs = (1:2, [30, 40], Float32[500, 600]);
+ 4.0  5.0  6.0  400.0  500.0  600.0  0.04  0.05  0.06
source
stack(iter; [dims])

Combine a collection of arrays (or other iterable objects) of equal size into one larger array, by arranging them along one or more new dimensions.

By default the axes of the elements are placed first, giving size(result) = (size(first(iter))..., size(iter)...). This has the same order of elements as Iterators.flatten(iter).

With keyword dims::Integer, instead the ith element of iter becomes the slice selectdim(result, dims, i), so that size(result, dims) == length(iter). In this case stack reverses the action of eachslice with the same dims.

The various cat functions also combine arrays. However, these all extend the arrays' existing (possibly trivial) dimensions, rather than placing the arrays along new dimensions. They also accept arrays as separate arguments, rather than a single collection.

Julia 1.9

This function requires at least Julia 1.9.

Examples

julia> vecs = (1:2, [30, 40], Float32[500, 600]);
 
 julia> mat = stack(vecs)
 2×3 Matrix{Float32}:
@@ -1106,11 +1106,11 @@
 (35, 2, 3)
 
 julia> hvcat(5, M...) |> size  # hvcat puts matrices next to each other
-(14, 15)
source
Base.vectFunction
vect(X...)

Create a Vector with element type computed from the promote_typeof of the argument, containing the argument list.

Examples

julia> a = Base.vect(UInt8(1), 2.5, 1//2)
+(14, 15)
source
Base.vectFunction
vect(X...)

Create a Vector with element type computed from the promote_typeof of the argument, containing the argument list.

Examples

julia> a = Base.vect(UInt8(1), 2.5, 1//2)
 3-element Vector{Float64}:
  1.0
  2.5
- 0.5
source
Base.circshiftFunction
circshift(A, shifts)

Circularly shift, i.e. rotate, the data in A. The second argument is a tuple or vector giving the amount to shift in each dimension, or an integer to shift only in the first dimension.

The generated code is most efficient when the shift amounts are known at compile-time, i.e., compile-time constants.

See also: circshift!, circcopy!, bitrotate, <<.

Examples

julia> b = reshape(Vector(1:16), (4,4))
+ 0.5
source
Base.circshiftFunction
circshift(A, shifts)

Circularly shift, i.e. rotate, the data in A. The second argument is a tuple or vector giving the amount to shift in each dimension, or an integer to shift only in the first dimension.

The generated code is most efficient when the shift amounts are known at compile-time, i.e., compile-time constants.

See also: circshift!, circcopy!, bitrotate, <<.

Examples

julia> b = reshape(Vector(1:16), (4,4))
 4×4 Matrix{Int64}:
  1  5   9  13
  2  6  10  14
@@ -1165,7 +1165,7 @@
 (1, 'a', -7.0, 3)
 
 julia> circshift(z, -1)
-('a', -7.0, 3, 1)
source
Base.circshift!Function
circshift!(dest, src, shifts)

Circularly shift, i.e. rotate, the data in src, storing the result in dest. shifts specifies the amount to shift in each dimension.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also circshift.

source
Base.circcopy!Function
circcopy!(dest, src)

Copy src to dest, indexing each dimension modulo its length. src and dest must have the same size, but can be offset in their indices; any offset results in a (circular) wraparound. If the arrays have overlapping indices, then on the domain of the overlap dest agrees with src.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also: circshift.

Examples

julia> src = reshape(Vector(1:16), (4,4))
+('a', -7.0, 3, 1)
source
Base.circshift!Function
circshift!(dest, src, shifts)

Circularly shift, i.e. rotate, the data in src, storing the result in dest. shifts specifies the amount to shift in each dimension.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also circshift.

source
Base.circcopy!Function
circcopy!(dest, src)

Copy src to dest, indexing each dimension modulo its length. src and dest must have the same size, but can be offset in their indices; any offset results in a (circular) wraparound. If the arrays have overlapping indices, then on the domain of the overlap dest agrees with src.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also: circshift.

Examples

julia> src = reshape(Vector(1:16), (4,4))
 4×4 Matrix{Int64}:
  1  5   9  13
  2  6  10  14
@@ -1182,7 +1182,7 @@
  7  11  15  3
 
 julia> dest[1:3,2:4] == src[1:3,2:4]
-true
source
Base.findallMethod
findall(A)

Return a vector I of the true indices or keys of A. If there are no such elements of A, return an empty array. To search for other kinds of values, pass a predicate as the first argument.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

See also: findfirst, searchsorted.

Examples

julia> A = [true, false, false, true]
+true
source
Base.findallMethod
findall(A)

Return a vector I of the true indices or keys of A. If there are no such elements of A, return an empty array. To search for other kinds of values, pass a predicate as the first argument.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

See also: findfirst, searchsorted.

Examples

julia> A = [true, false, false, true]
 4-element Vector{Bool}:
  1
  0
@@ -1205,7 +1205,7 @@
  CartesianIndex(2, 2)
 
 julia> findall(falses(3))
-Int64[]
source
Base.findallMethod
findall(f::Function, A)

Return a vector I of the indices or keys of A where f(A[I]) returns true. If there are no such elements of A, return an empty array.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> x = [1, 3, 4]
+Int64[]
source
Base.findallMethod
findall(f::Function, A)

Return a vector I of the indices or keys of A where f(A[I]) returns true. If there are no such elements of A, return an empty array.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> x = [1, 3, 4]
 3-element Vector{Int64}:
  1
  3
@@ -1242,7 +1242,7 @@
 2-element Vector{Symbol}:
  :A
  :C
-
source
Base.findfirstMethod
findfirst(A)

Return the index or key of the first true value in A. Return nothing if no such value is found. To search for other kinds of values, pass a predicate as the first argument.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

See also: findall, findnext, findlast, searchsortedfirst.

Examples

julia> A = [false, false, true, false]
+
source
Base.findfirstMethod
findfirst(A)

Return the index or key of the first true value in A. Return nothing if no such value is found. To search for other kinds of values, pass a predicate as the first argument.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

See also: findall, findnext, findlast, searchsortedfirst.

Examples

julia> A = [false, false, true, false]
 4-element Vector{Bool}:
  0
  0
@@ -1260,7 +1260,7 @@
  1  0
 
 julia> findfirst(A)
-CartesianIndex(2, 1)
source
Base.findfirstMethod
findfirst(predicate::Function, A)

Return the index or key of the first element of A for which predicate returns true. Return nothing if there is no such element.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [1, 4, 2, 2]
+CartesianIndex(2, 1)
source
Base.findfirstMethod
findfirst(predicate::Function, A)

Return the index or key of the first element of A for which predicate returns true. Return nothing if there is no such element.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [1, 4, 2, 2]
 4-element Vector{Int64}:
  1
  4
@@ -1281,7 +1281,7 @@
  2  2
 
 julia> findfirst(iseven, A)
-CartesianIndex(2, 1)
source
Base.findlastMethod
findlast(A)

Return the index or key of the last true value in A. Return nothing if there is no true value in A.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

See also: findfirst, findprev, findall.

Examples

julia> A = [true, false, true, false]
+CartesianIndex(2, 1)
source
Base.findlastMethod
findlast(A)

Return the index or key of the last true value in A. Return nothing if there is no true value in A.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

See also: findfirst, findprev, findall.

Examples

julia> A = [true, false, true, false]
 4-element Vector{Bool}:
  1
  0
@@ -1301,7 +1301,7 @@
  1  0
 
 julia> findlast(A)
-CartesianIndex(2, 1)
source
Base.findlastMethod
findlast(predicate::Function, A)

Return the index or key of the last element of A for which predicate returns true. Return nothing if there is no such element.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [1, 2, 3, 4]
+CartesianIndex(2, 1)
source
Base.findlastMethod
findlast(predicate::Function, A)

Return the index or key of the last element of A for which predicate returns true. Return nothing if there is no such element.

Indices or keys are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [1, 2, 3, 4]
 4-element Vector{Int64}:
  1
  2
@@ -1319,7 +1319,7 @@
  3  4
 
 julia> findlast(isodd, A)
-CartesianIndex(2, 1)
source
Base.findnextMethod
findnext(A, i)

Find the next index after or including i of a true element of A, or nothing if not found.

Indices are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [false, false, true, false]
+CartesianIndex(2, 1)
source
Base.findnextMethod
findnext(A, i)

Find the next index after or including i of a true element of A, or nothing if not found.

Indices are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [false, false, true, false]
 4-element Vector{Bool}:
  0
  0
@@ -1337,7 +1337,7 @@
  1  0
 
 julia> findnext(A, CartesianIndex(1, 1))
-CartesianIndex(2, 1)
source
Base.findnextMethod
findnext(predicate::Function, A, i)

Find the next index after or including i of an element of A for which predicate returns true, or nothing if not found. This works for Arrays, Strings, and most other collections that support getindex, keys(A), and nextind.

Indices are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [1, 4, 2, 2];
+CartesianIndex(2, 1)
source
Base.findnextMethod
findnext(predicate::Function, A, i)

Find the next index after or including i of an element of A for which predicate returns true, or nothing if not found. This works for Arrays, Strings, and most other collections that support getindex, keys(A), and nextind.

Indices are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [1, 4, 2, 2];
 
 julia> findnext(isodd, A, 1)
 1
@@ -1350,7 +1350,7 @@
 CartesianIndex(1, 1)
 
 julia> findnext(isspace, "a b c", 3)
-4
source
Base.findprevMethod
findprev(A, i)

Find the previous index before or including i of a true element of A, or nothing if not found.

Indices are of the same type as those returned by keys(A) and pairs(A).

See also: findnext, findfirst, findall.

Examples

julia> A = [false, false, true, true]
+4
source
Base.findprevMethod
findprev(A, i)

Find the previous index before or including i of a true element of A, or nothing if not found.

Indices are of the same type as those returned by keys(A) and pairs(A).

See also: findnext, findfirst, findall.

Examples

julia> A = [false, false, true, true]
 4-element Vector{Bool}:
  0
  0
@@ -1368,7 +1368,7 @@
  1  1
 
 julia> findprev(A, CartesianIndex(2, 1))
-CartesianIndex(2, 1)
source
Base.findprevMethod
findprev(predicate::Function, A, i)

Find the previous index before or including i of an element of A for which predicate returns true, or nothing if not found. This works for Arrays, Strings, and most other collections that support getindex, keys(A), and nextind.

Indices are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [4, 6, 1, 2]
+CartesianIndex(2, 1)
source
Base.findprevMethod
findprev(predicate::Function, A, i)

Find the previous index before or including i of an element of A for which predicate returns true, or nothing if not found. This works for Arrays, Strings, and most other collections that support getindex, keys(A), and nextind.

Indices are of the same type as those returned by keys(A) and pairs(A).

Examples

julia> A = [4, 6, 1, 2]
 4-element Vector{Int64}:
  4
  6
@@ -1389,7 +1389,7 @@
 CartesianIndex(2, 1)
 
 julia> findprev(isspace, "a b c", 3)
-2
source
Base.permutedimsFunction
permutedims(v::AbstractVector)

Reshape vector v into a 1 × length(v) row matrix. Differs from transpose in that the operation is not recursive, which is especially useful for arrays of non-numeric values (where the recursive transpose might throw an error).

Examples

Unlike transpose, permutedims can be used on vectors of arbitrary non-numeric elements, such as strings:

julia> permutedims(["a", "b", "c"])
+2
source
Base.permutedimsFunction
permutedims(v::AbstractVector)

Reshape vector v into a 1 × length(v) row matrix. Differs from transpose in that the operation is not recursive, which is especially useful for arrays of non-numeric values (where the recursive transpose might throw an error).

Examples

Unlike transpose, permutedims can be used on vectors of arbitrary non-numeric elements, such as strings:

julia> permutedims(["a", "b", "c"])
 1×3 Matrix{String}:
  "a"  "b"  "c"

For vectors of numbers, permutedims(v) works much like transpose(v) except that the return type differs (it uses reshape rather than a LinearAlgebra.Transpose view, though both share memory with the original array v):

julia> v = [1, 2, 3, 4]
 4-element Vector{Int64}:
@@ -1430,7 +1430,7 @@
 
 julia> transpose(V)
 1×2 transpose(::Vector{Matrix{Int64}}) with eltype Transpose{Int64, Matrix{Int64}}:
- [1 3; 2 4]  [5 7; 6 8]
source
permutedims(A::AbstractArray, perm)
+ [1 3; 2 4]  [5 7; 6 8]
source
permutedims(A::AbstractArray, perm)
 permutedims(A::AbstractMatrix)

Permute the dimensions (axes) of array A. perm is a tuple or vector of ndims(A) integers specifying the permutation.

If A is a 2d array (AbstractMatrix), then perm defaults to (2,1), swapping the two axes of A (the rows and columns of the matrix). This differs from transpose in that the operation is not recursive, which is especially useful for arrays of non-numeric values (where the recursive transpose would throw an error) and/or 2d arrays that do not represent linear operators.

For 1d arrays, see permutedims(v::AbstractVector), which returns a 1-row “matrix”.

See also permutedims!, PermutedDimsArray, transpose, invperm.

Examples

2d arrays:

Unlike transpose, permutedims can be used to swap rows and columns of 2d arrays of arbitrary non-numeric elements, such as strings:

julia> A = ["a" "b" "c"
             "d" "e" "f"]
 2×3 Matrix{String}:
@@ -1495,7 +1495,7 @@
 (13, 5, 11, 7)
 
 julia> size(A)[perm] == ans
-true
source
Base.permutedims!Function
permutedims!(dest, src, perm)

Permute the dimensions of array src and store the result in the array dest. perm is a vector specifying a permutation of length ndims(src). The preallocated array dest should have size(dest) == size(src)[perm] and is completely overwritten. No in-place permutation is supported and unexpected results will happen if src and dest have overlapping memory regions.

See also permutedims.

source
Base.permutedims!Function
permutedims!(dest, src, perm)

Permute the dimensions of array src and store the result in the array dest. perm is a vector specifying a permutation of length ndims(src). The preallocated array dest should have size(dest) == size(src)[perm] and is completely overwritten. No in-place permutation is supported and unexpected results will happen if src and dest have overlapping memory regions.

See also permutedims.

source
Base.PermutedDimsArrays.PermutedDimsArrayType
PermutedDimsArray(A, perm) -> B

Given an AbstractArray A, create a view B such that the dimensions appear to be permuted. Similar to permutedims, except that no copying occurs (B shares storage with A).

See also permutedims, invperm.

Examples

julia> A = rand(3,5,4);
 
 julia> B = PermutedDimsArray(A, (3,1,2));
 
@@ -1503,7 +1503,7 @@
 (4, 3, 5)
 
 julia> B[3,1,2] == A[1,2,3]
-true
source
Base.promote_shapeFunction
promote_shape(s1, s2)

Check two array shapes for compatibility, allowing trailing singleton dimensions, and return whichever shape has more dimensions.

Examples

julia> a = fill(1, (3,4,1,1,1));
+true
source
Base.promote_shapeFunction
promote_shape(s1, s2)

Check two array shapes for compatibility, allowing trailing singleton dimensions, and return whichever shape has more dimensions.

Examples

julia> a = fill(1, (3,4,1,1,1));
 
 julia> b = fill(1, (3,4));
 
@@ -1511,7 +1511,7 @@
 (Base.OneTo(3), Base.OneTo(4), Base.OneTo(1), Base.OneTo(1), Base.OneTo(1))
 
 julia> promote_shape((2,3,1,4), (2, 3, 1, 4, 1))
-(2, 3, 1, 4, 1)
source

Array functions

Base.accumulateFunction
accumulate(op, A; dims::Integer, [init])

Cumulative operation op along the dimension dims of A (providing dims is optional for vectors). An initial value init may optionally be provided by a keyword argument. See also accumulate! to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow).

For common operations there are specialized variants of accumulate, see cumsum, cumprod. For a lazy version, see Iterators.accumulate.

Julia 1.5

accumulate on a non-array iterator requires at least Julia 1.5.

Examples

julia> accumulate(+, [1,2,3])
+(2, 3, 1, 4, 1)
source

Array functions

Base.accumulateFunction
accumulate(op, A; dims::Integer, [init])

Cumulative operation op along the dimension dims of A (providing dims is optional for vectors). An initial value init may optionally be provided by a keyword argument. See also accumulate! to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow).

For common operations there are specialized variants of accumulate, see cumsum, cumprod. For a lazy version, see Iterators.accumulate.

Julia 1.5

accumulate on a non-array iterator requires at least Julia 1.5.

Examples

julia> accumulate(+, [1,2,3])
 3-element Vector{Int64}:
  1
  3
@@ -1538,7 +1538,7 @@
 julia> accumulate(+, fill(1, 2, 5), dims=2, init=100.0)
 2×5 Matrix{Float64}:
  101.0  102.0  103.0  104.0  105.0
- 101.0  102.0  103.0  104.0  105.0
source
Base.accumulate!Function
accumulate!(op, B, A; [dims], [init])

Cumulative operation op on A along the dimension dims, storing the result in B. Providing dims is optional for vectors. If the keyword argument init is given, its value is used to instantiate the accumulation.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also accumulate, cumsum!, cumprod!.

Examples

julia> x = [1, 0, 2, 0, 3];
+ 101.0  102.0  103.0  104.0  105.0
source
Base.accumulate!Function
accumulate!(op, B, A; [dims], [init])

Cumulative operation op on A along the dimension dims, storing the result in B. Providing dims is optional for vectors. If the keyword argument init is given, its value is used to instantiate the accumulation.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also accumulate, cumsum!, cumprod!.

Examples

julia> x = [1, 0, 2, 0, 3];
 
 julia> y = rand(5);
 
@@ -1564,7 +1564,7 @@
 julia> accumulate!(*, B, A, dims=2, init=10)
 2×3 Matrix{Int64}:
  10   20    60
- 40  200  1200
source
Base.cumprodFunction
cumprod(itr)

Cumulative product of an iterator.

See also cumprod!, accumulate, cumsum.

Julia 1.5

cumprod on a non-array iterator requires at least Julia 1.5.

Examples

julia> cumprod(fill(1//2, 3))
+ 40  200  1200
source
Base.cumprodFunction
cumprod(itr)

Cumulative product of an iterator.

See also cumprod!, accumulate, cumsum.

Julia 1.5

cumprod on a non-array iterator requires at least Julia 1.5.

Examples

julia> cumprod(fill(1//2, 3))
 3-element Vector{Rational{Int64}}:
  1//2
  1//4
@@ -1579,7 +1579,7 @@
  "ju"
  "jul"
  "juli"
- "julia"
source
cumprod(A; dims::Integer)

Cumulative product along the dimension dim. See also cumprod! to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow).

Examples

julia> a = Int8[1 2 3; 4 5 6];
+ "julia"
source
cumprod(A; dims::Integer)

Cumulative product along the dimension dim. See also cumprod! to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow).

Examples

julia> a = Int8[1 2 3; 4 5 6];
 
 julia> cumprod(a, dims=1)
 2×3 Matrix{Int64}:
@@ -1589,7 +1589,7 @@
 julia> cumprod(a, dims=2)
 2×3 Matrix{Int64}:
  1   2    6
- 4  20  120
source
Base.cumprod!Function
cumprod!(y::AbstractVector, x::AbstractVector)

Cumulative product of a vector x, storing the result in y. See also cumprod.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
cumprod!(B, A; dims::Integer)

Cumulative product of A along the dimension dims, storing the result in B. See also cumprod.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.cumsumFunction
cumsum(itr)

Cumulative sum of an iterator.

See also accumulate to apply functions other than +.

Julia 1.5

cumsum on a non-array iterator requires at least Julia 1.5.

Examples

julia> cumsum(1:3)
+ 4  20  120
source
Base.cumprod!Function
cumprod!(y::AbstractVector, x::AbstractVector)

Cumulative product of a vector x, storing the result in y. See also cumprod.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
cumprod!(B, A; dims::Integer)

Cumulative product of A along the dimension dims, storing the result in B. See also cumprod.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.cumsumFunction
cumsum(itr)

Cumulative sum of an iterator.

See also accumulate to apply functions other than +.

Julia 1.5

cumsum on a non-array iterator requires at least Julia 1.5.

Examples

julia> cumsum(1:3)
 3-element Vector{Int64}:
  1
  3
@@ -1602,7 +1602,7 @@
 3-element Vector{Vector{Int64}}:
  [1, 1]
  [2, 2]
- [3, 3]
source
cumsum(A; dims::Integer)

Cumulative sum along the dimension dims. See also cumsum! to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow).

Examples

julia> a = [1 2 3; 4 5 6]
+ [3, 3]
source
cumsum(A; dims::Integer)

Cumulative sum along the dimension dims. See also cumsum! to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow).

Examples

julia> a = [1 2 3; 4 5 6]
 2×3 Matrix{Int64}:
  1  2  3
  4  5  6
@@ -1623,7 +1623,7 @@
 julia> accumulate(+,Int8[100, 28])
 2-element Vector{Int8}:
   100
- -128

In the former case, the integers are widened to system word size and therefore the result is Int64[100, 128]. In the latter case, no such widening happens and integer overflow results in Int8[100, -128].

source
Base.cumsum!Function
cumsum!(B, A; dims::Integer)

Cumulative sum of A along the dimension dims, storing the result in B. See also cumsum.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.diffFunction
diff(A::AbstractVector)
+ -128

In the former case, the integers are widened to system word size and therefore the result is Int64[100, 128]. In the latter case, no such widening happens and integer overflow results in Int8[100, -128].

source
Base.cumsum!Function
cumsum!(B, A; dims::Integer)

Cumulative sum of A along the dimension dims, storing the result in B. See also cumsum.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.diffFunction
diff(A::AbstractVector)
 diff(A::AbstractArray; dims::Integer)

Finite difference operator on a vector or a multidimensional array A. In the latter case the dimension to operate on needs to be specified with the dims keyword argument.

Julia 1.1

diff for arrays with dimension higher than 2 requires at least Julia 1.1.

Examples

julia> a = [2 4; 6 16]
 2×2 Matrix{Int64}:
  2   4
@@ -1638,9 +1638,9 @@
 3-element Vector{Int64}:
   4
  -2
- 12
source
Base.repeatFunction
repeat(c::AbstractChar, r::Integer) -> String

Repeat a character r times. This can equivalently be accomplished by calling c^r.

Examples

julia> repeat('A', 3)
-"AAA"
source
repeat(s::AbstractString, r::Integer)

Repeat a string r times. This can be written as s^r.

See also ^.

Examples

julia> repeat("ha", 3)
-"hahaha"
source
repeat(A::AbstractArray; inner=ntuple(Returns(1), ndims(A)), outer=ntuple(Returns(1), ndims(A)))

Construct an array by repeating the entries of A. The i-th element of inner specifies the number of times that the individual entries of the i-th dimension of A should be repeated. The i-th element of outer specifies the number of times that a slice along the i-th dimension of A should be repeated. If inner or outer are omitted, no repetition is performed.

Examples

julia> repeat(1:2, inner=2)
+ 12
source
Base.repeatFunction
repeat(c::AbstractChar, r::Integer) -> String

Repeat a character r times. This can equivalently be accomplished by calling c^r.

Examples

julia> repeat('A', 3)
+"AAA"
source
repeat(s::AbstractString, r::Integer)

Repeat a string r times. This can be written as s^r.

See also ^.

Examples

julia> repeat("ha", 3)
+"hahaha"
source
repeat(A::AbstractArray; inner=ntuple(Returns(1), ndims(A)), outer=ntuple(Returns(1), ndims(A)))

Construct an array by repeating the entries of A. The i-th element of inner specifies the number of times that the individual entries of the i-th dimension of A should be repeated. The i-th element of outer specifies the number of times that a slice along the i-th dimension of A should be repeated. If inner or outer are omitted, no repetition is performed.

Examples

julia> repeat(1:2, inner=2)
 4-element Vector{Int64}:
  1
  1
@@ -1659,7 +1659,7 @@
  1  2  1  2  1  2
  1  2  1  2  1  2
  3  4  3  4  3  4
- 3  4  3  4  3  4
source
repeat(A::AbstractArray, counts::Integer...)

Construct an array by repeating array A a given number of times in each dimension, specified by counts.

See also: fill, Iterators.repeated, Iterators.cycle.

Examples

julia> repeat([1, 2, 3], 2)
+ 3  4  3  4  3  4
source
repeat(A::AbstractArray, counts::Integer...)

Construct an array by repeating array A a given number of times in each dimension, specified by counts.

See also: fill, Iterators.repeated, Iterators.cycle.

Examples

julia> repeat([1, 2, 3], 2)
 6-element Vector{Int64}:
  1
  2
@@ -1675,7 +1675,7 @@
  3  3  3
  1  1  1
  2  2  2
- 3  3  3
source
Base.rot180Function
rot180(A, k)

Rotate matrix A 180 degrees an integer k number of times. If k is even, this is equivalent to a copy.

Examples

julia> a = [1 2; 3 4]
+ 3  3  3
source
Base.rot180Function
rot180(A, k)

Rotate matrix A 180 degrees an integer k number of times. If k is even, this is equivalent to a copy.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1688,7 +1688,7 @@
 julia> rot180(a,2)
 2×2 Matrix{Int64}:
  1  2
- 3  4
source
rot180(A)

Rotate matrix A 180 degrees.

Examples

julia> a = [1 2; 3 4]
+ 3  4
source
rot180(A)

Rotate matrix A 180 degrees.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1696,7 +1696,7 @@
 julia> rot180(a)
 2×2 Matrix{Int64}:
  4  3
- 2  1
source
Base.rotl90Function
rotl90(A, k)

Left-rotate matrix A 90 degrees counterclockwise an integer k number of times. If k is a multiple of four (including zero), this is equivalent to a copy.

Examples

julia> a = [1 2; 3 4]
+ 2  1
source
Base.rotl90Function
rotl90(A, k)

Left-rotate matrix A 90 degrees counterclockwise an integer k number of times. If k is a multiple of four (including zero), this is equivalent to a copy.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1719,7 +1719,7 @@
 julia> rotl90(a,4)
 2×2 Matrix{Int64}:
  1  2
- 3  4
source
rotl90(A)

Rotate matrix A left 90 degrees.

Examples

julia> a = [1 2; 3 4]
+ 3  4
source
rotl90(A)

Rotate matrix A left 90 degrees.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1727,7 +1727,7 @@
 julia> rotl90(a)
 2×2 Matrix{Int64}:
  2  4
- 1  3
source
Base.rotr90Function
rotr90(A, k)

Right-rotate matrix A 90 degrees clockwise an integer k number of times. If k is a multiple of four (including zero), this is equivalent to a copy.

Examples

julia> a = [1 2; 3 4]
+ 1  3
source
Base.rotr90Function
rotr90(A, k)

Right-rotate matrix A 90 degrees clockwise an integer k number of times. If k is a multiple of four (including zero), this is equivalent to a copy.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1750,7 +1750,7 @@
 julia> rotr90(a,4)
 2×2 Matrix{Int64}:
  1  2
- 3  4
source
rotr90(A)

Rotate matrix A right 90 degrees.

Examples

julia> a = [1 2; 3 4]
+ 3  4
source
rotr90(A)

Rotate matrix A right 90 degrees.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1758,7 +1758,7 @@
 julia> rotr90(a)
 2×2 Matrix{Int64}:
  3  1
- 4  2
source
Base.mapslicesFunction
mapslices(f, A; dims)

Transform the given dimensions of array A by applying a function f on each slice of the form A[..., :, ..., :, ...], with a colon at each d in dims. The results are concatenated along the remaining dimensions.

For example, if dims = [1,2] and A is 4-dimensional, then f is called on x = A[:,:,i,j] for all i and j, and f(x) becomes R[:,:,i,j] in the result R.

See also eachcol or eachslice, used with map or stack.

Examples

julia> A = reshape(1:30,(2,5,3))
+ 4  2
source
Base.mapslicesFunction
mapslices(f, A; dims)

Transform the given dimensions of array A by applying a function f on each slice of the form A[..., :, ..., :, ...], with a colon at each d in dims. The results are concatenated along the remaining dimensions.

For example, if dims = [1,2] and A is 4-dimensional, then f is called on x = A[:,:,i,j] for all i and j, and f(x) becomes R[:,:,i,j] in the result R.

See also eachcol or eachslice, used with map or stack.

Examples

julia> A = reshape(1:30,(2,5,3))
 2×5×3 reshape(::UnitRange{Int64}, 2, 5, 3) with eltype Int64:
 [:, :, 1] =
  1  3  5  7   9
@@ -1806,7 +1806,7 @@
  9//29
 
 julia> mapslices(sum, A; dims=(1,3)) == sum(A; dims=(1,3))
-true

Notice that in eachslice(A; dims=2), the specified dimension is the one without a colon in the slice. This is view(A,:,i,:), whereas mapslices(f, A; dims=(1,3)) uses A[:,i,:]. The function f may mutate values in the slice without affecting A.

source
Base.eachrowFunction
eachrow(A::AbstractVecOrMat) <: AbstractVector

Create a RowSlices object that is a vector of rows of matrix or vector A. Row slices are returned as AbstractVector views of A.

For the inverse, see stack(rows; dims=1).

See also eachcol, eachslice and mapslices.

Julia 1.1

This function requires at least Julia 1.1.

Julia 1.9

Prior to Julia 1.9, this returned an iterator.

Examples

julia> a = [1 2; 3 4]
+true

Notice that in eachslice(A; dims=2), the specified dimension is the one without a colon in the slice. This is view(A,:,i,:), whereas mapslices(f, A; dims=(1,3)) uses A[:,i,:]. The function f may mutate values in the slice without affecting A.

source
Base.eachrowFunction
eachrow(A::AbstractVecOrMat) <: AbstractVector

Create a RowSlices object that is a vector of rows of matrix or vector A. Row slices are returned as AbstractVector views of A.

For the inverse, see stack(rows; dims=1).

See also eachcol, eachslice and mapslices.

Julia 1.1

This function requires at least Julia 1.1.

Julia 1.9

Prior to Julia 1.9, this returned an iterator.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1819,7 +1819,7 @@
 julia> s[1]
 2-element view(::Matrix{Int64}, 1, :) with eltype Int64:
  1
- 2
source
Base.eachcolFunction
eachcol(A::AbstractVecOrMat) <: AbstractVector

Create a ColumnSlices object that is a vector of columns of matrix or vector A. Column slices are returned as AbstractVector views of A.

For the inverse, see stack(cols) or reduce(hcat, cols).

See also eachrow, eachslice and mapslices.

Julia 1.1

This function requires at least Julia 1.1.

Julia 1.9

Prior to Julia 1.9, this returned an iterator.

Examples

julia> a = [1 2; 3 4]
+ 2
source
Base.eachcolFunction
eachcol(A::AbstractVecOrMat) <: AbstractVector

Create a ColumnSlices object that is a vector of columns of matrix or vector A. Column slices are returned as AbstractVector views of A.

For the inverse, see stack(cols) or reduce(hcat, cols).

See also eachrow, eachslice and mapslices.

Julia 1.1

This function requires at least Julia 1.1.

Julia 1.9

Prior to Julia 1.9, this returned an iterator.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1832,7 +1832,7 @@
 julia> s[1]
 2-element view(::Matrix{Int64}, :, 1) with eltype Int64:
  1
- 3
source
Base.eachsliceFunction
eachslice(A::AbstractArray; dims, drop=true)

Create a Slices object that is an array of slices over dimensions dims of A, returning views that select all the data from the other dimensions in A. dims can either be an integer or a tuple of integers.

If drop = true (the default), the outer Slices will drop the inner dimensions, and the ordering of the dimensions will match those in dims. If drop = false, then the Slices will have the same dimensionality as the underlying array, with inner dimensions having size 1.

See stack(slices; dims) for the inverse of eachslice(A; dims::Integer).

See also eachrow, eachcol, mapslices and selectdim.

Julia 1.1

This function requires at least Julia 1.1.

Julia 1.9

Prior to Julia 1.9, this returned an iterator, and only a single dimension dims was supported.

Examples

julia> m = [1 2 3; 4 5 6; 7 8 9]
+ 3
source
Base.eachsliceFunction
eachslice(A::AbstractArray; dims, drop=true)

Create a Slices object that is an array of slices over dimensions dims of A, returning views that select all the data from the other dimensions in A. dims can either be an integer or a tuple of integers.

If drop = true (the default), the outer Slices will drop the inner dimensions, and the ordering of the dimensions will match those in dims. If drop = false, then the Slices will have the same dimensionality as the underlying array, with inner dimensions having size 1.

See stack(slices; dims) for the inverse of eachslice(A; dims::Integer).

See also eachrow, eachcol, mapslices and selectdim.

Julia 1.1

This function requires at least Julia 1.1.

Julia 1.9

Prior to Julia 1.9, this returned an iterator, and only a single dimension dims was supported.

Examples

julia> m = [1 2 3; 4 5 6; 7 8 9]
 3×3 Matrix{Int64}:
  1  2  3
  4  5  6
@@ -1854,7 +1854,7 @@
 3×1 Slices{Matrix{Int64}, Tuple{Int64, Colon}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, SubArray{Int64, 1, Matrix{Int64}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}, 2}:
  [1, 2, 3]
  [4, 5, 6]
- [7, 8, 9]
source

Combinatorics

Base.invpermFunction
invperm(v)

Return the inverse permutation of v. If B = A[v], then A == B[invperm(v)].

See also sortperm, invpermute!, isperm, permutedims.

Examples

julia> p = (2, 3, 1);
+ [7, 8, 9]
source

Combinatorics

Base.invpermFunction
invperm(v)

Return the inverse permutation of v. If B = A[v], then A == B[invperm(v)].

See also sortperm, invpermute!, isperm, permutedims.

Examples

julia> p = (2, 3, 1);
 
 julia> invperm(p)
 (3, 1, 2)
@@ -1882,11 +1882,11 @@
  'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
  'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)
  'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase)
- 'd': ASCII/Unicode U+0064 (category Ll: Letter, lowercase)
source
Base.ispermFunction
isperm(v) -> Bool

Return true if v is a valid permutation.

Examples

julia> isperm([1; 2])
+ 'd': ASCII/Unicode U+0064 (category Ll: Letter, lowercase)
source
Base.ispermFunction
isperm(v) -> Bool

Return true if v is a valid permutation.

Examples

julia> isperm([1; 2])
 true
 
 julia> isperm([1; 3])
-false
source
Base.permute!Method
permute!(v, p)

Permute vector v in-place, according to permutation p. No checking is done to verify that p is a permutation.

To return a new permutation, use v[p]. This is generally faster than permute!(v, p); it is even faster to write into a pre-allocated output array with u .= @view v[p]. (Even though permute! overwrites v in-place, it internally requires some allocation to keep track of which elements have been moved.)

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also invpermute!.

Examples

julia> A = [1, 1, 3, 4];
+false
source
Base.permute!Method
permute!(v, p)

Permute vector v in-place, according to permutation p. No checking is done to verify that p is a permutation.

To return a new permutation, use v[p]. This is generally faster than permute!(v, p); it is even faster to write into a pre-allocated output array with u .= @view v[p]. (Even though permute! overwrites v in-place, it internally requires some allocation to keep track of which elements have been moved.)

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also invpermute!.

Examples

julia> A = [1, 1, 3, 4];
 
 julia> perm = [2, 4, 3, 1];
 
@@ -1897,7 +1897,7 @@
  1
  4
  3
- 1
source
Base.invpermute!Function
invpermute!(v, p)

Like permute!, but the inverse of the given permutation is applied.

Note that if you have a pre-allocated output array (e.g. u = similar(v)), it is quicker to instead employ u[p] = v. (invpermute! internally allocates a copy of the data.)

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1, 1, 3, 4];
+ 1
source
Base.invpermute!Function
invpermute!(v, p)

Like permute!, but the inverse of the given permutation is applied.

Note that if you have a pre-allocated output array (e.g. u = similar(v)), it is quicker to instead employ u[p] = v. (invpermute! internally allocates a copy of the data.)

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1, 1, 3, 4];
 
 julia> perm = [2, 4, 3, 1];
 
@@ -1908,7 +1908,7 @@
  4
  1
  3
- 1
source
Base.reverseMethod
reverse(A; dims=:)

Reverse A along dimension dims, which can be an integer (a single dimension), a tuple of integers (a tuple of dimensions) or : (reverse along all the dimensions, the default). See also reverse! for in-place reversal.

Examples

julia> b = Int64[1 2; 3 4]
+ 1
source
Base.reverseMethod
reverse(A; dims=:)

Reverse A along dimension dims, which can be an integer (a single dimension), a tuple of integers (a tuple of dimensions) or : (reverse along all the dimensions, the default). See also reverse! for in-place reversal.

Examples

julia> b = Int64[1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1921,7 +1921,7 @@
 julia> reverse(b)
 2×2 Matrix{Int64}:
  4  3
- 2  1
Julia 1.6

Prior to Julia 1.6, only single-integer dims are supported in reverse.

source
Base.reverseindFunction
reverseind(v, i)

Given an index i in reverse(v), return the corresponding index in v so that v[reverseind(v,i)] == reverse(v)[i]. (This can be nontrivial in cases where v contains non-ASCII characters.)

Examples

julia> s = "Julia🚀"
+ 2  1
Julia 1.6

Prior to Julia 1.6, only single-integer dims are supported in reverse.

source
Base.reverseindFunction
reverseind(v, i)

Given an index i in reverse(v), return the corresponding index in v so that v[reverseind(v,i)] == reverse(v)[i]. (This can be nontrivial in cases where v contains non-ASCII characters.)

Examples

julia> s = "Julia🚀"
 "Julia🚀"
 
 julia> r = reverse(s)
@@ -1930,7 +1930,7 @@
 julia> for i in eachindex(s)
            print(r[reverseind(r, i)])
        end
-Julia🚀
source
Base.reverse!Function
reverse!(A; dims=:)

Like reverse, but operates in-place in A.

Julia 1.6

Multidimensional reverse! requires Julia 1.6.

source
reverse!(v [, start=firstindex(v) [, stop=lastindex(v) ]]) -> v

In-place version of reverse.

Examples

julia> A = Vector(1:5)
+Julia🚀
source
Base.reverse!Function
reverse!(A; dims=:)

Like reverse, but operates in-place in A.

Julia 1.6

Multidimensional reverse! requires Julia 1.6.

source
reverse!(v [, start=firstindex(v) [, stop=lastindex(v) ]]) -> v

In-place version of reverse.

Examples

julia> A = Vector(1:5)
 5-element Vector{Int64}:
  1
  2
@@ -1946,4 +1946,4 @@
  4
  3
  2
- 1
source
+ 1
source diff --git a/en/v1.12-dev/base/base/index.html b/en/v1.12-dev/base/base/index.html index 5ea5d6aa89c..a2037b94f4a 100644 --- a/en/v1.12-dev/base/base/index.html +++ b/en/v1.12-dev/base/base/index.html @@ -3,19 +3,19 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Essentials

Introduction

Julia Base contains a range of functions and macros appropriate for performing scientific and numerical computing, but is also as broad as those of many general purpose programming languages. Additional functionality is available from a growing collection of available packages. Functions are grouped by topic below.

Some general notes:

  • To use module functions, use import Module to import the module, and Module.fn(x) to use the functions.
  • Alternatively, using Module will import all exported Module functions into the current namespace.
  • By convention, function names ending with an exclamation point (!) modify their arguments. Some functions have both modifying (e.g., sort!) and non-modifying (sort) versions.

The behaviors of Base and standard libraries are stable as defined in SemVer only if they are documented; i.e., included in the Julia documentation and not marked as unstable. See API FAQ for more information.

Getting Around

Base.exitFunction
exit(code=0)

Stop the program with an exit code. The default exit code is zero, indicating that the program completed successfully. In an interactive session, exit() can be called with the keyboard shortcut ^D.

source
Base.atexitFunction
atexit(f)

Register a zero- or one-argument function f() to be called at process exit. atexit() hooks are called in last in first out (LIFO) order and run before object finalizers.

If f has a method defined for one integer argument, it will be called as f(n::Int32), where n is the current exit code, otherwise it will be called as f().

Julia 1.9

The one-argument form requires Julia 1.9

Exit hooks are allowed to call exit(n), in which case Julia will exit with exit code n (instead of the original exit code). If more than one exit hook calls exit(n), then Julia will exit with the exit code corresponding to the last called exit hook that calls exit(n). (Because exit hooks are called in LIFO order, "last called" is equivalent to "first registered".)

Note: Once all exit hooks have been called, no more exit hooks can be registered, and any call to atexit(f) after all hooks have completed will throw an exception. This situation may occur if you are registering exit hooks from background Tasks that may still be executing concurrently during shutdown.

source
Base.summarysizeFunction
Base.summarysize(obj; exclude=Union{...}, chargeall=Union{...}) -> Int

Compute the amount of memory, in bytes, used by all unique objects reachable from the argument.

Keyword Arguments

  • exclude: specifies the types of objects to exclude from the traversal.
  • chargeall: specifies the types of objects to always charge the size of all of their fields, even if those fields would normally be excluded.

See also sizeof.

Examples

julia> Base.summarysize(1.0)
+

Essentials

Introduction

Julia Base contains a range of functions and macros appropriate for performing scientific and numerical computing, but is also as broad as those of many general purpose programming languages. Additional functionality is available from a growing collection of available packages. Functions are grouped by topic below.

Some general notes:

  • To use module functions, use import Module to import the module, and Module.fn(x) to use the functions.
  • Alternatively, using Module will import all exported Module functions into the current namespace.
  • By convention, function names ending with an exclamation point (!) modify their arguments. Some functions have both modifying (e.g., sort!) and non-modifying (sort) versions.

The behaviors of Base and standard libraries are stable as defined in SemVer only if they are documented; i.e., included in the Julia documentation and not marked as unstable. See API FAQ for more information.

Getting Around

Base.exitFunction
exit(code=0)

Stop the program with an exit code. The default exit code is zero, indicating that the program completed successfully. In an interactive session, exit() can be called with the keyboard shortcut ^D.

source
Base.atexitFunction
atexit(f)

Register a zero- or one-argument function f() to be called at process exit. atexit() hooks are called in last in first out (LIFO) order and run before object finalizers.

If f has a method defined for one integer argument, it will be called as f(n::Int32), where n is the current exit code, otherwise it will be called as f().

Julia 1.9

The one-argument form requires Julia 1.9

Exit hooks are allowed to call exit(n), in which case Julia will exit with exit code n (instead of the original exit code). If more than one exit hook calls exit(n), then Julia will exit with the exit code corresponding to the last called exit hook that calls exit(n). (Because exit hooks are called in LIFO order, "last called" is equivalent to "first registered".)

Note: Once all exit hooks have been called, no more exit hooks can be registered, and any call to atexit(f) after all hooks have completed will throw an exception. This situation may occur if you are registering exit hooks from background Tasks that may still be executing concurrently during shutdown.

source
Base.summarysizeFunction
Base.summarysize(obj; exclude=Union{...}, chargeall=Union{...}) -> Int

Compute the amount of memory, in bytes, used by all unique objects reachable from the argument.

Keyword Arguments

  • exclude: specifies the types of objects to exclude from the traversal.
  • chargeall: specifies the types of objects to always charge the size of all of their fields, even if those fields would normally be excluded.

See also sizeof.

Examples

julia> Base.summarysize(1.0)
 8
 
 julia> Base.summarysize(Ref(rand(100)))
 848
 
 julia> sizeof(Ref(rand(100)))
-8
source
Base.__precompile__Function
__precompile__(isprecompilable::Bool)

Specify whether the file calling this function is precompilable, defaulting to true. If a module or file is not safely precompilable, it should call __precompile__(false) in order to throw an error if Julia attempts to precompile it.

source
Base.includeFunction
Base.include([mapexpr::Function,] m::Module, path::AbstractString)

Evaluate the contents of the input source file in the global scope of module m. Every module (except those defined with baremodule) has its own definition of include omitting the m argument, which evaluates the file in that module. Returns the result of the last evaluated expression of the input file. During including, a task-local include path is set to the directory containing the file. Nested calls to include will search relative to that path. This function is typically used to load source interactively, or to combine files in packages that are broken into multiple source files.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in path, the include function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Julia 1.5

Julia 1.5 is required for passing the mapexpr argument.

source
includeFunction
include([mapexpr::Function,] path::AbstractString)

Evaluate the contents of the input source file in the global scope of the containing module. Every module (except those defined with baremodule) has its own definition of include, which evaluates the file in that module. Returns the result of the last evaluated expression of the input file. During including, a task-local include path is set to the directory containing the file. Nested calls to include will search relative to that path. This function is typically used to load source interactively, or to combine files in packages that are broken into multiple source files. The argument path is normalized using normpath which will resolve relative path tokens such as .. and convert / to the appropriate path separator.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in path, the include function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Use Base.include to evaluate a file into another module.

Note

Julia's syntax lowering recognizes an explicit call to a literal include at top-level and inserts an implicit @Core.latestworld to make any include'd definitions visible to subsequent code. Note however that this recognition is syntactic. I.e. assigning const myinclude = include may require and explicit @Core.latestworld call after myinclude.

Julia 1.5

Julia 1.5 is required for passing the mapexpr argument.

source
Base.include_stringFunction
include_string([mapexpr::Function,] m::Module, code::AbstractString, filename::AbstractString="string")

Like include, except reads code from the given string rather than from a file.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in code, the include_string function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Julia 1.5

Julia 1.5 is required for passing the mapexpr argument.

source
Base.include_dependencyFunction
include_dependency(path::AbstractString; track_content::Bool=true)

In a module, declare that the file, directory, or symbolic link specified by path (relative or absolute) is a dependency for precompilation; that is, if track_content=true the module will need to be recompiled if the content of path changes (if path is a directory the content equals join(readdir(path))). If track_content=false recompilation is triggered when the modification time mtime of path changes.

This is only needed if your module depends on a path that is not used via include. It has no effect outside of compilation.

Julia 1.11

Keyword argument track_content requires at least Julia 1.11. An error is now thrown if path is not readable.

source
__init__Keyword
__init__

The __init__() function in a module executes immediately after the module is loaded at runtime for the first time. It is called once, after all other statements in the module have been executed. Because it is called after fully importing the module, __init__ functions of submodules will be executed first. Two typical uses of __init__ are calling runtime initialization functions of external C libraries and initializing global constants that involve pointers returned by external libraries. See the manual section about modules for more details.

See also: OncePerProcess.

Examples

const foo_data_ptr = Ref{Ptr{Cvoid}}(0)
+8
source
Base.__precompile__Function
__precompile__(isprecompilable::Bool)

Specify whether the file calling this function is precompilable, defaulting to true. If a module or file is not safely precompilable, it should call __precompile__(false) in order to throw an error if Julia attempts to precompile it.

source
Base.includeFunction
Base.include([mapexpr::Function,] m::Module, path::AbstractString)

Evaluate the contents of the input source file in the global scope of module m. Every module (except those defined with baremodule) has its own definition of include omitting the m argument, which evaluates the file in that module. Returns the result of the last evaluated expression of the input file. During including, a task-local include path is set to the directory containing the file. Nested calls to include will search relative to that path. This function is typically used to load source interactively, or to combine files in packages that are broken into multiple source files.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in path, the include function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Julia 1.5

Julia 1.5 is required for passing the mapexpr argument.

source
includeFunction
include([mapexpr::Function,] path::AbstractString)

Evaluate the contents of the input source file in the global scope of the containing module. Every module (except those defined with baremodule) has its own definition of include, which evaluates the file in that module. Returns the result of the last evaluated expression of the input file. During including, a task-local include path is set to the directory containing the file. Nested calls to include will search relative to that path. This function is typically used to load source interactively, or to combine files in packages that are broken into multiple source files. The argument path is normalized using normpath which will resolve relative path tokens such as .. and convert / to the appropriate path separator.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in path, the include function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Use Base.include to evaluate a file into another module.

Note

Julia's syntax lowering recognizes an explicit call to a literal include at top-level and inserts an implicit @Core.latestworld to make any include'd definitions visible to subsequent code. Note however that this recognition is syntactic. I.e. assigning const myinclude = include may require and explicit @Core.latestworld call after myinclude.

Julia 1.5

Julia 1.5 is required for passing the mapexpr argument.

source
Base.include_stringFunction
include_string([mapexpr::Function,] m::Module, code::AbstractString, filename::AbstractString="string")

Like include, except reads code from the given string rather than from a file.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in code, the include_string function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Julia 1.5

Julia 1.5 is required for passing the mapexpr argument.

source
Base.include_dependencyFunction
include_dependency(path::AbstractString; track_content::Bool=true)

In a module, declare that the file, directory, or symbolic link specified by path (relative or absolute) is a dependency for precompilation; that is, if track_content=true the module will need to be recompiled if the content of path changes (if path is a directory the content equals join(readdir(path))). If track_content=false recompilation is triggered when the modification time mtime of path changes.

This is only needed if your module depends on a path that is not used via include. It has no effect outside of compilation.

Julia 1.11

Keyword argument track_content requires at least Julia 1.11. An error is now thrown if path is not readable.

source
__init__Keyword
__init__

The __init__() function in a module executes immediately after the module is loaded at runtime for the first time. It is called once, after all other statements in the module have been executed. Because it is called after fully importing the module, __init__ functions of submodules will be executed first. Two typical uses of __init__ are calling runtime initialization functions of external C libraries and initializing global constants that involve pointers returned by external libraries. See the manual section about modules for more details.

See also: OncePerProcess.

Examples

const foo_data_ptr = Ref{Ptr{Cvoid}}(0)
 function __init__()
     ccall((:foo_init, :libfoo), Cvoid, ())
     foo_data_ptr[] = ccall((:foo_data, :libfoo), Ptr{Cvoid}, ())
     nothing
-end
source
Base.OncePerProcessType
OncePerProcess{T}(init::Function)() -> T

Calling a OncePerProcess object returns a value of type T by running the function initializer exactly once per process. All concurrent and future calls in the same process will return exactly the same value. This is useful in code that will be precompiled, as it allows setting up caches or other state which won't get serialized.

Example

julia> const global_state = Base.OncePerProcess{Vector{UInt32}}() do
+end
source
Base.OncePerProcessType
OncePerProcess{T}(init::Function)() -> T

Calling a OncePerProcess object returns a value of type T by running the function initializer exactly once per process. All concurrent and future calls in the same process will return exactly the same value. This is useful in code that will be precompiled, as it allows setting up caches or other state which won't get serialized.

Example

julia> const global_state = Base.OncePerProcess{Vector{UInt32}}() do
            println("Making lazy global value...done.")
            return [Libc.rand()]
        end;
@@ -28,7 +28,7 @@
 true
 
 julia> procstate === fetch(@async global_state())
-true
source
Base.OncePerTaskType
OncePerTask{T}(init::Function)() -> T

Calling a OncePerTask object returns a value of type T by running the function initializer exactly once per Task. All future calls in the same Task will return exactly the same value.

See also: task_local_storage.

Example

julia> const task_state = Base.OncePerTask{Vector{UInt32}}() do
+true
source
Base.OncePerTaskType
OncePerTask{T}(init::Function)() -> T

Calling a OncePerTask object returns a value of type T by running the function initializer exactly once per Task. All future calls in the same Task will return exactly the same value.

See also: task_local_storage.

Example

julia> const task_state = Base.OncePerTask{Vector{UInt32}}() do
            println("Making lazy task value...done.")
            return [Libc.rand()]
        end;
@@ -42,7 +42,7 @@
 
 julia> taskvec === fetch(@async task_state())
 Making lazy task value...done.
-false
source
Base.OncePerThreadType
OncePerThread{T}(init::Function)() -> T

Calling a OncePerThread object returns a value of type T by running the function initializer exactly once per thread. All future calls in the same thread, and concurrent or future calls with the same thread id, will return exactly the same value. The object can also be indexed by the threadid for any existing thread, to get (or initialize on this thread) the value stored for that thread. Incorrect usage can lead to data-races or memory corruption so use only if that behavior is correct within your library's threading-safety design.

Warning

It is not necessarily true that a Task only runs on one thread, therefore the value returned here may alias other values or change in the middle of your program. This function may get deprecated in the future. If initializer yields, the thread running the current task after the call might not be the same as the one at the start of the call.

See also: OncePerTask.

Example

julia> const thread_state = Base.OncePerThread{Vector{UInt32}}() do
+false
source
Base.OncePerThreadType
OncePerThread{T}(init::Function)() -> T

Calling a OncePerThread object returns a value of type T by running the function initializer exactly once per thread. All future calls in the same thread, and concurrent or future calls with the same thread id, will return exactly the same value. The object can also be indexed by the threadid for any existing thread, to get (or initialize on this thread) the value stored for that thread. Incorrect usage can lead to data-races or memory corruption so use only if that behavior is correct within your library's threading-safety design.

Warning

It is not necessarily true that a Task only runs on one thread, therefore the value returned here may alias other values or change in the middle of your program. This function may get deprecated in the future. If initializer yields, the thread running the current task after the call might not be the same as the one at the start of the call.

See also: OncePerTask.

Example

julia> const thread_state = Base.OncePerThread{Vector{UInt32}}() do
            println("Making lazy thread value...done.")
            return [Libc.rand()]
        end;
@@ -55,13 +55,13 @@
 true
 
 julia> threadvec === thread_state[Threads.threadid()]
-true
source
Base.whichMethod
which(f, types)

Returns the method of f (a Method object) that would be called for arguments of the given types.

If types is an abstract type, then the method that would be called by invoke is returned.

See also: parentmodule, @which, and @edit.

source
Base.methodsFunction
methods(f, [types], [module])

Return the method table for f.

If types is specified, return an array of methods whose types match. If module is specified, return an array of methods defined in that module. A list of modules can also be specified as an array.

Julia 1.4

At least Julia 1.4 is required for specifying a module.

See also: which, @which and methodswith.

source
Base.@showMacro
@show exs...

Prints one or more expressions, and their results, to stdout, and returns the last result.

See also: show, @info, println.

Examples

julia> x = @show 1+2
+true
source
Base.whichMethod
which(f, types)

Returns the method of f (a Method object) that would be called for arguments of the given types.

If types is an abstract type, then the method that would be called by invoke is returned.

See also: parentmodule, @which, and @edit.

source
Base.methodsFunction
methods(f, [types], [module])

Return the method table for f.

If types is specified, return an array of methods whose types match. If module is specified, return an array of methods defined in that module. A list of modules can also be specified as an array.

Julia 1.4

At least Julia 1.4 is required for specifying a module.

See also: which, @which and methodswith.

source
Base.@showMacro
@show exs...

Prints one or more expressions, and their results, to stdout, and returns the last result.

See also: show, @info, println.

Examples

julia> x = @show 1+2
 1 + 2 = 3
 3
 
 julia> @show x^2 x/2;
 x ^ 2 = 9
-x / 2 = 1.5
source
Base.MainInclude.ansConstant
ans

A variable referring to the last computed value, automatically imported to the interactive prompt.

source
Base.MainInclude.errConstant
err

A variable referring to the last thrown errors, automatically imported to the interactive prompt. The thrown errors are collected in a stack of exceptions.

source

Keywords

This is the list of reserved keywords in Julia: baremodule, begin, break, catch, const, continue, do, else, elseif, end, export, false, finally, for, function, global, if, import, let, local, macro, module, quote, return, struct, true, try, using, while. Those keywords are not allowed to be used as variable names.

The following two-word sequences are reserved: abstract type, mutable struct, primitive type. However, you can create variables with names: abstract, mutable, primitive and type.

Finally: where is parsed as an infix operator for writing parametric method and type definitions; in and isa are parsed as infix operators; public is parsed as a keyword when beginning a toplevel statement; outer is parsed as a keyword when used to modify the scope of a variable in an iteration specification of a for loop; and as is used as a keyword to rename an identifier brought into scope by import or using. Creation of variables named where, in, isa, outer and as is allowed, though.

moduleKeyword
module

module declares a Module, which is a separate global variable workspace. Within a module, you can control which names from other modules are visible (via importing), and specify which of your names are intended to be public (via export and public). Modules allow you to create top-level definitions without worrying about name conflicts when your code is used together with somebody else’s. See the manual section about modules for more details.

Examples

module Foo
+x / 2 = 1.5
source
Base.MainInclude.ansConstant
ans

A variable referring to the last computed value, automatically imported to the interactive prompt.

source
Base.MainInclude.errConstant
err

A variable referring to the last thrown errors, automatically imported to the interactive prompt. The thrown errors are collected in a stack of exceptions.

source

Keywords

This is the list of reserved keywords in Julia: baremodule, begin, break, catch, const, continue, do, else, elseif, end, export, false, finally, for, function, global, if, import, let, local, macro, module, quote, return, struct, true, try, using, while. Those keywords are not allowed to be used as variable names.

The following two-word sequences are reserved: abstract type, mutable struct, primitive type. However, you can create variables with names: abstract, mutable, primitive and type.

Finally: where is parsed as an infix operator for writing parametric method and type definitions; in and isa are parsed as infix operators; public is parsed as a keyword when beginning a toplevel statement; outer is parsed as a keyword when used to modify the scope of a variable in an iteration specification of a for loop; and as is used as a keyword to rename an identifier brought into scope by import or using. Creation of variables named where, in, isa, outer and as is allowed, though.

moduleKeyword
module

module declares a Module, which is a separate global variable workspace. Within a module, you can control which names from other modules are visible (via importing), and specify which of your names are intended to be public (via export and public). Modules allow you to create top-level definitions without worrying about name conflicts when your code is used together with somebody else’s. See the manual section about modules for more details.

Examples

module Foo
 import Base.show
 export MyType, foo
 
@@ -72,7 +72,7 @@
 bar(x) = 2x
 foo(a::MyType) = bar(a.x) + 1
 show(io::IO, a::MyType) = print(io, "MyType $(a.x)")
-end
source
exportKeyword
export

export is used within modules to tell Julia which names should be made available to the user. For example: export foo makes the name foo available when using the module. See the manual section about modules for details.

source
publicKeyword
public

public is used within modules to tell Julia which names are part of the public API of the module. For example: public foo indicates that the name foo is public, without making it available when using the module.

As export already indicates that a name is public, it is unnecessary and an error to declare a name both as public and as exported. See the manual section about modules for details.

Julia 1.11

The public keyword was added in Julia 1.11. Prior to this the notion of publicness was less explicit.

source
importKeyword
import

import Foo will load the module or package Foo. Names from the imported Foo module can be accessed with dot syntax (e.g. Foo.foo to access the name foo). See the manual section about modules for details.

source
usingKeyword
using

using Foo will load the module or package Foo and make its exported names available for direct use. Names can also be used via dot syntax (e.g. Foo.foo to access the name foo), whether they are exported or not. See the manual section about modules for details.

Note

When two or more packages/modules export a name and that name does not refer to the same thing in each of the packages, and the packages are loaded via using without an explicit list of names, it is an error to reference that name without qualification. It is thus recommended that code intended to be forward-compatible with future versions of its dependencies and of Julia, e.g., code in released packages, list the names it uses from each loaded package, e.g., using Foo: Foo, f rather than using Foo.

source
asKeyword
as

as is used as a keyword to rename an identifier brought into scope by import or using, for the purpose of working around name conflicts as well as for shortening names. (Outside of import or using statements, as is not a keyword and can be used as an ordinary identifier.)

import LinearAlgebra as LA brings the imported LinearAlgebra standard library into scope as LA.

import LinearAlgebra: eigen as eig, cholesky as chol brings the eigen and cholesky methods from LinearAlgebra into scope as eig and chol respectively.

as works with using only when individual identifiers are brought into scope. For example, using LinearAlgebra: eigen as eig or using LinearAlgebra: eigen as eig, cholesky as chol works, but using LinearAlgebra as LA is invalid syntax, since it is nonsensical to rename all exported names from LinearAlgebra to LA.

source
baremoduleKeyword
baremodule

baremodule declares a module that does not contain using Base or local definitions of eval and include. It does still import Core. In other words,

module Mod
+end
source
exportKeyword
export

export is used within modules to tell Julia which names should be made available to the user. For example: export foo makes the name foo available when using the module. See the manual section about modules for details.

source
publicKeyword
public

public is used within modules to tell Julia which names are part of the public API of the module. For example: public foo indicates that the name foo is public, without making it available when using the module.

As export already indicates that a name is public, it is unnecessary and an error to declare a name both as public and as exported. See the manual section about modules for details.

Julia 1.11

The public keyword was added in Julia 1.11. Prior to this the notion of publicness was less explicit.

source
importKeyword
import

import Foo will load the module or package Foo. Names from the imported Foo module can be accessed with dot syntax (e.g. Foo.foo to access the name foo). See the manual section about modules for details.

source
usingKeyword
using

using Foo will load the module or package Foo and make its exported names available for direct use. Names can also be used via dot syntax (e.g. Foo.foo to access the name foo), whether they are exported or not. See the manual section about modules for details.

Note

When two or more packages/modules export a name and that name does not refer to the same thing in each of the packages, and the packages are loaded via using without an explicit list of names, it is an error to reference that name without qualification. It is thus recommended that code intended to be forward-compatible with future versions of its dependencies and of Julia, e.g., code in released packages, list the names it uses from each loaded package, e.g., using Foo: Foo, f rather than using Foo.

source
asKeyword
as

as is used as a keyword to rename an identifier brought into scope by import or using, for the purpose of working around name conflicts as well as for shortening names. (Outside of import or using statements, as is not a keyword and can be used as an ordinary identifier.)

import LinearAlgebra as LA brings the imported LinearAlgebra standard library into scope as LA.

import LinearAlgebra: eigen as eig, cholesky as chol brings the eigen and cholesky methods from LinearAlgebra into scope as eig and chol respectively.

as works with using only when individual identifiers are brought into scope. For example, using LinearAlgebra: eigen as eig or using LinearAlgebra: eigen as eig, cholesky as chol works, but using LinearAlgebra as LA is invalid syntax, since it is nonsensical to rename all exported names from LinearAlgebra to LA.

source
baremoduleKeyword
baremodule

baremodule declares a module that does not contain using Base or local definitions of eval and include. It does still import Core. In other words,

module Mod
 
 ...
 
@@ -85,9 +85,9 @@
 
 ...
 
-end
source
functionKeyword
function

Functions are defined with the function keyword:

function add(a, b)
+end
source
functionKeyword
function

Functions are defined with the function keyword:

function add(a, b)
     return a + b
-end

Or the short form notation:

add(a, b) = a + b

The use of the return keyword is exactly the same as in other languages, but is often optional. A function without an explicit return statement will return the last expression in the function body.

source
macroKeyword
macro

macro defines a method for inserting generated code into a program. A macro maps a sequence of argument expressions to a returned expression, and the resulting expression is substituted directly into the program at the point where the macro is invoked. Macros are a way to run generated code without calling eval, since the generated code instead simply becomes part of the surrounding program. Macro arguments may include expressions, literal values, and symbols. Macros can be defined for variable number of arguments (varargs), but do not accept keyword arguments. Every macro also implicitly gets passed the arguments __source__, which contains the line number and file name the macro is called from, and __module__, which is the module the macro is expanded in.

See the manual section on Metaprogramming for more information about how to write a macro.

Examples

julia> macro sayhello(name)
+end

Or the short form notation:

add(a, b) = a + b

The use of the return keyword is exactly the same as in other languages, but is often optional. A function without an explicit return statement will return the last expression in the function body.

source
macroKeyword
macro

macro defines a method for inserting generated code into a program. A macro maps a sequence of argument expressions to a returned expression, and the resulting expression is substituted directly into the program at the point where the macro is invoked. Macros are a way to run generated code without calling eval, since the generated code instead simply becomes part of the surrounding program. Macro arguments may include expressions, literal values, and symbols. Macros can be defined for variable number of arguments (varargs), but do not accept keyword arguments. Every macro also implicitly gets passed the arguments __source__, which contains the line number and file name the macro is called from, and __module__, which is the module the macro is expanded in.

See the manual section on Metaprogramming for more information about how to write a macro.

Examples

julia> macro sayhello(name)
            return :( println("Hello, ", $name, "!") )
        end
 @sayhello (macro with 1 method)
@@ -101,7 +101,7 @@
 @saylots (macro with 1 method)
 
 julia> @saylots "hey " "there " "friend"
-Say: hey there friend
source
returnKeyword
return

return x causes the enclosing function to exit early, passing the given value x back to its caller. return by itself with no value is equivalent to return nothing (see nothing).

function compare(a, b)
+Say: hey there friend
source
returnKeyword
return

return x causes the enclosing function to exit early, passing the given value x back to its caller. return by itself with no value is equivalent to return nothing (see nothing).

function compare(a, b)
     a == b && return "equal to"
     a < b ? "less than" : "greater than"
 end

In general you can place a return statement anywhere within a function body, including within deeply nested loops or conditionals, but be careful with do blocks. For example:

function test1(xs)
@@ -115,11 +115,11 @@
         iseven(x) && return 2x
         x
     end
-end

In the first example, the return breaks out of test1 as soon as it hits an even number, so test1([5,6,7]) returns 12.

You might expect the second example to behave the same way, but in fact the return there only breaks out of the inner function (inside the do block) and gives a value back to map. test2([5,6,7]) then returns [5,12,7].

When used in a top-level expression (i.e. outside any function), return causes the entire current top-level expression to terminate early.

source
doKeyword
do

Create an anonymous function and pass it as the first argument to a function call. For example:

map(1:10) do x
+end

In the first example, the return breaks out of test1 as soon as it hits an even number, so test1([5,6,7]) returns 12.

You might expect the second example to behave the same way, but in fact the return there only breaks out of the inner function (inside the do block) and gives a value back to map. test2([5,6,7]) then returns [5,12,7].

When used in a top-level expression (i.e. outside any function), return causes the entire current top-level expression to terminate early.

source
doKeyword
do

Create an anonymous function and pass it as the first argument to a function call. For example:

map(1:10) do x
     2x
 end

is equivalent to map(x->2x, 1:10).

Use multiple arguments like so:

map(1:10, 11:20) do x, y
     x + y
-end
source
beginKeyword
begin

begin...end denotes a block of code.

begin
+end
source
beginKeyword
begin

begin...end denotes a block of code.

begin
     println("Hello, ")
     println("World!")
 end

Usually begin will not be necessary, since keywords such as function and let implicitly begin blocks of code. See also ;.

begin may also be used when indexing to represent the first index of a collection or the first index of a dimension of an array. For example, a[begin] is the first element of an array a.

Julia 1.4

Use of begin as an index requires Julia 1.4 or later.

Examples

julia> A = [1 2; 3 4]
@@ -130,7 +130,7 @@
 julia> A[begin, :]
 2-element Matrix{Int64}:
  1
- 2
source
endKeyword
end

end marks the conclusion of a block of expressions, for example module, struct, mutable struct, begin, let, for etc.

end may also be used when indexing to represent the last index of a collection or the last index of a dimension of an array.

Examples

julia> A = [1 2; 3 4]
+ 2
source
endKeyword
end

end marks the conclusion of a block of expressions, for example module, struct, mutable struct, begin, let, for etc.

end may also be used when indexing to represent the last index of a collection or the last index of a dimension of an array.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -138,7 +138,7 @@
 julia> A[end, :]
 2-element Vector{Int64}:
  3
- 4
source
letKeyword
let

let blocks create a new hard scope and optionally introduce new local bindings.

Just like the other scope constructs, let blocks define the block of code where newly introduced local variables are accessible. Additionally, the syntax has a special meaning for comma-separated assignments and variable names that may optionally appear on the same line as the let:

let var1 = value1, var2, var3 = value3
+ 4
source
letKeyword
let

let blocks create a new hard scope and optionally introduce new local bindings.

Just like the other scope constructs, let blocks define the block of code where newly introduced local variables are accessible. Additionally, the syntax has a special meaning for comma-separated assignments and variable names that may optionally appear on the same line as the let:

let var1 = value1, var2, var3 = value3
     code
 end

The variables introduced on this line are local to the let block and the assignments are evaluated in order, with each right-hand side evaluated in the scope without considering the name on the left-hand side. Therefore it makes sense to write something like let x = x, since the two x variables are distinct with the left-hand side locally shadowing the x from the outer scope. This can even be a useful idiom as new local variables are freshly created each time local scopes are entered, but this is only observable in the case of variables that outlive their scope via closures. A let variable without an assignment, such as var2 in the example above, declares a new local variable that is not yet bound to a value.

By contrast, begin blocks also group multiple expressions together but do not introduce scope or have the special assignment syntax.

Examples

In the function below, there is a single x that is iteratively updated three times by the map. The closures returned all reference that one x at its final value:

julia> function test_outer_x()
            x = 0
@@ -179,19 +179,19 @@
 3-element Vector{Int64}:
  1
  2
- 3
source
ifKeyword
if/elseif/else

if/elseif/else performs conditional evaluation, which allows portions of code to be evaluated or not evaluated depending on the value of a boolean expression. Here is the anatomy of the if/elseif/else conditional syntax:

if x < y
+ 3
source
ifKeyword
if/elseif/else

if/elseif/else performs conditional evaluation, which allows portions of code to be evaluated or not evaluated depending on the value of a boolean expression. Here is the anatomy of the if/elseif/else conditional syntax:

if x < y
     println("x is less than y")
 elseif x > y
     println("x is greater than y")
 else
     println("x is equal to y")
 end

If the condition expression x < y is true, then the corresponding block is evaluated; otherwise the condition expression x > y is evaluated, and if it is true, the corresponding block is evaluated; if neither expression is true, the else block is evaluated. The elseif and else blocks are optional, and as many elseif blocks as desired can be used.

In contrast to some other languages conditions must be of type Bool. It does not suffice for conditions to be convertible to Bool.

julia> if 1 end
-ERROR: TypeError: non-boolean (Int64) used in boolean context
source
forKeyword
for

for loops repeatedly evaluate a block of statements while iterating over a sequence of values.

The iteration variable is always a new variable, even if a variable of the same name exists in the enclosing scope. Use outer to reuse an existing local variable for iteration.

Examples

julia> for i in [1, 4, 0]
+ERROR: TypeError: non-boolean (Int64) used in boolean context
source
forKeyword
for

for loops repeatedly evaluate a block of statements while iterating over a sequence of values.

The iteration variable is always a new variable, even if a variable of the same name exists in the enclosing scope. Use outer to reuse an existing local variable for iteration.

Examples

julia> for i in [1, 4, 0]
            println(i)
        end
 1
 4
-0
source
whileKeyword
while

while loops repeatedly evaluate a conditional expression, and continue evaluating the body of the while loop as long as the expression remains true. If the condition expression is false when the while loop is first reached, the body is never evaluated.

Examples

julia> i = 1
+0
source
whileKeyword
while

while loops repeatedly evaluate a conditional expression, and continue evaluating the body of the while loop as long as the expression remains true. If the condition expression is false when the while loop is first reached, the body is never evaluated.

Examples

julia> i = 1
 1
 
 julia> while i < 5
@@ -201,7 +201,7 @@
 1
 2
 3
-4
source
breakKeyword
break

Break out of a loop immediately.

Examples

julia> i = 0
+4
source
breakKeyword
break

Break out of a loop immediately.

Examples

julia> i = 0
 0
 
 julia> while true
@@ -213,13 +213,13 @@
 2
 3
 4
-5
source
continueKeyword
continue

Skip the rest of the current loop iteration.

Examples

julia> for i = 1:6
+5
source
continueKeyword
continue

Skip the rest of the current loop iteration.

Examples

julia> for i = 1:6
            iseven(i) && continue
            println(i)
        end
 1
 3
-5
source
tryKeyword
try/catch

A try/catch statement allows intercepting errors (exceptions) thrown by throw so that program execution can continue. For example, the following code attempts to write a file, but warns the user and proceeds instead of terminating execution if the file cannot be written:

try
+5
source
tryKeyword
try/catch

A try/catch statement allows intercepting errors (exceptions) thrown by throw so that program execution can continue. For example, the following code attempts to write a file, but warns the user and proceeds instead of terminating execution if the file cannot be written:

try
     open("/danger", "w") do f
         println(f, "Hello")
     end
@@ -244,16 +244,16 @@
     @warn "An error occurred!"
 finally
     close(f)
-end

(finally can also be used without a catch block.)

Julia 1.8

Else clauses require at least Julia 1.8.

source
finallyKeyword
finally

Run some code when a given try block of code exits, regardless of how it exits. For example, here is how we can guarantee that an opened file is closed:

f = open("file")
+end

(finally can also be used without a catch block.)

Julia 1.8

Else clauses require at least Julia 1.8.

source
finallyKeyword
finally

Run some code when a given try block of code exits, regardless of how it exits. For example, here is how we can guarantee that an opened file is closed:

f = open("file")
 try
     operate_on_file(f)
 finally
     close(f)
-end

When control leaves the try block (for example, due to a return, or just finishing normally), close(f) will be executed. If the try block exits due to an exception, the exception will continue propagating. A catch block may be combined with try and finally as well. In this case the finally block will run after catch has handled the error.

source
quoteKeyword
quote

quote creates multiple expression objects in a block without using the explicit Expr constructor. For example:

ex = quote
+end

When control leaves the try block (for example, due to a return, or just finishing normally), close(f) will be executed. If the try block exits due to an exception, the exception will continue propagating. A catch block may be combined with try and finally as well. In this case the finally block will run after catch has handled the error.

source
quoteKeyword
quote

quote creates multiple expression objects in a block without using the explicit Expr constructor. For example:

ex = quote
     x = 1
     y = 2
     x + y
-end

Unlike the other means of quoting, :( ... ), this form introduces QuoteNode elements to the expression tree, which must be considered when directly manipulating the tree. For other purposes, :( ... ) and quote .. end blocks are treated identically.

source
localKeyword
local

local introduces a new local variable. See the manual section on variable scoping for more information.

Examples

julia> function foo(n)
+end

Unlike the other means of quoting, :( ... ), this form introduces QuoteNode elements to the expression tree, which must be considered when directly manipulating the tree. For other purposes, :( ... ) and quote .. end blocks are treated identically.

source
localKeyword
local

local introduces a new local variable. See the manual section on variable scoping for more information.

Examples

julia> function foo(n)
            x = 0
            for i = 1:n
                local x # introduce a loop-local x
@@ -264,7 +264,7 @@
 foo (generic function with 1 method)
 
 julia> foo(10)
-0
source
globalKeyword
global

global x makes x in the current scope and its inner scopes refer to the global variable of that name. See the manual section on variable scoping for more information.

Examples

julia> z = 3
 3
 
 julia> function foo()
@@ -276,7 +276,7 @@
 6
 
 julia> z
-6
source
outerKeyword
for outer

Reuse an existing local variable for iteration in a for loop.

See the manual section on variable scoping for more information.

See also for.

Examples

julia> function f()
            i = 0
            for i = 1:3
                # empty
@@ -298,7 +298,7 @@
        for outer i = 1:3
        end
 ERROR: syntax: no outer local variable declaration exists for "for outer"
-[...]
source
constKeyword
const

const is used to declare global variables whose values will not change. In almost all code (and particularly performance sensitive code) global variables should be declared constant in this way.

const x = 5

Multiple variables can be declared within a single const:

const y, z = 7, 11

Note that const only applies to one = operation, therefore const x = y = 1 declares x to be constant but not y. On the other hand, const x = const y = 1 declares both x and y constant.

Note that "constant-ness" does not extend into mutable containers; only the association between a variable and its value is constant. If x is an array or dictionary (for example) you can still modify, add, or remove elements.

In some cases changing the value of a const variable gives a warning instead of an error. However, this can produce unpredictable behavior or corrupt the state of your program, and so should be avoided. This feature is intended only for convenience during interactive use.

source
structKeyword
struct

The most commonly used kind of type in Julia is a struct, specified as a name and a set of fields.

struct Point
+[...]
source
constKeyword
const

const is used to declare global variables whose values will not change. In almost all code (and particularly performance sensitive code) global variables should be declared constant in this way.

const x = 5

Multiple variables can be declared within a single const:

const y, z = 7, 11

Note that const only applies to one = operation, therefore const x = y = 1 declares x to be constant but not y. On the other hand, const x = const y = 1 declares both x and y constant.

Note that "constant-ness" does not extend into mutable containers; only the association between a variable and its value is constant. If x is an array or dictionary (for example) you can still modify, add, or remove elements.

In some cases changing the value of a const variable gives a warning instead of an error. However, this can produce unpredictable behavior or corrupt the state of your program, and so should be avoided. This feature is intended only for convenience during interactive use.

source
structKeyword
struct

The most commonly used kind of type in Julia is a struct, specified as a name and a set of fields.

struct Point
     x
     y
 end

Fields can have type restrictions, which may be parameterized:

struct Point{X}
@@ -307,10 +307,10 @@
 end

A struct can also declare an abstract super type via <: syntax:

struct Point <: AbstractPoint
     x
     y
-end

structs are immutable by default; an instance of one of these types cannot be modified after construction. Use mutable struct instead to declare a type whose instances can be modified.

See the manual section on Composite Types for more details, such as how to define constructors.

source
mutable structKeyword
mutable struct

mutable struct is similar to struct, but additionally allows the fields of the type to be set after construction.

Individual fields of a mutable struct can be marked as const to make them immutable:

mutable struct Baz
+end

structs are immutable by default; an instance of one of these types cannot be modified after construction. Use mutable struct instead to declare a type whose instances can be modified.

See the manual section on Composite Types for more details, such as how to define constructors.

source
mutable structKeyword
mutable struct

mutable struct is similar to struct, but additionally allows the fields of the type to be set after construction.

Individual fields of a mutable struct can be marked as const to make them immutable:

mutable struct Baz
     a::Int
     const b::Float64
-end
Julia 1.8

The const keyword for fields of mutable structs requires at least Julia 1.8.

See the manual section on Composite Types for more information.

source
Base.@kwdefMacro
@kwdef typedef

This is a helper macro that automatically defines a keyword-based constructor for the type declared in the expression typedef, which must be a struct or mutable struct expression. The default argument is supplied by declaring fields of the form field::T = default or field = default. If no default is provided then the keyword argument becomes a required keyword argument in the resulting type constructor.

Inner constructors can still be defined, but at least one should accept arguments in the same form as the default inner constructor (i.e. one positional argument per field) in order to function correctly with the keyword outer constructor.

Julia 1.1

Base.@kwdef for parametric structs, and structs with supertypes requires at least Julia 1.1.

Julia 1.9

This macro is exported as of Julia 1.9.

Examples

julia> @kwdef struct Foo
+end
Julia 1.8

The const keyword for fields of mutable structs requires at least Julia 1.8.

See the manual section on Composite Types for more information.

source
Base.@kwdefMacro
@kwdef typedef

This is a helper macro that automatically defines a keyword-based constructor for the type declared in the expression typedef, which must be a struct or mutable struct expression. The default argument is supplied by declaring fields of the form field::T = default or field = default. If no default is provided then the keyword argument becomes a required keyword argument in the resulting type constructor.

Inner constructors can still be defined, but at least one should accept arguments in the same form as the default inner constructor (i.e. one positional argument per field) in order to function correctly with the keyword outer constructor.

Julia 1.1

Base.@kwdef for parametric structs, and structs with supertypes requires at least Julia 1.1.

Julia 1.9

This macro is exported as of Julia 1.9.

Examples

julia> @kwdef struct Foo
            a::Int = 1         # specified default
            b::String          # required keyword
        end
@@ -322,10 +322,10 @@
 julia> Foo()
 ERROR: UndefKeywordError: keyword argument `b` not assigned
 Stacktrace:
-[...]
source
abstract typeKeyword
abstract type

abstract type declares a type that cannot be instantiated, and serves only as a node in the type graph, thereby describing sets of related concrete types: those concrete types which are their descendants. Abstract types form the conceptual hierarchy which makes Julia’s type system more than just a collection of object implementations. For example:

abstract type Number end
-abstract type Real <: Number end

Number has no supertype, whereas Real is an abstract subtype of Number.

source
primitive typeKeyword
primitive type

primitive type declares a concrete type whose data consists only of a series of bits. Classic examples of primitive types are integers and floating-point values. Some example built-in primitive type declarations:

primitive type Char 32 end
-primitive type Bool <: Integer 8 end

The number after the name indicates how many bits of storage the type requires. Currently, only sizes that are multiples of 8 bits are supported. The Bool declaration shows how a primitive type can be optionally declared to be a subtype of some supertype.

source
whereKeyword
where

The where keyword creates a UnionAll type, which may be thought of as an iterated union of other types, over all values of some variable. For example Vector{T} where T<:Real includes all Vectors where the element type is some kind of Real number.

The variable bound defaults to Any if it is omitted:

Vector{T} where T    # short for `where T<:Any`

Variables can also have lower bounds:

Vector{T} where T>:Int
-Vector{T} where Int<:T<:Real

There is also a concise syntax for nested where expressions. For example, this:

Pair{T, S} where S<:Array{T} where T<:Number

can be shortened to:

Pair{T, S} where {T<:Number, S<:Array{T}}

This form is often found on method signatures.

Note that in this form, the variables are listed outermost-first. This matches the order in which variables are substituted when a type is "applied" to parameter values using the syntax T{p1, p2, ...}.

source
...Keyword
...

The "splat" operator, ..., represents a sequence of arguments. ... can be used in function definitions, to indicate that the function accepts an arbitrary number of arguments. ... can also be used to apply a function to a sequence of arguments.

Examples

julia> add(xs...) = reduce(+, xs)
+[...]
source
abstract typeKeyword
abstract type

abstract type declares a type that cannot be instantiated, and serves only as a node in the type graph, thereby describing sets of related concrete types: those concrete types which are their descendants. Abstract types form the conceptual hierarchy which makes Julia’s type system more than just a collection of object implementations. For example:

abstract type Number end
+abstract type Real <: Number end

Number has no supertype, whereas Real is an abstract subtype of Number.

source
primitive typeKeyword
primitive type

primitive type declares a concrete type whose data consists only of a series of bits. Classic examples of primitive types are integers and floating-point values. Some example built-in primitive type declarations:

primitive type Char 32 end
+primitive type Bool <: Integer 8 end

The number after the name indicates how many bits of storage the type requires. Currently, only sizes that are multiples of 8 bits are supported. The Bool declaration shows how a primitive type can be optionally declared to be a subtype of some supertype.

source
whereKeyword
where

The where keyword creates a UnionAll type, which may be thought of as an iterated union of other types, over all values of some variable. For example Vector{T} where T<:Real includes all Vectors where the element type is some kind of Real number.

The variable bound defaults to Any if it is omitted:

Vector{T} where T    # short for `where T<:Any`

Variables can also have lower bounds:

Vector{T} where T>:Int
+Vector{T} where Int<:T<:Real

There is also a concise syntax for nested where expressions. For example, this:

Pair{T, S} where S<:Array{T} where T<:Number

can be shortened to:

Pair{T, S} where {T<:Number, S<:Array{T}}

This form is often found on method signatures.

Note that in this form, the variables are listed outermost-first. This matches the order in which variables are substituted when a type is "applied" to parameter values using the syntax T{p1, p2, ...}.

source
...Keyword
...

The "splat" operator, ..., represents a sequence of arguments. ... can be used in function definitions, to indicate that the function accepts an arbitrary number of arguments. ... can also be used to apply a function to a sequence of arguments.

Examples

julia> add(xs...) = reduce(+, xs)
 add (generic function with 1 method)
 
 julia> add(1, 2, 3, 4, 5)
@@ -335,7 +335,7 @@
 6
 
 julia> add(7, 1:100..., 1000:1100...)
-111107
source
;Keyword
;

Semicolons are used as statement separators and mark the beginning of keyword arguments in function declarations or calls.

source
=Keyword
=

= is the assignment operator.

  • For variable a and expression b, a = b makes a refer to the value of b.
  • For functions f(x), f(x) = x defines a new function constant f, or adds a new method to f if f is already defined; this usage is equivalent to function f(x); x; end.
  • a[i] = v calls setindex!(a,v,i).
  • a.b = c calls setproperty!(a,:b,c).
  • Inside a function call, f(a=b) passes b as the value of keyword argument a.
  • Inside parentheses with commas, (a=1,) constructs a NamedTuple.

Examples

Assigning a to b does not create a copy of b; instead use copy or deepcopy.

julia> b = [1]; a = b; b[1] = 2; a
+111107
source
;Keyword
;

Semicolons are used as statement separators and mark the beginning of keyword arguments in function declarations or calls.

source
=Keyword
=

= is the assignment operator.

  • For variable a and expression b, a = b makes a refer to the value of b.
  • For functions f(x), f(x) = x defines a new function constant f, or adds a new method to f if f is already defined; this usage is equivalent to function f(x); x; end.
  • a[i] = v calls setindex!(a,v,i).
  • a.b = c calls setproperty!(a,:b,c).
  • Inside a function call, f(a=b) passes b as the value of keyword argument a.
  • Inside parentheses with commas, (a=1,) constructs a NamedTuple.

Examples

Assigning a to b does not create a copy of b; instead use copy or deepcopy.

julia> b = [1]; a = b; b[1] = 2; a
 1-element Vector{Int64}:
  2
 
@@ -380,13 +380,13 @@
 2-element Vector{Int64}:
  2
  3
-
source
?:Keyword
a ? b : c

Short form for conditionals; read "if a, evaluate b otherwise evaluate c". Also known as the ternary operator.

This syntax is equivalent to if a; b else c end, but is often used to emphasize the value b-or-c which is being used as part of a larger expression, rather than the side effects that evaluating b or c may have.

See the manual section on control flow for more details.

Examples

julia> x = 1; y = 2;
+
source
?:Keyword
a ? b : c

Short form for conditionals; read "if a, evaluate b otherwise evaluate c". Also known as the ternary operator.

This syntax is equivalent to if a; b else c end, but is often used to emphasize the value b-or-c which is being used as part of a larger expression, rather than the side effects that evaluating b or c may have.

See the manual section on control flow for more details.

Examples

julia> x = 1; y = 2;
 
 julia> x > y ? println("x is larger") : println("x is not larger")
 x is not larger
 
 julia> x > y ? "x is larger" : x == y ? "x and y are equal" : "y is larger"
-"y is larger"
source
.=Keyword
.=

Perform broadcasted assignment. The right-side argument is expanded as in broadcast and then assigned into the left-side argument in-place. Fuses with other dotted operators in the same expression; i.e. the whole assignment expression is converted into a single loop.

A .= B is similar to broadcast!(identity, A, B).

Examples

julia> A = zeros(4, 4); B = [1, 2, 3, 4];
+"y is larger"
source
.=Keyword
.=

Perform broadcasted assignment. The right-side argument is expanded as in broadcast and then assigned into the left-side argument in-place. Fuses with other dotted operators in the same expression; i.e. the whole assignment expression is converted into a single loop.

A .= B is similar to broadcast!(identity, A, B).

Examples

julia> A = zeros(4, 4); B = [1, 2, 3, 4];
 
 julia> A .= B
 4×4 Matrix{Float64}:
@@ -400,11 +400,11 @@
  1.0  1.0  1.0  1.0
  2.0  2.0  2.0  2.0
  3.0  3.0  3.0  3.0
- 4.0  4.0  4.0  4.0
source
.Keyword
.

The dot operator is used to access fields or properties of objects and access variables defined inside modules.

In general, a.b calls getproperty(a, :b) (see getproperty).

Examples

julia> z = 1 + 2im; z.im
+ 4.0  4.0  4.0  4.0
source
.Keyword
.

The dot operator is used to access fields or properties of objects and access variables defined inside modules.

In general, a.b calls getproperty(a, :b) (see getproperty).

Examples

julia> z = 1 + 2im; z.im
 2
 
 julia> Iterators.product
-product (generic function with 1 method)
source
->Keyword
x -> y

Create an anonymous function mapping argument(s) x to the function body y.

julia> f = x -> x^2 + 2x - 1
+product (generic function with 1 method)
source
->Keyword
x -> y

Create an anonymous function mapping argument(s) x to the function body y.

julia> f = x -> x^2 + 2x - 1
 #1 (generic function with 1 method)
 
 julia> f(2)
@@ -412,7 +412,7 @@
 #2 (generic function with 1 method)
 
 julia> g(2,3)
-13

See the manual section on anonymous functions for more details.

source
::Keyword
::

The :: operator either asserts that a value has the given type, or declares that a local variable or function return always has the given type.

Given expression::T, expression is first evaluated. If the result is of type T, the value is simply returned. Otherwise, a TypeError is thrown.

In local scope, the syntax local x::T or x::T = expression declares that local variable x always has type T. When a value is assigned to the variable, it will be converted to type T by calling convert.

In a method declaration, the syntax function f(x)::T causes any value returned by the method to be converted to type T.

See the manual section on Type Declarations.

Examples

julia> (1+2)::AbstractFloat
+13

See the manual section on anonymous functions for more details.

source
::Keyword
::

The :: operator either asserts that a value has the given type, or declares that a local variable or function return always has the given type.

Given expression::T, expression is first evaluated. If the result is of type T, the value is simply returned. Otherwise, a TypeError is thrown.

In local scope, the syntax local x::T or x::T = expression declares that local variable x always has type T. When a value is assigned to the variable, it will be converted to type T by calling convert.

In a method declaration, the syntax function f(x)::T causes any value returned by the method to be converted to type T.

See the manual section on Type Declarations.

Examples

julia> (1+2)::AbstractFloat
 ERROR: TypeError: typeassert: expected AbstractFloat, got a value of type Int64
 
 julia> (1+2)::Int
@@ -423,8 +423,8 @@
            x = 2.0
            x
        end
-2
source

Standard Modules

MainModule
Main

Main is the top-level module, and Julia starts with Main set as the current module. Variables defined at the prompt go in Main, and varinfo lists variables in Main.

julia> @__MODULE__
-Main
source
CoreModule
Core

Core is the module that contains all identifiers considered "built in" to the language, i.e. part of the core language and not libraries. Every module implicitly specifies using Core, since you can't do anything without those definitions.

source
BaseModule
Base

The base library of Julia. Base is a module that contains basic functionality (the contents of base/). All modules implicitly contain using Base, since this is needed in the vast majority of cases.

source

Base Submodules

Base.DocsModule
Docs

The Docs module provides the @doc macro which can be used to set and retrieve documentation metadata for Julia objects.

Please see the manual section on documentation for more information.

source
Base.StackTracesModule

Tools for collecting and manipulating stack traces. Mainly used for building errors.

source
Base.SysModule

Provide methods for retrieving information about hardware and the operating system.

source
Base.GCModule
Base.GC

Module with garbage collection utilities.

source

All Objects

Standard Modules

MainModule
Main

Main is the top-level module, and Julia starts with Main set as the current module. Variables defined at the prompt go in Main, and varinfo lists variables in Main.

julia> @__MODULE__
+Main
source
CoreModule
Core

Core is the module that contains all identifiers considered "built in" to the language, i.e. part of the core language and not libraries. Every module implicitly specifies using Core, since you can't do anything without those definitions.

source
BaseModule
Base

The base library of Julia. Base is a module that contains basic functionality (the contents of base/). All modules implicitly contain using Base, since this is needed in the vast majority of cases.

source

Base Submodules

Base.DocsModule
Docs

The Docs module provides the @doc macro which can be used to set and retrieve documentation metadata for Julia objects.

Please see the manual section on documentation for more information.

source
Base.StackTracesModule

Tools for collecting and manipulating stack traces. Mainly used for building errors.

source
Base.SysModule

Provide methods for retrieving information about hardware and the operating system.

source
Base.GCModule
Base.GC

Module with garbage collection utilities.

source

All Objects

Core.:===Function
===(x,y) -> Bool
 ≡(x,y) -> Bool

Determine whether x and y are identical, in the sense that no program could distinguish them. First the types of x and y are compared. If those are identical, mutable objects are compared by address in memory and immutable objects (such as numbers) are compared by contents at the bit level. This function is sometimes called "egal". It always returns a Bool value.

Examples

julia> a = [1, 2]; b = [1, 2];
 
 julia> a == b
@@ -434,7 +434,7 @@
 false
 
 julia> a === a
-true
source
Core.isaFunction
isa(x, type) -> Bool

Determine whether x is of the given type. Can also be used as an infix operator, e.g. x isa type.

Examples

julia> isa(1, Int)
+true
source
Core.isaFunction
isa(x, type) -> Bool

Determine whether x is of the given type. Can also be used as an infix operator, e.g. x isa type.

Examples

julia> isa(1, Int)
 true
 
 julia> isa(1, Matrix)
@@ -447,7 +447,7 @@
 true
 
 julia> 1 isa Number
-true
source
Base.isequalFunction
isequal(x)

Create a function that compares its argument to x using isequal, i.e. a function equivalent to y -> isequal(y, x).

The returned function is of type Base.Fix2{typeof(isequal)}, which can be used to implement specialized methods.

source
isequal(x, y) -> Bool

Similar to ==, except for the treatment of floating point numbers and of missing values. isequal treats all floating-point NaN values as equal to each other, treats -0.0 as unequal to 0.0, and missing as equal to missing. Always returns a Bool value.

isequal is an equivalence relation - it is reflexive (=== implies isequal), symmetric (isequal(a, b) implies isequal(b, a)) and transitive (isequal(a, b) and isequal(b, c) implies isequal(a, c)).

Implementation

The default implementation of isequal calls ==, so a type that does not involve floating-point values generally only needs to define ==.

isequal is the comparison function used by hash tables (Dict). isequal(x,y) must imply that hash(x) == hash(y).

This typically means that types for which a custom == or isequal method exists must implement a corresponding hash method (and vice versa). Collections typically implement isequal by calling isequal recursively on all contents.

Furthermore, isequal is linked with isless, and they work together to define a fixed total ordering, where exactly one of isequal(x, y), isless(x, y), or isless(y, x) must be true (and the other two false).

Scalar types generally do not need to implement isequal separate from ==, unless they represent floating-point numbers amenable to a more efficient implementation than that provided as a generic fallback (based on isnan, signbit, and ==).

Examples

julia> isequal([1., NaN], [1., NaN])
+true
source
Base.isequalFunction
isequal(x)

Create a function that compares its argument to x using isequal, i.e. a function equivalent to y -> isequal(y, x).

The returned function is of type Base.Fix2{typeof(isequal)}, which can be used to implement specialized methods.

source
isequal(x, y) -> Bool

Similar to ==, except for the treatment of floating point numbers and of missing values. isequal treats all floating-point NaN values as equal to each other, treats -0.0 as unequal to 0.0, and missing as equal to missing. Always returns a Bool value.

isequal is an equivalence relation - it is reflexive (=== implies isequal), symmetric (isequal(a, b) implies isequal(b, a)) and transitive (isequal(a, b) and isequal(b, c) implies isequal(a, c)).

Implementation

The default implementation of isequal calls ==, so a type that does not involve floating-point values generally only needs to define ==.

isequal is the comparison function used by hash tables (Dict). isequal(x,y) must imply that hash(x) == hash(y).

This typically means that types for which a custom == or isequal method exists must implement a corresponding hash method (and vice versa). Collections typically implement isequal by calling isequal recursively on all contents.

Furthermore, isequal is linked with isless, and they work together to define a fixed total ordering, where exactly one of isequal(x, y), isless(x, y), or isless(y, x) must be true (and the other two false).

Scalar types generally do not need to implement isequal separate from ==, unless they represent floating-point numbers amenable to a more efficient implementation than that provided as a generic fallback (based on isnan, signbit, and ==).

Examples

julia> isequal([1., NaN], [1., NaN])
 true
 
 julia> [1., NaN] == [1., NaN]
@@ -463,15 +463,15 @@
 missing
 
 julia> isequal(missing, missing)
-true
source
Base.islessFunction
isless(x, y)

Test whether x is less than y, according to a fixed total order (defined together with isequal). isless is not defined for pairs (x, y) of all types. However, if it is defined, it is expected to satisfy the following:

  • If isless(x, y) is defined, then so is isless(y, x) and isequal(x, y), and exactly one of those three yields true.
  • The relation defined by isless is transitive, i.e., isless(x, y) && isless(y, z) implies isless(x, z).

Values that are normally unordered, such as NaN, are ordered after regular values. missing values are ordered last.

This is the default comparison used by sort!.

Implementation

Non-numeric types with a total order should implement this function. Numeric types only need to implement it if they have special values such as NaN. Types with a partial order should implement <. See the documentation on Alternate Orderings for how to define alternate ordering methods that can be used in sorting and related functions.

Examples

julia> isless(1, 3)
+true
source
Base.islessFunction
isless(x, y)

Test whether x is less than y, according to a fixed total order (defined together with isequal). isless is not defined for pairs (x, y) of all types. However, if it is defined, it is expected to satisfy the following:

  • If isless(x, y) is defined, then so is isless(y, x) and isequal(x, y), and exactly one of those three yields true.
  • The relation defined by isless is transitive, i.e., isless(x, y) && isless(y, z) implies isless(x, z).

Values that are normally unordered, such as NaN, are ordered after regular values. missing values are ordered last.

This is the default comparison used by sort!.

Implementation

Non-numeric types with a total order should implement this function. Numeric types only need to implement it if they have special values such as NaN. Types with a partial order should implement <. See the documentation on Alternate Orderings for how to define alternate ordering methods that can be used in sorting and related functions.

Examples

julia> isless(1, 3)
 true
 
 julia> isless("Red", "Blue")
-false
source
Base.isunorderedFunction
isunordered(x)

Return true if x is a value that is not orderable according to <, such as NaN or missing.

The values that evaluate to true with this predicate may be orderable with respect to other orderings such as isless.

Julia 1.7

This function requires Julia 1.7 or later.

source
Base.ifelseFunction
ifelse(condition::Bool, x, y)

Return x if condition is true, otherwise return y. This differs from ? or if in that it is an ordinary function, so all the arguments are evaluated first. In some cases, using ifelse instead of an if statement can eliminate the branch in generated code and provide higher performance in tight loops.

Examples

julia> ifelse(1 > 2, 1, 2)
-2
source
Core.typeassertFunction
typeassert(x, type)

Throw a TypeError unless x isa type. The syntax x::type calls this function.

Examples

julia> typeassert(2.5, Int)
+false
source
Base.isunorderedFunction
isunordered(x)

Return true if x is a value that is not orderable according to <, such as NaN or missing.

The values that evaluate to true with this predicate may be orderable with respect to other orderings such as isless.

Julia 1.7

This function requires Julia 1.7 or later.

source
Base.ifelseFunction
ifelse(condition::Bool, x, y)

Return x if condition is true, otherwise return y. This differs from ? or if in that it is an ordinary function, so all the arguments are evaluated first. In some cases, using ifelse instead of an if statement can eliminate the branch in generated code and provide higher performance in tight loops.

Examples

julia> ifelse(1 > 2, 1, 2)
+2
source
Core.typeassertFunction
typeassert(x, type)

Throw a TypeError unless x isa type. The syntax x::type calls this function.

Examples

julia> typeassert(2.5, Int)
 ERROR: TypeError: in typeassert, expected Int64, got a value of type Float64
 Stacktrace:
-[...]
source
Core.typeofFunction
typeof(x)

Get the concrete type of x.

See also eltype.

Examples

julia> a = 1//2;
 
 julia> typeof(a)
 Rational{Int64}
@@ -479,20 +479,20 @@
 julia> M = [1 2; 3.5 4];
 
 julia> typeof(M)
-Matrix{Float64} (alias for Array{Float64, 2})
source
Core.tupleFunction
tuple(xs...)

Construct a tuple of the given objects.

See also Tuple, ntuple, NamedTuple.

Examples

julia> tuple(1, 'b', pi)
+Matrix{Float64} (alias for Array{Float64, 2})
source
Core.tupleFunction
tuple(xs...)

Construct a tuple of the given objects.

See also Tuple, ntuple, NamedTuple.

Examples

julia> tuple(1, 'b', pi)
 (1, 'b', π)
 
 julia> ans === (1, 'b', π)
 true
 
 julia> Tuple(Real[1, 2, pi])  # takes a collection
-(1, 2, π)
source
Base.ntupleFunction
ntuple(f, ::Val{N})

Create a tuple of length N, computing each element as f(i), where i is the index of the element. By taking a Val(N) argument, it is possible that this version of ntuple may generate more efficient code than the version taking the length as an integer. But ntuple(f, N) is preferable to ntuple(f, Val(N)) in cases where N cannot be determined at compile time.

Examples

julia> ntuple(i -> 2*i, Val(4))
-(2, 4, 6, 8)
source
ntuple(f, n::Integer)

Create a tuple of length n, computing each element as f(i), where i is the index of the element.

Examples

julia> ntuple(i -> 2*i, 4)
-(2, 4, 6, 8)
source
Base.objectidFunction
objectid(x) -> UInt

Get a hash value for x based on object identity.

If x === y then objectid(x) == objectid(y), and usually when x !== y, objectid(x) != objectid(y).

See also hash, IdDict.

source
Base.hashFunction
hash(x[, h::UInt]) -> UInt

Compute an integer hash code such that isequal(x,y) implies hash(x)==hash(y). The optional second argument h is another hash code to be mixed with the result.

New types should implement the 2-argument form, typically by calling the 2-argument hash method recursively in order to mix hashes of the contents with each other (and with h). Typically, any type that implements hash should also implement its own == (hence isequal) to guarantee the property mentioned above.

The hash value may change when a new Julia process is started.

julia> a = hash(10)
+(1, 2, π)
source
Base.ntupleFunction
ntuple(f, ::Val{N})

Create a tuple of length N, computing each element as f(i), where i is the index of the element. By taking a Val(N) argument, it is possible that this version of ntuple may generate more efficient code than the version taking the length as an integer. But ntuple(f, N) is preferable to ntuple(f, Val(N)) in cases where N cannot be determined at compile time.

Examples

julia> ntuple(i -> 2*i, Val(4))
+(2, 4, 6, 8)
source
ntuple(f, n::Integer)

Create a tuple of length n, computing each element as f(i), where i is the index of the element.

Examples

julia> ntuple(i -> 2*i, 4)
+(2, 4, 6, 8)
source
Base.objectidFunction
objectid(x) -> UInt

Get a hash value for x based on object identity.

If x === y then objectid(x) == objectid(y), and usually when x !== y, objectid(x) != objectid(y).

See also hash, IdDict.

source
Base.hashFunction
hash(x[, h::UInt]) -> UInt

Compute an integer hash code such that isequal(x,y) implies hash(x)==hash(y). The optional second argument h is another hash code to be mixed with the result.

New types should implement the 2-argument form, typically by calling the 2-argument hash method recursively in order to mix hashes of the contents with each other (and with h). Typically, any type that implements hash should also implement its own == (hence isequal) to guarantee the property mentioned above.

The hash value may change when a new Julia process is started.

julia> a = hash(10)
 0x95ea2955abd45275
 
 julia> hash(10, a) # only use the output of another hash function as the second argument
-0xd42bad54a8575b16

See also: objectid, Dict, Set.

source
Base.finalizerFunction
finalizer(f, x)

Register a function f(x) to be called when there are no program-accessible references to x, and return x. The type of x must be a mutable struct, otherwise the function will throw.

f must not cause a task switch, which excludes most I/O operations such as println. Using the @async macro (to defer context switching to outside of the finalizer) or ccall to directly invoke IO functions in C may be helpful for debugging purposes.

Note that there is no guaranteed world age for the execution of f. It may be called in the world age in which the finalizer was registered or any later world age.

Examples

finalizer(my_mutable_struct) do x
+0xd42bad54a8575b16

See also: objectid, Dict, Set.

source
Base.finalizerFunction
finalizer(f, x)

Register a function f(x) to be called when there are no program-accessible references to x, and return x. The type of x must be a mutable struct, otherwise the function will throw.

f must not cause a task switch, which excludes most I/O operations such as println. Using the @async macro (to defer context switching to outside of the finalizer) or ccall to directly invoke IO functions in C may be helpful for debugging purposes.

Note that there is no guaranteed world age for the execution of f. It may be called in the world age in which the finalizer was registered or any later world age.

Examples

finalizer(my_mutable_struct) do x
     @async println("Finalizing $x.")
 end
 
@@ -505,7 +505,7 @@
         f(t) = @async println("Finalizing $t.")
         finalizer(f, x)
     end
-end
source
Base.copyFunction
copy(x)

Create a shallow copy of x: the outer structure is copied, but not all internal values. For example, copying an array produces a new array with identically-same elements as the original.

See also copy!, copyto!, deepcopy.

source
Base.deepcopyFunction
deepcopy(x)

Create a deep copy of x: everything is copied recursively, resulting in a fully independent object. For example, deep-copying an array creates deep copies of all the objects it contains and produces a new array with the consistent relationship structure (e.g., if the first two elements are the same object in the original array, the first two elements of the new array will also be the same deepcopyed object). Calling deepcopy on an object should generally have the same effect as serializing and then deserializing it.

While it isn't normally necessary, user-defined types can override the default deepcopy behavior by defining a specialized version of the function deepcopy_internal(x::T, dict::IdDict) (which shouldn't otherwise be used), where T is the type to be specialized for, and dict keeps track of objects copied so far within the recursion. Within the definition, deepcopy_internal should be used in place of deepcopy, and the dict variable should be updated as appropriate before returning.

source
Base.copyFunction
copy(x)

Create a shallow copy of x: the outer structure is copied, but not all internal values. For example, copying an array produces a new array with identically-same elements as the original.

See also copy!, copyto!, deepcopy.

source
Base.deepcopyFunction
deepcopy(x)

Create a deep copy of x: everything is copied recursively, resulting in a fully independent object. For example, deep-copying an array creates deep copies of all the objects it contains and produces a new array with the consistent relationship structure (e.g., if the first two elements are the same object in the original array, the first two elements of the new array will also be the same deepcopyed object). Calling deepcopy on an object should generally have the same effect as serializing and then deserializing it.

While it isn't normally necessary, user-defined types can override the default deepcopy behavior by defining a specialized version of the function deepcopy_internal(x::T, dict::IdDict) (which shouldn't otherwise be used), where T is the type to be specialized for, and dict keeps track of objects copied so far within the recursion. Within the definition, deepcopy_internal should be used in place of deepcopy, and the dict variable should be updated as appropriate before returning.

source
Base.getpropertyFunction
getproperty(value, name::Symbol)
 getproperty(value, name::Symbol, order::Symbol)

The syntax a.b calls getproperty(a, :b). The syntax @atomic order a.b calls getproperty(a, :b, :order) and the syntax @atomic a.b calls getproperty(a, :b, :sequentially_consistent).

Examples

julia> struct MyType{T <: Number}
            x::T
        end
@@ -524,8 +524,8 @@
 2
 
 julia> obj.x
-1

One should overload getproperty only when necessary, as it can be confusing if the behavior of the syntax obj.f is unusual. Also note that using methods is often preferable. See also this style guide documentation for more information: Prefer exported methods over direct field access.

See also getfield, propertynames and setproperty!.

source
Base.setproperty!Function
setproperty!(value, name::Symbol, x)
-setproperty!(value, name::Symbol, x, order::Symbol)

The syntax a.b = c calls setproperty!(a, :b, c). The syntax @atomic order a.b = c calls setproperty!(a, :b, c, :order) and the syntax @atomic a.b = c calls setproperty!(a, :b, c, :sequentially_consistent).

Julia 1.8

setproperty! on modules requires at least Julia 1.8.

See also setfield!, propertynames and getproperty.

source
Base.replaceproperty!Function
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order)

Perform a compare-and-swap operation on x.f from expected to desired, per egal. The syntax @atomicreplace x.f expected => desired can be used instead of the function call form.

See also replacefield! setproperty!, setpropertyonce!.

source
Base.swapproperty!Function
swapproperty!(x, f::Symbol, v, order::Symbol=:not_atomic)

The syntax @atomic a.b, _ = c, a.b returns (c, swapproperty!(a, :b, c, :sequentially_consistent)), where there must be one getproperty expression common to both sides.

See also swapfield! and setproperty!.

source
Base.modifyproperty!Function
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:not_atomic)

The syntax @atomic op(x.f, v) (and its equivalent @atomic x.f op v) returns modifyproperty!(x, :f, op, v, :sequentially_consistent), where the first argument must be a getproperty expression and is modified atomically.

Invocation of op(getproperty(x, f), v) must return a value that can be stored in the field f of the object x by default. In particular, unlike the default behavior of setproperty!, the convert function is not called automatically.

See also modifyfield! and setproperty!.

source
Base.setpropertyonce!Function
setpropertyonce!(x, f::Symbol, value, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order)

Perform a compare-and-swap operation on x.f to set it to value if previously unset. The syntax @atomiconce x.f = value can be used instead of the function call form.

See also setfieldonce!, setproperty!, replaceproperty!.

Julia 1.11

This function requires Julia 1.11 or later.

source
Base.propertynamesFunction
propertynames(x, private=false)

Get a tuple or a vector of the properties (x.property) of an object x. This is typically the same as fieldnames(typeof(x)), but types that overload getproperty should generally overload propertynames as well to get the properties of an instance of the type.

propertynames(x) may return only "public" property names that are part of the documented interface of x. If you want it to also return "private" property names intended for internal use, pass true for the optional second argument. REPL tab completion on x. shows only the private=false properties.

See also: hasproperty, hasfield.

source
Base.haspropertyFunction
hasproperty(x, s::Symbol)

Return a boolean indicating whether the object x has s as one of its own properties.

Julia 1.2

This function requires at least Julia 1.2.

See also: propertynames, hasfield.

source
Base.setproperty!Function
setproperty!(value, name::Symbol, x)
+setproperty!(value, name::Symbol, x, order::Symbol)

The syntax a.b = c calls setproperty!(a, :b, c). The syntax @atomic order a.b = c calls setproperty!(a, :b, c, :order) and the syntax @atomic a.b = c calls setproperty!(a, :b, c, :sequentially_consistent).

Julia 1.8

setproperty! on modules requires at least Julia 1.8.

See also setfield!, propertynames and getproperty.

source
Base.replaceproperty!Function
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order)

Perform a compare-and-swap operation on x.f from expected to desired, per egal. The syntax @atomicreplace x.f expected => desired can be used instead of the function call form.

See also replacefield! setproperty!, setpropertyonce!.

source
Base.swapproperty!Function
swapproperty!(x, f::Symbol, v, order::Symbol=:not_atomic)

The syntax @atomic a.b, _ = c, a.b returns (c, swapproperty!(a, :b, c, :sequentially_consistent)), where there must be one getproperty expression common to both sides.

See also swapfield! and setproperty!.

source
Base.modifyproperty!Function
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:not_atomic)

The syntax @atomic op(x.f, v) (and its equivalent @atomic x.f op v) returns modifyproperty!(x, :f, op, v, :sequentially_consistent), where the first argument must be a getproperty expression and is modified atomically.

Invocation of op(getproperty(x, f), v) must return a value that can be stored in the field f of the object x by default. In particular, unlike the default behavior of setproperty!, the convert function is not called automatically.

See also modifyfield! and setproperty!.

source
Base.setpropertyonce!Function
setpropertyonce!(x, f::Symbol, value, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order)

Perform a compare-and-swap operation on x.f to set it to value if previously unset. The syntax @atomiconce x.f = value can be used instead of the function call form.

See also setfieldonce!, setproperty!, replaceproperty!.

Julia 1.11

This function requires Julia 1.11 or later.

source
Base.propertynamesFunction
propertynames(x, private=false)

Get a tuple or a vector of the properties (x.property) of an object x. This is typically the same as fieldnames(typeof(x)), but types that overload getproperty should generally overload propertynames as well to get the properties of an instance of the type.

propertynames(x) may return only "public" property names that are part of the documented interface of x. If you want it to also return "private" property names intended for internal use, pass true for the optional second argument. REPL tab completion on x. shows only the private=false properties.

See also: hasproperty, hasfield.

source
Base.haspropertyFunction
hasproperty(x, s::Symbol)

Return a boolean indicating whether the object x has s as one of its own properties.

Julia 1.2

This function requires at least Julia 1.2.

See also: propertynames, hasfield.

source
Core.getfieldFunction
getfield(value, name::Symbol, [order::Symbol])
 getfield(value, i::Int, [order::Symbol])

Extract a field from a composite value by name or position. Optionally, an ordering can be defined for the operation. If the field was declared @atomic, the specification is strongly recommended to be compatible with the stores to that location. Otherwise, if not declared as @atomic, this parameter must be :not_atomic if specified. See also getproperty and fieldnames.

Examples

julia> a = 1//2
 1//2
 
@@ -536,7 +536,7 @@
 1
 
 julia> getfield(a, 1)
-1
source
Core.setfield!Function
setfield!(value, name::Symbol, x, [order::Symbol])
 setfield!(value, i::Int, x, [order::Symbol])

Assign x to a named field in value of composite type. The value must be mutable and x must be a subtype of fieldtype(typeof(value), name). Additionally, an ordering can be specified for this operation. If the field was declared @atomic, this specification is mandatory. Otherwise, if not declared as @atomic, it must be :not_atomic if specified. See also setproperty!.

Examples

julia> mutable struct MyMutableStruct
            field::Int
        end
@@ -552,11 +552,11 @@
 1//2
 
 julia> setfield!(a, :num, 3);
-ERROR: setfield!: immutable struct of type Rational cannot be changed
source
Core.modifyfield!Function
modifyfield!(value, name::Symbol, op, x, [order::Symbol]) -> Pair
+ERROR: setfield!: immutable struct of type Rational cannot be changed
source
Core.modifyfield!Function
modifyfield!(value, name::Symbol, op, x, [order::Symbol]) -> Pair
 modifyfield!(value, i::Int, op, x, [order::Symbol]) -> Pair

Atomically perform the operations to get and set a field after applying the function op.

y = getfield(value, name)
 z = op(y, x)
 setfield!(value, name, z)
-return y => z

If supported by the hardware (for example, atomic increment), this may be optimized to the appropriate hardware instruction, otherwise it'll use a loop.

Julia 1.7

This function requires Julia 1.7 or later.

source
Core.replacefield!Function
replacefield!(value, name::Symbol, expected, desired,
+return y => z

If supported by the hardware (for example, atomic increment), this may be optimized to the appropriate hardware instruction, otherwise it'll use a loop.

Julia 1.7

This function requires Julia 1.7 or later.

source
Core.replacefield!Function
replacefield!(value, name::Symbol, expected, desired,
               [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)
 replacefield!(value, i::Int, expected, desired,
               [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)

Atomically perform the operations to get and conditionally set a field to a given value.

y = getfield(value, name, fail_order)
@@ -564,15 +564,15 @@
 if ok
     setfield!(value, name, desired, success_order)
 end
-return (; old = y, success = ok)

If supported by the hardware, this may be optimized to the appropriate hardware instruction, otherwise it'll use a loop.

Julia 1.7

This function requires Julia 1.7 or later.

source
Core.swapfield!Function
swapfield!(value, name::Symbol, x, [order::Symbol])
+return (; old = y, success = ok)

If supported by the hardware, this may be optimized to the appropriate hardware instruction, otherwise it'll use a loop.

Julia 1.7

This function requires Julia 1.7 or later.

source
Core.swapfield!Function
swapfield!(value, name::Symbol, x, [order::Symbol])
 swapfield!(value, i::Int, x, [order::Symbol])

Atomically perform the operations to simultaneously get and set a field:

y = getfield(value, name)
 setfield!(value, name, x)
-return y
Julia 1.7

This function requires Julia 1.7 or later.

source
Core.setfieldonce!Function
setfieldonce!(value, name::Union{Int,Symbol}, desired,
+return y
Julia 1.7

This function requires Julia 1.7 or later.

source
Core.setfieldonce!Function
setfieldonce!(value, name::Union{Int,Symbol}, desired,
               [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool

Atomically perform the operations to set a field to a given value, only if it was previously not set.

ok = !isdefined(value, name, fail_order)
 if ok
     setfield!(value, name, desired, success_order)
 end
-return ok
Julia 1.11

This function requires Julia 1.11 or later.

source
Core.isdefinedFunction
isdefined(m::Module, s::Symbol, [order::Symbol])
+return ok
Julia 1.11

This function requires Julia 1.11 or later.

source
Core.isdefinedFunction
isdefined(m::Module, s::Symbol, [order::Symbol])
 isdefined(object, s::Symbol, [order::Symbol])
 isdefined(object, index::Int, [order::Symbol])

Tests whether a global variable or object field is defined. The arguments can be a module and a symbol or a composite object and field name (as a symbol) or index. Optionally, an ordering can be defined for the operation. If the field was declared @atomic, the specification is strongly recommended to be compatible with the stores to that location. Otherwise, if not declared as @atomic, this parameter must be :not_atomic if specified.

To test whether an array element is defined, use isassigned instead.

The global variable variant is supported for compatibility with older julia releases. For new code, prefer isdefinedglobal.

See also @isdefined.

Examples

julia> isdefined(Base, :sum)
 true
@@ -592,7 +592,7 @@
 true
 
 julia> isdefined(a, :numerator)
-false
source
Core.isdefinedglobalFunction
isdefinedglobal(m::Module, s::Symbol, [allow_import::Bool=true, [order::Symbol=:unordered]])

Tests whether a global variable s is defined in module m (in the current world age). A variable is considered defined if and only if a value may be read from this global variable and an access will not throw. This includes both constants and global variables that have a value set.

If allow_import is false, the global variable must be defined inside m and may not be imported from another module.

See also @isdefined.

Examples

julia> isdefinedglobal(Base, :sum)
+false
source
Core.isdefinedglobalFunction
isdefinedglobal(m::Module, s::Symbol, [allow_import::Bool=true, [order::Symbol=:unordered]])

Tests whether a global variable s is defined in module m (in the current world age). A variable is considered defined if and only if a value may be read from this global variable and an access will not throw. This includes both constants and global variables that have a value set.

If allow_import is false, the global variable must be defined inside m and may not be imported from another module.

See also @isdefined.

Examples

julia> isdefinedglobal(Base, :sum)
 true
 
 julia> isdefinedglobal(Base, :NonExistentMethod)
@@ -602,7 +602,7 @@
 true
 
 julia> isdefinedglobal(Main, :sum, false)
-false
source
Base.@isdefinedMacro
@isdefined s -> Bool

Tests whether variable s is defined in the current scope.

See also isdefined for field properties and isassigned for array indexes or haskey for other mappings.

Examples

julia> @isdefined newvar
+false
source
Base.@isdefinedMacro
@isdefined s -> Bool

Tests whether variable s is defined in the current scope.

See also isdefined for field properties and isassigned for array indexes or haskey for other mappings.

Examples

julia> @isdefined newvar
 false
 
 julia> newvar = 1
@@ -620,7 +620,7 @@
 
 julia> f()
 false
-true
source
Base.convertFunction
convert(T, x)

Convert x to a value of type T.

If T is an Integer type, an InexactError will be raised if x is not representable by T, for example if x is not integer-valued, or is outside the range supported by T.

Examples

julia> convert(Int, 3.0)
+true
source
Base.convertFunction
convert(T, x)

Convert x to a value of type T.

If T is an Integer type, an InexactError will be raised if x is not representable by T, for example if x is not integer-valued, or is outside the range supported by T.

Examples

julia> convert(Int, 3.0)
 3
 
 julia> convert(Int, 3.5)
@@ -638,7 +638,7 @@
 julia> y = convert(Vector{Int}, x);
 
 julia> y === x
-true

See also: round, trunc, oftype, reinterpret.

source
Base.promoteFunction
promote(xs...)

Convert all arguments to a common type, and return them all (as a tuple). If no arguments can be converted, an error is raised.

See also: promote_type, promote_rule.

Examples

julia> promote(Int8(1), Float16(4.5), Float32(4.1))
 (1.0f0, 4.5f0, 4.1f0)
 
 julia> promote_type(Int8, Float16, Float32)
@@ -652,7 +652,7 @@
 [...]
 
 julia> promote_type(Int, String)
-Any
source
Base.oftypeFunction
oftype(x, y)

Convert y to the type of x i.e. convert(typeof(x), y).

Examples

julia> x = 4;
+Any
source
Base.oftypeFunction
oftype(x, y)

Convert y to the type of x i.e. convert(typeof(x), y).

Examples

julia> x = 4;
 
 julia> y = 3.;
 
@@ -660,12 +660,12 @@
 3
 
 julia> oftype(y, x)
-4.0
source
Base.widenFunction
widen(x)

If x is a type, return a "larger" type, defined so that arithmetic operations + and - are guaranteed not to overflow nor lose precision for any combination of values that type x can hold.

For fixed-size integer types less than 128 bits, widen will return a type with twice the number of bits.

If x is a value, it is converted to widen(typeof(x)).

Examples

julia> widen(Int32)
+4.0
source
Base.widenFunction
widen(x)

If x is a type, return a "larger" type, defined so that arithmetic operations + and - are guaranteed not to overflow nor lose precision for any combination of values that type x can hold.

For fixed-size integer types less than 128 bits, widen will return a type with twice the number of bits.

If x is a value, it is converted to widen(typeof(x)).

Examples

julia> widen(Int32)
 Int64
 
 julia> widen(1.5f0)
-1.5
source
Base.identityFunction
identity(x)

The identity function. Returns its argument.

See also: one, oneunit, and LinearAlgebra's I.

Examples

julia> identity("Well, what did you expect?")
-"Well, what did you expect?"
source
Core.WeakRefType
WeakRef(x)

w = WeakRef(x) constructs a weak reference to the Julia value x: although w contains a reference to x, it does not prevent x from being garbage collected. w.value is either x (if x has not been garbage-collected yet) or nothing (if x has been garbage-collected).

julia> x = "a string"
+1.5
source
Base.identityFunction
identity(x)

The identity function. Returns its argument.

See also: one, oneunit, and LinearAlgebra's I.

Examples

julia> identity("Well, what did you expect?")
+"Well, what did you expect?"
source
Core.WeakRefType
WeakRef(x)

w = WeakRef(x) constructs a weak reference to the Julia value x: although w contains a reference to x, it does not prevent x from being garbage collected. w.value is either x (if x has not been garbage-collected yet) or nothing (if x has been garbage-collected).

julia> x = "a string"
 "a string"
 
 julia> w = WeakRef(x)
@@ -681,11 +681,11 @@
 julia> GC.gc()
 
 julia> w
-WeakRef(nothing)
source

Properties of Types

Type relations

Base.supertypeFunction
supertype(T::Union{DataType, UnionAll})

Return the direct supertype of type T. T can be a DataType or a UnionAll type. Does not support type Unions. Also see info on Types.

Examples

julia> supertype(Int32)
+WeakRef(nothing)
source

Properties of Types

Type relations

Base.supertypeFunction
supertype(T::Union{DataType, UnionAll})

Return the direct supertype of type T. T can be a DataType or a UnionAll type. Does not support type Unions. Also see info on Types.

Examples

julia> supertype(Int32)
 Signed
 
 julia> supertype(Vector)
-DenseVector (alias for DenseArray{T, 1} where T)
source
Core.TypeType
Core.Type{T}

Core.Type is an abstract type which has all type objects as its instances. The only instance of the singleton type Core.Type{T} is the object T.

Examples

julia> isa(Type{Float64}, Type)
+DenseVector (alias for DenseArray{T, 1} where T)
source
Core.TypeType
Core.Type{T}

Core.Type is an abstract type which has all type objects as its instances. The only instance of the singleton type Core.Type{T} is the object T.

Examples

julia> isa(Type{Float64}, Type)
 true
 
 julia> isa(Float64, Type)
@@ -695,7 +695,7 @@
 false
 
 julia> isa(Real, Type{Real})
-true
source
Core.DataTypeType
DataType <: Type{T}

DataType represents explicitly declared types that have names, explicitly declared supertypes, and, optionally, parameters. Every concrete value in the system is an instance of some DataType.

Examples

julia> typeof(Real)
+true
source
Core.DataTypeType
DataType <: Type{T}

DataType represents explicitly declared types that have names, explicitly declared supertypes, and, optionally, parameters. Every concrete value in the system is an instance of some DataType.

Examples

julia> typeof(Real)
 DataType
 
 julia> typeof(Int)
@@ -707,7 +707,7 @@
        end
 
 julia> typeof(Point)
-DataType
source
Core.:<:Function
<:(T1, T2)::Bool

Subtyping relation, defined between two types. In Julia, a type S is said to be a subtype of a type T if and only if we have S <: T.

For any type L and any type R, L <: R implies that any value v of type L is also of type R. I.e., (L <: R) && (v isa L) implies v isa R.

The subtyping relation is a partial order. I.e., <: is:

  • reflexive: for any type T, T <: T holds

  • antisymmetric: for any type A and any type B, (A <: B) && (B <: A) implies A == B

  • transitive: for any type A, any type B and any type C; (A <: B) && (B <: C) implies A <: C

See also info on Types, Union{}, Any, isa.

Examples

julia> Float64 <: AbstractFloat
+DataType
source
Core.:<:Function
<:(T1, T2)::Bool

Subtyping relation, defined between two types. In Julia, a type S is said to be a subtype of a type T if and only if we have S <: T.

For any type L and any type R, L <: R implies that any value v of type L is also of type R. I.e., (L <: R) && (v isa L) implies v isa R.

The subtyping relation is a partial order. I.e., <: is:

  • reflexive: for any type T, T <: T holds

  • antisymmetric: for any type A and any type B, (A <: B) && (B <: A) implies A == B

  • transitive: for any type A, any type B and any type C; (A <: B) && (B <: C) implies A <: C

See also info on Types, Union{}, Any, isa.

Examples

julia> Float64 <: AbstractFloat
 true
 
 julia> Vector{Int} <: AbstractArray
@@ -723,11 +723,11 @@
 true
 
 julia> Union{} <: Float32 <: AbstractFloat <: Real <: Number <: Any  # Operator chaining
-true

The <: keyword also has several syntactic uses which represent the same subtyping relation, but which do not execute the operator or return a Bool:

  • To specify the lower bound and the upper bound on a parameter of a UnionAll type in a where statement.

  • To specify the lower bound and the upper bound on a (static) parameter of a method, see Parametric Methods.

  • To define a subtyping relation while declaring a new type, see struct and abstract type.

source
Core.:>:Function
>:(T1, T2)

Supertype operator, equivalent to T2 <: T1.

source
Base.typejoinFunction
typejoin(T, S, ...)

Return the closest common ancestor of types T and S, i.e. the narrowest type from which they both inherit. Recurses on additional varargs.

Examples

julia> typejoin(Int, Float64)
+true

The <: keyword also has several syntactic uses which represent the same subtyping relation, but which do not execute the operator or return a Bool:

  • To specify the lower bound and the upper bound on a parameter of a UnionAll type in a where statement.

  • To specify the lower bound and the upper bound on a (static) parameter of a method, see Parametric Methods.

  • To define a subtyping relation while declaring a new type, see struct and abstract type.

source
Core.:>:Function
>:(T1, T2)

Supertype operator, equivalent to T2 <: T1.

source
Base.typejoinFunction
typejoin(T, S, ...)

Return the closest common ancestor of types T and S, i.e. the narrowest type from which they both inherit. Recurses on additional varargs.

Examples

julia> typejoin(Int, Float64)
 Real
 
 julia> typejoin(Int, Float64, ComplexF32)
-Number
source
Base.typeintersectFunction
typeintersect(T::Type, S::Type)

Compute a type that contains the intersection of T and S. Usually this will be the smallest such type or one close to it.

A special case where exact behavior is guaranteed: when T <: S, typeintersect(S, T) == T == typeintersect(T, S).

source
Base.promote_typeFunction
promote_type(type1, type2, ...)

Promotion refers to converting values of mixed types to a single common type. promote_type represents the default promotion behavior in Julia when operators (usually mathematical) are given arguments of differing types. promote_type generally tries to return a type which can at least approximate most values of either input type without excessively widening. Some loss is tolerated; for example, promote_type(Int64, Float64) returns Float64 even though strictly, not all Int64 values can be represented exactly as Float64 values.

See also: promote, promote_typejoin, promote_rule.

Examples

julia> promote_type(Int64, Float64)
+Number
source
Base.typeintersectFunction
typeintersect(T::Type, S::Type)

Compute a type that contains the intersection of T and S. Usually this will be the smallest such type or one close to it.

A special case where exact behavior is guaranteed: when T <: S, typeintersect(S, T) == T == typeintersect(T, S).

source
Base.promote_typeFunction
promote_type(type1, type2, ...)

Promotion refers to converting values of mixed types to a single common type. promote_type represents the default promotion behavior in Julia when operators (usually mathematical) are given arguments of differing types. promote_type generally tries to return a type which can at least approximate most values of either input type without excessively widening. Some loss is tolerated; for example, promote_type(Int64, Float64) returns Float64 even though strictly, not all Int64 values can be represented exactly as Float64 values.

See also: promote, promote_typejoin, promote_rule.

Examples

julia> promote_type(Int64, Float64)
 Float64
 
 julia> promote_type(Int32, Int64)
@@ -743,44 +743,44 @@
 Float16
 
 julia> promote_type(Int8, UInt16)
-UInt16
Don't overload this directly

To overload promotion for your own types you should overload promote_rule. promote_type calls promote_rule internally to determine the type. Overloading promote_type directly can cause ambiguity errors.

source
Base.promote_ruleFunction
promote_rule(type1, type2)

Specifies what type should be used by promote when given values of types type1 and type2. This function should not be called directly, but should have definitions added to it for new types as appropriate.

source
Base.promote_typejoinFunction
promote_typejoin(T, S)

Compute a type that contains both T and S, which could be either a parent of both types, or a Union if appropriate. Falls back to typejoin.

See instead promote, promote_type.

Examples

julia> Base.promote_typejoin(Int, Float64)
+UInt16
Don't overload this directly

To overload promotion for your own types you should overload promote_rule. promote_type calls promote_rule internally to determine the type. Overloading promote_type directly can cause ambiguity errors.

source
Base.promote_ruleFunction
promote_rule(type1, type2)

Specifies what type should be used by promote when given values of types type1 and type2. This function should not be called directly, but should have definitions added to it for new types as appropriate.

source
Base.promote_typejoinFunction
promote_typejoin(T, S)

Compute a type that contains both T and S, which could be either a parent of both types, or a Union if appropriate. Falls back to typejoin.

See instead promote, promote_type.

Examples

julia> Base.promote_typejoin(Int, Float64)
 Real
 
 julia> Base.promote_type(Int, Float64)
-Float64
source
Base.isdispatchtupleFunction
isdispatchtuple(T)

Determine whether type T is a tuple of concrete types, meaning it could appear as a type signature in dispatch and has no subtypes (or supertypes) which could appear in a call. If T is not a type, then return false.

source

Declared structure

Base.ismutableFunction
ismutable(v) -> Bool

Return true if and only if value v is mutable. See Mutable Composite Types for a discussion of immutability. Note that this function works on values, so if you give it a DataType, it will tell you that a value of the type is mutable.

Note

For technical reasons, ismutable returns true for values of certain special types (for example String and Symbol) even though they cannot be mutated in a permissible way.

See also isbits, isstructtype.

Examples

julia> ismutable(1)
+Float64
source
Base.isdispatchtupleFunction
isdispatchtuple(T)

Determine whether type T is a tuple of concrete types, meaning it could appear as a type signature in dispatch and has no subtypes (or supertypes) which could appear in a call. If T is not a type, then return false.

source

Declared structure

Base.ismutableFunction
ismutable(v) -> Bool

Return true if and only if value v is mutable. See Mutable Composite Types for a discussion of immutability. Note that this function works on values, so if you give it a DataType, it will tell you that a value of the type is mutable.

Note

For technical reasons, ismutable returns true for values of certain special types (for example String and Symbol) even though they cannot be mutated in a permissible way.

See also isbits, isstructtype.

Examples

julia> ismutable(1)
 false
 
 julia> ismutable([1,2])
-true
Julia 1.5

This function requires at least Julia 1.5.

source
Base.isimmutableFunction
isimmutable(v) -> Bool
Warning

Consider using !ismutable(v) instead, as isimmutable(v) will be replaced by !ismutable(v) in a future release. (Since Julia 1.5)

Return true iff value v is immutable. See Mutable Composite Types for a discussion of immutability. Note that this function works on values, so if you give it a type, it will tell you that a value of DataType is mutable.

Examples

julia> isimmutable(1)
+true
Julia 1.5

This function requires at least Julia 1.5.

source
Base.isimmutableFunction
isimmutable(v) -> Bool
Warning

Consider using !ismutable(v) instead, as isimmutable(v) will be replaced by !ismutable(v) in a future release. (Since Julia 1.5)

Return true iff value v is immutable. See Mutable Composite Types for a discussion of immutability. Note that this function works on values, so if you give it a type, it will tell you that a value of DataType is mutable.

Examples

julia> isimmutable(1)
 true
 
 julia> isimmutable([1,2])
-false
source
Base.ismutabletypeFunction
ismutabletype(T) -> Bool

Determine whether type T was declared as a mutable type (i.e. using mutable struct keyword). If T is not a type, then return false.

Julia 1.7

This function requires at least Julia 1.7.

source
Base.isabstracttypeFunction
isabstracttype(T)

Determine whether type T was declared as an abstract type (i.e. using the abstract type syntax). Note that this is not the negation of isconcretetype(T). If T is not a type, then return false.

Examples

julia> isabstracttype(AbstractArray)
+false
source
Base.ismutabletypeFunction
ismutabletype(T) -> Bool

Determine whether type T was declared as a mutable type (i.e. using mutable struct keyword). If T is not a type, then return false.

Julia 1.7

This function requires at least Julia 1.7.

source
Base.isabstracttypeFunction
isabstracttype(T)

Determine whether type T was declared as an abstract type (i.e. using the abstract type syntax). Note that this is not the negation of isconcretetype(T). If T is not a type, then return false.

Examples

julia> isabstracttype(AbstractArray)
 true
 
 julia> isabstracttype(Vector)
-false
source
Base.isprimitivetypeFunction
isprimitivetype(T) -> Bool

Determine whether type T was declared as a primitive type (i.e. using the primitive type syntax). If T is not a type, then return false.

source
Base.issingletontypeFunction
Base.issingletontype(T)

Determine whether type T has exactly one possible instance; for example, a struct type with no fields except other singleton values. If T is not a concrete type, then return false.

source
Base.isstructtypeFunction
isstructtype(T) -> Bool

Determine whether type T was declared as a struct type (i.e. using the struct or mutable struct keyword). If T is not a type, then return false.

source
Base.nameofMethod
nameof(t::DataType) -> Symbol

Get the name of a (potentially UnionAll-wrapped) DataType (without its parent module) as a symbol.

Examples

julia> module Foo
+false
source
Base.isprimitivetypeFunction
isprimitivetype(T) -> Bool

Determine whether type T was declared as a primitive type (i.e. using the primitive type syntax). If T is not a type, then return false.

source
Base.issingletontypeFunction
Base.issingletontype(T)

Determine whether type T has exactly one possible instance; for example, a struct type with no fields except other singleton values. If T is not a concrete type, then return false.

source
Base.isstructtypeFunction
isstructtype(T) -> Bool

Determine whether type T was declared as a struct type (i.e. using the struct or mutable struct keyword). If T is not a type, then return false.

source
Base.nameofMethod
nameof(t::DataType) -> Symbol

Get the name of a (potentially UnionAll-wrapped) DataType (without its parent module) as a symbol.

Examples

julia> module Foo
            struct S{T}
            end
        end
 Foo
 
 julia> nameof(Foo.S{T} where T)
-:S
source
Base.fieldnamesFunction
fieldnames(x::DataType)

Get a tuple with the names of the fields of a DataType.

Each name is a Symbol, except when x <: Tuple, in which case each name (actually the index of the field) is an Int.

See also propertynames, hasfield.

Examples

julia> fieldnames(Rational)
+:S
source
Base.fieldnamesFunction
fieldnames(x::DataType)

Get a tuple with the names of the fields of a DataType.

Each name is a Symbol, except when x <: Tuple, in which case each name (actually the index of the field) is an Int.

See also propertynames, hasfield.

Examples

julia> fieldnames(Rational)
 (:num, :den)
 
 julia> fieldnames(typeof(1+im))
 (:re, :im)
 
 julia> fieldnames(Tuple{String,Int})
-(1, 2)
source
Base.fieldnameFunction
fieldname(x::DataType, i::Integer)

Get the name of field i of a DataType.

The return type is Symbol, except when x <: Tuple, in which case the index of the field is returned, of type Int.

Examples

julia> fieldname(Rational, 1)
+(1, 2)
source
Base.fieldnameFunction
fieldname(x::DataType, i::Integer)

Get the name of field i of a DataType.

The return type is Symbol, except when x <: Tuple, in which case the index of the field is returned, of type Int.

Examples

julia> fieldname(Rational, 1)
 :num
 
 julia> fieldname(Rational, 2)
 :den
 
 julia> fieldname(Tuple{String,Int}, 2)
-2
source
Core.fieldtypeFunction
fieldtype(T, name::Symbol | index::Int)

Determine the declared type of a field (specified by name or index) in a composite DataType T.

Examples

julia> struct Foo
+2
source
Core.fieldtypeFunction
fieldtype(T, name::Symbol | index::Int)

Determine the declared type of a field (specified by name or index) in a composite DataType T.

Examples

julia> struct Foo
            x::Int64
            y::String
        end
@@ -789,13 +789,13 @@
 Int64
 
 julia> fieldtype(Foo, 2)
-String
source
Base.fieldtypesFunction
fieldtypes(T::Type)

The declared types of all fields in a composite DataType T as a tuple.

Julia 1.1

This function requires at least Julia 1.1.

Examples

julia> struct Foo
+String
source
Base.fieldtypesFunction
fieldtypes(T::Type)

The declared types of all fields in a composite DataType T as a tuple.

Julia 1.1

This function requires at least Julia 1.1.

Examples

julia> struct Foo
            x::Int64
            y::String
        end
 
 julia> fieldtypes(Foo)
-(Int64, String)
source
Base.fieldcountFunction
fieldcount(t::Type)

Get the number of fields that an instance of the given type would have. An error is thrown if the type is too abstract to determine this.

source
Base.hasfieldFunction
hasfield(T::Type, name::Symbol)

Return a boolean indicating whether T has name as one of its own fields.

See also fieldnames, fieldcount, hasproperty.

Julia 1.2

This function requires at least Julia 1.2.

Examples

julia> struct Foo
+(Int64, String)
source
Base.fieldcountFunction
fieldcount(t::Type)

Get the number of fields that an instance of the given type would have. An error is thrown if the type is too abstract to determine this.

source
Base.hasfieldFunction
hasfield(T::Type, name::Symbol)

Return a boolean indicating whether T has name as one of its own fields.

See also fieldnames, fieldcount, hasproperty.

Julia 1.2

This function requires at least Julia 1.2.

Examples

julia> struct Foo
             bar::Int
        end
 
@@ -803,7 +803,7 @@
 true
 
 julia> hasfield(Foo, :x)
-false
source
Core.nfieldsFunction
nfields(x) -> Int

Get the number of fields in the given object.

Examples

julia> a = 1//2;
+false
source
Core.nfieldsFunction
nfields(x) -> Int

Get the number of fields in the given object.

Examples

julia> a = 1//2;
 
 julia> nfields(a)
 2
@@ -817,7 +817,7 @@
 julia> ex = ErrorException("I've done a bad thing");
 
 julia> nfields(ex)
-1

In these examples, a is a Rational, which has two fields. b is an Int, which is a primitive bitstype with no fields at all. ex is an ErrorException, which has one field.

source
Base.isconstFunction
isconst(t::DataType, s::Union{Int,Symbol}) -> Bool

Determine whether a field s is declared const in a given type t.

source
isconst(m::Module, s::Symbol) -> Bool

Determine whether a global is declared const in a given module m.

source
Base.isfieldatomicFunction
isfieldatomic(t::DataType, s::Union{Int,Symbol}) -> Bool

Determine whether a field s is declared @atomic in a given type t.

source

Memory layout

Base.sizeofMethod
sizeof(T::DataType)
+1

In these examples, a is a Rational, which has two fields. b is an Int, which is a primitive bitstype with no fields at all. ex is an ErrorException, which has one field.

source
Base.isconstFunction
isconst(t::DataType, s::Union{Int,Symbol}) -> Bool

Determine whether a field s is declared const in a given type t.

source
isconst(m::Module, s::Symbol) -> Bool

Determine whether a global is declared const in a given module m.

source
Base.isfieldatomicFunction
isfieldatomic(t::DataType, s::Union{Int,Symbol}) -> Bool

Determine whether a field s is declared @atomic in a given type t.

source

Memory layout

Base.sizeofMethod
sizeof(T::DataType)
 sizeof(obj)

Size, in bytes, of the canonical binary representation of the given DataType T, if any. Or the size, in bytes, of object obj if it is not a DataType.

See also Base.summarysize.

Examples

julia> sizeof(Float32)
 4
 
@@ -842,7 +842,7 @@
 9

If DataType T does not have a specific size, an error is thrown.

julia> sizeof(AbstractArray)
 ERROR: Abstract type AbstractArray does not have a definite size.
 Stacktrace:
-[...]
source
Base.isconcretetypeFunction
isconcretetype(T)

Determine whether type T is a concrete type, meaning it could have direct instances (values x such that typeof(x) === T). Note that this is not the negation of isabstracttype(T). If T is not a type, then return false.

See also: isbits, isabstracttype, issingletontype.

Examples

julia> isconcretetype(Complex)
+[...]
source
Base.isconcretetypeFunction
isconcretetype(T)

Determine whether type T is a concrete type, meaning it could have direct instances (values x such that typeof(x) === T). Note that this is not the negation of isabstracttype(T). If T is not a type, then return false.

See also: isbits, isabstracttype, issingletontype.

Examples

julia> isconcretetype(Complex)
 false
 
 julia> isconcretetype(Complex{Float32})
@@ -858,11 +858,11 @@
 false
 
 julia> isconcretetype(Union{Int,String})
-false
source
Base.isbitstypeFunction
isbitstype(T)

Return true if type T is a "plain data" type, meaning it is immutable and contains no references to other values, only primitive types and other isbitstype types. Typical examples are numeric types such as UInt8, Float64, and Complex{Float64}. This category of types is significant since they are valid as type parameters, may not track isdefined / isassigned status, and have a defined layout that is compatible with C. If T is not a type, then return false.

See also isbits, isprimitivetype, ismutable.

Examples

julia> isbitstype(Complex{Float64})
+false
source
Base.isbitstypeFunction
isbitstype(T)

Return true if type T is a "plain data" type, meaning it is immutable and contains no references to other values, only primitive types and other isbitstype types. Typical examples are numeric types such as UInt8, Float64, and Complex{Float64}. This category of types is significant since they are valid as type parameters, may not track isdefined / isassigned status, and have a defined layout that is compatible with C. If T is not a type, then return false.

See also isbits, isprimitivetype, ismutable.

Examples

julia> isbitstype(Complex{Float64})
 true
 
 julia> isbitstype(Complex)
-false
source
Base.fieldoffsetFunction
fieldoffset(type, i)

The byte offset of field i of a type relative to the data start. For example, we could use it in the following manner to summarize information about a struct:

julia> structinfo(T) = [(fieldoffset(T,i), fieldname(T,i), fieldtype(T,i)) for i = 1:fieldcount(T)];
+false
source
Base.fieldoffsetFunction
fieldoffset(type, i)

The byte offset of field i of a type relative to the data start. For example, we could use it in the following manner to summarize information about a struct:

julia> structinfo(T) = [(fieldoffset(T,i), fieldname(T,i), fieldtype(T,i)) for i = 1:fieldcount(T)];
 
 julia> structinfo(Base.Filesystem.StatStruct)
 14-element Vector{Tuple{UInt64, Symbol, Type}}:
@@ -879,7 +879,7 @@
  (0x0000000000000050, :blocks, Int64)
  (0x0000000000000058, :mtime, Float64)
  (0x0000000000000060, :ctime, Float64)
- (0x0000000000000068, :ioerrno, Int32)
source
Base.datatype_alignmentFunction
Base.datatype_alignment(dt::DataType) -> Int

Memory allocation minimum alignment for instances of this type. Can be called on any isconcretetype, although for Memory it will give the alignment of the elements, not the whole object.

source
Base.datatype_haspaddingFunction
Base.datatype_haspadding(dt::DataType) -> Bool

Return whether the fields of instances of this type are packed in memory, with no intervening padding bits (defined as bits whose value does not impact the semantic value of the instance itself). Can be called on any isconcretetype.

source
Base.datatype_pointerfreeFunction
Base.datatype_pointerfree(dt::DataType) -> Bool

Return whether instances of this type can contain references to gc-managed memory. Can be called on any isconcretetype.

source

Special values

Base.typeminFunction
typemin(T)

The lowest value representable by the given (real) numeric DataType T.

See also: floatmin, typemax, eps.

Examples

julia> typemin(Int8)
+ (0x0000000000000068, :ioerrno, Int32)
source
Base.datatype_alignmentFunction
Base.datatype_alignment(dt::DataType) -> Int

Memory allocation minimum alignment for instances of this type. Can be called on any isconcretetype, although for Memory it will give the alignment of the elements, not the whole object.

source
Base.datatype_haspaddingFunction
Base.datatype_haspadding(dt::DataType) -> Bool

Return whether the fields of instances of this type are packed in memory, with no intervening padding bits (defined as bits whose value does not impact the semantic value of the instance itself). Can be called on any isconcretetype.

source
Base.datatype_pointerfreeFunction
Base.datatype_pointerfree(dt::DataType) -> Bool

Return whether instances of this type can contain references to gc-managed memory. Can be called on any isconcretetype.

source

Special values

Base.typeminFunction
typemin(T)

The lowest value representable by the given (real) numeric DataType T.

See also: floatmin, typemax, eps.

Examples

julia> typemin(Int8)
 -128
 
 julia> typemin(UInt32)
@@ -892,7 +892,7 @@
 -Inf32
 
 julia> nextfloat(-Inf32)  # smallest finite Float32 floating point number
--3.4028235f38
source
Base.typemaxFunction
typemax(T)

The highest value representable by the given (real) numeric DataType.

See also: floatmax, typemin, eps.

Examples

julia> typemax(Int8)
+-3.4028235f38
source
Base.typemaxFunction
typemax(T)

The highest value representable by the given (real) numeric DataType.

See also: floatmax, typemin, eps.

Examples

julia> typemax(Int8)
 127
 
 julia> typemax(UInt32)
@@ -905,14 +905,14 @@
 Inf32
 
 julia> floatmax(Float32)  # largest finite Float32 floating point number
-3.4028235f38
source
Base.floatminFunction
floatmin(T = Float64)

Return the smallest positive normal number representable by the floating-point type T.

Examples

julia> floatmin(Float16)
+3.4028235f38
source
Base.floatminFunction
floatmin(T = Float64)

Return the smallest positive normal number representable by the floating-point type T.

Examples

julia> floatmin(Float16)
 Float16(6.104e-5)
 
 julia> floatmin(Float32)
 1.1754944f-38
 
 julia> floatmin()
-2.2250738585072014e-308
source
Base.floatmaxFunction
floatmax(T = Float64)

Return the largest finite number representable by the floating-point type T.

See also: typemax, floatmin, eps.

Examples

julia> floatmax(Float16)
+2.2250738585072014e-308
source
Base.floatmaxFunction
floatmax(T = Float64)

Return the largest finite number representable by the floating-point type T.

See also: typemax, floatmin, eps.

Examples

julia> floatmax(Float16)
 Float16(6.55e4)
 
 julia> floatmax(Float32)
@@ -922,7 +922,7 @@
 1.7976931348623157e308
 
 julia> typemax(Float64)
-Inf
source
Base.maxintfloatFunction
maxintfloat(T, S)

The largest consecutive integer representable in the given floating-point type T that also does not exceed the maximum integer representable by the integer type S. Equivalently, it is the minimum of maxintfloat(T) and typemax(S).

source
maxintfloat(T=Float64)

The largest consecutive integer-valued floating-point number that is exactly represented in the given floating-point type T (which defaults to Float64).

That is, maxintfloat returns the smallest positive integer-valued floating-point number n such that n+1 is not exactly representable in the type T.

When an Integer-type value is needed, use Integer(maxintfloat(T)).

source
Base.maxintfloatFunction
maxintfloat(T, S)

The largest consecutive integer representable in the given floating-point type T that also does not exceed the maximum integer representable by the integer type S. Equivalently, it is the minimum of maxintfloat(T) and typemax(S).

source
maxintfloat(T=Float64)

The largest consecutive integer-valued floating-point number that is exactly represented in the given floating-point type T (which defaults to Float64).

That is, maxintfloat returns the smallest positive integer-valued floating-point number n such that n+1 is not exactly representable in the type T.

When an Integer-type value is needed, use Integer(maxintfloat(T)).

source
Base.epsMethod
eps(::Type{T}) where T<:AbstractFloat
 eps()

Return the machine epsilon of the floating point type T (T = Float64 by default). This is defined as the gap between 1 and the next largest value representable by typeof(one(T)), and is equivalent to eps(one(T)). (Since eps(T) is a bound on the relative error of T, it is a "dimensionless" quantity like one.)

Examples

julia> eps()
 2.220446049250313e-16
 
@@ -933,7 +933,7 @@
 1.0000000000000002
 
 julia> 1.0 + eps()/2
-1.0
source
Base.epsMethod
eps(x::AbstractFloat)

Return the unit in last place (ulp) of x. This is the distance between consecutive representable floating point values at x. In most cases, if the distance on either side of x is different, then the larger of the two is taken, that is

eps(x) == max(x-prevfloat(x), nextfloat(x)-x)

The exceptions to this rule are the smallest and largest finite values (e.g. nextfloat(-Inf) and prevfloat(Inf) for Float64), which round to the smaller of the values.

The rationale for this behavior is that eps bounds the floating point rounding error. Under the default RoundNearest rounding mode, if $y$ is a real number and $x$ is the nearest floating point number to $y$, then

\[|y-x| \leq \operatorname{eps}(x)/2.\]

See also: nextfloat, issubnormal, floatmax.

Examples

julia> eps(1.0)
+1.0
source
Base.epsMethod
eps(x::AbstractFloat)

Return the unit in last place (ulp) of x. This is the distance between consecutive representable floating point values at x. In most cases, if the distance on either side of x is different, then the larger of the two is taken, that is

eps(x) == max(x-prevfloat(x), nextfloat(x)-x)

The exceptions to this rule are the smallest and largest finite values (e.g. nextfloat(-Inf) and prevfloat(Inf) for Float64), which round to the smaller of the values.

The rationale for this behavior is that eps bounds the floating point rounding error. Under the default RoundNearest rounding mode, if $y$ is a real number and $x$ is the nearest floating point number to $y$, then

\[|y-x| \leq \operatorname{eps}(x)/2.\]

See also: nextfloat, issubnormal, floatmax.

Examples

julia> eps(1.0)
 2.220446049250313e-16
 
 julia> eps(prevfloat(2.0))
@@ -949,10 +949,10 @@
 Inf
 
 julia> x + prevfloat(eps(x)/2) # rounds down
-1.7976931348623157e308
source
Base.instancesFunction
instances(T::Type)

Return a collection of all instances of the given type, if applicable. Mostly used for enumerated types (see @enum).

Examples

julia> @enum Color red blue green
+1.7976931348623157e308
source
Base.instancesFunction
instances(T::Type)

Return a collection of all instances of the given type, if applicable. Mostly used for enumerated types (see @enum).

Examples

julia> @enum Color red blue green
 
 julia> instances(Color)
-(red, blue, green)
source

Special Types

Core.AnyType
Any::DataType

Any is the union of all types. It has the defining property isa(x, Any) == true for any x. Any therefore describes the entire universe of possible values. For example Integer is a subset of Any that includes Int, Int8, and other integer types.

source
Core.UnionType
Union{Types...}

A Union type is an abstract type which includes all instances of any of its argument types. This means that T <: Union{T,S} and S <: Union{T,S}.

Like other abstract types, it cannot be instantiated, even if all of its arguments are non abstract.

Examples

julia> IntOrString = Union{Int,AbstractString}
+(red, blue, green)
source

Special Types

Core.AnyType
Any::DataType

Any is the union of all types. It has the defining property isa(x, Any) == true for any x. Any therefore describes the entire universe of possible values. For example Integer is a subset of Any that includes Int, Int8, and other integer types.

source
Core.UnionType
Union{Types...}

A Union type is an abstract type which includes all instances of any of its argument types. This means that T <: Union{T,S} and S <: Union{T,S}.

Like other abstract types, it cannot be instantiated, even if all of its arguments are non abstract.

Examples

julia> IntOrString = Union{Int,AbstractString}
 Union{Int64, AbstractString}
 
 julia> 1 isa IntOrString # instance of Int is included in the union
@@ -962,7 +962,7 @@
 true
 
 julia> 1.0 isa IntOrString # Float64 is not included because it is neither Int nor AbstractString
-false

Extended Help

Unlike most other parametric types, unions are covariant in their parameters. For example, Union{Real, String} is a subtype of Union{Number, AbstractString}.

The empty union Union{} is the bottom type of Julia.

source
Union{}Keyword
Union{}

Union{}, the empty Union of types, is the bottom type of the type system. That is, for each T::Type, Union{} <: T. Also see the subtyping operator's documentation: <:.

As such, Union{} is also an empty/uninhabited type, meaning that it has no values. That is, for each x, isa(x, Union{}) == false.

Base.Bottom is defined as its alias and the type of Union{} is Core.TypeofBottom.

Examples

julia> isa(nothing, Union{})
+false

Extended Help

Unlike most other parametric types, unions are covariant in their parameters. For example, Union{Real, String} is a subtype of Union{Number, AbstractString}.

The empty union Union{} is the bottom type of Julia.

source
Union{}Keyword
Union{}

Union{}, the empty Union of types, is the bottom type of the type system. That is, for each T::Type, Union{} <: T. Also see the subtyping operator's documentation: <:.

As such, Union{} is also an empty/uninhabited type, meaning that it has no values. That is, for each x, isa(x, Union{}) == false.

Base.Bottom is defined as its alias and the type of Union{} is Core.TypeofBottom.

Examples

julia> isa(nothing, Union{})
 false
 
 julia> Union{} <: Int
@@ -972,11 +972,11 @@
 true
 
 julia> isa(Union{}, Union)
-false
source
Core.UnionAllType
UnionAll

A union of types over all values of a type parameter. UnionAll is used to describe parametric types where the values of some parameters are not known. See the manual section on UnionAll Types.

Examples

julia> typeof(Vector)
+false
source
Core.UnionAllType
UnionAll

A union of types over all values of a type parameter. UnionAll is used to describe parametric types where the values of some parameters are not known. See the manual section on UnionAll Types.

Examples

julia> typeof(Vector)
 UnionAll
 
 julia> typeof(Vector{Int})
-DataType
source
Core.TupleType
Tuple{Types...}

A tuple is a fixed-length container that can hold any values of different types, but cannot be modified (it is immutable). The values can be accessed via indexing. Tuple literals are written with commas and parentheses:

julia> (1, 1+1)
+DataType
source
Core.TupleType
Tuple{Types...}

A tuple is a fixed-length container that can hold any values of different types, but cannot be modified (it is immutable). The values can be accessed via indexing. Tuple literals are written with commas and parentheses:

julia> (1, 1+1)
 (1, 2)
 
 julia> (1,)
@@ -993,8 +993,8 @@
 ("a", 1)
 
 julia> Tuple{String, Float64}(["a", 1])
-("a", 1.0)

Tuple types are covariant in their parameters: Tuple{Int} is a subtype of Tuple{Any}. Therefore Tuple{Any} is considered an abstract type, and tuple types are only concrete if their parameters are. Tuples do not have field names; fields are only accessed by index. Tuple types may have any number of parameters.

See the manual section on Tuple Types.

See also Vararg, NTuple, ntuple, tuple, NamedTuple.

source
Core.NTupleType
NTuple{N, T}

A compact way of representing the type for a tuple of length N where all elements are of type T.

Examples

julia> isa((1, 2, 3, 4, 5, 6), NTuple{6, Int})
-true

See also ntuple.

source
Core.NamedTupleType
NamedTuple

NamedTuples are, as their name suggests, named Tuples. That is, they're a tuple-like collection of values, where each entry has a unique name, represented as a Symbol. Like Tuples, NamedTuples are immutable; neither the names nor the values can be modified in place after construction.

A named tuple can be created as a tuple literal with keys, e.g. (a=1, b=2), or as a tuple literal with semicolon after the opening parenthesis, e.g. (; a=1, b=2) (this form also accepts programmatically generated names as described below), or using a NamedTuple type as constructor, e.g. NamedTuple{(:a, :b)}((1,2)).

Accessing the value associated with a name in a named tuple can be done using field access syntax, e.g. x.a, or using getindex, e.g. x[:a] or x[(:a, :b)]. A tuple of the names can be obtained using keys, and a tuple of the values can be obtained using values.

Note

Iteration over NamedTuples produces the values without the names. (See example below.) To iterate over the name-value pairs, use the pairs function.

The @NamedTuple macro can be used for conveniently declaring NamedTuple types.

Examples

julia> x = (a=1, b=2)
+("a", 1.0)

Tuple types are covariant in their parameters: Tuple{Int} is a subtype of Tuple{Any}. Therefore Tuple{Any} is considered an abstract type, and tuple types are only concrete if their parameters are. Tuples do not have field names; fields are only accessed by index. Tuple types may have any number of parameters.

See the manual section on Tuple Types.

See also Vararg, NTuple, ntuple, tuple, NamedTuple.

source
Core.NTupleType
NTuple{N, T}

A compact way of representing the type for a tuple of length N where all elements are of type T.

Examples

julia> isa((1, 2, 3, 4, 5, 6), NTuple{6, Int})
+true

See also ntuple.

source
Core.NamedTupleType
NamedTuple

NamedTuples are, as their name suggests, named Tuples. That is, they're a tuple-like collection of values, where each entry has a unique name, represented as a Symbol. Like Tuples, NamedTuples are immutable; neither the names nor the values can be modified in place after construction.

A named tuple can be created as a tuple literal with keys, e.g. (a=1, b=2), or as a tuple literal with semicolon after the opening parenthesis, e.g. (; a=1, b=2) (this form also accepts programmatically generated names as described below), or using a NamedTuple type as constructor, e.g. NamedTuple{(:a, :b)}((1,2)).

Accessing the value associated with a name in a named tuple can be done using field access syntax, e.g. x.a, or using getindex, e.g. x[:a] or x[(:a, :b)]. A tuple of the names can be obtained using keys, and a tuple of the values can be obtained using values.

Note

Iteration over NamedTuples produces the values without the names. (See example below.) To iterate over the name-value pairs, use the pairs function.

The @NamedTuple macro can be used for conveniently declaring NamedTuple types.

Examples

julia> x = (a=1, b=2)
 (a = 1, b = 2)
 
 julia> x.a
@@ -1044,7 +1044,7 @@
 (x = 0,)
 
 julia> (; t.x)
-(x = 0,)
Julia 1.5

Implicit names from identifiers and dot expressions are available as of Julia 1.5.

Julia 1.7

Use of getindex methods with multiple Symbols is available as of Julia 1.7.

source
Base.@NamedTupleMacro
@NamedTuple{key1::Type1, key2::Type2, ...}
+(x = 0,)
Julia 1.5

Implicit names from identifiers and dot expressions are available as of Julia 1.5.

Julia 1.7

Use of getindex methods with multiple Symbols is available as of Julia 1.7.

source
Base.@NamedTupleMacro
@NamedTuple{key1::Type1, key2::Type2, ...}
 @NamedTuple begin key1::Type1; key2::Type2; ...; end

This macro gives a more convenient syntax for declaring NamedTuple types. It returns a NamedTuple type with the given keys and types, equivalent to NamedTuple{(:key1, :key2, ...), Tuple{Type1,Type2,...}}. If the ::Type declaration is omitted, it is taken to be Any. The begin ... end form allows the declarations to be split across multiple lines (similar to a struct declaration), but is otherwise equivalent. The NamedTuple macro is used when printing NamedTuple types to e.g. the REPL.

For example, the tuple (a=3.1, b="hello") has a type NamedTuple{(:a, :b), Tuple{Float64, String}}, which can also be declared via @NamedTuple as:

julia> @NamedTuple{a::Float64, b::String}
 @NamedTuple{a::Float64, b::String}
 
@@ -1052,7 +1052,7 @@
            a::Float64
            b::String
        end
-@NamedTuple{a::Float64, b::String}
Julia 1.5

This macro is available as of Julia 1.5.

source
Base.@KwargsMacro
@Kwargs{key1::Type1, key2::Type2, ...}

This macro gives a convenient way to construct the type representation of keyword arguments from the same syntax as @NamedTuple. For example, when we have a function call like func([positional arguments]; kw1=1.0, kw2="2"), we can use this macro to construct the internal type representation of the keyword arguments as @Kwargs{kw1::Float64, kw2::String}. The macro syntax is specifically designed to simplify the signature type of a keyword method when it is printed in the stack trace view.

julia> @Kwargs{init::Int} # the internal representation of keyword arguments
+@NamedTuple{a::Float64, b::String}
Julia 1.5

This macro is available as of Julia 1.5.

source
Base.@KwargsMacro
@Kwargs{key1::Type1, key2::Type2, ...}

This macro gives a convenient way to construct the type representation of keyword arguments from the same syntax as @NamedTuple. For example, when we have a function call like func([positional arguments]; kw1=1.0, kw2="2"), we can use this macro to construct the internal type representation of the keyword arguments as @Kwargs{kw1::Float64, kw2::String}. The macro syntax is specifically designed to simplify the signature type of a keyword method when it is printed in the stack trace view.

julia> @Kwargs{init::Int} # the internal representation of keyword arguments
 Base.Pairs{Symbol, Int64, Tuple{Symbol}, @NamedTuple{init::Int64}}
 
 julia> sum("julia"; init=1)
@@ -1087,14 +1087,14 @@
   [9] sum(a::String; kw::@Kwargs{init::Int64})
     @ Base ./reduce.jl:564 [inlined]
  [10] top-level scope
-    @ REPL[12]:1
Julia 1.10

This macro is available as of Julia 1.10.

source
Base.ValType
Val(c)

Return Val{c}(), which contains no run-time data. Types like this can be used to pass the information between functions through the value c, which must be an isbits value or a Symbol. The intent of this construct is to be able to dispatch on constants directly (at compile time) without having to test the value of the constant at run time.

Examples

julia> f(::Val{true}) = "Good"
+    @ REPL[12]:1
Julia 1.10

This macro is available as of Julia 1.10.

source
Base.ValType
Val(c)

Return Val{c}(), which contains no run-time data. Types like this can be used to pass the information between functions through the value c, which must be an isbits value or a Symbol. The intent of this construct is to be able to dispatch on constants directly (at compile time) without having to test the value of the constant at run time.

Examples

julia> f(::Val{true}) = "Good"
 f (generic function with 1 method)
 
 julia> f(::Val{false}) = "Bad"
 f (generic function with 2 methods)
 
 julia> f(Val(true))
-"Good"
source
Core.VarargConstant
Vararg{T,N}

The last parameter of a tuple type Tuple can be the special value Vararg, which denotes any number of trailing elements. Vararg{T,N} corresponds to exactly N elements of type T. Finally Vararg{T} corresponds to zero or more elements of type T. Vararg tuple types are used to represent the arguments accepted by varargs methods (see the section on Varargs Functions in the manual.)

See also NTuple.

Examples

julia> mytupletype = Tuple{AbstractString, Vararg{Int}}
+"Good"
source
Core.VarargConstant
Vararg{T,N}

The last parameter of a tuple type Tuple can be the special value Vararg, which denotes any number of trailing elements. Vararg{T,N} corresponds to exactly N elements of type T. Finally Vararg{T} corresponds to zero or more elements of type T. Vararg tuple types are used to represent the arguments accepted by varargs methods (see the section on Varargs Functions in the manual.)

See also NTuple.

Examples

julia> mytupletype = Tuple{AbstractString, Vararg{Int}}
 Tuple{AbstractString, Vararg{Int64}}
 
 julia> isa(("1",), mytupletype)
@@ -1107,7 +1107,7 @@
 true
 
 julia> isa(("1",1,2,3.0), mytupletype)
-false
source
Base.SomeType
Some{T}

A wrapper type used in Union{Some{T}, Nothing} to distinguish between the absence of a value (nothing) and the presence of a nothing value (i.e. Some(nothing)).

Use something to access the value wrapped by a Some object.

source
Base.SomeType
Some{T}

A wrapper type used in Union{Some{T}, Nothing} to distinguish between the absence of a value (nothing) and the presence of a nothing value (i.e. Some(nothing)).

Use something to access the value wrapped by a Some object.

source
Base.somethingFunction
something(x...)

Return the first value in the arguments which is not equal to nothing, if any. Otherwise throw an error. Arguments of type Some are unwrapped.

See also coalesce, skipmissing, @something.

Examples

julia> something(nothing, 1)
 1
 
 julia> something(Some(1), nothing)
@@ -1120,7 +1120,7 @@
 missing
 
 julia> something(nothing, nothing)
-ERROR: ArgumentError: No value arguments present
source
Base.@somethingMacro
@something(x...)

Short-circuiting version of something.

Examples

julia> f(x) = (println("f($x)"); nothing);
+ERROR: ArgumentError: No value arguments present
source
Base.@somethingMacro
@something(x...)

Short-circuiting version of something.

Examples

julia> f(x) = (println("f($x)"); nothing);
 
 julia> a = 1;
 
@@ -1140,7 +1140,7 @@
 f(3)
 
 julia> b === nothing
-true
Julia 1.7

This macro is available as of Julia 1.7.

source
Base.Enums.@enumMacro
@enum EnumName[::BaseType] value1[=x] value2[=y]

Create an Enum{BaseType} subtype with name EnumName and enum member values of value1 and value2 with optional assigned values of x and y, respectively. EnumName can be used just like other types and enum member values as regular values, such as

Examples

julia> @enum Fruit apple=1 orange=2 kiwi=3
+true
Julia 1.7

This macro is available as of Julia 1.7.

source
Base.Enums.@enumMacro
@enum EnumName[::BaseType] value1[=x] value2[=y]

Create an Enum{BaseType} subtype with name EnumName and enum member values of value1 and value2 with optional assigned values of x and y, respectively. EnumName can be used just like other types and enum member values as regular values, such as

Examples

julia> @enum Fruit apple=1 orange=2 kiwi=3
 
 julia> f(x::Fruit) = "I'm a Fruit with value: $(Int(x))"
 f (generic function with 1 method)
@@ -1154,7 +1154,7 @@
     value2
 end

BaseType, which defaults to Int32, must be a primitive subtype of Integer. Member values can be converted between the enum type and BaseType. read and write perform these conversions automatically. In case the enum is created with a non-default BaseType, Integer(value1) will return the integer value1 with the type BaseType.

To list all the instances of an enum use instances, e.g.

julia> instances(Fruit)
 (apple, orange, kiwi)

It is possible to construct a symbol from an enum instance:

julia> Symbol(apple)
-:apple
source
Core.ExprType
Expr(head::Symbol, args...)

A type representing compound expressions in parsed julia code (ASTs). Each expression consists of a head Symbol identifying which kind of expression it is (e.g. a call, for loop, conditional statement, etc.), and subexpressions (e.g. the arguments of a call). The subexpressions are stored in a Vector{Any} field called args.

See the manual chapter on Metaprogramming and the developer documentation Julia ASTs.

Examples

julia> Expr(:call, :+, 1, 2)
+:apple
source
Core.ExprType
Expr(head::Symbol, args...)

A type representing compound expressions in parsed julia code (ASTs). Each expression consists of a head Symbol identifying which kind of expression it is (e.g. a call, for loop, conditional statement, etc.), and subexpressions (e.g. the arguments of a call). The subexpressions are stored in a Vector{Any} field called args.

See the manual chapter on Metaprogramming and the developer documentation Julia ASTs.

Examples

julia> Expr(:call, :+, 1, 2)
 :(1 + 2)
 
 julia> dump(:(a ? b : c))
@@ -1163,7 +1163,7 @@
   args: Array{Any}((3,))
     1: Symbol a
     2: Symbol b
-    3: Symbol c
source
Core.SymbolType
Symbol

The type of object used to represent identifiers in parsed julia code (ASTs). Also often used as a name or label to identify an entity (e.g. as a dictionary key). Symbols can be entered using the : quote operator:

julia> :name
+    3: Symbol c
source
Core.SymbolType
Symbol

The type of object used to represent identifiers in parsed julia code (ASTs). Also often used as a name or label to identify an entity (e.g. as a dictionary key). Symbols can be entered using the : quote operator:

julia> :name
 :name
 
 julia> typeof(:name)
@@ -1173,18 +1173,18 @@
 42
 
 julia> eval(:x)
-42

Symbols can also be constructed from strings or other values by calling the constructor Symbol(x...).

Symbols are immutable and their implementation re-uses the same object for all Symbols with the same name.

Unlike strings, Symbols are "atomic" or "scalar" entities that do not support iteration over characters.

source
Core.SymbolMethod
Symbol(x...) -> Symbol

Create a Symbol by concatenating the string representations of the arguments together.

Examples

julia> Symbol("my", "name")
+42

Symbols can also be constructed from strings or other values by calling the constructor Symbol(x...).

Symbols are immutable and their implementation re-uses the same object for all Symbols with the same name.

Unlike strings, Symbols are "atomic" or "scalar" entities that do not support iteration over characters.

source
Core.SymbolMethod
Symbol(x...) -> Symbol

Create a Symbol by concatenating the string representations of the arguments together.

Examples

julia> Symbol("my", "name")
 :myname
 
 julia> Symbol("day", 4)
-:day4
source
Core.ModuleType
Module

A Module is a separate global variable workspace. See module and the manual section about modules for details.

Module(name::Symbol=:anonymous, std_imports=true, default_names=true)

Return a module with the specified name. A baremodule corresponds to Module(:ModuleName, false)

An empty module containing no names at all can be created with Module(:ModuleName, false, false). This module will not import Base or Core and does not contain a reference to itself.

source

Generic Functions

Core.FunctionType
Function

Abstract type of all functions.

Examples

julia> isa(+, Function)
+:day4
source
Core.ModuleType
Module

A Module is a separate global variable workspace. See module and the manual section about modules for details.

Module(name::Symbol=:anonymous, std_imports=true, default_names=true)

Return a module with the specified name. A baremodule corresponds to Module(:ModuleName, false)

An empty module containing no names at all can be created with Module(:ModuleName, false, false). This module will not import Base or Core and does not contain a reference to itself.

source

Generic Functions

Core.FunctionType
Function

Abstract type of all functions.

Examples

julia> isa(+, Function)
 true
 
 julia> typeof(sin)
 typeof(sin) (singleton type of function sin, subtype of Function)
 
 julia> ans <: Function
-true
source
Base.hasmethodFunction
hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=get_world_counter()) -> Bool

Determine whether the given generic function has a method matching the given Tuple of argument types with the upper bound of world age given by world.

If a tuple of keyword argument names kwnames is provided, this also checks whether the method of f matching t has the given keyword argument names. If the matching method accepts a variable number of keyword arguments, e.g. with kwargs..., any names given in kwnames are considered valid. Otherwise the provided names must be a subset of the method's keyword arguments.

See also applicable.

Julia 1.2

Providing keyword argument names requires Julia 1.2 or later.

Examples

julia> hasmethod(length, Tuple{Array})
+true
source
Base.hasmethodFunction
hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=get_world_counter()) -> Bool

Determine whether the given generic function has a method matching the given Tuple of argument types with the upper bound of world age given by world.

If a tuple of keyword argument names kwnames is provided, this also checks whether the method of f matching t has the given keyword argument names. If the matching method accepts a variable number of keyword arguments, e.g. with kwargs..., any names given in kwnames are considered valid. Otherwise the provided names must be a subset of the method's keyword arguments.

See also applicable.

Julia 1.2

Providing keyword argument names requires Julia 1.2 or later.

Examples

julia> hasmethod(length, Tuple{Array})
 true
 
 julia> f(; oranges=0) = oranges;
@@ -1198,7 +1198,7 @@
 julia> g(; xs...) = 4;
 
 julia> hasmethod(g, Tuple{}, (:a, :b, :c, :d))  # g accepts arbitrary kwargs
-true
source
Core.applicableFunction
applicable(f, args...) -> Bool

Determine whether the given generic function has a method applicable to the given arguments.

See also hasmethod.

Examples

julia> function f(x, y)
+true
source
Core.applicableFunction
applicable(f, args...) -> Bool

Determine whether the given generic function has a method applicable to the given arguments.

See also hasmethod.

Examples

julia> function f(x, y)
            x + y
        end;
 
@@ -1206,7 +1206,7 @@
 false
 
 julia> applicable(f, 1, 2)
-true
source
Base.isambiguousFunction
Base.isambiguous(m1, m2; ambiguous_bottom=false) -> Bool

Determine whether two methods m1 and m2 may be ambiguous for some call signature. This test is performed in the context of other methods of the same function; in isolation, m1 and m2 might be ambiguous, but if a third method resolving the ambiguity has been defined, this returns false. Alternatively, in isolation m1 and m2 might be ordered, but if a third method cannot be sorted with them, they may cause an ambiguity together.

For parametric types, the ambiguous_bottom keyword argument controls whether Union{} counts as an ambiguous intersection of type parameters – when true, it is considered ambiguous, when false it is not.

Examples

julia> foo(x::Complex{<:Integer}) = 1
+true
source
Base.isambiguousFunction
Base.isambiguous(m1, m2; ambiguous_bottom=false) -> Bool

Determine whether two methods m1 and m2 may be ambiguous for some call signature. This test is performed in the context of other methods of the same function; in isolation, m1 and m2 might be ambiguous, but if a third method resolving the ambiguity has been defined, this returns false. Alternatively, in isolation m1 and m2 might be ordered, but if a third method cannot be sorted with them, they may cause an ambiguity together.

For parametric types, the ambiguous_bottom keyword argument controls whether Union{} counts as an ambiguous intersection of type parameters – when true, it is considered ambiguous, when false it is not.

Examples

julia> foo(x::Complex{<:Integer}) = 1
 foo (generic function with 1 method)
 
 julia> foo(x::Complex{<:Rational}) = 2
@@ -1221,7 +1221,7 @@
 true
 
 julia> Base.isambiguous(m1, m2, ambiguous_bottom=false)
-false
source
Core.invokeFunction
invoke(f, argtypes::Type, args...; kwargs...)
 invoke(f, argtypes::Method, args...; kwargs...)
 invoke(f, argtypes::CodeInstance, args...; kwargs...)

Invoke a method for the given generic function f matching the specified types argtypes on the specified arguments args and passing the keyword arguments kwargs. The arguments args must conform with the specified types in argtypes, i.e. conversion is not automatically performed. This method allows invoking a method other than the most specific matching method, which is useful when the behavior of a more general definition is explicitly needed (often as part of the implementation of a more specific method of the same function). However, because this means the runtime must do more work, invoke is generally also slower–sometimes significantly so–than doing normal dispatch with a regular call.

Be careful when using invoke for functions that you don't write. What definition is used for given argtypes is an implementation detail unless the function is explicitly states that calling with certain argtypes is a part of public API. For example, the change between f1 and f2 in the example below is usually considered compatible because the change is invisible by the caller with a normal (non-invoke) call. However, the change is visible if you use invoke.

Passing a Method instead of a signature

The argtypes argument may be a Method, in which case the ordinary method table lookup is bypassed entirely and the given method is invoked directly. Needing this feature is uncommon. Note in particular that the specified Method may be entirely unreachable from ordinary dispatch (or ordinary invoke), e.g. because it was replaced or fully covered by more specific methods. If the method is part of the ordinary method table, this call behaves similar to invoke(f, method.sig, args...).

Julia 1.12

Passing a Method requires Julia 1.12.

Passing a CodeInstance instead of a signature

The argtypes argument may be a CodeInstance, bypassing both method lookup and specialization. The semantics of this invocation are similar to a function pointer call of the CodeInstance's invoke pointer. It is an error to invoke a CodeInstance with arguments that do not match its parent MethodInstance or from a world age not included in the min_world/max_world range. It is undefined behavior to invoke a CodeInstance whose behavior does not match the constraints specified in its fields. For some code instances with owner !== nothing (i.e. those generated by external compilers), it may be an error to invoke them after passing through precompilation. This is an advanced interface intended for use with external compiler plugins.

Julia 1.12

Passing a CodeInstance requires Julia 1.12.

Examples

julia> f(x::Real) = x^2;
 
@@ -1247,7 +1247,7 @@
 Real
 
 julia> invoke(f2, Tuple{Real}, 1)
-Integer
source
Base.@invokeMacro
@invoke f(arg::T, ...; kwargs...)

Provides a convenient way to call invoke by expanding @invoke f(arg1::T1, arg2::T2; kwargs...) to invoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...). When an argument's type annotation is omitted, it's replaced with Core.Typeof that argument. To invoke a method where an argument is untyped or explicitly typed as Any, annotate the argument with ::Any.

It also supports the following syntax:

  • @invoke (x::X).f expands to invoke(getproperty, Tuple{X,Symbol}, x, :f)
  • @invoke (x::X).f = v::V expands to invoke(setproperty!, Tuple{X,Symbol,V}, x, :f, v)
  • @invoke (xs::Xs)[i::I] expands to invoke(getindex, Tuple{Xs,I}, xs, i)
  • @invoke (xs::Xs)[i::I] = v::V expands to invoke(setindex!, Tuple{Xs,V,I}, xs, v, i)

Examples

julia> @macroexpand @invoke f(x::T, y)
+Integer
source
Base.@invokeMacro
@invoke f(arg::T, ...; kwargs...)

Provides a convenient way to call invoke by expanding @invoke f(arg1::T1, arg2::T2; kwargs...) to invoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...). When an argument's type annotation is omitted, it's replaced with Core.Typeof that argument. To invoke a method where an argument is untyped or explicitly typed as Any, annotate the argument with ::Any.

It also supports the following syntax:

  • @invoke (x::X).f expands to invoke(getproperty, Tuple{X,Symbol}, x, :f)
  • @invoke (x::X).f = v::V expands to invoke(setproperty!, Tuple{X,Symbol,V}, x, :f, v)
  • @invoke (xs::Xs)[i::I] expands to invoke(getindex, Tuple{Xs,I}, xs, i)
  • @invoke (xs::Xs)[i::I] = v::V expands to invoke(setindex!, Tuple{Xs,V,I}, xs, v, i)

Examples

julia> @macroexpand @invoke f(x::T, y)
 :(Core.invoke(f, Tuple{T, Core.Typeof(y)}, x, y))
 
 julia> @invoke 420::Integer % Unsigned
@@ -1263,7 +1263,7 @@
 :(Core.invoke(Base.getindex, Tuple{Xs, I}, xs, i))
 
 julia> @macroexpand @invoke (xs::Xs)[i::I] = v::V
-:(Core.invoke(Base.setindex!, Tuple{Xs, V, I}, xs, v, i))
Julia 1.7

This macro requires Julia 1.7 or later.

Julia 1.9

This macro is exported as of Julia 1.9.

Julia 1.10

The additional syntax is supported as of Julia 1.10.

source
Base.invokelatestFunction
invokelatest(f, args...; kwargs...)

Calls f(args...; kwargs...), but guarantees that the most recent method of f will be executed. This is useful in specialized circumstances, e.g. long-running event loops or callback functions that may call obsolete versions of a function f. (The drawback is that invokelatest is somewhat slower than calling f directly, and the type of the result cannot be inferred by the compiler.)

Julia 1.9

Prior to Julia 1.9, this function was not exported, and was called as Base.invokelatest.

source
Base.@invokelatestMacro
@invokelatest f(args...; kwargs...)

Provides a convenient way to call invokelatest. @invokelatest f(args...; kwargs...) will simply be expanded into Base.invokelatest(f, args...; kwargs...).

It also supports the following syntax:

  • @invokelatest x.f expands to Base.invokelatest(getproperty, x, :f)
  • @invokelatest x.f = v expands to Base.invokelatest(setproperty!, x, :f, v)
  • @invokelatest xs[i] expands to Base.invokelatest(getindex, xs, i)
  • @invokelatest xs[i] = v expands to Base.invokelatest(setindex!, xs, v, i)
julia> @macroexpand @invokelatest f(x; kw=kwv)
+:(Core.invoke(Base.setindex!, Tuple{Xs, V, I}, xs, v, i))
Julia 1.7

This macro requires Julia 1.7 or later.

Julia 1.9

This macro is exported as of Julia 1.9.

Julia 1.10

The additional syntax is supported as of Julia 1.10.

source
Base.invokelatestFunction
invokelatest(f, args...; kwargs...)

Calls f(args...; kwargs...), but guarantees that the most recent method of f will be executed. This is useful in specialized circumstances, e.g. long-running event loops or callback functions that may call obsolete versions of a function f. (The drawback is that invokelatest is somewhat slower than calling f directly, and the type of the result cannot be inferred by the compiler.)

Julia 1.9

Prior to Julia 1.9, this function was not exported, and was called as Base.invokelatest.

source
Base.@invokelatestMacro
@invokelatest f(args...; kwargs...)

Provides a convenient way to call invokelatest. @invokelatest f(args...; kwargs...) will simply be expanded into Base.invokelatest(f, args...; kwargs...).

It also supports the following syntax:

  • @invokelatest x.f expands to Base.invokelatest(getproperty, x, :f)
  • @invokelatest x.f = v expands to Base.invokelatest(setproperty!, x, :f, v)
  • @invokelatest xs[i] expands to Base.invokelatest(getindex, xs, i)
  • @invokelatest xs[i] = v expands to Base.invokelatest(setindex!, xs, v, i)
julia> @macroexpand @invokelatest f(x; kw=kwv)
 :(Base.invokelatest(f, x; kw = kwv))
 
 julia> @macroexpand @invokelatest x.f
@@ -1276,14 +1276,14 @@
 :(Base.invokelatest(Base.getindex, xs, i))
 
 julia> @macroexpand @invokelatest xs[i] = v
-:(Base.invokelatest(Base.setindex!, xs, v, i))
Julia 1.7

This macro requires Julia 1.7 or later.

Julia 1.9

Prior to Julia 1.9, this macro was not exported, and was called as Base.@invokelatest.

Julia 1.10

The additional x.f and xs[i] syntax requires Julia 1.10.

source
newKeyword
new, or new{A,B,...}

Special function available to inner constructors which creates a new object of the type. The form new{A,B,...} explicitly specifies values of parameters for parametric types. See the manual section on Inner Constructor Methods for more information.

source
Base.:|>Function
|>(x, f)

Infix operator which applies function f to the argument x. This allows f(g(x)) to be written x |> g |> f. When used with anonymous functions, parentheses are typically required around the definition to get the intended chain.

Examples

julia> 4 |> inv
+:(Base.invokelatest(Base.setindex!, xs, v, i))
Julia 1.7

This macro requires Julia 1.7 or later.

Julia 1.9

Prior to Julia 1.9, this macro was not exported, and was called as Base.@invokelatest.

Julia 1.10

The additional x.f and xs[i] syntax requires Julia 1.10.

source
newKeyword
new, or new{A,B,...}

Special function available to inner constructors which creates a new object of the type. The form new{A,B,...} explicitly specifies values of parameters for parametric types. See the manual section on Inner Constructor Methods for more information.

source
Base.:|>Function
|>(x, f)

Infix operator which applies function f to the argument x. This allows f(g(x)) to be written x |> g |> f. When used with anonymous functions, parentheses are typically required around the definition to get the intended chain.

Examples

julia> 4 |> inv
 0.25
 
 julia> [2, 3, 5] |> sum |> inv
 0.1
 
 julia> [0 1; 2 3] .|> (x -> x^2) |> sum
-14
source
Base.:∘Function
f ∘ g

Compose functions: i.e. (f ∘ g)(args...; kwargs...) means f(g(args...; kwargs...)). The symbol can be entered in the Julia REPL (and most editors, appropriately configured) by typing \circ<tab>.

Function composition also works in prefix form: ∘(f, g) is the same as f ∘ g. The prefix form supports composition of multiple functions: ∘(f, g, h) = f ∘ g ∘ h and splatting ∘(fs...) for composing an iterable collection of functions. The last argument to execute first.

Julia 1.4

Multiple function composition requires at least Julia 1.4.

Julia 1.5

Composition of one function ∘(f) requires at least Julia 1.5.

Julia 1.7

Using keyword arguments requires at least Julia 1.7.

Examples

julia> map(uppercase∘first, ["apple", "banana", "carrot"])
+14
source
Base.:∘Function
f ∘ g

Compose functions: i.e. (f ∘ g)(args...; kwargs...) means f(g(args...; kwargs...)). The symbol can be entered in the Julia REPL (and most editors, appropriately configured) by typing \circ<tab>.

Function composition also works in prefix form: ∘(f, g) is the same as f ∘ g. The prefix form supports composition of multiple functions: ∘(f, g, h) = f ∘ g ∘ h and splatting ∘(fs...) for composing an iterable collection of functions. The last argument to execute first.

Julia 1.4

Multiple function composition requires at least Julia 1.4.

Julia 1.5

Composition of one function ∘(f) requires at least Julia 1.5.

Julia 1.7

Using keyword arguments requires at least Julia 1.7.

Examples

julia> map(uppercase∘first, ["apple", "banana", "carrot"])
 3-element Vector{Char}:
  'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
  'B': ASCII/Unicode U+0042 (category Lu: Letter, uppercase)
@@ -1303,7 +1303,7 @@
        ];
 
 julia> ∘(fs...)(3)
-2.0

See also ComposedFunction, !f::Function.

source
Base.ComposedFunctionType
ComposedFunction{Outer,Inner} <: Function

Represents the composition of two callable objects outer::Outer and inner::Inner. That is

ComposedFunction(outer, inner)(args...; kw...) === outer(inner(args...; kw...))

The preferred way to construct an instance of ComposedFunction is to use the composition operator :

julia> sin ∘ cos === ComposedFunction(sin, cos)
+2.0

See also ComposedFunction, !f::Function.

source
Base.ComposedFunctionType
ComposedFunction{Outer,Inner} <: Function

Represents the composition of two callable objects outer::Outer and inner::Inner. That is

ComposedFunction(outer, inner)(args...; kw...) === outer(inner(args...; kw...))

The preferred way to construct an instance of ComposedFunction is to use the composition operator :

julia> sin ∘ cos === ComposedFunction(sin, cos)
 true
 
 julia> typeof(sin∘cos)
@@ -1314,7 +1314,7 @@
 true
 
 julia> composition.inner === cos
-true
Julia 1.6

ComposedFunction requires at least Julia 1.6. In earlier versions returns an anonymous function instead.

See also .

source
Base.splatFunction
splat(f)

Equivalent to

    my_splat(f) = args->f(args...)

i.e. given a function returns a new function that takes one argument and splats it into the original function. This is useful as an adaptor to pass a multi-argument function in a context that expects a single argument, but passes a tuple as that single argument.

Examples

julia> map(splat(+), zip(1:3,4:6))
+true
Julia 1.6

ComposedFunction requires at least Julia 1.6. In earlier versions returns an anonymous function instead.

See also .

source
Base.splatFunction
splat(f)

Equivalent to

    my_splat(f) = args->f(args...)

i.e. given a function returns a new function that takes one argument and splats it into the original function. This is useful as an adaptor to pass a multi-argument function in a context that expects a single argument, but passes a tuple as that single argument.

Examples

julia> map(splat(+), zip(1:3,4:6))
 3-element Vector{Int64}:
  5
  7
@@ -1324,7 +1324,7 @@
 splat(+)
 
 julia> my_add((1,2,3))
-6
source
Base.FixType
Fix{N}(f, x)

A type representing a partially-applied version of a function f, with the argument x fixed at position N::Int. In other words, Fix{3}(f, x) behaves similarly to (y1, y2, y3...; kws...) -> f(y1, y2, x, y3...; kws...).

Julia 1.12

This general functionality requires at least Julia 1.12, while Fix1 and Fix2 are available earlier.

Note

When nesting multiple Fix, note that the N in Fix{N} is relative to the current available arguments, rather than an absolute ordering on the target function. For example, Fix{1}(Fix{2}(f, 4), 4) fixes the first and second arg, while Fix{2}(Fix{1}(f, 4), 4) fixes the first and third arg.

source

Syntax

Core.evalFunction
Core.eval(m::Module, expr)

Evaluate an expression in the given module and return the result.

source
evalFunction
eval(expr)

Evaluate an expression in the global scope of the containing module. Every Module (except those defined with baremodule) has its own 1-argument definition of eval, which evaluates expressions in that module.

source
Base.@evalMacro
@eval [mod,] ex

Evaluate an expression with values interpolated into it using eval. If two arguments are provided, the first is the module to evaluate in.

source
Base.evalfileFunction
evalfile(path::AbstractString, args::Vector{String}=String[])

Load the file into an anonymous module using include, evaluate all expressions, and return the value of the last expression. The optional args argument can be used to set the input arguments of the script (i.e. the global ARGS variable). Note that definitions (e.g. methods, globals) are evaluated in the anonymous module and do not affect the current module.

Examples

julia> write("testfile.jl", """
+6
source
Base.FixType
Fix{N}(f, x)

A type representing a partially-applied version of a function f, with the argument x fixed at position N::Int. In other words, Fix{3}(f, x) behaves similarly to (y1, y2, y3...; kws...) -> f(y1, y2, x, y3...; kws...).

Julia 1.12

This general functionality requires at least Julia 1.12, while Fix1 and Fix2 are available earlier.

Note

When nesting multiple Fix, note that the N in Fix{N} is relative to the current available arguments, rather than an absolute ordering on the target function. For example, Fix{1}(Fix{2}(f, 4), 4) fixes the first and second arg, while Fix{2}(Fix{1}(f, 4), 4) fixes the first and third arg.

source

Syntax

Core.evalFunction
Core.eval(m::Module, expr)

Evaluate an expression in the given module and return the result.

source
evalFunction
eval(expr)

Evaluate an expression in the global scope of the containing module. Every Module (except those defined with baremodule) has its own 1-argument definition of eval, which evaluates expressions in that module.

source
Base.@evalMacro
@eval [mod,] ex

Evaluate an expression with values interpolated into it using eval. If two arguments are provided, the first is the module to evaluate in.

source
Base.evalfileFunction
evalfile(path::AbstractString, args::Vector{String}=String[])

Load the file into an anonymous module using include, evaluate all expressions, and return the value of the last expression. The optional args argument can be used to set the input arguments of the script (i.e. the global ARGS variable). Note that definitions (e.g. methods, globals) are evaluated in the anonymous module and do not affect the current module.

Examples

julia> write("testfile.jl", """
            @show ARGS
            1 + 1
        """);
@@ -1335,13 +1335,13 @@
 julia> x
 2
 
-julia> rm("testfile.jl")
source
Base.escFunction
esc(e)

Only valid in the context of an Expr returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the Macros section of the Metaprogramming chapter of the manual for more details and examples.

source
Base.@inboundsMacro
@inbounds(blk)

Eliminates array bounds checking within expressions.

In the example below the in-range check for referencing element i of array A is skipped to improve performance.

function sum(A::AbstractArray)
+julia> rm("testfile.jl")
source
Base.escFunction
esc(e)

Only valid in the context of an Expr returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the Macros section of the Metaprogramming chapter of the manual for more details and examples.

source
Base.@inboundsMacro
@inbounds(blk)

Eliminates array bounds checking within expressions.

In the example below the in-range check for referencing element i of array A is skipped to improve performance.

function sum(A::AbstractArray)
     r = zero(eltype(A))
     for i in eachindex(A)
         @inbounds r += A[i]
     end
     return r
-end
Warning

Using @inbounds may return incorrect results/crashes/corruption for out-of-bounds indices. The user is responsible for checking it manually. Only use @inbounds when you are certain that all accesses are in bounds (as undefined behavior, e.g. crashes, might occur if this assertion is violated). For example, using 1:length(A) instead of eachindex(A) in a function like the one above is not safely inbounds because the first index of A may not be 1 for all user defined types that subtype AbstractArray.

source
Base.@boundscheckMacro
@boundscheck(blk)

Annotates the expression blk as a bounds checking block, allowing it to be elided by @inbounds.

Note

The function in which @boundscheck is written must be inlined into its caller in order for @inbounds to have effect.

Examples

julia> @inline function g(A, i)
+end
Warning

Using @inbounds may return incorrect results/crashes/corruption for out-of-bounds indices. The user is responsible for checking it manually. Only use @inbounds when you are certain that all accesses are in bounds (as undefined behavior, e.g. crashes, might occur if this assertion is violated). For example, using 1:length(A) instead of eachindex(A) in a function like the one above is not safely inbounds because the first index of A may not be 1 for all user defined types that subtype AbstractArray.

source
Base.@boundscheckMacro
@boundscheck(blk)

Annotates the expression blk as a bounds checking block, allowing it to be elided by @inbounds.

Note

The function in which @boundscheck is written must be inlined into its caller in order for @inbounds to have effect.

Examples

julia> @inline function g(A, i)
            @boundscheck checkbounds(A, i)
            return "accessing ($A)[$i]"
        end;
@@ -1360,7 +1360,7 @@
  [5] top-level scope
 
 julia> f2()
-"accessing (1:2)[-1]"
Warning

The @boundscheck annotation allows you, as a library writer, to opt-in to allowing other code to remove your bounds checks with @inbounds. As noted there, the caller must verify—using information they can access—that their accesses are valid before using @inbounds. For indexing into your AbstractArray subclasses, for example, this involves checking the indices against its axes. Therefore, @boundscheck annotations should only be added to a getindex or setindex! implementation after you are certain its behavior is correct.

source
Base.@inlineMacro
@inline

Give a hint to the compiler that this function is worth inlining.

Small functions typically do not need the @inline annotation, as the compiler does it automatically. By using @inline on bigger functions, an extra nudge can be given to the compiler to inline it.

@inline can be applied immediately before a function definition or within a function body.

# annotate long-form definition
+"accessing (1:2)[-1]"
Warning

The @boundscheck annotation allows you, as a library writer, to opt-in to allowing other code to remove your bounds checks with @inbounds. As noted there, the caller must verify—using information they can access—that their accesses are valid before using @inbounds. For indexing into your AbstractArray subclasses, for example, this involves checking the indices against its axes. Therefore, @boundscheck annotations should only be added to a getindex or setindex! implementation after you are certain its behavior is correct.

source
Base.@inlineMacro
@inline

Give a hint to the compiler that this function is worth inlining.

Small functions typically do not need the @inline annotation, as the compiler does it automatically. By using @inline on bigger functions, an extra nudge can be given to the compiler to inline it.

@inline can be applied immediately before a function definition or within a function body.

# annotate long-form definition
 @inline function longdef(x)
     ...
 end
@@ -1386,7 +1386,7 @@
     a = @inline f(a0)  # the compiler will try to inline this call
     b = f(b0)          # the compiler will NOT try to inline this call
     return a, b
-end
Warning

Although a callsite annotation will try to force inlining in regardless of the cost model, there are still chances it can't succeed in it. Especially, recursive calls can not be inlined even if they are annotated as @inlined.

Julia 1.8

The callsite annotation requires at least Julia 1.8.

source
Base.@noinlineMacro
@noinline

Give a hint to the compiler that it should not inline a function.

Small functions are typically inlined automatically. By using @noinline on small functions, auto-inlining can be prevented.

@noinline can be applied immediately before a function definition or within a function body.

# annotate long-form definition
+end
Warning

Although a callsite annotation will try to force inlining in regardless of the cost model, there are still chances it can't succeed in it. Especially, recursive calls can not be inlined even if they are annotated as @inlined.

Julia 1.8

The callsite annotation requires at least Julia 1.8.

source
Base.@noinlineMacro
@noinline

Give a hint to the compiler that it should not inline a function.

Small functions are typically inlined automatically. By using @noinline on small functions, auto-inlining can be prevented.

@noinline can be applied immediately before a function definition or within a function body.

# annotate long-form definition
 @noinline function longdef(x)
     ...
 end
@@ -1412,7 +1412,7 @@
     a = @noinline f(a0)  # the compiler will NOT try to inline this call
     b = f(b0)            # the compiler will try to inline this call
     return a, b
-end
Julia 1.8

The callsite annotation requires at least Julia 1.8.


Note

If the function is trivial (for example returning a constant) it might get inlined anyway.

source
Base.@nospecializeMacro
@nospecialize

Applied to a function argument name, hints to the compiler that the method implementation should not be specialized for different types of that argument, but instead use the declared type for that argument. It can be applied to an argument within a formal argument list, or in the function body. When applied to an argument, the macro must wrap the entire argument expression, e.g., @nospecialize(x::Real) or @nospecialize(i::Integer...) rather than wrapping just the argument name. When used in a function body, the macro must occur in statement position and before any code.

When used without arguments, it applies to all arguments of the parent scope. In local scope, this means all arguments of the containing function. In global (top-level) scope, this means all methods subsequently defined in the current module.

Specialization can reset back to the default by using @specialize.

function example_function(@nospecialize x)
+end
Julia 1.8

The callsite annotation requires at least Julia 1.8.


Note

If the function is trivial (for example returning a constant) it might get inlined anyway.

source
Base.@nospecializeMacro
@nospecialize

Applied to a function argument name, hints to the compiler that the method implementation should not be specialized for different types of that argument, but instead use the declared type for that argument. It can be applied to an argument within a formal argument list, or in the function body. When applied to an argument, the macro must wrap the entire argument expression, e.g., @nospecialize(x::Real) or @nospecialize(i::Integer...) rather than wrapping just the argument name. When used in a function body, the macro must occur in statement position and before any code.

When used without arguments, it applies to all arguments of the parent scope. In local scope, this means all arguments of the containing function. In global (top-level) scope, this means all methods subsequently defined in the current module.

Specialization can reset back to the default by using @specialize.

function example_function(@nospecialize x)
     ...
 end
 
@@ -1437,7 +1437,7 @@
 CodeInfo(
 1 ─ %1 = invoke Main.g(_2::AbstractArray)::Float64
 └──      return %1
-) => Float64

Here, the @nospecialize annotation results in the equivalent of

f(A::AbstractArray) = invoke(g, Tuple{AbstractArray}, A)

ensuring that only one version of native code will be generated for g, one that is generic for any AbstractArray. However, the specific return type is still inferred for both g and f, and this is still used in optimizing the callers of f and g.

source
Base.@specializeMacro
@specialize

Reset the specialization hint for an argument back to the default. For details, see @nospecialize.

source
Base.@nospecializeinferMacro
Base.@nospecializeinfer function f(args...)
+) => Float64

Here, the @nospecialize annotation results in the equivalent of

f(A::AbstractArray) = invoke(g, Tuple{AbstractArray}, A)

ensuring that only one version of native code will be generated for g, one that is generic for any AbstractArray. However, the specific return type is still inferred for both g and f, and this is still used in optimizing the callers of f and g.

source
Base.@specializeMacro
@specialize

Reset the specialization hint for an argument back to the default. For details, see @nospecialize.

source
Base.@nospecializeinferMacro
Base.@nospecializeinfer function f(args...)
     @nospecialize ...
     ...
 end
@@ -1451,7 +1451,7 @@
 CodeInfo(
 1 ─ %1 = invoke Main.g(_2::AbstractArray)::Any
 └──      return %1
-) => Any

In this example, f will be inferred for each specific type of A, but g will only be inferred once with the declared argument type A::AbstractArray, meaning that the compiler will not likely see the excessive inference time on it while it can not infer the concrete return type of it. Without the @nospecializeinfer, f([1.0]) would infer the return type of g as Float64, indicating that inference ran for g(::Vector{Float64}) despite the prohibition on specialized code generation.

Julia 1.10

Using Base.@nospecializeinfer requires Julia version 1.10.

source
Base.@constpropMacro
Base.@constprop setting [ex]

Control the mode of interprocedural constant propagation for the annotated function.

Two settings are supported:

  • Base.@constprop :aggressive [ex]: apply constant propagation aggressively. For a method where the return type depends on the value of the arguments, this can yield improved inference results at the cost of additional compile time.
  • Base.@constprop :none [ex]: disable constant propagation. This can reduce compile times for functions that Julia might otherwise deem worthy of constant-propagation. Common cases are for functions with Bool- or Symbol-valued arguments or keyword arguments.

Base.@constprop can be applied immediately before a function definition or within a function body.

# annotate long-form definition
+) => Any

In this example, f will be inferred for each specific type of A, but g will only be inferred once with the declared argument type A::AbstractArray, meaning that the compiler will not likely see the excessive inference time on it while it can not infer the concrete return type of it. Without the @nospecializeinfer, f([1.0]) would infer the return type of g as Float64, indicating that inference ran for g(::Vector{Float64}) despite the prohibition on specialized code generation.

Julia 1.10

Using Base.@nospecializeinfer requires Julia version 1.10.

source
Base.@constpropMacro
Base.@constprop setting [ex]

Control the mode of interprocedural constant propagation for the annotated function.

Two settings are supported:

  • Base.@constprop :aggressive [ex]: apply constant propagation aggressively. For a method where the return type depends on the value of the arguments, this can yield improved inference results at the cost of additional compile time.
  • Base.@constprop :none [ex]: disable constant propagation. This can reduce compile times for functions that Julia might otherwise deem worthy of constant-propagation. Common cases are for functions with Bool- or Symbol-valued arguments or keyword arguments.

Base.@constprop can be applied immediately before a function definition or within a function body.

# annotate long-form definition
 Base.@constprop :aggressive function longdef(x)
     ...
 end
@@ -1463,7 +1463,7 @@
 f() do
     Base.@constprop :aggressive
     ...
-end
Julia 1.10

The usage within a function body requires at least Julia 1.10.

source
Base.gensymFunction
gensym([tag])

Generates a symbol which will not conflict with other variable names (in the same module).

source
Base.@gensymMacro
@gensym

Generates a gensym symbol for a variable. For example, @gensym x y is transformed into x = gensym("x"); y = gensym("y").

source
var"name"Keyword
var

The syntax var"#example#" refers to a variable named Symbol("#example#"), even though #example# is not a valid Julia identifier name.

This can be useful for interoperability with programming languages which have different rules for the construction of valid identifiers. For example, to refer to the R variable draw.segments, you can use var"draw.segments" in your Julia code.

It is also used to show julia source code which has gone through macro hygiene or otherwise contains variable names which can't be parsed normally.

Note that this syntax requires parser support so it is expanded directly by the parser rather than being implemented as a normal string macro @var_str.

Julia 1.3

This syntax requires at least Julia 1.3.

source
Base.@gotoMacro
@goto name

@goto name unconditionally jumps to the statement at the location @label name.

@label and @goto cannot create jumps to different top-level statements. Attempts cause an error. To still use @goto, enclose the @label and @goto in a block.

source
Base.@labelMacro
@label name

Labels a statement with the symbolic label name. The label marks the end-point of an unconditional jump with @goto name.

source
Base.SimdLoop.@simdMacro
@simd

Annotate a for loop to allow the compiler to take extra liberties to allow loop re-ordering

Warning

This feature is experimental and could change or disappear in future versions of Julia. Incorrect use of the @simd macro may cause unexpected results.

The object iterated over in a @simd for loop should be a one-dimensional range. By using @simd, you are asserting several properties of the loop:

  • It is safe to execute iterations in arbitrary or overlapping order, with special consideration for reduction variables.
  • Floating-point operations on reduction variables can be reordered or contracted, possibly causing different results than without @simd.

In many cases, Julia is able to automatically vectorize inner for loops without the use of @simd. Using @simd gives the compiler a little extra leeway to make it possible in more situations. In either case, your inner loop should have the following properties to allow vectorization:

  • The loop must be an innermost loop
  • The loop body must be straight-line code. Therefore, @inbounds is currently needed for all array accesses. The compiler can sometimes turn short &&, ||, and ?: expressions into straight-line code if it is safe to evaluate all operands unconditionally. Consider using the ifelse function instead of ?: in the loop if it is safe to do so.
  • Accesses must have a stride pattern and cannot be "gathers" (random-index reads) or "scatters" (random-index writes).
  • The stride should be unit stride.
Note

The @simd does not assert by default that the loop is completely free of loop-carried memory dependencies, which is an assumption that can easily be violated in generic code. If you are writing non-generic code, you can use @simd ivdep for ... end to also assert that:

  • There exists no loop-carried memory dependencies
  • No iteration ever waits on a previous iteration to make forward progress.
source
Base.@pollyMacro
@polly

Tells the compiler to apply the polyhedral optimizer Polly to a function.

source
Base.@generatedMacro
@generated f

@generated is used to annotate a function which will be generated. In the body of the generated function, only types of arguments can be read (not the values). The function returns a quoted expression evaluated when the function is called. The @generated macro should not be used on functions mutating the global scope or depending on mutable elements.

See Metaprogramming for further details.

Examples

julia> @generated function bar(x)
+end
Julia 1.10

The usage within a function body requires at least Julia 1.10.

source
Base.gensymFunction
gensym([tag])

Generates a symbol which will not conflict with other variable names (in the same module).

source
Base.@gensymMacro
@gensym

Generates a gensym symbol for a variable. For example, @gensym x y is transformed into x = gensym("x"); y = gensym("y").

source
var"name"Keyword
var

The syntax var"#example#" refers to a variable named Symbol("#example#"), even though #example# is not a valid Julia identifier name.

This can be useful for interoperability with programming languages which have different rules for the construction of valid identifiers. For example, to refer to the R variable draw.segments, you can use var"draw.segments" in your Julia code.

It is also used to show julia source code which has gone through macro hygiene or otherwise contains variable names which can't be parsed normally.

Note that this syntax requires parser support so it is expanded directly by the parser rather than being implemented as a normal string macro @var_str.

Julia 1.3

This syntax requires at least Julia 1.3.

source
Base.@gotoMacro
@goto name

@goto name unconditionally jumps to the statement at the location @label name.

@label and @goto cannot create jumps to different top-level statements. Attempts cause an error. To still use @goto, enclose the @label and @goto in a block.

source
Base.@labelMacro
@label name

Labels a statement with the symbolic label name. The label marks the end-point of an unconditional jump with @goto name.

source
Base.SimdLoop.@simdMacro
@simd

Annotate a for loop to allow the compiler to take extra liberties to allow loop re-ordering

Warning

This feature is experimental and could change or disappear in future versions of Julia. Incorrect use of the @simd macro may cause unexpected results.

The object iterated over in a @simd for loop should be a one-dimensional range. By using @simd, you are asserting several properties of the loop:

  • It is safe to execute iterations in arbitrary or overlapping order, with special consideration for reduction variables.
  • Floating-point operations on reduction variables can be reordered or contracted, possibly causing different results than without @simd.

In many cases, Julia is able to automatically vectorize inner for loops without the use of @simd. Using @simd gives the compiler a little extra leeway to make it possible in more situations. In either case, your inner loop should have the following properties to allow vectorization:

  • The loop must be an innermost loop
  • The loop body must be straight-line code. Therefore, @inbounds is currently needed for all array accesses. The compiler can sometimes turn short &&, ||, and ?: expressions into straight-line code if it is safe to evaluate all operands unconditionally. Consider using the ifelse function instead of ?: in the loop if it is safe to do so.
  • Accesses must have a stride pattern and cannot be "gathers" (random-index reads) or "scatters" (random-index writes).
  • The stride should be unit stride.
Note

The @simd does not assert by default that the loop is completely free of loop-carried memory dependencies, which is an assumption that can easily be violated in generic code. If you are writing non-generic code, you can use @simd ivdep for ... end to also assert that:

  • There exists no loop-carried memory dependencies
  • No iteration ever waits on a previous iteration to make forward progress.
source
Base.@pollyMacro
@polly

Tells the compiler to apply the polyhedral optimizer Polly to a function.

source
Base.@generatedMacro
@generated f

@generated is used to annotate a function which will be generated. In the body of the generated function, only types of arguments can be read (not the values). The function returns a quoted expression evaluated when the function is called. The @generated macro should not be used on functions mutating the global scope or depending on mutable elements.

See Metaprogramming for further details.

Examples

julia> @generated function bar(x)
            if x <: Integer
                return :(x ^ 2)
            else
@@ -1476,7 +1476,7 @@
 16
 
 julia> bar("baz")
-"baz"
source
Base.@assume_effectsMacro
Base.@assume_effects setting... [ex]

Override the compiler's effect modeling. This macro can be used in several contexts:

  1. Immediately before a method definition, to override the entire effect modeling of the applied method.
  2. Within a function body without any arguments, to override the entire effect modeling of the enclosing method.
  3. Applied to a code block, to override the local effect modeling of the applied code block.

Examples

julia> Base.@assume_effects :terminates_locally function fact(x)
+"baz"
source
Base.@assume_effectsMacro
Base.@assume_effects setting... [ex]

Override the compiler's effect modeling. This macro can be used in several contexts:

  1. Immediately before a method definition, to override the entire effect modeling of the applied method.
  2. Within a function body without any arguments, to override the entire effect modeling of the enclosing method.
  3. Applied to a code block, to override the local effect modeling of the applied code block.

Examples

julia> Base.@assume_effects :terminates_locally function fact(x)
            # usage 1:
            # this :terminates_locally allows `fact` to be constant-folded
            res = 1
@@ -1531,7 +1531,7 @@
        end |> only
 CodeInfo(
 1 ─     return (2, 6, 24)
-) => Tuple{Int64, Int64, Int64}
Julia 1.8

Using Base.@assume_effects requires Julia version 1.8.

Julia 1.10

The usage within a function body requires at least Julia 1.10.

Julia 1.11

The code block annotation requires at least Julia 1.11.

Warning

Improper use of this macro causes undefined behavior (including crashes, incorrect answers, or other hard to track bugs). Use with care and only as a last resort if absolutely required. Even in such a case, you SHOULD take all possible steps to minimize the strength of the effect assertion (e.g., do not use :total if :nothrow would have been sufficient).

In general, each setting value makes an assertion about the behavior of the function, without requiring the compiler to prove that this behavior is indeed true. These assertions are made for all world ages. It is thus advisable to limit the use of generic functions that may later be extended to invalidate the assumption (which would cause undefined behavior).

The following settings are supported.

  • :consistent
  • :effect_free
  • :nothrow
  • :terminates_globally
  • :terminates_locally
  • :notaskstate
  • :inaccessiblememonly
  • :noub
  • :noub_if_noinbounds
  • :nortcall
  • :foldable
  • :removable
  • :total

Extended help


:consistent

The :consistent setting asserts that for egal (===) inputs:

  • The manner of termination (return value, exception, non-termination) will always be the same.
  • If the method returns, the results will always be egal.
Note

This in particular implies that the method must not return a freshly allocated mutable object. Multiple allocations of mutable objects (even with identical contents) are not egal.

Note

The :consistent-cy assertion is made world-age wise. More formally, write $fᵢ$ for the evaluation of $f$ in world-age $i$, then this setting requires:

\[∀ i, x, y: x ≡ y → fᵢ(x) ≡ fᵢ(y)\]

However, for two world ages $i$, $j$ s.t. $i ≠ j$, we may have $fᵢ(x) ≢ fⱼ(y)$.

A further implication is that :consistent functions may not make their return value dependent on the state of the heap or any other global state that is not constant for a given world age.

Note

The :consistent-cy includes all legal rewrites performed by the optimizer. For example, floating-point fastmath operations are not considered :consistent, because the optimizer may rewrite them causing the output to not be :consistent, even for the same world age (e.g. because one ran in the interpreter, while the other was optimized).

Note

If :consistent functions terminate by throwing an exception, that exception itself is not required to meet the egality requirement specified above.


:effect_free

The :effect_free setting asserts that the method is free of externally semantically visible side effects. The following is an incomplete list of externally semantically visible side effects:

  • Changing the value of a global variable.
  • Mutating the heap (e.g. an array or mutable value), except as noted below
  • Changing the method table (e.g. through calls to eval)
  • File/Network/etc. I/O
  • Task switching

However, the following are explicitly not semantically visible, even if they may be observable:

  • Memory allocations (both mutable and immutable)
  • Elapsed time
  • Garbage collection
  • Heap mutations of objects whose lifetime does not exceed the method (i.e. were allocated in the method and do not escape).
  • The returned value (which is externally visible, but not a side effect)

The rule of thumb here is that an externally visible side effect is anything that would affect the execution of the remainder of the program if the function were not executed.

Note

The :effect_free assertion is made both for the method itself and any code that is executed by the method. Keep in mind that the assertion must be valid for all world ages and limit use of this assertion accordingly.


:nothrow

The :nothrow settings asserts that this method does not throw an exception (i.e. will either always return a value or never return).

Note

It is permissible for :nothrow annotated methods to make use of exception handling internally as long as the exception is not rethrown out of the method itself.

Note

If the execution of a method may raise MethodErrors and similar exceptions, then the method is not considered as :nothrow. However, note that environment-dependent errors like StackOverflowError or InterruptException are not modeled by this effect and thus a method that may result in StackOverflowError does not necessarily need to be !:nothrow (although it should usually be !:terminates too).


:terminates_globally

The :terminates_globally settings asserts that this method will eventually terminate (either normally or abnormally), i.e. does not loop indefinitely.

Note

This :terminates_globally assertion covers any other methods called by the annotated method.

Note

The compiler will consider this a strong indication that the method will terminate relatively quickly and may (if otherwise legal) call this method at compile time. I.e. it is a bad idea to annotate this setting on a method that technically, but not practically, terminates.


:terminates_locally

The :terminates_locally setting is like :terminates_globally, except that it only applies to syntactic control flow within the annotated method. It is thus a much weaker (and thus safer) assertion that allows for the possibility of non-termination if the method calls some other method that does not terminate.

Note

:terminates_globally implies :terminates_locally.


:notaskstate

The :notaskstate setting asserts that the method does not use or modify the local task state (task local storage, RNG state, etc.) and may thus be safely moved between tasks without observable results.

Note

The implementation of exception handling makes use of state stored in the task object. However, this state is currently not considered to be within the scope of :notaskstate and is tracked separately using the :nothrow effect.

Note

The :notaskstate assertion concerns the state of the currently running task. If a reference to a Task object is obtained by some other means that does not consider which task is currently running, the :notaskstate effect need not be tainted. This is true, even if said task object happens to be === to the currently running task.

Note

Access to task state usually also results in the tainting of other effects, such as :effect_free (if task state is modified) or :consistent (if task state is used in the computation of the result). In particular, code that is not :notaskstate, but is :effect_free and :consistent may still be dead-code-eliminated and thus promoted to :total.


:inaccessiblememonly

The :inaccessiblememonly setting asserts that the method does not access or modify externally accessible mutable memory. This means the method can access or modify mutable memory for newly allocated objects that is not accessible by other methods or top-level execution before return from the method, but it can not access or modify any mutable global state or mutable memory pointed to by its arguments.

Note

Below is an incomplete list of examples that invalidate this assumption:

  • a global reference or getglobal call to access a mutable global variable
  • a global assignment or setglobal! call to perform assignment to a non-constant global variable
  • setfield! call that changes a field of a global mutable variable
Note

This :inaccessiblememonly assertion covers any other methods called by the annotated method.


:noub

The :noub setting asserts that the method will not execute any undefined behavior (for any input). Note that undefined behavior may technically cause the method to violate any other effect assertions (such as :consistent or :effect_free) as well, but we do not model this, and they assume the absence of undefined behavior.


:nortcall

The :nortcall setting asserts that the method does not call Core.Compiler.return_type, and that any other methods this method might call also do not call Core.Compiler.return_type.

Note

To be precise, this assertion can be used when a call to Core.Compiler.return_type is not made at runtime; that is, when the result of Core.Compiler.return_type is known exactly at compile time and the call is eliminated by the optimizer. However, since whether the result of Core.Compiler.return_type is folded at compile time depends heavily on the compiler's implementation, it is generally risky to assert this if the method in question uses Core.Compiler.return_type in any form.


:foldable

This setting is a convenient shortcut for the set of effects that the compiler requires to be guaranteed to constant fold a call at compile time. It is currently equivalent to the following settings:

  • :consistent
  • :effect_free
  • :terminates_globally
  • :noub
  • :nortcall
Note

This list in particular does not include :nothrow. The compiler will still attempt constant propagation and note any thrown error at compile time. Note however, that by the :consistent-cy requirements, any such annotated call must consistently throw given the same argument values.

Note

An explicit @inbounds annotation inside the function will also disable constant folding and not be overridden by :foldable.


:removable

This setting is a convenient shortcut for the set of effects that the compiler requires to be guaranteed to delete a call whose result is unused at compile time. It is currently equivalent to the following settings:

  • :effect_free
  • :nothrow
  • :terminates_globally

:total

This setting is the maximum possible set of effects. It currently implies the following other settings:

  • :consistent
  • :effect_free
  • :nothrow
  • :terminates_globally
  • :notaskstate
  • :inaccessiblememonly
  • :noub
  • :nortcall
Warning

:total is a very strong assertion and will likely gain additional semantics in future versions of Julia (e.g. if additional effects are added and included in the definition of :total). As a result, it should be used with care. Whenever possible, prefer to use the minimum possible set of specific effect assertions required for a particular application. In cases where a large number of effect overrides apply to a set of functions, a custom macro is recommended over the use of :total.


Negated effects

Effect names may be prefixed by ! to indicate that the effect should be removed from an earlier meta effect. For example, :total !:nothrow indicates that while the call is generally total, it may however throw.

source

Managing deprecations

Base.@deprecateMacro
@deprecate old new [export_old=true]

Deprecate method old and specify the replacement call new, defining a new method old with the specified signature in the process.

To prevent old from being exported, set export_old to false.

See also Base.depwarn().

Julia 1.5

As of Julia 1.5, functions defined by @deprecate do not print warning when julia is run without the --depwarn=yes flag set, as the default value of --depwarn option is no. The warnings are printed from tests run by Pkg.test().

Examples

julia> @deprecate old_export(x) new(x)
+) => Tuple{Int64, Int64, Int64}
Julia 1.8

Using Base.@assume_effects requires Julia version 1.8.

Julia 1.10

The usage within a function body requires at least Julia 1.10.

Julia 1.11

The code block annotation requires at least Julia 1.11.

Warning

Improper use of this macro causes undefined behavior (including crashes, incorrect answers, or other hard to track bugs). Use with care and only as a last resort if absolutely required. Even in such a case, you SHOULD take all possible steps to minimize the strength of the effect assertion (e.g., do not use :total if :nothrow would have been sufficient).

In general, each setting value makes an assertion about the behavior of the function, without requiring the compiler to prove that this behavior is indeed true. These assertions are made for all world ages. It is thus advisable to limit the use of generic functions that may later be extended to invalidate the assumption (which would cause undefined behavior).

The following settings are supported.

  • :consistent
  • :effect_free
  • :nothrow
  • :terminates_globally
  • :terminates_locally
  • :notaskstate
  • :inaccessiblememonly
  • :noub
  • :noub_if_noinbounds
  • :nortcall
  • :foldable
  • :removable
  • :total

Extended help


:consistent

The :consistent setting asserts that for egal (===) inputs:

  • The manner of termination (return value, exception, non-termination) will always be the same.
  • If the method returns, the results will always be egal.
Note

This in particular implies that the method must not return a freshly allocated mutable object. Multiple allocations of mutable objects (even with identical contents) are not egal.

Note

The :consistent-cy assertion is made world-age wise. More formally, write $fᵢ$ for the evaluation of $f$ in world-age $i$, then this setting requires:

\[∀ i, x, y: x ≡ y → fᵢ(x) ≡ fᵢ(y)\]

However, for two world ages $i$, $j$ s.t. $i ≠ j$, we may have $fᵢ(x) ≢ fⱼ(y)$.

A further implication is that :consistent functions may not make their return value dependent on the state of the heap or any other global state that is not constant for a given world age.

Note

The :consistent-cy includes all legal rewrites performed by the optimizer. For example, floating-point fastmath operations are not considered :consistent, because the optimizer may rewrite them causing the output to not be :consistent, even for the same world age (e.g. because one ran in the interpreter, while the other was optimized).

Note

If :consistent functions terminate by throwing an exception, that exception itself is not required to meet the egality requirement specified above.


:effect_free

The :effect_free setting asserts that the method is free of externally semantically visible side effects. The following is an incomplete list of externally semantically visible side effects:

  • Changing the value of a global variable.
  • Mutating the heap (e.g. an array or mutable value), except as noted below
  • Changing the method table (e.g. through calls to eval)
  • File/Network/etc. I/O
  • Task switching

However, the following are explicitly not semantically visible, even if they may be observable:

  • Memory allocations (both mutable and immutable)
  • Elapsed time
  • Garbage collection
  • Heap mutations of objects whose lifetime does not exceed the method (i.e. were allocated in the method and do not escape).
  • The returned value (which is externally visible, but not a side effect)

The rule of thumb here is that an externally visible side effect is anything that would affect the execution of the remainder of the program if the function were not executed.

Note

The :effect_free assertion is made both for the method itself and any code that is executed by the method. Keep in mind that the assertion must be valid for all world ages and limit use of this assertion accordingly.


:nothrow

The :nothrow settings asserts that this method does not throw an exception (i.e. will either always return a value or never return).

Note

It is permissible for :nothrow annotated methods to make use of exception handling internally as long as the exception is not rethrown out of the method itself.

Note

If the execution of a method may raise MethodErrors and similar exceptions, then the method is not considered as :nothrow. However, note that environment-dependent errors like StackOverflowError or InterruptException are not modeled by this effect and thus a method that may result in StackOverflowError does not necessarily need to be !:nothrow (although it should usually be !:terminates too).


:terminates_globally

The :terminates_globally settings asserts that this method will eventually terminate (either normally or abnormally), i.e. does not loop indefinitely.

Note

This :terminates_globally assertion covers any other methods called by the annotated method.

Note

The compiler will consider this a strong indication that the method will terminate relatively quickly and may (if otherwise legal) call this method at compile time. I.e. it is a bad idea to annotate this setting on a method that technically, but not practically, terminates.


:terminates_locally

The :terminates_locally setting is like :terminates_globally, except that it only applies to syntactic control flow within the annotated method. It is thus a much weaker (and thus safer) assertion that allows for the possibility of non-termination if the method calls some other method that does not terminate.

Note

:terminates_globally implies :terminates_locally.


:notaskstate

The :notaskstate setting asserts that the method does not use or modify the local task state (task local storage, RNG state, etc.) and may thus be safely moved between tasks without observable results.

Note

The implementation of exception handling makes use of state stored in the task object. However, this state is currently not considered to be within the scope of :notaskstate and is tracked separately using the :nothrow effect.

Note

The :notaskstate assertion concerns the state of the currently running task. If a reference to a Task object is obtained by some other means that does not consider which task is currently running, the :notaskstate effect need not be tainted. This is true, even if said task object happens to be === to the currently running task.

Note

Access to task state usually also results in the tainting of other effects, such as :effect_free (if task state is modified) or :consistent (if task state is used in the computation of the result). In particular, code that is not :notaskstate, but is :effect_free and :consistent may still be dead-code-eliminated and thus promoted to :total.


:inaccessiblememonly

The :inaccessiblememonly setting asserts that the method does not access or modify externally accessible mutable memory. This means the method can access or modify mutable memory for newly allocated objects that is not accessible by other methods or top-level execution before return from the method, but it can not access or modify any mutable global state or mutable memory pointed to by its arguments.

Note

Below is an incomplete list of examples that invalidate this assumption:

  • a global reference or getglobal call to access a mutable global variable
  • a global assignment or setglobal! call to perform assignment to a non-constant global variable
  • setfield! call that changes a field of a global mutable variable
Note

This :inaccessiblememonly assertion covers any other methods called by the annotated method.


:noub

The :noub setting asserts that the method will not execute any undefined behavior (for any input). Note that undefined behavior may technically cause the method to violate any other effect assertions (such as :consistent or :effect_free) as well, but we do not model this, and they assume the absence of undefined behavior.


:nortcall

The :nortcall setting asserts that the method does not call Core.Compiler.return_type, and that any other methods this method might call also do not call Core.Compiler.return_type.

Note

To be precise, this assertion can be used when a call to Core.Compiler.return_type is not made at runtime; that is, when the result of Core.Compiler.return_type is known exactly at compile time and the call is eliminated by the optimizer. However, since whether the result of Core.Compiler.return_type is folded at compile time depends heavily on the compiler's implementation, it is generally risky to assert this if the method in question uses Core.Compiler.return_type in any form.


:foldable

This setting is a convenient shortcut for the set of effects that the compiler requires to be guaranteed to constant fold a call at compile time. It is currently equivalent to the following settings:

  • :consistent
  • :effect_free
  • :terminates_globally
  • :noub
  • :nortcall
Note

This list in particular does not include :nothrow. The compiler will still attempt constant propagation and note any thrown error at compile time. Note however, that by the :consistent-cy requirements, any such annotated call must consistently throw given the same argument values.

Note

An explicit @inbounds annotation inside the function will also disable constant folding and not be overridden by :foldable.


:removable

This setting is a convenient shortcut for the set of effects that the compiler requires to be guaranteed to delete a call whose result is unused at compile time. It is currently equivalent to the following settings:

  • :effect_free
  • :nothrow
  • :terminates_globally

:total

This setting is the maximum possible set of effects. It currently implies the following other settings:

  • :consistent
  • :effect_free
  • :nothrow
  • :terminates_globally
  • :notaskstate
  • :inaccessiblememonly
  • :noub
  • :nortcall
Warning

:total is a very strong assertion and will likely gain additional semantics in future versions of Julia (e.g. if additional effects are added and included in the definition of :total). As a result, it should be used with care. Whenever possible, prefer to use the minimum possible set of specific effect assertions required for a particular application. In cases where a large number of effect overrides apply to a set of functions, a custom macro is recommended over the use of :total.


Negated effects

Effect names may be prefixed by ! to indicate that the effect should be removed from an earlier meta effect. For example, :total !:nothrow indicates that while the call is generally total, it may however throw.

source

Managing deprecations

Base.@deprecateMacro
@deprecate old new [export_old=true]

Deprecate method old and specify the replacement call new, defining a new method old with the specified signature in the process.

To prevent old from being exported, set export_old to false.

See also Base.depwarn().

Julia 1.5

As of Julia 1.5, functions defined by @deprecate do not print warning when julia is run without the --depwarn=yes flag set, as the default value of --depwarn option is no. The warnings are printed from tests run by Pkg.test().

Examples

julia> @deprecate old_export(x) new(x)
 old_export (generic function with 1 method)
 
 julia> @deprecate old_public(x) new(x) false
@@ -1544,11 +1544,11 @@
 julia> methods(old)
 # 1 method for generic function "old" from Main:
  [1] old(x::Int64)
-     @ deprecated.jl:94

will define and deprecate a method old(x::Int) that mirrors new(x::Int) but will not define nor deprecate the method old(x::Float64).

source
Base.depwarnFunction
Base.depwarn(msg::String, funcsym::Symbol; force=false)

Print msg as a deprecation warning. The symbol funcsym should be the name of the calling function, which is used to ensure that the deprecation warning is only printed the first time for each call place. Set force=true to force the warning to always be shown, even if Julia was started with --depwarn=no (the default).

See also @deprecate.

Examples

function deprecated_func()
+     @ deprecated.jl:94

will define and deprecate a method old(x::Int) that mirrors new(x::Int) but will not define nor deprecate the method old(x::Float64).

source
Base.depwarnFunction
Base.depwarn(msg::String, funcsym::Symbol; force=false)

Print msg as a deprecation warning. The symbol funcsym should be the name of the calling function, which is used to ensure that the deprecation warning is only printed the first time for each call place. Set force=true to force the warning to always be shown, even if Julia was started with --depwarn=no (the default).

See also @deprecate.

Examples

function deprecated_func()
     Base.depwarn("Don't use `deprecated_func()`!", :deprecated_func)
 
     1 + 1
-end
source

Missing Values

Base.MissingType
Missing

A type with no fields whose singleton instance missing is used to represent missing values.

See also: skipmissing, nonmissingtype, Nothing.

source
Base.missingConstant
missing

The singleton instance of type Missing representing a missing value.

See also: NaN, skipmissing, nonmissingtype.

source
Base.coalesceFunction
coalesce(x...)

Return the first value in the arguments which is not equal to missing, if any. Otherwise return missing.

See also skipmissing, something, @coalesce.

Examples

julia> coalesce(missing, 1)
+end
source

Missing Values

Base.MissingType
Missing

A type with no fields whose singleton instance missing is used to represent missing values.

See also: skipmissing, nonmissingtype, Nothing.

source
Base.missingConstant
missing

The singleton instance of type Missing representing a missing value.

See also: NaN, skipmissing, nonmissingtype.

source
Base.coalesceFunction
coalesce(x...)

Return the first value in the arguments which is not equal to missing, if any. Otherwise return missing.

See also skipmissing, something, @coalesce.

Examples

julia> coalesce(missing, 1)
 1
 
 julia> coalesce(1, missing)
@@ -1557,7 +1557,7 @@
 julia> coalesce(nothing, 1)  # returns `nothing`
 
 julia> coalesce(missing, missing)
-missing
source
Base.@coalesceMacro
@coalesce(x...)

Short-circuiting version of coalesce.

Examples

julia> f(x) = (println("f($x)"); missing);
+missing
source
Base.@coalesceMacro
@coalesce(x...)

Short-circuiting version of coalesce.

Examples

julia> f(x) = (println("f($x)"); missing);
 
 julia> a = 1;
 
@@ -1570,7 +1570,7 @@
 f(2)
 f(3)
 ERROR: `b` is still missing
-[...]
Julia 1.7

This macro is available as of Julia 1.7.

source
Base.ismissingFunction
ismissing(x)

Indicate whether x is missing.

See also: skipmissing, isnothing, isnan.

source
Base.skipmissingFunction
skipmissing(itr)

Return an iterator over the elements in itr skipping missing values. The returned object can be indexed using indices of itr if the latter is indexable. Indices corresponding to missing values are not valid: they are skipped by keys and eachindex, and a MissingException is thrown when trying to use them.

Use collect to obtain an Array containing the non-missing values in itr. Note that even if itr is a multidimensional array, the result will always be a Vector since it is not possible to remove missings while preserving dimensions of the input.

See also coalesce, ismissing, something.

Examples

julia> x = skipmissing([1, missing, 2])
+[...]
Julia 1.7

This macro is available as of Julia 1.7.

source
Base.ismissingFunction
ismissing(x)

Indicate whether x is missing.

See also: skipmissing, isnothing, isnan.

source
Base.skipmissingFunction
skipmissing(itr)

Return an iterator over the elements in itr skipping missing values. The returned object can be indexed using indices of itr if the latter is indexable. Indices corresponding to missing values are not valid: they are skipped by keys and eachindex, and a MissingException is thrown when trying to use them.

Use collect to obtain an Array containing the non-missing values in itr. Note that even if itr is a multidimensional array, the result will always be a Vector since it is not possible to remove missings while preserving dimensions of the input.

See also coalesce, ismissing, something.

Examples

julia> x = skipmissing([1, missing, 2])
 skipmissing(Union{Missing, Int64}[1, missing, 2])
 
 julia> sum(x)
@@ -1599,26 +1599,26 @@
 julia> collect(skipmissing([1 missing; 2 missing]))
 2-element Vector{Int64}:
  1
- 2
source
Base.nonmissingtypeFunction
nonmissingtype(T::Type)

If T is a union of types containing Missing, return a new type with Missing removed.

Examples

julia> nonmissingtype(Union{Int64,Missing})
+ 2
source
Base.nonmissingtypeFunction
nonmissingtype(T::Type)

If T is a union of types containing Missing, return a new type with Missing removed.

Examples

julia> nonmissingtype(Union{Int64,Missing})
 Int64
 
 julia> nonmissingtype(Any)
-Any
Julia 1.3

This function is exported as of Julia 1.3.

source

System

Base.runFunction
run(command, args...; wait::Bool = true)

Run a command object, constructed with backticks (see the Running External Programs section in the manual). Throws an error if anything goes wrong, including the process exiting with a non-zero status (when wait is true).

The args... allow you to pass through file descriptors to the command, and are ordered like regular unix file descriptors (eg stdin, stdout, stderr, FD(3), FD(4)...).

If wait is false, the process runs asynchronously. You can later wait for it and check its exit status by calling success on the returned process object.

When wait is false, the process' I/O streams are directed to devnull. When wait is true, I/O streams are shared with the parent process. Use pipeline to control I/O redirection.

source
Base.devnullConstant
devnull

Used in a stream redirect to discard all data written to it. Essentially equivalent to /dev/null on Unix or NUL on Windows. Usage:

run(pipeline(`cat test.txt`, devnull))
source
Base.successFunction
success(command)

Run a command object, constructed with backticks (see the Running External Programs section in the manual), and tell whether it was successful (exited with a code of 0). An exception is raised if the process cannot be started.

source
Base.process_runningFunction
process_running(p::Process)

Determine whether a process is currently running.

source
Base.process_exitedFunction
process_exited(p::Process)

Determine whether a process has exited.

source
Base.killMethod
kill(p::Process, signum=Base.SIGTERM)

Send a signal to a process. The default is to terminate the process. Returns successfully if the process has already exited, but throws an error if killing the process failed for other reasons (e.g. insufficient permissions).

source
Base.Sys.set_process_titleFunction
Sys.set_process_title(title::AbstractString)

Set the process title. No-op on some operating systems.

source
Base.Sys.get_process_titleFunction
Sys.get_process_title()

Get the process title. On some systems, will always return an empty string.

source
Base.ignorestatusFunction
ignorestatus(command)

Mark a command object so that running it will not throw an error if the result code is non-zero.

source
Base.detachFunction
detach(command)

Mark a command object so that it will be run in a new process group, allowing it to outlive the julia process, and not have Ctrl-C interrupts passed to it.

source
Base.CmdType
Cmd(cmd::Cmd; ignorestatus, detach, windows_verbatim, windows_hide, env, dir)
-Cmd(exec::Vector{String})

Construct a new Cmd object, representing an external program and arguments, from cmd, while changing the settings of the optional keyword arguments:

  • ignorestatus::Bool: If true (defaults to false), then the Cmd will not throw an error if the return code is nonzero.
  • detach::Bool: If true (defaults to false), then the Cmd will be run in a new process group, allowing it to outlive the julia process and not have Ctrl-C passed to it.
  • windows_verbatim::Bool: If true (defaults to false), then on Windows the Cmd will send a command-line string to the process with no quoting or escaping of arguments, even arguments containing spaces. (On Windows, arguments are sent to a program as a single "command-line" string, and programs are responsible for parsing it into arguments. By default, empty arguments and arguments with spaces or tabs are quoted with double quotes " in the command line, and \ or " are preceded by backslashes. windows_verbatim=true is useful for launching programs that parse their command line in nonstandard ways.) Has no effect on non-Windows systems.
  • windows_hide::Bool: If true (defaults to false), then on Windows no new console window is displayed when the Cmd is executed. This has no effect if a console is already open or on non-Windows systems.
  • env: Set environment variables to use when running the Cmd. env is either a dictionary mapping strings to strings, an array of strings of the form "var=val", an array or tuple of "var"=>val pairs. In order to modify (rather than replace) the existing environment, initialize env with copy(ENV) and then set env["var"]=val as desired. To add to an environment block within a Cmd object without replacing all elements, use addenv() which will return a Cmd object with the updated environment.
  • dir::AbstractString: Specify a working directory for the command (instead of the current directory).

For any keywords that are not specified, the current settings from cmd are used.

Note that the Cmd(exec) constructor does not create a copy of exec. Any subsequent changes to exec will be reflected in the Cmd object.

The most common way to construct a Cmd object is with command literals (backticks), e.g.

`ls -l`

This can then be passed to the Cmd constructor to modify its settings, e.g.

Cmd(`echo "Hello world"`, ignorestatus=true, detach=false)
source
Base.setenvFunction
setenv(command::Cmd, env; dir)

Set environment variables to use when running the given command. env is either a dictionary mapping strings to strings, an array of strings of the form "var=val", or zero or more "var"=>val pair arguments. In order to modify (rather than replace) the existing environment, create env through copy(ENV) and then setting env["var"]=val as desired, or use addenv.

The dir keyword argument can be used to specify a working directory for the command. dir defaults to the currently set dir for command (which is the current working directory if not specified already).

See also Cmd, addenv, ENV, pwd.

source
Base.addenvFunction
addenv(command::Cmd, env...; inherit::Bool = true)

Merge new environment mappings into the given Cmd object, returning a new Cmd object. Duplicate keys are replaced. If command does not contain any environment values set already, it inherits the current environment at time of addenv() call if inherit is true. Keys with value nothing are deleted from the env.

See also Cmd, setenv, ENV.

Julia 1.6

This function requires Julia 1.6 or later.

source
Base.withenvFunction
withenv(f, kv::Pair...)

Execute f in an environment that is temporarily modified (not replaced as in setenv) by zero or more "var"=>val arguments kv. withenv is generally used via the withenv(kv...) do ... end syntax. A value of nothing can be used to temporarily unset an environment variable (if it is set). When withenv returns, the original environment has been restored.

Warning

Changing the environment is not thread-safe. For running external commands with a different environment from the parent process, prefer using addenv over withenv.

source
Base.shell_escapeFunction
shell_escape(args::Union{Cmd,AbstractString...}; special::AbstractString="")

The unexported shell_escape function is the inverse of the unexported Base.shell_split() function: it takes a string or command object and escapes any special characters in such a way that calling Base.shell_split() on it would give back the array of words in the original command. The special keyword argument controls what characters in addition to whitespace, backslashes, quotes and dollar signs are considered to be special (default: none).

Examples

julia> Base.shell_escape("cat", "/foo/bar baz", "&&", "echo", "done")
+Any
Julia 1.3

This function is exported as of Julia 1.3.

source

System

Base.runFunction
run(command, args...; wait::Bool = true)

Run a command object, constructed with backticks (see the Running External Programs section in the manual). Throws an error if anything goes wrong, including the process exiting with a non-zero status (when wait is true).

The args... allow you to pass through file descriptors to the command, and are ordered like regular unix file descriptors (eg stdin, stdout, stderr, FD(3), FD(4)...).

If wait is false, the process runs asynchronously. You can later wait for it and check its exit status by calling success on the returned process object.

When wait is false, the process' I/O streams are directed to devnull. When wait is true, I/O streams are shared with the parent process. Use pipeline to control I/O redirection.

source
Base.devnullConstant
devnull

Used in a stream redirect to discard all data written to it. Essentially equivalent to /dev/null on Unix or NUL on Windows. Usage:

run(pipeline(`cat test.txt`, devnull))
source
Base.successFunction
success(command)

Run a command object, constructed with backticks (see the Running External Programs section in the manual), and tell whether it was successful (exited with a code of 0). An exception is raised if the process cannot be started.

source
Base.process_runningFunction
process_running(p::Process)

Determine whether a process is currently running.

source
Base.process_exitedFunction
process_exited(p::Process)

Determine whether a process has exited.

source
Base.killMethod
kill(p::Process, signum=Base.SIGTERM)

Send a signal to a process. The default is to terminate the process. Returns successfully if the process has already exited, but throws an error if killing the process failed for other reasons (e.g. insufficient permissions).

source
Base.Sys.set_process_titleFunction
Sys.set_process_title(title::AbstractString)

Set the process title. No-op on some operating systems.

source
Base.Sys.get_process_titleFunction
Sys.get_process_title()

Get the process title. On some systems, will always return an empty string.

source
Base.ignorestatusFunction
ignorestatus(command)

Mark a command object so that running it will not throw an error if the result code is non-zero.

source
Base.detachFunction
detach(command)

Mark a command object so that it will be run in a new process group, allowing it to outlive the julia process, and not have Ctrl-C interrupts passed to it.

source
Base.CmdType
Cmd(cmd::Cmd; ignorestatus, detach, windows_verbatim, windows_hide, env, dir)
+Cmd(exec::Vector{String})

Construct a new Cmd object, representing an external program and arguments, from cmd, while changing the settings of the optional keyword arguments:

  • ignorestatus::Bool: If true (defaults to false), then the Cmd will not throw an error if the return code is nonzero.
  • detach::Bool: If true (defaults to false), then the Cmd will be run in a new process group, allowing it to outlive the julia process and not have Ctrl-C passed to it.
  • windows_verbatim::Bool: If true (defaults to false), then on Windows the Cmd will send a command-line string to the process with no quoting or escaping of arguments, even arguments containing spaces. (On Windows, arguments are sent to a program as a single "command-line" string, and programs are responsible for parsing it into arguments. By default, empty arguments and arguments with spaces or tabs are quoted with double quotes " in the command line, and \ or " are preceded by backslashes. windows_verbatim=true is useful for launching programs that parse their command line in nonstandard ways.) Has no effect on non-Windows systems.
  • windows_hide::Bool: If true (defaults to false), then on Windows no new console window is displayed when the Cmd is executed. This has no effect if a console is already open or on non-Windows systems.
  • env: Set environment variables to use when running the Cmd. env is either a dictionary mapping strings to strings, an array of strings of the form "var=val", an array or tuple of "var"=>val pairs. In order to modify (rather than replace) the existing environment, initialize env with copy(ENV) and then set env["var"]=val as desired. To add to an environment block within a Cmd object without replacing all elements, use addenv() which will return a Cmd object with the updated environment.
  • dir::AbstractString: Specify a working directory for the command (instead of the current directory).

For any keywords that are not specified, the current settings from cmd are used.

Note that the Cmd(exec) constructor does not create a copy of exec. Any subsequent changes to exec will be reflected in the Cmd object.

The most common way to construct a Cmd object is with command literals (backticks), e.g.

`ls -l`

This can then be passed to the Cmd constructor to modify its settings, e.g.

Cmd(`echo "Hello world"`, ignorestatus=true, detach=false)
source
Base.setenvFunction
setenv(command::Cmd, env; dir)

Set environment variables to use when running the given command. env is either a dictionary mapping strings to strings, an array of strings of the form "var=val", or zero or more "var"=>val pair arguments. In order to modify (rather than replace) the existing environment, create env through copy(ENV) and then setting env["var"]=val as desired, or use addenv.

The dir keyword argument can be used to specify a working directory for the command. dir defaults to the currently set dir for command (which is the current working directory if not specified already).

See also Cmd, addenv, ENV, pwd.

source
Base.addenvFunction
addenv(command::Cmd, env...; inherit::Bool = true)

Merge new environment mappings into the given Cmd object, returning a new Cmd object. Duplicate keys are replaced. If command does not contain any environment values set already, it inherits the current environment at time of addenv() call if inherit is true. Keys with value nothing are deleted from the env.

See also Cmd, setenv, ENV.

Julia 1.6

This function requires Julia 1.6 or later.

source
Base.withenvFunction
withenv(f, kv::Pair...)

Execute f in an environment that is temporarily modified (not replaced as in setenv) by zero or more "var"=>val arguments kv. withenv is generally used via the withenv(kv...) do ... end syntax. A value of nothing can be used to temporarily unset an environment variable (if it is set). When withenv returns, the original environment has been restored.

Warning

Changing the environment is not thread-safe. For running external commands with a different environment from the parent process, prefer using addenv over withenv.

source
Base.shell_escapeFunction
shell_escape(args::Union{Cmd,AbstractString...}; special::AbstractString="")

The unexported shell_escape function is the inverse of the unexported Base.shell_split() function: it takes a string or command object and escapes any special characters in such a way that calling Base.shell_split() on it would give back the array of words in the original command. The special keyword argument controls what characters in addition to whitespace, backslashes, quotes and dollar signs are considered to be special (default: none).

Examples

julia> Base.shell_escape("cat", "/foo/bar baz", "&&", "echo", "done")
 "cat '/foo/bar baz' && echo done"
 
 julia> Base.shell_escape("echo", "this", "&&", "that")
-"echo this && that"
source
Base.shell_splitFunction
shell_split(command::AbstractString)

Split a shell command string into its individual components.

Examples

julia> Base.shell_split("git commit -m 'Initial commit'")
+"echo this && that"
source
Base.shell_splitFunction
shell_split(command::AbstractString)

Split a shell command string into its individual components.

Examples

julia> Base.shell_split("git commit -m 'Initial commit'")
 4-element Vector{String}:
  "git"
  "commit"
  "-m"
- "Initial commit"
source
Base.shell_escape_posixlyFunction
shell_escape_posixly(args::Union{Cmd,AbstractString...})

The unexported shell_escape_posixly function takes a string or command object and escapes any special characters in such a way that it is safe to pass it as an argument to a posix shell.

See also: Base.shell_escape()

Examples

julia> Base.shell_escape_posixly("cat", "/foo/bar baz", "&&", "echo", "done")
+ "Initial commit"
source
Base.shell_escape_posixlyFunction
shell_escape_posixly(args::Union{Cmd,AbstractString...})

The unexported shell_escape_posixly function takes a string or command object and escapes any special characters in such a way that it is safe to pass it as an argument to a posix shell.

See also: Base.shell_escape()

Examples

julia> Base.shell_escape_posixly("cat", "/foo/bar baz", "&&", "echo", "done")
 "cat '/foo/bar baz' '&&' echo done"
 
 julia> Base.shell_escape_posixly("echo", "this", "&&", "that")
-"echo this '&&' that"
source
Base.shell_escape_cshFunction
shell_escape_csh(args::Union{Cmd,AbstractString...})
-shell_escape_csh(io::IO, args::Union{Cmd,AbstractString...})

This function quotes any metacharacters in the string arguments such that the string returned can be inserted into a command-line for interpretation by the Unix C shell (csh, tcsh), where each string argument will form one word.

In contrast to a POSIX shell, csh does not support the use of the backslash as a general escape character in double-quoted strings. Therefore, this function wraps strings that might contain metacharacters in single quotes, except for parts that contain single quotes, which it wraps in double quotes instead. It switches between these types of quotes as needed. Linefeed characters are escaped with a backslash.

This function should also work for a POSIX shell, except if the input string contains a linefeed ("\n") character.

See also: Base.shell_escape_posixly()

source
Base.shell_escape_wincmdFunction
shell_escape_wincmd(s::AbstractString)
+"echo this '&&' that"
source
Base.shell_escape_cshFunction
shell_escape_csh(args::Union{Cmd,AbstractString...})
+shell_escape_csh(io::IO, args::Union{Cmd,AbstractString...})

This function quotes any metacharacters in the string arguments such that the string returned can be inserted into a command-line for interpretation by the Unix C shell (csh, tcsh), where each string argument will form one word.

In contrast to a POSIX shell, csh does not support the use of the backslash as a general escape character in double-quoted strings. Therefore, this function wraps strings that might contain metacharacters in single quotes, except for parts that contain single quotes, which it wraps in double quotes instead. It switches between these types of quotes as needed. Linefeed characters are escaped with a backslash.

This function should also work for a POSIX shell, except if the input string contains a linefeed ("\n") character.

See also: Base.shell_escape_posixly()

source
Base.shell_escape_wincmdFunction
shell_escape_wincmd(s::AbstractString)
 shell_escape_wincmd(io::IO, s::AbstractString)

The unexported shell_escape_wincmd function escapes Windows cmd.exe shell meta characters. It escapes ()!^<>&| by placing a ^ in front. An @ is only escaped at the start of the string. Pairs of " characters and the strings they enclose are passed through unescaped. Any remaining " is escaped with ^ to ensure that the number of unescaped " characters in the result remains even.

Since cmd.exe substitutes variable references (like %USER%) before processing the escape characters ^ and ", this function makes no attempt to escape the percent sign (%), the presence of % in the input may cause severe breakage, depending on where the result is used.

Input strings with ASCII control characters that cannot be escaped (NUL, CR, LF) will cause an ArgumentError exception.

The result is safe to pass as an argument to a command call being processed by CMD.exe /S /C " ... " (with surrounding double-quote pair) and will be received verbatim by the target application if the input does not contain % (else this function will fail with an ArgumentError). The presence of % in the input string may result in command injection vulnerabilities and may invalidate any claim of suitability of the output of this function for use as an argument to cmd (due to the ordering described above), so use caution when assembling a string from various sources.

This function may be useful in concert with the windows_verbatim flag to Cmd when constructing process pipelines.

wincmd(c::String) =
    run(Cmd(Cmd(["cmd.exe", "/s /c \" $c \""]);
            windows_verbatim=true))
@@ -1628,13 +1628,13 @@
 run(setenv(`cmd /C echo %cmdargs%`, "cmdargs" => cmdargs))
Warning

The argument parsing done by CMD when calling batch files (either inside .bat files or as arguments to them) is not fully compatible with the output of this function. In particular, the processing of % is different.

Important

Due to a peculiar behavior of the CMD parser/interpreter, each command after a literal | character (indicating a command pipeline) must have shell_escape_wincmd applied twice since it will be parsed twice by CMD. This implies ENV variables would also be expanded twice! For example:

to_print = "All for 1 & 1 for all!"
 to_print_esc = Base.shell_escape_wincmd(Base.shell_escape_wincmd(to_print))
 run(Cmd(Cmd(["cmd", "/S /C \" break | echo $(to_print_esc) \""]), windows_verbatim=true))

With an I/O stream parameter io, the result will be written there, rather than returned as a string.

See also Base.escape_microsoft_c_args(), Base.shell_escape_posixly().

Examples

julia> Base.shell_escape_wincmd("a^\"^o\"^u\"")
-"a^^\"^o\"^^u^\""
source
Base.escape_microsoft_c_argsFunction
escape_microsoft_c_args(args::Union{Cmd,AbstractString...})
-escape_microsoft_c_args(io::IO, args::Union{Cmd,AbstractString...})

Convert a collection of string arguments into a string that can be passed to many Windows command-line applications.

Microsoft Windows passes the entire command line as a single string to the application (unlike POSIX systems, where the shell splits the command line into a list of arguments). Many Windows API applications (including julia.exe), use the conventions of the Microsoft C/C++ runtime to split that command line into a list of strings.

This function implements an inverse for a parser compatible with these rules. It joins command-line arguments to be passed to a Windows C/C++/Julia application into a command line, escaping or quoting the meta characters space, TAB, double quote and backslash where needed.

See also Base.shell_escape_wincmd(), Base.escape_raw_string().

source
Base.setcpuaffinityFunction
setcpuaffinity(original_command::Cmd, cpus) -> command::Cmd

Set the CPU affinity of the command by a list of CPU IDs (1-based) cpus. Passing cpus = nothing means to unset the CPU affinity if the original_command has any.

This function is supported only in Linux and Windows. It is not supported in macOS because libuv does not support affinity setting.

Julia 1.8

This function requires at least Julia 1.8.

Examples

In Linux, the taskset command line program can be used to see how setcpuaffinity works.

julia> run(setcpuaffinity(`sh -c 'taskset -p $$'`, [1, 2, 5]));
+"a^^\"^o\"^^u^\""
source
Base.escape_microsoft_c_argsFunction
escape_microsoft_c_args(args::Union{Cmd,AbstractString...})
+escape_microsoft_c_args(io::IO, args::Union{Cmd,AbstractString...})

Convert a collection of string arguments into a string that can be passed to many Windows command-line applications.

Microsoft Windows passes the entire command line as a single string to the application (unlike POSIX systems, where the shell splits the command line into a list of arguments). Many Windows API applications (including julia.exe), use the conventions of the Microsoft C/C++ runtime to split that command line into a list of strings.

This function implements an inverse for a parser compatible with these rules. It joins command-line arguments to be passed to a Windows C/C++/Julia application into a command line, escaping or quoting the meta characters space, TAB, double quote and backslash where needed.

See also Base.shell_escape_wincmd(), Base.escape_raw_string().

source
Base.setcpuaffinityFunction
setcpuaffinity(original_command::Cmd, cpus) -> command::Cmd

Set the CPU affinity of the command by a list of CPU IDs (1-based) cpus. Passing cpus = nothing means to unset the CPU affinity if the original_command has any.

This function is supported only in Linux and Windows. It is not supported in macOS because libuv does not support affinity setting.

Julia 1.8

This function requires at least Julia 1.8.

Examples

In Linux, the taskset command line program can be used to see how setcpuaffinity works.

julia> run(setcpuaffinity(`sh -c 'taskset -p $$'`, [1, 2, 5]));
 pid 2273's current affinity mask: 13

Note that the mask value 13 reflects that the first, second, and the fifth bits (counting from the least significant position) are turned on:

julia> 0b010011
-0x13
source
Base.pipelineMethod
pipeline(from, to, ...)

Create a pipeline from a data source to a destination. The source and destination can be commands, I/O streams, strings, or results of other pipeline calls. At least one argument must be a command. Strings refer to filenames. When called with more than two arguments, they are chained together from left to right. For example, pipeline(a,b,c) is equivalent to pipeline(pipeline(a,b),c). This provides a more concise way to specify multi-stage pipelines.

Examples:

run(pipeline(`ls`, `grep xyz`))
+0x13
source
Base.pipelineMethod
pipeline(from, to, ...)

Create a pipeline from a data source to a destination. The source and destination can be commands, I/O streams, strings, or results of other pipeline calls. At least one argument must be a command. Strings refer to filenames. When called with more than two arguments, they are chained together from left to right. For example, pipeline(a,b,c) is equivalent to pipeline(pipeline(a,b),c). This provides a more concise way to specify multi-stage pipelines.

Examples:

run(pipeline(`ls`, `grep xyz`))
 run(pipeline(`ls`, "out.txt"))
-run(pipeline("out.txt", `grep xyz`))
source
Base.pipelineMethod
pipeline(command; stdin, stdout, stderr, append=false)

Redirect I/O to or from the given command. Keyword arguments specify which of the command's streams should be redirected. append controls whether file output appends to the file. This is a more general version of the 2-argument pipeline function. pipeline(from, to) is equivalent to pipeline(from, stdout=to) when from is a command, and to pipeline(to, stdin=from) when from is another kind of data source.

Examples:

run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt"))
-run(pipeline(`update`, stdout="log.txt", append=true))
source
Base.Libc.gethostnameFunction
gethostname() -> String

Get the local machine's host name.

source
Base.Libc.getpidFunction
getpid() -> Int32

Get Julia's process ID.

source
getpid(process) -> Int32

Get the child process ID, if it still exists.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Libc.timeMethod
time() -> Float64

Get the system time in seconds since the epoch, with fairly high (typically, microsecond) resolution.

source
Base.time_nsFunction
time_ns() -> UInt64

Get the time in nanoseconds relative to some arbitrary time in the past. The primary use is for measuring the elapsed time between two moments in time.

source
Base.@timeMacro
@time expr
+run(pipeline("out.txt", `grep xyz`))
source
Base.pipelineMethod
pipeline(command; stdin, stdout, stderr, append=false)

Redirect I/O to or from the given command. Keyword arguments specify which of the command's streams should be redirected. append controls whether file output appends to the file. This is a more general version of the 2-argument pipeline function. pipeline(from, to) is equivalent to pipeline(from, stdout=to) when from is a command, and to pipeline(to, stdin=from) when from is another kind of data source.

Examples:

run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt"))
+run(pipeline(`update`, stdout="log.txt", append=true))
source
Base.Libc.gethostnameFunction
gethostname() -> String

Get the local machine's host name.

source
Base.Libc.getpidFunction
getpid() -> Int32

Get Julia's process ID.

source
getpid(process) -> Int32

Get the child process ID, if it still exists.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Libc.timeMethod
time() -> Float64

Get the system time in seconds since the epoch, with fairly high (typically, microsecond) resolution.

source
Base.time_nsFunction
time_ns() -> UInt64

Get the time in nanoseconds relative to some arbitrary time in the past. The primary use is for measuring the elapsed time between two moments in time.

source
Base.@timeMacro
@time expr
 @time "description" expr

A macro to execute an expression, printing the time it took to execute, the number of allocations, and the total number of bytes its execution caused to be allocated, before returning the value of the expression. Any time spent garbage collecting (gc), compiling new code, or recompiling invalidated code is shown as a percentage. Any lock conflicts where a ReentrantLock had to wait are shown as a count.

Optionally provide a description string to print before the time report.

In some cases the system will look inside the @time expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run @time @eval ....

See also @showtime, @timev, @timed, @elapsed, @allocated, and @allocations.

Note

For more serious benchmarking, consider the @btime macro from the BenchmarkTools.jl package which among other things evaluates the function multiple times in order to reduce noise.

Julia 1.8

The option to add a description was introduced in Julia 1.8.

Recompilation time being shown separately from compilation time was introduced in Julia 1.8

Julia 1.11

The reporting of any lock conflicts was added in Julia 1.11.

julia> x = rand(10,10);
 
 julia> @time x * x;
@@ -1658,8 +1658,8 @@
         end
 1: 1.006760 seconds (5 allocations: 144 bytes)
 2: 1.001263 seconds (5 allocations: 144 bytes)
-3: 1.003676 seconds (5 allocations: 144 bytes)
source
Base.@showtimeMacro
@showtime expr

Like @time but also prints the expression being evaluated for reference.

Julia 1.8

This macro was added in Julia 1.8.

See also @time.

julia> @showtime sleep(1)
-sleep(1): 1.002164 seconds (4 allocations: 128 bytes)
source
Base.@timevMacro
@timev expr
+3: 1.003676 seconds (5 allocations: 144 bytes)
source
Base.@showtimeMacro
@showtime expr

Like @time but also prints the expression being evaluated for reference.

Julia 1.8

This macro was added in Julia 1.8.

See also @time.

julia> @showtime sleep(1)
+sleep(1): 1.002164 seconds (4 allocations: 128 bytes)
source
Base.@timevMacro
@timev expr
 @timev "description" expr

This is a verbose version of the @time macro. It first prints the same information as @time, then any non-zero memory allocation counters, and then returns the value of the expression.

Optionally provide a description string to print before the time report.

Julia 1.8

The option to add a description was introduced in Julia 1.8.

See also @time, @timed, @elapsed, @allocated, and @allocations.

julia> x = rand(10,10);
 
 julia> @timev x * x;
@@ -1677,7 +1677,7 @@
   0.000010 seconds (1 allocation: 896 bytes)
 elapsed time (ns): 9848
 bytes allocated:   896
-pool allocs:       1
source
Base.@timedMacro
@timed

A macro to execute an expression, and return the value of the expression, elapsed time in seconds, total bytes allocated, garbage collection time, an object with various memory allocation counters, compilation time in seconds, and recompilation time in seconds. Any lock conflicts where a ReentrantLock had to wait are shown as a count.

In some cases the system will look inside the @timed expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run @timed @eval ....

See also @time, @timev, @elapsed, @allocated, @allocations, and @lock_conflicts.

julia> stats = @timed rand(10^6);
+pool allocs:       1
source
Base.@timedMacro
@timed

A macro to execute an expression, and return the value of the expression, elapsed time in seconds, total bytes allocated, garbage collection time, an object with various memory allocation counters, compilation time in seconds, and recompilation time in seconds. Any lock conflicts where a ReentrantLock had to wait are shown as a count.

In some cases the system will look inside the @timed expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run @timed @eval ....

See also @time, @timev, @elapsed, @allocated, @allocations, and @lock_conflicts.

julia> stats = @timed rand(10^6);
 
 julia> stats.time
 0.006634834
@@ -1699,10 +1699,10 @@
 
 julia> stats.recompile_time
 0.0
-
Julia 1.5

The return type of this macro was changed from Tuple to NamedTuple in Julia 1.5.

Julia 1.11

The lock_conflicts, compile_time, and recompile_time fields were added in Julia 1.11.

source
Base.@elapsedMacro
@elapsed

A macro to evaluate an expression, discarding the resulting value, instead returning the number of seconds it took to execute as a floating-point number.

In some cases the system will look inside the @elapsed expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run @elapsed @eval ....

See also @time, @timev, @timed, @allocated, and @allocations.

julia> @elapsed sleep(0.3)
-0.301391426
source
Base.@allocatedMacro
@allocated

A macro to evaluate an expression, discarding the resulting value, instead returning the total number of bytes allocated during evaluation of the expression.

See also @allocations, @time, @timev, @timed, and @elapsed.

julia> @allocated rand(10^6)
-8000080
source
Base.@allocationsMacro
@allocations

A macro to evaluate an expression, discard the resulting value, and instead return the total number of allocations during evaluation of the expression.

See also @allocated, @time, @timev, @timed, and @elapsed.

julia> @allocations rand(10^6)
-2
Julia 1.9

This macro was added in Julia 1.9.

source
Base.@lock_conflictsMacro
@lock_conflicts

A macro to evaluate an expression, discard the resulting value, and instead return the total number of lock conflicts during evaluation, where a lock attempt on a ReentrantLock resulted in a wait because the lock was already held.

See also @time, @timev and @timed.

julia> @lock_conflicts begin
+
Julia 1.5

The return type of this macro was changed from Tuple to NamedTuple in Julia 1.5.

Julia 1.11

The lock_conflicts, compile_time, and recompile_time fields were added in Julia 1.11.

source
Base.@elapsedMacro
@elapsed

A macro to evaluate an expression, discarding the resulting value, instead returning the number of seconds it took to execute as a floating-point number.

In some cases the system will look inside the @elapsed expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run @elapsed @eval ....

See also @time, @timev, @timed, @allocated, and @allocations.

julia> @elapsed sleep(0.3)
+0.301391426
source
Base.@allocatedMacro
@allocated

A macro to evaluate an expression, discarding the resulting value, instead returning the total number of bytes allocated during evaluation of the expression.

See also @allocations, @time, @timev, @timed, and @elapsed.

julia> @allocated rand(10^6)
+8000080
source
Base.@allocationsMacro
@allocations

A macro to evaluate an expression, discard the resulting value, and instead return the total number of allocations during evaluation of the expression.

See also @allocated, @time, @timev, @timed, and @elapsed.

julia> @allocations rand(10^6)
+2
Julia 1.9

This macro was added in Julia 1.9.

source
Base.@lock_conflictsMacro
@lock_conflicts

A macro to evaluate an expression, discard the resulting value, and instead return the total number of lock conflicts during evaluation, where a lock attempt on a ReentrantLock resulted in a wait because the lock was already held.

See also @time, @timev and @timed.

julia> @lock_conflicts begin
     l = ReentrantLock()
     Threads.@threads for i in 1:Threads.nthreads()
         lock(l) do
@@ -1710,7 +1710,7 @@
         end
     end
 end
-5
Julia 1.11

This macro was added in Julia 1.11.

source
Base.EnvDictType
EnvDict() -> EnvDict

A singleton of this type provides a hash table interface to environment variables.

source
Base.ENVConstant
ENV

Reference to the singleton EnvDict, providing a dictionary interface to system environment variables.

(On Windows, system environment variables are case-insensitive, and ENV correspondingly converts all keys to uppercase for display, iteration, and copying. Portable code should not rely on the ability to distinguish variables by case, and should beware that setting an ostensibly lowercase variable may result in an uppercase ENV key.)

Warning

Mutating the environment is not thread-safe.

Examples

julia> ENV
+5
Julia 1.11

This macro was added in Julia 1.11.

source
Base.EnvDictType
EnvDict() -> EnvDict

A singleton of this type provides a hash table interface to environment variables.

source
Base.ENVConstant
ENV

Reference to the singleton EnvDict, providing a dictionary interface to system environment variables.

(On Windows, system environment variables are case-insensitive, and ENV correspondingly converts all keys to uppercase for display, iteration, and copying. Portable code should not rely on the ability to distinguish variables by case, and should beware that setting an ostensibly lowercase variable may result in an uppercase ENV key.)

Warning

Mutating the environment is not thread-safe.

Examples

julia> ENV
 Base.EnvDict with "50" entries:
   "SECURITYSESSIONID"            => "123"
   "USER"                         => "username"
@@ -1721,7 +1721,7 @@
 "vim"
 
 julia> ENV["JULIA_EDITOR"]
-"vim"

See also: withenv, addenv.

source
Base.Sys.STDLIBConstant
Sys.STDLIB::String

A string containing the full path to the directory containing the stdlib packages.

source
Base.Sys.isunixFunction
Sys.isunix([os])

Predicate for testing if the OS provides a Unix-like interface. See documentation in Handling Operating System Variation.

source
Base.Sys.isappleFunction
Sys.isapple([os])

Predicate for testing if the OS is a derivative of Apple Macintosh OS X or Darwin. See documentation in Handling Operating System Variation.

source
Base.Sys.islinuxFunction
Sys.islinux([os])

Predicate for testing if the OS is a derivative of Linux. See documentation in Handling Operating System Variation.

source
Base.Sys.isbsdFunction
Sys.isbsd([os])

Predicate for testing if the OS is a derivative of BSD. See documentation in Handling Operating System Variation.

Note

The Darwin kernel descends from BSD, which means that Sys.isbsd() is true on macOS systems. To exclude macOS from a predicate, use Sys.isbsd() && !Sys.isapple().

source
Base.Sys.isfreebsdFunction
Sys.isfreebsd([os])

Predicate for testing if the OS is a derivative of FreeBSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on FreeBSD but also on other BSD-based systems. Sys.isfreebsd() refers only to FreeBSD.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.isopenbsdFunction
Sys.isopenbsd([os])

Predicate for testing if the OS is a derivative of OpenBSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on OpenBSD but also on other BSD-based systems. Sys.isopenbsd() refers only to OpenBSD.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.isnetbsdFunction
Sys.isnetbsd([os])

Predicate for testing if the OS is a derivative of NetBSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on NetBSD but also on other BSD-based systems. Sys.isnetbsd() refers only to NetBSD.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.isdragonflyFunction
Sys.isdragonfly([os])

Predicate for testing if the OS is a derivative of DragonFly BSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on DragonFly but also on other BSD-based systems. Sys.isdragonfly() refers only to DragonFly.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.iswindowsFunction
Sys.iswindows([os])

Predicate for testing if the OS is a derivative of Microsoft Windows NT. See documentation in Handling Operating System Variation.

source
Base.Sys.windows_versionFunction
Sys.windows_version()

Return the version number for the Windows NT Kernel as a VersionNumber, i.e. v"major.minor.build", or v"0.0.0" if this is not running on Windows.

source
Base.Sys.free_memoryFunction
Sys.free_memory()

Get the total free memory in RAM in bytes.

source
Base.Sys.total_memoryFunction
Sys.total_memory()

Get the total memory in RAM (including that which is currently used) in bytes. This amount may be constrained, e.g., by Linux control groups. For the unconstrained amount, see Sys.total_physical_memory().

source
Base.Sys.free_physical_memoryFunction
Sys.free_physical_memory()

Get the free memory of the system in bytes. The entire amount may not be available to the current process; use Sys.free_memory() for the actually available amount.

source
Base.Sys.total_physical_memoryFunction
Sys.total_physical_memory()

Get the total memory in RAM (including that which is currently used) in bytes. The entire amount may not be available to the current process; see Sys.total_memory().

source
Base.Sys.uptimeFunction
Sys.uptime()

Gets the current system uptime in seconds.

source
Base.Sys.isjsvmFunction
Sys.isjsvm([os])

Predicate for testing if Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser.

Julia 1.2

This function requires at least Julia 1.2.

source
Base.Sys.loadavgFunction
Sys.loadavg()

Get the load average. See: https://en.wikipedia.org/wiki/Load_(computing).

source
Base.Sys.isexecutableFunction
isexecutable(path::String)

Return true if the given path has executable permissions.

Note

This permission may change before the user executes path, so it is recommended to execute the file and handle the error if that fails, rather than calling isexecutable first.

Note

Prior to Julia 1.6, this did not correctly interrogate filesystem ACLs on Windows, therefore it would return true for any file. From Julia 1.6 on, it correctly determines whether the file is marked as executable or not.

See also ispath, isreadable, iswritable.

source
Base.Sys.isreadableFunction
isreadable(path::String)

Return true if the access permissions for the given path permitted reading by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling isreadable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, iswritable.

source
isreadable(io) -> Bool

Return false if the specified IO object is not readable.

Examples

julia> open("myfile.txt", "w") do io
+"vim"

See also: withenv, addenv.

source
Base.Sys.STDLIBConstant
Sys.STDLIB::String

A string containing the full path to the directory containing the stdlib packages.

source
Base.Sys.isunixFunction
Sys.isunix([os])

Predicate for testing if the OS provides a Unix-like interface. See documentation in Handling Operating System Variation.

source
Base.Sys.isappleFunction
Sys.isapple([os])

Predicate for testing if the OS is a derivative of Apple Macintosh OS X or Darwin. See documentation in Handling Operating System Variation.

source
Base.Sys.islinuxFunction
Sys.islinux([os])

Predicate for testing if the OS is a derivative of Linux. See documentation in Handling Operating System Variation.

source
Base.Sys.isbsdFunction
Sys.isbsd([os])

Predicate for testing if the OS is a derivative of BSD. See documentation in Handling Operating System Variation.

Note

The Darwin kernel descends from BSD, which means that Sys.isbsd() is true on macOS systems. To exclude macOS from a predicate, use Sys.isbsd() && !Sys.isapple().

source
Base.Sys.isfreebsdFunction
Sys.isfreebsd([os])

Predicate for testing if the OS is a derivative of FreeBSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on FreeBSD but also on other BSD-based systems. Sys.isfreebsd() refers only to FreeBSD.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.isopenbsdFunction
Sys.isopenbsd([os])

Predicate for testing if the OS is a derivative of OpenBSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on OpenBSD but also on other BSD-based systems. Sys.isopenbsd() refers only to OpenBSD.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.isnetbsdFunction
Sys.isnetbsd([os])

Predicate for testing if the OS is a derivative of NetBSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on NetBSD but also on other BSD-based systems. Sys.isnetbsd() refers only to NetBSD.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.isdragonflyFunction
Sys.isdragonfly([os])

Predicate for testing if the OS is a derivative of DragonFly BSD. See documentation in Handling Operating System Variation.

Note

Not to be confused with Sys.isbsd(), which is true on DragonFly but also on other BSD-based systems. Sys.isdragonfly() refers only to DragonFly.

Julia 1.1

This function requires at least Julia 1.1.

source
Base.Sys.iswindowsFunction
Sys.iswindows([os])

Predicate for testing if the OS is a derivative of Microsoft Windows NT. See documentation in Handling Operating System Variation.

source
Base.Sys.windows_versionFunction
Sys.windows_version()

Return the version number for the Windows NT Kernel as a VersionNumber, i.e. v"major.minor.build", or v"0.0.0" if this is not running on Windows.

source
Base.Sys.free_memoryFunction
Sys.free_memory()

Get the total free memory in RAM in bytes.

source
Base.Sys.total_memoryFunction
Sys.total_memory()

Get the total memory in RAM (including that which is currently used) in bytes. This amount may be constrained, e.g., by Linux control groups. For the unconstrained amount, see Sys.total_physical_memory().

source
Base.Sys.free_physical_memoryFunction
Sys.free_physical_memory()

Get the free memory of the system in bytes. The entire amount may not be available to the current process; use Sys.free_memory() for the actually available amount.

source
Base.Sys.total_physical_memoryFunction
Sys.total_physical_memory()

Get the total memory in RAM (including that which is currently used) in bytes. The entire amount may not be available to the current process; see Sys.total_memory().

source
Base.Sys.uptimeFunction
Sys.uptime()

Gets the current system uptime in seconds.

source
Base.Sys.isjsvmFunction
Sys.isjsvm([os])

Predicate for testing if Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser.

Julia 1.2

This function requires at least Julia 1.2.

source
Base.Sys.loadavgFunction
Sys.loadavg()

Get the load average. See: https://en.wikipedia.org/wiki/Load_(computing).

source
Base.Sys.isexecutableFunction
isexecutable(path::String)

Return true if the given path has executable permissions.

Note

This permission may change before the user executes path, so it is recommended to execute the file and handle the error if that fails, rather than calling isexecutable first.

Note

Prior to Julia 1.6, this did not correctly interrogate filesystem ACLs on Windows, therefore it would return true for any file. From Julia 1.6 on, it correctly determines whether the file is marked as executable or not.

See also ispath, isreadable, iswritable.

source
Base.Sys.isreadableFunction
isreadable(path::String)

Return true if the access permissions for the given path permitted reading by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling isreadable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, iswritable.

source
isreadable(io) -> Bool

Return false if the specified IO object is not readable.

Examples

julia> open("myfile.txt", "w") do io
            print(io, "Hello world!");
            isreadable(io)
        end
@@ -1732,7 +1732,7 @@
        end
 true
 
-julia> rm("myfile.txt")
source
Base.Sys.iswritableFunction
iswritable(path::String)

Return true if the access permissions for the given path permitted writing by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling iswritable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, isreadable.

source
iswritable(io) -> Bool

Return false if the specified IO object is not writable.

Examples

julia> open("myfile.txt", "w") do io
+julia> rm("myfile.txt")
source
Base.Sys.iswritableFunction
iswritable(path::String)

Return true if the access permissions for the given path permitted writing by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling iswritable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, isreadable.

source
iswritable(io) -> Bool

Return false if the specified IO object is not writable.

Examples

julia> open("myfile.txt", "w") do io
            print(io, "Hello world!");
            iswritable(io)
        end
@@ -1743,7 +1743,7 @@
        end
 false
 
-julia> rm("myfile.txt")
source
Base.Sys.usernameFunction
Sys.username() -> String

Return the username for the current user. If the username cannot be determined or is empty, this function throws an error.

To retrieve a username that is overridable via an environment variable, e.g., USER, consider using

user = get(Sys.username, ENV, "USER")
Julia 1.11

This function requires at least Julia 1.11.

See also homedir.

source
Base.@staticMacro
@static

Partially evaluate an expression at macro expansion time.

This is useful in cases where a construct would be invalid in some cases, such as a ccall to an os-dependent function, or macros defined in packages that are not imported.

@static requires a conditional. The conditional can be in an if statement, a ternary operator, or &&||. The conditional is evaluated by recursively expanding macros, lowering and executing the resulting expressions. Then, the matching branch (if any) is returned. All the other branches of the conditional are deleted before they are macro-expanded (and lowered or executed).

Example

Suppose we want to parse an expression expr that is valid only on macOS. We could solve this problem using @static with @static if Sys.isapple() expr end. In case we had expr_apple for macOS and expr_others for the other operating systems, the solution with @static would be @static Sys.isapple() ? expr_apple : expr_others.

source

Versioning

Base.VersionNumberType
VersionNumber

Version number type which follows the specifications of semantic versioning (semver), composed of major, minor and patch numeric values, followed by pre-release and build alphanumeric annotations.

VersionNumber objects can be compared with all of the standard comparison operators (==, <, <=, etc.), with the result following semver v2.0.0-rc.2 rules.

VersionNumber has the following public fields:

  • v.major::Integer
  • v.minor::Integer
  • v.patch::Integer
  • v.prerelease::Tuple{Vararg{Union{Integer, AbstractString}}}
  • v.build::Tuple{Vararg{Union{Integer, AbstractString}}}

See also @v_str to efficiently construct VersionNumber objects from semver-format literal strings, VERSION for the VersionNumber of Julia itself, and Version Number Literals in the manual.

Examples

julia> a = VersionNumber(1, 2, 3)
+julia> rm("myfile.txt")
source
Base.Sys.usernameFunction
Sys.username() -> String

Return the username for the current user. If the username cannot be determined or is empty, this function throws an error.

To retrieve a username that is overridable via an environment variable, e.g., USER, consider using

user = get(Sys.username, ENV, "USER")
Julia 1.11

This function requires at least Julia 1.11.

See also homedir.

source
Base.@staticMacro
@static

Partially evaluate an expression at macro expansion time.

This is useful in cases where a construct would be invalid in some cases, such as a ccall to an os-dependent function, or macros defined in packages that are not imported.

@static requires a conditional. The conditional can be in an if statement, a ternary operator, or &&||. The conditional is evaluated by recursively expanding macros, lowering and executing the resulting expressions. Then, the matching branch (if any) is returned. All the other branches of the conditional are deleted before they are macro-expanded (and lowered or executed).

Example

Suppose we want to parse an expression expr that is valid only on macOS. We could solve this problem using @static with @static if Sys.isapple() expr end. In case we had expr_apple for macOS and expr_others for the other operating systems, the solution with @static would be @static Sys.isapple() ? expr_apple : expr_others.

source

Versioning

Base.VersionNumberType
VersionNumber

Version number type which follows the specifications of semantic versioning (semver), composed of major, minor and patch numeric values, followed by pre-release and build alphanumeric annotations.

VersionNumber objects can be compared with all of the standard comparison operators (==, <, <=, etc.), with the result following semver v2.0.0-rc.2 rules.

VersionNumber has the following public fields:

  • v.major::Integer
  • v.minor::Integer
  • v.patch::Integer
  • v.prerelease::Tuple{Vararg{Union{Integer, AbstractString}}}
  • v.build::Tuple{Vararg{Union{Integer, AbstractString}}}

See also @v_str to efficiently construct VersionNumber objects from semver-format literal strings, VERSION for the VersionNumber of Julia itself, and Version Number Literals in the manual.

Examples

julia> a = VersionNumber(1, 2, 3)
 v"1.2.3"
 
 julia> a >= v"1.2"
@@ -1753,14 +1753,14 @@
 v"2.0.1-rc1"
 
 julia> b >= v"2.0.1"
-false
source
Base.@v_strMacro
@v_str

String macro used to parse a string to a VersionNumber.

Examples

julia> v"1.2.3"
+false
source
Base.@v_strMacro
@v_str

String macro used to parse a string to a VersionNumber.

Examples

julia> v"1.2.3"
 v"1.2.3"
 
 julia> v"2.0.1-rc1"
-v"2.0.1-rc1"
source

Errors

Base.errorFunction
error(msg...)

Raise an ErrorException with a message constructed by string(msg...).

source
error(message::AbstractString)

Raise an ErrorException with the given message.

source
Core.throwFunction
throw(e)

Throw an object as an exception.

See also: rethrow, error.

source
Base.rethrowFunction
rethrow()

Rethrow the current exception from within a catch block. The rethrown exception will continue propagation as if it had not been caught.

Note

The alternative form rethrow(e) allows you to associate an alternative exception object e with the current backtrace. However this misrepresents the program state at the time of the error so you're encouraged to instead throw a new exception using throw(e). In Julia 1.1 and above, using throw(e) will preserve the root cause exception on the stack, as described in current_exceptions.

source
Base.backtraceFunction
backtrace()

Get a backtrace object for the current program point.

source
Base.catch_backtraceFunction
catch_backtrace()

Get the backtrace of the current exception, for use within catch blocks.

source
Base.current_exceptionsFunction
current_exceptions(task::Task=current_task(); [backtrace::Bool=true])

Get the stack of exceptions currently being handled. For nested catch blocks there may be more than one current exception in which case the most recently thrown exception is last in the stack. The stack is returned as an ExceptionStack which is an AbstractVector of named tuples (exception,backtrace). If backtrace is false, the backtrace in each pair will be set to nothing.

Explicitly passing task will return the current exception stack on an arbitrary task. This is useful for inspecting tasks which have failed due to uncaught exceptions.

Julia 1.7

This function went by the experimental name catch_stack() in Julia 1.1–1.6, and had a plain Vector-of-tuples as a return type.

source
Base.@assertMacro
@assert cond [text]

Throw an AssertionError if cond is false. This is the preferred syntax for writing assertions, which are conditions that are assumed to be true, but that the user might decide to check anyways, as an aid to debugging if they fail. The optional message text is displayed upon assertion failure.

Warning

An assert might be disabled at some optimization levels. Assert should therefore only be used as a debugging tool and not used for authentication verification (e.g., verifying passwords or checking array bounds). The code must not rely on the side effects of running cond for the correct behavior of a function.

Examples

julia> @assert iseven(3) "3 is an odd number!"
+v"2.0.1-rc1"
source

Errors

Base.errorFunction
error(msg...)

Raise an ErrorException with a message constructed by string(msg...).

source
error(message::AbstractString)

Raise an ErrorException with the given message.

source
Core.throwFunction
throw(e)

Throw an object as an exception.

See also: rethrow, error.

source
Base.rethrowFunction
rethrow()

Rethrow the current exception from within a catch block. The rethrown exception will continue propagation as if it had not been caught.

Note

The alternative form rethrow(e) allows you to associate an alternative exception object e with the current backtrace. However this misrepresents the program state at the time of the error so you're encouraged to instead throw a new exception using throw(e). In Julia 1.1 and above, using throw(e) will preserve the root cause exception on the stack, as described in current_exceptions.

source
Base.backtraceFunction
backtrace()

Get a backtrace object for the current program point.

source
Base.catch_backtraceFunction
catch_backtrace()

Get the backtrace of the current exception, for use within catch blocks.

source
Base.current_exceptionsFunction
current_exceptions(task::Task=current_task(); [backtrace::Bool=true])

Get the stack of exceptions currently being handled. For nested catch blocks there may be more than one current exception in which case the most recently thrown exception is last in the stack. The stack is returned as an ExceptionStack which is an AbstractVector of named tuples (exception,backtrace). If backtrace is false, the backtrace in each pair will be set to nothing.

Explicitly passing task will return the current exception stack on an arbitrary task. This is useful for inspecting tasks which have failed due to uncaught exceptions.

Julia 1.7

This function went by the experimental name catch_stack() in Julia 1.1–1.6, and had a plain Vector-of-tuples as a return type.

source
Base.@assertMacro
@assert cond [text]

Throw an AssertionError if cond is false. This is the preferred syntax for writing assertions, which are conditions that are assumed to be true, but that the user might decide to check anyways, as an aid to debugging if they fail. The optional message text is displayed upon assertion failure.

Warning

An assert might be disabled at some optimization levels. Assert should therefore only be used as a debugging tool and not used for authentication verification (e.g., verifying passwords or checking array bounds). The code must not rely on the side effects of running cond for the correct behavior of a function.

Examples

julia> @assert iseven(3) "3 is an odd number!"
 ERROR: AssertionError: 3 is an odd number!
 
-julia> @assert isodd(3) "What even are numbers?"
source
Base.Experimental.register_error_hintFunction
Experimental.register_error_hint(handler, exceptiontype)

Register a "hinting" function handler(io, exception) that can suggest potential ways for users to circumvent errors. handler should examine exception to see whether the conditions appropriate for a hint are met, and if so generate output to io. Packages should call register_error_hint from within their __init__ function.

For specific exception types, handler is required to accept additional arguments:

  • MethodError: provide handler(io, exc::MethodError, argtypes, kwargs), which splits the combined arguments into positional and keyword arguments.

When issuing a hint, the output should typically start with \n.

If you define custom exception types, your showerror method can support hints by calling Experimental.show_error_hints.

Examples

julia> module Hinter
+julia> @assert isodd(3) "What even are numbers?"
source
Base.Experimental.register_error_hintFunction
Experimental.register_error_hint(handler, exceptiontype)

Register a "hinting" function handler(io, exception) that can suggest potential ways for users to circumvent errors. handler should examine exception to see whether the conditions appropriate for a hint are met, and if so generate output to io. Packages should call register_error_hint from within their __init__ function.

For specific exception types, handler is required to accept additional arguments:

  • MethodError: provide handler(io, exc::MethodError, argtypes, kwargs), which splits the combined arguments into positional and keyword arguments.

When issuing a hint, the output should typically start with \n.

If you define custom exception types, your showerror method can support hints by calling Experimental.show_error_hints.

Examples

julia> module Hinter
 
        only_int(x::Int)      = 1
        any_number(x::Number) = 2
@@ -1780,8 +1780,8 @@
 The function `only_int` exists, but no method is defined for this combination of argument types.
 Did you mean to call `any_number`?
 Closest candidates are:
-    ...
Julia 1.5

Custom error hints are available as of Julia 1.5.

Warning

This interface is experimental and subject to change or removal without notice. To insulate yourself against changes, consider putting any registrations inside an if isdefined(Base.Experimental, :register_error_hint) ... end block.

source
Base.Experimental.show_error_hintsFunction
Experimental.show_error_hints(io, ex, args...)

Invoke all handlers from Experimental.register_error_hint for the particular exception type typeof(ex). args must contain any other arguments expected by the handler for that type.

Julia 1.5

Custom error hints are available as of Julia 1.5.

Warning

This interface is experimental and subject to change or removal without notice.

source
Core.ArgumentErrorType
ArgumentError(msg)

The arguments passed to a function are invalid. msg is a descriptive error message.

source
Core.AssertionErrorType
AssertionError([msg])

The asserted condition did not evaluate to true. Optional argument msg is a descriptive error string.

Examples

julia> @assert false "this is not true"
-ERROR: AssertionError: this is not true

AssertionError is usually thrown from @assert.

source
Core.BoundsErrorType
BoundsError([a],[i])

An indexing operation into an array, a, tried to access an out-of-bounds element at index i.

Examples

julia> A = fill(1.0, 7);
+    ...
Julia 1.5

Custom error hints are available as of Julia 1.5.

Warning

This interface is experimental and subject to change or removal without notice. To insulate yourself against changes, consider putting any registrations inside an if isdefined(Base.Experimental, :register_error_hint) ... end block.

source
Base.Experimental.show_error_hintsFunction
Experimental.show_error_hints(io, ex, args...)

Invoke all handlers from Experimental.register_error_hint for the particular exception type typeof(ex). args must contain any other arguments expected by the handler for that type.

Julia 1.5

Custom error hints are available as of Julia 1.5.

Warning

This interface is experimental and subject to change or removal without notice.

source
Core.ArgumentErrorType
ArgumentError(msg)

The arguments passed to a function are invalid. msg is a descriptive error message.

source
Core.AssertionErrorType
AssertionError([msg])

The asserted condition did not evaluate to true. Optional argument msg is a descriptive error string.

Examples

julia> @assert false "this is not true"
+ERROR: AssertionError: this is not true

AssertionError is usually thrown from @assert.

source
Core.BoundsErrorType
BoundsError([a],[i])

An indexing operation into an array, a, tried to access an out-of-bounds element at index i.

Examples

julia> A = fill(1.0, 7);
 
 julia> A[8]
 ERROR: BoundsError: attempt to access 7-element Vector{Float64} at index [8]
@@ -1795,21 +1795,21 @@
 
 julia> B[9]
 ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [9]
-
source
Base.CompositeExceptionType
CompositeException

Wrap a Vector of exceptions thrown by a Task (e.g. generated from a remote worker over a channel or an asynchronously executing local I/O write or a remote worker under pmap) with information about the series of exceptions. For example, if a group of workers are executing several tasks, and multiple workers fail, the resulting CompositeException will contain a "bundle" of information from each worker indicating where and why the exception(s) occurred.

source
Base.DimensionMismatchType
DimensionMismatch([msg])

The objects called do not have matching dimensionality. Optional argument msg is a descriptive error string.

source
Core.DivideErrorType
DivideError()

Integer division was attempted with a denominator value of 0.

Examples

julia> 2/0
+
source
Base.CompositeExceptionType
CompositeException

Wrap a Vector of exceptions thrown by a Task (e.g. generated from a remote worker over a channel or an asynchronously executing local I/O write or a remote worker under pmap) with information about the series of exceptions. For example, if a group of workers are executing several tasks, and multiple workers fail, the resulting CompositeException will contain a "bundle" of information from each worker indicating where and why the exception(s) occurred.

source
Base.DimensionMismatchType
DimensionMismatch([msg])

The objects called do not have matching dimensionality. Optional argument msg is a descriptive error string.

source
Core.DivideErrorType
DivideError()

Integer division was attempted with a denominator value of 0.

Examples

julia> 2/0
 Inf
 
 julia> div(2, 0)
 ERROR: DivideError: integer division error
 Stacktrace:
-[...]
source
Core.DomainErrorType
DomainError(val)
+[...]
source
Core.DomainErrorType
DomainError(val)
 DomainError(val, msg)

The argument val to a function or constructor is outside the valid domain.

Examples

julia> sqrt(-1)
 ERROR: DomainError with -1.0:
 sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
 Stacktrace:
-[...]
source
Base.EOFErrorType
EOFError()

No more data was available to read from a file or stream.

source
Core.ErrorExceptionType
ErrorException(msg)

Generic error type. The error message, in the .msg field, may provide more specific details.

Examples

julia> ex = ErrorException("I've done a bad thing");
+[...]
source
Base.EOFErrorType
EOFError()

No more data was available to read from a file or stream.

source
Core.ErrorExceptionType
ErrorException(msg)

Generic error type. The error message, in the .msg field, may provide more specific details.

Examples

julia> ex = ErrorException("I've done a bad thing");
 
 julia> ex.msg
-"I've done a bad thing"
source
Core.FieldErrorType
FieldError(type::DataType, field::Symbol)

An operation tried to access invalid field on an object of type.

Julia 1.12

Prior to Julia 1.12, invalid field access threw an ErrorException

See getfield

Examples

julia> struct AB
+"I've done a bad thing"
source
Core.FieldErrorType
FieldError(type::DataType, field::Symbol)

An operation tried to access invalid field on an object of type.

Julia 1.12

Prior to Julia 1.12, invalid field access threw an ErrorException

See getfield

Examples

julia> struct AB
           a::Float32
           b::Float64
        end
@@ -1820,10 +1820,10 @@
 julia> ab.c # field `c` doesn't exist
 ERROR: FieldError: type AB has no field `c`, available fields: `a`, `b`
 Stacktrace:
-[...]
source
Core.InexactErrorType
InexactError(name::Symbol, T, val)

Cannot exactly convert val to type T in a method of function name.

Examples

julia> convert(Float64, 1+2im)
+[...]
source
Core.InexactErrorType
InexactError(name::Symbol, T, val)

Cannot exactly convert val to type T in a method of function name.

Examples

julia> convert(Float64, 1+2im)
 ERROR: InexactError: Float64(1 + 2im)
 Stacktrace:
-[...]
source
Core.InterruptExceptionType
InterruptException()

The process was stopped by a terminal interrupt (CTRL+C).

Note that, in Julia script started without -i (interactive) option, InterruptException is not thrown by default. Calling Base.exit_on_sigint(false) in the script can recover the behavior of the REPL. Alternatively, a Julia script can be started with

julia -e "include(popfirst!(ARGS))" script.jl

to let InterruptException be thrown by CTRL+C during the execution.

source
Base.KeyErrorType
KeyError(key)

An indexing operation into an AbstractDict (Dict) or Set like object tried to access or delete a non-existent element.

source
Core.LoadErrorType
LoadError(file::AbstractString, line::Int, error)

An error occurred while includeing, requireing, or using a file. The error specifics should be available in the .error field.

Julia 1.7

LoadErrors are no longer emitted by @macroexpand, @macroexpand1, and macroexpand as of Julia 1.7.

source
Core.MethodErrorType
MethodError(f, args)

A method with the required type signature does not exist in the given generic function. Alternatively, there is no unique most-specific method.

source
Base.MissingExceptionType
MissingException(msg)

Exception thrown when a missing value is encountered in a situation where it is not supported. The error message, in the msg field may provide more specific details.

source
Core.OutOfMemoryErrorType
OutOfMemoryError()

An operation allocated too much memory for either the system or the garbage collector to handle properly.

source
Core.ReadOnlyMemoryErrorType
ReadOnlyMemoryError()

An operation tried to write to memory that is read-only.

source
Core.OverflowErrorType
OverflowError(msg)

The result of an expression is too large for the specified type and will cause a wraparound.

source
Base.ProcessFailedExceptionType
ProcessFailedException

Indicates problematic exit status of a process. When running commands or pipelines, this is thrown to indicate a nonzero exit code was returned (i.e. that the invoked process failed).

source
Base.TaskFailedExceptionType
TaskFailedException

This exception is thrown by a wait(t) call when task t fails. TaskFailedException wraps the failed task t.

source
Core.StackOverflowErrorType
StackOverflowError()

The function call grew beyond the size of the call stack. This usually happens when a call recurses infinitely.

source
Base.SystemErrorType
SystemError(prefix::AbstractString, [errno::Int32])

A system call failed with an error code (in the errno global variable).

source
Core.TypeErrorType
TypeError(func::Symbol, context::AbstractString, expected::Type, got)

A type assertion failure, or calling an intrinsic function with an incorrect argument type.

source
Core.UndefKeywordErrorType
UndefKeywordError(var::Symbol)

The required keyword argument var was not assigned in a function call.

Examples

julia> function my_func(;my_arg)
+[...]
source
Core.InterruptExceptionType
InterruptException()

The process was stopped by a terminal interrupt (CTRL+C).

Note that, in Julia script started without -i (interactive) option, InterruptException is not thrown by default. Calling Base.exit_on_sigint(false) in the script can recover the behavior of the REPL. Alternatively, a Julia script can be started with

julia -e "include(popfirst!(ARGS))" script.jl

to let InterruptException be thrown by CTRL+C during the execution.

source
Base.KeyErrorType
KeyError(key)

An indexing operation into an AbstractDict (Dict) or Set like object tried to access or delete a non-existent element.

source
Core.LoadErrorType
LoadError(file::AbstractString, line::Int, error)

An error occurred while includeing, requireing, or using a file. The error specifics should be available in the .error field.

Julia 1.7

LoadErrors are no longer emitted by @macroexpand, @macroexpand1, and macroexpand as of Julia 1.7.

source
Core.MethodErrorType
MethodError(f, args)

A method with the required type signature does not exist in the given generic function. Alternatively, there is no unique most-specific method.

source
Base.MissingExceptionType
MissingException(msg)

Exception thrown when a missing value is encountered in a situation where it is not supported. The error message, in the msg field may provide more specific details.

source
Core.OutOfMemoryErrorType
OutOfMemoryError()

An operation allocated too much memory for either the system or the garbage collector to handle properly.

source
Core.ReadOnlyMemoryErrorType
ReadOnlyMemoryError()

An operation tried to write to memory that is read-only.

source
Core.OverflowErrorType
OverflowError(msg)

The result of an expression is too large for the specified type and will cause a wraparound.

source
Base.ProcessFailedExceptionType
ProcessFailedException

Indicates problematic exit status of a process. When running commands or pipelines, this is thrown to indicate a nonzero exit code was returned (i.e. that the invoked process failed).

source
Base.TaskFailedExceptionType
TaskFailedException

This exception is thrown by a wait(t) call when task t fails. TaskFailedException wraps the failed task t.

source
Core.StackOverflowErrorType
StackOverflowError()

The function call grew beyond the size of the call stack. This usually happens when a call recurses infinitely.

source
Base.SystemErrorType
SystemError(prefix::AbstractString, [errno::Int32])

A system call failed with an error code (in the errno global variable).

source
Core.TypeErrorType
TypeError(func::Symbol, context::AbstractString, expected::Type, got)

A type assertion failure, or calling an intrinsic function with an incorrect argument type.

source
Core.UndefKeywordErrorType
UndefKeywordError(var::Symbol)

The required keyword argument var was not assigned in a function call.

Examples

julia> function my_func(;my_arg)
            return my_arg + 1
        end
 my_func (generic function with 1 method)
@@ -1832,7 +1832,7 @@
 ERROR: UndefKeywordError: keyword argument `my_arg` not assigned
 Stacktrace:
  [1] my_func() at ./REPL[1]:2
- [2] top-level scope at REPL[2]:1
source
Core.UndefRefErrorType
UndefRefError()

The item or field is not defined for the given object.

Examples

julia> struct MyType
+ [2] top-level scope at REPL[2]:1
source
Core.UndefRefErrorType
UndefRefError()

The item or field is not defined for the given object.

Examples

julia> struct MyType
            a::Vector{Int}
            MyType() = new()
        end
@@ -1843,17 +1843,17 @@
 julia> A.a
 ERROR: UndefRefError: access to undefined reference
 Stacktrace:
-[...]
source
Core.UndefVarErrorType
UndefVarError(var::Symbol, [scope])

A symbol in the current scope is not defined.

Examples

julia> a
+[...]
source
Core.UndefVarErrorType
UndefVarError(var::Symbol, [scope])

A symbol in the current scope is not defined.

Examples

julia> a
 ERROR: UndefVarError: `a` not defined in `Main`
 
 julia> a = 1;
 
 julia> a
-1
source
Base.StringIndexErrorType
StringIndexError(str, i)

An error occurred when trying to access str at index i that is not valid.

source
Core.InitErrorType
InitError(mod::Symbol, error)

An error occurred when running a module's __init__ function. The actual error thrown is available in the .error field.

source
Base.retryFunction
retry(f;  delays=ExponentialBackOff(), check=nothing) -> Function

Return an anonymous function that calls function f. If an exception arises, f is repeatedly called again, each time check returns true, after waiting the number of seconds specified in delays. check should input delays's current state and the Exception.

Julia 1.2

Before Julia 1.2 this signature was restricted to f::Function.

Examples

retry(f, delays=fill(5.0, 3))
+1
source
Base.StringIndexErrorType
StringIndexError(str, i)

An error occurred when trying to access str at index i that is not valid.

source
Core.InitErrorType
InitError(mod::Symbol, error)

An error occurred when running a module's __init__ function. The actual error thrown is available in the .error field.

source
Base.retryFunction
retry(f;  delays=ExponentialBackOff(), check=nothing) -> Function

Return an anonymous function that calls function f. If an exception arises, f is repeatedly called again, each time check returns true, after waiting the number of seconds specified in delays. check should input delays's current state and the Exception.

Julia 1.2

Before Julia 1.2 this signature was restricted to f::Function.

Examples

retry(f, delays=fill(5.0, 3))
 retry(f, delays=rand(5:10, 2))
 retry(f, delays=Base.ExponentialBackOff(n=3, first_delay=5, max_delay=1000))
 retry(http_get, check=(s,e)->e.status == "503")(url)
-retry(read, check=(s,e)->isa(e, IOError))(io, 128; all=false)
source
Base.ExponentialBackOffType
ExponentialBackOff(; n=1, first_delay=0.05, max_delay=10.0, factor=5.0, jitter=0.1)

A Float64 iterator of length n whose elements exponentially increase at a rate in the interval factor * (1 ± jitter). The first element is first_delay and all elements are clamped to max_delay.

source

Events

Base.TimerMethod
Timer(callback::Function, delay; interval = 0, spawn::Union{Nothing,Bool}=nothing)

Create a timer that runs the function callback at each timer expiration.

Waiting tasks are woken and the function callback is called after an initial delay of delay seconds, and then repeating with the given interval in seconds. If interval is equal to 0, the callback is only run once. The function callback is called with a single argument, the timer itself. Stop a timer by calling close. The callback may still be run one final time, if the timer has already expired.

If spawn is true, the created task will be spawned, meaning that it will be allowed to move thread, which avoids the side-effect of forcing the parent task to get stuck to the thread it is on. If spawn is nothing (default), the task will be spawned if the parent task isn't sticky.

Julia 1.12

The spawn argument was introduced in Julia 1.12.

Examples

Here the first number is printed after a delay of two seconds, then the following numbers are printed quickly.

julia> begin
+retry(read, check=(s,e)->isa(e, IOError))(io, 128; all=false)
source
Base.ExponentialBackOffType
ExponentialBackOff(; n=1, first_delay=0.05, max_delay=10.0, factor=5.0, jitter=0.1)

A Float64 iterator of length n whose elements exponentially increase at a rate in the interval factor * (1 ± jitter). The first element is first_delay and all elements are clamped to max_delay.

source

Events

Base.TimerMethod
Timer(callback::Function, delay; interval = 0, spawn::Union{Nothing,Bool}=nothing)

Create a timer that runs the function callback at each timer expiration.

Waiting tasks are woken and the function callback is called after an initial delay of delay seconds, and then repeating with the given interval in seconds. If interval is equal to 0, the callback is only run once. The function callback is called with a single argument, the timer itself. Stop a timer by calling close. The callback may still be run one final time, if the timer has already expired.

If spawn is true, the created task will be spawned, meaning that it will be allowed to move thread, which avoids the side-effect of forcing the parent task to get stuck to the thread it is on. If spawn is nothing (default), the task will be spawned if the parent task isn't sticky.

Julia 1.12

The spawn argument was introduced in Julia 1.12.

Examples

Here the first number is printed after a delay of two seconds, then the following numbers are printed quickly.

julia> begin
            i = 0
            cb(timer) = (global i += 1; println(i))
            t = Timer(cb, 2, interval=0.2)
@@ -1863,8 +1863,8 @@
        end
 1
 2
-3
source
Base.TimerType
Timer(delay; interval = 0)

Create a timer that wakes up tasks waiting for it (by calling wait on the timer object).

Waiting tasks are woken after an initial delay of at least delay seconds, and then repeating after at least interval seconds again elapse. If interval is equal to 0, the timer is only triggered once. When the timer is closed (by close) waiting tasks are woken with an error. Use isopen to check whether a timer is still active.

Note

interval is subject to accumulating time skew. If you need precise events at a particular absolute time, create a new timer at each expiration with the difference to the next time computed.

Note

A Timer requires yield points to update its state. For instance, isopen(t::Timer) cannot be used to timeout a non-yielding while loop.

source
Base.AsyncConditionType
AsyncCondition()

Create a async condition that wakes up tasks waiting for it (by calling wait on the object) when notified from C by a call to uv_async_send. Waiting tasks are woken with an error when the object is closed (by close). Use isopen to check whether it is still active.

This provides an implicit acquire & release memory ordering between the sending and waiting threads.

source
Base.AsyncConditionMethod
AsyncCondition(callback::Function)

Create a async condition that calls the given callback function. The callback is passed one argument, the async condition object itself.

source

Reflection

Base.nameofMethod
nameof(m::Module) -> Symbol

Get the name of a Module as a Symbol.

Examples

julia> nameof(Base.Broadcast)
-:Broadcast
source
Base.parentmoduleFunction
parentmodule(m::Method) -> Module

Return the module in which the given method m is defined.

Julia 1.9

Passing a Method as an argument requires Julia 1.9 or later.

source
parentmodule(f::Function, types) -> Module

Determine the module containing the first method of a generic function f matching the specified types.

source
parentmodule(f::Function) -> Module

Determine the module containing the (first) definition of a generic function.

source
parentmodule(t::DataType) -> Module

Determine the module containing the definition of a (potentially UnionAll-wrapped) DataType.

Examples

julia> module Foo
+3
source
Base.TimerType
Timer(delay; interval = 0)

Create a timer that wakes up tasks waiting for it (by calling wait on the timer object).

Waiting tasks are woken after an initial delay of at least delay seconds, and then repeating after at least interval seconds again elapse. If interval is equal to 0, the timer is only triggered once. When the timer is closed (by close) waiting tasks are woken with an error. Use isopen to check whether a timer is still active.

Note

interval is subject to accumulating time skew. If you need precise events at a particular absolute time, create a new timer at each expiration with the difference to the next time computed.

Note

A Timer requires yield points to update its state. For instance, isopen(t::Timer) cannot be used to timeout a non-yielding while loop.

source
Base.AsyncConditionType
AsyncCondition()

Create a async condition that wakes up tasks waiting for it (by calling wait on the object) when notified from C by a call to uv_async_send. Waiting tasks are woken with an error when the object is closed (by close). Use isopen to check whether it is still active.

This provides an implicit acquire & release memory ordering between the sending and waiting threads.

source
Base.AsyncConditionMethod
AsyncCondition(callback::Function)

Create a async condition that calls the given callback function. The callback is passed one argument, the async condition object itself.

source

Reflection

Base.nameofMethod
nameof(m::Module) -> Symbol

Get the name of a Module as a Symbol.

Examples

julia> nameof(Base.Broadcast)
+:Broadcast
source
Base.parentmoduleFunction
parentmodule(m::Method) -> Module

Return the module in which the given method m is defined.

Julia 1.9

Passing a Method as an argument requires Julia 1.9 or later.

source
parentmodule(f::Function, types) -> Module

Determine the module containing the first method of a generic function f matching the specified types.

source
parentmodule(f::Function) -> Module

Determine the module containing the (first) definition of a generic function.

source
parentmodule(t::DataType) -> Module

Determine the module containing the definition of a (potentially UnionAll-wrapped) DataType.

Examples

julia> module Foo
            struct Int end
        end
 Foo
@@ -1873,15 +1873,15 @@
 Core
 
 julia> parentmodule(Foo.Int)
-Foo
source
parentmodule(m::Module) -> Module

Get a module's enclosing Module. Main is its own parent.

See also: names, nameof, fullname, @__MODULE__.

Examples

julia> parentmodule(Main)
+Foo
source
parentmodule(m::Module) -> Module

Get a module's enclosing Module. Main is its own parent.

See also: names, nameof, fullname, @__MODULE__.

Examples

julia> parentmodule(Main)
 Main
 
 julia> parentmodule(Base.Broadcast)
-Base
source
Base.pathofMethod
pathof(m::Module)

Return the path of the m.jl file that was used to import module m, or nothing if m was not imported from a package.

Use dirname to get the directory part and basename to get the file name part of the path.

See also pkgdir.

source
Base.pkgdirMethod
pkgdir(m::Module[, paths::String...])

Return the root directory of the package that declared module m, or nothing if m was not declared in a package. Optionally further path component strings can be provided to construct a path within the package root.

To get the root directory of the package that implements the current module the form pkgdir(@__MODULE__) can be used.

If an extension module is given, the root of the parent package is returned.

julia> pkgdir(Foo)
+Base
source
Base.pathofMethod
pathof(m::Module)

Return the path of the m.jl file that was used to import module m, or nothing if m was not imported from a package.

Use dirname to get the directory part and basename to get the file name part of the path.

See also pkgdir.

source
Base.pkgdirMethod
pkgdir(m::Module[, paths::String...])

Return the root directory of the package that declared module m, or nothing if m was not declared in a package. Optionally further path component strings can be provided to construct a path within the package root.

To get the root directory of the package that implements the current module the form pkgdir(@__MODULE__) can be used.

If an extension module is given, the root of the parent package is returned.

julia> pkgdir(Foo)
 "/path/to/Foo.jl"
 
 julia> pkgdir(Foo, "src", "file.jl")
-"/path/to/Foo.jl/src/file.jl"

See also pathof.

Julia 1.7

The optional argument paths requires at least Julia 1.7.

source
Base.pkgversionMethod
pkgversion(m::Module)

Return the version of the package that imported module m, or nothing if m was not imported from a package, or imported from a package without a version field set.

The version is read from the package's Project.toml during package load.

To get the version of the package that imported the current module the form pkgversion(@__MODULE__) can be used.

Julia 1.9

This function was introduced in Julia 1.9.

source
Base.modulerootFunction
moduleroot(m::Module) -> Module

Find the root module of a given module. This is the first module in the chain of parent modules of m which is either a registered root module or which is its own parent module.

source
__module__Keyword
__module__

The argument __module__ is only visible inside the macro, and it provides information (in the form of a Module object) about the expansion context of the macro invocation. See the manual section on Macro invocation for more information.

source
__source__Keyword
__source__

The argument __source__ is only visible inside the macro, and it provides information (in the form of a LineNumberNode object) about the parser location of the @ sign from the macro invocation. See the manual section on Macro invocation for more information.

source
Base.@__MODULE__Macro
@__MODULE__ -> Module

Get the Module of the toplevel eval, which is the Module code is currently being read from.

source
Base.@__FILE__Macro
@__FILE__ -> String

Expand to a string with the path to the file containing the macrocall, or an empty string if evaluated by julia -e <expr>. Return nothing if the macro was missing parser source information. Alternatively see PROGRAM_FILE.

source
Base.@__DIR__Macro
@__DIR__ -> String

Macro to obtain the absolute path of the current directory as a string.

If in a script, returns the directory of the script containing the @__DIR__ macrocall. If run from a REPL or if evaluated by julia -e <expr>, returns the current working directory.

Examples

The example illustrates the difference in the behaviors of @__DIR__ and pwd(), by creating a simple script in a different directory than the current working one and executing both commands:

julia> cd("/home/JuliaUser") # working directory
+"/path/to/Foo.jl/src/file.jl"

See also pathof.

Julia 1.7

The optional argument paths requires at least Julia 1.7.

source
Base.pkgversionMethod
pkgversion(m::Module)

Return the version of the package that imported module m, or nothing if m was not imported from a package, or imported from a package without a version field set.

The version is read from the package's Project.toml during package load.

To get the version of the package that imported the current module the form pkgversion(@__MODULE__) can be used.

Julia 1.9

This function was introduced in Julia 1.9.

source
Base.modulerootFunction
moduleroot(m::Module) -> Module

Find the root module of a given module. This is the first module in the chain of parent modules of m which is either a registered root module or which is its own parent module.

source
__module__Keyword
__module__

The argument __module__ is only visible inside the macro, and it provides information (in the form of a Module object) about the expansion context of the macro invocation. See the manual section on Macro invocation for more information.

source
__source__Keyword
__source__

The argument __source__ is only visible inside the macro, and it provides information (in the form of a LineNumberNode object) about the parser location of the @ sign from the macro invocation. See the manual section on Macro invocation for more information.

source
Base.@__MODULE__Macro
@__MODULE__ -> Module

Get the Module of the toplevel eval, which is the Module code is currently being read from.

source
Base.@__FILE__Macro
@__FILE__ -> String

Expand to a string with the path to the file containing the macrocall, or an empty string if evaluated by julia -e <expr>. Return nothing if the macro was missing parser source information. Alternatively see PROGRAM_FILE.

source
Base.@__DIR__Macro
@__DIR__ -> String

Macro to obtain the absolute path of the current directory as a string.

If in a script, returns the directory of the script containing the @__DIR__ macrocall. If run from a REPL or if evaluated by julia -e <expr>, returns the current working directory.

Examples

The example illustrates the difference in the behaviors of @__DIR__ and pwd(), by creating a simple script in a different directory than the current working one and executing both commands:

julia> cd("/home/JuliaUser") # working directory
 
 julia> # create script at /home/JuliaUser/Projects
        open("/home/JuliaUser/Projects/test.jl","w") do io
@@ -1894,11 +1894,11 @@
 julia> # outputs script directory and current working directory
        include("/home/JuliaUser/Projects/test.jl")
 @__DIR__ = /home/JuliaUser/Projects
-pwd() = /home/JuliaUser
source
Base.@__LINE__Macro
@__LINE__ -> Int

Expand to the line number of the location of the macrocall. Return 0 if the line number could not be determined.

source
Base.fullnameFunction
fullname(m::Module)

Get the fully-qualified name of a module as a tuple of symbols. For example,

Examples

julia> fullname(Base.Iterators)
+pwd() = /home/JuliaUser
source
Base.@__LINE__Macro
@__LINE__ -> Int

Expand to the line number of the location of the macrocall. Return 0 if the line number could not be determined.

source
Base.fullnameFunction
fullname(m::Module)

Get the fully-qualified name of a module as a tuple of symbols. For example,

Examples

julia> fullname(Base.Iterators)
 (:Base, :Iterators)
 
 julia> fullname(Main)
-(:Main,)
source
Base.namesFunction
names(x::Module; all::Bool=false, imported::Bool=false, usings::Bool=false) -> Vector{Symbol}

Get a vector of the public names of a Module, excluding deprecated names. If all is true, then the list also includes non-public names defined in the module, deprecated names, and compiler-generated names. If imported is true, then names explicitly imported from other modules are also included. If usings is true, then names explicitly imported via using are also included. Names are returned in sorted order.

As a special case, all names defined in Main are considered "public", since it is not idiomatic to explicitly mark names from Main as public.

Note

sym ∈ names(SomeModule) does not imply isdefined(SomeModule, sym). names may return symbols marked with public or export, even if they are not defined in the module.

Warning

names may return duplicate names. The duplication happens, e.g. if an imported name conflicts with an already existing identifier.

See also: Base.isexported, Base.ispublic, Base.@locals, @__MODULE__.

source
Base.isexportedFunction
isexported(m::Module, s::Symbol) -> Bool

Returns whether a symbol is exported from a module.

See also: ispublic, names

julia> module Mod
+(:Main,)
source
Base.namesFunction
names(x::Module; all::Bool=false, imported::Bool=false, usings::Bool=false) -> Vector{Symbol}

Get a vector of the public names of a Module, excluding deprecated names. If all is true, then the list also includes non-public names defined in the module, deprecated names, and compiler-generated names. If imported is true, then names explicitly imported from other modules are also included. If usings is true, then names explicitly imported via using are also included. Names are returned in sorted order.

As a special case, all names defined in Main are considered "public", since it is not idiomatic to explicitly mark names from Main as public.

Note

sym ∈ names(SomeModule) does not imply isdefined(SomeModule, sym). names may return symbols marked with public or export, even if they are not defined in the module.

Warning

names may return duplicate names. The duplication happens, e.g. if an imported name conflicts with an already existing identifier.

See also: Base.isexported, Base.ispublic, Base.@locals, @__MODULE__.

source
Base.isexportedFunction
isexported(m::Module, s::Symbol) -> Bool

Returns whether a symbol is exported from a module.

See also: ispublic, names

julia> module Mod
            export foo
            public bar
        end
@@ -1911,7 +1911,7 @@
 false
 
 julia> Base.isexported(Mod, :baz)
-false
source
Base.ispublicFunction
ispublic(m::Module, s::Symbol) -> Bool

Returns whether a symbol is marked as public in a module.

Exported symbols are considered public.

Julia 1.11

This function and the notion of publicity were added in Julia 1.11.

See also: isexported, names

julia> module Mod
+false
source
Base.ispublicFunction
ispublic(m::Module, s::Symbol) -> Bool

Returns whether a symbol is marked as public in a module.

Exported symbols are considered public.

Julia 1.11

This function and the notion of publicity were added in Julia 1.11.

See also: isexported, names

julia> module Mod
            export foo
            public bar
        end
@@ -1924,7 +1924,7 @@
 true
 
 julia> Base.ispublic(Mod, :baz)
-false
source
Base.nameofMethod
nameof(f::Function) -> Symbol

Get the name of a generic Function as a symbol. For anonymous functions, this is a compiler-generated name. For explicitly-declared subtypes of Function, it is the name of the function's type.

source
Base.functionlocMethod
functionloc(f::Function, types)

Return a tuple (filename,line) giving the location of a generic Function definition.

source
Base.functionlocMethod
functionloc(m::Method)

Return a tuple (filename,line) giving the location of a Method definition.

source
Base.@localsMacro
@locals()

Construct a dictionary of the names (as symbols) and values of all local variables defined as of the call site.

Julia 1.1

This macro requires at least Julia 1.1.

Examples

julia> let x = 1, y = 2
+false
source
Base.nameofMethod
nameof(f::Function) -> Symbol

Get the name of a generic Function as a symbol. For anonymous functions, this is a compiler-generated name. For explicitly-declared subtypes of Function, it is the name of the function's type.

source
Base.functionlocMethod
functionloc(f::Function, types)

Return a tuple (filename,line) giving the location of a generic Function definition.

source
Base.functionlocMethod
functionloc(m::Method)

Return a tuple (filename,line) giving the location of a Method definition.

source
Base.@localsMacro
@locals()

Construct a dictionary of the names (as symbols) and values of all local variables defined as of the call site.

Julia 1.1

This macro requires at least Julia 1.1.

Examples

julia> let x = 1, y = 2
            Base.@locals
        end
 Dict{Symbol, Any} with 2 entries:
@@ -1945,7 +1945,7 @@
 julia> f(42)
 Dict{Symbol, Any}(:x => 42)
 Dict{Symbol, Any}(:i => 1, :x => 42)
-Dict{Symbol, Any}(:y => 2, :x => 42)
source
Core.getglobalFunction
getglobal(module::Module, name::Symbol, [order::Symbol=:monotonic])

Retrieve the value of the binding name from the module module. Optionally, an atomic ordering can be defined for the operation, otherwise it defaults to monotonic.

While accessing module bindings using getfield is still supported to maintain compatibility, using getglobal should always be preferred since getglobal allows for control over atomic ordering (getfield is always monotonic) and better signifies the code's intent both to the user as well as the compiler.

Most users should not have to call this function directly – The getproperty function or corresponding syntax (i.e. module.name) should be preferred in all but few very specific use cases.

Julia 1.9

This function requires Julia 1.9 or later.

See also getproperty and setglobal!.

Examples

julia> a = 1
+Dict{Symbol, Any}(:y => 2, :x => 42)
source
Core.getglobalFunction
getglobal(module::Module, name::Symbol, [order::Symbol=:monotonic])

Retrieve the value of the binding name from the module module. Optionally, an atomic ordering can be defined for the operation, otherwise it defaults to monotonic.

While accessing module bindings using getfield is still supported to maintain compatibility, using getglobal should always be preferred since getglobal allows for control over atomic ordering (getfield is always monotonic) and better signifies the code's intent both to the user as well as the compiler.

Most users should not have to call this function directly – The getproperty function or corresponding syntax (i.e. module.name) should be preferred in all but few very specific use cases.

Julia 1.9

This function requires Julia 1.9 or later.

See also getproperty and setglobal!.

Examples

julia> a = 1
 1
 
 julia> module M
@@ -1956,7 +1956,7 @@
 1
 
 julia> getglobal(M, :a)
-2
source
Core.setglobal!Function
setglobal!(module::Module, name::Symbol, x, [order::Symbol=:monotonic])

Set or change the value of the binding name in the module module to x. No type conversion is performed, so if a type has already been declared for the binding, x must be of appropriate type or an error is thrown.

Additionally, an atomic ordering can be specified for this operation, otherwise it defaults to monotonic.

Users will typically access this functionality through the setproperty! function or corresponding syntax (i.e. module.name = x) instead, so this is intended only for very specific use cases.

Julia 1.9

This function requires Julia 1.9 or later.

See also setproperty! and getglobal

Examples

julia> module M; global a; end;
+2
source
Core.setglobal!Function
setglobal!(module::Module, name::Symbol, x, [order::Symbol=:monotonic])

Set or change the value of the binding name in the module module to x. No type conversion is performed, so if a type has already been declared for the binding, x must be of appropriate type or an error is thrown.

Additionally, an atomic ordering can be specified for this operation, otherwise it defaults to monotonic.

Users will typically access this functionality through the setproperty! function or corresponding syntax (i.e. module.name = x) instead, so this is intended only for very specific use cases.

Julia 1.9

This function requires Julia 1.9 or later.

See also setproperty! and getglobal

Examples

julia> module M; global a; end;
 
 julia> M.a  # same as `getglobal(M, :a)`
 ERROR: UndefVarError: `a` not defined in `M`
@@ -1971,9 +1971,9 @@
 1
 
 julia> M.a
-1
source
Core.modifyglobal!Function
modifyglobal!(module::Module, name::Symbol, op, x, [order::Symbol=:monotonic]) -> Pair

Atomically perform the operations to get and set a global after applying the function op.

Julia 1.11

This function requires Julia 1.11 or later.

See also modifyproperty! and setglobal!.

source
Core.swapglobal!Function
swapglobal!(module::Module, name::Symbol, x, [order::Symbol=:monotonic])

Atomically perform the operations to simultaneously get and set a global.

Julia 1.11

This function requires Julia 1.11 or later.

See also swapproperty! and setglobal!.

source
Core.setglobalonce!Function
setglobalonce!(module::Module, name::Symbol, value,
-              [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool

Atomically perform the operations to set a global to a given value, only if it was previously not set.

Julia 1.11

This function requires Julia 1.11 or later.

See also setpropertyonce! and setglobal!.

source
Core.replaceglobal!Function
replaceglobal!(module::Module, name::Symbol, expected, desired,
-              [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)

Atomically perform the operations to get and conditionally set a global to a given value.

Julia 1.11

This function requires Julia 1.11 or later.

See also replaceproperty! and setglobal!.

source

Documentation

(See also the documentation chapter.)

Core.@docMacro

Documentation

Functions, methods and types can be documented by placing a string before the definition:

"""
+1
source
Core.modifyglobal!Function
modifyglobal!(module::Module, name::Symbol, op, x, [order::Symbol=:monotonic]) -> Pair

Atomically perform the operations to get and set a global after applying the function op.

Julia 1.11

This function requires Julia 1.11 or later.

See also modifyproperty! and setglobal!.

source
Core.swapglobal!Function
swapglobal!(module::Module, name::Symbol, x, [order::Symbol=:monotonic])

Atomically perform the operations to simultaneously get and set a global.

Julia 1.11

This function requires Julia 1.11 or later.

See also swapproperty! and setglobal!.

source
Core.setglobalonce!Function
setglobalonce!(module::Module, name::Symbol, value,
+              [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool

Atomically perform the operations to set a global to a given value, only if it was previously not set.

Julia 1.11

This function requires Julia 1.11 or later.

See also setpropertyonce! and setglobal!.

source
Core.replaceglobal!Function
replaceglobal!(module::Module, name::Symbol, expected, desired,
+              [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)

Atomically perform the operations to get and conditionally set a global to a given value.

Julia 1.11

This function requires Julia 1.11 or later.

See also replaceproperty! and setglobal!.

source

Documentation

(See also the documentation chapter.)

Core.@docMacro

Documentation

Functions, methods and types can be documented by placing a string before the definition:

"""
     foo(x)
 
 Return a fooified version of `x`.
@@ -1982,21 +1982,21 @@
 function foo() ...

By default, documentation is written as Markdown, but any object can be used as the first argument.

Documenting objects separately from their definitions

You can document an object before or after its definition with

@doc "foo" function_to_doc
 @doc "bar" TypeToDoc

For macros, the syntax is @doc "macro doc" :(Module.@macro) or @doc "macro doc" :(string_macro"") for string macros. Without the quote :() the expansion of the macro will be documented.

Retrieving Documentation

You can retrieve docs for functions, macros and other objects as follows:

@doc foo
 @doc @time
-@doc md""

Functions & Methods

Placing documentation before a method definition (e.g. function foo() ... or foo() = ...) will cause that specific method to be documented, as opposed to the whole function. Method docs are concatenated together in the order they were defined to provide docs for the function.

source
Base.Docs.HTMLType

HTML(s): Create an object that renders s as html.

HTML("<div>foo</div>")

You can also use a stream for large amounts of data:

HTML() do io
+@doc md""

Functions & Methods

Placing documentation before a method definition (e.g. function foo() ... or foo() = ...) will cause that specific method to be documented, as opposed to the whole function. Method docs are concatenated together in the order they were defined to provide docs for the function.

source
Base.Docs.HTMLType

HTML(s): Create an object that renders s as html.

HTML("<div>foo</div>")

You can also use a stream for large amounts of data:

HTML() do io
   println(io, "<div>foo</div>")
-end
Warning

HTML is currently exported to maintain backwards compatibility, but this export is deprecated. It is recommended to use this type as Docs.HTML or to explicitly import it from Docs.

source
Base.Docs.TextType

Text(s): Create an object that renders s as plain text.

Text("foo")

You can also use a stream for large amounts of data:

Text() do io
+end
Warning

HTML is currently exported to maintain backwards compatibility, but this export is deprecated. It is recommended to use this type as Docs.HTML or to explicitly import it from Docs.

source
Base.Docs.TextType

Text(s): Create an object that renders s as plain text.

Text("foo")

You can also use a stream for large amounts of data:

Text() do io
   println(io, "foo")
-end
Warning

Text is currently exported to maintain backwards compatibility, but this export is deprecated. It is recommended to use this type as Docs.Text or to explicitly import it from Docs.

source
Base.Docs.hasdocFunction
Docs.hasdoc(mod::Module, sym::Symbol)::Bool

Return true if sym in mod has a docstring and false otherwise.

source
Base.Docs.undocumented_namesFunction
undocumented_names(mod::Module; private=false)

Return a sorted vector of undocumented symbols in module (that is, lacking docstrings). private=false (the default) returns only identifiers declared with public and/or export, whereas private=true returns all symbols in the module (excluding compiler-generated hidden symbols starting with #).

See also: names, Docs.hasdoc, Base.ispublic.

source

Code loading

Base.identify_packageFunction
Base.identify_package(name::String)::Union{PkgId, Nothing}
+end
Warning

Text is currently exported to maintain backwards compatibility, but this export is deprecated. It is recommended to use this type as Docs.Text or to explicitly import it from Docs.

source
Base.Docs.hasdocFunction
Docs.hasdoc(mod::Module, sym::Symbol)::Bool

Return true if sym in mod has a docstring and false otherwise.

source
Base.Docs.undocumented_namesFunction
undocumented_names(mod::Module; private=false)

Return a sorted vector of undocumented symbols in module (that is, lacking docstrings). private=false (the default) returns only identifiers declared with public and/or export, whereas private=true returns all symbols in the module (excluding compiler-generated hidden symbols starting with #).

See also: names, Docs.hasdoc, Base.ispublic.

source

Code loading

Base.identify_packageFunction
Base.identify_package(name::String)::Union{PkgId, Nothing}
 Base.identify_package(where::Union{Module,PkgId}, name::String)::Union{PkgId, Nothing}

Identify the package by its name from the current environment stack, returning its PkgId, or nothing if it cannot be found.

If only the name argument is provided, it searches each environment in the stack and its named direct dependencies.

The where argument provides the context from where to search for the package: in this case it first checks if the name matches the context itself, otherwise it searches all recursive dependencies (from the resolved manifest of each environment) until it locates the context where, and from there identifies the dependency with the corresponding name.

julia> Base.identify_package("Pkg") # Pkg is a dependency of the default environment
 Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f]
 
 julia> using LinearAlgebra
 
-julia> Base.identify_package(LinearAlgebra, "Pkg") # Pkg is not a dependency of LinearAlgebra
source
Base.locate_packageFunction
Base.locate_package(pkg::PkgId)::Union{String, Nothing}

The path to the entry-point file for the package corresponding to the identifier pkg, or nothing if not found. See also identify_package.

julia> pkg = Base.identify_package("Pkg")
+julia> Base.identify_package(LinearAlgebra, "Pkg") # Pkg is not a dependency of LinearAlgebra
source
Base.locate_packageFunction
Base.locate_package(pkg::PkgId)::Union{String, Nothing}

The path to the entry-point file for the package corresponding to the identifier pkg, or nothing if not found. See also identify_package.

julia> pkg = Base.identify_package("Pkg")
 Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f]
 
 julia> Base.locate_package(pkg)
-"/path/to/julia/stdlib/v1.12/Pkg/src/Pkg.jl"
source
Base.requireFunction
require(into::Module, module::Symbol)

This function is part of the implementation of using / import, if a module is not already defined in Main. It can also be called directly to force reloading a module, regardless of whether it has been loaded before (for example, when interactively developing libraries).

Loads a source file, in the context of the Main module, on every active node, searching standard locations for files. require is considered a top-level operation, so it sets the current include path but does not use it to search for files (see help for include). This function is typically used to load library code, and is implicitly called by using to load packages.

When searching for files, require first looks for package code in the global array LOAD_PATH. require is case-sensitive on all platforms, including those with case-insensitive filesystems like macOS and Windows.

For more details regarding code loading, see the manual sections on modules and parallel computing.

source
Base.compilecacheFunction
Base.compilecache(module::PkgId)

Creates a precompiled cache file for a module and all of its dependencies. This can be used to reduce package load times. Cache files are stored in DEPOT_PATH[1]/compiled. See Module initialization and precompilation for important notes.

source
Base.isprecompiledFunction
Base.isprecompiled(pkg::PkgId; ignore_loaded::Bool=false)

Returns whether a given PkgId within the active project is precompiled.

By default this check observes the same approach that code loading takes with respect to when different versions of dependencies are currently loaded to that which is expected. To ignore loaded modules and answer as if in a fresh julia session specify ignore_loaded=true.

Julia 1.10

This function requires at least Julia 1.10.

source
Base.get_extensionFunction
get_extension(parent::Module, extension::Symbol)

Return the module for extension of parent or return nothing if the extension is not loaded.

source

Internals

Base.GC.gcFunction
GC.gc([full=true])

Perform garbage collection. The argument full determines the kind of collection: a full collection (default) traverses all live objects (i.e. full mark) and should reclaim memory from all unreachable objects. An incremental collection only reclaims memory from young objects which are not reachable.

The GC may decide to perform a full collection even if an incremental collection was requested.

Warning

Excessive use will likely lead to poor performance.

source
Base.GC.enableFunction
GC.enable(on::Bool)

Control whether garbage collection is enabled using a boolean argument (true for enabled, false for disabled). Return previous GC state.

Warning

Disabling garbage collection should be used only with caution, as it can cause memory use to grow without bound.

source
Base.GC.@preserveMacro
GC.@preserve x1 x2 ... xn expr

Mark the objects x1, x2, ... as being in use during the evaluation of the expression expr. This is only required in unsafe code where expr implicitly uses memory or other resources owned by one of the xs.

Implicit use of x covers any indirect use of resources logically owned by x which the compiler cannot see. Some examples:

  • Accessing memory of an object directly via a Ptr
  • Passing a pointer to x to ccall
  • Using resources of x which would be cleaned up in the finalizer.

@preserve should generally not have any performance impact in typical use cases where it briefly extends object lifetime. In implementation, @preserve has effects such as protecting dynamically allocated objects from garbage collection.

Examples

When loading from a pointer with unsafe_load, the underlying object is implicitly used, for example x is implicitly used by unsafe_load(p) in the following:

julia> let
+"/path/to/julia/stdlib/v1.12/Pkg/src/Pkg.jl"
source
Base.requireFunction
require(into::Module, module::Symbol)

This function is part of the implementation of using / import, if a module is not already defined in Main. It can also be called directly to force reloading a module, regardless of whether it has been loaded before (for example, when interactively developing libraries).

Loads a source file, in the context of the Main module, on every active node, searching standard locations for files. require is considered a top-level operation, so it sets the current include path but does not use it to search for files (see help for include). This function is typically used to load library code, and is implicitly called by using to load packages.

When searching for files, require first looks for package code in the global array LOAD_PATH. require is case-sensitive on all platforms, including those with case-insensitive filesystems like macOS and Windows.

For more details regarding code loading, see the manual sections on modules and parallel computing.

source
Base.compilecacheFunction
Base.compilecache(module::PkgId)

Creates a precompiled cache file for a module and all of its dependencies. This can be used to reduce package load times. Cache files are stored in DEPOT_PATH[1]/compiled. See Module initialization and precompilation for important notes.

source
Base.isprecompiledFunction
Base.isprecompiled(pkg::PkgId; ignore_loaded::Bool=false)

Returns whether a given PkgId within the active project is precompiled.

By default this check observes the same approach that code loading takes with respect to when different versions of dependencies are currently loaded to that which is expected. To ignore loaded modules and answer as if in a fresh julia session specify ignore_loaded=true.

Julia 1.10

This function requires at least Julia 1.10.

source
Base.get_extensionFunction
get_extension(parent::Module, extension::Symbol)

Return the module for extension of parent or return nothing if the extension is not loaded.

source

Internals

Base.GC.gcFunction
GC.gc([full=true])

Perform garbage collection. The argument full determines the kind of collection: a full collection (default) traverses all live objects (i.e. full mark) and should reclaim memory from all unreachable objects. An incremental collection only reclaims memory from young objects which are not reachable.

The GC may decide to perform a full collection even if an incremental collection was requested.

Warning

Excessive use will likely lead to poor performance.

source
Base.GC.enableFunction
GC.enable(on::Bool)

Control whether garbage collection is enabled using a boolean argument (true for enabled, false for disabled). Return previous GC state.

Warning

Disabling garbage collection should be used only with caution, as it can cause memory use to grow without bound.

source
Base.GC.@preserveMacro
GC.@preserve x1 x2 ... xn expr

Mark the objects x1, x2, ... as being in use during the evaluation of the expression expr. This is only required in unsafe code where expr implicitly uses memory or other resources owned by one of the xs.

Implicit use of x covers any indirect use of resources logically owned by x which the compiler cannot see. Some examples:

  • Accessing memory of an object directly via a Ptr
  • Passing a pointer to x to ccall
  • Using resources of x which would be cleaned up in the finalizer.

@preserve should generally not have any performance impact in typical use cases where it briefly extends object lifetime. In implementation, @preserve has effects such as protecting dynamically allocated objects from garbage collection.

Examples

When loading from a pointer with unsafe_load, the underlying object is implicitly used, for example x is implicitly used by unsafe_load(p) in the following:

julia> let
            x = Ref{Int}(101)
            p = Base.unsafe_convert(Ptr{Int}, x)
            GC.@preserve x unsafe_load(p)
@@ -2008,7 +2008,7 @@
            # Preferred alternative
            Int(@ccall strlen(x::Cstring)::Csize_t)
        end
-5
source
Base.GC.safepointFunction
GC.safepoint()

Inserts a point in the program where garbage collection may run. This can be useful in rare cases in multi-threaded programs where some threads are allocating memory (and hence may need to run GC) but other threads are doing only simple operations (no allocation, task switches, or I/O). Calling this function periodically in non-allocating threads allows garbage collection to run.

Julia 1.4

This function is available as of Julia 1.4.

source
Base.GC.enable_loggingFunction
GC.enable_logging(on::Bool)

When turned on, print statistics about each GC to stderr.

source
Base.GC.logging_enabledFunction
GC.logging_enabled()

Return whether GC logging has been enabled via GC.enable_logging.

source
Base.Meta.lowerFunction
lower(m, x)

Takes the expression x and returns an equivalent expression in lowered form for executing in module m. See also code_lowered.

source
Base.Meta.@lowerMacro
@lower [m] x

Return lowered form of the expression x in module m. By default m is the module in which the macro is called. See also lower.

source
Base.Meta.parseMethod
parse(str, start; greedy=true, raise=true, depwarn=true, filename="none")

Parse the expression string and return an expression (which could later be passed to eval for execution). start is the code unit index into str of the first character to start parsing at (as with all string indexing, these are not character indices). If greedy is true (default), parse will try to consume as much input as it can; otherwise, it will stop as soon as it has parsed a valid expression. Incomplete but otherwise syntactically valid expressions will return Expr(:incomplete, "(error message)"). If raise is true (default), syntax errors other than incomplete expressions will raise an error. If raise is false, parse will return an expression that will raise an error upon evaluation. If depwarn is false, deprecation warnings will be suppressed. The filename argument is used to display diagnostics when an error is raised.

julia> Meta.parse("(α, β) = 3, 5", 1) # start of string
+5
source
Base.GC.safepointFunction
GC.safepoint()

Inserts a point in the program where garbage collection may run. This can be useful in rare cases in multi-threaded programs where some threads are allocating memory (and hence may need to run GC) but other threads are doing only simple operations (no allocation, task switches, or I/O). Calling this function periodically in non-allocating threads allows garbage collection to run.

Julia 1.4

This function is available as of Julia 1.4.

source
Base.GC.enable_loggingFunction
GC.enable_logging(on::Bool)

When turned on, print statistics about each GC to stderr.

source
Base.GC.logging_enabledFunction
GC.logging_enabled()

Return whether GC logging has been enabled via GC.enable_logging.

source
Base.Meta.lowerFunction
lower(m, x)

Takes the expression x and returns an equivalent expression in lowered form for executing in module m. See also code_lowered.

source
Base.Meta.@lowerMacro
@lower [m] x

Return lowered form of the expression x in module m. By default m is the module in which the macro is called. See also lower.

source
Base.Meta.parseMethod
parse(str, start; greedy=true, raise=true, depwarn=true, filename="none")

Parse the expression string and return an expression (which could later be passed to eval for execution). start is the code unit index into str of the first character to start parsing at (as with all string indexing, these are not character indices). If greedy is true (default), parse will try to consume as much input as it can; otherwise, it will stop as soon as it has parsed a valid expression. Incomplete but otherwise syntactically valid expressions will return Expr(:incomplete, "(error message)"). If raise is true (default), syntax errors other than incomplete expressions will raise an error. If raise is false, parse will return an expression that will raise an error upon evaluation. If depwarn is false, deprecation warnings will be suppressed. The filename argument is used to display diagnostics when an error is raised.

julia> Meta.parse("(α, β) = 3, 5", 1) # start of string
 (:((α, β) = (3, 5)), 16)
 
 julia> Meta.parse("(α, β) = 3, 5", 1, greedy=false)
@@ -2021,7 +2021,7 @@
 (:((3, 5)), 16)
 
 julia> Meta.parse("(α, β) = 3, 5", 11, greedy=false)
-(3, 13)
source
Base.Meta.parseMethod
parse(str; raise=true, depwarn=true, filename="none")

Parse the expression string greedily, returning a single expression. An error is thrown if there are additional characters after the first expression. If raise is true (default), syntax errors will raise an error; otherwise, parse will return an expression that will raise an error upon evaluation. If depwarn is false, deprecation warnings will be suppressed. The filename argument is used to display diagnostics when an error is raised.

julia> Meta.parse("x = 3")
+(3, 13)
source
Base.Meta.parseMethod
parse(str; raise=true, depwarn=true, filename="none")

Parse the expression string greedily, returning a single expression. An error is thrown if there are additional characters after the first expression. If raise is true (default), syntax errors will raise an error; otherwise, parse will return an expression that will raise an error upon evaluation. If depwarn is false, deprecation warnings will be suppressed. The filename argument is used to display diagnostics when an error is raised.

julia> Meta.parse("x = 3")
 :(x = 3)
 
 julia> Meta.parse("1.0.2")
@@ -2035,7 +2035,7 @@
 :($(Expr(:error, "invalid numeric constant "1.0."")))
 
 julia> Meta.parse("x = ")
-:($(Expr(:incomplete, "incomplete: premature end of input")))
source
Base.Meta.ParseErrorType
ParseError(msg)

The expression passed to the parse function could not be interpreted as a valid Julia expression.

source
Core.QuoteNodeType
QuoteNode

A quoted piece of code, that does not support interpolation. See the manual section about QuoteNodes for details.

source
Base.macroexpandFunction
macroexpand(m::Module, x; recursive=true)

Take the expression x and return an equivalent expression with all macros removed (expanded) for executing in module m. The recursive keyword controls whether deeper levels of nested macros are also expanded. This is demonstrated in the example below:

julia> module M
+:($(Expr(:incomplete, "incomplete: premature end of input")))
source
Base.Meta.ParseErrorType
ParseError(msg)

The expression passed to the parse function could not be interpreted as a valid Julia expression.

source
Core.QuoteNodeType
QuoteNode

A quoted piece of code, that does not support interpolation. See the manual section about QuoteNodes for details.

source
Base.macroexpandFunction
macroexpand(m::Module, x; recursive=true)

Take the expression x and return an equivalent expression with all macros removed (expanded) for executing in module m. The recursive keyword controls whether deeper levels of nested macros are also expanded. This is demonstrated in the example below:

julia> module M
            macro m1()
                42
            end
@@ -2049,7 +2049,7 @@
 42
 
 julia> macroexpand(M, :(@m2()), recursive=false)
-:(#= REPL[16]:6 =# M.@m1)
source
Base.@macroexpandMacro
@macroexpand [mod,] ex

Return equivalent expression with all macros removed (expanded). If two arguments are provided, the first is the module to evaluate in.

There are differences between @macroexpand and macroexpand.

  • While macroexpand takes a keyword argument recursive, @macroexpand is always recursive. For a non recursive macro version, see @macroexpand1.

  • While macroexpand has an explicit module argument, @macroexpand always expands with respect to the module in which it is called.

This is best seen in the following example:

julia> module M
+:(#= REPL[16]:6 =# M.@m1)
source
Base.@macroexpandMacro
@macroexpand [mod,] ex

Return equivalent expression with all macros removed (expanded). If two arguments are provided, the first is the module to evaluate in.

There are differences between @macroexpand and macroexpand.

  • While macroexpand takes a keyword argument recursive, @macroexpand is always recursive. For a non recursive macro version, see @macroexpand1.

  • While macroexpand has an explicit module argument, @macroexpand always expands with respect to the module in which it is called.

This is best seen in the following example:

julia> module M
            macro m()
                1
            end
@@ -2068,12 +2068,12 @@
 @m (macro with 1 method)
 
 julia> M.f()
-(1, 1, 2)

With @macroexpand the expression expands where @macroexpand appears in the code (module M in the example). With macroexpand the expression expands in the module given as the first argument.

Julia 1.11

The two-argument form requires at least Julia 1.11.

source
Base.@macroexpand1Macro
@macroexpand1 [mod,] ex

Non recursive version of @macroexpand.

source
Base.code_loweredFunction
code_lowered(f, types; generated=true, debuginfo=:default)

Return an array of the lowered forms (IR) for the methods matching the given generic function and type signature.

If generated is false, the returned CodeInfo instances will correspond to fallback implementations. An error is thrown if no fallback implementation exists. If generated is true, these CodeInfo instances will correspond to the method bodies yielded by expanding the generators.

The keyword debuginfo controls the amount of code metadata present in the output.

Note that an error will be thrown if types are not concrete types when generated is true and any of the corresponding methods are an @generated method.

source
Base.code_typedFunction
code_typed(f, types; kw...)

Returns an array of type-inferred lowered form (IR) for the methods matching the given generic function and type signature.

Keyword Arguments

  • optimize::Bool = true: optional, controls whether additional optimizations, such as inlining, are also applied.
  • debuginfo::Symbol = :default: optional, controls the amount of code metadata present in the output, possible options are :source or :none.

Internal Keyword Arguments

This section should be considered internal, and is only for who understands Julia compiler internals.

  • world::UInt = Base.get_world_counter(): optional, controls the world age to use when looking up methods, use current world age if not specified.
  • interp::Core.Compiler.AbstractInterpreter = Core.Compiler.NativeInterpreter(world): optional, controls the abstract interpreter to use, use the native interpreter if not specified.

Examples

One can put the argument types in a tuple to get the corresponding code_typed.

julia> code_typed(+, (Float64, Float64))
+(1, 1, 2)

With @macroexpand the expression expands where @macroexpand appears in the code (module M in the example). With macroexpand the expression expands in the module given as the first argument.

Julia 1.11

The two-argument form requires at least Julia 1.11.

source
Base.@macroexpand1Macro
@macroexpand1 [mod,] ex

Non recursive version of @macroexpand.

source
Base.code_loweredFunction
code_lowered(f, types; generated=true, debuginfo=:default)

Return an array of the lowered forms (IR) for the methods matching the given generic function and type signature.

If generated is false, the returned CodeInfo instances will correspond to fallback implementations. An error is thrown if no fallback implementation exists. If generated is true, these CodeInfo instances will correspond to the method bodies yielded by expanding the generators.

The keyword debuginfo controls the amount of code metadata present in the output.

Note that an error will be thrown if types are not concrete types when generated is true and any of the corresponding methods are an @generated method.

source
Base.code_typedFunction
code_typed(f, types; kw...)

Returns an array of type-inferred lowered form (IR) for the methods matching the given generic function and type signature.

Keyword Arguments

  • optimize::Bool = true: optional, controls whether additional optimizations, such as inlining, are also applied.
  • debuginfo::Symbol = :default: optional, controls the amount of code metadata present in the output, possible options are :source or :none.

Internal Keyword Arguments

This section should be considered internal, and is only for who understands Julia compiler internals.

  • world::UInt = Base.get_world_counter(): optional, controls the world age to use when looking up methods, use current world age if not specified.
  • interp::Core.Compiler.AbstractInterpreter = Core.Compiler.NativeInterpreter(world): optional, controls the abstract interpreter to use, use the native interpreter if not specified.

Examples

One can put the argument types in a tuple to get the corresponding code_typed.

julia> code_typed(+, (Float64, Float64))
 1-element Vector{Any}:
  CodeInfo(
 1 ─ %1 = Base.add_float(x, y)::Float64
 └──      return %1
-) => Float64
source
Base.precompileFunction
precompile(f, argtypes::Tuple{Vararg{Any}}, m::Method)

Precompile a specific method for the given argument types. This may be used to precompile a different method than the one that would ordinarily be chosen by dispatch, thus mimicking invoke.

source
precompile(f, argtypes::Tuple{Vararg{Any}})

Compile the given function f for the argument tuple (of types) argtypes, but do not execute it.

source
Base.jit_total_bytesFunction
Base.jit_total_bytes()

Return the total amount (in bytes) allocated by the just-in-time compiler for e.g. native code and data.

source

Meta

Base.Meta.quotFunction
Meta.quot(ex)::Expr

Quote expression ex to produce an expression with head quote. This can for instance be used to represent objects of type Expr in the AST. See also the manual section about QuoteNode.

Examples

julia> eval(Meta.quot(:x))
+) => Float64
source
Base.precompileFunction
precompile(f, argtypes::Tuple{Vararg{Any}}, m::Method)

Precompile a specific method for the given argument types. This may be used to precompile a different method than the one that would ordinarily be chosen by dispatch, thus mimicking invoke.

source
precompile(f, argtypes::Tuple{Vararg{Any}})

Compile the given function f for the argument tuple (of types) argtypes, but do not execute it.

source
Base.jit_total_bytesFunction
Base.jit_total_bytes()

Return the total amount (in bytes) allocated by the just-in-time compiler for e.g. native code and data.

source

Meta

Base.Meta.quotFunction
Meta.quot(ex)::Expr

Quote expression ex to produce an expression with head quote. This can for instance be used to represent objects of type Expr in the AST. See also the manual section about QuoteNode.

Examples

julia> eval(Meta.quot(:x))
 :x
 
 julia> dump(Meta.quot(:x))
@@ -2083,7 +2083,7 @@
     1: Symbol x
 
 julia> eval(Meta.quot(:(1+2)))
-:(1 + 2)
source
Base.isexprFunction
Meta.isexpr(ex, head[, n])::Bool

Return true if ex is an Expr with the given type head and optionally that the argument list is of length n. head may be a Symbol or collection of Symbols. For example, to check that a macro was passed a function call expression, you might use isexpr(ex, :call).

Examples

julia> ex = :(f(x))
+:(1 + 2)
source
Base.isexprFunction
Meta.isexpr(ex, head[, n])::Bool

Return true if ex is an Expr with the given type head and optionally that the argument list is of length n. head may be a Symbol or collection of Symbols. For example, to check that a macro was passed a function call expression, you might use isexpr(ex, :call).

Examples

julia> ex = :(f(x))
 :(f(x))
 
 julia> Meta.isexpr(ex, :block)
@@ -2099,9 +2099,9 @@
 false
 
 julia> Meta.isexpr(ex, :call, 2)
-true
source
Base.isidentifierFunction
 isidentifier(s) -> Bool

Return whether the symbol or string s contains characters that are parsed as a valid ordinary identifier (not a binary/unary operator) in Julia code; see also Base.isoperator.

Internally Julia allows any sequence of characters in a Symbol (except \0s), and macros automatically use variable names containing # in order to avoid naming collision with the surrounding code. In order for the parser to recognize a variable, it uses a limited set of characters (greatly extended by Unicode). isidentifier() makes it possible to query the parser directly whether a symbol contains valid characters.

Examples

julia> Meta.isidentifier(:x), Meta.isidentifier("1x")
-(true, false)
source
Base.isoperatorFunction
isoperator(s::Symbol)

Return true if the symbol can be used as an operator, false otherwise.

Examples

julia> Meta.isoperator(:+), Meta.isoperator(:f)
-(true, false)
source
Base.isunaryoperatorFunction
isunaryoperator(s::Symbol)

Return true if the symbol can be used as a unary (prefix) operator, false otherwise.

Examples

julia> Meta.isunaryoperator(:-), Meta.isunaryoperator(:√), Meta.isunaryoperator(:f)
-(true, true, false)
source
Base.isbinaryoperatorFunction
isbinaryoperator(s::Symbol)

Return true if the symbol can be used as a binary (infix) operator, false otherwise.

Examples

julia> Meta.isbinaryoperator(:-), Meta.isbinaryoperator(:√), Meta.isbinaryoperator(:f)
-(true, false, false)
source
Base.Meta.show_sexprFunction
Meta.show_sexpr([io::IO,], ex)

Show expression ex as a lisp style S-expression.

Examples

julia> Meta.show_sexpr(:(f(x, g(y,z))))
-(:call, :f, :x, (:call, :g, :y, :z))
source
+true
source
Base.isidentifierFunction
 isidentifier(s) -> Bool

Return whether the symbol or string s contains characters that are parsed as a valid ordinary identifier (not a binary/unary operator) in Julia code; see also Base.isoperator.

Internally Julia allows any sequence of characters in a Symbol (except \0s), and macros automatically use variable names containing # in order to avoid naming collision with the surrounding code. In order for the parser to recognize a variable, it uses a limited set of characters (greatly extended by Unicode). isidentifier() makes it possible to query the parser directly whether a symbol contains valid characters.

Examples

julia> Meta.isidentifier(:x), Meta.isidentifier("1x")
+(true, false)
source
Base.isoperatorFunction
isoperator(s::Symbol)

Return true if the symbol can be used as an operator, false otherwise.

Examples

julia> Meta.isoperator(:+), Meta.isoperator(:f)
+(true, false)
source
Base.isunaryoperatorFunction
isunaryoperator(s::Symbol)

Return true if the symbol can be used as a unary (prefix) operator, false otherwise.

Examples

julia> Meta.isunaryoperator(:-), Meta.isunaryoperator(:√), Meta.isunaryoperator(:f)
+(true, true, false)
source
Base.isbinaryoperatorFunction
isbinaryoperator(s::Symbol)

Return true if the symbol can be used as a binary (infix) operator, false otherwise.

Examples

julia> Meta.isbinaryoperator(:-), Meta.isbinaryoperator(:√), Meta.isbinaryoperator(:f)
+(true, false, false)
source
Base.Meta.show_sexprFunction
Meta.show_sexpr([io::IO,], ex)

Show expression ex as a lisp style S-expression.

Examples

julia> Meta.show_sexpr(:(f(x, g(y,z))))
+(:call, :f, :x, (:call, :g, :y, :z))
source
diff --git a/en/v1.12-dev/base/c/index.html b/en/v1.12-dev/base/c/index.html index 453f6c764d5..fc079c95655 100644 --- a/en/v1.12-dev/base/c/index.html +++ b/en/v1.12-dev/base/c/index.html @@ -9,30 +9,30 @@ # char *g_uri_escape_string(const char *unescaped, const char *reserved_chars_allowed, gboolean allow_utf8); const glib = "libglib-2.0" -@ccall glib.g_uri_escape_string(my_uri::Cstring, ":/"::Cstring, true::Cint)::Cstring

The string literal could also be used directly before the function name, if desired "libglib-2.0".g_uri_escape_string(...

source
ccallKeyword
ccall((function_name, library), returntype, (argtype1, ...), argvalue1, ...)
+@ccall glib.g_uri_escape_string(my_uri::Cstring, ":/"::Cstring, true::Cint)::Cstring

The string literal could also be used directly before the function name, if desired "libglib-2.0".g_uri_escape_string(...

source
ccallKeyword
ccall((function_name, library), returntype, (argtype1, ...), argvalue1, ...)
 ccall(function_name, returntype, (argtype1, ...), argvalue1, ...)
-ccall(function_pointer, returntype, (argtype1, ...), argvalue1, ...)

Call a function in a C-exported shared library, specified by the tuple (function_name, library), where each component is either a string or symbol. Instead of specifying a library, one can also use a function_name symbol or string, which is resolved in the current process. Alternatively, ccall may also be used to call a function pointer function_pointer, such as one returned by dlsym.

Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression.

Each argvalue to the ccall will be converted to the corresponding argtype, by automatic insertion of calls to unsafe_convert(argtype, cconvert(argtype, argvalue)). (See also the documentation for unsafe_convert and cconvert for further details.) In most cases, this simply results in a call to convert(argtype, argvalue).

source
Core.Intrinsics.cglobalFunction
cglobal((symbol, library) [, type=Cvoid])

Obtain a pointer to a global variable in a C-exported shared library, specified exactly as in ccall. Returns a Ptr{Type}, defaulting to Ptr{Cvoid} if no Type argument is supplied. The values can be read or written by unsafe_load or unsafe_store!, respectively.

source
Base.@cfunctionMacro
@cfunction(callable, ReturnType, (ArgumentTypes...,)) -> Ptr{Cvoid}
+ccall(function_pointer, returntype, (argtype1, ...), argvalue1, ...)

Call a function in a C-exported shared library, specified by the tuple (function_name, library), where each component is either a string or symbol. Instead of specifying a library, one can also use a function_name symbol or string, which is resolved in the current process. Alternatively, ccall may also be used to call a function pointer function_pointer, such as one returned by dlsym.

Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression.

Each argvalue to the ccall will be converted to the corresponding argtype, by automatic insertion of calls to unsafe_convert(argtype, cconvert(argtype, argvalue)). (See also the documentation for unsafe_convert and cconvert for further details.) In most cases, this simply results in a call to convert(argtype, argvalue).

source
Core.Intrinsics.cglobalFunction
cglobal((symbol, library) [, type=Cvoid])

Obtain a pointer to a global variable in a C-exported shared library, specified exactly as in ccall. Returns a Ptr{Type}, defaulting to Ptr{Cvoid} if no Type argument is supplied. The values can be read or written by unsafe_load or unsafe_store!, respectively.

source
Base.@cfunctionMacro
@cfunction(callable, ReturnType, (ArgumentTypes...,)) -> Ptr{Cvoid}
 @cfunction($callable, ReturnType, (ArgumentTypes...,)) -> CFunction

Generate a C-callable function pointer from the Julia function callable for the given type signature. To pass the return value to a ccall, use the argument type Ptr{Cvoid} in the signature.

Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression (although it can include a splat expression). And that these arguments will be evaluated in global scope during compile-time (not deferred until runtime). Adding a '$' in front of the function argument changes this to instead create a runtime closure over the local variable callable (this is not supported on all architectures).

See manual section on ccall and cfunction usage.

Examples

julia> function foo(x::Int, y::Int)
            return x + y
        end
 
 julia> @cfunction(foo, Int, (Int, Int))
-Ptr{Cvoid} @0x000000001b82fcd0
source
Base.CFunctionType
CFunction struct

Garbage-collection handle for the return value from @cfunction when the first argument is annotated with '$'. Like all cfunction handles, it should be passed to ccall as a Ptr{Cvoid}, and will be converted automatically at the call site to the appropriate type.

See @cfunction.

source
Base.unsafe_convertFunction
unsafe_convert(T, x)

Convert x to a C argument of type T where the input x must be the return value of cconvert(T, ...).

In cases where convert would need to take a Julia object and turn it into a Ptr, this function should be used to define and perform that conversion.

Be careful to ensure that a Julia reference to x exists as long as the result of this function will be used. Accordingly, the argument x to this function should never be an expression, only a variable name or field reference. For example, x=a.b.c is acceptable, but x=[a,b,c] is not.

The unsafe prefix on this function indicates that using the result of this function after the x argument to this function is no longer accessible to the program may cause undefined behavior, including program corruption or segfaults, at any later time.

See also cconvert

source
Base.cconvertFunction
cconvert(T,x)

Convert x to a value to be passed to C code as type T, typically by calling convert(T, x).

In cases where x cannot be safely converted to T, unlike convert, cconvert may return an object of a type different from T, which however is suitable for unsafe_convert to handle. The result of this function should be kept valid (for the GC) until the result of unsafe_convert is not needed anymore. This can be used to allocate memory that will be accessed by the ccall. If multiple objects need to be allocated, a tuple of the objects can be used as return value.

Neither convert nor cconvert should take a Julia object and turn it into a Ptr.

source
Base.unsafe_loadFunction
unsafe_load(p::Ptr{T}, i::Integer=1)
+Ptr{Cvoid} @0x000000001b82fcd0
source
Base.CFunctionType
CFunction struct

Garbage-collection handle for the return value from @cfunction when the first argument is annotated with '$'. Like all cfunction handles, it should be passed to ccall as a Ptr{Cvoid}, and will be converted automatically at the call site to the appropriate type.

See @cfunction.

source
Base.unsafe_convertFunction
unsafe_convert(T, x)

Convert x to a C argument of type T where the input x must be the return value of cconvert(T, ...).

In cases where convert would need to take a Julia object and turn it into a Ptr, this function should be used to define and perform that conversion.

Be careful to ensure that a Julia reference to x exists as long as the result of this function will be used. Accordingly, the argument x to this function should never be an expression, only a variable name or field reference. For example, x=a.b.c is acceptable, but x=[a,b,c] is not.

The unsafe prefix on this function indicates that using the result of this function after the x argument to this function is no longer accessible to the program may cause undefined behavior, including program corruption or segfaults, at any later time.

See also cconvert

source
Base.cconvertFunction
cconvert(T,x)

Convert x to a value to be passed to C code as type T, typically by calling convert(T, x).

In cases where x cannot be safely converted to T, unlike convert, cconvert may return an object of a type different from T, which however is suitable for unsafe_convert to handle. The result of this function should be kept valid (for the GC) until the result of unsafe_convert is not needed anymore. This can be used to allocate memory that will be accessed by the ccall. If multiple objects need to be allocated, a tuple of the objects can be used as return value.

Neither convert nor cconvert should take a Julia object and turn it into a Ptr.

source
Base.unsafe_loadFunction
unsafe_load(p::Ptr{T}, i::Integer=1)
 unsafe_load(p::Ptr{T}, order::Symbol)
-unsafe_load(p::Ptr{T}, i::Integer, order::Symbol)

Load a value of type T from the address of the ith element (1-indexed) starting at p. This is equivalent to the C expression p[i-1]. Optionally, an atomic memory ordering can be provided.

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program or return garbage answers. Unlike C, dereferencing memory region allocated as different type may be valid provided that the types are compatible.

Julia 1.10

The order argument is available as of Julia 1.10.

See also: atomic

source
Base.unsafe_store!Function
unsafe_store!(p::Ptr{T}, x, i::Integer=1)
+unsafe_load(p::Ptr{T}, i::Integer, order::Symbol)

Load a value of type T from the address of the ith element (1-indexed) starting at p. This is equivalent to the C expression p[i-1]. Optionally, an atomic memory ordering can be provided.

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program or return garbage answers. Unlike C, dereferencing memory region allocated as different type may be valid provided that the types are compatible.

Julia 1.10

The order argument is available as of Julia 1.10.

See also: atomic

source
Base.unsafe_store!Function
unsafe_store!(p::Ptr{T}, x, i::Integer=1)
 unsafe_store!(p::Ptr{T}, x, order::Symbol)
-unsafe_store!(p::Ptr{T}, x, i::Integer, order::Symbol)

Store a value of type T to the address of the ith element (1-indexed) starting at p. This is equivalent to the C expression p[i-1] = x. Optionally, an atomic memory ordering can be provided.

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program. Unlike C, storing memory region allocated as different type may be valid provided that the types are compatible.

Julia 1.10

The order argument is available as of Julia 1.10.

See also: atomic

source
Base.unsafe_modify!Function
unsafe_modify!(p::Ptr{T}, op, x, [order::Symbol]) -> Pair

These atomically perform the operations to get and set a memory address after applying the function op. If supported by the hardware (for example, atomic increment), this may be optimized to the appropriate hardware instruction, otherwise its execution will be similar to:

y = unsafe_load(p)
+unsafe_store!(p::Ptr{T}, x, i::Integer, order::Symbol)

Store a value of type T to the address of the ith element (1-indexed) starting at p. This is equivalent to the C expression p[i-1] = x. Optionally, an atomic memory ordering can be provided.

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program. Unlike C, storing memory region allocated as different type may be valid provided that the types are compatible.

Julia 1.10

The order argument is available as of Julia 1.10.

See also: atomic

source
Base.unsafe_modify!Function
unsafe_modify!(p::Ptr{T}, op, x, [order::Symbol]) -> Pair

These atomically perform the operations to get and set a memory address after applying the function op. If supported by the hardware (for example, atomic increment), this may be optimized to the appropriate hardware instruction, otherwise its execution will be similar to:

y = unsafe_load(p)
 z = op(y, x)
 unsafe_store!(p, z)
-return y => z

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program.

Julia 1.10

This function requires at least Julia 1.10.

See also: modifyproperty!, atomic

source
Base.unsafe_replace!Function
unsafe_replace!(p::Ptr{T}, expected, desired,
+return y => z

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program.

Julia 1.10

This function requires at least Julia 1.10.

See also: modifyproperty!, atomic

source
Base.unsafe_replace!Function
unsafe_replace!(p::Ptr{T}, expected, desired,
                [success_order::Symbol[, fail_order::Symbol=success_order]]) -> (; old, success::Bool)

These atomically perform the operations to get and conditionally set a memory address to a given value. If supported by the hardware, this may be optimized to the appropriate hardware instruction, otherwise its execution will be similar to:

y = unsafe_load(p, fail_order)
 ok = y === expected
 if ok
     unsafe_store!(p, desired, success_order)
 end
-return (; old = y, success = ok)

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program.

Julia 1.10

This function requires at least Julia 1.10.

See also: replaceproperty!, atomic

source
Base.unsafe_swap!Function
unsafe_swap!(p::Ptr{T}, x, [order::Symbol])

These atomically perform the operations to simultaneously get and set a memory address. If supported by the hardware, this may be optimized to the appropriate hardware instruction, otherwise its execution will be similar to:

y = unsafe_load(p)
+return (; old = y, success = ok)

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program.

Julia 1.10

This function requires at least Julia 1.10.

See also: replaceproperty!, atomic

source
Base.unsafe_swap!Function
unsafe_swap!(p::Ptr{T}, x, [order::Symbol])

These atomically perform the operations to simultaneously get and set a memory address. If supported by the hardware, this may be optimized to the appropriate hardware instruction, otherwise its execution will be similar to:

y = unsafe_load(p)
 unsafe_store!(p, x)
-return y

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program.

Julia 1.10

This function requires at least Julia 1.10.

See also: swapproperty!, atomic

source
Base.unsafe_copyto!Method
unsafe_copyto!(dest::Ptr{T}, src::Ptr{T}, N)

Copy N elements from a source pointer to a destination, with no checking. The size of an element is determined by the type of the pointers.

The unsafe prefix on this function indicates that no validation is performed on the pointers dest and src to ensure that they are valid. Incorrect usage may corrupt or segfault your program, in the same manner as C.

source
Base.unsafe_copyto!Method
unsafe_copyto!(dest::Array, doffs, src::Array, soffs, n)

Copy n elements from a source array to a destination, starting at the linear index soffs in the source and doffs in the destination (1-indexed).

The unsafe prefix on this function indicates that no validation is performed to ensure that n is inbounds on either array. Incorrect usage may corrupt or segfault your program, in the same manner as C.

source
Base.copyto!Function
copyto!(B::AbstractMatrix, ir_dest::AbstractUnitRange, jr_dest::AbstractUnitRange,
+return y

The unsafe prefix on this function indicates that no validation is performed on the pointer p to ensure that it is valid. Like C, the programmer is responsible for ensuring that referenced memory is not freed or garbage collected while invoking this function. Incorrect usage may segfault your program.

Julia 1.10

This function requires at least Julia 1.10.

See also: swapproperty!, atomic

source
Base.unsafe_copyto!Method
unsafe_copyto!(dest::Ptr{T}, src::Ptr{T}, N)

Copy N elements from a source pointer to a destination, with no checking. The size of an element is determined by the type of the pointers.

The unsafe prefix on this function indicates that no validation is performed on the pointers dest and src to ensure that they are valid. Incorrect usage may corrupt or segfault your program, in the same manner as C.

source
Base.unsafe_copyto!Method
unsafe_copyto!(dest::Array, doffs, src::Array, soffs, n)

Copy n elements from a source array to a destination, starting at the linear index soffs in the source and doffs in the destination (1-indexed).

The unsafe prefix on this function indicates that no validation is performed to ensure that n is inbounds on either array. Incorrect usage may corrupt or segfault your program, in the same manner as C.

source
Base.copyto!Function
copyto!(B::AbstractMatrix, ir_dest::AbstractUnitRange, jr_dest::AbstractUnitRange,
         tM::AbstractChar,
         M::AbstractVecOrMat, ir_src::AbstractUnitRange, jr_src::AbstractUnitRange) -> B

Efficiently copy elements of matrix M to B conditioned on the character parameter tM as follows:

tMDestinationSource
'N'B[ir_dest, jr_dest]M[ir_src, jr_src]
'T'B[ir_dest, jr_dest]transpose(M)[ir_src, jr_src]
'C'B[ir_dest, jr_dest]adjoint(M)[ir_src, jr_src]

The elements B[ir_dest, jr_dest] are overwritten. Furthermore, the index range parameters must satisfy length(ir_dest) == length(ir_src) and length(jr_dest) == length(jr_src).

See also copy_transpose! and copy_adjoint!.

copyto!(dest::AbstractMatrix, src::UniformScaling)

Copies a UniformScaling onto a matrix.

Julia 1.1

In Julia 1.0 this method only supported a square destination matrix. Julia 1.1. added support for a rectangular matrix.

copyto!(dest, Rdest::CartesianIndices, src, Rsrc::CartesianIndices) -> dest

Copy the block of src in the range of Rsrc to the block of dest in the range of Rdest. The sizes of the two regions must match.

Examples

julia> A = zeros(5, 5);
 
@@ -48,7 +48,7 @@
  0.0  1.0  2.0  0.0  0.0
  0.0  3.0  4.0  0.0  0.0
  0.0  0.0  0.0  0.0  0.0
- 0.0  0.0  0.0  0.0  0.0
source
copyto!(dest::AbstractArray, src) -> dest

Copy all elements from collection src to array dest, whose length must be greater than or equal to the length n of src. The first n elements of dest are overwritten, the other elements are left untouched.

See also copy!, copy.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> x = [1., 0., 3., 0., 5.];
+ 0.0  0.0  0.0  0.0  0.0
source
copyto!(dest::AbstractArray, src) -> dest

Copy all elements from collection src to array dest, whose length must be greater than or equal to the length n of src. The first n elements of dest are overwritten, the other elements are left untouched.

See also copy!, copy.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> x = [1., 0., 3., 0., 5.];
 
 julia> y = zeros(7);
 
@@ -62,12 +62,12 @@
  0.0
  5.0
  0.0
- 0.0
source
copyto!(dest, doffs, src, soffs, n)

Copy n elements from collection src starting at the linear index soffs, to array dest starting at the index doffs. Return dest.

source
Base.pointerFunction
pointer(array [, index])

Get the native address of an array or string, optionally at a given location index.

This function is "unsafe". Be careful to ensure that a Julia reference to array exists as long as this pointer will be used. The GC.@preserve macro should be used to protect the array argument from garbage collection within a given block of code.

Calling Ref(array[, index]) is generally preferable to this function as it guarantees validity.

source
Base.unsafe_wrapMethod
unsafe_wrap(Array, pointer::Ptr{T}, dims; own = false)

Wrap a Julia Array object around the data at the address given by pointer, without making a copy. The pointer element type T determines the array element type. dims is either an integer (for a 1d array) or a tuple of the array dimensions. own optionally specifies whether Julia should take ownership of the memory, calling free on the pointer when the array is no longer referenced.

This function is labeled "unsafe" because it will crash if pointer is not a valid memory address to data of the requested length. Unlike unsafe_load and unsafe_store!, the programmer is responsible also for ensuring that the underlying data is not accessed through two arrays of different element type, similar to the strict aliasing rule in C.

source
Base.pointer_from_objrefFunction
pointer_from_objref(x)

Get the memory address of a Julia object as a Ptr. The existence of the resulting Ptr will not protect the object from garbage collection, so you must ensure that the object remains referenced for the whole time that the Ptr will be used.

This function may not be called on immutable objects, since they do not have stable memory addresses.

See also unsafe_pointer_to_objref.

source
Base.unsafe_pointer_to_objrefFunction
unsafe_pointer_to_objref(p::Ptr)

Convert a Ptr to an object reference. Assumes the pointer refers to a valid heap-allocated Julia object. If this is not the case, undefined behavior results, hence this function is considered "unsafe" and should be used with care.

See also pointer_from_objref.

source
Base.disable_sigintFunction
disable_sigint(f::Function)

Disable Ctrl-C handler during execution of a function on the current task, for calling external code that may call julia code that is not interrupt safe. Intended to be called using do block syntax as follows:

disable_sigint() do
+ 0.0
source
copyto!(dest, doffs, src, soffs, n)

Copy n elements from collection src starting at the linear index soffs, to array dest starting at the index doffs. Return dest.

source
Base.pointerFunction
pointer(array [, index])

Get the native address of an array or string, optionally at a given location index.

This function is "unsafe". Be careful to ensure that a Julia reference to array exists as long as this pointer will be used. The GC.@preserve macro should be used to protect the array argument from garbage collection within a given block of code.

Calling Ref(array[, index]) is generally preferable to this function as it guarantees validity.

source
Base.unsafe_wrapMethod
unsafe_wrap(Array, pointer::Ptr{T}, dims; own = false)

Wrap a Julia Array object around the data at the address given by pointer, without making a copy. The pointer element type T determines the array element type. dims is either an integer (for a 1d array) or a tuple of the array dimensions. own optionally specifies whether Julia should take ownership of the memory, calling free on the pointer when the array is no longer referenced.

This function is labeled "unsafe" because it will crash if pointer is not a valid memory address to data of the requested length. Unlike unsafe_load and unsafe_store!, the programmer is responsible also for ensuring that the underlying data is not accessed through two arrays of different element type, similar to the strict aliasing rule in C.

source
Base.pointer_from_objrefFunction
pointer_from_objref(x)

Get the memory address of a Julia object as a Ptr. The existence of the resulting Ptr will not protect the object from garbage collection, so you must ensure that the object remains referenced for the whole time that the Ptr will be used.

This function may not be called on immutable objects, since they do not have stable memory addresses.

See also unsafe_pointer_to_objref.

source
Base.unsafe_pointer_to_objrefFunction
unsafe_pointer_to_objref(p::Ptr)

Convert a Ptr to an object reference. Assumes the pointer refers to a valid heap-allocated Julia object. If this is not the case, undefined behavior results, hence this function is considered "unsafe" and should be used with care.

See also pointer_from_objref.

source
Base.disable_sigintFunction
disable_sigint(f::Function)

Disable Ctrl-C handler during execution of a function on the current task, for calling external code that may call julia code that is not interrupt safe. Intended to be called using do block syntax as follows:

disable_sigint() do
     # interrupt-unsafe code
     ...
-end

This is not needed on worker threads (Threads.threadid() != 1) since the InterruptException will only be delivered to the master thread. External functions that do not call julia code or julia runtime automatically disable sigint during their execution.

source
Base.reenable_sigintFunction
reenable_sigint(f::Function)

Re-enable Ctrl-C handler during execution of a function. Temporarily reverses the effect of disable_sigint.

source
Base.exit_on_sigintFunction
exit_on_sigint(on::Bool)

Set exit_on_sigint flag of the julia runtime. If false, Ctrl-C (SIGINT) is capturable as InterruptException in try block. This is the default behavior in REPL, any code run via -e and -E and in Julia script run with -i option.

If true, InterruptException is not thrown by Ctrl-C. Running code upon such event requires atexit. This is the default behavior in Julia script run without -i option.

Julia 1.5

Function exit_on_sigint requires at least Julia 1.5.

source
Base.systemerrorFunction
systemerror(sysfunc[, errno::Cint=Libc.errno()])
-systemerror(sysfunc, iftrue::Bool)

Raises a SystemError for errno with the descriptive string sysfunc if iftrue is true

source
Base.windowserrorFunction
windowserror(sysfunc[, code::UInt32=Libc.GetLastError()])
-windowserror(sysfunc, iftrue::Bool)

Like systemerror, but for Windows API functions that use GetLastError to return an error code instead of setting errno.

source
Core.PtrType
Ptr{T}

A memory address referring to data of type T. However, there is no guarantee that the memory is actually valid, or that it actually represents data of the specified type.

source
Core.RefType
Ref{T}

An object that safely references data of type T. This type is guaranteed to point to valid, Julia-allocated memory of the correct type. The underlying data is protected from freeing by the garbage collector as long as the Ref itself is referenced.

In Julia, Ref objects are dereferenced (loaded or stored) with [].

Creation of a Ref to a value x of type T is usually written Ref(x). Additionally, for creating interior pointers to containers (such as Array or Ptr), it can be written Ref(a, i) for creating a reference to the i-th element of a.

Ref{T}() creates a reference to a value of type T without initialization. For a bitstype T, the value will be whatever currently resides in the memory allocated. For a non-bitstype T, the reference will be undefined and attempting to dereference it will result in an error, "UndefRefError: access to undefined reference".

To check if a Ref is an undefined reference, use isassigned(ref::RefValue). For example, isassigned(Ref{T}()) is false if T is not a bitstype. If T is a bitstype, isassigned(Ref{T}()) will always be true.

When passed as a ccall argument (either as a Ptr or Ref type), a Ref object will be converted to a native pointer to the data it references. For most T, or when converted to a Ptr{Cvoid}, this is a pointer to the object data. When T is an isbits type, this value may be safely mutated, otherwise mutation is strictly undefined behavior.

As a special case, setting T = Any will instead cause the creation of a pointer to the reference itself when converted to a Ptr{Any} (a jl_value_t const* const* if T is immutable, else a jl_value_t *const *). When converted to a Ptr{Cvoid}, it will still return a pointer to the data region as for any other T.

A C_NULL instance of Ptr can be passed to a ccall Ref argument to initialize it.

Use in broadcasting

Ref is sometimes used in broadcasting in order to treat the referenced values as a scalar.

Examples

julia> r = Ref(5) # Create a Ref with an initial value
+end

This is not needed on worker threads (Threads.threadid() != 1) since the InterruptException will only be delivered to the master thread. External functions that do not call julia code or julia runtime automatically disable sigint during their execution.

source
Base.reenable_sigintFunction
reenable_sigint(f::Function)

Re-enable Ctrl-C handler during execution of a function. Temporarily reverses the effect of disable_sigint.

source
Base.exit_on_sigintFunction
exit_on_sigint(on::Bool)

Set exit_on_sigint flag of the julia runtime. If false, Ctrl-C (SIGINT) is capturable as InterruptException in try block. This is the default behavior in REPL, any code run via -e and -E and in Julia script run with -i option.

If true, InterruptException is not thrown by Ctrl-C. Running code upon such event requires atexit. This is the default behavior in Julia script run without -i option.

Julia 1.5

Function exit_on_sigint requires at least Julia 1.5.

source
Base.systemerrorFunction
systemerror(sysfunc[, errno::Cint=Libc.errno()])
+systemerror(sysfunc, iftrue::Bool)

Raises a SystemError for errno with the descriptive string sysfunc if iftrue is true

source
Base.windowserrorFunction
windowserror(sysfunc[, code::UInt32=Libc.GetLastError()])
+windowserror(sysfunc, iftrue::Bool)

Like systemerror, but for Windows API functions that use GetLastError to return an error code instead of setting errno.

source
Core.PtrType
Ptr{T}

A memory address referring to data of type T. However, there is no guarantee that the memory is actually valid, or that it actually represents data of the specified type.

source
Core.RefType
Ref{T}

An object that safely references data of type T. This type is guaranteed to point to valid, Julia-allocated memory of the correct type. The underlying data is protected from freeing by the garbage collector as long as the Ref itself is referenced.

In Julia, Ref objects are dereferenced (loaded or stored) with [].

Creation of a Ref to a value x of type T is usually written Ref(x). Additionally, for creating interior pointers to containers (such as Array or Ptr), it can be written Ref(a, i) for creating a reference to the i-th element of a.

Ref{T}() creates a reference to a value of type T without initialization. For a bitstype T, the value will be whatever currently resides in the memory allocated. For a non-bitstype T, the reference will be undefined and attempting to dereference it will result in an error, "UndefRefError: access to undefined reference".

To check if a Ref is an undefined reference, use isassigned(ref::RefValue). For example, isassigned(Ref{T}()) is false if T is not a bitstype. If T is a bitstype, isassigned(Ref{T}()) will always be true.

When passed as a ccall argument (either as a Ptr or Ref type), a Ref object will be converted to a native pointer to the data it references. For most T, or when converted to a Ptr{Cvoid}, this is a pointer to the object data. When T is an isbits type, this value may be safely mutated, otherwise mutation is strictly undefined behavior.

As a special case, setting T = Any will instead cause the creation of a pointer to the reference itself when converted to a Ptr{Any} (a jl_value_t const* const* if T is immutable, else a jl_value_t *const *). When converted to a Ptr{Cvoid}, it will still return a pointer to the data region as for any other T.

A C_NULL instance of Ptr can be passed to a ccall Ref argument to initialize it.

Use in broadcasting

Ref is sometimes used in broadcasting in order to treat the referenced values as a scalar.

Examples

julia> r = Ref(5) # Create a Ref with an initial value
 Base.RefValue{Int64}(5)
 
 julia> r[] # Getting a value from a Ref
@@ -98,7 +98,7 @@
 julia> Ref{Int64}()[]; # A reference to a bitstype refers to an undetermined value if not given
 
 julia> isassigned(Ref{Int64}()) # A reference to a bitstype is always assigned
-true
source
Base.isassignedMethod
isassigned(ref::RefValue) -> Bool

Test whether the given Ref is associated with a value. This is always true for a Ref of a bitstype object. Return false if the reference is undefined.

Examples

julia> ref = Ref{Function}()
+true
source
Base.isassignedMethod
isassigned(ref::RefValue) -> Bool

Test whether the given Ref is associated with a value. This is always true for a Ref of a bitstype object. Return false if the reference is undefined.

Examples

julia> ref = Ref{Function}()
 Base.RefValue{Function}(#undef)
 
 julia> isassigned(ref)
@@ -111,6 +111,6 @@
 true
 
 julia> isassigned(Ref{Int}())
-true
source
Base.CcharType
Cchar

Equivalent to the native char c-type.

source
Base.CucharType
Cuchar

Equivalent to the native unsigned char c-type (UInt8).

source
Base.CshortType
Cshort

Equivalent to the native signed short c-type (Int16).

source
Base.CstringType
Cstring

A C-style string composed of the native character type Cchars. Cstrings are NUL-terminated. For C-style strings composed of the native wide character type, see Cwstring. For more information about string interoperability with C, see the manual.

source
Base.CushortType
Cushort

Equivalent to the native unsigned short c-type (UInt16).

source
Base.CintType
Cint

Equivalent to the native signed int c-type (Int32).

source
Base.CuintType
Cuint

Equivalent to the native unsigned int c-type (UInt32).

source
Base.ClongType
Clong

Equivalent to the native signed long c-type.

source
Base.CulongType
Culong

Equivalent to the native unsigned long c-type.

source
Base.ClonglongType
Clonglong

Equivalent to the native signed long long c-type (Int64).

source
Base.CulonglongType
Culonglong

Equivalent to the native unsigned long long c-type (UInt64).

source
Base.Cintmax_tType
Cintmax_t

Equivalent to the native intmax_t c-type (Int64).

source
Base.Cuintmax_tType
Cuintmax_t

Equivalent to the native uintmax_t c-type (UInt64).

source
Base.Csize_tType
Csize_t

Equivalent to the native size_t c-type (UInt).

source
Base.Cssize_tType
Cssize_t

Equivalent to the native ssize_t c-type.

source
Base.Cptrdiff_tType
Cptrdiff_t

Equivalent to the native ptrdiff_t c-type (Int).

source
Base.Cwchar_tType
Cwchar_t

Equivalent to the native wchar_t c-type (Int32).

source
Base.CwstringType
Cwstring

A C-style string composed of the native wide character type Cwchar_ts. Cwstrings are NUL-terminated. For C-style strings composed of the native character type, see Cstring. For more information about string interoperability with C, see the manual.

source
Base.CfloatType
Cfloat

Equivalent to the native float c-type (Float32).

source
Base.CdoubleType
Cdouble

Equivalent to the native double c-type (Float64).

source

LLVM Interface

Core.Intrinsics.llvmcallFunction
llvmcall(fun_ir::String, returntype, Tuple{argtype1, ...}, argvalue1, ...)
+true
source
Base.CcharType
Cchar

Equivalent to the native char c-type.

source
Base.CucharType
Cuchar

Equivalent to the native unsigned char c-type (UInt8).

source
Base.CshortType
Cshort

Equivalent to the native signed short c-type (Int16).

source
Base.CstringType
Cstring

A C-style string composed of the native character type Cchars. Cstrings are NUL-terminated. For C-style strings composed of the native wide character type, see Cwstring. For more information about string interoperability with C, see the manual.

source
Base.CushortType
Cushort

Equivalent to the native unsigned short c-type (UInt16).

source
Base.CintType
Cint

Equivalent to the native signed int c-type (Int32).

source
Base.CuintType
Cuint

Equivalent to the native unsigned int c-type (UInt32).

source
Base.ClongType
Clong

Equivalent to the native signed long c-type.

source
Base.CulongType
Culong

Equivalent to the native unsigned long c-type.

source
Base.ClonglongType
Clonglong

Equivalent to the native signed long long c-type (Int64).

source
Base.CulonglongType
Culonglong

Equivalent to the native unsigned long long c-type (UInt64).

source
Base.Cintmax_tType
Cintmax_t

Equivalent to the native intmax_t c-type (Int64).

source
Base.Cuintmax_tType
Cuintmax_t

Equivalent to the native uintmax_t c-type (UInt64).

source
Base.Csize_tType
Csize_t

Equivalent to the native size_t c-type (UInt).

source
Base.Cssize_tType
Cssize_t

Equivalent to the native ssize_t c-type.

source
Base.Cptrdiff_tType
Cptrdiff_t

Equivalent to the native ptrdiff_t c-type (Int).

source
Base.Cwchar_tType
Cwchar_t

Equivalent to the native wchar_t c-type (Int32).

source
Base.CwstringType
Cwstring

A C-style string composed of the native wide character type Cwchar_ts. Cwstrings are NUL-terminated. For C-style strings composed of the native character type, see Cstring. For more information about string interoperability with C, see the manual.

source
Base.CfloatType
Cfloat

Equivalent to the native float c-type (Float32).

source
Base.CdoubleType
Cdouble

Equivalent to the native double c-type (Float64).

source

LLVM Interface

Core.Intrinsics.llvmcallFunction
llvmcall(fun_ir::String, returntype, Tuple{argtype1, ...}, argvalue1, ...)
 llvmcall((mod_ir::String, entry_fn::String), returntype, Tuple{argtype1, ...}, argvalue1, ...)
-llvmcall((mod_bc::Vector{UInt8}, entry_fn::String), returntype, Tuple{argtype1, ...}, argvalue1, ...)

Call the LLVM code provided in the first argument. There are several ways to specify this first argument:

  • as a literal string, representing function-level IR (similar to an LLVM define block), with arguments are available as consecutive unnamed SSA variables (%0, %1, etc.);
  • as a 2-element tuple, containing a string of module IR and a string representing the name of the entry-point function to call;
  • as a 2-element tuple, but with the module provided as an Vector{UInt8} with bitcode.

Note that contrary to ccall, the argument types must be specified as a tuple type, and not a tuple of types. All types, as well as the LLVM code, should be specified as literals, and not as variables or expressions (it may be necessary to use @eval to generate these literals).

Opaque pointers (written as ptr) are not allowed in the LLVM code.

See test/llvmcall.jl for usage examples.

source
+llvmcall((mod_bc::Vector{UInt8}, entry_fn::String), returntype, Tuple{argtype1, ...}, argvalue1, ...)

Call the LLVM code provided in the first argument. There are several ways to specify this first argument:

Note that contrary to ccall, the argument types must be specified as a tuple type, and not a tuple of types. All types, as well as the LLVM code, should be specified as literals, and not as variables or expressions (it may be necessary to use @eval to generate these literals).

Opaque pointers (written as ptr) are not allowed in the LLVM code.

See test/llvmcall.jl for usage examples.

source diff --git a/en/v1.12-dev/base/collections/index.html b/en/v1.12-dev/base/collections/index.html index 4ea535a82d0..15647f30948 100644 --- a/en/v1.12-dev/base/collections/index.html +++ b/en/v1.12-dev/base/collections/index.html @@ -10,12 +10,12 @@ (i, state) = next # body next = iterate(iter, state) -end

The state object may be anything, and should be chosen appropriately for each iterable type. See the manual section on the iteration interface for more details about defining a custom iterable type.

Base.iterateFunction
iterate(iter [, state]) -> Union{Nothing, Tuple{Any, Any}}

Advance the iterator to obtain the next element. If no elements remain, nothing should be returned. Otherwise, a 2-tuple of the next element and the new iteration state should be returned.

source
Base.IteratorSizeType
IteratorSize(itertype::Type) -> IteratorSize

Given the type of an iterator, return one of the following values:

  • SizeUnknown() if the length (number of elements) cannot be determined in advance.
  • HasLength() if there is a fixed, finite length.
  • HasShape{N}() if there is a known length plus a notion of multidimensional shape (as for an array). In this case N should give the number of dimensions, and the axes function is valid for the iterator.
  • IsInfinite() if the iterator yields values forever.

The default value (for iterators that do not define this function) is HasLength(). This means that most iterators are assumed to implement length.

This trait is generally used to select between algorithms that pre-allocate space for their result, and algorithms that resize their result incrementally.

julia> Base.IteratorSize(1:5)
+end

The state object may be anything, and should be chosen appropriately for each iterable type. See the manual section on the iteration interface for more details about defining a custom iterable type.

Base.iterateFunction
iterate(iter [, state]) -> Union{Nothing, Tuple{Any, Any}}

Advance the iterator to obtain the next element. If no elements remain, nothing should be returned. Otherwise, a 2-tuple of the next element and the new iteration state should be returned.

source
Base.IteratorSizeType
IteratorSize(itertype::Type) -> IteratorSize

Given the type of an iterator, return one of the following values:

  • SizeUnknown() if the length (number of elements) cannot be determined in advance.
  • HasLength() if there is a fixed, finite length.
  • HasShape{N}() if there is a known length plus a notion of multidimensional shape (as for an array). In this case N should give the number of dimensions, and the axes function is valid for the iterator.
  • IsInfinite() if the iterator yields values forever.

The default value (for iterators that do not define this function) is HasLength(). This means that most iterators are assumed to implement length.

This trait is generally used to select between algorithms that pre-allocate space for their result, and algorithms that resize their result incrementally.

julia> Base.IteratorSize(1:5)
 Base.HasShape{1}()
 
 julia> Base.IteratorSize((2,3))
-Base.HasLength()
source
Base.IteratorEltypeType
IteratorEltype(itertype::Type) -> IteratorEltype

Given the type of an iterator, return one of the following values:

  • EltypeUnknown() if the type of elements yielded by the iterator is not known in advance.
  • HasEltype() if the element type is known, and eltype would return a meaningful value.

HasEltype() is the default, since iterators are assumed to implement eltype.

This trait is generally used to select between algorithms that pre-allocate a specific type of result, and algorithms that pick a result type based on the types of yielded values.

julia> Base.IteratorEltype(1:5)
-Base.HasEltype()
source

Fully implemented by:

Constructors and Types

Base.OrdinalRangeType
OrdinalRange{T, S} <: AbstractRange{T}

Supertype for ordinal ranges with elements of type T with spacing(s) of type S. The steps should be always-exact multiples of oneunit, and T should be a "discrete" type, which cannot have values smaller than oneunit. For example, Integer or Date types would qualify, whereas Float64 would not (since this type can represent values smaller than oneunit(Float64). UnitRange, StepRange, and other types are subtypes of this.

source
Base.StepRangeType
StepRange{T, S} <: OrdinalRange{T, S}

Ranges with elements of type T with spacing of type S. The step between each element is constant, and the range is defined in terms of a start and stop of type T and a step of type S. Neither T nor S should be floating point types. The syntax a:b:c with b != 0 and a, b, and c all integers creates a StepRange.

Examples

julia> collect(StepRange(1, Int8(2), 10))
+Base.HasLength()
source
Base.IteratorEltypeType
IteratorEltype(itertype::Type) -> IteratorEltype

Given the type of an iterator, return one of the following values:

  • EltypeUnknown() if the type of elements yielded by the iterator is not known in advance.
  • HasEltype() if the element type is known, and eltype would return a meaningful value.

HasEltype() is the default, since iterators are assumed to implement eltype.

This trait is generally used to select between algorithms that pre-allocate a specific type of result, and algorithms that pick a result type based on the types of yielded values.

julia> Base.IteratorEltype(1:5)
+Base.HasEltype()
source

Fully implemented by:

Constructors and Types

Base.OrdinalRangeType
OrdinalRange{T, S} <: AbstractRange{T}

Supertype for ordinal ranges with elements of type T with spacing(s) of type S. The steps should be always-exact multiples of oneunit, and T should be a "discrete" type, which cannot have values smaller than oneunit. For example, Integer or Date types would qualify, whereas Float64 would not (since this type can represent values smaller than oneunit(Float64). UnitRange, StepRange, and other types are subtypes of this.

source
Base.StepRangeType
StepRange{T, S} <: OrdinalRange{T, S}

Ranges with elements of type T with spacing of type S. The step between each element is constant, and the range is defined in terms of a start and stop of type T and a step of type S. Neither T nor S should be floating point types. The syntax a:b:c with b != 0 and a, b, and c all integers creates a StepRange.

Examples

julia> collect(StepRange(1, Int8(2), 10))
 5-element Vector{Int64}:
  1
  3
@@ -27,14 +27,14 @@
 StepRange{Int64, Int8}
 
 julia> typeof(1:3:6)
-StepRange{Int64, Int64}
source
Base.UnitRangeType
UnitRange{T<:Real}

A range parameterized by a start and stop of type T, filled with elements spaced by 1 from start until stop is exceeded. The syntax a:b with a and b both Integers creates a UnitRange.

Examples

julia> collect(UnitRange(2.3, 5.2))
+StepRange{Int64, Int64}
source
Base.UnitRangeType
UnitRange{T<:Real}

A range parameterized by a start and stop of type T, filled with elements spaced by 1 from start until stop is exceeded. The syntax a:b with a and b both Integers creates a UnitRange.

Examples

julia> collect(UnitRange(2.3, 5.2))
 3-element Vector{Float64}:
  2.3
  3.3
  4.3
 
 julia> typeof(1:10)
-UnitRange{Int64}
source
Base.LinRangeType
LinRange{T,L}

A range with len linearly spaced elements between its start and stop. The size of the spacing is controlled by len, which must be an Integer.

Examples

julia> LinRange(1.5, 5.5, 9)
+UnitRange{Int64}
source
Base.LinRangeType
LinRange{T,L}

A range with len linearly spaced elements between its start and stop. The size of the spacing is controlled by len, which must be an Integer.

Examples

julia> LinRange(1.5, 5.5, 9)
 9-element LinRange{Float64, Int64}:
  1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5

Compared to using range, directly constructing a LinRange should have less overhead but won't try to correct for floating point errors:

julia> collect(range(-0.1, 0.3, length=5))
 5-element Vector{Float64}:
@@ -50,11 +50,11 @@
  -1.3877787807814457e-17
   0.09999999999999999
   0.19999999999999998
-  0.3

See also Logrange for logarithmically spaced points.

source

General Collections

Base.isemptyFunction
isempty(condition)

Return true if no tasks are waiting on the condition, false otherwise.

source
isempty(collection) -> Bool

Determine whether a collection is empty (has no elements).

Warning

isempty(itr) may consume the next element of a stateful iterator itr unless an appropriate Base.isdone(itr) method is defined. Stateful iterators should implement isdone, but you may want to avoid using isempty when writing generic code which should support any iterator type.

Examples

julia> isempty([])
+  0.3

See also Logrange for logarithmically spaced points.

source

General Collections

Base.isemptyFunction
isempty(condition)

Return true if no tasks are waiting on the condition, false otherwise.

source
isempty(collection) -> Bool

Determine whether a collection is empty (has no elements).

Warning

isempty(itr) may consume the next element of a stateful iterator itr unless an appropriate Base.isdone(itr) method is defined. Stateful iterators should implement isdone, but you may want to avoid using isempty when writing generic code which should support any iterator type.

Examples

julia> isempty([])
 true
 
 julia> isempty([1 2 3])
-false
source
Base.isdoneFunction
isdone(itr, [state]) -> Union{Bool, Missing}

This function provides a fast-path hint for iterator completion. This is useful for stateful iterators that want to avoid having elements consumed if they are not going to be exposed to the user (e.g. when checking for done-ness in isempty or zip).

Stateful iterators that want to opt into this feature should define an isdone method that returns true/false depending on whether the iterator is done or not. Stateless iterators need not implement this function.

If the result is missing, callers may go ahead and compute iterate(x, state) === nothing to compute a definite answer.

See also iterate, isempty

source
Base.empty!Function
empty!(c::Channel)

Empty a Channel c by calling empty! on the internal buffer. Return the empty channel.

source
empty!(collection) -> collection

Remove all elements from a collection.

Examples

julia> A = Dict("a" => 1, "b" => 2)
+false
source
Base.isdoneFunction
isdone(itr, [state]) -> Union{Bool, Missing}

This function provides a fast-path hint for iterator completion. This is useful for stateful iterators that want to avoid having elements consumed if they are not going to be exposed to the user (e.g. when checking for done-ness in isempty or zip).

Stateful iterators that want to opt into this feature should define an isdone method that returns true/false depending on whether the iterator is done or not. Stateless iterators need not implement this function.

If the result is missing, callers may go ahead and compute iterate(x, state) === nothing to compute a definite answer.

See also iterate, isempty

source
Base.empty!Function
empty!(c::Channel)

Empty a Channel c by calling empty! on the internal buffer. Return the empty channel.

source
empty!(collection) -> collection

Remove all elements from a collection.

Examples

julia> A = Dict("a" => 1, "b" => 2)
 Dict{String, Int64} with 2 entries:
   "b" => 2
   "a" => 1
@@ -62,14 +62,14 @@
 julia> empty!(A);
 
 julia> A
-Dict{String, Int64}()
source
Base.lengthFunction
length(collection) -> Integer

Return the number of elements in the collection.

Use lastindex to get the last valid index of an indexable collection.

See also: size, ndims, eachindex.

Examples

julia> length(1:5)
+Dict{String, Int64}()
source
Base.lengthFunction
length(collection) -> Integer

Return the number of elements in the collection.

Use lastindex to get the last valid index of an indexable collection.

See also: size, ndims, eachindex.

Examples

julia> length(1:5)
 5
 
 julia> length([1, 2, 3, 4])
 4
 
 julia> length([1 2; 3 4])
-4
source
Base.checked_lengthFunction
Base.checked_length(r)

Calculates length(r), but may check for overflow errors where applicable when the result doesn't fit into Union{Integer(eltype(r)),Int}.

source

Fully implemented by:

Iterable Collections

Base.checked_lengthFunction
Base.checked_length(r)

Calculates length(r), but may check for overflow errors where applicable when the result doesn't fit into Union{Integer(eltype(r)),Int}.

source

Fully implemented by:

Iterable Collections

Base.inFunction
in(item, collection) -> Bool
 ∈(item, collection) -> Bool

Determine whether an item is in the given collection, in the sense that it is == to one of the values generated by iterating over the collection. Can equivalently be used with infix syntax:

item in collection
 item ∈ collection

Return a Bool value, except if item is missing or collection contains missing but not item, in which case missing is returned (three-valued logic, matching the behavior of any and ==). Some collections follow a slightly different definition. For example, Sets check whether the item isequal to one of the elements; Dicts look for key=>value pairs, and the key is compared using isequal.

To test for the presence of a key in a dictionary, use haskey or k in keys(dict). For the collections mentioned above, the result is always a Bool.

When broadcasting with in.(items, collection) or items .∈ collection, both items and collection are broadcasted over, which is often not what is intended. For example, if both arguments are vectors (and the dimensions match), the result is a vector indicating whether each value in collection items is in the value at the corresponding position in collection. To get a vector indicating whether each value in items is in collection, wrap collection in a tuple or a Ref like this: in.(items, Ref(collection)) or items .∈ Ref(collection).

See also: , insorted, contains, occursin, issubset.

Examples

julia> a = 1:3:20
 1:3:19
@@ -103,7 +103,7 @@
 julia> [1, 2] .∈ ([2, 3],)
 2-element BitVector:
  0
- 1
source
Base.:∉Function
∉(item, collection) -> Bool
 ∌(collection, item) -> Bool

Negation of and , i.e. checks that item is not in collection.

When broadcasting with items .∉ collection, both items and collection are broadcasted over, which is often not what is intended. For example, if both arguments are vectors (and the dimensions match), the result is a vector indicating whether each value in collection items is not in the value at the corresponding position in collection. To get a vector indicating whether each value in items is not in collection, wrap collection in a tuple or a Ref like this: items .∉ Ref(collection).

Examples

julia> 1 ∉ 2:4
 true
 
@@ -118,11 +118,11 @@
 julia> [1, 2] .∉ ([2, 3],)
 2-element BitVector:
  1
- 0
source
Base.hasfastinFunction
Base.hasfastin(T)

Determine whether the computation x ∈ collection where collection::T can be considered as a "fast" operation (typically constant or logarithmic complexity). The definition hasfastin(x) = hasfastin(typeof(x)) is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.

The default for hasfastin(T) is true for subtypes of AbstractSet, AbstractDict and AbstractRange and false otherwise.

source
Base.eltypeFunction
eltype(type)

Determine the type of the elements generated by iterating a collection of the given type. For dictionary types, this will be a Pair{KeyType,ValType}. The definition eltype(x) = eltype(typeof(x)) is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.

See also: keytype, typeof.

Examples

julia> eltype(fill(1f0, (2,2)))
+ 0
source
Base.hasfastinFunction
Base.hasfastin(T)

Determine whether the computation x ∈ collection where collection::T can be considered as a "fast" operation (typically constant or logarithmic complexity). The definition hasfastin(x) = hasfastin(typeof(x)) is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.

The default for hasfastin(T) is true for subtypes of AbstractSet, AbstractDict and AbstractRange and false otherwise.

source
Base.eltypeFunction
eltype(type)

Determine the type of the elements generated by iterating a collection of the given type. For dictionary types, this will be a Pair{KeyType,ValType}. The definition eltype(x) = eltype(typeof(x)) is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.

See also: keytype, typeof.

Examples

julia> eltype(fill(1f0, (2,2)))
 Float32
 
 julia> eltype(fill(0x1, (2,2)))
-UInt8
source
Base.indexinFunction
indexin(a, b)

Return an array containing the first index in b for each value in a that is a member of b. The output array contains nothing wherever a is not a member of b.

See also: sortperm, findfirst.

Examples

julia> a = ['a', 'b', 'c', 'b', 'd', 'a'];
+UInt8
source
Base.indexinFunction
indexin(a, b)

Return an array containing the first index in b for each value in a that is a member of b. The output array contains nothing wherever a is not a member of b.

See also: sortperm, findfirst.

Examples

julia> a = ['a', 'b', 'c', 'b', 'd', 'a'];
 
 julia> b = ['a', 'b', 'c'];
 
@@ -139,7 +139,7 @@
 3-element Vector{Union{Nothing, Int64}}:
  1
  2
- 3
source
Base.uniqueFunction
unique(A::AbstractArray; dims::Int)

Return unique regions of A along dimension dims.

Examples

julia> A = map(isodd, reshape(Vector(1:8), (2,2,2)))
+ 3
source
Base.uniqueFunction
unique(A::AbstractArray; dims::Int)

Return unique regions of A along dimension dims.

Examples

julia> A = map(isodd, reshape(Vector(1:8), (2,2,2)))
 2×2×2 Array{Bool, 3}:
 [:, :, 1] =
  1  1
@@ -168,7 +168,7 @@
 2×2×1 Array{Bool, 3}:
 [:, :, 1] =
  1  1
- 0  0
source
unique(f, itr)

Return an array containing one value from itr for each unique value produced by f applied to elements of itr.

Examples

julia> unique(x -> x^2, [1, -1, 3, -3, 4])
+ 0  0
source
unique(f, itr)

Return an array containing one value from itr for each unique value produced by f applied to elements of itr.

Examples

julia> unique(x -> x^2, [1, -1, 3, -3, 4])
 3-element Vector{Int64}:
  1
  3
@@ -189,7 +189,7 @@
  1.7
 
 julia> a[i] == unique(a)
-true
source
unique(itr)

Return an array containing only the unique elements of collection itr, as determined by isequal and hash, in the order that the first of each set of equivalent elements originally appears. The element type of the input is preserved.

See also: unique!, allunique, allequal.

Examples

julia> unique([1, 2, 6, 2])
+true
source
unique(itr)

Return an array containing only the unique elements of collection itr, as determined by isequal and hash, in the order that the first of each set of equivalent elements originally appears. The element type of the input is preserved.

See also: unique!, allunique, allequal.

Examples

julia> unique([1, 2, 6, 2])
 3-element Vector{Int64}:
  1
  2
@@ -198,7 +198,7 @@
 julia> unique(Real[1, 1.0, 2])
 2-element Vector{Real}:
  1
- 2
source
Base.unique!Function
unique!(A::AbstractVector)

Remove duplicate items as determined by isequal and hash, then return the modified A. unique! will return the elements of A in the order that they occur. If you do not care about the order of the returned data, then calling (sort!(A); unique!(A)) will be much more efficient as long as the elements of A can be sorted.

Examples

julia> unique!([1, 1, 1])
+ 2
source
Base.unique!Function
unique!(A::AbstractVector)

Remove duplicate items as determined by isequal and hash, then return the modified A. unique! will return the elements of A in the order that they occur. If you do not care about the order of the returned data, then calling (sort!(A); unique!(A)) will be much more efficient as long as the elements of A can be sorted.

Examples

julia> unique!([1, 1, 1])
 1-element Vector{Int64}:
  1
 
@@ -219,7 +219,7 @@
 3-element Vector{Int64}:
   6
   7
- 42
source
unique!(f, A::AbstractVector)

Selects one value from A for each unique value produced by f applied to elements of A, then return the modified A.

Julia 1.1

This method is available as of Julia 1.1.

Examples

julia> unique!(x -> x^2, [1, -1, 3, -3, 4])
+ 42
source
unique!(f, A::AbstractVector)

Selects one value from A for each unique value produced by f applied to elements of A, then return the modified A.

Julia 1.1

This method is available as of Julia 1.1.

Examples

julia> unique!(x -> x^2, [1, -1, 3, -3, 4])
 3-element Vector{Int64}:
  1
  3
@@ -234,7 +234,7 @@
 julia> unique!(iseven, [2, 3, 5, 7, 9])
 2-element Vector{Int64}:
  2
- 3
source
Base.alluniqueFunction
allunique(itr) -> Bool
 allunique(f, itr) -> Bool

Return true if all values from itr are distinct when compared with isequal. Or if all of [f(x) for x in itr] are distinct, for the second method.

Note that allunique(f, itr) may call f fewer than length(itr) times. The precise number of calls is regarded as an implementation detail.

allunique may use a specialized implementation when the input is sorted.

See also: unique, issorted, allequal.

Julia 1.11

The method allunique(f, itr) requires at least Julia 1.11.

Examples

julia> allunique([1, 2, 3])
 true
 
@@ -248,7 +248,7 @@
 false
 
 julia> allunique(abs, [1, -1, 2])
-false
source
Base.allequalFunction
allequal(itr) -> Bool
 allequal(f, itr) -> Bool

Return true if all values from itr are equal when compared with isequal. Or if all of [f(x) for x in itr] are equal, for the second method.

Note that allequal(f, itr) may call f fewer than length(itr) times. The precise number of calls is regarded as an implementation detail.

See also: unique, allunique.

Julia 1.8

The allequal function requires at least Julia 1.8.

Julia 1.11

The method allequal(f, itr) requires at least Julia 1.11.

Examples

julia> allequal([])
 true
 
@@ -265,11 +265,11 @@
 false
 
 julia> allequal(abs2, [1, -1])
-true
source
Base.reduceMethod
reduce(op, itr; [init])

Reduce the given collection itr with the given binary operator op. If provided, the initial value init must be a neutral element for op that will be returned for empty collections. It is unspecified whether init is used for non-empty collections.

For empty collections, providing init will be necessary, except for some special cases (e.g. when op is one of +, *, max, min, &, |) when Julia can determine the neutral element of op.

Reductions for certain commonly-used operators may have special implementations, and should be used instead: maximum(itr), minimum(itr), sum(itr), prod(itr), any(itr), all(itr). There are efficient methods for concatenating certain arrays of arrays by calling reduce(vcat, arr) or reduce(hcat, arr).

The associativity of the reduction is implementation dependent. This means that you can't use non-associative operations like - because it is undefined whether reduce(-,[1,2,3]) should be evaluated as (1-2)-3 or 1-(2-3). Use foldl or foldr instead for guaranteed left or right associativity.

Some operations accumulate error. Parallelism will be easier if the reduction can be executed in groups. Future versions of Julia might change the algorithm. Note that the elements are not reordered if you use an ordered collection.

Examples

julia> reduce(*, [2; 3; 4])
+true
source
Base.reduceMethod
reduce(op, itr; [init])

Reduce the given collection itr with the given binary operator op. If provided, the initial value init must be a neutral element for op that will be returned for empty collections. It is unspecified whether init is used for non-empty collections.

For empty collections, providing init will be necessary, except for some special cases (e.g. when op is one of +, *, max, min, &, |) when Julia can determine the neutral element of op.

Reductions for certain commonly-used operators may have special implementations, and should be used instead: maximum(itr), minimum(itr), sum(itr), prod(itr), any(itr), all(itr). There are efficient methods for concatenating certain arrays of arrays by calling reduce(vcat, arr) or reduce(hcat, arr).

The associativity of the reduction is implementation dependent. This means that you can't use non-associative operations like - because it is undefined whether reduce(-,[1,2,3]) should be evaluated as (1-2)-3 or 1-(2-3). Use foldl or foldr instead for guaranteed left or right associativity.

Some operations accumulate error. Parallelism will be easier if the reduction can be executed in groups. Future versions of Julia might change the algorithm. Note that the elements are not reordered if you use an ordered collection.

Examples

julia> reduce(*, [2; 3; 4])
 24
 
 julia> reduce(*, Int[]; init=1)
-1
source
Base.reduceMethod
reduce(f, A::AbstractArray; dims=:, [init])

Reduce 2-argument function f along dimensions of A. dims is a vector specifying the dimensions to reduce, and the keyword argument init is the initial value to use in the reductions. For +, *, max and min the init argument is optional.

The associativity of the reduction is implementation-dependent; if you need a particular associativity, e.g. left-to-right, you should write your own loop or consider using foldl or foldr. See documentation for reduce.

Examples

julia> a = reshape(Vector(1:16), (4,4))
+1
source
Base.reduceMethod
reduce(f, A::AbstractArray; dims=:, [init])

Reduce 2-argument function f along dimensions of A. dims is a vector specifying the dimensions to reduce, and the keyword argument init is the initial value to use in the reductions. For +, *, max and min the init argument is optional.

The associativity of the reduction is implementation-dependent; if you need a particular associativity, e.g. left-to-right, you should write your own loop or consider using foldl or foldr. See documentation for reduce.

Examples

julia> a = reshape(Vector(1:16), (4,4))
 4×4 Matrix{Int64}:
  1  5   9  13
  2  6  10  14
@@ -285,18 +285,18 @@
 
 julia> reduce(max, a, dims=1)
 1×4 Matrix{Int64}:
- 4  8  12  16
source
Base.foldlMethod
foldl(op, itr; [init])

Like reduce, but with guaranteed left associativity. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

See also mapfoldl, foldr, accumulate.

Examples

julia> foldl(=>, 1:4)
+ 4  8  12  16
source
Base.foldlMethod
foldl(op, itr; [init])

Like reduce, but with guaranteed left associativity. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

See also mapfoldl, foldr, accumulate.

Examples

julia> foldl(=>, 1:4)
 ((1 => 2) => 3) => 4
 
 julia> foldl(=>, 1:4; init=0)
 (((0 => 1) => 2) => 3) => 4
 
 julia> accumulate(=>, (1,2,3,4))
-(1, 1 => 2, (1 => 2) => 3, ((1 => 2) => 3) => 4)
source
Base.foldrMethod
foldr(op, itr; [init])

Like reduce, but with guaranteed right associativity. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

Examples

julia> foldr(=>, 1:4)
+(1, 1 => 2, (1 => 2) => 3, ((1 => 2) => 3) => 4)
source
Base.foldrMethod
foldr(op, itr; [init])

Like reduce, but with guaranteed right associativity. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

Examples

julia> foldr(=>, 1:4)
 1 => (2 => (3 => 4))
 
 julia> foldr(=>, 1:4; init=0)
-1 => (2 => (3 => (4 => 0)))
source
Base.maximumFunction
maximum(f, A::AbstractArray; dims)

Compute the maximum value by calling the function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
+1 => (2 => (3 => (4 => 0)))
source
Base.maximumFunction
maximum(f, A::AbstractArray; dims)

Compute the maximum value by calling the function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -308,7 +308,7 @@
 julia> maximum(abs2, A, dims=2)
 2×1 Matrix{Int64}:
   4
- 16
source
maximum(A::AbstractArray; dims)

Compute the maximum value of an array over the given dimensions. See also the max(a,b) function to take the maximum of two or more arguments, which can be applied elementwise to arrays via max.(a,b).

See also: maximum!, extrema, findmax, argmax.

Examples

julia> A = [1 2; 3 4]
+ 16
source
maximum(A::AbstractArray; dims)

Compute the maximum value of an array over the given dimensions. See also the max(a,b) function to take the maximum of two or more arguments, which can be applied elementwise to arrays via max.(a,b).

See also: maximum!, extrema, findmax, argmax.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -320,7 +320,7 @@
 julia> maximum(A, dims=2)
 2×1 Matrix{Int64}:
  2
- 4
source
maximum(itr; [init])

Return the largest element in a collection.

The value returned for empty itr can be specified by init. It must be a neutral element for max (i.e. which is less than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> maximum(-20.5:10)
+ 4
source
maximum(itr; [init])

Return the largest element in a collection.

The value returned for empty itr can be specified by init. It must be a neutral element for max (i.e. which is less than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> maximum(-20.5:10)
 9.5
 
 julia> maximum([1,2,3])
@@ -332,14 +332,14 @@
 [...]
 
 julia> maximum((); init=-Inf)
--Inf
source
maximum(f, itr; [init])

Return the largest result of calling function f on each element of itr.

The value returned for empty itr can be specified by init. It must be a neutral element for max (i.e. which is less than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> maximum(length, ["Julion", "Julia", "Jule"])
+-Inf
source
maximum(f, itr; [init])

Return the largest result of calling function f on each element of itr.

The value returned for empty itr can be specified by init. It must be a neutral element for max (i.e. which is less than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> maximum(length, ["Julion", "Julia", "Jule"])
 6
 
 julia> maximum(length, []; init=-1)
 -1
 
 julia> maximum(sin, Real[]; init=-1.0)  # good, since output of sin is >= -1
--1.0
source
Base.maximum!Function
maximum!(r, A)

Compute the maximum value of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
+-1.0
source
Base.maximum!Function
maximum!(r, A)

Compute the maximum value of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -351,7 +351,7 @@
 
 julia> maximum!([1 1], A)
 1×2 Matrix{Int64}:
- 3  4
source
Base.minimumFunction
minimum(f, A::AbstractArray; dims)

Compute the minimum value by calling the function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
+ 3  4
source
Base.minimumFunction
minimum(f, A::AbstractArray; dims)

Compute the minimum value by calling the function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -363,7 +363,7 @@
 julia> minimum(abs2, A, dims=2)
 2×1 Matrix{Int64}:
  1
- 9
source
minimum(A::AbstractArray; dims)

Compute the minimum value of an array over the given dimensions. See also the min(a,b) function to take the minimum of two or more arguments, which can be applied elementwise to arrays via min.(a,b).

See also: minimum!, extrema, findmin, argmin.

Examples

julia> A = [1 2; 3 4]
+ 9
source
minimum(A::AbstractArray; dims)

Compute the minimum value of an array over the given dimensions. See also the min(a,b) function to take the minimum of two or more arguments, which can be applied elementwise to arrays via min.(a,b).

See also: minimum!, extrema, findmin, argmin.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -375,7 +375,7 @@
 julia> minimum(A, dims=2)
 2×1 Matrix{Int64}:
  1
- 3
source
minimum(itr; [init])

Return the smallest element in a collection.

The value returned for empty itr can be specified by init. It must be a neutral element for min (i.e. which is greater than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> minimum(-20.5:10)
+ 3
source
minimum(itr; [init])

Return the smallest element in a collection.

The value returned for empty itr can be specified by init. It must be a neutral element for min (i.e. which is greater than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> minimum(-20.5:10)
 -20.5
 
 julia> minimum([1,2,3])
@@ -387,14 +387,14 @@
 [...]
 
 julia> minimum([]; init=Inf)
-Inf
source
minimum(f, itr; [init])

Return the smallest result of calling function f on each element of itr.

The value returned for empty itr can be specified by init. It must be a neutral element for min (i.e. which is greater than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> minimum(length, ["Julion", "Julia", "Jule"])
+Inf
source
minimum(f, itr; [init])

Return the smallest result of calling function f on each element of itr.

The value returned for empty itr can be specified by init. It must be a neutral element for min (i.e. which is greater than or equal to any other element) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> minimum(length, ["Julion", "Julia", "Jule"])
 4
 
 julia> minimum(length, []; init=typemax(Int64))
 9223372036854775807
 
 julia> minimum(sin, Real[]; init=1.0)  # good, since output of sin is <= 1
-1.0
source
Base.minimum!Function
minimum!(r, A)

Compute the minimum value of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
+1.0
source
Base.minimum!Function
minimum!(r, A)

Compute the minimum value of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -406,7 +406,7 @@
 
 julia> minimum!([1 1], A)
 1×2 Matrix{Int64}:
- 1  2
source
Base.extremaFunction
extrema(f, A::AbstractArray; dims) -> Array{Tuple}

Compute the minimum and maximum of f applied to each element in the given dimensions of A.

Julia 1.2

This method requires Julia 1.2 or later.

source
extrema(A::AbstractArray; dims) -> Array{Tuple}

Compute the minimum and maximum elements of an array over the given dimensions.

See also: minimum, maximum, extrema!.

Examples

julia> A = reshape(Vector(1:2:16), (2,2,2))
+ 1  2
source
Base.extremaFunction
extrema(f, A::AbstractArray; dims) -> Array{Tuple}

Compute the minimum and maximum of f applied to each element in the given dimensions of A.

Julia 1.2

This method requires Julia 1.2 or later.

source
extrema(A::AbstractArray; dims) -> Array{Tuple}

Compute the minimum and maximum elements of an array over the given dimensions.

See also: minimum, maximum, extrema!.

Examples

julia> A = reshape(Vector(1:2:16), (2,2,2))
 2×2×2 Array{Int64, 3}:
 [:, :, 1] =
  1  5
@@ -422,18 +422,18 @@
  (1, 7)
 
 [:, :, 2] =
- (9, 15)
source
extrema(f, itr; [init]) -> (mn, mx)

Compute both the minimum mn and maximum mx of f applied to each element in itr and return them as a 2-tuple. Only one pass is made over itr.

The value returned for empty itr can be specified by init. It must be a 2-tuple whose first and second elements are neutral elements for min and max respectively (i.e. which are greater/less than or equal to any other element). It is used for non-empty collections. Note: it implies that, for empty itr, the returned value (mn, mx) satisfies mn ≥ mx even though for non-empty itr it satisfies mn ≤ mx. This is a "paradoxical" but yet expected result.

Julia 1.2

This method requires Julia 1.2 or later.

Julia 1.8

Keyword argument init requires Julia 1.8 or later.

Examples

julia> extrema(sin, 0:π)
+ (9, 15)
source
extrema(f, itr; [init]) -> (mn, mx)

Compute both the minimum mn and maximum mx of f applied to each element in itr and return them as a 2-tuple. Only one pass is made over itr.

The value returned for empty itr can be specified by init. It must be a 2-tuple whose first and second elements are neutral elements for min and max respectively (i.e. which are greater/less than or equal to any other element). It is used for non-empty collections. Note: it implies that, for empty itr, the returned value (mn, mx) satisfies mn ≥ mx even though for non-empty itr it satisfies mn ≤ mx. This is a "paradoxical" but yet expected result.

Julia 1.2

This method requires Julia 1.2 or later.

Julia 1.8

Keyword argument init requires Julia 1.8 or later.

Examples

julia> extrema(sin, 0:π)
 (0.0, 0.9092974268256817)
 
 julia> extrema(sin, Real[]; init = (1.0, -1.0))  # good, since -1 ≤ sin(::Real) ≤ 1
-(1.0, -1.0)
source
extrema(itr; [init]) -> (mn, mx)

Compute both the minimum mn and maximum mx element in a single pass, and return them as a 2-tuple.

The value returned for empty itr can be specified by init. It must be a 2-tuple whose first and second elements are neutral elements for min and max respectively (i.e. which are greater/less than or equal to any other element). As a consequence, when itr is empty the returned (mn, mx) tuple will satisfy mn ≥ mx. When init is specified it may be used even for non-empty itr.

Julia 1.8

Keyword argument init requires Julia 1.8 or later.

Examples

julia> extrema(2:10)
+(1.0, -1.0)
source
extrema(itr; [init]) -> (mn, mx)

Compute both the minimum mn and maximum mx element in a single pass, and return them as a 2-tuple.

The value returned for empty itr can be specified by init. It must be a 2-tuple whose first and second elements are neutral elements for min and max respectively (i.e. which are greater/less than or equal to any other element). As a consequence, when itr is empty the returned (mn, mx) tuple will satisfy mn ≥ mx. When init is specified it may be used even for non-empty itr.

Julia 1.8

Keyword argument init requires Julia 1.8 or later.

Examples

julia> extrema(2:10)
 (2, 10)
 
 julia> extrema([9,pi,4.5])
 (3.141592653589793, 9.0)
 
 julia> extrema([]; init = (Inf, -Inf))
-(Inf, -Inf)
source
Base.extrema!Function
extrema!(r, A)

Compute the minimum and maximum value of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Julia 1.8

This method requires Julia 1.8 or later.

Examples

julia> A = [1 2; 3 4]
+(Inf, -Inf)
source
Base.extrema!Function
extrema!(r, A)

Compute the minimum and maximum value of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Julia 1.8

This method requires Julia 1.8 or later.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -445,7 +445,7 @@
 
 julia> extrema!([(1, 1);; (1, 1)], A)
 1×2 Matrix{Tuple{Int64, Int64}}:
- (1, 3)  (2, 4)
source
Base.argmaxFunction
argmax(A; dims) -> indices

For an array input, return the indices of the maximum elements over the given dimensions. NaN is treated as greater than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
+ (1, 3)  (2, 4)
source
Base.argmaxFunction
argmax(A; dims) -> indices

For an array input, return the indices of the maximum elements over the given dimensions. NaN is treated as greater than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
 2×2 Matrix{Float64}:
  1.0  2.0
  3.0  4.0
@@ -457,18 +457,18 @@
 julia> argmax(A, dims=2)
 2×1 Matrix{CartesianIndex{2}}:
  CartesianIndex(1, 2)
- CartesianIndex(2, 2)
source
argmax(itr)

Return the index or key of the maximal element in a collection. If there are multiple maximal elements, then the first one will be returned.

The collection must not be empty.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

Values are compared with isless.

See also: argmin, findmax.

Examples

julia> argmax([8, 0.1, -9, pi])
+ CartesianIndex(2, 2)
source
argmax(itr)

Return the index or key of the maximal element in a collection. If there are multiple maximal elements, then the first one will be returned.

The collection must not be empty.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

Values are compared with isless.

See also: argmin, findmax.

Examples

julia> argmax([8, 0.1, -9, pi])
 1
 
 julia> argmax([1, 7, 7, 6])
 2
 
 julia> argmax([1, 7, 7, NaN])
-4
source
argmax(f, domain)

Return a value x from domain for which f(x) is maximised. If there are multiple maximal values for f(x) then the first one will be found.

domain must be a non-empty iterable.

Values are compared with isless.

Julia 1.7

This method requires Julia 1.7 or later.

See also argmin, findmax.

Examples

julia> argmax(abs, -10:5)
+4
source
argmax(f, domain)

Return a value x from domain for which f(x) is maximised. If there are multiple maximal values for f(x) then the first one will be found.

domain must be a non-empty iterable.

Values are compared with isless.

Julia 1.7

This method requires Julia 1.7 or later.

See also argmin, findmax.

Examples

julia> argmax(abs, -10:5)
 -10
 
 julia> argmax(cos, 0:π/2:2π)
-0.0
source
argmax(r::AbstractRange)

Ranges can have multiple maximal elements. In that case argmax will return a maximal index, but not necessarily the first one.

source
Base.argminFunction
argmin(A; dims) -> indices

For an array input, return the indices of the minimum elements over the given dimensions. NaN is treated as less than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
+0.0
source
argmax(r::AbstractRange)

Ranges can have multiple maximal elements. In that case argmax will return a maximal index, but not necessarily the first one.

source
Base.argminFunction
argmin(A; dims) -> indices

For an array input, return the indices of the minimum elements over the given dimensions. NaN is treated as less than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
 2×2 Matrix{Float64}:
  1.0  2.0
  3.0  4.0
@@ -480,21 +480,21 @@
 julia> argmin(A, dims=2)
 2×1 Matrix{CartesianIndex{2}}:
  CartesianIndex(1, 1)
- CartesianIndex(2, 1)
source
argmin(itr)

Return the index or key of the minimal element in a collection. If there are multiple minimal elements, then the first one will be returned.

The collection must not be empty.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

NaN is treated as less than all other values except missing.

See also: argmax, findmin.

Examples

julia> argmin([8, 0.1, -9, pi])
+ CartesianIndex(2, 1)
source
argmin(itr)

Return the index or key of the minimal element in a collection. If there are multiple minimal elements, then the first one will be returned.

The collection must not be empty.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

NaN is treated as less than all other values except missing.

See also: argmax, findmin.

Examples

julia> argmin([8, 0.1, -9, pi])
 3
 
 julia> argmin([7, 1, 1, 6])
 2
 
 julia> argmin([7, 1, 1, NaN])
-4
source
argmin(f, domain)

Return a value x from domain for which f(x) is minimised. If there are multiple minimal values for f(x) then the first one will be found.

domain must be a non-empty iterable.

NaN is treated as less than all other values except missing.

Julia 1.7

This method requires Julia 1.7 or later.

See also argmax, findmin.

Examples

julia> argmin(sign, -10:5)
+4
source
argmin(f, domain)

Return a value x from domain for which f(x) is minimised. If there are multiple minimal values for f(x) then the first one will be found.

domain must be a non-empty iterable.

NaN is treated as less than all other values except missing.

Julia 1.7

This method requires Julia 1.7 or later.

See also argmax, findmin.

Examples

julia> argmin(sign, -10:5)
 -10
 
 julia> argmin(x -> -x^3 + x^2 - 10, -5:5)
 5
 
 julia> argmin(acos, 0:0.1:1)
-1.0
source
argmin(r::AbstractRange)

Ranges can have multiple minimal elements. In that case argmin will return a minimal index, but not necessarily the first one.

source
Base.findmaxFunction
findmax(f, A; dims) -> (f(x), index)

For an array input, returns the value in the codomain and index of the corresponding value which maximize f over the given dimensions.

Examples

julia> A = [-1.0 1; -0.5 2]
+1.0
source
argmin(r::AbstractRange)

Ranges can have multiple minimal elements. In that case argmin will return a minimal index, but not necessarily the first one.

source
Base.findmaxFunction
findmax(f, A; dims) -> (f(x), index)

For an array input, returns the value in the codomain and index of the corresponding value which maximize f over the given dimensions.

Examples

julia> A = [-1.0 1; -0.5 2]
 2×2 Matrix{Float64}:
  -1.0  1.0
  -0.5  2.0
@@ -503,7 +503,7 @@
 ([1.0 4.0], CartesianIndex{2}[CartesianIndex(1, 1) CartesianIndex(2, 2)])
 
 julia> findmax(abs2, A, dims=2)
-([1.0; 4.0;;], CartesianIndex{2}[CartesianIndex(1, 1); CartesianIndex(2, 2);;])
source
findmax(A; dims) -> (maxval, index)

For an array input, returns the value and index of the maximum over the given dimensions. NaN is treated as greater than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
+([1.0; 4.0;;], CartesianIndex{2}[CartesianIndex(1, 1); CartesianIndex(2, 2);;])
source
findmax(A; dims) -> (maxval, index)

For an array input, returns the value and index of the maximum over the given dimensions. NaN is treated as greater than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
 2×2 Matrix{Float64}:
  1.0  2.0
  3.0  4.0
@@ -512,14 +512,14 @@
 ([3.0 4.0], CartesianIndex{2}[CartesianIndex(2, 1) CartesianIndex(2, 2)])
 
 julia> findmax(A, dims=2)
-([2.0; 4.0;;], CartesianIndex{2}[CartesianIndex(1, 2); CartesianIndex(2, 2);;])
source
findmax(itr) -> (x, index)

Return the maximal element of the collection itr and its index or key. If there are multiple maximal elements, then the first one will be returned. Values are compared with isless.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

See also: findmin, argmax, maximum.

Examples

julia> findmax([8, 0.1, -9, pi])
+([2.0; 4.0;;], CartesianIndex{2}[CartesianIndex(1, 2); CartesianIndex(2, 2);;])
source
findmax(itr) -> (x, index)

Return the maximal element of the collection itr and its index or key. If there are multiple maximal elements, then the first one will be returned. Values are compared with isless.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

See also: findmin, argmax, maximum.

Examples

julia> findmax([8, 0.1, -9, pi])
 (8.0, 1)
 
 julia> findmax([1, 7, 7, 6])
 (7, 2)
 
 julia> findmax([1, 7, 7, NaN])
-(NaN, 4)
source
findmax(f, domain) -> (f(x), index)

Return a pair of a value in the codomain (outputs of f) and the index or key of the corresponding value in the domain (inputs to f) such that f(x) is maximised. If there are multiple maximal points, then the first one will be returned.

domain must be a non-empty iterable supporting keys. Indices are of the same type as those returned by keys(domain).

Values are compared with isless.

Julia 1.7

This method requires Julia 1.7 or later.

Examples

julia> findmax(identity, 5:9)
+(NaN, 4)
source
findmax(f, domain) -> (f(x), index)

Return a pair of a value in the codomain (outputs of f) and the index or key of the corresponding value in the domain (inputs to f) such that f(x) is maximised. If there are multiple maximal points, then the first one will be returned.

domain must be a non-empty iterable supporting keys. Indices are of the same type as those returned by keys(domain).

Values are compared with isless.

Julia 1.7

This method requires Julia 1.7 or later.

Examples

julia> findmax(identity, 5:9)
 (9, 5)
 
 julia> findmax(-, 1:10)
@@ -529,7 +529,7 @@
 (3, 2)
 
 julia> findmax(cos, 0:π/2:2π)
-(1.0, 1)
source
Base.findminFunction
findmin(f, A; dims) -> (f(x), index)

For an array input, returns the value in the codomain and index of the corresponding value which minimize f over the given dimensions.

Examples

julia> A = [-1.0 1; -0.5 2]
+(1.0, 1)
source
Base.findminFunction
findmin(f, A; dims) -> (f(x), index)

For an array input, returns the value in the codomain and index of the corresponding value which minimize f over the given dimensions.

Examples

julia> A = [-1.0 1; -0.5 2]
 2×2 Matrix{Float64}:
  -1.0  1.0
  -0.5  2.0
@@ -538,7 +538,7 @@
 ([0.25 1.0], CartesianIndex{2}[CartesianIndex(2, 1) CartesianIndex(1, 2)])
 
 julia> findmin(abs2, A, dims=2)
-([1.0; 0.25;;], CartesianIndex{2}[CartesianIndex(1, 1); CartesianIndex(2, 1);;])
source
findmin(A; dims) -> (minval, index)

For an array input, returns the value and index of the minimum over the given dimensions. NaN is treated as less than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
+([1.0; 0.25;;], CartesianIndex{2}[CartesianIndex(1, 1); CartesianIndex(2, 1);;])
source
findmin(A; dims) -> (minval, index)

For an array input, returns the value and index of the minimum over the given dimensions. NaN is treated as less than all other values except missing.

Examples

julia> A = [1.0 2; 3 4]
 2×2 Matrix{Float64}:
  1.0  2.0
  3.0  4.0
@@ -547,14 +547,14 @@
 ([1.0 2.0], CartesianIndex{2}[CartesianIndex(1, 1) CartesianIndex(1, 2)])
 
 julia> findmin(A, dims=2)
-([1.0; 3.0;;], CartesianIndex{2}[CartesianIndex(1, 1); CartesianIndex(2, 1);;])
source
findmin(itr) -> (x, index)

Return the minimal element of the collection itr and its index or key. If there are multiple minimal elements, then the first one will be returned. NaN is treated as less than all other values except missing.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

See also: findmax, argmin, minimum.

Examples

julia> findmin([8, 0.1, -9, pi])
+([1.0; 3.0;;], CartesianIndex{2}[CartesianIndex(1, 1); CartesianIndex(2, 1);;])
source
findmin(itr) -> (x, index)

Return the minimal element of the collection itr and its index or key. If there are multiple minimal elements, then the first one will be returned. NaN is treated as less than all other values except missing.

Indices are of the same type as those returned by keys(itr) and pairs(itr).

See also: findmax, argmin, minimum.

Examples

julia> findmin([8, 0.1, -9, pi])
 (-9.0, 3)
 
 julia> findmin([1, 7, 7, 6])
 (1, 1)
 
 julia> findmin([1, 7, 7, NaN])
-(NaN, 4)
source
findmin(f, domain) -> (f(x), index)

Return a pair of a value in the codomain (outputs of f) and the index or key of the corresponding value in the domain (inputs to f) such that f(x) is minimised. If there are multiple minimal points, then the first one will be returned.

domain must be a non-empty iterable.

Indices are of the same type as those returned by keys(domain) and pairs(domain).

NaN is treated as less than all other values except missing.

Julia 1.7

This method requires Julia 1.7 or later.

Examples

julia> findmin(identity, 5:9)
+(NaN, 4)
source
findmin(f, domain) -> (f(x), index)

Return a pair of a value in the codomain (outputs of f) and the index or key of the corresponding value in the domain (inputs to f) such that f(x) is minimised. If there are multiple minimal points, then the first one will be returned.

domain must be a non-empty iterable.

Indices are of the same type as those returned by keys(domain) and pairs(domain).

NaN is treated as less than all other values except missing.

Julia 1.7

This method requires Julia 1.7 or later.

Examples

julia> findmin(identity, 5:9)
 (5, 1)
 
 julia> findmin(-, 1:10)
@@ -564,7 +564,7 @@
 (2, 1)
 
 julia> findmin(cos, 0:π/2:2π)
-(-1.0, 3)
source
Base.findmax!Function
findmax!(rval, rind, A) -> (maxval, index)

Find the maximum of A and the corresponding linear index along singleton dimensions of rval and rind, and store the results in rval and rind. NaN is treated as greater than all other values except missing.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.findmin!Function
findmin!(rval, rind, A) -> (minval, index)

Find the minimum of A and the corresponding linear index along singleton dimensions of rval and rind, and store the results in rval and rind. NaN is treated as less than all other values except missing.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.sumFunction
sum(f, A::AbstractArray; dims)

Sum the results of calling function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
+(-1.0, 3)
source
Base.findmax!Function
findmax!(rval, rind, A) -> (maxval, index)

Find the maximum of A and the corresponding linear index along singleton dimensions of rval and rind, and store the results in rval and rind. NaN is treated as greater than all other values except missing.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.findmin!Function
findmin!(rval, rind, A) -> (minval, index)

Find the minimum of A and the corresponding linear index along singleton dimensions of rval and rind, and store the results in rval and rind. NaN is treated as less than all other values except missing.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.sumFunction
sum(f, A::AbstractArray; dims)

Sum the results of calling function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -576,7 +576,7 @@
 julia> sum(abs2, A, dims=2)
 2×1 Matrix{Int64}:
   5
- 25
source
sum(A::AbstractArray; dims)

Sum elements of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
+ 25
source
sum(A::AbstractArray; dims)

Sum elements of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -588,16 +588,16 @@
 julia> sum(A, dims=2)
 2×1 Matrix{Int64}:
  3
- 7
source
sum(itr; [init])

Return the sum of all elements in a collection.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the additive identity (i.e. zero) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

See also: reduce, mapreduce, count, union.

Examples

julia> sum(1:20)
+ 7
source
sum(itr; [init])

Return the sum of all elements in a collection.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the additive identity (i.e. zero) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

See also: reduce, mapreduce, count, union.

Examples

julia> sum(1:20)
 210
 
 julia> sum(1:20; init = 0.0)
-210.0
source
sum(f, itr; [init])

Sum the results of calling function f on each element of itr.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the additive identity (i.e. zero) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> sum(abs2, [2; 3; 4])
+210.0
source
sum(f, itr; [init])

Sum the results of calling function f on each element of itr.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the additive identity (i.e. zero) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> sum(abs2, [2; 3; 4])
 29

Note the important difference between sum(A) and reduce(+, A) for arrays with small integer eltype:

julia> sum(Int8[100, 28])
 128
 
 julia> reduce(+, Int8[100, 28])
--128

In the former case, the integers are widened to system word size and therefore the result is 128. In the latter case, no such widening happens and integer overflow results in -128.

source
Base.sum!Function
sum!(r, A)

Sum elements of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
+-128

In the former case, the integers are widened to system word size and therefore the result is 128. In the latter case, no such widening happens and integer overflow results in -128.

source
Base.sum!Function
sum!(r, A)

Sum elements of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -609,7 +609,7 @@
 
 julia> sum!([1 1], A)
 1×2 Matrix{Int64}:
- 4  6
source
Base.prodFunction
prod(f, A::AbstractArray; dims)

Multiply the results of calling the function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
+ 4  6
source
Base.prodFunction
prod(f, A::AbstractArray; dims)

Multiply the results of calling the function f on each element of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -621,7 +621,7 @@
 julia> prod(abs2, A, dims=2)
 2×1 Matrix{Int64}:
    4
- 144
source
prod(A::AbstractArray; dims)

Multiply elements of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
+ 144
source
prod(A::AbstractArray; dims)

Multiply elements of an array over the given dimensions.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -633,12 +633,12 @@
 julia> prod(A, dims=2)
 2×1 Matrix{Int64}:
   2
- 12
source
prod(itr; [init])

Return the product of all elements of a collection.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the multiplicative identity (i.e. one) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

See also: reduce, cumprod, any.

Examples

julia> prod(1:5)
+ 12
source
prod(itr; [init])

Return the product of all elements of a collection.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the multiplicative identity (i.e. one) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

See also: reduce, cumprod, any.

Examples

julia> prod(1:5)
 120
 
 julia> prod(1:5; init = 1.0)
-120.0
source
prod(f, itr; [init])

Return the product of f applied to each element of itr.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the multiplicative identity (i.e. one) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> prod(abs2, [2; 3; 4])
-576
source
Base.prod!Function
prod!(r, A)

Multiply elements of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
+120.0
source
prod(f, itr; [init])

Return the product of f applied to each element of itr.

The return type is Int for signed integers of less than system word size, and UInt for unsigned integers of less than system word size. For all other arguments, a common return type is found to which all arguments are promoted.

The value returned for empty itr can be specified by init. It must be the multiplicative identity (i.e. one) as it is unspecified whether init is used for non-empty collections.

Julia 1.6

Keyword argument init requires Julia 1.6 or later.

Examples

julia> prod(abs2, [2; 3; 4])
+576
source
Base.prod!Function
prod!(r, A)

Multiply elements of A over the singleton dimensions of r, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -650,7 +650,7 @@
 
 julia> prod!([1 1], A)
 1×2 Matrix{Int64}:
- 3  8
source
Base.anyMethod
any(itr) -> Bool

Test whether any elements of a boolean collection are true, returning true as soon as the first true value in itr is encountered (short-circuiting). To short-circuit on false, use all.

If the input contains missing values, return missing if all non-missing values are false (or equivalently, if the input contains no true value), following three-valued logic.

See also: all, count, sum, |, ||.

Examples

julia> a = [true,false,false,true]
+ 3  8
source
Base.anyMethod
any(itr) -> Bool

Test whether any elements of a boolean collection are true, returning true as soon as the first true value in itr is encountered (short-circuiting). To short-circuit on false, use all.

If the input contains missing values, return missing if all non-missing values are false (or equivalently, if the input contains no true value), following three-valued logic.

See also: all, count, sum, |, ||.

Examples

julia> a = [true,false,false,true]
 4-element Vector{Bool}:
  1
  0
@@ -668,7 +668,7 @@
 true
 
 julia> any([false, missing])
-missing
source
Base.anyMethod
any(p, itr) -> Bool

Determine whether predicate p returns true for any elements of itr, returning true as soon as the first item in itr for which p returns true is encountered (short-circuiting). To short-circuit on false, use all.

If the input contains missing values, return missing if all non-missing values are false (or equivalently, if the input contains no true value), following three-valued logic.

Examples

julia> any(i->(4<=i<=6), [3,5,7])
+missing
source
Base.anyMethod
any(p, itr) -> Bool

Determine whether predicate p returns true for any elements of itr, returning true as soon as the first item in itr for which p returns true is encountered (short-circuiting). To short-circuit on false, use all.

If the input contains missing values, return missing if all non-missing values are false (or equivalently, if the input contains no true value), following three-valued logic.

Examples

julia> any(i->(4<=i<=6), [3,5,7])
 true
 
 julia> any(i -> (println(i); i > 3), 1:10)
@@ -685,7 +685,7 @@
 missing
 
 julia> any(i -> i > 0, [-1, 0])
-false
source
Base.any!Function
any!(r, A)

Test whether any values in A along the singleton dimensions of r are true, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [true false; true false]
+false
source
Base.any!Function
any!(r, A)

Test whether any values in A along the singleton dimensions of r are true, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [true false; true false]
 2×2 Matrix{Bool}:
  1  0
  1  0
@@ -697,7 +697,7 @@
 
 julia> any!([1 1], A)
 1×2 Matrix{Int64}:
- 1  0
source
Base.allMethod
all(itr) -> Bool

Test whether all elements of a boolean collection are true, returning false as soon as the first false value in itr is encountered (short-circuiting). To short-circuit on true, use any.

If the input contains missing values, return missing if all non-missing values are true (or equivalently, if the input contains no false value), following three-valued logic.

See also: all!, any, count, &, &&, allunique.

Examples

julia> a = [true,false,false,true]
+ 1  0
source
Base.allMethod
all(itr) -> Bool

Test whether all elements of a boolean collection are true, returning false as soon as the first false value in itr is encountered (short-circuiting). To short-circuit on true, use any.

If the input contains missing values, return missing if all non-missing values are true (or equivalently, if the input contains no false value), following three-valued logic.

See also: all!, any, count, &, &&, allunique.

Examples

julia> a = [true,false,false,true]
 4-element Vector{Bool}:
  1
  0
@@ -716,7 +716,7 @@
 false
 
 julia> all([true, missing])
-missing
source
Base.allMethod
all(p, itr) -> Bool

Determine whether predicate p returns true for all elements of itr, returning false as soon as the first item in itr for which p returns false is encountered (short-circuiting). To short-circuit on true, use any.

If the input contains missing values, return missing if all non-missing values are true (or equivalently, if the input contains no false value), following three-valued logic.

Examples

julia> all(i->(4<=i<=6), [4,5,6])
+missing
source
Base.allMethod
all(p, itr) -> Bool

Determine whether predicate p returns true for all elements of itr, returning false as soon as the first item in itr for which p returns false is encountered (short-circuiting). To short-circuit on true, use any.

If the input contains missing values, return missing if all non-missing values are true (or equivalently, if the input contains no false value), following three-valued logic.

Examples

julia> all(i->(4<=i<=6), [4,5,6])
 true
 
 julia> all(i -> (println(i); i < 3), 1:10)
@@ -732,7 +732,7 @@
 false
 
 julia> all(i -> i > 0, [1, 2])
-true
source
Base.all!Function
all!(r, A)

Test whether all values in A along the singleton dimensions of r are true, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [true false; true false]
+true
source
Base.all!Function
all!(r, A)

Test whether all values in A along the singleton dimensions of r are true, and write results to r.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> A = [true false; true false]
 2×2 Matrix{Bool}:
  1  0
  1  0
@@ -744,7 +744,7 @@
 
 julia> all!([1 1], A)
 1×2 Matrix{Int64}:
- 1  0
source
Base.countFunction
count([f=identity,] A::AbstractArray; dims=:)

Count the number of elements in A for which f returns true over the given dimensions.

Julia 1.5

dims keyword was added in Julia 1.5.

Julia 1.6

init keyword was added in Julia 1.6.

Examples

julia> A = [1 2; 3 4]
+ 1  0
source
Base.countFunction
count([f=identity,] A::AbstractArray; dims=:)

Count the number of elements in A for which f returns true over the given dimensions.

Julia 1.5

dims keyword was added in Julia 1.5.

Julia 1.6

init keyword was added in Julia 1.6.

Examples

julia> A = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -756,7 +756,7 @@
 julia> count(<=(2), A, dims=2)
 2×1 Matrix{Int64}:
  2
- 0
source
count(
+ 0
source
count(
     pattern::Union{AbstractChar,AbstractString,AbstractPattern},
     string::AbstractString;
     overlap::Bool = false,
@@ -767,14 +767,14 @@
 3
 
 julia> count(r"a(.)a", "cabacabac")
-2
source
count([f=identity,] itr; init=0) -> Integer

Count the number of elements in itr for which the function f returns true. If f is omitted, count the number of true elements in itr (which should be a collection of boolean values). init optionally specifies the value to start counting from and therefore also determines the output type.

Julia 1.6

init keyword was added in Julia 1.6.

See also: any, sum.

Examples

julia> count(i->(4<=i<=6), [2,3,4,5,6])
+2
source
count([f=identity,] itr; init=0) -> Integer

Count the number of elements in itr for which the function f returns true. If f is omitted, count the number of true elements in itr (which should be a collection of boolean values). init optionally specifies the value to start counting from and therefore also determines the output type.

Julia 1.6

init keyword was added in Julia 1.6.

See also: any, sum.

Examples

julia> count(i->(4<=i<=6), [2,3,4,5,6])
 3
 
 julia> count([true, false, true, true])
 3
 
 julia> count(>(3), 1:7, init=0x03)
-0x07
source
Base.foreachFunction
foreach(f, c...) -> Nothing

Call function f on each element of iterable c. For multiple iterable arguments, f is called elementwise, and iteration stops when any iterator is finished.

foreach should be used instead of map when the results of f are not needed, for example in foreach(println, array).

Examples

julia> tri = 1:3:7; res = Int[];
+0x07
source
Base.foreachFunction
foreach(f, c...) -> Nothing

Call function f on each element of iterable c. For multiple iterable arguments, f is called elementwise, and iteration stops when any iterator is finished.

foreach should be used instead of map when the results of f are not needed, for example in foreach(println, array).

Examples

julia> tri = 1:3:7; res = Int[];
 
 julia> foreach(x -> push!(res, x^2), tri)
 
@@ -787,7 +787,7 @@
 julia> foreach((x, y) -> println(x, " with ", y), tri, 'a':'z')
 1 with a
 4 with b
-7 with c
source
Base.mapFunction
map(f, A::AbstractArray...) -> N-array

When acting on multi-dimensional arrays of the same ndims, they must all have the same axes, and the answer will too.

See also broadcast, which allows mismatched sizes.

Examples

julia> map(//, [1 2; 3 4], [4 3; 2 1])
+7 with c
source
Base.mapFunction
map(f, A::AbstractArray...) -> N-array

When acting on multi-dimensional arrays of the same ndims, they must all have the same axes, and the answer will too.

See also broadcast, which allows mismatched sizes.

Examples

julia> map(//, [1 2; 3 4], [4 3; 2 1])
 2×2 Matrix{Rational{Int64}}:
  1//4  2//3
  3//2  4//1
@@ -799,7 +799,7 @@
 3-element Vector{Float64}:
    2.0
   13.0
- 102.0
source
map(f, c...) -> collection

Transform collection c by applying f to each element. For multiple collection arguments, apply f elementwise, and stop when any of them is exhausted.

The element type of the result is determined in the same manner as in collect.

See also map!, foreach, mapreduce, mapslices, zip, Iterators.map.

Examples

julia> map(x -> x * 2, [1, 2, 3])
+ 102.0
source
map(f, c...) -> collection

Transform collection c by applying f to each element. For multiple collection arguments, apply f elementwise, and stop when any of them is exhausted.

The element type of the result is determined in the same manner as in collect.

See also map!, foreach, mapreduce, mapslices, zip, Iterators.map.

Examples

julia> map(x -> x * 2, [1, 2, 3])
 3-element Vector{Int64}:
  2
  4
@@ -809,7 +809,7 @@
 3-element Vector{Int64}:
  11
  22
- 33
source
Base.map!Function
map!(f, values(dict::AbstractDict))

Modifies dict by transforming each value from val to f(val). Note that the type of dict cannot be changed: if f(val) is not an instance of the value type of dict then it will be converted to the value type if possible and otherwise raise an error.

Julia 1.2

map!(f, values(dict::AbstractDict)) requires Julia 1.2 or later.

Examples

julia> d = Dict(:a => 1, :b => 2)
+ 33
source
Base.map!Function
map!(f, values(dict::AbstractDict))

Modifies dict by transforming each value from val to f(val). Note that the type of dict cannot be changed: if f(val) is not an instance of the value type of dict then it will be converted to the value type if possible and otherwise raise an error.

Julia 1.2

map!(f, values(dict::AbstractDict)) requires Julia 1.2 or later.

Examples

julia> d = Dict(:a => 1, :b => 2)
 Dict{Symbol, Int64} with 2 entries:
   :a => 1
   :b => 2
@@ -817,14 +817,14 @@
 julia> map!(v -> v-1, values(d))
 ValueIterator for a Dict{Symbol, Int64} with 2 entries. Values:
   0
-  1
source
map!(function, array)

Like map, but stores the result in the same array.

Julia 1.12

This method requires Julia 1.12 or later. To support previous versions too, use the equivalent map!(function, array, array).

Examples

julia> a = [1 2 3; 4 5 6];
+  1
source
map!(function, array)

Like map, but stores the result in the same array.

Julia 1.12

This method requires Julia 1.12 or later. To support previous versions too, use the equivalent map!(function, array, array).

Examples

julia> a = [1 2 3; 4 5 6];
 
 julia> map!(x -> x^3, a);
 
 julia> a
 2×3 Matrix{Int64}:
   1    8   27
- 64  125  216
source
map!(function, destination, collection...)

Like map, but stores the result in destination rather than a new collection. destination must be at least as large as the smallest collection.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also: map, foreach, zip, copyto!.

Examples

julia> a = zeros(3);
+ 64  125  216
source
map!(function, destination, collection...)

Like map, but stores the result in destination rather than a new collection. destination must be at least as large as the smallest collection.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

See also: map, foreach, zip, copyto!.

Examples

julia> a = zeros(3);
 
 julia> map!(x -> x * 2, a, [1, 2, 3]);
 
@@ -840,15 +840,15 @@
  103
  105
    0
-   0
source
Base.mapreduceMethod
mapreduce(f, op, itrs...; [init])

Apply function f to each element(s) in itrs, and then reduce the result using the binary function op. If provided, init must be a neutral element for op that will be returned for empty collections. It is unspecified whether init is used for non-empty collections. In general, it will be necessary to provide init to work with empty collections.

mapreduce is functionally equivalent to calling reduce(op, map(f, itr); init=init), but will in general execute faster since no intermediate collection needs to be created. See documentation for reduce and map.

Julia 1.2

mapreduce with multiple iterators requires Julia 1.2 or later.

Examples

julia> mapreduce(x->x^2, +, [1:3;]) # == 1 + 4 + 9
-14

The associativity of the reduction is implementation-dependent. Additionally, some implementations may reuse the return value of f for elements that appear multiple times in itr. Use mapfoldl or mapfoldr instead for guaranteed left or right associativity and invocation of f for every value.

source
Base.mapfoldlMethod
mapfoldl(f, op, itr; [init])

Like mapreduce, but with guaranteed left associativity, as in foldl. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

source
Base.mapfoldrMethod
mapfoldr(f, op, itr; [init])

Like mapreduce, but with guaranteed right associativity, as in foldr. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

source
Base.firstFunction
first(s::AbstractString, n::Integer)

Get a string consisting of the first n characters of s.

Examples

julia> first("∀ϵ≠0: ϵ²>0", 0)
+   0
source
Base.mapreduceMethod
mapreduce(f, op, itrs...; [init])

Apply function f to each element(s) in itrs, and then reduce the result using the binary function op. If provided, init must be a neutral element for op that will be returned for empty collections. It is unspecified whether init is used for non-empty collections. In general, it will be necessary to provide init to work with empty collections.

mapreduce is functionally equivalent to calling reduce(op, map(f, itr); init=init), but will in general execute faster since no intermediate collection needs to be created. See documentation for reduce and map.

Julia 1.2

mapreduce with multiple iterators requires Julia 1.2 or later.

Examples

julia> mapreduce(x->x^2, +, [1:3;]) # == 1 + 4 + 9
+14

The associativity of the reduction is implementation-dependent. Additionally, some implementations may reuse the return value of f for elements that appear multiple times in itr. Use mapfoldl or mapfoldr instead for guaranteed left or right associativity and invocation of f for every value.

source
Base.mapfoldlMethod
mapfoldl(f, op, itr; [init])

Like mapreduce, but with guaranteed left associativity, as in foldl. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

source
Base.mapfoldrMethod
mapfoldr(f, op, itr; [init])

Like mapreduce, but with guaranteed right associativity, as in foldr. If provided, the keyword argument init will be used exactly once. In general, it will be necessary to provide init to work with empty collections.

source
Base.firstFunction
first(s::AbstractString, n::Integer)

Get a string consisting of the first n characters of s.

Examples

julia> first("∀ϵ≠0: ϵ²>0", 0)
 ""
 
 julia> first("∀ϵ≠0: ϵ²>0", 1)
 "∀"
 
 julia> first("∀ϵ≠0: ϵ²>0", 3)
-"∀ϵ≠"
source
first(itr, n::Integer)

Get the first n elements of the iterable collection itr, or fewer elements if itr is not long enough.

See also: startswith, Iterators.take.

Julia 1.6

This method requires at least Julia 1.6.

Examples

julia> first(["foo", "bar", "qux"], 2)
+"∀ϵ≠"
source
first(itr, n::Integer)

Get the first n elements of the iterable collection itr, or fewer elements if itr is not long enough.

See also: startswith, Iterators.take.

Julia 1.6

This method requires at least Julia 1.6.

Examples

julia> first(["foo", "bar", "qux"], 2)
 2-element Vector{String}:
  "foo"
  "bar"
@@ -857,18 +857,18 @@
 1:6
 
 julia> first(Bool[], 1)
-Bool[]
source
first(coll)

Get the first element of an iterable collection. Return the start point of an AbstractRange even if it is empty.

See also: only, firstindex, last.

Examples

julia> first(2:2:10)
+Bool[]
source
first(coll)

Get the first element of an iterable collection. Return the start point of an AbstractRange even if it is empty.

See also: only, firstindex, last.

Examples

julia> first(2:2:10)
 2
 
 julia> first([1; 2; 3; 4])
-1
source
Base.lastFunction
last(s::AbstractString, n::Integer)

Get a string consisting of the last n characters of s.

Examples

julia> last("∀ϵ≠0: ϵ²>0", 0)
+1
source
Base.lastFunction
last(s::AbstractString, n::Integer)

Get a string consisting of the last n characters of s.

Examples

julia> last("∀ϵ≠0: ϵ²>0", 0)
 ""
 
 julia> last("∀ϵ≠0: ϵ²>0", 1)
 "0"
 
 julia> last("∀ϵ≠0: ϵ²>0", 3)
-"²>0"
source
last(itr, n::Integer)

Get the last n elements of the iterable collection itr, or fewer elements if itr is not long enough.

Julia 1.6

This method requires at least Julia 1.6.

Examples

julia> last(["foo", "bar", "qux"], 2)
+"²>0"
source
last(itr, n::Integer)

Get the last n elements of the iterable collection itr, or fewer elements if itr is not long enough.

Julia 1.6

This method requires at least Julia 1.6.

Examples

julia> last(["foo", "bar", "qux"], 2)
 2-element Vector{String}:
  "bar"
  "qux"
@@ -877,19 +877,19 @@
 1:6
 
 julia> last(Float64[], 1)
-Float64[]
source
last(coll)

Get the last element of an ordered collection, if it can be computed in O(1) time. This is accomplished by calling lastindex to get the last index. Return the end point of an AbstractRange even if it is empty.

See also first, endswith.

Examples

julia> last(1:2:10)
+Float64[]
source
last(coll)

Get the last element of an ordered collection, if it can be computed in O(1) time. This is accomplished by calling lastindex to get the last index. Return the end point of an AbstractRange even if it is empty.

See also first, endswith.

Examples

julia> last(1:2:10)
 9
 
 julia> last([1; 2; 3; 4])
-4
source
Base.frontFunction
front(x::Tuple)::Tuple

Return a Tuple consisting of all but the last component of x.

See also: first, tail.

Examples

julia> Base.front((1,2,3))
+4
source
Base.frontFunction
front(x::Tuple)::Tuple

Return a Tuple consisting of all but the last component of x.

See also: first, tail.

Examples

julia> Base.front((1,2,3))
 (1, 2)
 
 julia> Base.front(())
-ERROR: ArgumentError: Cannot call front on an empty tuple.
source
Base.tailFunction
tail(x::Tuple)::Tuple

Return a Tuple consisting of all but the first component of x.

See also: front, rest, first, Iterators.peel.

Examples

julia> Base.tail((1,2,3))
+ERROR: ArgumentError: Cannot call front on an empty tuple.
source
Base.tailFunction
tail(x::Tuple)::Tuple

Return a Tuple consisting of all but the first component of x.

See also: front, rest, first, Iterators.peel.

Examples

julia> Base.tail((1,2,3))
 (2, 3)
 
 julia> Base.tail(())
-ERROR: ArgumentError: Cannot call tail on an empty tuple.
source
Base.stepFunction
step(r)

Get the step size of an AbstractRange object.

Examples

julia> step(1:10)
+ERROR: ArgumentError: Cannot call tail on an empty tuple.
source
Base.stepFunction
step(r)

Get the step size of an AbstractRange object.

Examples

julia> step(1:10)
 1
 
 julia> step(1:2:10)
@@ -899,7 +899,7 @@
 0.3
 
 julia> step(range(2.5, stop=10.9, length=85))
-0.1
source
Base.collectMethod
collect(iterator)

Return an Array of all items in a collection or iterator. For dictionaries, returns a Vector of key=>value Pairs. If the argument is array-like or is an iterator with the HasShape trait, the result will have the same shape and number of dimensions as the argument.

Used by comprehensions to turn a generator expression into an Array. Thus, on generators, the square-brackets notation may be used instead of calling collect, see second example.

The element type of the returned array is based on the types of the values collected. However, if the iterator is empty then the element type of the returned (empty) array is determined by type inference.

Examples

Collect items from a UnitRange{Int64} collection:

julia> collect(1:3)
+0.1
source
Base.collectMethod
collect(iterator)

Return an Array of all items in a collection or iterator. For dictionaries, returns a Vector of key=>value Pairs. If the argument is array-like or is an iterator with the HasShape trait, the result will have the same shape and number of dimensions as the argument.

Used by comprehensions to turn a generator expression into an Array. Thus, on generators, the square-brackets notation may be used instead of calling collect, see second example.

The element type of the returned array is based on the types of the values collected. However, if the iterator is empty then the element type of the returned (empty) array is determined by type inference.

Examples

Collect items from a UnitRange{Int64} collection:

julia> collect(1:3)
 3-element Vector{Int64}:
  1
  2
@@ -910,32 +910,32 @@
  9

Collecting an empty iterator where the result type depends on type inference:

julia> [rand(Bool) ? 1 : missing for _ in []]
 Union{Missing, Int64}[]

When the iterator is non-empty, the result type depends only on values:

julia> [rand(Bool) ? 1 : missing for _ in [""]]
 1-element Vector{Int64}:
- 1
source
Base.collectMethod
collect(element_type, collection)

Return an Array with the given element type of all items in a collection or iterable. The result has the same shape and number of dimensions as collection.

Examples

julia> collect(Float64, 1:2:5)
+ 1
source
Base.collectMethod
collect(element_type, collection)

Return an Array with the given element type of all items in a collection or iterable. The result has the same shape and number of dimensions as collection.

Examples

julia> collect(Float64, 1:2:5)
 3-element Vector{Float64}:
  1.0
  3.0
- 5.0
source
Base.filterFunction
filter(f, itr::SkipMissing{<:AbstractArray})

Return a vector similar to the array wrapped by the given SkipMissing iterator but with all missing elements and those for which f returns false removed.

Julia 1.2

This method requires Julia 1.2 or later.

Examples

julia> x = [1 2; missing 4]
+ 5.0
source
Base.filterFunction
filter(f, itr::SkipMissing{<:AbstractArray})

Return a vector similar to the array wrapped by the given SkipMissing iterator but with all missing elements and those for which f returns false removed.

Julia 1.2

This method requires Julia 1.2 or later.

Examples

julia> x = [1 2; missing 4]
 2×2 Matrix{Union{Missing, Int64}}:
  1         2
   missing  4
 
 julia> filter(isodd, skipmissing(x))
 1-element Vector{Int64}:
- 1
source
filter(f, d::AbstractDict)

Return a copy of d, removing elements for which f is false. The function f is passed key=>value pairs.

Examples

julia> d = Dict(1=>"a", 2=>"b")
+ 1
source
filter(f, d::AbstractDict)

Return a copy of d, removing elements for which f is false. The function f is passed key=>value pairs.

Examples

julia> d = Dict(1=>"a", 2=>"b")
 Dict{Int64, String} with 2 entries:
   2 => "b"
   1 => "a"
 
 julia> filter(p->isodd(p.first), d)
 Dict{Int64, String} with 1 entry:
-  1 => "a"
source
filter(f)

Create a function that filters its arguments with function f using filter, i.e. a function equivalent to x -> filter(f, x).

The returned function is of type Base.Fix1{typeof(filter)}, which can be used to implement specialized methods.

Examples

julia> (1, 2, Inf, 4, NaN, 6) |> filter(isfinite)
+  1 => "a"
source
filter(f)

Create a function that filters its arguments with function f using filter, i.e. a function equivalent to x -> filter(f, x).

The returned function is of type Base.Fix1{typeof(filter)}, which can be used to implement specialized methods.

Examples

julia> (1, 2, Inf, 4, NaN, 6) |> filter(isfinite)
 (1, 2, 4, 6)
 
 julia> map(filter(iseven), [1:3, 2:4, 3:5])
 3-element Vector{Vector{Int64}}:
  [2]
  [2, 4]
- [4]
Julia 1.9

This method requires at least Julia 1.9.

source
filter(f, a)

Return a copy of collection a, removing elements for which f is false. The function f is passed one argument.

Julia 1.4

Support for a as a tuple requires at least Julia 1.4.

See also: filter!, Iterators.filter.

Examples

julia> a = 1:10
+ [4]
Julia 1.9

This method requires at least Julia 1.9.

source
filter(f, a)

Return a copy of collection a, removing elements for which f is false. The function f is passed one argument.

Julia 1.4

Support for a as a tuple requires at least Julia 1.4.

See also: filter!, Iterators.filter.

Examples

julia> a = 1:10
 1:10
 
 julia> filter(isodd, a)
@@ -944,7 +944,7 @@
  3
  5
  7
- 9
source
Base.filter!Function
filter!(f, d::AbstractDict)

Update d, removing elements for which f is false. The function f is passed key=>value pairs.

Examples

julia> d = Dict(1=>"a", 2=>"b", 3=>"c")
+ 9
source
Base.filter!Function
filter!(f, d::AbstractDict)

Update d, removing elements for which f is false. The function f is passed key=>value pairs.

Examples

julia> d = Dict(1=>"a", 2=>"b", 3=>"c")
 Dict{Int64, String} with 3 entries:
   2 => "b"
   3 => "c"
@@ -953,13 +953,13 @@
 julia> filter!(p->isodd(p.first), d)
 Dict{Int64, String} with 2 entries:
   3 => "c"
-  1 => "a"
source
filter!(f, a)

Update collection a, removing elements for which f is false. The function f is passed one argument.

Examples

julia> filter!(isodd, Vector(1:10))
+  1 => "a"
source
filter!(f, a)

Update collection a, removing elements for which f is false. The function f is passed one argument.

Examples

julia> filter!(isodd, Vector(1:10))
 5-element Vector{Int64}:
  1
  3
  5
  7
- 9
source
Base.replaceMethod
replace(A, old_new::Pair...; [count::Integer])

Return a copy of collection A where, for each pair old=>new in old_new, all occurrences of old are replaced by new. Equality is determined using isequal. If count is specified, then replace at most count occurrences in total.

The element type of the result is chosen using promotion (see promote_type) based on the element type of A and on the types of the new values in pairs. If count is omitted and the element type of A is a Union, the element type of the result will not include singleton types which are replaced with values of a different type: for example, Union{T,Missing} will become T if missing is replaced.

See also replace!, splice!, delete!, insert!.

Julia 1.7

Version 1.7 is required to replace elements of a Tuple.

Examples

julia> replace([1, 2, 1, 3], 1=>0, 2=>4, count=2)
+ 9
source
Base.replaceMethod
replace(A, old_new::Pair...; [count::Integer])

Return a copy of collection A where, for each pair old=>new in old_new, all occurrences of old are replaced by new. Equality is determined using isequal. If count is specified, then replace at most count occurrences in total.

The element type of the result is chosen using promotion (see promote_type) based on the element type of A and on the types of the new values in pairs. If count is omitted and the element type of A is a Union, the element type of the result will not include singleton types which are replaced with values of a different type: for example, Union{T,Missing} will become T if missing is replaced.

See also replace!, splice!, delete!, insert!.

Julia 1.7

Version 1.7 is required to replace elements of a Tuple.

Examples

julia> replace([1, 2, 1, 3], 1=>0, 2=>4, count=2)
 4-element Vector{Int64}:
  0
  4
@@ -969,7 +969,7 @@
 julia> replace([1, missing], missing=>0)
 2-element Vector{Int64}:
  1
- 0
source
Base.replaceMethod
replace(new::Union{Function, Type}, A; [count::Integer])

Return a copy of A where each value x in A is replaced by new(x). If count is specified, then replace at most count values in total (replacements being defined as new(x) !== x).

Julia 1.7

Version 1.7 is required to replace elements of a Tuple.

Examples

julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
+ 0
source
Base.replaceMethod
replace(new::Union{Function, Type}, A; [count::Integer])

Return a copy of A where each value x in A is replaced by new(x). If count is specified, then replace at most count values in total (replacements being defined as new(x) !== x).

Julia 1.7

Version 1.7 is required to replace elements of a Tuple.

Examples

julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
 4-element Vector{Int64}:
  2
  2
@@ -981,7 +981,7 @@
        end
 Dict{Int64, Int64} with 2 entries:
   3 => 4
-  1 => 3
source
Base.replace!Function
replace!(new::Union{Function, Type}, A; [count::Integer])

Replace each element x in collection A by new(x). If count is specified, then replace at most count values in total (replacements being defined as new(x) !== x).

Examples

julia> replace!(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
+  1 => 3
source
Base.replace!Function
replace!(new::Union{Function, Type}, A; [count::Integer])

Replace each element x in collection A by new(x). If count is specified, then replace at most count values in total (replacements being defined as new(x) !== x).

Examples

julia> replace!(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
 4-element Vector{Int64}:
  2
  2
@@ -998,7 +998,7 @@
 julia> replace!(x->2x, Set([3, 6]))
 Set{Int64} with 2 elements:
   6
-  12
source
replace!(A, old_new::Pair...; [count::Integer])

For each pair old=>new in old_new, replace all occurrences of old in collection A by new. Equality is determined using isequal. If count is specified, then replace at most count occurrences in total. See also replace.

Examples

julia> replace!([1, 2, 1, 3], 1=>0, 2=>4, count=2)
+  12
source
replace!(A, old_new::Pair...; [count::Integer])

For each pair old=>new in old_new, replace all occurrences of old in collection A by new. Equality is determined using isequal. If count is specified, then replace at most count occurrences in total. See also replace.

Examples

julia> replace!([1, 2, 1, 3], 1=>0, 2=>4, count=2)
 4-element Vector{Int64}:
  0
  4
@@ -1009,7 +1009,7 @@
 Set{Int64} with 3 elements:
   0
   2
-  3
source
Base.restFunction
Base.rest(collection[, itr_state])

Generic function for taking the tail of collection, starting from a specific iteration state itr_state. Return a Tuple, if collection itself is a Tuple, a subtype of AbstractVector, if collection is an AbstractArray, a subtype of AbstractString if collection is an AbstractString, and an arbitrary iterator, falling back to Iterators.rest(collection[, itr_state]), otherwise.

Can be overloaded for user-defined collection types to customize the behavior of slurping in assignments in final position, like a, b... = collection.

Julia 1.6

Base.rest requires at least Julia 1.6.

See also: first, Iterators.rest, Base.split_rest.

Examples

julia> a = [1 2; 3 4]
+  3
source
Base.restFunction
Base.rest(collection[, itr_state])

Generic function for taking the tail of collection, starting from a specific iteration state itr_state. Return a Tuple, if collection itself is a Tuple, a subtype of AbstractVector, if collection is an AbstractArray, a subtype of AbstractString if collection is an AbstractString, and an arbitrary iterator, falling back to Iterators.rest(collection[, itr_state]), otherwise.

Can be overloaded for user-defined collection types to customize the behavior of slurping in assignments in final position, like a, b... = collection.

Julia 1.6

Base.rest requires at least Julia 1.6.

See also: first, Iterators.rest, Base.split_rest.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1018,7 +1018,7 @@
 (1, 2)
 
 julia> first, Base.rest(a, state)
-(1, [3, 2, 4])
source
Base.split_restFunction
Base.split_rest(collection, n::Int[, itr_state]) -> (rest_but_n, last_n)

Generic function for splitting the tail of collection, starting from a specific iteration state itr_state. Returns a tuple of two new collections. The first one contains all elements of the tail but the n last ones, which make up the second collection.

The type of the first collection generally follows that of Base.rest, except that the fallback case is not lazy, but is collected eagerly into a vector.

Can be overloaded for user-defined collection types to customize the behavior of slurping in assignments in non-final position, like a, b..., c = collection.

Julia 1.9

Base.split_rest requires at least Julia 1.9.

See also: Base.rest.

Examples

julia> a = [1 2; 3 4]
+(1, [3, 2, 4])
source
Base.split_restFunction
Base.split_rest(collection, n::Int[, itr_state]) -> (rest_but_n, last_n)

Generic function for splitting the tail of collection, starting from a specific iteration state itr_state. Returns a tuple of two new collections. The first one contains all elements of the tail but the n last ones, which make up the second collection.

The type of the first collection generally follows that of Base.rest, except that the fallback case is not lazy, but is collected eagerly into a vector.

Can be overloaded for user-defined collection types to customize the behavior of slurping in assignments in non-final position, like a, b..., c = collection.

Julia 1.9

Base.split_rest requires at least Julia 1.9.

See also: Base.rest.

Examples

julia> a = [1 2; 3 4]
 2×2 Matrix{Int64}:
  1  2
  3  4
@@ -1027,36 +1027,36 @@
 (1, 2)
 
 julia> first, Base.split_rest(a, 1, state)
-(1, ([3, 2], [4]))
source

Indexable Collections

Base.getindexFunction
getindex(collection, key...)

Retrieve the value(s) stored at the given key or index within a collection. The syntax a[i,j,...] is converted by the compiler to getindex(a, i, j, ...).

See also get, keys, eachindex.

Examples

julia> A = Dict("a" => 1, "b" => 2)
+(1, ([3, 2], [4]))
source

Indexable Collections

Base.getindexFunction
getindex(collection, key...)

Retrieve the value(s) stored at the given key or index within a collection. The syntax a[i,j,...] is converted by the compiler to getindex(a, i, j, ...).

See also get, keys, eachindex.

Examples

julia> A = Dict("a" => 1, "b" => 2)
 Dict{String, Int64} with 2 entries:
   "b" => 2
   "a" => 1
 
 julia> getindex(A, "a")
-1
source
Base.setindex!Function
setindex!(collection, value, key...)

Store the given value at the given key or index within a collection. The syntax a[i,j,...] = x is converted by the compiler to (setindex!(a, x, i, j, ...); x).

Examples

julia> a = Dict("a"=>1)
+1
source
Base.setindex!Function
setindex!(collection, value, key...)

Store the given value at the given key or index within a collection. The syntax a[i,j,...] = x is converted by the compiler to (setindex!(a, x, i, j, ...); x).

Examples

julia> a = Dict("a"=>1)
 Dict{String, Int64} with 1 entry:
   "a" => 1
 
 julia> setindex!(a, 2, "b")
 Dict{String, Int64} with 2 entries:
   "b" => 2
-  "a" => 1
source
Base.firstindexFunction
firstindex(collection) -> Integer
 firstindex(collection, d) -> Integer

Return the first index of collection. If d is given, return the first index of collection along dimension d.

The syntaxes A[begin] and A[1, begin] lower to A[firstindex(A)] and A[1, firstindex(A, 2)], respectively.

See also: first, axes, lastindex, nextind.

Examples

julia> firstindex([1,2,4])
 1
 
 julia> firstindex(rand(3,4,5), 2)
-1
source
Base.lastindexFunction
lastindex(collection) -> Integer
 lastindex(collection, d) -> Integer

Return the last index of collection. If d is given, return the last index of collection along dimension d.

The syntaxes A[end] and A[end, end] lower to A[lastindex(A)] and A[lastindex(A, 1), lastindex(A, 2)], respectively.

See also: axes, firstindex, eachindex, prevind.

Examples

julia> lastindex([1,2,4])
 3
 
 julia> lastindex(rand(3,4,5), 2)
-4
source

Fully implemented by:

Partially implemented by:

Dictionaries

Dict is the standard dictionary. Its implementation uses hash as the hashing function for the key, and isequal to determine equality. Define these two functions for custom types to override how they are stored in a hash table.

IdDict is a special hash table where the keys are always object identities.

WeakKeyDict is a hash table implementation where the keys are weak references to objects, and thus may be garbage collected even when referenced in a hash table. Like Dict it uses hash for hashing and isequal for equality, unlike Dict it does not convert keys on insertion.

Dicts can be created by passing pair objects constructed with => to a Dict constructor: Dict("A"=>1, "B"=>2). This call will attempt to infer type information from the keys and values (i.e. this example creates a Dict{String, Int64}). To explicitly specify types use the syntax Dict{KeyType,ValueType}(...). For example, Dict{String,Int32}("A"=>1, "B"=>2).

Dictionaries may also be created with generators. For example, Dict(i => f(i) for i = 1:10).

Given a dictionary D, the syntax D[x] returns the value of key x (if it exists) or throws an error, and D[x] = y stores the key-value pair x => y in D (replacing any existing value for the key x). Multiple arguments to D[...] are converted to tuples; for example, the syntax D[x,y] is equivalent to D[(x,y)], i.e. it refers to the value keyed by the tuple (x,y).

Base.AbstractDictType
AbstractDict{K, V}

Supertype for dictionary-like types with keys of type K and values of type V. Dict, IdDict and other types are subtypes of this. An AbstractDict{K, V} should be an iterator of Pair{K, V}.

source
Base.DictType
Dict([itr])

Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

Given a single iterable argument, constructs a Dict whose key-value pairs are taken from 2-tuples (key,value) generated by the argument.

Examples

julia> Dict([("A", 1), ("B", 2)])
+4
source

Fully implemented by:

Partially implemented by:

Dictionaries

Dict is the standard dictionary. Its implementation uses hash as the hashing function for the key, and isequal to determine equality. Define these two functions for custom types to override how they are stored in a hash table.

IdDict is a special hash table where the keys are always object identities.

WeakKeyDict is a hash table implementation where the keys are weak references to objects, and thus may be garbage collected even when referenced in a hash table. Like Dict it uses hash for hashing and isequal for equality, unlike Dict it does not convert keys on insertion.

Dicts can be created by passing pair objects constructed with => to a Dict constructor: Dict("A"=>1, "B"=>2). This call will attempt to infer type information from the keys and values (i.e. this example creates a Dict{String, Int64}). To explicitly specify types use the syntax Dict{KeyType,ValueType}(...). For example, Dict{String,Int32}("A"=>1, "B"=>2).

Dictionaries may also be created with generators. For example, Dict(i => f(i) for i = 1:10).

Given a dictionary D, the syntax D[x] returns the value of key x (if it exists) or throws an error, and D[x] = y stores the key-value pair x => y in D (replacing any existing value for the key x). Multiple arguments to D[...] are converted to tuples; for example, the syntax D[x,y] is equivalent to D[(x,y)], i.e. it refers to the value keyed by the tuple (x,y).

Base.AbstractDictType
AbstractDict{K, V}

Supertype for dictionary-like types with keys of type K and values of type V. Dict, IdDict and other types are subtypes of this. An AbstractDict{K, V} should be an iterator of Pair{K, V}.

source
Base.DictType
Dict([itr])

Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

Given a single iterable argument, constructs a Dict whose key-value pairs are taken from 2-tuples (key,value) generated by the argument.

Examples

julia> Dict([("A", 1), ("B", 2)])
 Dict{String, Int64} with 2 entries:
   "B" => 2
   "A" => 1

Alternatively, a sequence of pair arguments may be passed.

julia> Dict("A"=>1, "B"=>2)
 Dict{String, Int64} with 2 entries:
   "B" => 2
-  "A" => 1
Warning

Keys are allowed to be mutable, but if you do mutate stored keys, the hash table may become internally inconsistent, in which case the Dict will not work properly. IdDict can be an alternative if you need to mutate keys.

source
Base.IdDictType
IdDict([itr])

IdDict{K,V}() constructs a hash table using objectid as hash and === as equality with keys of type K and values of type V. See Dict for further help and IdSet for the set version of this.

In the example below, the Dict keys are all isequal and therefore get hashed the same, so they get overwritten. The IdDict hashes by object-id, and thus preserves the 3 different keys.

Examples

julia> Dict(true => "yes", 1 => "no", 1.0 => "maybe")
+  "A" => 1
Warning

Keys are allowed to be mutable, but if you do mutate stored keys, the hash table may become internally inconsistent, in which case the Dict will not work properly. IdDict can be an alternative if you need to mutate keys.

source
Base.IdDictType
IdDict([itr])

IdDict{K,V}() constructs a hash table using objectid as hash and === as equality with keys of type K and values of type V. See Dict for further help and IdSet for the set version of this.

In the example below, the Dict keys are all isequal and therefore get hashed the same, so they get overwritten. The IdDict hashes by object-id, and thus preserves the 3 different keys.

Examples

julia> Dict(true => "yes", 1 => "no", 1.0 => "maybe")
 Dict{Real, String} with 1 entry:
   1.0 => "maybe"
 
@@ -1064,7 +1064,7 @@
 IdDict{Any, String} with 3 entries:
   true => "yes"
   1.0  => "maybe"
-  1    => "no"
source
Base.WeakKeyDictType
WeakKeyDict([itr])

WeakKeyDict() constructs a hash table where the keys are weak references to objects which may be garbage collected even when referenced in a hash table.

See Dict for further help. Note, unlike Dict, WeakKeyDict does not convert keys on insertion, as this would imply the key object was unreferenced anywhere before insertion.

See also WeakRef.

source
Base.ImmutableDictType
ImmutableDict

ImmutableDict is a dictionary implemented as an immutable linked list, which is optimal for small dictionaries that are constructed over many individual insertions. Note that it is not possible to remove a value, although it can be partially overridden and hidden by inserting a new value with the same key.

ImmutableDict(KV::Pair)

Create a new entry in the ImmutableDict for a key => value pair

  • use (key => value) in dict to see if this particular combination is in the properties set
  • use get(dict, key, default) to retrieve the most recent value for a particular key
source
Base.PersistentDictType
PersistentDict

PersistentDict is a dictionary implemented as an hash array mapped trie, which is optimal for situations where you need persistence, each operation returns a new dictionary separate from the previous one, but the underlying implementation is space-efficient and may share storage across multiple separate dictionaries.

Note

It behaves like an IdDict.

PersistentDict(KV::Pair)

Examples

julia> dict = Base.PersistentDict(:a=>1)
+  1    => "no"
source
Base.WeakKeyDictType
WeakKeyDict([itr])

WeakKeyDict() constructs a hash table where the keys are weak references to objects which may be garbage collected even when referenced in a hash table.

See Dict for further help. Note, unlike Dict, WeakKeyDict does not convert keys on insertion, as this would imply the key object was unreferenced anywhere before insertion.

See also WeakRef.

source
Base.ImmutableDictType
ImmutableDict

ImmutableDict is a dictionary implemented as an immutable linked list, which is optimal for small dictionaries that are constructed over many individual insertions. Note that it is not possible to remove a value, although it can be partially overridden and hidden by inserting a new value with the same key.

ImmutableDict(KV::Pair)

Create a new entry in the ImmutableDict for a key => value pair

  • use (key => value) in dict to see if this particular combination is in the properties set
  • use get(dict, key, default) to retrieve the most recent value for a particular key
source
Base.PersistentDictType
PersistentDict

PersistentDict is a dictionary implemented as an hash array mapped trie, which is optimal for situations where you need persistence, each operation returns a new dictionary separate from the previous one, but the underlying implementation is space-efficient and may share storage across multiple separate dictionaries.

Note

It behaves like an IdDict.

PersistentDict(KV::Pair)

Examples

julia> dict = Base.PersistentDict(:a=>1)
 Base.PersistentDict{Symbol, Int64} with 1 entry:
   :a => 1
 
@@ -1073,7 +1073,7 @@
 
 julia> dict3 = Base.PersistentDict(dict, :a=>2)
 Base.PersistentDict{Symbol, Int64} with 1 entry:
-  :a => 2
source
Base.haskeyFunction
haskey(collection, key) -> Bool

Determine whether a collection has a mapping for a given key.

Examples

julia> D = Dict('a'=>2, 'b'=>3)
+  :a => 2
source
Base.haskeyFunction
haskey(collection, key) -> Bool

Determine whether a collection has a mapping for a given key.

Examples

julia> D = Dict('a'=>2, 'b'=>3)
 Dict{Char, Int64} with 2 entries:
   'a' => 2
   'b' => 3
@@ -1082,16 +1082,16 @@
 true
 
 julia> haskey(D, 'c')
-false
source
Base.getFunction
get(f::Union{Function, Type}, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, return f(). Use get! to also store the default value in the dictionary.

This is intended to be called using do block syntax

get(dict, key) do
+false
source
Base.getFunction
get(f::Union{Function, Type}, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, return f(). Use get! to also store the default value in the dictionary.

This is intended to be called using do block syntax

get(dict, key) do
     # default value calculated here
     time()
-end
source
get(collection, key, default)

Return the value stored for the given key, or the given default value if no mapping for the key is present.

Julia 1.7

For tuples and numbers, this function requires at least Julia 1.7.

Examples

julia> d = Dict("a"=>1, "b"=>2);
+end
source
get(collection, key, default)

Return the value stored for the given key, or the given default value if no mapping for the key is present.

Julia 1.7

For tuples and numbers, this function requires at least Julia 1.7.

Examples

julia> d = Dict("a"=>1, "b"=>2);
 
 julia> get(d, "a", 3)
 1
 
 julia> get(d, "c", 3)
-3
source
Base.get!Function
get!(f::Union{Function, Type}, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, store key => f(), and return f().

This is intended to be called using do block syntax.

Examples

julia> squares = Dict{Int, Int}();
+3
source
Base.get!Function
get!(f::Union{Function, Type}, collection, key)

Return the value stored for the given key, or if no mapping for the key is present, store key => f(), and return f().

This is intended to be called using do block syntax.

Examples

julia> squares = Dict{Int, Int}();
 
 julia> function get_square!(d, i)
            get!(d, i) do
@@ -1105,7 +1105,7 @@
 
 julia> squares
 Dict{Int64, Int64} with 1 entry:
-  2 => 4
source
get!(collection, key, default)

Return the value stored for the given key, or if no mapping for the key is present, store key => default, and return default.

Examples

julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
+  2 => 4
source
get!(collection, key, default)

Return the value stored for the given key, or if no mapping for the key is present, store key => default, and return default.

Examples

julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
 
 julia> get!(d, "a", 5)
 1
@@ -1118,7 +1118,7 @@
   "c" => 3
   "b" => 2
   "a" => 1
-  "d" => 4
source
Base.getkeyFunction
getkey(collection, key, default)

Return the key matching argument key if one exists in collection, otherwise return default.

Examples

julia> D = Dict('a'=>2, 'b'=>3)
+  "d" => 4
source
Base.getkeyFunction
getkey(collection, key, default)

Return the key matching argument key if one exists in collection, otherwise return default.

Examples

julia> D = Dict('a'=>2, 'b'=>3)
 Dict{Char, Int64} with 2 entries:
   'a' => 2
   'b' => 3
@@ -1127,7 +1127,7 @@
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
 
 julia> getkey(D, 'd', 'a')
-'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
source
Base.delete!Function
delete!(collection, key)

Delete the mapping for the given key in a collection, if any, and return the collection.

Examples

julia> d = Dict("a"=>1, "b"=>2)
+'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
source
Base.delete!Function
delete!(collection, key)

Delete the mapping for the given key in a collection, if any, and return the collection.

Examples

julia> d = Dict("a"=>1, "b"=>2)
 Dict{String, Int64} with 2 entries:
   "b" => 2
   "a" => 1
@@ -1138,7 +1138,7 @@
 
 julia> delete!(d, "b") # d is left unchanged
 Dict{String, Int64} with 1 entry:
-  "a" => 1
source
Base.pop!Method
pop!(collection, key[, default])

Delete and return the mapping for key if it exists in collection, otherwise return default, or throw an error if default is not specified.

Examples

julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
+  "a" => 1
source
Base.pop!Method
pop!(collection, key[, default])

Delete and return the mapping for key if it exists in collection, otherwise return default, or throw an error if default is not specified.

Examples

julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
 
 julia> pop!(d, "a")
 1
@@ -1149,7 +1149,7 @@
 [...]
 
 julia> pop!(d, "e", 4)
-4
source
Base.keysFunction
keys(iterator)

For an iterator or collection that has keys and values (e.g. arrays and dictionaries), return an iterator over the keys.

source
Base.valuesFunction
values(a::AbstractDict)

Return an iterator over all values in a collection. collect(values(a)) returns an array of values. When the values are stored internally in a hash table, as is the case for Dict, the order in which they are returned may vary. But keys(a), values(a) and pairs(a) all iterate a and return the elements in the same order.

Examples

julia> D = Dict('a'=>2, 'b'=>3)
+4
source
Base.keysFunction
keys(iterator)

For an iterator or collection that has keys and values (e.g. arrays and dictionaries), return an iterator over the keys.

source
Base.valuesFunction
values(a::AbstractDict)

Return an iterator over all values in a collection. collect(values(a)) returns an array of values. When the values are stored internally in a hash table, as is the case for Dict, the order in which they are returned may vary. But keys(a), values(a) and pairs(a) all iterate a and return the elements in the same order.

Examples

julia> D = Dict('a'=>2, 'b'=>3)
 Dict{Char, Int64} with 2 entries:
   'a' => 2
   'b' => 3
@@ -1157,7 +1157,7 @@
 julia> collect(values(D))
 2-element Vector{Int64}:
  2
- 3
source
values(iterator)

For an iterator or collection that has keys and values, return an iterator over the values. This function simply returns its argument by default, since the elements of a general iterator are normally considered its "values".

Examples

julia> d = Dict("a"=>1, "b"=>2);
+ 3
source
values(iterator)

For an iterator or collection that has keys and values, return an iterator over the values. This function simply returns its argument by default, since the elements of a general iterator are normally considered its "values".

Examples

julia> d = Dict("a"=>1, "b"=>2);
 
 julia> values(d)
 ValueIterator for a Dict{String, Int64} with 2 entries. Values:
@@ -1166,7 +1166,7 @@
 
 julia> values([2])
 1-element Vector{Int64}:
- 2
source
Base.pairsFunction
pairs(IndexLinear(), A)
 pairs(IndexCartesian(), A)
 pairs(IndexStyle(A), A)

An iterator that accesses each element of the array A, returning i => x, where i is the index for the element and x = A[i]. Identical to pairs(A), except that the style of index can be selected. Also similar to enumerate(A), except i will be a valid index for A, while enumerate always counts from 1 regardless of the indices of A.

Specifying IndexLinear() ensures that i will be an integer; specifying IndexCartesian() ensures that i will be a Base.CartesianIndex; specifying IndexStyle(A) chooses whichever has been defined as the native indexing style for array A.

Mutation of the bounds of the underlying array will invalidate this iterator.

Examples

julia> A = ["a" "d"; "b" "e"; "c" "f"];
 
@@ -1188,7 +1188,7 @@
 CartesianIndex(1, 1) a
 CartesianIndex(2, 1) b
 CartesianIndex(1, 2) d
-CartesianIndex(2, 2) e

See also IndexStyle, axes.

source
pairs(collection)

Return an iterator over key => value pairs for any collection that maps a set of keys to a set of values. This includes arrays, where the keys are the array indices. When the entries are stored internally in a hash table, as is the case for Dict, the order in which they are returned may vary. But keys(a), values(a) and pairs(a) all iterate a and return the elements in the same order.

Examples

julia> a = Dict(zip(["a", "b", "c"], [1, 2, 3]))
+CartesianIndex(2, 2) e

See also IndexStyle, axes.

source
pairs(collection)

Return an iterator over key => value pairs for any collection that maps a set of keys to a set of values. This includes arrays, where the keys are the array indices. When the entries are stored internally in a hash table, as is the case for Dict, the order in which they are returned may vary. But keys(a), values(a) and pairs(a) all iterate a and return the elements in the same order.

Examples

julia> a = Dict(zip(["a", "b", "c"], [1, 2, 3]))
 Dict{String, Int64} with 3 entries:
   "c" => 3
   "b" => 2
@@ -1215,10 +1215,10 @@
 3-element Vector{Int64}:
  1
  2
- 3
source
Base.mergeFunction
merge(initial::Face, others::Face...)

Merge the properties of the initial face and others, with later faces taking priority.

merge(a::NamedTuple, iterable)

Interpret an iterable of key-value pairs as a named tuple, and perform a merge.

julia> merge((a=1, b=2, c=3), [:b=>4, :d=>5])
-(a = 1, b = 4, c = 3, d = 5)
source
merge(a::NamedTuple, bs::NamedTuple...)

Construct a new named tuple by merging two or more existing ones, in a left-associative manner. Merging proceeds left-to-right, between pairs of named tuples, and so the order of fields present in both the leftmost and rightmost named tuples take the same position as they are found in the leftmost named tuple. However, values are taken from matching fields in the rightmost named tuple that contains that field. Fields present in only the rightmost named tuple of a pair are appended at the end. A fallback is implemented for when only a single named tuple is supplied, with signature merge(a::NamedTuple).

Julia 1.1

Merging 3 or more NamedTuple requires at least Julia 1.1.

Examples

julia> merge((a=1, b=2, c=3), (b=4, d=5))
+ 3
source
Base.mergeFunction
merge(initial::Face, others::Face...)

Merge the properties of the initial face and others, with later faces taking priority.

merge(a::NamedTuple, iterable)

Interpret an iterable of key-value pairs as a named tuple, and perform a merge.

julia> merge((a=1, b=2, c=3), [:b=>4, :d=>5])
+(a = 1, b = 4, c = 3, d = 5)
source
merge(a::NamedTuple, bs::NamedTuple...)

Construct a new named tuple by merging two or more existing ones, in a left-associative manner. Merging proceeds left-to-right, between pairs of named tuples, and so the order of fields present in both the leftmost and rightmost named tuples take the same position as they are found in the leftmost named tuple. However, values are taken from matching fields in the rightmost named tuple that contains that field. Fields present in only the rightmost named tuple of a pair are appended at the end. A fallback is implemented for when only a single named tuple is supplied, with signature merge(a::NamedTuple).

Julia 1.1

Merging 3 or more NamedTuple requires at least Julia 1.1.

Examples

julia> merge((a=1, b=2, c=3), (b=4, d=5))
 (a = 1, b = 4, c = 3, d = 5)
julia> merge((a=1, b=2), (b=3, c=(d=1,)), (c=(d=2,),))
-(a = 1, b = 3, c = (d = 2,))
source
merge(d::AbstractDict, others::AbstractDict...)

Construct a merged collection from the given collections. If necessary, the types of the resulting collection will be promoted to accommodate the types of the merged collections. If the same key is present in another collection, the value for that key will be the value it has in the last collection listed. See also mergewith for custom handling of values with the same key.

Examples

julia> a = Dict("foo" => 0.0, "bar" => 42.0)
+(a = 1, b = 3, c = (d = 2,))
source
merge(d::AbstractDict, others::AbstractDict...)

Construct a merged collection from the given collections. If necessary, the types of the resulting collection will be promoted to accommodate the types of the merged collections. If the same key is present in another collection, the value for that key will be the value it has in the last collection listed. See also mergewith for custom handling of values with the same key.

Examples

julia> a = Dict("foo" => 0.0, "bar" => 42.0)
 Dict{String, Float64} with 2 entries:
   "bar" => 42.0
   "foo" => 0.0
@@ -1238,7 +1238,7 @@
 Dict{String, Float64} with 3 entries:
   "bar" => 42.0
   "baz" => 17.0
-  "foo" => 0.0
source
Base.mergewithFunction
mergewith(combine, d::AbstractDict, others::AbstractDict...)
+  "foo" => 0.0
source
Base.mergewithFunction
mergewith(combine, d::AbstractDict, others::AbstractDict...)
 mergewith(combine)
 merge(combine, d::AbstractDict, others::AbstractDict...)

Construct a merged collection from the given collections. If necessary, the types of the resulting collection will be promoted to accommodate the types of the merged collections. Values with the same key will be combined using the combiner function. The curried form mergewith(combine) returns the function (args...) -> mergewith(combine, args...).

Method merge(combine::Union{Function,Type}, args...) as an alias of mergewith(combine, args...) is still available for backward compatibility.

Julia 1.5

mergewith requires Julia 1.5 or later.

Examples

julia> a = Dict("foo" => 0.0, "bar" => 42.0)
 Dict{String, Float64} with 2 entries:
@@ -1261,7 +1261,7 @@
 
 julia> mergewith(-, Dict(), Dict(:a=>1))  # Combining function only used if key is present in both
 Dict{Any, Any} with 1 entry:
-  :a => 1
source
Base.merge!Function
merge!(d::AbstractDict, others::AbstractDict...)

Update collection with pairs from the other collections. See also merge.

Examples

julia> d1 = Dict(1 => 2, 3 => 4);
+  :a => 1
source
Base.merge!Function
merge!(d::AbstractDict, others::AbstractDict...)

Update collection with pairs from the other collections. See also merge.

Examples

julia> d1 = Dict(1 => 2, 3 => 4);
 
 julia> d2 = Dict(1 => 4, 4 => 5);
 
@@ -1271,7 +1271,7 @@
 Dict{Int64, Int64} with 3 entries:
   4 => 5
   3 => 4
-  1 => 4
source
Base.mergewith!Function
mergewith!(combine, d::AbstractDict, others::AbstractDict...) -> d
+  1 => 4
source
Base.mergewith!Function
mergewith!(combine, d::AbstractDict, others::AbstractDict...) -> d
 mergewith!(combine)
 merge!(combine, d::AbstractDict, others::AbstractDict...) -> d

Update collection with pairs from the other collections. Values with the same key will be combined using the combiner function. The curried form mergewith!(combine) returns the function (args...) -> mergewith!(combine, args...).

Method merge!(combine::Union{Function,Type}, args...) as an alias of mergewith!(combine, args...) is still available for backward compatibility.

Julia 1.5

mergewith! requires Julia 1.5 or later.

Examples

julia> d1 = Dict(1 => 2, 3 => 4);
 
@@ -1297,16 +1297,16 @@
 Dict{Int64, Int64} with 3 entries:
   4 => 5
   3 => 0
-  1 => 4
source
Base.sizehint!Function
sizehint!(s, n; first::Bool=false, shrink::Bool=true) -> s

Suggest that collection s reserve capacity for at least n elements. That is, if you expect that you're going to have to push a lot of values onto s, you can avoid the cost of incremental reallocation by doing it once up front; this can improve performance.

If first is true, then any additional space is reserved before the start of the collection. This way, subsequent calls to pushfirst! (instead of push!) may become faster. Supplying this keyword may result in an error if the collection is not ordered or if pushfirst! is not supported for this collection.

If shrink=true (the default), the collection's capacity may be reduced if its current capacity is greater than n.

See also resize!.

Notes on the performance model

For types that support sizehint!,

  1. push! and append! methods generally may (but are not required to) preallocate extra storage. For types implemented in Base, they typically do, using a heuristic optimized for a general use case.

  2. sizehint! may control this preallocation. Again, it typically does this for types in Base.

  3. empty! is nearly costless (and O(1)) for types that support this kind of preallocation.

Julia 1.11

The shrink and first arguments were added in Julia 1.11.

source
Base.keytypeFunction
keytype(type)

Get the key type of a dictionary type. Behaves similarly to eltype.

Examples

julia> keytype(Dict(Int32(1) => "foo"))
-Int32
source
keytype(T::Type{<:AbstractArray})
+  1 => 4
source
Base.sizehint!Function
sizehint!(s, n; first::Bool=false, shrink::Bool=true) -> s

Suggest that collection s reserve capacity for at least n elements. That is, if you expect that you're going to have to push a lot of values onto s, you can avoid the cost of incremental reallocation by doing it once up front; this can improve performance.

If first is true, then any additional space is reserved before the start of the collection. This way, subsequent calls to pushfirst! (instead of push!) may become faster. Supplying this keyword may result in an error if the collection is not ordered or if pushfirst! is not supported for this collection.

If shrink=true (the default), the collection's capacity may be reduced if its current capacity is greater than n.

See also resize!.

Notes on the performance model

For types that support sizehint!,

  1. push! and append! methods generally may (but are not required to) preallocate extra storage. For types implemented in Base, they typically do, using a heuristic optimized for a general use case.

  2. sizehint! may control this preallocation. Again, it typically does this for types in Base.

  3. empty! is nearly costless (and O(1)) for types that support this kind of preallocation.

Julia 1.11

The shrink and first arguments were added in Julia 1.11.

source
Base.keytypeFunction
keytype(type)

Get the key type of a dictionary type. Behaves similarly to eltype.

Examples

julia> keytype(Dict(Int32(1) => "foo"))
+Int32
source
keytype(T::Type{<:AbstractArray})
 keytype(A::AbstractArray)

Return the key type of an array. This is equal to the eltype of the result of keys(...), and is provided mainly for compatibility with the dictionary interface.

Examples

julia> keytype([1, 2, 3]) == Int
 true
 
 julia> keytype([1 2; 3 4])
-CartesianIndex{2}
Julia 1.2

For arrays, this function requires at least Julia 1.2.

source
Base.valtypeFunction
valtype(type)

Get the value type of a dictionary type. Behaves similarly to eltype.

Examples

julia> valtype(Dict(Int32(1) => "foo"))
-String
source
valtype(T::Type{<:AbstractArray})
+CartesianIndex{2}
Julia 1.2

For arrays, this function requires at least Julia 1.2.

source
Base.valtypeFunction
valtype(type)

Get the value type of a dictionary type. Behaves similarly to eltype.

Examples

julia> valtype(Dict(Int32(1) => "foo"))
+String
source
valtype(T::Type{<:AbstractArray})
 valtype(A::AbstractArray)

Return the value type of an array. This is identical to eltype and is provided mainly for compatibility with the dictionary interface.

Examples

julia> valtype(["one", "two", "three"])
-String
Julia 1.2

For arrays, this function requires at least Julia 1.2.

source

Fully implemented by:

Partially implemented by:

Set-Like Collections

Base.SetType
Set{T} <: AbstractSet{T}

Sets are mutable containers that provide fast membership testing.

Sets have efficient implementations of set operations such as in, union and intersect. Elements in a Set are unique, as determined by the elements' definition of isequal. The order of elements in a Set is an implementation detail and cannot be relied on.

See also: AbstractSet, BitSet, Dict, push!, empty!, union!, in, isequal

Examples

julia> s = Set("aaBca")
+String
Julia 1.2

For arrays, this function requires at least Julia 1.2.

source

Fully implemented by:

Partially implemented by:

Set-Like Collections

Base.SetType
Set{T} <: AbstractSet{T}

Sets are mutable containers that provide fast membership testing.

Sets have efficient implementations of set operations such as in, union and intersect. Elements in a Set are unique, as determined by the elements' definition of isequal. The order of elements in a Set is an implementation detail and cannot be relied on.

See also: AbstractSet, BitSet, Dict, push!, empty!, union!, in, isequal

Examples

julia> s = Set("aaBca")
 Set{Char} with 3 elements:
   'a'
   'c'
@@ -1325,7 +1325,7 @@
 false
 
 julia> NaN in s # isequal(NaN, NaN) is true
-true
source
Base.BitSetType
BitSet([itr])

Construct a sorted set of Ints generated by the given iterable object, or an empty set. Implemented as a bit string, and therefore designed for dense integer sets. If the set will be sparse (for example, holding a few very large integers), use Set instead.

source
Base.BitSetType
BitSet([itr])

Construct a sorted set of Ints generated by the given iterable object, or an empty set. Implemented as a bit string, and therefore designed for dense integer sets. If the set will be sparse (for example, holding a few very large integers), use Set instead.

source
Base.IdSetType
IdSet{T}([itr])
 IdSet()

IdSet{T}() constructs a set (see Set) using === as equality with values of type T.

In the example below, the values are all isequal so they get overwritten in the ordinary Set. The IdSet compares by === and so preserves the 3 different values.

Examples

julia> Set(Any[true, 1, 1.0])
 Set{Any} with 1 element:
   1.0
@@ -1334,7 +1334,7 @@
 IdSet{Any} with 3 elements:
   1.0
   1
-  true
source
Base.unionFunction
union(s, itrs...)
 ∪(s, itrs...)

Construct an object containing all distinct elements from all of the arguments.

The first argument controls what kind of container is returned. If this is an array, it maintains the order in which elements first appear.

Unicode can be typed by writing \cup then pressing tab in the Julia REPL, and in many editors. This is an infix operator, allowing s ∪ itr.

See also unique, intersect, isdisjoint, vcat, Iterators.flatten.

Examples

julia> union([1, 2], [3])
 3-element Vector{Int64}:
  1
@@ -1358,7 +1358,7 @@
 Set{Int64} with 3 elements:
   2
   3
-  1
source
Base.union!Function
union!(s::IntDisjointSet{T}, x::T, y::T)

Merge the subset containing x and that containing y into one and return the root of the new set.

source
union!(s::Union{AbstractSet,AbstractVector}, itrs...)

Construct the union of passed in sets and overwrite s with the result. Maintain order with arrays.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> a = Set([3, 4, 5]);
+  1
source
Base.union!Function
union!(s::IntDisjointSet{T}, x::T, y::T)

Merge the subset containing x and that containing y into one and return the root of the new set.

source
union!(s::Union{AbstractSet,AbstractVector}, itrs...)

Construct the union of passed in sets and overwrite s with the result. Maintain order with arrays.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> a = Set([3, 4, 5]);
 
 julia> union!(a, 1:2:7);
 
@@ -1368,7 +1368,7 @@
   4
   7
   3
-  1
source
Base.intersectFunction
intersect(s, itrs...)
 ∩(s, itrs...)

Construct the set containing those elements which appear in all of the arguments.

The first argument controls what kind of container is returned. If this is an array, it maintains the order in which elements first appear.

Unicode can be typed by writing \cap then pressing tab in the Julia REPL, and in many editors. This is an infix operator, allowing s ∩ itr.

See also setdiff, isdisjoint, issubset, issetequal.

Julia 1.8

As of Julia 1.8 intersect returns a result with the eltype of the type-promoted eltypes of the two inputs

Examples

julia> intersect([1, 2, 3], [3, 4, 5])
 1-element Vector{Int64}:
  3
@@ -1387,23 +1387,23 @@
 
 julia> intersect(Set([1, 2]), BitSet([2, 3]), 1.0:10.0)
 Set{Float64} with 1 element:
-  2.0
source
Base.setdiffFunction
setdiff(s, itrs...)

Construct the set of elements in s but not in any of the iterables in itrs. Maintain order with arrays.

See also setdiff!, union and intersect.

Examples

julia> setdiff([1,2,3], [3,4,5])
+  2.0
source
Base.setdiffFunction
setdiff(s, itrs...)

Construct the set of elements in s but not in any of the iterables in itrs. Maintain order with arrays.

See also setdiff!, union and intersect.

Examples

julia> setdiff([1,2,3], [3,4,5])
 2-element Vector{Int64}:
  1
- 2
source
Base.setdiff!Function
setdiff!(s, itrs...)

Remove from set s (in-place) each element of each iterable from itrs. Maintain order with arrays.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> a = Set([1, 3, 4, 5]);
+ 2
source
Base.setdiff!Function
setdiff!(s, itrs...)

Remove from set s (in-place) each element of each iterable from itrs. Maintain order with arrays.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> a = Set([1, 3, 4, 5]);
 
 julia> setdiff!(a, 1:2:6);
 
 julia> a
 Set{Int64} with 1 element:
-  4
source
Base.symdiffFunction
symdiff(s, itrs...)

Construct the symmetric difference of elements in the passed in sets. When s is not an AbstractSet, the order is maintained.

See also symdiff!, setdiff, union and intersect.

Examples

julia> symdiff([1,2,3], [3,4,5], [4,5,6])
+  4
source
Base.symdiffFunction
symdiff(s, itrs...)

Construct the symmetric difference of elements in the passed in sets. When s is not an AbstractSet, the order is maintained.

See also symdiff!, setdiff, union and intersect.

Examples

julia> symdiff([1,2,3], [3,4,5], [4,5,6])
 3-element Vector{Int64}:
  1
  2
  6
 
 julia> symdiff([1,2,1], [2, 1, 2])
-Int64[]
source
Base.symdiff!Function
symdiff!(s::Union{AbstractSet,AbstractVector}, itrs...)

Construct the symmetric difference of the passed in sets, and overwrite s with the result. When s is an array, the order is maintained. Note that in this case the multiplicity of elements matters.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.intersect!Function
intersect!(s::Union{AbstractSet,AbstractVector}, itrs...)

Intersect all passed in sets and overwrite s with the result. Maintain order with arrays.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.symdiff!Function
symdiff!(s::Union{AbstractSet,AbstractVector}, itrs...)

Construct the symmetric difference of the passed in sets, and overwrite s with the result. When s is an array, the order is maintained. Note that in this case the multiplicity of elements matters.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.intersect!Function
intersect!(s::Union{AbstractSet,AbstractVector}, itrs...)

Intersect all passed in sets and overwrite s with the result. Maintain order with arrays.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.issubsetFunction
issubset(a, b) -> Bool
 ⊆(a, b) -> Bool
 ⊇(b, a) -> Bool

Determine whether every element of a is also in b, using in.

See also , , , , contains.

Examples

julia> issubset([1, 2], [1, 2, 3])
 true
@@ -1412,7 +1412,7 @@
 false
 
 julia> [1, 2, 3] ⊇ [1, 2]
-true
source
Base.in!Function
in!(x, s::AbstractSet) -> Bool

If x is in s, return true. If not, push x into s and return false. This is equivalent to in(x, s) ? true : (push!(s, x); false), but may have a more efficient implementation.

See also: in, push!, Set

Julia 1.11

This function requires at least 1.11.

Examples

julia> s = Set{Any}([1, 2, 3]); in!(4, s)
+true
source
Base.in!Function
in!(x, s::AbstractSet) -> Bool

If x is in s, return true. If not, push x into s and return false. This is equivalent to in(x, s) ? true : (push!(s, x); false), but may have a more efficient implementation.

See also: in, push!, Set

Julia 1.11

This function requires at least 1.11.

Examples

julia> s = Set{Any}([1, 2, 3]); in!(4, s)
 false
 
 julia> length(s)
@@ -1426,32 +1426,32 @@
   4
   2
   3
-  1
source
Base.:⊈Function
⊈(a, b) -> Bool
 ⊉(b, a) -> Bool

Negation of and , i.e. checks that a is not a subset of b.

See also issubset (), .

Examples

julia> (1, 2) ⊈ (2, 3)
 true
 
 julia> (1, 2) ⊈ (1, 2, 3)
-false
source
Base.:⊊Function
⊊(a, b) -> Bool
 ⊋(b, a) -> Bool

Determines if a is a subset of, but not equal to, b.

See also issubset (), .

Examples

julia> (1, 2) ⊊ (1, 2, 3)
 true
 
 julia> (1, 2) ⊊ (1, 2)
-false
source
Base.issetequalFunction
issetequal(x)

Create a function that compares its argument to x using issetequal, i.e. a function equivalent to y -> issetequal(y, x). The returned function is of type Base.Fix2{typeof(issetequal)}, which can be used to implement specialized methods.

Julia 1.11

This functionality requires at least Julia 1.11.

source
issetequal(a, b) -> Bool

Determine whether a and b have the same elements. Equivalent to a ⊆ b && b ⊆ a but more efficient when possible.

See also: isdisjoint, union.

Examples

julia> issetequal([1, 2], [1, 2, 3])
+false
source
Base.issetequalFunction
issetequal(x)

Create a function that compares its argument to x using issetequal, i.e. a function equivalent to y -> issetequal(y, x). The returned function is of type Base.Fix2{typeof(issetequal)}, which can be used to implement specialized methods.

Julia 1.11

This functionality requires at least Julia 1.11.

source
issetequal(a, b) -> Bool

Determine whether a and b have the same elements. Equivalent to a ⊆ b && b ⊆ a but more efficient when possible.

See also: isdisjoint, union.

Examples

julia> issetequal([1, 2], [1, 2, 3])
 false
 
 julia> issetequal([1, 2], [2, 1])
-true
source
Base.isdisjointFunction
isdisjoint(x)

Create a function that compares its argument to x using isdisjoint, i.e. a function equivalent to y -> isdisjoint(y, x). The returned function is of type Base.Fix2{typeof(isdisjoint)}, which can be used to implement specialized methods.

Julia 1.11

This functionality requires at least Julia 1.11.

source
isdisjoint(a, b) -> Bool

Determine whether the collections a and b are disjoint. Equivalent to isempty(a ∩ b) but more efficient when possible.

See also: intersect, isempty, issetequal.

Julia 1.5

This function requires at least Julia 1.5.

Examples

julia> isdisjoint([1, 2], [2, 3, 4])
+true
source
Base.isdisjointFunction
isdisjoint(x)

Create a function that compares its argument to x using isdisjoint, i.e. a function equivalent to y -> isdisjoint(y, x). The returned function is of type Base.Fix2{typeof(isdisjoint)}, which can be used to implement specialized methods.

Julia 1.11

This functionality requires at least Julia 1.11.

source
isdisjoint(a, b) -> Bool

Determine whether the collections a and b are disjoint. Equivalent to isempty(a ∩ b) but more efficient when possible.

See also: intersect, isempty, issetequal.

Julia 1.5

This function requires at least Julia 1.5.

Examples

julia> isdisjoint([1, 2], [2, 3, 4])
 false
 
 julia> isdisjoint([3, 1], [2, 4])
-true
source

Fully implemented by:

Partially implemented by:

Dequeues

Base.push!Function
push!(collection, items...) -> collection

Insert one or more items in collection. If collection is an ordered container, the items are inserted at the end (in the given order).

Examples

julia> push!([1, 2, 3], 4, 5, 6)
+true
source

Fully implemented by:

Partially implemented by:

Dequeues

Base.push!Function
push!(collection, items...) -> collection

Insert one or more items in collection. If collection is an ordered container, the items are inserted at the end (in the given order).

Examples

julia> push!([1, 2, 3], 4, 5, 6)
 6-element Vector{Int64}:
  1
  2
  3
  4
  5
- 6

If collection is ordered, use append! to add all the elements of another collection to it. The result of the preceding example is equivalent to append!([1, 2, 3], [4, 5, 6]). For AbstractSet objects, union! can be used instead.

See sizehint! for notes about the performance model.

See also pushfirst!.

source
Base.pop!Function
pop!(collection, key[, default])

Delete and return the mapping for key if it exists in collection, otherwise return default, or throw an error if default is not specified.

Examples

julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
+ 6

If collection is ordered, use append! to add all the elements of another collection to it. The result of the preceding example is equivalent to append!([1, 2, 3], [4, 5, 6]). For AbstractSet objects, union! can be used instead.

See sizehint! for notes about the performance model.

See also pushfirst!.

source
Base.pop!Function
pop!(collection, key[, default])

Delete and return the mapping for key if it exists in collection, otherwise return default, or throw an error if default is not specified.

Examples

julia> d = Dict("a"=>1, "b"=>2, "c"=>3);
 
 julia> pop!(d, "a")
 1
@@ -1462,7 +1462,7 @@
 [...]
 
 julia> pop!(d, "e", 4)
-4
source
pop!(collection) -> item

Remove an item in collection and return it. If collection is an ordered container, the last item is returned; for unordered containers, an arbitrary element is returned.

See also: popfirst!, popat!, delete!, deleteat!, splice!, and push!.

Examples

julia> A=[1, 2, 3]
+4
source
pop!(collection) -> item

Remove an item in collection and return it. If collection is an ordered container, the last item is returned; for unordered containers, an arbitrary element is returned.

See also: popfirst!, popat!, delete!, deleteat!, splice!, and push!.

Examples

julia> A=[1, 2, 3]
 3-element Vector{Int64}:
  1
  2
@@ -1489,7 +1489,7 @@
   1
 
 julia> pop!(Dict(1=>2))
-1 => 2
source
Base.popat!Function
popat!(a::Vector, i::Integer, [default])

Remove the item at the given i and return it. Subsequent items are shifted to fill the resulting gap. When i is not a valid index for a, return default, or throw an error if default is not specified.

See also: pop!, popfirst!, deleteat!, splice!.

Julia 1.5

This function is available as of Julia 1.5.

Examples

julia> a = [4, 3, 2, 1]; popat!(a, 2)
+1 => 2
source
Base.popat!Function
popat!(a::Vector, i::Integer, [default])

Remove the item at the given i and return it. Subsequent items are shifted to fill the resulting gap. When i is not a valid index for a, return default, or throw an error if default is not specified.

See also: pop!, popfirst!, deleteat!, splice!.

Julia 1.5

This function is available as of Julia 1.5.

Examples

julia> a = [4, 3, 2, 1]; popat!(a, 2)
 3
 
 julia> a
@@ -1503,14 +1503,14 @@
 
 julia> popat!(a, 4)
 ERROR: BoundsError: attempt to access 3-element Vector{Int64} at index [4]
-[...]
source
Base.pushfirst!Function
pushfirst!(collection, items...) -> collection

Insert one or more items at the beginning of collection.

This function is called unshift in many other programming languages.

Examples

julia> pushfirst!([1, 2, 3, 4], 5, 6)
+[...]
source
Base.pushfirst!Function
pushfirst!(collection, items...) -> collection

Insert one or more items at the beginning of collection.

This function is called unshift in many other programming languages.

Examples

julia> pushfirst!([1, 2, 3, 4], 5, 6)
 6-element Vector{Int64}:
  5
  6
  1
  2
  3
- 4
source
Base.popfirst!Function
popfirst!(collection) -> item

Remove the first item from collection.

This function is called shift in many other programming languages.

See also: pop!, popat!, delete!.

Examples

julia> A = [1, 2, 3, 4, 5, 6]
+ 4
source
Base.popfirst!Function
popfirst!(collection) -> item

Remove the first item from collection.

This function is called shift in many other programming languages.

See also: pop!, popat!, delete!.

Examples

julia> A = [1, 2, 3, 4, 5, 6]
 6-element Vector{Int64}:
  1
  2
@@ -1528,7 +1528,7 @@
  3
  4
  5
- 6
source
Base.insert!Function
insert!(a::Vector, index::Integer, item)

Insert an item into a at the given index. index is the index of item in the resulting a.

See also: push!, replace, popat!, splice!.

Examples

julia> insert!(Any[1:6;], 3, "here")
+ 6
source
Base.insert!Function
insert!(a::Vector, index::Integer, item)

Insert an item into a at the given index. index is the index of item in the resulting a.

See also: push!, replace, popat!, splice!.

Examples

julia> insert!(Any[1:6;], 3, "here")
 7-element Vector{Any}:
  1
  2
@@ -1536,7 +1536,7 @@
  3
  4
  5
- 6
source
Base.deleteat!Function
deleteat!(a::Vector, inds)

Remove the items at the indices given by inds, and return the modified a. Subsequent items are shifted to fill the resulting gap.

inds can be either an iterator or a collection of sorted and unique integer indices, or a boolean vector of the same length as a with true indicating entries to delete.

Examples

julia> deleteat!([6, 5, 4, 3, 2, 1], 1:2:5)
+ 6
source
Base.deleteat!Function
deleteat!(a::Vector, inds)

Remove the items at the indices given by inds, and return the modified a. Subsequent items are shifted to fill the resulting gap.

inds can be either an iterator or a collection of sorted and unique integer indices, or a boolean vector of the same length as a with true indicating entries to delete.

Examples

julia> deleteat!([6, 5, 4, 3, 2, 1], 1:2:5)
 3-element Vector{Int64}:
  5
  3
@@ -1551,13 +1551,13 @@
 julia> deleteat!([6, 5, 4, 3, 2, 1], (2, 2))
 ERROR: ArgumentError: indices must be unique and sorted
 Stacktrace:
-[...]
source
deleteat!(a::Vector, i::Integer)

Remove the item at the given i and return the modified a. Subsequent items are shifted to fill the resulting gap.

See also: keepat!, delete!, popat!, splice!.

Examples

julia> deleteat!([6, 5, 4, 3, 2, 1], 2)
+[...]
source
deleteat!(a::Vector, i::Integer)

Remove the item at the given i and return the modified a. Subsequent items are shifted to fill the resulting gap.

See also: keepat!, delete!, popat!, splice!.

Examples

julia> deleteat!([6, 5, 4, 3, 2, 1], 2)
 5-element Vector{Int64}:
  6
  4
  3
  2
- 1
source
Base.keepat!Function
keepat!(a::Vector, m::AbstractVector{Bool})
 keepat!(a::BitVector, m::AbstractVector{Bool})

The in-place version of logical indexing a = a[m]. That is, keepat!(a, m) on vectors of equal length a and m will remove all elements from a for which m at the corresponding index is false.

Examples

julia> a = [:a, :b, :c];
 
 julia> keepat!(a, [true, false, true])
@@ -1568,12 +1568,12 @@
 julia> a
 2-element Vector{Symbol}:
  :a
- :c
source
keepat!(a::Vector, inds)
+ :c
source
keepat!(a::Vector, inds)
 keepat!(a::BitVector, inds)

Remove the items at all the indices which are not given by inds, and return the modified a. Items which are kept are shifted to fill the resulting gaps.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

inds must be an iterator of sorted and unique integer indices. See also deleteat!.

Julia 1.7

This function is available as of Julia 1.7.

Examples

julia> keepat!([6, 5, 4, 3, 2, 1], 1:2:5)
 3-element Vector{Int64}:
  6
  4
- 2
source
Base.splice!Function
splice!(a::Vector, indices, [replacement]) -> items

Remove items at specified indices, and return a collection containing the removed items. Subsequent items are shifted left to fill the resulting gaps. If specified, replacement values from an ordered collection will be spliced in place of the removed items; in this case, indices must be a AbstractUnitRange.

To insert replacement before an index n without removing any items, use splice!(collection, n:n-1, replacement).

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Julia 1.5

Prior to Julia 1.5, indices must always be a UnitRange.

Julia 1.8

Prior to Julia 1.8, indices must be a UnitRange if splicing in replacement values.

Examples

julia> A = [-1, -2, -3, 5, 4, 3, -1]; splice!(A, 4:3, 2)
+ 2
source
Base.splice!Function
splice!(a::Vector, indices, [replacement]) -> items

Remove items at specified indices, and return a collection containing the removed items. Subsequent items are shifted left to fill the resulting gaps. If specified, replacement values from an ordered collection will be spliced in place of the removed items; in this case, indices must be a AbstractUnitRange.

To insert replacement before an index n without removing any items, use splice!(collection, n:n-1, replacement).

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Julia 1.5

Prior to Julia 1.5, indices must always be a UnitRange.

Julia 1.8

Prior to Julia 1.8, indices must be a UnitRange if splicing in replacement values.

Examples

julia> A = [-1, -2, -3, 5, 4, 3, -1]; splice!(A, 4:3, 2)
 Int64[]
 
 julia> A
@@ -1585,7 +1585,7 @@
   5
   4
   3
- -1
source
splice!(a::Vector, index::Integer, [replacement]) -> item

Remove the item at the given index, and return the removed item. Subsequent items are shifted left to fill the resulting gap. If specified, replacement values from an ordered collection will be spliced in place of the removed item.

See also: replace, delete!, deleteat!, pop!, popat!.

Examples

julia> A = [6, 5, 4, 3, 2, 1]; splice!(A, 5)
+ -1
source
splice!(a::Vector, index::Integer, [replacement]) -> item

Remove the item at the given index, and return the removed item. Subsequent items are shifted left to fill the resulting gap. If specified, replacement values from an ordered collection will be spliced in place of the removed item.

See also: replace, delete!, deleteat!, pop!, popat!.

Examples

julia> A = [6, 5, 4, 3, 2, 1]; splice!(A, 5)
 2
 
 julia> A
@@ -1618,7 +1618,7 @@
   5
   4
   3
- -1

To insert replacement before an index n without removing any items, use splice!(collection, n:n-1, replacement).

source
Base.resize!Function
resize!(a::Vector, n::Integer) -> Vector

Resize a to contain n elements. If n is smaller than the current collection length, the first n elements will be retained. If n is larger, the new elements are not guaranteed to be initialized.

Examples

julia> resize!([6, 5, 4, 3, 2, 1], 3)
+ -1

To insert replacement before an index n without removing any items, use splice!(collection, n:n-1, replacement).

source
Base.resize!Function
resize!(a::Vector, n::Integer) -> Vector

Resize a to contain n elements. If n is smaller than the current collection length, the first n elements will be retained. If n is larger, the new elements are not guaranteed to be initialized.

Examples

julia> resize!([6, 5, 4, 3, 2, 1], 3)
 3-element Vector{Int64}:
  6
  5
@@ -1636,7 +1636,7 @@
  4
  3
  2
- 1
source
Base.append!Function
append!(collection, collections...) -> collection.

For an ordered container collection, add the elements of each collections to the end of it.

Julia 1.6

Specifying multiple collections to be appended requires at least Julia 1.6.

Examples

julia> append!([1], [2, 3])
+ 1
source
Base.append!Function
append!(collection, collections...) -> collection.

For an ordered container collection, add the elements of each collections to the end of it.

Julia 1.6

Specifying multiple collections to be appended requires at least Julia 1.6.

Examples

julia> append!([1], [2, 3])
 3-element Vector{Int64}:
  1
  2
@@ -1649,7 +1649,7 @@
  3
  4
  5
- 6

Use push! to add individual items to collection which are not already themselves in another collection. The result of the preceding example is equivalent to push!([1, 2, 3], 4, 5, 6).

See sizehint! for notes about the performance model.

See also vcat for vectors, union! for sets, and prepend! and pushfirst! for the opposite order.

source
Base.prepend!Function
prepend!(a::Vector, collections...) -> collection

Insert the elements of each collections to the beginning of a.

When collections specifies multiple collections, order is maintained: elements of collections[1] will appear leftmost in a, and so on.

Julia 1.6

Specifying multiple collections to be prepended requires at least Julia 1.6.

Examples

julia> prepend!([3], [1, 2])
+ 6

Use push! to add individual items to collection which are not already themselves in another collection. The result of the preceding example is equivalent to push!([1, 2, 3], 4, 5, 6).

See sizehint! for notes about the performance model.

See also vcat for vectors, union! for sets, and prepend! and pushfirst! for the opposite order.

source
Base.prepend!Function
prepend!(a::Vector, collections...) -> collection

Insert the elements of each collections to the beginning of a.

When collections specifies multiple collections, order is maintained: elements of collections[1] will appear leftmost in a, and so on.

Julia 1.6

Specifying multiple collections to be prepended requires at least Julia 1.6.

Examples

julia> prepend!([3], [1, 2])
 3-element Vector{Int64}:
  1
  2
@@ -1662,7 +1662,7 @@
  3
  4
  5
- 6
source

Fully implemented by:

  • Vector (a.k.a. 1-dimensional Array)
  • BitVector (a.k.a. 1-dimensional BitArray)

Utility Collections

Fully implemented by:

  • Vector (a.k.a. 1-dimensional Array)
  • BitVector (a.k.a. 1-dimensional BitArray)

Utility Collections

Core.PairType
Pair(x, y)
 x => y

Construct a Pair object with type Pair{typeof(x), typeof(y)}. The elements are stored in the fields first and second. They can also be accessed via iteration (but a Pair is treated as a single "scalar" for broadcasting operations).

See also Dict.

Examples

julia> p = "foo" => 7
 "foo" => 7
 
@@ -1681,4 +1681,4 @@
 julia> replace.(["xops", "oxps"], "x" => "o")
 2-element Vector{String}:
  "oops"
- "oops"
source
Base.PairsType
Base.Pairs(values, keys) <: AbstractDict{eltype(keys), eltype(values)}

Transforms an indexable container into a Dictionary-view of the same data. Modifying the key-space of the underlying data may invalidate this object.

source
+ "oops"source
Base.PairsType
Base.Pairs(values, keys) <: AbstractDict{eltype(keys), eltype(values)}

Transforms an indexable container into a Dictionary-view of the same data. Modifying the key-space of the underlying data may invalidate this object.

source
diff --git a/en/v1.12-dev/base/constants/index.html b/en/v1.12-dev/base/constants/index.html index ded03925b2b..c283a24dfc9 100644 --- a/en/v1.12-dev/base/constants/index.html +++ b/en/v1.12-dev/base/constants/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Constants

Core.nothingConstant
nothing

The singleton instance of type Nothing, used by convention when there is no value to return (as in a C void function) or when a variable or field holds no value.

A return value of nothing is not displayed by the REPL and similar interactive environments.

See also: isnothing, something, missing.

source
Base.PROGRAM_FILEConstant
PROGRAM_FILE

A string containing the script name passed to Julia from the command line. Note that the script name remains unchanged from within included files. Alternatively see @__FILE__.

source
Base.ARGSConstant
ARGS

An array of the command line arguments passed to Julia, as strings.

source
Base.C_NULLConstant
C_NULL

The C null pointer constant, sometimes used when calling external code.

source
Base.DEPOT_PATHConstant
DEPOT_PATH

A stack of "depot" locations where the package manager, as well as Julia's code loading mechanisms, look for package registries, installed packages, named environments, repo clones, cached compiled package images, and configuration files. By default it includes:

  1. ~/.julia where ~ is the user home as appropriate on the system;
  2. an architecture-specific shared system directory, e.g. /usr/local/share/julia;
  3. an architecture-independent shared system directory, e.g. /usr/share/julia.

So DEPOT_PATH might be:

[joinpath(homedir(), ".julia"), "/usr/local/share/julia", "/usr/share/julia"]

The first entry is the "user depot" and should be writable by and owned by the current user. The user depot is where: registries are cloned, new package versions are installed, named environments are created and updated, package repos are cloned, newly compiled package image files are saved, log files are written, development packages are checked out by default, and global configuration data is saved. Later entries in the depot path are treated as read-only and are appropriate for registries, packages, etc. installed and managed by system administrators.

DEPOT_PATH is populated based on the JULIA_DEPOT_PATH environment variable if set.

DEPOT_PATH contents

Each entry in DEPOT_PATH is a path to a directory which contains subdirectories used by Julia for various purposes. Here is an overview of some of the subdirectories that may exist in a depot:

  • artifacts: Contains content that packages use for which Pkg manages the installation of.
  • clones: Contains full clones of package repos. Maintained by Pkg.jl and used as a cache.
  • config: Contains julia-level configuration such as a startup.jl.
  • compiled: Contains precompiled *.ji files for packages. Maintained by Julia.
  • dev: Default directory for Pkg.develop. Maintained by Pkg.jl and the user.
  • environments: Default package environments. For instance the global environment for a specific julia version. Maintained by Pkg.jl.
  • logs: Contains logs of Pkg and REPL operations. Maintained by Pkg.jl and Julia.
  • packages: Contains packages, some of which were explicitly installed and some which are implicit dependencies. Maintained by Pkg.jl.
  • registries: Contains package registries. By default only General. Maintained by Pkg.jl.
  • scratchspaces: Contains content that a package itself installs via the Scratch.jl package. Pkg.gc() will delete content that is known to be unused.
Note

Packages that want to store content should use the scratchspaces subdirectory via Scratch.jl instead of creating new subdirectories in the depot root.

See also JULIA_DEPOT_PATH, and Code Loading.

source
Base.LOAD_PATHConstant
LOAD_PATH

An array of paths for using and import statements to consider as project environments or package directories when loading code. It is populated based on the JULIA_LOAD_PATH environment variable if set; otherwise it defaults to ["@", "@v#.#", "@stdlib"]. Entries starting with @ have special meanings:

  • @ refers to the "current active environment", the initial value of which is initially determined by the JULIA_PROJECT environment variable or the --project command-line option.

  • @stdlib expands to the absolute path of the current Julia installation's standard library directory.

  • @name refers to a named environment, which are stored in depots (see JULIA_DEPOT_PATH) under the environments subdirectory. The user's named environments are stored in ~/.julia/environments so @name would refer to the environment in ~/.julia/environments/name if it exists and contains a Project.toml file. If name contains # characters, then they are replaced with the major, minor and patch components of the Julia version number. For example, if you are running Julia 1.2 then @v#.# expands to @v1.2 and will look for an environment by that name, typically at ~/.julia/environments/v1.2.

The fully expanded value of LOAD_PATH that is searched for projects and packages can be seen by calling the Base.load_path() function.

See also JULIA_LOAD_PATH, JULIA_PROJECT, JULIA_DEPOT_PATH, and Code Loading.

source
Base.Sys.BINDIRConstant
Sys.BINDIR::String

A string containing the full path to the directory containing the julia executable.

source
Base.Sys.CPU_THREADSConstant
Sys.CPU_THREADS::Int

The number of logical CPU cores available in the system, i.e. the number of threads that the CPU can run concurrently. Note that this is not necessarily the number of CPU cores, for example, in the presence of hyper-threading.

See Hwloc.jl or CpuId.jl for extended information, including number of physical cores.

source
Base.Sys.KERNELConstant
Sys.KERNEL::Symbol

A symbol representing the name of the operating system, as returned by uname of the build configuration.

source
Base.Sys.ARCHConstant
Sys.ARCH::Symbol

A symbol representing the architecture of the build configuration.

source

See also:

+

Constants

Core.nothingConstant
nothing

The singleton instance of type Nothing, used by convention when there is no value to return (as in a C void function) or when a variable or field holds no value.

A return value of nothing is not displayed by the REPL and similar interactive environments.

See also: isnothing, something, missing.

source
Base.PROGRAM_FILEConstant
PROGRAM_FILE

A string containing the script name passed to Julia from the command line. Note that the script name remains unchanged from within included files. Alternatively see @__FILE__.

source
Base.ARGSConstant
ARGS

An array of the command line arguments passed to Julia, as strings.

source
Base.C_NULLConstant
C_NULL

The C null pointer constant, sometimes used when calling external code.

source
Base.DEPOT_PATHConstant
DEPOT_PATH

A stack of "depot" locations where the package manager, as well as Julia's code loading mechanisms, look for package registries, installed packages, named environments, repo clones, cached compiled package images, and configuration files. By default it includes:

  1. ~/.julia where ~ is the user home as appropriate on the system;
  2. an architecture-specific shared system directory, e.g. /usr/local/share/julia;
  3. an architecture-independent shared system directory, e.g. /usr/share/julia.

So DEPOT_PATH might be:

[joinpath(homedir(), ".julia"), "/usr/local/share/julia", "/usr/share/julia"]

The first entry is the "user depot" and should be writable by and owned by the current user. The user depot is where: registries are cloned, new package versions are installed, named environments are created and updated, package repos are cloned, newly compiled package image files are saved, log files are written, development packages are checked out by default, and global configuration data is saved. Later entries in the depot path are treated as read-only and are appropriate for registries, packages, etc. installed and managed by system administrators.

DEPOT_PATH is populated based on the JULIA_DEPOT_PATH environment variable if set.

DEPOT_PATH contents

Each entry in DEPOT_PATH is a path to a directory which contains subdirectories used by Julia for various purposes. Here is an overview of some of the subdirectories that may exist in a depot:

  • artifacts: Contains content that packages use for which Pkg manages the installation of.
  • clones: Contains full clones of package repos. Maintained by Pkg.jl and used as a cache.
  • config: Contains julia-level configuration such as a startup.jl.
  • compiled: Contains precompiled *.ji files for packages. Maintained by Julia.
  • dev: Default directory for Pkg.develop. Maintained by Pkg.jl and the user.
  • environments: Default package environments. For instance the global environment for a specific julia version. Maintained by Pkg.jl.
  • logs: Contains logs of Pkg and REPL operations. Maintained by Pkg.jl and Julia.
  • packages: Contains packages, some of which were explicitly installed and some which are implicit dependencies. Maintained by Pkg.jl.
  • registries: Contains package registries. By default only General. Maintained by Pkg.jl.
  • scratchspaces: Contains content that a package itself installs via the Scratch.jl package. Pkg.gc() will delete content that is known to be unused.
Note

Packages that want to store content should use the scratchspaces subdirectory via Scratch.jl instead of creating new subdirectories in the depot root.

See also JULIA_DEPOT_PATH, and Code Loading.

source
Base.LOAD_PATHConstant
LOAD_PATH

An array of paths for using and import statements to consider as project environments or package directories when loading code. It is populated based on the JULIA_LOAD_PATH environment variable if set; otherwise it defaults to ["@", "@v#.#", "@stdlib"]. Entries starting with @ have special meanings:

  • @ refers to the "current active environment", the initial value of which is initially determined by the JULIA_PROJECT environment variable or the --project command-line option.

  • @stdlib expands to the absolute path of the current Julia installation's standard library directory.

  • @name refers to a named environment, which are stored in depots (see JULIA_DEPOT_PATH) under the environments subdirectory. The user's named environments are stored in ~/.julia/environments so @name would refer to the environment in ~/.julia/environments/name if it exists and contains a Project.toml file. If name contains # characters, then they are replaced with the major, minor and patch components of the Julia version number. For example, if you are running Julia 1.2 then @v#.# expands to @v1.2 and will look for an environment by that name, typically at ~/.julia/environments/v1.2.

The fully expanded value of LOAD_PATH that is searched for projects and packages can be seen by calling the Base.load_path() function.

See also JULIA_LOAD_PATH, JULIA_PROJECT, JULIA_DEPOT_PATH, and Code Loading.

source
Base.Sys.BINDIRConstant
Sys.BINDIR::String

A string containing the full path to the directory containing the julia executable.

source
Base.Sys.CPU_THREADSConstant
Sys.CPU_THREADS::Int

The number of logical CPU cores available in the system, i.e. the number of threads that the CPU can run concurrently. Note that this is not necessarily the number of CPU cores, for example, in the presence of hyper-threading.

See Hwloc.jl or CpuId.jl for extended information, including number of physical cores.

source
Base.Sys.KERNELConstant
Sys.KERNEL::Symbol

A symbol representing the name of the operating system, as returned by uname of the build configuration.

source
Base.Sys.ARCHConstant
Sys.ARCH::Symbol

A symbol representing the architecture of the build configuration.

source

See also:

diff --git a/en/v1.12-dev/base/file/index.html b/en/v1.12-dev/base/file/index.html index 2d356880c2e..05ec049f94e 100644 --- a/en/v1.12-dev/base/file/index.html +++ b/en/v1.12-dev/base/file/index.html @@ -3,13 +3,13 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Filesystem

Base.readMethod
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
Base.writeMethod
write(filename::AbstractString, content)

Write the canonical binary representation of content to a file, which will be created if it does not exist yet or overwritten if it does exist.

Return the number of bytes written into the file.

source
Base.Filesystem.pwdFunction
pwd() -> String

Get the current working directory.

See also: cd, tempdir.

Examples

julia> pwd()
+

Filesystem

Base.readMethod
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
Base.writeMethod
write(filename::AbstractString, content)

Write the canonical binary representation of content to a file, which will be created if it does not exist yet or overwritten if it does exist.

Return the number of bytes written into the file.

source
Base.Filesystem.pwdFunction
pwd() -> String

Get the current working directory.

See also: cd, tempdir.

Examples

julia> pwd()
 "/home/JuliaUser"
 
 julia> cd("/home/JuliaUser/Projects/julia")
 
 julia> pwd()
-"/home/JuliaUser/Projects/julia"
source
Base.Filesystem.cdMethod
cd(dir::AbstractString=homedir())

Set the current working directory.

See also: pwd, mkdir, mkpath, mktempdir.

Examples

julia> cd("/home/JuliaUser/Projects/julia")
 
 julia> pwd()
 "/home/JuliaUser/Projects/julia"
@@ -17,7 +17,7 @@
 julia> cd()
 
 julia> pwd()
-"/home/JuliaUser"
source
Base.Filesystem.cdMethod
cd(f::Function, dir::AbstractString=homedir())

Temporarily change the current working directory to dir, apply function f and finally return to the original directory.

Examples

julia> pwd()
+"/home/JuliaUser"
source
Base.Filesystem.cdMethod
cd(f::Function, dir::AbstractString=homedir())

Temporarily change the current working directory to dir, apply function f and finally return to the original directory.

Examples

julia> pwd()
 "/home/JuliaUser"
 
 julia> cd(readdir, "/home/JuliaUser/Projects/julia")
@@ -34,7 +34,7 @@
  "usr-staging"
 
 julia> pwd()
-"/home/JuliaUser"
source
Base.Filesystem.readdirFunction
readdir(dir::AbstractString=pwd();
     join::Bool = false,
     sort::Bool = true,
 ) -> Vector{String}

Return the names in the directory dir or the current working directory if not given. When join is false, readdir returns just the names in the directory as is; when join is true, it returns joinpath(dir, name) for each name so that the returned strings are full paths. If you want to get absolute paths back, call readdir with an absolute directory path and join set to true.

By default, readdir sorts the list of names it returns. If you want to skip sorting the names and get them in the order that the file system lists them, you can use readdir(dir, sort=false) to opt out of sorting.

See also: walkdir.

Julia 1.4

The join and sort keyword arguments require at least Julia 1.4.

Examples

julia> cd("/home/JuliaUser/dev/julia")
@@ -87,7 +87,7 @@
  ⋮
  "/home/JuliaUser/dev/julia/base/version_git.sh"
  "/home/JuliaUser/dev/julia/base/views.jl"
- "/home/JuliaUser/dev/julia/base/weakkeydict.jl"
source
Base.Filesystem.walkdirFunction
walkdir(dir = pwd(); topdown=true, follow_symlinks=false, onerror=throw)

Return an iterator that walks the directory tree of a directory.

The iterator returns a tuple containing (path, dirs, files). Each iteration path will change to the next directory in the tree; then dirs and files will be vectors containing the directories and files in the current path directory. The directory tree can be traversed top-down or bottom-up. If walkdir or stat encounters a IOError it will rethrow the error by default. A custom error handling function can be provided through onerror keyword argument. onerror is called with a IOError as argument. The returned iterator is stateful so when accessed repeatedly each access will resume where the last left off, like Iterators.Stateful.

See also: readdir.

Julia 1.12

pwd() as the default directory was added in Julia 1.12.

Examples

for (path, dirs, files) in walkdir(".")
+ "/home/JuliaUser/dev/julia/base/weakkeydict.jl"
source
Base.Filesystem.walkdirFunction
walkdir(dir = pwd(); topdown=true, follow_symlinks=false, onerror=throw)

Return an iterator that walks the directory tree of a directory.

The iterator returns a tuple containing (path, dirs, files). Each iteration path will change to the next directory in the tree; then dirs and files will be vectors containing the directories and files in the current path directory. The directory tree can be traversed top-down or bottom-up. If walkdir or stat encounters a IOError it will rethrow the error by default. A custom error handling function can be provided through onerror keyword argument. onerror is called with a IOError as argument. The returned iterator is stateful so when accessed repeatedly each access will resume where the last left off, like Iterators.Stateful.

See also: readdir.

Julia 1.12

pwd() as the default directory was added in Julia 1.12.

Examples

for (path, dirs, files) in walkdir(".")
     println("Directories in $path")
     for dir in dirs
         println(joinpath(path, dir)) # path to directories
@@ -107,13 +107,13 @@
 ("my/test", ["dir"], String[])
 
 julia> (path, dirs, files) = first(itr)
-("my/test/dir", String[], String[])
source
Base.Filesystem.mkdirFunction
mkdir(path::AbstractString; mode::Unsigned = 0o777)

Make a new directory with name path and permissions mode. mode defaults to 0o777, modified by the current file creation mask. This function never creates more than one directory. If the directory already exists, or some intermediate directories do not exist, this function throws an error. See mkpath for a function which creates all required intermediate directories. Return path.

Examples

julia> mkdir("testingdir")
+("my/test/dir", String[], String[])
source
Base.Filesystem.mkdirFunction
mkdir(path::AbstractString; mode::Unsigned = 0o777)

Make a new directory with name path and permissions mode. mode defaults to 0o777, modified by the current file creation mask. This function never creates more than one directory. If the directory already exists, or some intermediate directories do not exist, this function throws an error. See mkpath for a function which creates all required intermediate directories. Return path.

Examples

julia> mkdir("testingdir")
 "testingdir"
 
 julia> cd("testingdir")
 
 julia> pwd()
-"/home/JuliaUser/testingdir"
source
Base.Filesystem.mkpathFunction
mkpath(path::AbstractString; mode::Unsigned = 0o777)

Create all intermediate directories in the path as required. Directories are created with the permissions mode which defaults to 0o777 and is modified by the current file creation mask. Unlike mkdir, mkpath does not error if path (or parts of it) already exists. However, an error will be thrown if path (or parts of it) points to an existing file. Return path.

If path includes a filename you will probably want to use mkpath(dirname(path)) to avoid creating a directory using the filename.

Examples

julia> cd(mktempdir())
+"/home/JuliaUser/testingdir"
source
Base.Filesystem.mkpathFunction
mkpath(path::AbstractString; mode::Unsigned = 0o777)

Create all intermediate directories in the path as required. Directories are created with the permissions mode which defaults to 0o777 and is modified by the current file creation mask. Unlike mkdir, mkpath does not error if path (or parts of it) already exists. However, an error will be thrown if path (or parts of it) points to an existing file. Return path.

If path includes a filename you will probably want to use mkpath(dirname(path)) to avoid creating a directory using the filename.

Examples

julia> cd(mktempdir())
 
 julia> mkpath("my/test/dir") # creates three directories
 "my/test/dir"
@@ -139,17 +139,17 @@
 true
 
 julia> mkpath("my/test/dir/") # returns the original `path`
-"my/test/dir/"
source
Base.Filesystem.hardlinkFunction
hardlink(src::AbstractString, dst::AbstractString)

Creates a hard link to an existing source file src with the name dst. The destination, dst, must not exist.

See also: symlink.

Julia 1.8

This method was added in Julia 1.8.

source
Base.Filesystem.symlinkFunction
symlink(target::AbstractString, link::AbstractString; dir_target = false)

Creates a symbolic link to target with the name link.

On Windows, symlinks must be explicitly declared as referring to a directory or not. If target already exists, by default the type of link will be auto- detected, however if target does not exist, this function defaults to creating a file symlink unless dir_target is set to true. Note that if the user sets dir_target but target exists and is a file, a directory symlink will still be created, but dereferencing the symlink will fail, just as if the user creates a file symlink (by calling symlink() with dir_target set to false before the directory is created) and tries to dereference it to a directory.

Additionally, there are two methods of making a link on Windows; symbolic links and junction points. Junction points are slightly more efficient, but do not support relative paths, so if a relative directory symlink is requested (as denoted by isabspath(target) returning false) a symlink will be used, else a junction point will be used. Best practice for creating symlinks on Windows is to create them only after the files/directories they reference are already created.

See also: hardlink.

Note

This function raises an error under operating systems that do not support soft symbolic links, such as Windows XP.

Julia 1.6

The dir_target keyword argument was added in Julia 1.6. Prior to this, symlinks to nonexistent paths on windows would always be file symlinks, and relative symlinks to directories were not supported.

source
Base.Filesystem.chmodFunction
chmod(path::AbstractString, mode::Integer; recursive::Bool=false)

Change the permissions mode of path to mode. Only integer modes (e.g. 0o777) are currently supported. If recursive=true and the path is a directory all permissions in that directory will be recursively changed. Return path.

Note

Prior to Julia 1.6, this did not correctly manipulate filesystem ACLs on Windows, therefore it would only set read-only bits on files. It now is able to manipulate ACLs.

source
Base.Filesystem.chownFunction
chown(path::AbstractString, owner::Integer, group::Integer=-1)

Change the owner and/or group of path to owner and/or group. If the value entered for owner or group is -1 the corresponding ID will not change. Only integer owners and groups are currently supported. Return path.

source
Base.Libc.RawFDType
RawFD

Primitive type which wraps the native OS file descriptor. RawFDs can be passed to methods like stat to discover information about the underlying file, and can also be used to open streams, with the RawFD describing the OS file backing the stream.

source
Base.statFunction
stat(path)
-stat(path_elements...)

Return a structure whose fields contain information about the file. If multiple arguments are given, they are joined by joinpath.

The fields of the structure are:

NameTypeDescription
descUnion{String, Base.OS_HANDLE}The path or OS file descriptor
sizeInt64The size (in bytes) of the file
deviceUIntID of the device that contains the file
inodeUIntThe inode number of the file
modeUIntThe protection mode of the file
nlinkIntThe number of hard links to the file
uidUIntThe user id of the owner of the file
gidUIntThe group id of the file owner
rdevUIntIf this file refers to a device, the ID of the device it refers to
blksizeInt64The file-system preferred block size for the file
blocksInt64The number of 512-byte blocks allocated
mtimeFloat64Unix timestamp of when the file was last modified
ctimeFloat64Unix timestamp of when the file's metadata was changed
source
Base.Filesystem.diskstatFunction
diskstat(path=pwd())

Returns statistics in bytes about the disk that contains the file or directory pointed at by path. If no argument is passed, statistics about the disk that contains the current working directory are returned.

Julia 1.8

This method was added in Julia 1.8.

source
Base.Filesystem.lstatFunction
lstat(path)
-lstat(path_elements...)

Like stat, but for symbolic links gets the info for the link itself rather than the file it refers to.

This function must be called on a file path rather than a file object or a file descriptor.

source
Base.Filesystem.hardlinkFunction
hardlink(src::AbstractString, dst::AbstractString)

Creates a hard link to an existing source file src with the name dst. The destination, dst, must not exist.

See also: symlink.

Julia 1.8

This method was added in Julia 1.8.

source
Base.Filesystem.symlinkFunction
symlink(target::AbstractString, link::AbstractString; dir_target = false)

Creates a symbolic link to target with the name link.

On Windows, symlinks must be explicitly declared as referring to a directory or not. If target already exists, by default the type of link will be auto- detected, however if target does not exist, this function defaults to creating a file symlink unless dir_target is set to true. Note that if the user sets dir_target but target exists and is a file, a directory symlink will still be created, but dereferencing the symlink will fail, just as if the user creates a file symlink (by calling symlink() with dir_target set to false before the directory is created) and tries to dereference it to a directory.

Additionally, there are two methods of making a link on Windows; symbolic links and junction points. Junction points are slightly more efficient, but do not support relative paths, so if a relative directory symlink is requested (as denoted by isabspath(target) returning false) a symlink will be used, else a junction point will be used. Best practice for creating symlinks on Windows is to create them only after the files/directories they reference are already created.

See also: hardlink.

Note

This function raises an error under operating systems that do not support soft symbolic links, such as Windows XP.

Julia 1.6

The dir_target keyword argument was added in Julia 1.6. Prior to this, symlinks to nonexistent paths on windows would always be file symlinks, and relative symlinks to directories were not supported.

source
Base.Filesystem.chmodFunction
chmod(path::AbstractString, mode::Integer; recursive::Bool=false)

Change the permissions mode of path to mode. Only integer modes (e.g. 0o777) are currently supported. If recursive=true and the path is a directory all permissions in that directory will be recursively changed. Return path.

Note

Prior to Julia 1.6, this did not correctly manipulate filesystem ACLs on Windows, therefore it would only set read-only bits on files. It now is able to manipulate ACLs.

source
Base.Filesystem.chownFunction
chown(path::AbstractString, owner::Integer, group::Integer=-1)

Change the owner and/or group of path to owner and/or group. If the value entered for owner or group is -1 the corresponding ID will not change. Only integer owners and groups are currently supported. Return path.

source
Base.Libc.RawFDType
RawFD

Primitive type which wraps the native OS file descriptor. RawFDs can be passed to methods like stat to discover information about the underlying file, and can also be used to open streams, with the RawFD describing the OS file backing the stream.

source
Base.statFunction
stat(path)
+stat(path_elements...)

Return a structure whose fields contain information about the file. If multiple arguments are given, they are joined by joinpath.

The fields of the structure are:

NameTypeDescription
descUnion{String, Base.OS_HANDLE}The path or OS file descriptor
sizeInt64The size (in bytes) of the file
deviceUIntID of the device that contains the file
inodeUIntThe inode number of the file
modeUIntThe protection mode of the file
nlinkIntThe number of hard links to the file
uidUIntThe user id of the owner of the file
gidUIntThe group id of the file owner
rdevUIntIf this file refers to a device, the ID of the device it refers to
blksizeInt64The file-system preferred block size for the file
blocksInt64The number of 512-byte blocks allocated
mtimeFloat64Unix timestamp of when the file was last modified
ctimeFloat64Unix timestamp of when the file's metadata was changed
source
Base.Filesystem.diskstatFunction
diskstat(path=pwd())

Returns statistics in bytes about the disk that contains the file or directory pointed at by path. If no argument is passed, statistics about the disk that contains the current working directory are returned.

Julia 1.8

This method was added in Julia 1.8.

source
Base.Filesystem.lstatFunction
lstat(path)
+lstat(path_elements...)

Like stat, but for symbolic links gets the info for the link itself rather than the file it refers to.

This function must be called on a file path rather than a file object or a file descriptor.

source
Base.Filesystem.ctimeFunction
ctime(path)
 ctime(path_elements...)
-ctime(stat_struct)

Return the unix timestamp of when the metadata of the file at path was last modified, or the last modified metadata timestamp indicated by the file descriptor stat_struct.

Equivalent to stat(path).ctime or stat_struct.ctime.

source
Base.Filesystem.mtimeFunction
mtime(path)
+ctime(stat_struct)

Return the unix timestamp of when the metadata of the file at path was last modified, or the last modified metadata timestamp indicated by the file descriptor stat_struct.

Equivalent to stat(path).ctime or stat_struct.ctime.

source
Base.Filesystem.mtimeFunction
mtime(path)
 mtime(path_elements...)
-mtime(stat_struct)

Return the unix timestamp of when the file at path was last modified, or the last modified timestamp indicated by the file descriptor stat_struct.

Equivalent to stat(path).mtime or stat_struct.mtime.

source
Base.Filesystem.filemodeFunction
filemode(path)
+mtime(stat_struct)

Return the unix timestamp of when the file at path was last modified, or the last modified timestamp indicated by the file descriptor stat_struct.

Equivalent to stat(path).mtime or stat_struct.mtime.

source
Base.Filesystem.filemodeFunction
filemode(path)
 filemode(path_elements...)
-filemode(stat_struct)

Return the mode of the file located at path, or the mode indicated by the file descriptor stat_struct.

Equivalent to stat(path).mode or stat_struct.mode.

source
Base.filesizeFunction
filesize(path)
+filemode(stat_struct)

Return the mode of the file located at path, or the mode indicated by the file descriptor stat_struct.

Equivalent to stat(path).mode or stat_struct.mode.

source
Base.filesizeFunction
filesize(path)
 filesize(path_elements...)
-filesize(stat_struct)

Return the size of the file located at path, or the size indicated by file descriptor stat_struct.

Equivalent to stat(path).size or stat_struct.size.

source
Base.Filesystem.upermFunction
uperm(path)
+filesize(stat_struct)

Return the size of the file located at path, or the size indicated by file descriptor stat_struct.

Equivalent to stat(path).size or stat_struct.size.

source
Base.Filesystem.upermFunction
uperm(path)
 uperm(path_elements...)
 uperm(stat_struct)

Return a bitfield of the owner permissions for the file at path or file descriptor stat_struct.

ValueDescription
01Execute Permission
02Write Permission
04Read Permission

The fact that a bitfield is returned means that if the permission is read+write, the bitfield is "110", which maps to the decimal value of 0+2+4=6. This is reflected in the printing of the returned UInt8 value.

See also gperm and operm.

julia> touch("dummy_file");  # Create test-file without contents
 
@@ -164,11 +164,11 @@
 julia> has_read_permission("dummy_file")
 true
 
-julia> rm("dummy_file")     # Clean up test-file
source
Base.Filesystem.opermFunction
operm(path)
 operm(path_elements...)
-operm(stat_struct)

Like uperm but gets the permissions for people who neither own the file nor are a member of the group owning the file.

See also gperm.

source
Base.Filesystem.cpFunction
cp(src::AbstractString, dst::AbstractString; force::Bool=false, follow_symlinks::Bool=false)

Copy the file, link, or directory from src to dst. force=true will first remove an existing dst.

If follow_symlinks=false, and src is a symbolic link, dst will be created as a symbolic link. If follow_symlinks=true and src is a symbolic link, dst will be a copy of the file or directory src refers to. Return dst.

Note

The cp function is different from the cp Unix command. The cp function always operates on the assumption that dst is a file, while the command does different things depending on whether dst is a directory or a file. Using force=true when dst is a directory will result in loss of all the contents present in the dst directory, and dst will become a file that has the contents of src instead.

source
Base.downloadFunction
download(url::AbstractString, [path::AbstractString = tempname()]) -> path

Download a file from the given url, saving it to the location path, or if not specified, a temporary path. Returns the path of the downloaded file.

Note

Since Julia 1.6, this function is deprecated and is just a thin wrapper around Downloads.download. In new code, you should use that function directly instead of calling this.

source
Base.Filesystem.mvFunction
mv(src::AbstractString, dst::AbstractString; force::Bool=false)

Move the file, link, or directory from src to dst. force=true will first remove an existing dst. Return dst.

Examples

julia> write("hello.txt", "world");
+operm(stat_struct)

Like uperm but gets the permissions for people who neither own the file nor are a member of the group owning the file.

See also gperm.

source
Base.Filesystem.cpFunction
cp(src::AbstractString, dst::AbstractString; force::Bool=false, follow_symlinks::Bool=false)

Copy the file, link, or directory from src to dst. force=true will first remove an existing dst.

If follow_symlinks=false, and src is a symbolic link, dst will be created as a symbolic link. If follow_symlinks=true and src is a symbolic link, dst will be a copy of the file or directory src refers to. Return dst.

Note

The cp function is different from the cp Unix command. The cp function always operates on the assumption that dst is a file, while the command does different things depending on whether dst is a directory or a file. Using force=true when dst is a directory will result in loss of all the contents present in the dst directory, and dst will become a file that has the contents of src instead.

source
Base.downloadFunction
download(url::AbstractString, [path::AbstractString = tempname()]) -> path

Download a file from the given url, saving it to the location path, or if not specified, a temporary path. Returns the path of the downloaded file.

Note

Since Julia 1.6, this function is deprecated and is just a thin wrapper around Downloads.download. In new code, you should use that function directly instead of calling this.

source
Base.Filesystem.mvFunction
mv(src::AbstractString, dst::AbstractString; force::Bool=false)

Move the file, link, or directory from src to dst. force=true will first remove an existing dst. Return dst.

Examples

julia> write("hello.txt", "world");
 
 julia> mv("hello.txt", "goodbye.txt")
 "goodbye.txt"
@@ -191,7 +191,7 @@
 "goodbye.txt"
 
 julia> rm("goodbye.txt");
-
Note

The mv function is different from the mv Unix command. The mv function by default will error if dst exists, while the command will delete an existing dst file by default. Also the mv function always operates on the assumption that dst is a file, while the command does different things depending on whether dst is a directory or a file. Using force=true when dst is a directory will result in loss of all the contents present in the dst directory, and dst will become a file that has the contents of src instead.

source
Base.Filesystem.renameFunction
Base.rename(oldpath::AbstractString, newpath::AbstractString)

Change the name of a file or directory from oldpath to newpath. If newpath is an existing file or empty directory it may be replaced. Equivalent to rename(2) on Unix. If a path contains a "\0" throw an ArgumentError. On other failures throw an IOError. Return newpath.

This is a lower level filesystem operation used to implement mv.

OS-specific restrictions may apply when oldpath and newpath are in different directories.

Currently there are a few differences in behavior on Windows which may be resolved in a future release. Specifically, currently on Windows:

  1. rename will fail if oldpath or newpath are opened files.
  2. rename will fail if newpath is an existing directory.
  3. rename may work if newpath is a file and oldpath is a directory.
  4. rename may remove oldpath if it is a hardlink to newpath.

See also: mv.

Julia 1.12

This method was made public in Julia 1.12.

source
Base.Filesystem.rmFunction
rm(path::AbstractString; force::Bool=false, recursive::Bool=false)

Delete the file, link, or empty directory at the given path. If force=true is passed, a non-existing path is not treated as error. If recursive=true is passed and the path is a directory, then all contents are removed recursively.

Examples

julia> mkpath("my/test/dir");
+
Note

The mv function is different from the mv Unix command. The mv function by default will error if dst exists, while the command will delete an existing dst file by default. Also the mv function always operates on the assumption that dst is a file, while the command does different things depending on whether dst is a directory or a file. Using force=true when dst is a directory will result in loss of all the contents present in the dst directory, and dst will become a file that has the contents of src instead.

source
Base.Filesystem.renameFunction
Base.rename(oldpath::AbstractString, newpath::AbstractString)

Change the name of a file or directory from oldpath to newpath. If newpath is an existing file or empty directory it may be replaced. Equivalent to rename(2) on Unix. If a path contains a "\0" throw an ArgumentError. On other failures throw an IOError. Return newpath.

This is a lower level filesystem operation used to implement mv.

OS-specific restrictions may apply when oldpath and newpath are in different directories.

Currently there are a few differences in behavior on Windows which may be resolved in a future release. Specifically, currently on Windows:

  1. rename will fail if oldpath or newpath are opened files.
  2. rename will fail if newpath is an existing directory.
  3. rename may work if newpath is a file and oldpath is a directory.
  4. rename may remove oldpath if it is a hardlink to newpath.

See also: mv.

Julia 1.12

This method was made public in Julia 1.12.

source
Base.Filesystem.rmFunction
rm(path::AbstractString; force::Bool=false, recursive::Bool=false)

Delete the file, link, or empty directory at the given path. If force=true is passed, a non-existing path is not treated as error. If recursive=true is passed and the path is a directory, then all contents are removed recursively.

Examples

julia> mkpath("my/test/dir");
 
 julia> rm("my", recursive=true)
 
@@ -200,7 +200,7 @@
 julia> rm("this_file_does_not_exist")
 ERROR: IOError: unlink("this_file_does_not_exist"): no such file or directory (ENOENT)
 Stacktrace:
-[...]
source
Base.Filesystem.touchFunction
Base.touch(::Pidfile.LockMonitor)

Update the mtime on the lock, to indicate it is still fresh.

See also the refresh keyword in the mkpidlock constructor.

touch(path::AbstractString)
+[...]
source
Base.Filesystem.touchFunction
Base.touch(::Pidfile.LockMonitor)

Update the mtime on the lock, to indicate it is still fresh.

See also the refresh keyword in the mkpidlock constructor.

touch(path::AbstractString)
 touch(fd::File)

Update the last-modified timestamp on a file to the current time.

If the file does not exist a new file is created.

Return path.

Examples

julia> write("my_little_file", 2);
 
 julia> mtime("my_little_file")
@@ -209,18 +209,18 @@
 julia> touch("my_little_file");
 
 julia> mtime("my_little_file")
-1.527381559163435e9

We can see the mtime has been modified by touch.

source
Base.Filesystem.tempnameFunction
tempname(parent=tempdir(); cleanup=true, suffix="") -> String

Generate a temporary file path. This function only returns a path; no file is created. The path is likely to be unique, but this cannot be guaranteed due to the very remote possibility of two simultaneous calls to tempname generating the same file name. The name is guaranteed to differ from all files already existing at the time of the call to tempname.

When called with no arguments, the temporary name will be an absolute path to a temporary name in the system temporary directory as given by tempdir(). If a parent directory argument is given, the temporary path will be in that directory instead. If a suffix is given the tempname will end with that suffix and be tested for uniqueness with that suffix.

The cleanup option controls whether the process attempts to delete the returned path automatically when the process exits. Note that the tempname function does not create any file or directory at the returned location, so there is nothing to cleanup unless you create a file or directory there. If you do and cleanup is true it will be deleted upon process termination.

Julia 1.4

The parent and cleanup arguments were added in 1.4. Prior to Julia 1.4 the path tempname would never be cleaned up at process termination.

Julia 1.12

The suffix keyword argument was added in Julia 1.12.

Warning

This can lead to security holes if another process obtains the same file name and creates the file before you are able to. Open the file with JL_O_EXCL if this is a concern. Using mktemp() is also recommended instead.

source
Base.Filesystem.tempdirFunction
tempdir()

Gets the path of the temporary directory. On Windows, tempdir() uses the first environment variable found in the ordered list TMP, TEMP, USERPROFILE. On all other operating systems, tempdir() uses the first environment variable found in the ordered list TMPDIR, TMP, TEMP, and TEMPDIR. If none of these are found, the path "/tmp" is used.

source
Base.Filesystem.mktempMethod
mktemp(parent=tempdir(); cleanup=true) -> (path, io)

Return (path, io), where path is the path of a new temporary file in parent and io is an open file object for this path. The cleanup option controls whether the temporary file is automatically deleted when the process exits.

Julia 1.3

The cleanup keyword argument was added in Julia 1.3. Relatedly, starting from 1.3, Julia will remove the temporary paths created by mktemp when the Julia process exits, unless cleanup is explicitly set to false.

source
Base.Filesystem.mktempdirMethod
mktempdir(parent=tempdir(); prefix="jl_", cleanup=true) -> path

Create a temporary directory in the parent directory with a name constructed from the given prefix and a random suffix, and return its path. Additionally, on some platforms, any trailing 'X' characters in prefix may be replaced with random characters. If parent does not exist, throw an error. The cleanup option controls whether the temporary directory is automatically deleted when the process exits.

Julia 1.2

The prefix keyword argument was added in Julia 1.2.

Julia 1.3

The cleanup keyword argument was added in Julia 1.3. Relatedly, starting from 1.3, Julia will remove the temporary paths created by mktempdir when the Julia process exits, unless cleanup is explicitly set to false.

See also: mktemp, mkdir.

source
Base.Filesystem.tempnameFunction
tempname(parent=tempdir(); cleanup=true, suffix="") -> String

Generate a temporary file path. This function only returns a path; no file is created. The path is likely to be unique, but this cannot be guaranteed due to the very remote possibility of two simultaneous calls to tempname generating the same file name. The name is guaranteed to differ from all files already existing at the time of the call to tempname.

When called with no arguments, the temporary name will be an absolute path to a temporary name in the system temporary directory as given by tempdir(). If a parent directory argument is given, the temporary path will be in that directory instead. If a suffix is given the tempname will end with that suffix and be tested for uniqueness with that suffix.

The cleanup option controls whether the process attempts to delete the returned path automatically when the process exits. Note that the tempname function does not create any file or directory at the returned location, so there is nothing to cleanup unless you create a file or directory there. If you do and cleanup is true it will be deleted upon process termination.

Julia 1.4

The parent and cleanup arguments were added in 1.4. Prior to Julia 1.4 the path tempname would never be cleaned up at process termination.

Julia 1.12

The suffix keyword argument was added in Julia 1.12.

Warning

This can lead to security holes if another process obtains the same file name and creates the file before you are able to. Open the file with JL_O_EXCL if this is a concern. Using mktemp() is also recommended instead.

source
Base.Filesystem.tempdirFunction
tempdir()

Gets the path of the temporary directory. On Windows, tempdir() uses the first environment variable found in the ordered list TMP, TEMP, USERPROFILE. On all other operating systems, tempdir() uses the first environment variable found in the ordered list TMPDIR, TMP, TEMP, and TEMPDIR. If none of these are found, the path "/tmp" is used.

source
Base.Filesystem.mktempMethod
mktemp(parent=tempdir(); cleanup=true) -> (path, io)

Return (path, io), where path is the path of a new temporary file in parent and io is an open file object for this path. The cleanup option controls whether the temporary file is automatically deleted when the process exits.

Julia 1.3

The cleanup keyword argument was added in Julia 1.3. Relatedly, starting from 1.3, Julia will remove the temporary paths created by mktemp when the Julia process exits, unless cleanup is explicitly set to false.

source
Base.Filesystem.mktempdirMethod
mktempdir(parent=tempdir(); prefix="jl_", cleanup=true) -> path

Create a temporary directory in the parent directory with a name constructed from the given prefix and a random suffix, and return its path. Additionally, on some platforms, any trailing 'X' characters in prefix may be replaced with random characters. If parent does not exist, throw an error. The cleanup option controls whether the temporary directory is automatically deleted when the process exits.

Julia 1.2

The prefix keyword argument was added in Julia 1.2.

Julia 1.3

The cleanup keyword argument was added in Julia 1.3. Relatedly, starting from 1.3, Julia will remove the temporary paths created by mktempdir when the Julia process exits, unless cleanup is explicitly set to false.

See also: mktemp, mkdir.

source
Base.Filesystem.isblockdevFunction
isblockdev(path) -> Bool
 isblockdev(path_elements...) -> Bool
-isblockdev(stat_struct) -> Bool

Return true if the path path or file descriptor stat_struct refer to a block device, false otherwise.

source
Base.Filesystem.ischardevFunction
ischardev(path) -> Bool
+isblockdev(stat_struct) -> Bool

Return true if the path path or file descriptor stat_struct refer to a block device, false otherwise.

source
Base.Filesystem.ischardevFunction
ischardev(path) -> Bool
 ischardev(path_elements...) -> Bool
-ischardev(stat_struct) -> Bool

Return true if the path path or file descriptor stat_struct refer to a character device, false otherwise.

source
Base.Filesystem.isdirFunction
isdir(path) -> Bool
+ischardev(stat_struct) -> Bool

Return true if the path path or file descriptor stat_struct refer to a character device, false otherwise.

source
Base.Filesystem.isdirFunction
isdir(path) -> Bool
 isdir(path_elements...) -> Bool

Return true if path points to a directory, false otherwise.

Examples

julia> isdir(homedir())
 true
 
 julia> isdir("not/a/directory")
-false

See also isfile and ispath.

source
Base.Filesystem.isfifoFunction
isfifo(path) -> Bool
 isfifo(path_elements...) -> Bool
-isfifo(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct is FIFO, false otherwise.

source
Base.Filesystem.isfileFunction
isfile(path) -> Bool
+isfifo(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct is FIFO, false otherwise.

source
Base.Filesystem.isfileFunction
isfile(path) -> Bool
 isfile(path_elements...) -> Bool

Return true if path points to a regular file, false otherwise.

Examples

julia> isfile(homedir())
 false
 
@@ -234,51 +234,51 @@
 julia> rm(filename);
 
 julia> isfile(filename)
-false

See also isdir and ispath.

source
Base.Filesystem.islinkFunction
islink(path) -> Bool
-islink(path_elements...) -> Bool

Return true if path points to a symbolic link, false otherwise.

source
Base.Filesystem.ismountFunction
ismount(path) -> Bool
-ismount(path_elements...) -> Bool

Return true if path is a mount point, false otherwise.

source
Base.Filesystem.ispathFunction
ispath(path) -> Bool
-ispath(path_elements...) -> Bool

Return true if a valid filesystem entity exists at path, otherwise returns false.

This is the generalization of isfile, isdir etc.

source
Base.Filesystem.islinkFunction
islink(path) -> Bool
+islink(path_elements...) -> Bool

Return true if path points to a symbolic link, false otherwise.

source
Base.Filesystem.ismountFunction
ismount(path) -> Bool
+ismount(path_elements...) -> Bool

Return true if path is a mount point, false otherwise.

source
Base.Filesystem.ispathFunction
ispath(path) -> Bool
+ispath(path_elements...) -> Bool

Return true if a valid filesystem entity exists at path, otherwise returns false.

This is the generalization of isfile, isdir etc.

source
Base.Filesystem.issetgidFunction
issetgid(path) -> Bool
 issetgid(path_elements...) -> Bool
-issetgid(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct have the setgid flag set, false otherwise.

source
Base.Filesystem.issetuidFunction
issetuid(path) -> Bool
+issetgid(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct have the setgid flag set, false otherwise.

source
Base.Filesystem.issetuidFunction
issetuid(path) -> Bool
 issetuid(path_elements...) -> Bool
-issetuid(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct have the setuid flag set, false otherwise.

source
Base.Filesystem.issocketFunction
issocket(path) -> Bool
-issocket(path_elements...) -> Bool

Return true if path points to a socket, false otherwise.

source
Base.Filesystem.isstickyFunction
issticky(path) -> Bool
+issetuid(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct have the setuid flag set, false otherwise.

source
Base.Filesystem.issocketFunction
issocket(path) -> Bool
+issocket(path_elements...) -> Bool

Return true if path points to a socket, false otherwise.

source
Base.Filesystem.isstickyFunction
issticky(path) -> Bool
 issticky(path_elements...) -> Bool
-issticky(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct have the sticky bit set, false otherwise.

source
Base.Filesystem.dirnameFunction
dirname(path::AbstractString) -> String

Get the directory part of a path. Trailing characters ('/' or '\') in the path are counted as part of the path.

Examples

julia> dirname("/home/myuser")
+issticky(stat_struct) -> Bool

Return true if the file at path or file descriptor stat_struct have the sticky bit set, false otherwise.

source
Base.Filesystem.dirnameFunction
dirname(path::AbstractString) -> String

Get the directory part of a path. Trailing characters ('/' or '\') in the path are counted as part of the path.

Examples

julia> dirname("/home/myuser")
 "/home"
 
 julia> dirname("/home/myuser/")
-"/home/myuser"

See also basename.

source
Base.Filesystem.basenameFunction
basename(path::AbstractString) -> String

Get the file name part of a path.

Note

This function differs slightly from the Unix basename program, where trailing slashes are ignored, i.e. $ basename /foo/bar/ returns bar, whereas basename in Julia returns an empty string "".

Examples

julia> basename("/home/myuser/example.jl")
+"/home/myuser"

See also basename.

source
Base.Filesystem.basenameFunction
basename(path::AbstractString) -> String

Get the file name part of a path.

Note

This function differs slightly from the Unix basename program, where trailing slashes are ignored, i.e. $ basename /foo/bar/ returns bar, whereas basename in Julia returns an empty string "".

Examples

julia> basename("/home/myuser/example.jl")
 "example.jl"
 
 julia> basename("/home/myuser/")
-""

See also dirname.

source
Base.Filesystem.isabspathFunction
isabspath(path::AbstractString) -> Bool

Determine whether a path is absolute (begins at the root directory).

Examples

julia> isabspath("/home")
+""

See also dirname.

source
Base.Filesystem.isabspathFunction
isabspath(path::AbstractString) -> Bool

Determine whether a path is absolute (begins at the root directory).

Examples

julia> isabspath("/home")
 true
 
 julia> isabspath("home")
-false
source
Base.Filesystem.isdirpathFunction
isdirpath(path::AbstractString) -> Bool

Determine whether a path refers to a directory (for example, ends with a path separator).

Examples

julia> isdirpath("/home")
+false
source
Base.Filesystem.isdirpathFunction
isdirpath(path::AbstractString) -> Bool

Determine whether a path refers to a directory (for example, ends with a path separator).

Examples

julia> isdirpath("/home")
 false
 
 julia> isdirpath("/home/")
-true
source
Base.Filesystem.joinpathFunction
joinpath(parts::AbstractString...) -> String
 joinpath(parts::Vector{AbstractString}) -> String
 joinpath(parts::Tuple{AbstractString}) -> String

Join path components into a full path. If some argument is an absolute path or (on Windows) has a drive specification that doesn't match the drive computed for the join of the preceding paths, then prior components are dropped.

Note on Windows since there is a current directory for each drive, joinpath("c:", "foo") represents a path relative to the current directory on drive "c:" so this is equal to "c:foo", not "c:\foo". Furthermore, joinpath treats this as a non-absolute path and ignores the drive letter casing, hence joinpath("C:\A","c:b") = "C:\A\b".

Examples

julia> joinpath("/home/myuser", "example.jl")
 "/home/myuser/example.jl"
julia> joinpath(["/home/myuser", "example.jl"])
-"/home/myuser/example.jl"
source
Base.Filesystem.abspathFunction
abspath(path::AbstractString, paths::AbstractString...) -> String

Convert a set of paths to an absolute path by joining them together and adding the current directory if necessary. Equivalent to abspath(joinpath(path, paths...)).

source
abspath(path::AbstractString) -> String

Convert a path to an absolute path by adding the current directory if necessary. Also normalizes the path as in normpath.

Examples

If you are in a directory called JuliaExample and the data you are using is two levels up relative to the JuliaExample directory, you could write:

abspath("../../data")

Which gives a path like "/home/JuliaUser/data/".

See also joinpath, pwd, expanduser.

source
Base.Filesystem.normpathFunction
normpath(path::AbstractString, paths::AbstractString...) -> String

Convert a set of paths to a normalized path by joining them together and removing "." and ".." entries. Equivalent to normpath(joinpath(path, paths...)).

source
normpath(path::AbstractString) -> String

Normalize a path, removing "." and ".." entries and changing "/" to the canonical path separator for the system.

Examples

julia> normpath("/home/myuser/../example.jl")
+"/home/myuser/example.jl"
source
Base.Filesystem.abspathFunction
abspath(path::AbstractString, paths::AbstractString...) -> String

Convert a set of paths to an absolute path by joining them together and adding the current directory if necessary. Equivalent to abspath(joinpath(path, paths...)).

source
abspath(path::AbstractString) -> String

Convert a path to an absolute path by adding the current directory if necessary. Also normalizes the path as in normpath.

Examples

If you are in a directory called JuliaExample and the data you are using is two levels up relative to the JuliaExample directory, you could write:

abspath("../../data")

Which gives a path like "/home/JuliaUser/data/".

See also joinpath, pwd, expanduser.

source
Base.Filesystem.normpathFunction
normpath(path::AbstractString, paths::AbstractString...) -> String

Convert a set of paths to a normalized path by joining them together and removing "." and ".." entries. Equivalent to normpath(joinpath(path, paths...)).

source
normpath(path::AbstractString) -> String

Normalize a path, removing "." and ".." entries and changing "/" to the canonical path separator for the system.

Examples

julia> normpath("/home/myuser/../example.jl")
 "/home/example.jl"
 
 julia> normpath("Documents/Julia") == joinpath("Documents", "Julia")
-true
source
Base.Filesystem.realpathFunction
realpath(path::AbstractString) -> String

Canonicalize a path by expanding symbolic links and removing "." and ".." entries. On case-insensitive case-preserving filesystems (typically Mac and Windows), the filesystem's stored case for the path is returned.

(This function throws an exception if path does not exist in the filesystem.)

source
Base.Filesystem.relpathFunction
relpath(path::AbstractString, startpath::AbstractString = ".") -> String

Return a relative filepath to path either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the existence or nature of path or startpath.

On Windows, case sensitivity is applied to every part of the path except drive letters. If path and startpath refer to different drives, the absolute path of path is returned.

source
Base.Filesystem.expanduserFunction
expanduser(path::AbstractString) -> AbstractString

On Unix systems, replace a tilde character at the start of a path with the current user's home directory.

See also: contractuser.

source
Base.Filesystem.splitdirFunction
splitdir(path::AbstractString) -> (AbstractString, AbstractString)

Split a path into a tuple of the directory name and file name.

Examples

julia> splitdir("/home/myuser")
-("/home", "myuser")
source
Base.Filesystem.splitdriveFunction
splitdrive(path::AbstractString) -> (AbstractString, AbstractString)

On Windows, split a path into the drive letter part and the path part. On Unix systems, the first component is always the empty string.

source
Base.Filesystem.splitextFunction
splitext(path::AbstractString) -> (String, String)

If the last component of a path contains one or more dots, split the path into everything before the last dot and everything including and after the dot. Otherwise, return a tuple of the argument unmodified and the empty string. "splitext" is short for "split extension".

Examples

julia> splitext("/home/myuser/example.jl")
+true
source
Base.Filesystem.realpathFunction
realpath(path::AbstractString) -> String

Canonicalize a path by expanding symbolic links and removing "." and ".." entries. On case-insensitive case-preserving filesystems (typically Mac and Windows), the filesystem's stored case for the path is returned.

(This function throws an exception if path does not exist in the filesystem.)

source
Base.Filesystem.relpathFunction
relpath(path::AbstractString, startpath::AbstractString = ".") -> String

Return a relative filepath to path either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the existence or nature of path or startpath.

On Windows, case sensitivity is applied to every part of the path except drive letters. If path and startpath refer to different drives, the absolute path of path is returned.

source
Base.Filesystem.expanduserFunction
expanduser(path::AbstractString) -> AbstractString

On Unix systems, replace a tilde character at the start of a path with the current user's home directory.

See also: contractuser.

source
Base.Filesystem.splitdirFunction
splitdir(path::AbstractString) -> (AbstractString, AbstractString)

Split a path into a tuple of the directory name and file name.

Examples

julia> splitdir("/home/myuser")
+("/home", "myuser")
source
Base.Filesystem.splitdriveFunction
splitdrive(path::AbstractString) -> (AbstractString, AbstractString)

On Windows, split a path into the drive letter part and the path part. On Unix systems, the first component is always the empty string.

source
Base.Filesystem.splitextFunction
splitext(path::AbstractString) -> (String, String)

If the last component of a path contains one or more dots, split the path into everything before the last dot and everything including and after the dot. Otherwise, return a tuple of the argument unmodified and the empty string. "splitext" is short for "split extension".

Examples

julia> splitext("/home/myuser/example.jl")
 ("/home/myuser/example", ".jl")
 
 julia> splitext("/home/myuser/example.tar.gz")
 ("/home/myuser/example.tar", ".gz")
 
 julia> splitext("/home/my.user/example")
-("/home/my.user/example", "")
source
Base.Filesystem.splitpathFunction
splitpath(path::AbstractString) -> Vector{String}

Split a file path into all its path components. This is the opposite of joinpath. Returns an array of substrings, one for each directory or file in the path, including the root directory if present.

Julia 1.1

This function requires at least Julia 1.1.

Examples

julia> splitpath("/home/myuser/example.jl")
+("/home/my.user/example", "")
source
Base.Filesystem.splitpathFunction
splitpath(path::AbstractString) -> Vector{String}

Split a file path into all its path components. This is the opposite of joinpath. Returns an array of substrings, one for each directory or file in the path, including the root directory if present.

Julia 1.1

This function requires at least Julia 1.1.

Examples

julia> splitpath("/home/myuser/example.jl")
 4-element Vector{String}:
  "/"
  "home"
  "myuser"
- "example.jl"
source
+ "example.jl"
source
diff --git a/en/v1.12-dev/base/io-network/index.html b/en/v1.12-dev/base/io-network/index.html index 18b7384d253..889b88d2e8f 100644 --- a/en/v1.12-dev/base/io-network/index.html +++ b/en/v1.12-dev/base/io-network/index.html @@ -3,7 +3,7 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

I/O and Network

General I/O

Base.stdoutConstant
stdout::IO

Global variable referring to the standard out stream.

source
Base.stderrConstant
stderr::IO

Global variable referring to the standard error stream.

source
Base.stdinConstant
stdin::IO

Global variable referring to the standard input stream.

source
Base.readMethod
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
Base.writeMethod
write(filename::AbstractString, content)

Write the canonical binary representation of content to a file, which will be created if it does not exist yet or overwritten if it does exist.

Return the number of bytes written into the file.

source
Base.openFunction
open(f::Function, command, args...; kwargs...)

Similar to open(command, args...; kwargs...), but calls f(stream) on the resulting process stream, then closes the input stream and waits for the process to complete. Return the value returned by f on success. Throw an error if the process failed, or if the process attempts to print anything to stdout.

source
open(command, stdio=devnull; write::Bool = false, read::Bool = !write)

Start running command asynchronously, and return a process::IO object. If read is true, then reads from the process come from the process's standard output and stdio optionally specifies the process's standard input stream. If write is true, then writes go to the process's standard input and stdio optionally specifies the process's standard output stream. The process's standard error stream is connected to the current global stderr.

source
open(command, mode::AbstractString, stdio=devnull)

Run command asynchronously. Like open(command, stdio; read, write) except specifying the read and write flags via a mode string instead of keyword arguments. Possible mode strings are:

ModeDescriptionKeywords
rreadnone
wwritewrite = true
r+read, writeread = true, write = true
w+read, writeread = true, write = true
source
open(fd::OS_HANDLE) -> IO

Take a raw file descriptor wrap it in a Julia-aware IO type, and take ownership of the fd handle. Call open(Libc.dup(fd)) to avoid the ownership capture of the original handle.

Warning

Do not call this on a handle that's already owned by some other part of the system.

source
open(filename::AbstractString, [mode::AbstractString]; lock = true) -> IOStream

Alternate syntax for open, where a string-based mode specifier is used instead of the five booleans. The values of mode correspond to those from fopen(3) or Perl open, and are equivalent to setting the following boolean groups:

ModeDescriptionKeywords
rreadnone
wwrite, create, truncatewrite = true
awrite, create, appendappend = true
r+read, writeread = true, write = true
w+read, write, create, truncatetruncate = true, read = true
a+read, write, create, appendappend = true, read = true

The lock keyword argument controls whether operations will be locked for safe multi-threaded access.

Examples

julia> io = open("myfile.txt", "w");
+

I/O and Network

General I/O

Base.stdoutConstant
stdout::IO

Global variable referring to the standard out stream.

source
Base.stderrConstant
stderr::IO

Global variable referring to the standard error stream.

source
Base.stdinConstant
stdin::IO

Global variable referring to the standard input stream.

source
Base.readMethod
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
Base.writeMethod
write(filename::AbstractString, content)

Write the canonical binary representation of content to a file, which will be created if it does not exist yet or overwritten if it does exist.

Return the number of bytes written into the file.

source
Base.openFunction
open(f::Function, command, args...; kwargs...)

Similar to open(command, args...; kwargs...), but calls f(stream) on the resulting process stream, then closes the input stream and waits for the process to complete. Return the value returned by f on success. Throw an error if the process failed, or if the process attempts to print anything to stdout.

source
open(command, stdio=devnull; write::Bool = false, read::Bool = !write)

Start running command asynchronously, and return a process::IO object. If read is true, then reads from the process come from the process's standard output and stdio optionally specifies the process's standard input stream. If write is true, then writes go to the process's standard input and stdio optionally specifies the process's standard output stream. The process's standard error stream is connected to the current global stderr.

source
open(command, mode::AbstractString, stdio=devnull)

Run command asynchronously. Like open(command, stdio; read, write) except specifying the read and write flags via a mode string instead of keyword arguments. Possible mode strings are:

ModeDescriptionKeywords
rreadnone
wwritewrite = true
r+read, writeread = true, write = true
w+read, writeread = true, write = true
source
open(fd::OS_HANDLE) -> IO

Take a raw file descriptor wrap it in a Julia-aware IO type, and take ownership of the fd handle. Call open(Libc.dup(fd)) to avoid the ownership capture of the original handle.

Warning

Do not call this on a handle that's already owned by some other part of the system.

source
open(filename::AbstractString, [mode::AbstractString]; lock = true) -> IOStream

Alternate syntax for open, where a string-based mode specifier is used instead of the five booleans. The values of mode correspond to those from fopen(3) or Perl open, and are equivalent to setting the following boolean groups:

ModeDescriptionKeywords
rreadnone
wwrite, create, truncatewrite = true
awrite, create, appendappend = true
r+read, writeread = true, write = true
w+read, write, create, truncatetruncate = true, read = true
a+read, write, create, appendappend = true, read = true

The lock keyword argument controls whether operations will be locked for safe multi-threaded access.

Examples

julia> io = open("myfile.txt", "w");
 
 julia> write(io, "Hello world!");
 
@@ -27,18 +27,18 @@
 
 julia> close(io)
 
-julia> rm("myfile.txt")
Julia 1.5

The lock argument is available as of Julia 1.5.

source
open(filename::AbstractString; lock = true, keywords...) -> IOStream

Open a file in a mode specified by five boolean keyword arguments:

KeywordDescriptionDefault
readopen for reading!write
writeopen for writingtruncate | append
createcreate if non-existent!read & write | truncate | append
truncatetruncate to zero size!read & write
appendseek to endfalse

The default when no keywords are passed is to open files for reading only. Returns a stream for accessing the opened file.

The lock keyword argument controls whether operations will be locked for safe multi-threaded access.

Julia 1.5

The lock argument is available as of Julia 1.5.

source
open(f::Function, args...; kwargs...)

Apply the function f to the result of open(args...; kwargs...) and close the resulting file descriptor upon completion.

Examples

julia> write("myfile.txt", "Hello world!");
+julia> rm("myfile.txt")
Julia 1.5

The lock argument is available as of Julia 1.5.

source
open(filename::AbstractString; lock = true, keywords...) -> IOStream

Open a file in a mode specified by five boolean keyword arguments:

KeywordDescriptionDefault
readopen for reading!write
writeopen for writingtruncate | append
createcreate if non-existent!read & write | truncate | append
truncatetruncate to zero size!read & write
appendseek to endfalse

The default when no keywords are passed is to open files for reading only. Returns a stream for accessing the opened file.

The lock keyword argument controls whether operations will be locked for safe multi-threaded access.

Julia 1.5

The lock argument is available as of Julia 1.5.

source
open(f::Function, args...; kwargs...)

Apply the function f to the result of open(args...; kwargs...) and close the resulting file descriptor upon completion.

Examples

julia> write("myfile.txt", "Hello world!");
 
 julia> open(io->read(io, String), "myfile.txt")
 "Hello world!"
 
-julia> rm("myfile.txt")
source
Base.IOStreamType
IOStream

A buffered IO stream wrapping an OS file descriptor. Mostly used to represent files returned by open.

source
Base.IOBufferType
IOBuffer(string::String)

Create a read-only IOBuffer on the data underlying the given string.

Examples

julia> io = IOBuffer("Haho");
+julia> rm("myfile.txt")
source
Base.IOStreamType
IOStream

A buffered IO stream wrapping an OS file descriptor. Mostly used to represent files returned by open.

source
Base.IOBufferType
IOBuffer(string::String)

Create a read-only IOBuffer on the data underlying the given string.

Examples

julia> io = IOBuffer("Haho");
 
 julia> String(take!(io))
 "Haho"
 
 julia> String(take!(io))
-"Haho"
source
IOBuffer([data::AbstractVector{UInt8}]; keywords...) -> IOBuffer

Create an in-memory I/O stream, which may optionally operate on a pre-existing array.

It may take optional keyword arguments:

  • read, write, append: restricts operations to the buffer; see open for details.
  • truncate: truncates the buffer size to zero length.
  • maxsize: specifies a size beyond which the buffer may not be grown.
  • sizehint: suggests a capacity of the buffer (data must implement sizehint!(data, size)).

When data is not given, the buffer will be both readable and writable by default.

Passing `data` as scratch space to `IOBuffer` with `write=true` may give unexpected behavior

Once write is called on an IOBuffer, it is best to consider any previous references to data invalidated; in effect IOBuffer "owns" this data until a call to take!. Any indirect mutations to data could lead to undefined behavior by breaking the abstractions expected by IOBuffer. If write=true the IOBuffer may store data at any offset leaving behind arbitrary values at other offsets. If maxsize > length(data), the IOBuffer might re-allocate the data entirely, which may or may not be visible in any outstanding bindings to array.

Examples

julia> io = IOBuffer();
+"Haho"
source
IOBuffer([data::AbstractVector{UInt8}]; keywords...) -> IOBuffer

Create an in-memory I/O stream, which may optionally operate on a pre-existing array.

It may take optional keyword arguments:

  • read, write, append: restricts operations to the buffer; see open for details.
  • truncate: truncates the buffer size to zero length.
  • maxsize: specifies a size beyond which the buffer may not be grown.
  • sizehint: suggests a capacity of the buffer (data must implement sizehint!(data, size)).

When data is not given, the buffer will be both readable and writable by default.

Passing `data` as scratch space to `IOBuffer` with `write=true` may give unexpected behavior

Once write is called on an IOBuffer, it is best to consider any previous references to data invalidated; in effect IOBuffer "owns" this data until a call to take!. Any indirect mutations to data could lead to undefined behavior by breaking the abstractions expected by IOBuffer. If write=true the IOBuffer may store data at any offset leaving behind arbitrary values at other offsets. If maxsize > length(data), the IOBuffer might re-allocate the data entirely, which may or may not be visible in any outstanding bindings to array.

Examples

julia> io = IOBuffer();
 
 julia> write(io, "JuliaLang is a GitHub organization.", " It has many members.")
 56
@@ -68,13 +68,13 @@
 4
 
 julia> length(read(IOBuffer(b"data", read=true, truncate=true)))
-0
source
Base.take!Method
take!(b::IOBuffer)

Obtain the contents of an IOBuffer as an array. Afterwards, the IOBuffer is reset to its initial state.

Examples

julia> io = IOBuffer();
+0
source
Base.take!Method
take!(b::IOBuffer)

Obtain the contents of an IOBuffer as an array. Afterwards, the IOBuffer is reset to its initial state.

Examples

julia> io = IOBuffer();
 
 julia> write(io, "JuliaLang is a GitHub organization.", " It has many members.")
 56
 
 julia> String(take!(io))
-"JuliaLang is a GitHub organization. It has many members."
source
Base.PipeType
Pipe()

Construct an uninitialized Pipe object, especially for IO communication between multiple processes.

The appropriate end of the pipe will be automatically initialized if the object is used in process spawning. This can be useful to easily obtain references in process pipelines, e.g.:

julia> err = Pipe()
+"JuliaLang is a GitHub organization. It has many members."
source
Base.PipeType
Pipe()

Construct an uninitialized Pipe object, especially for IO communication between multiple processes.

The appropriate end of the pipe will be automatically initialized if the object is used in process spawning. This can be useful to easily obtain references in process pipelines, e.g.:

julia> err = Pipe()
 
 # After this `err` will be initialized and you may read `foo`'s
 # stderr from the `err` pipe, or pass `err` to other pipelines.
@@ -84,7 +84,7 @@
 julia> closewrite(err)
 
 julia> read(err, String)
-"stderr messages"

See also Base.link_pipe!.

source
Base.link_pipe!Function
link_pipe!(pipe; reader_supports_async=false, writer_supports_async=false)

Initialize pipe and link the in endpoint to the out endpoint. The keyword arguments reader_supports_async/writer_supports_async correspond to OVERLAPPED on Windows and O_NONBLOCK on POSIX systems. They should be true unless they'll be used by an external program (e.g. the output of a command executed with run).

source
Base.fdioFunction
fdio([name::AbstractString, ]fd::Integer[, own::Bool=false]) -> IOStream

Create an IOStream object from an integer file descriptor. If own is true, closing this object will close the underlying descriptor. By default, an IOStream is closed when it is garbage collected. name allows you to associate the descriptor with a named file.

source
Base.flushFunction
flush(stream)

Commit all currently buffered writes to the given stream.

source
Base.closewriteFunction
closewrite(stream)

Shutdown the write half of a full-duplex I/O stream. Performs a flush first. Notify the other end that no more data will be written to the underlying file. This is not supported by all IO types.

If implemented, closewrite causes subsequent read or eof calls that would block to instead throw EOF or return true, respectively. If the stream is already closed, this is idempotent.

Examples

julia> io = Base.BufferStream(); # this never blocks, so we can read and write on the same Task
+"stderr messages"

See also Base.link_pipe!.

source
Base.link_pipe!Function
link_pipe!(pipe; reader_supports_async=false, writer_supports_async=false)

Initialize pipe and link the in endpoint to the out endpoint. The keyword arguments reader_supports_async/writer_supports_async correspond to OVERLAPPED on Windows and O_NONBLOCK on POSIX systems. They should be true unless they'll be used by an external program (e.g. the output of a command executed with run).

source
Base.fdioFunction
fdio([name::AbstractString, ]fd::Integer[, own::Bool=false]) -> IOStream

Create an IOStream object from an integer file descriptor. If own is true, closing this object will close the underlying descriptor. By default, an IOStream is closed when it is garbage collected. name allows you to associate the descriptor with a named file.

source
Base.flushFunction
flush(stream)

Commit all currently buffered writes to the given stream.

source
Base.closewriteFunction
closewrite(stream)

Shutdown the write half of a full-duplex I/O stream. Performs a flush first. Notify the other end that no more data will be written to the underlying file. This is not supported by all IO types.

If implemented, closewrite causes subsequent read or eof calls that would block to instead throw EOF or return true, respectively. If the stream is already closed, this is idempotent.

Examples

julia> io = Base.BufferStream(); # this never blocks, so we can read and write on the same Task
 
 julia> write(io, "request");
 
@@ -93,7 +93,7 @@
 julia> closewrite(io);
 
 julia> read(io, String)
-"request"
source
Base.writeFunction
write(io::IO, x)

Write the canonical binary representation of a value to the given I/O stream or file. Return the number of bytes written into the stream. See also print to write a text representation (with an encoding that may depend upon io).

The endianness of the written value depends on the endianness of the host system. Convert to/from a fixed endianness when writing/reading (e.g. using htol and ltoh) to get results that are consistent across platforms.

You can write multiple values with the same write call, i.e. the following are equivalent:

write(io, x, y...)
+"request"
source
Base.writeFunction
write(io::IO, x)

Write the canonical binary representation of a value to the given I/O stream or file. Return the number of bytes written into the stream. See also print to write a text representation (with an encoding that may depend upon io).

The endianness of the written value depends on the endianness of the host system. Convert to/from a fixed endianness when writing/reading (e.g. using htol and ltoh) to get results that are consistent across platforms.

You can write multiple values with the same write call, i.e. the following are equivalent:

write(io, x, y...)
 write(io, x) + write(io, y...)

Examples

Consistent serialization:

julia> fname = tempname(); # random temporary filename
 
 julia> open(fname,"w") do f
@@ -127,7 +127,7 @@
 8
 
 julia> seekstart(io); read!(io, Ref(MyStruct(NaN)))
-Base.RefValue{MyStruct}(MyStruct(42.0))
source
Base.readFunction
read(command::Cmd, String)

Run command and return the resulting output as a String.

source
read(command::Cmd)

Run command and return the resulting output as an array of bytes.

source
read(s::IOStream, nb::Integer; all=true)

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
read(s::IO, nb=typemax(Int))

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

source
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
read(io::IO, T)

Read a single value of type T from io, in canonical binary representation.

Note that Julia does not convert the endianness for you. Use ntoh or ltoh for this purpose.

read(io::IO, String)

Read the entirety of io, as a String (see also readchomp).

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
+Base.RefValue{MyStruct}(MyStruct(42.0))
source
Base.readFunction
read(command::Cmd, String)

Run command and return the resulting output as a String.

source
read(command::Cmd)

Run command and return the resulting output as an array of bytes.

source
read(s::IOStream, nb::Integer; all=true)

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
read(s::IO, nb=typemax(Int))

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

source
read(filename::AbstractString)

Read the entire contents of a file as a Vector{UInt8}.

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

source
read(io::IO, T)

Read a single value of type T from io, in canonical binary representation.

Note that Julia does not convert the endianness for you. Use ntoh or ltoh for this purpose.

read(io::IO, String)

Read the entirety of io, as a String (see also readchomp).

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
 
 julia> read(io, Char)
 'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase)
@@ -135,14 +135,14 @@
 julia> io = IOBuffer("JuliaLang is a GitHub organization");
 
 julia> read(io, String)
-"JuliaLang is a GitHub organization"
source
Base.read!Function
read!(stream::IO, array::AbstractArray)
-read!(filename::AbstractString, array::AbstractArray)

Read binary data from an I/O stream or file, filling in array.

source
Base.readbytes!Function
readbytes!(stream::IOStream, b::AbstractVector{UInt8}, nb=length(b); all::Bool=true)

Read at most nb bytes from stream into b, returning the number of bytes read. The size of b will be increased if needed (i.e. if nb is greater than length(b) and enough bytes could be read), but it will never be decreased.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
readbytes!(stream::IO, b::AbstractVector{UInt8}, nb=length(b))

Read at most nb bytes from stream into b, returning the number of bytes read. The size of b will be increased if needed (i.e. if nb is greater than length(b) and enough bytes could be read), but it will never be decreased.

source
Base.unsafe_readFunction
unsafe_read(io::IO, ref, nbytes::UInt)

Copy nbytes from the IO stream object into ref (converted to a pointer).

It is recommended that subtypes T<:IO override the following method signature to provide more efficient implementations: unsafe_read(s::T, p::Ptr{UInt8}, n::UInt)

source
Base.unsafe_writeFunction
unsafe_write(io::IO, ref, nbytes::UInt)

Copy nbytes from ref (converted to a pointer) into the IO object.

It is recommended that subtypes T<:IO override the following method signature to provide more efficient implementations: unsafe_write(s::T, p::Ptr{UInt8}, n::UInt)

source
Base.readeachFunction
readeach(io::IO, T)

Return an iterable object yielding read(io, T).

See also skipchars, eachline, readuntil.

Julia 1.6

readeach requires Julia 1.6 or later.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.\n It has many members.\n");
+"JuliaLang is a GitHub organization"
source
Base.read!Function
read!(stream::IO, array::AbstractArray)
+read!(filename::AbstractString, array::AbstractArray)

Read binary data from an I/O stream or file, filling in array.

source
Base.readbytes!Function
readbytes!(stream::IOStream, b::AbstractVector{UInt8}, nb=length(b); all::Bool=true)

Read at most nb bytes from stream into b, returning the number of bytes read. The size of b will be increased if needed (i.e. if nb is greater than length(b) and enough bytes could be read), but it will never be decreased.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
readbytes!(stream::IO, b::AbstractVector{UInt8}, nb=length(b))

Read at most nb bytes from stream into b, returning the number of bytes read. The size of b will be increased if needed (i.e. if nb is greater than length(b) and enough bytes could be read), but it will never be decreased.

source
Base.unsafe_readFunction
unsafe_read(io::IO, ref, nbytes::UInt)

Copy nbytes from the IO stream object into ref (converted to a pointer).

It is recommended that subtypes T<:IO override the following method signature to provide more efficient implementations: unsafe_read(s::T, p::Ptr{UInt8}, n::UInt)

source
Base.unsafe_writeFunction
unsafe_write(io::IO, ref, nbytes::UInt)

Copy nbytes from ref (converted to a pointer) into the IO object.

It is recommended that subtypes T<:IO override the following method signature to provide more efficient implementations: unsafe_write(s::T, p::Ptr{UInt8}, n::UInt)

source
Base.readeachFunction
readeach(io::IO, T)

Return an iterable object yielding read(io, T).

See also skipchars, eachline, readuntil.

Julia 1.6

readeach requires Julia 1.6 or later.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.\n It has many members.\n");
 
 julia> for c in readeach(io, Char)
            c == '\n' && break
            print(c)
        end
-JuliaLang is a GitHub organization.
source
Base.peekFunction
peek(stream[, T=UInt8])

Read and return a value of type T from a stream without advancing the current position in the stream. See also startswith(stream, char_or_string).

Examples

julia> b = IOBuffer("julia");
+JuliaLang is a GitHub organization.
source
Base.peekFunction
peek(stream[, T=UInt8])

Read and return a value of type T from a stream without advancing the current position in the stream. See also startswith(stream, char_or_string).

Examples

julia> b = IOBuffer("julia");
 
 julia> peek(b)
 0x6a
@@ -151,7 +151,7 @@
 0
 
 julia> peek(b, Char)
-'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)
Julia 1.5

The method which accepts a type requires Julia 1.5 or later.

source
Base.positionFunction
position(l::Lexer)

Returns the current position.

source
position(s)

Get the current position of a stream.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
+'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)
Julia 1.5

The method which accepts a type requires Julia 1.5 or later.

source
Base.positionFunction
position(l::Lexer)

Returns the current position.

source
position(s)

Get the current position of a stream.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
 
 julia> seek(io, 5);
 
@@ -166,12 +166,12 @@
 julia> seekend(io);
 
 julia> position(io)
-35
source
Base.seekFunction
seek(s, pos)

Seek a stream to the given position.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
+35
source
Base.seekFunction
seek(s, pos)

Seek a stream to the given position.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
 
 julia> seek(io, 5);
 
 julia> read(io, Char)
-'L': ASCII/Unicode U+004C (category Lu: Letter, uppercase)
source
Base.seekstartFunction
seekstart(s)

Seek a stream to its beginning.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
+'L': ASCII/Unicode U+004C (category Lu: Letter, uppercase)
source
Base.seekstartFunction
seekstart(s)

Seek a stream to its beginning.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
 
 julia> seek(io, 5);
 
@@ -181,14 +181,14 @@
 julia> seekstart(io);
 
 julia> read(io, Char)
-'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase)
source
Base.skipFunction
skip(s, offset)

Seek a stream relative to the current position.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
+'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase)
source
Base.skipFunction
skip(s, offset)

Seek a stream relative to the current position.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.");
 
 julia> seek(io, 5);
 
 julia> skip(io, 10);
 
 julia> read(io, Char)
-'G': ASCII/Unicode U+0047 (category Lu: Letter, uppercase)
source
Base.resetMethod
reset(s::IO)

Reset a stream s to a previously marked position, and remove the mark. Return the previously marked position. Throw an error if the stream is not marked.

See also mark, unmark, ismarked.

source
Base.eofFunction
eof(stream) -> Bool

Test whether an I/O stream is at end-of-file. If the stream is not yet exhausted, this function will block to wait for more data if necessary, and then return false. Therefore it is always safe to read one byte after seeing eof return false. eof will return false as long as buffered data is still available, even if the remote end of a connection is closed.

Examples

julia> b = IOBuffer("my buffer");
+'G': ASCII/Unicode U+0047 (category Lu: Letter, uppercase)
source
Base.resetMethod
reset(s::IO)

Reset a stream s to a previously marked position, and remove the mark. Return the previously marked position. Throw an error if the stream is not marked.

See also mark, unmark, ismarked.

source
Base.eofFunction
eof(stream) -> Bool

Test whether an I/O stream is at end-of-file. If the stream is not yet exhausted, this function will block to wait for more data if necessary, and then return false. Therefore it is always safe to read one byte after seeing eof return false. eof will return false as long as buffered data is still available, even if the remote end of a connection is closed.

Examples

julia> b = IOBuffer("my buffer");
 
 julia> eof(b)
 false
@@ -196,7 +196,7 @@
 julia> seekend(b);
 
 julia> eof(b)
-true
source
Base.isreadonlyFunction
isreadonly(io) -> Bool

Determine whether a stream is read-only.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
+true
source
Base.isreadonlyFunction
isreadonly(io) -> Bool

Determine whether a stream is read-only.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
 
 julia> isreadonly(io)
 true
@@ -204,7 +204,7 @@
 julia> io = IOBuffer();
 
 julia> isreadonly(io)
-false
source
Base.iswritableFunction
iswritable(path::String)

Return true if the access permissions for the given path permitted writing by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling iswritable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, isreadable.

source
iswritable(io) -> Bool

Return false if the specified IO object is not writable.

Examples

julia> open("myfile.txt", "w") do io
+false
source
Base.iswritableFunction
iswritable(path::String)

Return true if the access permissions for the given path permitted writing by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling iswritable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, isreadable.

source
iswritable(io) -> Bool

Return false if the specified IO object is not writable.

Examples

julia> open("myfile.txt", "w") do io
            print(io, "Hello world!");
            iswritable(io)
        end
@@ -215,7 +215,7 @@
        end
 false
 
-julia> rm("myfile.txt")
source
Base.isreadableFunction
isreadable(path::String)

Return true if the access permissions for the given path permitted reading by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling isreadable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, iswritable.

source
isreadable(io) -> Bool

Return false if the specified IO object is not readable.

Examples

julia> open("myfile.txt", "w") do io
+julia> rm("myfile.txt")
source
Base.isreadableFunction
isreadable(path::String)

Return true if the access permissions for the given path permitted reading by the current user.

Note

This permission may change before the user calls open, so it is recommended to just call open alone and handle the error if that fails, rather than calling isreadable first.

Note

Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.

Julia 1.11

This function requires at least Julia 1.11.

See also ispath, isexecutable, iswritable.

source
isreadable(io) -> Bool

Return false if the specified IO object is not readable.

Examples

julia> open("myfile.txt", "w") do io
            print(io, "Hello world!");
            isreadable(io)
        end
@@ -226,7 +226,7 @@
        end
 true
 
-julia> rm("myfile.txt")
source
Base.isexecutableFunction
isexecutable(path::String)

Return true if the given path has executable permissions.

Note

This permission may change before the user executes path, so it is recommended to execute the file and handle the error if that fails, rather than calling isexecutable first.

Note

Prior to Julia 1.6, this did not correctly interrogate filesystem ACLs on Windows, therefore it would return true for any file. From Julia 1.6 on, it correctly determines whether the file is marked as executable or not.

See also ispath, isreadable, iswritable.

source
Base.isopenFunction
isopen(object) -> Bool

Determine whether an object - such as a stream or timer – is not yet closed. Once an object is closed, it will never produce a new event. However, since a closed stream may still have data to read in its buffer, use eof to check for the ability to read data. Use the FileWatching package to be notified when a stream might be writable or readable.

Examples

julia> io = open("my_file.txt", "w+");
+julia> rm("myfile.txt")
source
Base.isexecutableFunction
isexecutable(path::String)

Return true if the given path has executable permissions.

Note

This permission may change before the user executes path, so it is recommended to execute the file and handle the error if that fails, rather than calling isexecutable first.

Note

Prior to Julia 1.6, this did not correctly interrogate filesystem ACLs on Windows, therefore it would return true for any file. From Julia 1.6 on, it correctly determines whether the file is marked as executable or not.

See also ispath, isreadable, iswritable.

source
Base.isopenFunction
isopen(object) -> Bool

Determine whether an object - such as a stream or timer – is not yet closed. Once an object is closed, it will never produce a new event. However, since a closed stream may still have data to read in its buffer, use eof to check for the ability to read data. Use the FileWatching package to be notified when a stream might be writable or readable.

Examples

julia> io = open("my_file.txt", "w+");
 
 julia> isopen(io)
 true
@@ -234,7 +234,7 @@
 julia> close(io)
 
 julia> isopen(io)
-false
source
Base.fdFunction
fd(x) -> RawFD

Return the file descriptor backing the stream, file, or socket.

RawFD objects can be passed directly to other languages via the ccall interface.

Julia 1.12

Prior to 1.12, this function returned an Int instead of a RawFD. You may use RawFD(fd(x)) to produce a RawFD in all Julia versions.

Julia 1.12

Getting the file descriptor of sockets are supported as of Julia 1.12.

Warning

Duplicate the returned file descriptor with Libc.dup() before passing it to another system that will take ownership of it (e.g. a C library). Otherwise both the Julia object x and the other system may try to close the file descriptor, which will cause errors.

Warning

The file descriptors for sockets are asynchronous (i.e. O_NONBLOCK on POSIX and OVERLAPPED on Windows), they may behave differently than regular file descriptors.

source
Base.redirect_stdioFunction
redirect_stdio(f; stdin=nothing, stderr=nothing, stdout=nothing)

Redirect a subset of the streams stdin, stderr, stdout, call f() and restore each stream.

Possible values for each stream are:

  • nothing indicating the stream should not be redirected.
  • path::AbstractString redirecting the stream to the file at path.
  • io an IOStream, TTY, Pipe, socket, or devnull.

Examples

julia> redirect_stdio(stdout="stdout.txt", stderr="stderr.txt") do
+false
source
Base.fdFunction
fd(x) -> RawFD

Return the file descriptor backing the stream, file, or socket.

RawFD objects can be passed directly to other languages via the ccall interface.

Julia 1.12

Prior to 1.12, this function returned an Int instead of a RawFD. You may use RawFD(fd(x)) to produce a RawFD in all Julia versions.

Julia 1.12

Getting the file descriptor of sockets are supported as of Julia 1.12.

Warning

Duplicate the returned file descriptor with Libc.dup() before passing it to another system that will take ownership of it (e.g. a C library). Otherwise both the Julia object x and the other system may try to close the file descriptor, which will cause errors.

Warning

The file descriptors for sockets are asynchronous (i.e. O_NONBLOCK on POSIX and OVERLAPPED on Windows), they may behave differently than regular file descriptors.

source
Base.redirect_stdioFunction
redirect_stdio(f; stdin=nothing, stderr=nothing, stdout=nothing)

Redirect a subset of the streams stdin, stderr, stdout, call f() and restore each stream.

Possible values for each stream are:

  • nothing indicating the stream should not be redirected.
  • path::AbstractString redirecting the stream to the file at path.
  • io an IOStream, TTY, Pipe, socket, or devnull.

Examples

julia> redirect_stdio(stdout="stdout.txt", stderr="stderr.txt") do
            print("hello stdout")
            print(stderr, "hello stderr")
        end
@@ -251,12 +251,12 @@
 
 julia> redirect_stdio(f, stdout=io1, stderr=io2) # not supported

Also the stdin argument may not be the same descriptor as stdout or stderr.

julia> io = open(...)
 
-julia> redirect_stdio(f, stdout=io, stdin=io) # not supported
Julia 1.7

redirect_stdio requires Julia 1.7 or later.

source
redirect_stdio(;stdin=stdin, stderr=stderr, stdout=stdout)

Redirect a subset of the streams stdin, stderr, stdout. Each argument must be an IOStream, TTY, Pipe, socket, or devnull.

Julia 1.7

redirect_stdio requires Julia 1.7 or later.

source
Base.redirect_stdoutFunction
redirect_stdout([stream]) -> stream

Create a pipe to which all C and Julia level stdout output will be redirected. Return a stream representing the pipe ends. Data written to stdout may now be read from the rd end of the pipe.

Note

stream must be a compatible objects, such as an IOStream, TTY, Pipe, socket, or devnull.

See also redirect_stdio.

source
Base.redirect_stdinMethod
redirect_stdin(f::Function, stream)

Run the function f while redirecting stdin to stream. Upon completion, stdin is restored to its prior setting.

source
Base.readchompFunction
readchomp(x)

Read the entirety of x as a string and remove a single trailing newline if there is one. Equivalent to chomp(read(x, String)).

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
+julia> redirect_stdio(f, stdout=io, stdin=io) # not supported
Julia 1.7

redirect_stdio requires Julia 1.7 or later.

source
redirect_stdio(;stdin=stdin, stderr=stderr, stdout=stdout)

Redirect a subset of the streams stdin, stderr, stdout. Each argument must be an IOStream, TTY, Pipe, socket, or devnull.

Julia 1.7

redirect_stdio requires Julia 1.7 or later.

source
Base.redirect_stdoutFunction
redirect_stdout([stream]) -> stream

Create a pipe to which all C and Julia level stdout output will be redirected. Return a stream representing the pipe ends. Data written to stdout may now be read from the rd end of the pipe.

Note

stream must be a compatible objects, such as an IOStream, TTY, Pipe, socket, or devnull.

See also redirect_stdio.

source
Base.redirect_stdinMethod
redirect_stdin(f::Function, stream)

Run the function f while redirecting stdin to stream. Upon completion, stdin is restored to its prior setting.

source
Base.readchompFunction
readchomp(x)

Read the entirety of x as a string and remove a single trailing newline if there is one. Equivalent to chomp(read(x, String)).

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
 
 julia> readchomp("my_file.txt")
 "JuliaLang is a GitHub organization.\nIt has many members."
 
-julia> rm("my_file.txt");
source
Base.truncateFunction
truncate(file, n)

Resize the file or buffer given by the first argument to exactly n bytes, filling previously unallocated space with '\0' if the file or buffer is grown.

Examples

julia> io = IOBuffer();
+julia> rm("my_file.txt");
source
Base.truncateFunction
truncate(file, n)

Resize the file or buffer given by the first argument to exactly n bytes, filling previously unallocated space with '\0' if the file or buffer is grown.

Examples

julia> io = IOBuffer();
 
 julia> write(io, "JuliaLang is a GitHub organization.")
 35
@@ -274,14 +274,14 @@
 julia> truncate(io, 40);
 
 julia> String(take!(io))
-"JuliaLang is a GitHub organization.\0\0\0\0\0"
source
Base.skipcharsFunction
skipchars(predicate, io::IO; linecomment=nothing)

Advance the stream io such that the next-read character will be the first remaining for which predicate returns false. If the keyword argument linecomment is specified, all characters from that character until the start of the next line are ignored.

Examples

julia> buf = IOBuffer("    text")
+"JuliaLang is a GitHub organization.\0\0\0\0\0"
source
Base.skipcharsFunction
skipchars(predicate, io::IO; linecomment=nothing)

Advance the stream io such that the next-read character will be the first remaining for which predicate returns false. If the keyword argument linecomment is specified, all characters from that character until the start of the next line are ignored.

Examples

julia> buf = IOBuffer("    text")
 IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=8, maxsize=Inf, ptr=1, mark=-1)
 
 julia> skipchars(isspace, buf)
 IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=8, maxsize=Inf, ptr=5, mark=-1)
 
 julia> String(readavailable(buf))
-"text"
source
Base.countlinesFunction
countlines(io::IO; eol::AbstractChar = '\n')
 countlines(filename::AbstractString; eol::AbstractChar = '\n')

Read io until the end of the stream/file and count the number of lines. To specify a file pass the filename as the first argument. EOL markers other than '\n' are supported by passing them as the second argument. The last non-empty line of io is counted even if it does not end with the EOL, matching the length returned by eachline and readlines.

To count lines of a String, countlines(IOBuffer(str)) can be used.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization.\n");
 
 julia> countlines(io)
@@ -308,7 +308,7 @@
 4
 
 julia> rm("my_file.txt")
-
source
Base.PipeBufferFunction
PipeBuffer(data::AbstractVector{UInt8}=UInt8[]; maxsize::Integer = typemax(Int))

An IOBuffer that allows reading and performs writes by appending. Seeking and truncating are not supported. See IOBuffer for the available constructors. If data is given, creates a PipeBuffer to operate on a data vector, optionally specifying a size beyond which the underlying Array may not be grown.

source
Base.readavailableFunction
readavailable(stream)

Read available buffered data from a stream. Actual I/O is performed only if no data has already been buffered. The result is a Vector{UInt8}.

Warning

The amount of data returned is implementation-dependent; for example it can depend on the internal choice of buffer size. Other functions such as read should generally be used instead.

source
Base.IOContextType
IOContext

IOContext provides a mechanism for passing output configuration settings among show methods.

In short, it is an immutable dictionary that is a subclass of IO. It supports standard dictionary operations such as getindex, and can also be used as an I/O stream.

source
Base.IOContextMethod
IOContext(io::IO, KV::Pair...)

Create an IOContext that wraps a given stream, adding the specified key=>value pairs to the properties of that stream (note that io can itself be an IOContext).

  • use (key => value) in io to see if this particular combination is in the properties set
  • use get(io, key, default) to retrieve the most recent value for a particular key

The following properties are in common use:

  • :compact: Boolean specifying that values should be printed more compactly, e.g. that numbers should be printed with fewer digits. This is set when printing array elements. :compact output should not contain line breaks.
  • :limit: Boolean specifying that containers should be truncated, e.g. showing in place of most elements.
  • :displaysize: A Tuple{Int,Int} giving the size in rows and columns to use for text output. This can be used to override the display size for called functions, but to get the size of the screen use the displaysize function.
  • :typeinfo: a Type characterizing the information already printed concerning the type of the object about to be displayed. This is mainly useful when displaying a collection of objects of the same type, so that redundant type information can be avoided (e.g. [Float16(0)] can be shown as "Float16[0.0]" instead of "Float16[Float16(0.0)]" : while displaying the elements of the array, the :typeinfo property will be set to Float16).
  • :color: Boolean specifying whether ANSI color/escape codes are supported/expected. By default, this is determined by whether io is a compatible terminal and by any --color command-line flag when julia was launched.

Examples

julia> io = IOBuffer();
+
source
Base.PipeBufferFunction
PipeBuffer(data::AbstractVector{UInt8}=UInt8[]; maxsize::Integer = typemax(Int))

An IOBuffer that allows reading and performs writes by appending. Seeking and truncating are not supported. See IOBuffer for the available constructors. If data is given, creates a PipeBuffer to operate on a data vector, optionally specifying a size beyond which the underlying Array may not be grown.

source
Base.readavailableFunction
readavailable(stream)

Read available buffered data from a stream. Actual I/O is performed only if no data has already been buffered. The result is a Vector{UInt8}.

Warning

The amount of data returned is implementation-dependent; for example it can depend on the internal choice of buffer size. Other functions such as read should generally be used instead.

source
Base.IOContextType
IOContext

IOContext provides a mechanism for passing output configuration settings among show methods.

In short, it is an immutable dictionary that is a subclass of IO. It supports standard dictionary operations such as getindex, and can also be used as an I/O stream.

source
Base.IOContextMethod
IOContext(io::IO, KV::Pair...)

Create an IOContext that wraps a given stream, adding the specified key=>value pairs to the properties of that stream (note that io can itself be an IOContext).

  • use (key => value) in io to see if this particular combination is in the properties set
  • use get(io, key, default) to retrieve the most recent value for a particular key

The following properties are in common use:

  • :compact: Boolean specifying that values should be printed more compactly, e.g. that numbers should be printed with fewer digits. This is set when printing array elements. :compact output should not contain line breaks.
  • :limit: Boolean specifying that containers should be truncated, e.g. showing in place of most elements.
  • :displaysize: A Tuple{Int,Int} giving the size in rows and columns to use for text output. This can be used to override the display size for called functions, but to get the size of the screen use the displaysize function.
  • :typeinfo: a Type characterizing the information already printed concerning the type of the object about to be displayed. This is mainly useful when displaying a collection of objects of the same type, so that redundant type information can be avoided (e.g. [Float16(0)] can be shown as "Float16[0.0]" instead of "Float16[Float16(0.0)]" : while displaying the elements of the array, the :typeinfo property will be set to Float16).
  • :color: Boolean specifying whether ANSI color/escape codes are supported/expected. By default, this is determined by whether io is a compatible terminal and by any --color command-line flag when julia was launched.

Examples

julia> io = IOBuffer();
 
 julia> printstyled(IOContext(io, :color => true), "string", color=:red)
 
@@ -333,22 +333,22 @@
 julia> f(stdout)
 loooooong
 julia> f(IOContext(stdout, :short => true))
-short
source
Base.IOContextMethod
IOContext(io::IO, context::IOContext)

Create an IOContext that wraps an alternate IO but inherits the properties of context.

Note

Unless explicitly set in the wrapped io the displaysize of io will not be inherited. This is because by default displaysize is not a property of IO objects themselves, but lazily inferred, as the size of the terminal window can change during the lifetime of the IO object.

source

Text I/O

Base.showMethod
show([io::IO = stdout], x)

Write a text representation of a value x to the output stream io. New types T should overload show(io::IO, x::T). The representation used by show generally includes Julia-specific formatting and type information, and should be parseable Julia code when possible.

repr returns the output of show as a string.

For a more verbose human-readable text output for objects of type T, define show(io::IO, ::MIME"text/plain", ::T) in addition. Checking the :compact IOContext key (often checked as get(io, :compact, false)::Bool) of io in such methods is recommended, since some containers show their elements by calling this method with :compact => true.

See also print, which writes un-decorated representations.

Examples

julia> show("Hello World!")
+short
source
Base.IOContextMethod
IOContext(io::IO, context::IOContext)

Create an IOContext that wraps an alternate IO but inherits the properties of context.

Note

Unless explicitly set in the wrapped io the displaysize of io will not be inherited. This is because by default displaysize is not a property of IO objects themselves, but lazily inferred, as the size of the terminal window can change during the lifetime of the IO object.

source

Text I/O

Base.showMethod
show([io::IO = stdout], x)

Write a text representation of a value x to the output stream io. New types T should overload show(io::IO, x::T). The representation used by show generally includes Julia-specific formatting and type information, and should be parseable Julia code when possible.

repr returns the output of show as a string.

For a more verbose human-readable text output for objects of type T, define show(io::IO, ::MIME"text/plain", ::T) in addition. Checking the :compact IOContext key (often checked as get(io, :compact, false)::Bool) of io in such methods is recommended, since some containers show their elements by calling this method with :compact => true.

See also print, which writes un-decorated representations.

Examples

julia> show("Hello World!")
 "Hello World!"
 julia> print("Hello World!")
-Hello World!
source
Base.summaryFunction
summary(io::IO, x)
 str = summary(x)

Print to a stream io, or return a string str, giving a brief description of a value. By default returns string(typeof(x)), e.g. Int64.

For arrays, returns a string of size and type info, e.g. 10-element Vector{Int64} or 9×4×5 Array{Float64, 3}.

Examples

julia> summary(1)
 "Int64"
 
 julia> summary(zeros(2))
-"2-element Vector{Float64}"
source
Base.printFunction
print([io::IO], xs...)

Write to io (or to the default output stream stdout if io is not given) a canonical (un-decorated) text representation. The representation used by print includes minimal formatting and tries to avoid Julia-specific details.

print falls back to calling the 2-argument show(io, x) for each argument x in xs, so most types should just define show. Define print if your type has a separate "plain" representation. For example, show displays strings with quotes, and print displays strings without quotes.

See also println, string, printstyled.

Examples

julia> print("Hello World!")
+"2-element Vector{Float64}"
source
Base.printFunction
print([io::IO], xs...)

Write to io (or to the default output stream stdout if io is not given) a canonical (un-decorated) text representation. The representation used by print includes minimal formatting and tries to avoid Julia-specific details.

print falls back to calling the 2-argument show(io, x) for each argument x in xs, so most types should just define show. Define print if your type has a separate "plain" representation. For example, show displays strings with quotes, and print displays strings without quotes.

See also println, string, printstyled.

Examples

julia> print("Hello World!")
 Hello World!
 julia> io = IOBuffer();
 
 julia> print(io, "Hello", ' ', :World!)
 
 julia> String(take!(io))
-"Hello World!"
source
Base.printlnFunction
println([io::IO], xs...)

Print (using print) xs to io followed by a newline. If io is not supplied, prints to the default output stream stdout.

See also printstyled to add colors etc.

Examples

julia> println("Hello, world")
+"Hello World!"
source
Base.printlnFunction
println([io::IO], xs...)

Print (using print) xs to io followed by a newline. If io is not supplied, prints to the default output stream stdout.

See also printstyled to add colors etc.

Examples

julia> println("Hello, world")
 Hello, world
 
 julia> io = IOBuffer();
@@ -356,11 +356,11 @@
 julia> println(io, "Hello", ',', " world.")
 
 julia> String(take!(io))
-"Hello, world.\n"
source
Base.printstyledFunction
printstyled([io], xs...; bold::Bool=false, italic::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Symbol,Int}=:normal)

Print xs in a color specified as a symbol or integer, optionally in bold.

Keyword color may take any of the values :normal, :italic, :default, :bold, :black, :blink, :blue, :cyan, :green, :hidden, :light_black, :light_blue, :light_cyan, :light_green, :light_magenta, :light_red, :light_white, :light_yellow, :magenta, :nothing, :red, :reverse, :underline, :white, or :yellow or an integer between 0 and 255 inclusive. Note that not all terminals support 256 colors.

Keywords bold=true, italic=true, underline=true, blink=true are self-explanatory. Keyword reverse=true prints with foreground and background colors exchanged, and hidden=true should be invisible in the terminal but can still be copied. These properties can be used in any combination.

See also print, println, show.

Note

Not all terminals support italic output. Some terminals interpret italic as reverse or blink.

Julia 1.7

Keywords except color and bold were added in Julia 1.7.

Julia 1.10

Support for italic output was added in Julia 1.10.

source
Base.sprintFunction
sprint(f::Function, args...; context=nothing, sizehint=0)

Call the given function with an I/O stream and the supplied extra arguments. Everything written to this I/O stream is returned as a string. context can be an IOContext whose properties will be used, a Pair specifying a property and its value, or a tuple of Pair specifying multiple properties and their values. sizehint suggests the capacity of the buffer (in bytes).

The optional keyword argument context can be set to a :key=>value pair, a tuple of :key=>value pairs, or an IO or IOContext object whose attributes are used for the I/O stream passed to f. The optional sizehint is a suggested size (in bytes) to allocate for the buffer used to write the string.

Julia 1.7

Passing a tuple to keyword context requires Julia 1.7 or later.

Examples

julia> sprint(show, 66.66666; context=:compact => true)
+"Hello, world.\n"
source
Base.printstyledFunction
printstyled([io], xs...; bold::Bool=false, italic::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Symbol,Int}=:normal)

Print xs in a color specified as a symbol or integer, optionally in bold.

Keyword color may take any of the values :normal, :italic, :default, :bold, :black, :blink, :blue, :cyan, :green, :hidden, :light_black, :light_blue, :light_cyan, :light_green, :light_magenta, :light_red, :light_white, :light_yellow, :magenta, :nothing, :red, :reverse, :underline, :white, or :yellow or an integer between 0 and 255 inclusive. Note that not all terminals support 256 colors.

Keywords bold=true, italic=true, underline=true, blink=true are self-explanatory. Keyword reverse=true prints with foreground and background colors exchanged, and hidden=true should be invisible in the terminal but can still be copied. These properties can be used in any combination.

See also print, println, show.

Note

Not all terminals support italic output. Some terminals interpret italic as reverse or blink.

Julia 1.7

Keywords except color and bold were added in Julia 1.7.

Julia 1.10

Support for italic output was added in Julia 1.10.

source
Base.sprintFunction
sprint(f::Function, args...; context=nothing, sizehint=0)

Call the given function with an I/O stream and the supplied extra arguments. Everything written to this I/O stream is returned as a string. context can be an IOContext whose properties will be used, a Pair specifying a property and its value, or a tuple of Pair specifying multiple properties and their values. sizehint suggests the capacity of the buffer (in bytes).

The optional keyword argument context can be set to a :key=>value pair, a tuple of :key=>value pairs, or an IO or IOContext object whose attributes are used for the I/O stream passed to f. The optional sizehint is a suggested size (in bytes) to allocate for the buffer used to write the string.

Julia 1.7

Passing a tuple to keyword context requires Julia 1.7 or later.

Examples

julia> sprint(show, 66.66666; context=:compact => true)
 "66.6667"
 
 julia> sprint(showerror, BoundsError([1], 100))
-"BoundsError: attempt to access 1-element Vector{Int64} at index [100]"
source
Base.showerrorFunction
showerror(io, e)

Show a descriptive representation of an exception object e. This method is used to display the exception after a call to throw.

Examples

julia> struct MyException <: Exception
+"BoundsError: attempt to access 1-element Vector{Int64} at index [100]"
source
Base.showerrorFunction
showerror(io, e)

Show a descriptive representation of an exception object e. This method is used to display the exception after a call to throw.

Examples

julia> struct MyException <: Exception
            msg::String
        end
 
@@ -376,7 +376,7 @@
 "MyException: test exception"
 
 julia> throw(MyException("test exception"))
-ERROR: MyException: test exception
source
Base.dumpFunction
dump(x; maxdepth=8)

Show every part of the representation of a value. The depth of the output is truncated at maxdepth.

Examples

julia> struct MyStruct
+ERROR: MyException: test exception
source
Base.dumpFunction
dump(x; maxdepth=8)

Show every part of the representation of a value. The depth of the output is truncated at maxdepth.

Examples

julia> struct MyStruct
            x
            y
        end
@@ -393,7 +393,7 @@
 julia> dump(x; maxdepth = 1)
 MyStruct
   x: Int64 1
-  y: Tuple{Int64, Int64}
source
Base.readlineFunction
readline(io::IO=stdin; keep::Bool=false)
+  y: Tuple{Int64, Int64}
source
Base.readlineFunction
readline(io::IO=stdin; keep::Bool=false)
 readline(filename::AbstractString; keep::Bool=false)

Read a single line of text from the given I/O stream or file (defaults to stdin). When reading from a file, the text is assumed to be encoded in UTF-8. Lines in the input end with '\n' or "\r\n" or the end of an input stream. When keep is false (as it is by default), these trailing newline characters are removed from the line before it is returned. When keep is true, they are returned as part of the line.

Return a String. See also copyline to instead write in-place to another stream (which can be a preallocated IOBuffer).

See also readuntil for reading until more general delimiters.

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
 
 julia> readline("my_file.txt")
@@ -407,7 +407,7 @@
 
 julia> your_name = readline()
 Logan
-"Logan"
source
Base.readuntilFunction
readuntil(stream::IO, delim; keep::Bool = false)
 readuntil(filename::AbstractString, delim; keep::Bool = false)

Read a string from an I/O stream or a file, up to the given delimiter. The delimiter can be a UInt8, AbstractChar, string, or vector. Keyword argument keep controls whether the delimiter is included in the result. The text is assumed to be encoded in UTF-8.

Return a String if delim is an AbstractChar or a string or otherwise return a Vector{typeof(delim)}. See also copyuntil to instead write in-place to another stream (which can be a preallocated IOBuffer).

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
 
 julia> readuntil("my_file.txt", 'L')
@@ -416,7 +416,7 @@
 julia> readuntil("my_file.txt", '.', keep = true)
 "JuliaLang is a GitHub organization."
 
-julia> rm("my_file.txt")
source
Base.readlinesFunction
readlines(io::IO=stdin; keep::Bool=false)
+julia> rm("my_file.txt")
source
Base.readlinesFunction
readlines(io::IO=stdin; keep::Bool=false)
 readlines(filename::AbstractString; keep::Bool=false)

Read all lines of an I/O stream or a file as a vector of strings. Behavior is equivalent to saving the result of reading readline repeatedly with the same arguments and saving the resulting lines as a vector of strings. See also eachline to iterate over the lines without reading them all at once.

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
 
 julia> readlines("my_file.txt")
@@ -429,7 +429,7 @@
  "JuliaLang is a GitHub organization.\n"
  "It has many members.\n"
 
-julia> rm("my_file.txt")
source
Base.eachlineFunction
eachline(io::IO=stdin; keep::Bool=false)
+julia> rm("my_file.txt")
source
Base.eachlineFunction
eachline(io::IO=stdin; keep::Bool=false)
 eachline(filename::AbstractString; keep::Bool=false)

Create an iterable EachLine object that will yield each line from an I/O stream or a file. Iteration calls readline on the stream argument repeatedly with keep passed through, determining whether trailing end-of-line characters are retained. When called with a file name, the file is opened once at the beginning of iteration and closed at the end. If iteration is interrupted, the file will be closed when the EachLine object is garbage collected.

To iterate over each line of a String, eachline(IOBuffer(str)) can be used.

Iterators.reverse can be used on an EachLine object to read the lines in reverse order (for files, buffers, and other I/O streams supporting seek), and first or last can be used to extract the initial or final lines, respectively.

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\n It has many members.\n");
 
 julia> for line in eachline("my_file.txt")
@@ -437,7 +437,7 @@
        end
 JuliaLang is a GitHub organization. It has many members.
 
-julia> rm("my_file.txt");
Julia 1.8

Julia 1.8 is required to use Iterators.reverse or last with eachline iterators.

source
Base.copylineFunction
copyline(out::IO, io::IO=stdin; keep::Bool=false)
+julia> rm("my_file.txt");
Julia 1.8

Julia 1.8 is required to use Iterators.reverse or last with eachline iterators.

source
Base.copylineFunction
copyline(out::IO, io::IO=stdin; keep::Bool=false)
 copyline(out::IO, filename::AbstractString; keep::Bool=false)

Copy a single line of text from an I/O stream or a file to the out stream, returning out.

When reading from a file, the text is assumed to be encoded in UTF-8. Lines in the input end with '\n' or "\r\n" or the end of an input stream. When keep is false (as it is by default), these trailing newline characters are removed from the line before it is returned. When keep is true, they are returned as part of the line.

Similar to readline, which returns a String; in contrast, copyline writes directly to out, without allocating a string. (This can be used, for example, to read data into a pre-allocated IOBuffer.)

See also copyuntil for reading until more general delimiters.

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
 
 julia> String(take!(copyline(IOBuffer(), "my_file.txt")))
@@ -446,7 +446,7 @@
 julia> String(take!(copyline(IOBuffer(), "my_file.txt", keep=true)))
 "JuliaLang is a GitHub organization.\n"
 
-julia> rm("my_file.txt")
source
Base.copyuntilFunction
copyuntil(out::IO, stream::IO, delim; keep::Bool = false)
+julia> rm("my_file.txt")
source
Base.copyuntilFunction
copyuntil(out::IO, stream::IO, delim; keep::Bool = false)
 copyuntil(out::IO, filename::AbstractString, delim; keep::Bool = false)

Copy a string from an I/O stream or a file, up to the given delimiter, to the out stream, returning out. The delimiter can be a UInt8, AbstractChar, string, or vector. Keyword argument keep controls whether the delimiter is included in the result. The text is assumed to be encoded in UTF-8.

Similar to readuntil, which returns a String; in contrast, copyuntil writes directly to out, without allocating a string. (This can be used, for example, to read data into a pre-allocated IOBuffer.)

Examples

julia> write("my_file.txt", "JuliaLang is a GitHub organization.\nIt has many members.\n");
 
 julia> String(take!(copyuntil(IOBuffer(), "my_file.txt", 'L')))
@@ -455,38 +455,38 @@
 julia> String(take!(copyuntil(IOBuffer(), "my_file.txt", '.', keep = true)))
 "JuliaLang is a GitHub organization."
 
-julia> rm("my_file.txt")
source
Base.displaysizeFunction
displaysize([io::IO]) -> (lines, columns)

Return the nominal size of the screen that may be used for rendering output to this IO object. If no input is provided, the environment variables LINES and COLUMNS are read. If those are not set, a default size of (24, 80) is returned.

Examples

julia> withenv("LINES" => 30, "COLUMNS" => 100) do
+julia> rm("my_file.txt")
source
Base.displaysizeFunction
displaysize([io::IO]) -> (lines, columns)

Return the nominal size of the screen that may be used for rendering output to this IO object. If no input is provided, the environment variables LINES and COLUMNS are read. If those are not set, a default size of (24, 80) is returned.

Examples

julia> withenv("LINES" => 30, "COLUMNS" => 100) do
            displaysize()
        end
 (30, 100)

To get your TTY size,

julia> displaysize(stdout)
-(34, 147)
source

Multimedia I/O

Just as text output is performed by print and user-defined types can indicate their textual representation by overloading show, Julia provides a standardized mechanism for rich multimedia output (such as images, formatted text, or even audio and video), consisting of three parts:

  • A function display(x) to request the richest available multimedia display of a Julia object x (with a plain-text fallback).
  • Overloading show allows one to indicate arbitrary multimedia representations (keyed by standard MIME types) of user-defined types.
  • Multimedia-capable display backends may be registered by subclassing a generic AbstractDisplay type and pushing them onto a stack of display backends via pushdisplay.

The base Julia runtime provides only plain-text display, but richer displays may be enabled by loading external modules or by using graphical Julia environments (such as the IPython-based IJulia notebook).

Multimedia I/O

Just as text output is performed by print and user-defined types can indicate their textual representation by overloading show, Julia provides a standardized mechanism for rich multimedia output (such as images, formatted text, or even audio and video), consisting of three parts:

  • A function display(x) to request the richest available multimedia display of a Julia object x (with a plain-text fallback).
  • Overloading show allows one to indicate arbitrary multimedia representations (keyed by standard MIME types) of user-defined types.
  • Multimedia-capable display backends may be registered by subclassing a generic AbstractDisplay type and pushing them onto a stack of display backends via pushdisplay.

The base Julia runtime provides only plain-text display, but richer displays may be enabled by loading external modules or by using graphical Julia environments (such as the IPython-based IJulia notebook).

Base.Multimedia.displayFunction
display(x)
 display(d::AbstractDisplay, x)
 display(mime, x)
-display(d::AbstractDisplay, mime, x)

Display x using the topmost applicable display in the display stack, typically using the richest supported multimedia output for x, with plain-text stdout output as a fallback. The display(d, x) variant attempts to display x on the given display d only, throwing a MethodError if d cannot display objects of this type.

In general, you cannot assume that display output goes to stdout (unlike print(x) or show(x)). For example, display(x) may open up a separate window with an image. display(x) means "show x in the best way you can for the current output device(s)." If you want REPL-like text output that is guaranteed to go to stdout, use show(stdout, "text/plain", x) instead.

There are also two variants with a mime argument (a MIME type string, such as "image/png"), which attempt to display x using the requested MIME type only, throwing a MethodError if this type is not supported by either the display(s) or by x. With these variants, one can also supply the "raw" data in the requested MIME type by passing x::AbstractString (for MIME types with text-based storage, such as text/html or application/postscript) or x::Vector{UInt8} (for binary MIME types).

To customize how instances of a type are displayed, overload show rather than display, as explained in the manual section on custom pretty-printing.

source
Base.Multimedia.redisplayFunction
redisplay(x)
+display(d::AbstractDisplay, mime, x)

Display x using the topmost applicable display in the display stack, typically using the richest supported multimedia output for x, with plain-text stdout output as a fallback. The display(d, x) variant attempts to display x on the given display d only, throwing a MethodError if d cannot display objects of this type.

In general, you cannot assume that display output goes to stdout (unlike print(x) or show(x)). For example, display(x) may open up a separate window with an image. display(x) means "show x in the best way you can for the current output device(s)." If you want REPL-like text output that is guaranteed to go to stdout, use show(stdout, "text/plain", x) instead.

There are also two variants with a mime argument (a MIME type string, such as "image/png"), which attempt to display x using the requested MIME type only, throwing a MethodError if this type is not supported by either the display(s) or by x. With these variants, one can also supply the "raw" data in the requested MIME type by passing x::AbstractString (for MIME types with text-based storage, such as text/html or application/postscript) or x::Vector{UInt8} (for binary MIME types).

To customize how instances of a type are displayed, overload show rather than display, as explained in the manual section on custom pretty-printing.

source
Base.Multimedia.redisplayFunction
redisplay(x)
 redisplay(d::AbstractDisplay, x)
 redisplay(mime, x)
-redisplay(d::AbstractDisplay, mime, x)

By default, the redisplay functions simply call display. However, some display backends may override redisplay to modify an existing display of x (if any). Using redisplay is also a hint to the backend that x may be redisplayed several times, and the backend may choose to defer the display until (for example) the next interactive prompt.

source
Base.Multimedia.displayableFunction
displayable(mime) -> Bool
-displayable(d::AbstractDisplay, mime) -> Bool

Return a boolean value indicating whether the given mime type (string) is displayable by any of the displays in the current display stack, or specifically by the display d in the second variant.

source
Base.showMethod
show(io::IO, mime, x)

The display functions ultimately call show in order to write an object x as a given mime type to a given I/O stream io (usually a memory buffer), if possible. In order to provide a rich multimedia representation of a user-defined type T, it is only necessary to define a new show method for T, via: show(io, ::MIME"mime", x::T) = ..., where mime is a MIME-type string and the function body calls write (or similar) to write that representation of x to io. (Note that the MIME"" notation only supports literal strings; to construct MIME types in a more flexible manner use MIME{Symbol("")}.)

For example, if you define a MyImage type and know how to write it to a PNG file, you could define a function show(io, ::MIME"image/png", x::MyImage) = ... to allow your images to be displayed on any PNG-capable AbstractDisplay (such as IJulia). As usual, be sure to import Base.show in order to add new methods to the built-in Julia function show.

Technically, the MIME"mime" macro defines a singleton type for the given mime string, which allows us to exploit Julia's dispatch mechanisms in determining how to display objects of any given type.

The default MIME type is MIME"text/plain". There is a fallback definition for text/plain output that calls show with 2 arguments, so it is not always necessary to add a method for that case. If a type benefits from custom human-readable output though, show(::IO, ::MIME"text/plain", ::T) should be defined. For example, the Day type uses 1 day as the output for the text/plain MIME type, and Day(1) as the output of 2-argument show.

Examples

julia> struct Day
+redisplay(d::AbstractDisplay, mime, x)

By default, the redisplay functions simply call display. However, some display backends may override redisplay to modify an existing display of x (if any). Using redisplay is also a hint to the backend that x may be redisplayed several times, and the backend may choose to defer the display until (for example) the next interactive prompt.

source
Base.Multimedia.displayableFunction
displayable(mime) -> Bool
+displayable(d::AbstractDisplay, mime) -> Bool

Return a boolean value indicating whether the given mime type (string) is displayable by any of the displays in the current display stack, or specifically by the display d in the second variant.

source
Base.showMethod
show(io::IO, mime, x)

The display functions ultimately call show in order to write an object x as a given mime type to a given I/O stream io (usually a memory buffer), if possible. In order to provide a rich multimedia representation of a user-defined type T, it is only necessary to define a new show method for T, via: show(io, ::MIME"mime", x::T) = ..., where mime is a MIME-type string and the function body calls write (or similar) to write that representation of x to io. (Note that the MIME"" notation only supports literal strings; to construct MIME types in a more flexible manner use MIME{Symbol("")}.)

For example, if you define a MyImage type and know how to write it to a PNG file, you could define a function show(io, ::MIME"image/png", x::MyImage) = ... to allow your images to be displayed on any PNG-capable AbstractDisplay (such as IJulia). As usual, be sure to import Base.show in order to add new methods to the built-in Julia function show.

Technically, the MIME"mime" macro defines a singleton type for the given mime string, which allows us to exploit Julia's dispatch mechanisms in determining how to display objects of any given type.

The default MIME type is MIME"text/plain". There is a fallback definition for text/plain output that calls show with 2 arguments, so it is not always necessary to add a method for that case. If a type benefits from custom human-readable output though, show(::IO, ::MIME"text/plain", ::T) should be defined. For example, the Day type uses 1 day as the output for the text/plain MIME type, and Day(1) as the output of 2-argument show.

Examples

julia> struct Day
            n::Int
        end
 
 julia> Base.show(io::IO, ::MIME"text/plain", d::Day) = print(io, d.n, " day")
 
 julia> Day(1)
-1 day

Container types generally implement 3-argument show by calling show(io, MIME"text/plain"(), x) for elements x, with :compact => true set in an IOContext passed as the first argument.

source
Base.Multimedia.showableFunction
showable(mime, x)

Return a boolean value indicating whether or not the object x can be written as the given mime type.

(By default, this is determined automatically by the existence of the corresponding show method for typeof(x). Some types provide custom showable methods; for example, if the available MIME formats depend on the value of x.)

Examples

julia> showable(MIME("text/plain"), rand(5))
+1 day

Container types generally implement 3-argument show by calling show(io, MIME"text/plain"(), x) for elements x, with :compact => true set in an IOContext passed as the first argument.

source
Base.Multimedia.showableFunction
showable(mime, x)

Return a boolean value indicating whether or not the object x can be written as the given mime type.

(By default, this is determined automatically by the existence of the corresponding show method for typeof(x). Some types provide custom showable methods; for example, if the available MIME formats depend on the value of x.)

Examples

julia> showable(MIME("text/plain"), rand(5))
 true
 
 julia> showable("image/png", rand(5))
-false
source
Base.reprMethod
repr(mime, x; context=nothing)

Return an AbstractString or Vector{UInt8} containing the representation of x in the requested mime type, as written by show(io, mime, x) (throwing a MethodError if no appropriate show is available). An AbstractString is returned for MIME types with textual representations (such as "text/html" or "application/postscript"), whereas binary data is returned as Vector{UInt8}. (The function istextmime(mime) returns whether or not Julia treats a given mime type as text.)

The optional keyword argument context can be set to :key=>value pair or an IO or IOContext object whose attributes are used for the I/O stream passed to show.

As a special case, if x is an AbstractString (for textual MIME types) or a Vector{UInt8} (for binary MIME types), the repr function assumes that x is already in the requested mime format and simply returns x. This special case does not apply to the "text/plain" MIME type. This is useful so that raw data can be passed to display(m::MIME, x).

In particular, repr("text/plain", x) is typically a "pretty-printed" version of x designed for human consumption. See also repr(x) to instead return a string corresponding to show(x) that may be closer to how the value of x would be entered in Julia.

Examples

julia> A = [1 2; 3 4];
+false
source
Base.reprMethod
repr(mime, x; context=nothing)

Return an AbstractString or Vector{UInt8} containing the representation of x in the requested mime type, as written by show(io, mime, x) (throwing a MethodError if no appropriate show is available). An AbstractString is returned for MIME types with textual representations (such as "text/html" or "application/postscript"), whereas binary data is returned as Vector{UInt8}. (The function istextmime(mime) returns whether or not Julia treats a given mime type as text.)

The optional keyword argument context can be set to :key=>value pair or an IO or IOContext object whose attributes are used for the I/O stream passed to show.

As a special case, if x is an AbstractString (for textual MIME types) or a Vector{UInt8} (for binary MIME types), the repr function assumes that x is already in the requested mime format and simply returns x. This special case does not apply to the "text/plain" MIME type. This is useful so that raw data can be passed to display(m::MIME, x).

In particular, repr("text/plain", x) is typically a "pretty-printed" version of x designed for human consumption. See also repr(x) to instead return a string corresponding to show(x) that may be closer to how the value of x would be entered in Julia.

Examples

julia> A = [1 2; 3 4];
 
 julia> repr("text/plain", A)
-"2×2 Matrix{Int64}:\n 1  2\n 3  4"
source
Base.Multimedia.MIMEType
MIME

A type representing a standard internet data format. "MIME" stands for "Multipurpose Internet Mail Extensions", since the standard was originally used to describe multimedia attachments to email messages.

A MIME object can be passed as the second argument to show to request output in that format.

Examples

julia> show(stdout, MIME("text/plain"), "hi")
-"hi"
source
Base.Multimedia.@MIME_strMacro
@MIME_str

A convenience macro for writing MIME types, typically used when adding methods to show. For example the syntax show(io::IO, ::MIME"text/html", x::MyType) = ... could be used to define how to write an HTML representation of MyType.

source

As mentioned above, one can also define new display backends. For example, a module that can display PNG images in a window can register this capability with Julia, so that calling display(x) on types with PNG representations will automatically display the image using the module's window.

In order to define a new display backend, one should first create a subtype D of the abstract class AbstractDisplay. Then, for each MIME type (mime string) that can be displayed on D, one should define a function display(d::D, ::MIME"mime", x) = ... that displays x as that MIME type, usually by calling show(io, mime, x) or repr(io, mime, x). A MethodError should be thrown if x cannot be displayed as that MIME type; this is automatic if one calls show or repr. Finally, one should define a function display(d::D, x) that queries showable(mime, x) for the mime types supported by D and displays the "best" one; a MethodError should be thrown if no supported MIME types are found for x. Similarly, some subtypes may wish to override redisplay(d::D, ...). (Again, one should import Base.display to add new methods to display.) The return values of these functions are up to the implementation (since in some cases it may be useful to return a display "handle" of some type). The display functions for D can then be called directly, but they can also be invoked automatically from display(x) simply by pushing a new display onto the display-backend stack with:

Base.Multimedia.pushdisplayFunction
pushdisplay(d::AbstractDisplay)

Pushes a new display d on top of the global display-backend stack. Calling display(x) or display(mime, x) will display x on the topmost compatible backend in the stack (i.e., the topmost backend that does not throw a MethodError).

source
Base.Multimedia.popdisplayFunction
popdisplay()
-popdisplay(d::AbstractDisplay)

Pop the topmost backend off of the display-backend stack, or the topmost copy of d in the second variant.

source
Base.Multimedia.TextDisplayType
TextDisplay(io::IO)

Return a TextDisplay <: AbstractDisplay, which displays any object as the text/plain MIME type (by default), writing the text representation to the given I/O stream. (This is how objects are printed in the Julia REPL.)

source
Base.Multimedia.istextmimeFunction
istextmime(m::MIME)

Determine whether a MIME type is text data. MIME types are assumed to be binary data except for a set of types known to be text data (possibly Unicode).

Examples

julia> istextmime(MIME("text/plain"))
+"2×2 Matrix{Int64}:\n 1  2\n 3  4"
source
Base.Multimedia.MIMEType
MIME

A type representing a standard internet data format. "MIME" stands for "Multipurpose Internet Mail Extensions", since the standard was originally used to describe multimedia attachments to email messages.

A MIME object can be passed as the second argument to show to request output in that format.

Examples

julia> show(stdout, MIME("text/plain"), "hi")
+"hi"
source
Base.Multimedia.@MIME_strMacro
@MIME_str

A convenience macro for writing MIME types, typically used when adding methods to show. For example the syntax show(io::IO, ::MIME"text/html", x::MyType) = ... could be used to define how to write an HTML representation of MyType.

source

As mentioned above, one can also define new display backends. For example, a module that can display PNG images in a window can register this capability with Julia, so that calling display(x) on types with PNG representations will automatically display the image using the module's window.

In order to define a new display backend, one should first create a subtype D of the abstract class AbstractDisplay. Then, for each MIME type (mime string) that can be displayed on D, one should define a function display(d::D, ::MIME"mime", x) = ... that displays x as that MIME type, usually by calling show(io, mime, x) or repr(io, mime, x). A MethodError should be thrown if x cannot be displayed as that MIME type; this is automatic if one calls show or repr. Finally, one should define a function display(d::D, x) that queries showable(mime, x) for the mime types supported by D and displays the "best" one; a MethodError should be thrown if no supported MIME types are found for x. Similarly, some subtypes may wish to override redisplay(d::D, ...). (Again, one should import Base.display to add new methods to display.) The return values of these functions are up to the implementation (since in some cases it may be useful to return a display "handle" of some type). The display functions for D can then be called directly, but they can also be invoked automatically from display(x) simply by pushing a new display onto the display-backend stack with:

Base.Multimedia.pushdisplayFunction
pushdisplay(d::AbstractDisplay)

Pushes a new display d on top of the global display-backend stack. Calling display(x) or display(mime, x) will display x on the topmost compatible backend in the stack (i.e., the topmost backend that does not throw a MethodError).

source
Base.Multimedia.popdisplayFunction
popdisplay()
+popdisplay(d::AbstractDisplay)

Pop the topmost backend off of the display-backend stack, or the topmost copy of d in the second variant.

source
Base.Multimedia.TextDisplayType
TextDisplay(io::IO)

Return a TextDisplay <: AbstractDisplay, which displays any object as the text/plain MIME type (by default), writing the text representation to the given I/O stream. (This is how objects are printed in the Julia REPL.)

source
Base.Multimedia.istextmimeFunction
istextmime(m::MIME)

Determine whether a MIME type is text data. MIME types are assumed to be binary data except for a set of types known to be text data (possibly Unicode).

Examples

julia> istextmime(MIME("text/plain"))
 true
 
 julia> istextmime(MIME("image/png"))
-false
source

Network I/O

Base.bytesavailableFunction
bytesavailable(io)

Return the number of bytes available for reading before a read from this stream or buffer will block.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
+false
source

Network I/O

Base.bytesavailableFunction
bytesavailable(io)

Return the number of bytes available for reading before a read from this stream or buffer will block.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");
 
 julia> bytesavailable(io)
-34
source
Base.ntohFunction
ntoh(x)

Convert the endianness of a value from Network byte order (big-endian) to that used by the Host.

source
Base.htonFunction
hton(x)

Convert the endianness of a value from that used by the Host to Network byte order (big-endian).

source
Base.ltohFunction
ltoh(x)

Convert the endianness of a value from Little-endian to that used by the Host.

source
Base.htolFunction
htol(x)

Convert the endianness of a value from that used by the Host to Little-endian.

source
Base.ENDIAN_BOMConstant
ENDIAN_BOM

The 32-bit byte-order-mark indicates the native byte order of the host machine. Little-endian machines will contain the value 0x04030201. Big-endian machines will contain the value 0x01020304.

source
+34
source
Base.ntohFunction
ntoh(x)

Convert the endianness of a value from Network byte order (big-endian) to that used by the Host.

source
Base.htonFunction
hton(x)

Convert the endianness of a value from that used by the Host to Network byte order (big-endian).

source
Base.ltohFunction
ltoh(x)

Convert the endianness of a value from Little-endian to that used by the Host.

source
Base.htolFunction
htol(x)

Convert the endianness of a value from that used by the Host to Little-endian.

source
Base.ENDIAN_BOMConstant
ENDIAN_BOM

The 32-bit byte-order-mark indicates the native byte order of the host machine. Little-endian machines will contain the value 0x04030201. Big-endian machines will contain the value 0x01020304.

source
diff --git a/en/v1.12-dev/base/iterators/index.html b/en/v1.12-dev/base/iterators/index.html index a3503a74e6a..7b6bd6beb4c 100644 --- a/en/v1.12-dev/base/iterators/index.html +++ b/en/v1.12-dev/base/iterators/index.html @@ -34,7 +34,7 @@ 3 julia> sum(a) # Sum the remaining elements -7source
Base.Iterators.zipFunction
zip(iters...)

Run multiple iterators at the same time, until any of them is exhausted. The value type of the zip iterator is a tuple of values of its subiterators.

Note

zip orders the calls to its subiterators in such a way that stateful iterators will not advance when another iterator finishes in the current iteration.

Note

zip() with no arguments yields an infinite iterator of empty tuples.

See also: enumerate, Base.splat.

Examples

julia> a = 1:5
+7
source
Base.Iterators.zipFunction
zip(iters...)

Run multiple iterators at the same time, until any of them is exhausted. The value type of the zip iterator is a tuple of values of its subiterators.

Note

zip orders the calls to its subiterators in such a way that stateful iterators will not advance when another iterator finishes in the current iteration.

Note

zip() with no arguments yields an infinite iterator of empty tuples.

See also: enumerate, Base.splat.

Examples

julia> a = 1:5
 1:5
 
 julia> b = ["e","d","b","c","a"]
@@ -52,7 +52,7 @@
 5
 
 julia> first(c)
-(1, "e")
source
Base.Iterators.enumerateFunction
enumerate(iter)

An iterator that yields (i, x) where i is a counter starting at 1, and x is the ith value from the given iterator. It's useful when you need not only the values x over which you are iterating, but also the number of iterations so far.

Note that i may not be valid for indexing iter, or may index a different element. This will happen if iter has indices that do not start at 1, and may happen for strings, dictionaries, etc. See the pairs(IndexLinear(), iter) method if you want to ensure that i is an index.

Examples

julia> a = ["a", "b", "c"];
+(1, "e")
source
Base.Iterators.enumerateFunction
enumerate(iter)

An iterator that yields (i, x) where i is a counter starting at 1, and x is the ith value from the given iterator. It's useful when you need not only the values x over which you are iterating, but also the number of iterations so far.

Note that i may not be valid for indexing iter, or may index a different element. This will happen if iter has indices that do not start at 1, and may happen for strings, dictionaries, etc. See the pairs(IndexLinear(), iter) method if you want to ensure that i is an index.

Examples

julia> a = ["a", "b", "c"];
 
 julia> for (index, value) in enumerate(a)
            println("$index $value")
@@ -71,17 +71,17 @@
 i = 2, val = a, str[i] = 'a'
 i = 3, val = ï, str[i] = 'ï'
 i = 4, val = v, StringIndexError("naïve", 4)
-i = 5, val = e, str[i] = 'v'
source
Base.Iterators.restFunction
rest(iter, state)

An iterator that yields the same elements as iter, but starting at the given state.

See also: Iterators.drop, Iterators.peel, Base.rest.

Examples

julia> collect(Iterators.rest([1,2,3,4], 2))
+i = 5, val = e, str[i] = 'v'
source
Base.Iterators.restFunction
rest(iter, state)

An iterator that yields the same elements as iter, but starting at the given state.

See also: Iterators.drop, Iterators.peel, Base.rest.

Examples

julia> collect(Iterators.rest([1,2,3,4], 2))
 3-element Vector{Int64}:
  2
  3
- 4
source
Base.Iterators.countfromFunction
countfrom(start=1, step=1)

An iterator that counts forever, starting at start and incrementing by step.

Examples

julia> for v in Iterators.countfrom(5, 2)
+ 4
source
Base.Iterators.countfromFunction
countfrom(start=1, step=1)

An iterator that counts forever, starting at start and incrementing by step.

Examples

julia> for v in Iterators.countfrom(5, 2)
            v > 10 && break
            println(v)
        end
 5
 7
-9
source
Base.Iterators.takeFunction
take(iter, n)

An iterator that generates at most the first n elements of iter.

See also: drop, peel, first, Base.take!.

Examples

julia> a = 1:2:11
+9
source
Base.Iterators.takeFunction
take(iter, n)

An iterator that generates at most the first n elements of iter.

See also: drop, peel, first, Base.take!.

Examples

julia> a = 1:2:11
 1:2:11
 
 julia> collect(a)
@@ -97,7 +97,7 @@
 3-element Vector{Int64}:
  1
  3
- 5
source
Base.Iterators.takewhileFunction
takewhile(pred, iter)

An iterator that generates element from iter as long as predicate pred is true, afterwards, drops every element.

Julia 1.4

This function requires at least Julia 1.4.

Examples

julia> s = collect(1:5)
+ 5
source
Base.Iterators.takewhileFunction
takewhile(pred, iter)

An iterator that generates element from iter as long as predicate pred is true, afterwards, drops every element.

Julia 1.4

This function requires at least Julia 1.4.

Examples

julia> s = collect(1:5)
 5-element Vector{Int64}:
  1
  2
@@ -108,7 +108,7 @@
 julia> collect(Iterators.takewhile(<(3),s))
 2-element Vector{Int64}:
  1
- 2
source
Base.Iterators.dropFunction
drop(iter, n)

An iterator that generates all but the first n elements of iter.

Examples

julia> a = 1:2:11
+ 2
source
Base.Iterators.dropFunction
drop(iter, n)

An iterator that generates all but the first n elements of iter.

Examples

julia> a = 1:2:11
 1:2:11
 
 julia> collect(a)
@@ -123,7 +123,7 @@
 julia> collect(Iterators.drop(a,4))
 2-element Vector{Int64}:
   9
- 11
source
Base.Iterators.dropwhileFunction
dropwhile(pred, iter)

An iterator that drops element from iter as long as predicate pred is true, afterwards, returns every element.

Julia 1.4

This function requires at least Julia 1.4.

Examples

julia> s = collect(1:5)
+ 11
source
Base.Iterators.dropwhileFunction
dropwhile(pred, iter)

An iterator that drops element from iter as long as predicate pred is true, afterwards, returns every element.

Julia 1.4

This function requires at least Julia 1.4.

Examples

julia> s = collect(1:5)
 5-element Vector{Int64}:
  1
  2
@@ -135,7 +135,7 @@
 3-element Vector{Int64}:
  3
  4
- 5
source
Base.Iterators.cycleFunction
cycle(iter[, n::Int])

An iterator that cycles through iter forever. If n is specified, then it cycles through iter that many times. When iter is empty, so are cycle(iter) and cycle(iter, n).

Iterators.cycle(iter, n) is the lazy equivalent of Base.repeat(vector, n), while Iterators.repeated(iter, n) is the lazy Base.fill(item, n).

Julia 1.11

The method cycle(iter, n) was added in Julia 1.11.

Examples

julia> for (i, v) in enumerate(Iterators.cycle("hello"))
+ 5
source
Base.Iterators.cycleFunction
cycle(iter[, n::Int])

An iterator that cycles through iter forever. If n is specified, then it cycles through iter that many times. When iter is empty, so are cycle(iter) and cycle(iter, n).

Iterators.cycle(iter, n) is the lazy equivalent of Base.repeat(vector, n), while Iterators.repeated(iter, n) is the lazy Base.fill(item, n).

Julia 1.11

The method cycle(iter, n) was added in Julia 1.11.

Examples

julia> for (i, v) in enumerate(Iterators.cycle("hello"))
            print(v)
            i > 10 && break
        end
@@ -148,7 +148,7 @@
 true
 
 julia> fill([1,2,3], 4) == collect(Iterators.repeated([1,2,3], 4))
-true
source
Base.Iterators.repeatedFunction
repeated(x[, n::Int])

An iterator that generates the value x forever. If n is specified, generates x that many times (equivalent to take(repeated(x), n)).

See also fill, and compare Iterators.cycle.

Examples

julia> a = Iterators.repeated([1 2], 4);
+true
source
Base.Iterators.repeatedFunction
repeated(x[, n::Int])

An iterator that generates the value x forever. If n is specified, generates x that many times (equivalent to take(repeated(x), n)).

See also fill, and compare Iterators.cycle.

Examples

julia> a = Iterators.repeated([1 2], 4);
 
 julia> collect(a)
 4-element Vector{Matrix{Int64}}:
@@ -161,13 +161,13 @@
 true
 
 julia> Iterators.cycle([1 2], 4) |> collect |> println
-[1, 2, 1, 2, 1, 2, 1, 2]
source
Base.Iterators.productFunction
product(iters...)

Return an iterator over the product of several iterators. Each generated element is a tuple whose ith element comes from the ith argument iterator. The first iterator changes the fastest.

See also: zip, Iterators.flatten.

Examples

julia> collect(Iterators.product(1:2, 3:5))
+[1, 2, 1, 2, 1, 2, 1, 2]
source
Base.Iterators.productFunction
product(iters...)

Return an iterator over the product of several iterators. Each generated element is a tuple whose ith element comes from the ith argument iterator. The first iterator changes the fastest.

See also: zip, Iterators.flatten.

Examples

julia> collect(Iterators.product(1:2, 3:5))
 2×3 Matrix{Tuple{Int64, Int64}}:
  (1, 3)  (1, 4)  (1, 5)
  (2, 3)  (2, 4)  (2, 5)
 
 julia> ans == [(x,y) for x in 1:2, y in 3:5]  # collects a generator involving Iterators.product
-true
source
Base.Iterators.flattenFunction
flatten(iter)

Given an iterator that yields iterators, return an iterator that yields the elements of those iterators. Put differently, the elements of the argument iterator are concatenated.

Examples

julia> collect(Iterators.flatten((1:2, 8:9)))
+true
source
Base.Iterators.flattenFunction
flatten(iter)

Given an iterator that yields iterators, return an iterator that yields the elements of those iterators. Put differently, the elements of the argument iterator are concatenated.

Examples

julia> collect(Iterators.flatten((1:2, 8:9)))
 4-element Vector{Int64}:
  1
  2
@@ -181,7 +181,7 @@
  (0, 'c')
  (1, 'a')
  (1, 'b')
- (1, 'c')
source
Base.Iterators.flatmapFunction
Iterators.flatmap(f, iterators...)

Equivalent to flatten(map(f, iterators...)).

See also Iterators.flatten, Iterators.map.

Julia 1.9

This function was added in Julia 1.9.

Examples

julia> Iterators.flatmap(n -> -n:2:n, 1:3) |> collect
+ (1, 'c')
source
Base.Iterators.flatmapFunction
Iterators.flatmap(f, iterators...)

Equivalent to flatten(map(f, iterators...)).

See also Iterators.flatten, Iterators.map.

Julia 1.9

This function was added in Julia 1.9.

Examples

julia> Iterators.flatmap(n -> -n:2:n, 1:3) |> collect
 9-element Vector{Int64}:
  -1
   1
@@ -205,15 +205,15 @@
  20
 
 julia> ans == vec(stack(n -> (-n, 10n), 1:2))
-true
source
Base.Iterators.partitionFunction
partition(collection, n)

Iterate over a collection n elements at a time.

Examples

julia> collect(Iterators.partition([1,2,3,4,5], 2))
+true
source
Base.Iterators.partitionFunction
partition(collection, n)

Iterate over a collection n elements at a time.

Examples

julia> collect(Iterators.partition([1,2,3,4,5], 2))
 3-element Vector{SubArray{Int64, 1, Vector{Int64}, Tuple{UnitRange{Int64}}, true}}:
  [1, 2]
  [3, 4]
- [5]
source
Base.Iterators.mapFunction
Iterators.map(f, iterators...)

Create a lazy mapping. This is another syntax for writing (f(args...) for args in zip(iterators...)).

Julia 1.6

This function requires at least Julia 1.6.

Examples

julia> collect(Iterators.map(x -> x^2, 1:3))
+ [5]
source
Base.Iterators.mapFunction
Iterators.map(f, iterators...)

Create a lazy mapping. This is another syntax for writing (f(args...) for args in zip(iterators...)).

Julia 1.6

This function requires at least Julia 1.6.

Examples

julia> collect(Iterators.map(x -> x^2, 1:3))
 3-element Vector{Int64}:
  1
  4
- 9
source
Base.Iterators.filterFunction
Iterators.filter(flt, itr)

Given a predicate function flt and an iterable object itr, return an iterable object which upon iteration yields the elements x of itr that satisfy flt(x). The order of the original iterator is preserved.

This function is lazy; that is, it is guaranteed to return in $Θ(1)$ time and use $Θ(1)$ additional space, and flt will not be called by an invocation of filter. Calls to flt will be made when iterating over the returned iterable object. These calls are not cached and repeated calls will be made when reiterating.

Warning

Subsequent lazy transformations on the iterator returned from filter, such as those performed by Iterators.reverse or cycle, will also delay calls to flt until collecting or iterating over the returned iterable object. If the filter predicate is nondeterministic or its return values depend on the order of iteration over the elements of itr, composition with lazy transformations may result in surprising behavior. If this is undesirable, either ensure that flt is a pure function or collect intermediate filter iterators before further transformations.

See Base.filter for an eager implementation of filtering for arrays.

Examples

julia> f = Iterators.filter(isodd, [1, 2, 3, 4, 5])
+ 9
source
Base.Iterators.filterFunction
Iterators.filter(flt, itr)

Given a predicate function flt and an iterable object itr, return an iterable object which upon iteration yields the elements x of itr that satisfy flt(x). The order of the original iterator is preserved.

This function is lazy; that is, it is guaranteed to return in $Θ(1)$ time and use $Θ(1)$ additional space, and flt will not be called by an invocation of filter. Calls to flt will be made when iterating over the returned iterable object. These calls are not cached and repeated calls will be made when reiterating.

Warning

Subsequent lazy transformations on the iterator returned from filter, such as those performed by Iterators.reverse or cycle, will also delay calls to flt until collecting or iterating over the returned iterable object. If the filter predicate is nondeterministic or its return values depend on the order of iteration over the elements of itr, composition with lazy transformations may result in surprising behavior. If this is undesirable, either ensure that flt is a pure function or collect intermediate filter iterators before further transformations.

See Base.filter for an eager implementation of filtering for arrays.

Examples

julia> f = Iterators.filter(isodd, [1, 2, 3, 4, 5])
 Base.Iterators.Filter{typeof(isodd), Vector{Int64}}(isodd, [1, 2, 3, 4, 5])
 
 julia> foreach(println, f)
@@ -225,7 +225,7 @@
 3-element Vector{Int64}:
  1
  3
- 5
source
Base.Iterators.accumulateFunction
Iterators.accumulate(f, itr; [init])

Given a 2-argument function f and an iterator itr, return a new iterator that successively applies f to the previous value and the next element of itr.

This is effectively a lazy version of Base.accumulate.

Julia 1.5

Keyword argument init is added in Julia 1.5.

Examples

julia> a = Iterators.accumulate(+, [1,2,3,4]);
+ 5
source
Base.Iterators.accumulateFunction
Iterators.accumulate(f, itr; [init])

Given a 2-argument function f and an iterator itr, return a new iterator that successively applies f to the previous value and the next element of itr.

This is effectively a lazy version of Base.accumulate.

Julia 1.5

Keyword argument init is added in Julia 1.5.

Examples

julia> a = Iterators.accumulate(+, [1,2,3,4]);
 
 julia> foreach(println, a)
 1
@@ -240,12 +240,12 @@
  50.0
  10.0
   5.0
-  1.0
source
Base.Iterators.reverseFunction
Iterators.reverse(itr)

Given an iterator itr, then reverse(itr) is an iterator over the same collection but in the reverse order. This iterator is "lazy" in that it does not make a copy of the collection in order to reverse it; see Base.reverse for an eager implementation.

(By default, this returns an Iterators.Reverse object wrapping itr, which is iterable if the corresponding iterate methods are defined, but some itr types may implement more specialized Iterators.reverse behaviors.)

Not all iterator types T support reverse-order iteration. If T doesn't, then iterating over Iterators.reverse(itr::T) will throw a MethodError because of the missing iterate methods for Iterators.Reverse{T}. (To implement these methods, the original iterator itr::T can be obtained from an r::Iterators.Reverse{T} object by r.itr; more generally, one can use Iterators.reverse(r).)

Examples

julia> foreach(println, Iterators.reverse(1:5))
+  1.0
source
Base.Iterators.reverseFunction
Iterators.reverse(itr)

Given an iterator itr, then reverse(itr) is an iterator over the same collection but in the reverse order. This iterator is "lazy" in that it does not make a copy of the collection in order to reverse it; see Base.reverse for an eager implementation.

(By default, this returns an Iterators.Reverse object wrapping itr, which is iterable if the corresponding iterate methods are defined, but some itr types may implement more specialized Iterators.reverse behaviors.)

Not all iterator types T support reverse-order iteration. If T doesn't, then iterating over Iterators.reverse(itr::T) will throw a MethodError because of the missing iterate methods for Iterators.Reverse{T}. (To implement these methods, the original iterator itr::T can be obtained from an r::Iterators.Reverse{T} object by r.itr; more generally, one can use Iterators.reverse(r).)

Examples

julia> foreach(println, Iterators.reverse(1:5))
 5
 4
 3
 2
-1
source
Base.Iterators.onlyFunction
only(x)

Return the one and only element of collection x, or throw an ArgumentError if the collection has zero or multiple elements.

See also first, last.

Julia 1.4

This method requires at least Julia 1.4.

Examples

julia> only(["a"])
+1
source
Base.Iterators.onlyFunction
only(x)

Return the one and only element of collection x, or throw an ArgumentError if the collection has zero or multiple elements.

See also first, last.

Julia 1.4

This method requires at least Julia 1.4.

Examples

julia> only(["a"])
 "a"
 
 julia> only("a")
@@ -259,7 +259,7 @@
 julia> only(('a', 'b'))
 ERROR: ArgumentError: Tuple contains 2 elements, must contain exactly 1 element
 Stacktrace:
-[...]
source
Base.Iterators.peelFunction
peel(iter)

Returns the first element and an iterator over the remaining elements.

If the iterator is empty return nothing (like iterate).

Julia 1.7

Prior versions throw a BoundsError if the iterator is empty.

See also: Iterators.drop, Iterators.take.

Examples

julia> (a, rest) = Iterators.peel("abc");
+[...]
source
Base.Iterators.peelFunction
peel(iter)

Returns the first element and an iterator over the remaining elements.

If the iterator is empty return nothing (like iterate).

Julia 1.7

Prior versions throw a BoundsError if the iterator is empty.

See also: Iterators.drop, Iterators.take.

Examples

julia> (a, rest) = Iterators.peel("abc");
 
 julia> a
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
@@ -267,4 +267,4 @@
 julia> collect(rest)
 2-element Vector{Char}:
  'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)
- 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase)
source
+ 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase)source diff --git a/en/v1.12-dev/base/libc/index.html b/en/v1.12-dev/base/libc/index.html index b960d9c033e..5595f60497b 100644 --- a/en/v1.12-dev/base/libc/index.html +++ b/en/v1.12-dev/base/libc/index.html @@ -3,7 +3,7 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

C Standard Library

Base.Libc.mallocFunction
malloc(size::Integer) -> Ptr{Cvoid}

Call malloc from the C standard library.

source
Base.Libc.callocFunction
calloc(num::Integer, size::Integer) -> Ptr{Cvoid}

Call calloc from the C standard library.

source
Base.Libc.reallocFunction
realloc(addr::Ptr, size::Integer) -> Ptr{Cvoid}

Call realloc from the C standard library.

See warning in the documentation for free regarding only using this on memory originally obtained from malloc.

source
Base.memcpyFunction
memcpy(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid}

Call memcpy from the C standard library.

Julia 1.10

Support for memcpy requires at least Julia 1.10.

source
Base.memmoveFunction
memmove(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid}

Call memmove from the C standard library.

Julia 1.10

Support for memmove requires at least Julia 1.10.

source
Base.memsetFunction
memset(dst::Ptr, val, n::Integer) -> Ptr{Cvoid}

Call memset from the C standard library.

Julia 1.10

Support for memset requires at least Julia 1.10.

source
Base.memcmpFunction
memcmp(a::Ptr, b::Ptr, n::Integer) -> Int

Call memcmp from the C standard library.

Julia 1.10

Support for memcmp requires at least Julia 1.9.

source
Base.Libc.freeFunction
free(addr::Ptr)

Call free from the C standard library. Only use this on memory obtained from malloc, not on pointers retrieved from other C libraries. Ptr objects obtained from C libraries should be freed by the free functions defined in that library, to avoid assertion failures if multiple libc libraries exist on the system.

source
Base.Libc.errnoFunction
errno([code])

Get the value of the C library's errno. If an argument is specified, it is used to set the value of errno.

The value of errno is only valid immediately after a ccall to a C library routine that sets it. Specifically, you cannot call errno at the next prompt in a REPL, because lots of code is executed between prompts.

source
Base.Libc.FormatMessageFunction
FormatMessage(n=GetLastError())

Convert a Win32 system call error code to a descriptive string [only available on Windows].

source
Base.Libc.timeMethod
time(t::TmStruct) -> Float64

Converts a TmStruct struct to a number of seconds since the epoch.

source
Base.Libc.strftimeFunction
strftime([format], time)

Convert time, given as a number of seconds since the epoch or a TmStruct, to a formatted string using the given format. Supported formats are the same as those in the standard C library.

source
Base.Libc.strptimeFunction
strptime([format], timestr)

Parse a formatted time string into a TmStruct giving the seconds, minute, hour, date, etc. Supported formats are the same as those in the standard C library. On some platforms, timezones will not be parsed correctly. If the result of this function will be passed to time to convert it to seconds since the epoch, the isdst field should be filled in manually. Setting it to -1 will tell the C library to use the current system settings to determine the timezone.

source
Base.Libc.TmStructType
TmStruct([seconds])

Convert a number of seconds since the epoch to broken-down format, with fields sec, min, hour, mday, month, year, wday, yday, and isdst.

source
Base.Libc.FILEType
FILE(::Ptr)
+

C Standard Library

Base.Libc.mallocFunction
malloc(size::Integer) -> Ptr{Cvoid}

Call malloc from the C standard library.

source
Base.Libc.callocFunction
calloc(num::Integer, size::Integer) -> Ptr{Cvoid}

Call calloc from the C standard library.

source
Base.Libc.reallocFunction
realloc(addr::Ptr, size::Integer) -> Ptr{Cvoid}

Call realloc from the C standard library.

See warning in the documentation for free regarding only using this on memory originally obtained from malloc.

source
Base.memcpyFunction
memcpy(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid}

Call memcpy from the C standard library.

Julia 1.10

Support for memcpy requires at least Julia 1.10.

source
Base.memmoveFunction
memmove(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid}

Call memmove from the C standard library.

Julia 1.10

Support for memmove requires at least Julia 1.10.

source
Base.memsetFunction
memset(dst::Ptr, val, n::Integer) -> Ptr{Cvoid}

Call memset from the C standard library.

Julia 1.10

Support for memset requires at least Julia 1.10.

source
Base.memcmpFunction
memcmp(a::Ptr, b::Ptr, n::Integer) -> Int

Call memcmp from the C standard library.

Julia 1.10

Support for memcmp requires at least Julia 1.9.

source
Base.Libc.freeFunction
free(addr::Ptr)

Call free from the C standard library. Only use this on memory obtained from malloc, not on pointers retrieved from other C libraries. Ptr objects obtained from C libraries should be freed by the free functions defined in that library, to avoid assertion failures if multiple libc libraries exist on the system.

source
Base.Libc.errnoFunction
errno([code])

Get the value of the C library's errno. If an argument is specified, it is used to set the value of errno.

The value of errno is only valid immediately after a ccall to a C library routine that sets it. Specifically, you cannot call errno at the next prompt in a REPL, because lots of code is executed between prompts.

source
Base.Libc.FormatMessageFunction
FormatMessage(n=GetLastError())

Convert a Win32 system call error code to a descriptive string [only available on Windows].

source
Base.Libc.timeMethod
time(t::TmStruct) -> Float64

Converts a TmStruct struct to a number of seconds since the epoch.

source
Base.Libc.strftimeFunction
strftime([format], time)

Convert time, given as a number of seconds since the epoch or a TmStruct, to a formatted string using the given format. Supported formats are the same as those in the standard C library.

source
Base.Libc.strptimeFunction
strptime([format], timestr)

Parse a formatted time string into a TmStruct giving the seconds, minute, hour, date, etc. Supported formats are the same as those in the standard C library. On some platforms, timezones will not be parsed correctly. If the result of this function will be passed to time to convert it to seconds since the epoch, the isdst field should be filled in manually. Setting it to -1 will tell the C library to use the current system settings to determine the timezone.

source
Base.Libc.TmStructType
TmStruct([seconds])

Convert a number of seconds since the epoch to broken-down format, with fields sec, min, hour, mday, month, year, wday, yday, and isdst.

source
Base.Libc.FILEType
FILE(::Ptr)
 FILE(::IO)

A libc FILE*, representing an opened file.

It can be passed as a Ptr{FILE} argument to ccall and also supports seek, position and close.

A FILE can be constructed from an ordinary IO object, provided it is an open file. It must be closed afterward.

Examples

julia> using Base.Libc
 
 julia> mktemp() do _, io
@@ -15,4 +15,4 @@
            seek(io, 0)
            read(io, String)
        end
-"hello world"
source
Base.Libc.dupFunction
dup(src::RawFD[, target::RawFD])::RawFD

Duplicate the file descriptor src so that the duplicate refers to the same OS resource (e.g. a file or socket). A target file descriptor may be optionally be passed to use for the new duplicate.

source
Base.Libc.flush_cstdioFunction
flush_cstdio()

Flushes the C stdout and stderr streams (which may have been written to by external C code).

source
Base.Libc.systemsleepFunction
systemsleep(s::Real)

Suspends execution for s seconds. This function does not yield to Julia's scheduler and therefore blocks the Julia thread that it is running on for the duration of the sleep time.

See also sleep.

source
Base.Libc.mkfifoFunction
mkfifo(path::AbstractString, [mode::Integer]) -> path

Make a FIFO special file (a named pipe) at path. Return path as-is on success.

mkfifo is supported only in Unix platforms.

Julia 1.11

mkfifo requires at least Julia 1.11.

source
+"hello world"
source
Base.Libc.dupFunction
dup(src::RawFD[, target::RawFD])::RawFD

Duplicate the file descriptor src so that the duplicate refers to the same OS resource (e.g. a file or socket). A target file descriptor may be optionally be passed to use for the new duplicate.

source
Base.Libc.flush_cstdioFunction
flush_cstdio()

Flushes the C stdout and stderr streams (which may have been written to by external C code).

source
Base.Libc.systemsleepFunction
systemsleep(s::Real)

Suspends execution for s seconds. This function does not yield to Julia's scheduler and therefore blocks the Julia thread that it is running on for the duration of the sleep time.

See also sleep.

source
Base.Libc.mkfifoFunction
mkfifo(path::AbstractString, [mode::Integer]) -> path

Make a FIFO special file (a named pipe) at path. Return path as-is on success.

mkfifo is supported only in Unix platforms.

Julia 1.11

mkfifo requires at least Julia 1.11.

source
diff --git a/en/v1.12-dev/base/math/index.html b/en/v1.12-dev/base/math/index.html index d8bf4ba1b00..5543d687915 100644 --- a/en/v1.12-dev/base/math/index.html +++ b/en/v1.12-dev/base/math/index.html @@ -18,7 +18,7 @@ -1 julia> -(0x003) -0xfffdsource
Base.:+Function
dt::Date + t::Time -> DateTime

The addition of a Date with a Time produces a DateTime. The hour, minute, second, and millisecond parts of the Time are used along with the year, month, and day of the Date to create the new DateTime. Non-zero microseconds or nanoseconds in the Time type will result in an InexactError being thrown.

+(x, y...)

Addition operator.

Infix x+y+z+... calls this function with all arguments, i.e. +(x, y, z, ...), which by default then calls (x+y) + z + ... starting from the left.

Note that overflow is possible for most integer types, including the default Int, when adding large numbers.

Examples

julia> 1 + 20 + 4
+0xfffd
source
Base.:+Function
dt::Date + t::Time -> DateTime

The addition of a Date with a Time produces a DateTime. The hour, minute, second, and millisecond parts of the Time are used along with the year, month, and day of the Date to create the new DateTime. Non-zero microseconds or nanoseconds in the Time type will result in an InexactError being thrown.

+(x, y...)

Addition operator.

Infix x+y+z+... calls this function with all arguments, i.e. +(x, y, z, ...), which by default then calls (x+y) + z + ... starting from the left.

Note that overflow is possible for most integer types, including the default Int, when adding large numbers.

Examples

julia> 1 + 20 + 4
 25
 
 julia> +(1, 20, 4)
@@ -30,11 +30,11 @@
  6
 
 julia> typemax(Int) + 1 < 0
-true
source
Base.:-Method
-(x, y)

Subtraction operator.

Examples

julia> 2 - 3
+true
source
Base.:-Method
-(x, y)

Subtraction operator.

Examples

julia> 2 - 3
 -1
 
 julia> -(2, 4.5)
--2.5
source
Base.:*Method
*(x, y...)

Multiplication operator.

Infix x*y*z*... calls this function with all arguments, i.e. *(x, y, z, ...), which by default then calls (x*y) * z * ... starting from the left.

Juxtaposition such as 2pi also calls *(2, pi). Note that this operation has higher precedence than a literal *. Note also that juxtaposition "0x..." (integer zero times a variable whose name starts with x) is forbidden as it clashes with unsigned integer literals: 0x01 isa UInt8.

Note that overflow is possible for most integer types, including the default Int, when multiplying large numbers.

Examples

julia> 2 * 7 * 8
+-2.5
source
Base.:*Method
*(x, y...)

Multiplication operator.

Infix x*y*z*... calls this function with all arguments, i.e. *(x, y, z, ...), which by default then calls (x*y) * z * ... starting from the left.

Juxtaposition such as 2pi also calls *(2, pi). Note that this operation has higher precedence than a literal *. Note also that juxtaposition "0x..." (integer zero times a variable whose name starts with x) is forbidden as it clashes with unsigned integer literals: 0x01 isa UInt8.

Note that overflow is possible for most integer types, including the default Int, when multiplying large numbers.

Examples

julia> 2 * 7 * 8
 112
 
 julia> *(2, 7, 8)
@@ -49,14 +49,14 @@
 (0.15915494309189535, 1.5707963267948966)
 
 julia> x = [1, 2]; x'x  # adjoint vector * vector
-5
source
Base.:/Function
/(x, y)

Right division operator: multiplication of x by the inverse of y on the right.

Gives floating-point results for integer arguments. See ÷ for integer division, or // for Rational results.

Examples

julia> 1/2
+5
source
Base.:/Function
/(x, y)

Right division operator: multiplication of x by the inverse of y on the right.

Gives floating-point results for integer arguments. See ÷ for integer division, or // for Rational results.

Examples

julia> 1/2
 0.5
 
 julia> 4/2
 2.0
 
 julia> 4.5/2
-2.25
source
A / B

Matrix right-division: A / B is equivalent to (B' \ A')' where \ is the left-division operator. For square matrices, the result X is such that A == X*B.

See also: rdiv!.

Examples

julia> A = Float64[1 4 5; 3 9 2]; B = Float64[1 4 2; 3 4 2; 8 7 1];
+2.25
source
A / B

Matrix right-division: A / B is equivalent to (B' \ A')' where \ is the left-division operator. For square matrices, the result X is such that A == X*B.

See also: rdiv!.

Examples

julia> A = Float64[1 4 5; 3 9 2]; B = Float64[1 4 2; 3 4 2; 8 7 1];
 
 julia> X = A / B
 2×3 Matrix{Float64}:
@@ -83,7 +83,7 @@
 julia> inv(A) * x
 2-element Vector{Float64}:
   6.5
- -7.0
source
Base.:^Method
^(x, y)

Exponentiation operator.

If x and y are integers, the result may overflow. To enter numbers in scientific notation, use Float64 literals such as 1.2e3 rather than 1.2 * 10^3.

If y is an Int literal (e.g. 2 in x^2 or -3 in x^-3), the Julia code x^y is transformed by the compiler to Base.literal_pow(^, x, Val(y)), to enable compile-time specialization on the value of the exponent. (As a default fallback we have Base.literal_pow(^, x, Val(y)) = ^(x,y), where usually ^ == Base.^ unless ^ has been defined in the calling namespace.) If y is a negative integer literal, then Base.literal_pow transforms the operation to inv(x)^-y by default, where -y is positive.

See also exp2, <<.

Examples

julia> 3^5
+ -7.0
source
Base.:^Method
^(x, y)

Exponentiation operator.

If x and y are integers, the result may overflow. To enter numbers in scientific notation, use Float64 literals such as 1.2e3 rather than 1.2 * 10^3.

If y is an Int literal (e.g. 2 in x^2 or -3 in x^-3), the Julia code x^y is transformed by the compiler to Base.literal_pow(^, x, Val(y)), to enable compile-time specialization on the value of the exponent. (As a default fallback we have Base.literal_pow(^, x, Val(y)) = ^(x,y), where usually ^ == Base.^ unless ^ has been defined in the calling namespace.) If y is a negative integer literal, then Base.literal_pow transforms the operation to inv(x)^-y by default, where -y is positive.

See also exp2, <<.

Examples

julia> 3^5
 243
 
 julia> 3^-1  # uses Base.literal_pow
@@ -103,11 +103,11 @@
 false
 
 julia> big(10)^19 == 1e19
-true
source
Base.fmaFunction
fma(x, y, z)

Computes x*y+z without rounding the intermediate result x*y. On some systems this is significantly more expensive than x*y+z. fma is used to improve accuracy in certain algorithms. See muladd.

source
Base.muladdFunction
muladd(x, y, z)

Combined multiply-add: computes x*y+z, but allowing the add and multiply to be merged with each other or with surrounding operations for performance. For example, this may be implemented as an fma if the hardware supports it efficiently. The result can be different on different machines and can also be different on the same machine due to constant propagation or other optimizations. See fma.

Examples

julia> muladd(3, 2, 1)
+true
source
Base.fmaFunction
fma(x, y, z)

Computes x*y+z without rounding the intermediate result x*y. On some systems this is significantly more expensive than x*y+z. fma is used to improve accuracy in certain algorithms. See muladd.

source
Base.muladdFunction
muladd(x, y, z)

Combined multiply-add: computes x*y+z, but allowing the add and multiply to be merged with each other or with surrounding operations for performance. For example, this may be implemented as an fma if the hardware supports it efficiently. The result can be different on different machines and can also be different on the same machine due to constant propagation or other optimizations. See fma.

Examples

julia> muladd(3, 2, 1)
 7
 
 julia> 3 * 2 + 1
-7
source
muladd(A, y, z)

Combined multiply-add, A*y .+ z, for matrix-matrix or matrix-vector multiplication. The result is always the same size as A*y, but z may be smaller, or a scalar.

Julia 1.6

These methods require Julia 1.6 or later.

Examples

julia> A=[1.0 2.0; 3.0 4.0]; B=[1.0 1.0; 1.0 1.0]; z=[0, 100];
+7
source
muladd(A, y, z)

Combined multiply-add, A*y .+ z, for matrix-matrix or matrix-vector multiplication. The result is always the same size as A*y, but z may be smaller, or a scalar.

Julia 1.6

These methods require Julia 1.6 or later.

Examples

julia> A=[1.0 2.0; 3.0 4.0]; B=[1.0 1.0; 1.0 1.0]; z=[0, 100];
 
 julia> muladd(A, B, z)
 2×2 Matrix{Float64}:
@@ -122,7 +122,7 @@
 1.0 + 0.0im
 
 julia> inv(2//3)
-3//2
Julia 1.2

inv(::Missing) requires at least Julia 1.2.

source
Base.divFunction
div(x, y)
+3//2
Julia 1.2

inv(::Missing) requires at least Julia 1.2.

source
Base.divFunction
div(x, y)
 ÷(x, y)

The quotient from Euclidean (integer) division. Generally equivalent to a mathematical operation x/y without a fractional part.

See also: cld, fld, rem, divrem.

Examples

julia> 9 ÷ 4
 2
 
@@ -134,7 +134,7 @@
 
 julia> div.(-5:5, 3)'
 1×11 adjoint(::Vector{Int64}) with eltype Int64:
- -1  -1  -1  0  0  0  0  0  1  1  1
source
Base.divMethod
div(x, y, r::RoundingMode=RoundToZero)

The quotient from Euclidean (integer) division. Computes x / y, rounded to an integer according to the rounding mode r. In other words, the quantity

round(x / y, r)

without any intermediate rounding.

Julia 1.4

The three-argument method taking a RoundingMode requires Julia 1.4 or later.

See also fld and cld, which are special cases of this function.

Julia 1.9

RoundFromZero requires at least Julia 1.9.

Examples:

julia> div(4, 3, RoundToZero) # Matches div(4, 3)
+ -1  -1  -1  0  0  0  0  0  1  1  1
source
Base.divMethod
div(x, y, r::RoundingMode=RoundToZero)

The quotient from Euclidean (integer) division. Computes x / y, rounded to an integer according to the rounding mode r. In other words, the quantity

round(x / y, r)

without any intermediate rounding.

Julia 1.4

The three-argument method taking a RoundingMode requires Julia 1.4 or later.

See also fld and cld, which are special cases of this function.

Julia 1.9

RoundFromZero requires at least Julia 1.9.

Examples:

julia> div(4, 3, RoundToZero) # Matches div(4, 3)
 1
 julia> div(4, 3, RoundDown) # Matches fld(4, 3)
 1
@@ -158,7 +158,7 @@
 julia> 6.0 / 0.1
 60.0
 julia> 6.0 / big(0.1)
-59.99999999999999666933092612453056361837965690217069245739573412231113406246995

What is happening here is that the true value of the floating-point number written as 0.1 is slightly larger than the numerical value 1/10 while 6.0 represents the number 6 precisely. Therefore the true value of 6.0 / 0.1 is slightly less than 60. When doing division, this is rounded to precisely 60.0, but div(6.0, 0.1, RoundToZero) always truncates the true value, so the result is 59.0.

source
Base.fldFunction
fld(x, y)

Largest integer less than or equal to x / y. Equivalent to div(x, y, RoundDown).

See also div, cld, fld1.

Examples

julia> fld(7.3, 5.5)
+59.99999999999999666933092612453056361837965690217069245739573412231113406246995

What is happening here is that the true value of the floating-point number written as 0.1 is slightly larger than the numerical value 1/10 while 6.0 represents the number 6 precisely. Therefore the true value of 6.0 / 0.1 is slightly less than 60. When doing division, this is rounded to precisely 60.0, but div(6.0, 0.1, RoundToZero) always truncates the true value, so the result is 59.0.

source
Base.fldFunction
fld(x, y)

Largest integer less than or equal to x / y. Equivalent to div(x, y, RoundDown).

See also div, cld, fld1.

Examples

julia> fld(7.3, 5.5)
 1.0
 
 julia> fld.(-5:5, 3)'
@@ -168,12 +168,12 @@
 julia> 6.0 / 0.1
 60.0
 julia> 6.0 / big(0.1)
-59.99999999999999666933092612453056361837965690217069245739573412231113406246995

What is happening here is that the true value of the floating-point number written as 0.1 is slightly larger than the numerical value 1/10 while 6.0 represents the number 6 precisely. Therefore the true value of 6.0 / 0.1 is slightly less than 60. When doing division, this is rounded to precisely 60.0, but fld(6.0, 0.1) always takes the floor of the true value, so the result is 59.0.

source
Base.cldFunction
cld(x, y)

Smallest integer larger than or equal to x / y. Equivalent to div(x, y, RoundUp).

See also div, fld.

Examples

julia> cld(5.5, 2.2)
+59.99999999999999666933092612453056361837965690217069245739573412231113406246995

What is happening here is that the true value of the floating-point number written as 0.1 is slightly larger than the numerical value 1/10 while 6.0 represents the number 6 precisely. Therefore the true value of 6.0 / 0.1 is slightly less than 60. When doing division, this is rounded to precisely 60.0, but fld(6.0, 0.1) always takes the floor of the true value, so the result is 59.0.

source
Base.cldFunction
cld(x, y)

Smallest integer larger than or equal to x / y. Equivalent to div(x, y, RoundUp).

See also div, fld.

Examples

julia> cld(5.5, 2.2)
 3.0
 
 julia> cld.(-5:5, 3)'
 1×11 adjoint(::Vector{Int64}) with eltype Int64:
- -1  -1  -1  0  0  0  1  1  1  2  2
source
Base.modFunction
rem(x::Integer, T::Type{<:Integer}) -> T
+ -1  -1  -1  0  0  0  1  1  1  2  2
source
Base.modFunction
rem(x::Integer, T::Type{<:Integer}) -> T
 mod(x::Integer, T::Type{<:Integer}) -> T
 %(x::Integer, T::Type{<:Integer}) -> T

Find y::T such that xy (mod n), where n is the number of integers representable in T, and y is an integer in [typemin(T),typemax(T)]. If T can represent any integer (e.g. T == BigInt), then this operation corresponds to a conversion to T.

Examples

julia> x = 129 % Int8
 -127
@@ -185,7 +185,7 @@
 129
 
 julia> typeof(x)
-BigInt
source
mod(x, y)
+BigInt
source
mod(x, y)
 rem(x, y, RoundDown)

The reduction of x modulo y, or equivalently, the remainder of x after floored division by y, i.e. x - y*fld(x,y) if computed without intermediate rounding.

The result will have the same sign as y, and magnitude less than abs(y) (with some exceptions, see note below).

Note

When used with floating point values, the exact result may not be representable by the type, and so rounding error may occur. In particular, if the exact result is very close to y, then it may be rounded to y.

See also: rem, div, fld, mod1, invmod.

julia> mod(8, 3)
 2
 
@@ -203,11 +203,11 @@
 
 julia> mod.(-5:5, 3)'
 1×11 adjoint(::Vector{Int64}) with eltype Int64:
- 1  2  0  1  2  0  1  2  0  1  2
source
mod(x::Integer, r::AbstractUnitRange)

Find y in the range r such that xy (mod n), where n = length(r), i.e. y = mod(x - first(r), n) + first(r).

See also mod1.

Examples

julia> mod(0, Base.OneTo(3))  # mod1(0, 3)
+ 1  2  0  1  2  0  1  2  0  1  2
source
mod(x::Integer, r::AbstractUnitRange)

Find y in the range r such that xy (mod n), where n = length(r), i.e. y = mod(x - first(r), n) + first(r).

See also mod1.

Examples

julia> mod(0, Base.OneTo(3))  # mod1(0, 3)
 3
 
 julia> mod(3, 0:2)  # mod(3, 3)
-0
Julia 1.3

This method requires at least Julia 1.3.

source
Base.remFunction
rem(x, y)
+0
Julia 1.3

This method requires at least Julia 1.3.

source
Base.remFunction
rem(x, y)
 %(x, y)

Remainder from Euclidean division, returning a value of the same sign as x, and smaller in magnitude than y. This value is always exact.

See also: div, mod, mod1, divrem.

Examples

julia> x = 15; y = 4;
 
 julia> x % y
@@ -218,7 +218,7 @@
 
 julia> rem.(-5:5, 3)'
 1×11 adjoint(::Vector{Int64}) with eltype Int64:
- -2  -1  0  -2  -1  0  1  2  0  1  2
source
Base.remMethod
rem(x, y, r::RoundingMode=RoundToZero)

Compute the remainder of x after integer division by y, with the quotient rounded according to the rounding mode r. In other words, the quantity

x - y * round(x / y, r)

without any intermediate rounding.

  • if r == RoundNearest, then the result is exact, and in the interval $[-|y| / 2, |y| / 2]$. See also RoundNearest.

  • if r == RoundToZero (default), then the result is exact, and in the interval $[0, |y|)$ if x is positive, or $(-|y|, 0]$ otherwise. See also RoundToZero.

  • if r == RoundDown, then the result is in the interval $[0, y)$ if y is positive, or $(y, 0]$ otherwise. The result may not be exact if x and y have different signs, and abs(x) < abs(y). See also RoundDown.

  • if r == RoundUp, then the result is in the interval $(-y, 0]$ if y is positive, or $[0, -y)$ otherwise. The result may not be exact if x and y have the same sign, and abs(x) < abs(y). See also RoundUp.

  • if r == RoundFromZero, then the result is in the interval $(-y, 0]$ if y is positive, or $[0, -y)$ otherwise. The result may not be exact if x and y have the same sign, and abs(x) < abs(y). See also RoundFromZero.

Julia 1.9

RoundFromZero requires at least Julia 1.9.

Examples:

julia> x = 9; y = 4;
+ -2  -1  0  -2  -1  0  1  2  0  1  2
source
Base.remMethod
rem(x, y, r::RoundingMode=RoundToZero)

Compute the remainder of x after integer division by y, with the quotient rounded according to the rounding mode r. In other words, the quantity

x - y * round(x / y, r)

without any intermediate rounding.

  • if r == RoundNearest, then the result is exact, and in the interval $[-|y| / 2, |y| / 2]$. See also RoundNearest.

  • if r == RoundToZero (default), then the result is exact, and in the interval $[0, |y|)$ if x is positive, or $(-|y|, 0]$ otherwise. See also RoundToZero.

  • if r == RoundDown, then the result is in the interval $[0, y)$ if y is positive, or $(y, 0]$ otherwise. The result may not be exact if x and y have different signs, and abs(x) < abs(y). See also RoundDown.

  • if r == RoundUp, then the result is in the interval $(-y, 0]$ if y is positive, or $[0, -y)$ otherwise. The result may not be exact if x and y have the same sign, and abs(x) < abs(y). See also RoundUp.

  • if r == RoundFromZero, then the result is in the interval $(-y, 0]$ if y is positive, or $[0, -y)$ otherwise. The result may not be exact if x and y have the same sign, and abs(x) < abs(y). See also RoundFromZero.

Julia 1.9

RoundFromZero requires at least Julia 1.9.

Examples:

julia> x = 9; y = 4;
 
 julia> x % y  # same as rem(x, y)
 1
@@ -227,16 +227,16 @@
 2
 
 julia> x == div(x, y) * y + rem(x, y)
-true
source
Base.Math.rem2piFunction
rem2pi(x, r::RoundingMode)

Compute the remainder of x after integer division by , with the quotient rounded according to the rounding mode r. In other words, the quantity

x - 2π*round(x/(2π),r)

without any intermediate rounding. This internally uses a high precision approximation of 2π, and so will give a more accurate result than rem(x,2π,r)

  • if r == RoundNearest, then the result is in the interval $[-π, π]$. This will generally be the most accurate result. See also RoundNearest.

  • if r == RoundToZero, then the result is in the interval $[0, 2π]$ if x is positive,. or $[-2π, 0]$ otherwise. See also RoundToZero.

  • if r == RoundDown, then the result is in the interval $[0, 2π]$. See also RoundDown.

  • if r == RoundUp, then the result is in the interval $[-2π, 0]$. See also RoundUp.

Examples

julia> rem2pi(7pi/4, RoundNearest)
+true
source
Base.Math.rem2piFunction
rem2pi(x, r::RoundingMode)

Compute the remainder of x after integer division by , with the quotient rounded according to the rounding mode r. In other words, the quantity

x - 2π*round(x/(2π),r)

without any intermediate rounding. This internally uses a high precision approximation of 2π, and so will give a more accurate result than rem(x,2π,r)

  • if r == RoundNearest, then the result is in the interval $[-π, π]$. This will generally be the most accurate result. See also RoundNearest.

  • if r == RoundToZero, then the result is in the interval $[0, 2π]$ if x is positive,. or $[-2π, 0]$ otherwise. See also RoundToZero.

  • if r == RoundDown, then the result is in the interval $[0, 2π]$. See also RoundDown.

  • if r == RoundUp, then the result is in the interval $[-2π, 0]$. See also RoundUp.

Examples

julia> rem2pi(7pi/4, RoundNearest)
 -0.7853981633974485
 
 julia> rem2pi(7pi/4, RoundDown)
-5.497787143782138
source
Base.Math.mod2piFunction
mod2pi(x)

Modulus after division by , returning in the range $[0,2π)$.

This function computes a floating point representation of the modulus after division by numerically exact , and is therefore not exactly the same as mod(x,2π), which would compute the modulus of x relative to division by the floating-point number .

Note

Depending on the format of the input value, the closest representable value to 2π may be less than 2π. For example, the expression mod2pi(2π) will not return 0, because the intermediate value of 2*π is a Float64 and 2*Float64(π) < 2*big(π). See rem2pi for more refined control of this behavior.

Examples

julia> mod2pi(9*pi/4)
-0.7853981633974481
source
Base.divremFunction
divrem(x, y, r::RoundingMode=RoundToZero)

The quotient and remainder from Euclidean division. Equivalent to (div(x, y, r), rem(x, y, r)). Equivalently, with the default value of r, this call is equivalent to (x ÷ y, x % y).

See also: fldmod, cld.

Examples

julia> divrem(3, 7)
+5.497787143782138
source
Base.Math.mod2piFunction
mod2pi(x)

Modulus after division by , returning in the range $[0,2π)$.

This function computes a floating point representation of the modulus after division by numerically exact , and is therefore not exactly the same as mod(x,2π), which would compute the modulus of x relative to division by the floating-point number .

Note

Depending on the format of the input value, the closest representable value to 2π may be less than 2π. For example, the expression mod2pi(2π) will not return 0, because the intermediate value of 2*π is a Float64 and 2*Float64(π) < 2*big(π). See rem2pi for more refined control of this behavior.

Examples

julia> mod2pi(9*pi/4)
+0.7853981633974481
source
Base.divremFunction
divrem(x, y, r::RoundingMode=RoundToZero)

The quotient and remainder from Euclidean division. Equivalent to (div(x, y, r), rem(x, y, r)). Equivalently, with the default value of r, this call is equivalent to (x ÷ y, x % y).

See also: fldmod, cld.

Examples

julia> divrem(3, 7)
 (0, 3)
 
 julia> divrem(7, 3)
-(2, 1)
source
Base.fldmodFunction
fldmod(x, y)

The floored quotient and modulus after division. A convenience wrapper for divrem(x, y, RoundDown). Equivalent to (fld(x, y), mod(x, y)).

See also: fld, cld, fldmod1.

source
Base.fld1Function
fld1(x, y)

Flooring division, returning a value consistent with mod1(x,y)

See also mod1, fldmod1.

Examples

julia> x = 15; y = 4;
+(2, 1)
source
Base.fldmodFunction
fldmod(x, y)

The floored quotient and modulus after division. A convenience wrapper for divrem(x, y, RoundDown). Equivalent to (fld(x, y), mod(x, y)).

See also: fld, cld, fldmod1.

source
Base.fld1Function
fld1(x, y)

Flooring division, returning a value consistent with mod1(x,y)

See also mod1, fldmod1.

Examples

julia> x = 15; y = 4;
 
 julia> fld1(x, y)
 4
@@ -245,7 +245,7 @@
 true
 
 julia> x == (fld1(x, y) - 1) * y + mod1(x, y)
-true
source
Base.mod1Function
mod1(x, y)

Modulus after flooring division, returning a value r such that mod(r, y) == mod(x, y) in the range $(0, y]$ for positive y and in the range $[y,0)$ for negative y.

With integer arguments and positive y, this is equal to mod(x, 1:y), and hence natural for 1-based indexing. By comparison, mod(x, y) == mod(x, 0:y-1) is natural for computations with offsets or strides.

See also mod, fld1, fldmod1.

Examples

julia> mod1(4, 2)
+true
source
Base.mod1Function
mod1(x, y)

Modulus after flooring division, returning a value r such that mod(r, y) == mod(x, y) in the range $(0, y]$ for positive y and in the range $[y,0)$ for negative y.

With integer arguments and positive y, this is equal to mod(x, 1:y), and hence natural for 1-based indexing. By comparison, mod(x, y) == mod(x, 0:y-1) is natural for computations with offsets or strides.

See also mod, fld1, fldmod1.

Examples

julia> mod1(4, 2)
 2
 
 julia> mod1.(-5:5, 3)'
@@ -254,7 +254,7 @@
 
 julia> mod1.([-0.1, 0, 0.1, 1, 2, 2.9, 3, 3.1]', 3)
 1×8 Matrix{Float64}:
- 2.9  3.0  0.1  1.0  2.0  2.9  3.0  0.1
source
Base.fldmod1Function
fldmod1(x, y)

Return (fld1(x,y), mod1(x,y)).

See also fld1, mod1.

source
Base.://Function
//(num, den)

Divide two integers or rational numbers, giving a Rational result. More generally, // can be used for exact rational division of other numeric types with integer or rational components, such as complex numbers with integer components.

Note that floating-point (AbstractFloat) arguments are not permitted by // (even if the values are rational). The arguments must be subtypes of Integer, Rational, or composites thereof.

Examples

julia> 3 // 5
+ 2.9  3.0  0.1  1.0  2.0  2.9  3.0  0.1
source
Base.fldmod1Function
fldmod1(x, y)

Return (fld1(x,y), mod1(x,y)).

See also fld1, mod1.

source
Base.://Function
//(num, den)

Divide two integers or rational numbers, giving a Rational result. More generally, // can be used for exact rational division of other numeric types with integer or rational components, such as complex numbers with integer components.

Note that floating-point (AbstractFloat) arguments are not permitted by // (even if the values are rational). The arguments must be subtypes of Integer, Rational, or composites thereof.

Examples

julia> 3 // 5
 3//5
 
 julia> (3 // 5) // (2 // 1)
@@ -265,22 +265,22 @@
 
 julia> 1.0 // 2
 ERROR: MethodError: no method matching //(::Float64, ::Int64)
-[...]
source
Base.rationalizeFunction
rationalize([T<:Integer=Int,] x; tol::Real=eps(x))

Approximate floating point number x as a Rational number with components of the given integer type. The result will differ from x by no more than tol.

Examples

julia> rationalize(5.6)
+[...]
source
Base.rationalizeFunction
rationalize([T<:Integer=Int,] x; tol::Real=eps(x))

Approximate floating point number x as a Rational number with components of the given integer type. The result will differ from x by no more than tol.

Examples

julia> rationalize(5.6)
 28//5
 
 julia> a = rationalize(BigInt, 10.3)
 103//10
 
 julia> typeof(numerator(a))
-BigInt
source
Base.numeratorFunction
numerator(x)

Numerator of the rational representation of x.

Examples

julia> numerator(2//3)
+BigInt
source
Base.numeratorFunction
numerator(x)

Numerator of the rational representation of x.

Examples

julia> numerator(2//3)
 2
 
 julia> numerator(4)
-4
source
Base.denominatorFunction
denominator(x)

Denominator of the rational representation of x.

Examples

julia> denominator(2//3)
+4
source
Base.denominatorFunction
denominator(x)

Denominator of the rational representation of x.

Examples

julia> denominator(2//3)
 3
 
 julia> denominator(4)
-1
source
Base.:<<Function
<<(B::BitVector, n) -> BitVector

Left bit shift operator, B << n. For n >= 0, the result is B with elements shifted n positions backwards, filling with false values. If n < 0, elements are shifted forwards. Equivalent to B >> -n.

Examples

julia> B = BitVector([true, false, true, false, false])
+1
source
Base.:<<Function
<<(B::BitVector, n) -> BitVector

Left bit shift operator, B << n. For n >= 0, the result is B with elements shifted n positions backwards, filling with false values. If n < 0, elements are shifted forwards. Equivalent to B >> -n.

Examples

julia> B = BitVector([true, false, true, false, false])
 5-element BitVector:
  1
  0
@@ -302,14 +302,14 @@
  1
  0
  1
- 0
source
<<(x, n)

Left bit shift operator, x << n. For n >= 0, the result is x shifted left by n bits, filling with 0s. This is equivalent to x * 2^n. For n < 0, this is equivalent to x >> -n.

Examples

julia> Int8(3) << 2
+ 0
source
<<(x, n)

Left bit shift operator, x << n. For n >= 0, the result is x shifted left by n bits, filling with 0s. This is equivalent to x * 2^n. For n < 0, this is equivalent to x >> -n.

Examples

julia> Int8(3) << 2
 12
 
 julia> bitstring(Int8(3))
 "00000011"
 
 julia> bitstring(Int8(12))
-"00001100"

See also >>, >>>, exp2, ldexp.

source
Base.:>>Function
>>(B::BitVector, n) -> BitVector

Right bit shift operator, B >> n. For n >= 0, the result is B with elements shifted n positions forward, filling with false values. If n < 0, elements are shifted backwards. Equivalent to B << -n.

Examples

julia> B = BitVector([true, false, true, false, false])
+"00001100"

See also >>, >>>, exp2, ldexp.

source
Base.:>>Function
>>(B::BitVector, n) -> BitVector

Right bit shift operator, B >> n. For n >= 0, the result is B with elements shifted n positions forward, filling with false values. If n < 0, elements are shifted backwards. Equivalent to B << -n.

Examples

julia> B = BitVector([true, false, true, false, false])
 5-element BitVector:
  1
  0
@@ -331,7 +331,7 @@
  1
  0
  0
- 0
source
>>(x, n)

Right bit shift operator, x >> n. For n >= 0, the result is x shifted right by n bits, filling with 0s if x >= 0, 1s if x < 0, preserving the sign of x. This is equivalent to fld(x, 2^n). For n < 0, this is equivalent to x << -n.

Examples

julia> Int8(13) >> 2
+ 0
source
>>(x, n)

Right bit shift operator, x >> n. For n >= 0, the result is x shifted right by n bits, filling with 0s if x >= 0, 1s if x < 0, preserving the sign of x. This is equivalent to fld(x, 2^n). For n < 0, this is equivalent to x << -n.

Examples

julia> Int8(13) >> 2
 3
 
 julia> bitstring(Int8(13))
@@ -347,14 +347,14 @@
 "11110010"
 
 julia> bitstring(Int8(-4))
-"11111100"

See also >>>, <<.

source
Base.:>>>Function
>>>(B::BitVector, n) -> BitVector

Unsigned right bitshift operator, B >>> n. Equivalent to B >> n. See >> for details and examples.

source
>>>(x, n)

Unsigned right bit shift operator, x >>> n. For n >= 0, the result is x shifted right by n bits, filling with 0s. For n < 0, this is equivalent to x << -n.

For Unsigned integer types, this is equivalent to >>. For Signed integer types, this is equivalent to signed(unsigned(x) >> n).

Examples

julia> Int8(-14) >>> 2
+"11111100"

See also >>>, <<.

source
Base.:>>>Function
>>>(B::BitVector, n) -> BitVector

Unsigned right bitshift operator, B >>> n. Equivalent to B >> n. See >> for details and examples.

source
>>>(x, n)

Unsigned right bit shift operator, x >>> n. For n >= 0, the result is x shifted right by n bits, filling with 0s. For n < 0, this is equivalent to x << -n.

For Unsigned integer types, this is equivalent to >>. For Signed integer types, this is equivalent to signed(unsigned(x) >> n).

Examples

julia> Int8(-14) >>> 2
 60
 
 julia> bitstring(Int8(-14))
 "11110010"
 
 julia> bitstring(Int8(60))
-"00111100"

BigInts are treated as if having infinite size, so no filling is required and this is equivalent to >>.

See also >>, <<.

source
Base.bitrotateFunction
bitrotate(x::Base.BitInteger, k::Integer)

bitrotate(x, k) implements bitwise rotation. It returns the value of x with its bits rotated left k times. A negative value of k will rotate to the right instead.

Julia 1.5

This function requires Julia 1.5 or later.

See also: <<, circshift, BitArray.

julia> bitrotate(UInt8(114), 2)
+"00111100"

BigInts are treated as if having infinite size, so no filling is required and this is equivalent to >>.

See also >>, <<.

source
Base.bitrotateFunction
bitrotate(x::Base.BitInteger, k::Integer)

bitrotate(x, k) implements bitwise rotation. It returns the value of x with its bits rotated left k times. A negative value of k will rotate to the right instead.

Julia 1.5

This function requires Julia 1.5 or later.

See also: <<, circshift, BitArray.

julia> bitrotate(UInt8(114), 2)
 0xc9
 
 julia> bitstring(bitrotate(0b01110010, 2))
@@ -364,7 +364,7 @@
 "10011100"
 
 julia> bitstring(bitrotate(0b01110010, 8))
-"01110010"
source
Base.::Function
:expr

Quote an expression expr, returning the abstract syntax tree (AST) of expr. The AST may be of type Expr, Symbol, or a literal value. The syntax :identifier evaluates to a Symbol.

See also: Expr, Symbol, Meta.parse

Examples

julia> expr = :(a = b + 2*x)
+"01110010"
source
Base.::Function
:expr

Quote an expression expr, returning the abstract syntax tree (AST) of expr. The AST may be of type Expr, Symbol, or a literal value. The syntax :identifier evaluates to a Symbol.

See also: Expr, Symbol, Meta.parse

Examples

julia> expr = :(a = b + 2*x)
 :(a = b + 2x)
 
 julia> sym = :some_identifier
@@ -374,7 +374,7 @@
 0xff
 
 julia> typeof((expr, sym, value))
-Tuple{Expr, Symbol, UInt8}
source
Base.rangeFunction
range(start, stop, length)
+Tuple{Expr, Symbol, UInt8}
source
Base.rangeFunction
range(start, stop, length)
 range(start, stop; length, step)
 range(start; length, stop, step)
 range(;start, length, stop, step)

Construct a specialized array with evenly spaced elements and optimized storage (an AbstractRange) from the arguments. Mathematically a range is uniquely determined by any three of start, step, stop and length. Valid invocations of range are:

  • Call range with any three of start, step, stop, length.
  • Call range with two of start, stop, length. In this case step will be assumed to be positive one. If both arguments are Integers, a UnitRange will be returned.
  • Call range with one of stop or length. start and step will be assumed to be positive one.

To construct a descending range, specify a negative step size, e.g. range(5, 1; step = -1) => [5,4,3,2,1]. Otherwise, a stop value less than the start value, with the default step of +1, constructs an empty range. Empty ranges are normalized such that the stop is one less than the start, e.g. range(5, 1) == 5:4.

See Extended Help for additional details on the returned type. See also logrange for logarithmically spaced points.

Examples

julia> range(1, length=100)
@@ -412,9 +412,9 @@
 
 julia> range(; stop = 6.5)
 1.0:1.0:6.0

If length is not specified and stop - start is not an integer multiple of step, a range that ends before stop will be produced.

julia> range(1, 3.5, step=2)
-1.0:2.0:3.0

Special care is taken to ensure intermediate values are computed rationally. To avoid this induced overhead, see the LinRange constructor.

Julia 1.1

stop as a positional argument requires at least Julia 1.1.

Julia 1.7

The versions without keyword arguments and start as a keyword argument require at least Julia 1.7.

Julia 1.8

The versions with stop as a sole keyword argument, or length as a sole keyword argument require at least Julia 1.8.

Extended Help

range will produce a Base.OneTo when the arguments are Integers and

  • Only length is provided
  • Only stop is provided

range will produce a UnitRange when the arguments are Integers and

  • Only start and stop are provided
  • Only length and stop are provided

A UnitRange is not produced if step is provided even if specified as one.

source
Base.OneToType
Base.OneTo(n)

Define an AbstractUnitRange that behaves like 1:n, with the added distinction that the lower limit is guaranteed (by the type system) to be 1.

source
Base.StepRangeLenType
StepRangeLen(         ref::R, step::S, len, [offset=1]) where {  R,S}
+1.0:2.0:3.0

Special care is taken to ensure intermediate values are computed rationally. To avoid this induced overhead, see the LinRange constructor.

Julia 1.1

stop as a positional argument requires at least Julia 1.1.

Julia 1.7

The versions without keyword arguments and start as a keyword argument require at least Julia 1.7.

Julia 1.8

The versions with stop as a sole keyword argument, or length as a sole keyword argument require at least Julia 1.8.

Extended Help

range will produce a Base.OneTo when the arguments are Integers and

  • Only length is provided
  • Only stop is provided

range will produce a UnitRange when the arguments are Integers and

  • Only start and stop are provided
  • Only length and stop are provided

A UnitRange is not produced if step is provided even if specified as one.

source
Base.OneToType
Base.OneTo(n)

Define an AbstractUnitRange that behaves like 1:n, with the added distinction that the lower limit is guaranteed (by the type system) to be 1.

source
Base.StepRangeLenType
StepRangeLen(         ref::R, step::S, len, [offset=1]) where {  R,S}
 StepRangeLen{T,R,S}(  ref::R, step::S, len, [offset=1]) where {T,R,S}
-StepRangeLen{T,R,S,L}(ref::R, step::S, len, [offset=1]) where {T,R,S,L}

A range r where r[i] produces values of type T (in the first form, T is deduced automatically), parameterized by a reference value, a step, and the length. By default ref is the starting value r[1], but alternatively you can supply it as the value of r[offset] for some other index 1 <= offset <= len. The syntax a:b or a:b:c, where any of a, b, or c are floating-point numbers, creates a StepRangeLen.

Julia 1.7

The 4th type parameter L requires at least Julia 1.7.

source
Base.lograngeFunction
logrange(start, stop, length)
+StepRangeLen{T,R,S,L}(ref::R, step::S, len, [offset=1]) where {T,R,S,L}

A range r where r[i] produces values of type T (in the first form, T is deduced automatically), parameterized by a reference value, a step, and the length. By default ref is the starting value r[1], but alternatively you can supply it as the value of r[offset] for some other index 1 <= offset <= len. The syntax a:b or a:b:c, where any of a, b, or c are floating-point numbers, creates a StepRangeLen.

Julia 1.7

The 4th type parameter L requires at least Julia 1.7.

source
Base.lograngeFunction
logrange(start, stop, length)
 logrange(start, stop; length)

Construct a specialized array whose elements are spaced logarithmically between the given endpoints. That is, the ratio of successive elements is a constant, calculated from the length.

This is similar to geomspace in Python. Unlike PowerRange in Mathematica, you specify the number of elements not the ratio. Unlike logspace in Python and Matlab, the start and stop arguments are always the first and last elements of the result, not powers applied to some base.

Examples

julia> logrange(10, 4000, length=3)
 3-element Base.LogRange{Float64, Base.TwicePrecision{Float64}}:
  10.0, 200.0, 4000.0
@@ -430,7 +430,7 @@
  1.0, 1.41421, 2.0, 2.82843, 4.0, 5.65685, 8.0, 11.3137, 16.0, 22.6274, 32.0
 
 julia> logrange(1, 1000, length=4) ≈ 10 .^ (0:3)
-true

See the LogRange type for further details.

See also range for linearly spaced points.

Julia 1.11

This function requires at least Julia 1.11.

source
Base.LogRangeType
LogRange{T}(start, stop, len) <: AbstractVector{T}

A range whose elements are spaced logarithmically between start and stop, with spacing controlled by len. Returned by logrange.

Like LinRange, the first and last elements will be exactly those provided, but intermediate values may have small floating-point errors. These are calculated using the logs of the endpoints, which are stored on construction, often in higher precision than T.

Examples

julia> logrange(1, 4, length=5)
+true

See the LogRange type for further details.

See also range for linearly spaced points.

Julia 1.11

This function requires at least Julia 1.11.

source
Base.LogRangeType
LogRange{T}(start, stop, len) <: AbstractVector{T}

A range whose elements are spaced logarithmically between start and stop, with spacing controlled by len. Returned by logrange.

Like LinRange, the first and last elements will be exactly those provided, but intermediate values may have small floating-point errors. These are calculated using the logs of the endpoints, which are stored on construction, often in higher precision than T.

Examples

julia> logrange(1, 4, length=5)
 5-element Base.LogRange{Float64, Base.TwicePrecision{Float64}}:
  1.0, 1.41421, 2.0, 2.82843, 4.0
 
@@ -453,26 +453,26 @@
  1.0, 8.0, 64.0, 512.0
 
 julia> 2 .^ (0:3:9) |> println
-[1, 8, 64, 512]
Julia 1.11

This type requires at least Julia 1.11.

source
Base.:==Function
==(x, y)

Generic equality operator. Falls back to ===. Should be implemented for all types with a notion of equality, based on the abstract value that an instance represents. For example, all numeric types are compared by numeric value, ignoring type. Strings are compared as sequences of characters, ignoring encoding. Collections of the same type generally compare their key sets, and if those are ==, then compare the values for each of those keys, returning true if all such pairs are ==. Other properties are typically not taken into account (such as the exact type).

This operator follows IEEE semantics for floating-point numbers: 0.0 == -0.0 and NaN != NaN.

The result is of type Bool, except when one of the operands is missing, in which case missing is returned (three-valued logic). Collections generally implement three-valued logic akin to all, returning missing if any operands contain missing values and all other pairs are equal. Use isequal or === to always get a Bool result.

Implementation

New numeric types should implement this function for two arguments of the new type, and handle comparison to other types via promotion rules where possible.

Equality and hashing are intimately related; two values that are considered isequal must have the same hash and by default isequal falls back to ==. If a type customizes the behavior of == and/or isequal, then hash must be similarly implemented to ensure isequal and hash agree. Sets, Dicts, and many other internal implementations assume that this invariant holds.

If some type defines ==, isequal, and isless then it should also implement < to ensure consistency of comparisons.

source
Base.:!=Function
!=(x)

Create a function that compares its argument to x using !=, i.e. a function equivalent to y -> y != x. The returned function is of type Base.Fix2{typeof(!=)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
!=(x, y)
+[1, 8, 64, 512]
Julia 1.11

This type requires at least Julia 1.11.

source
Base.:==Function
==(x, y)

Generic equality operator. Falls back to ===. Should be implemented for all types with a notion of equality, based on the abstract value that an instance represents. For example, all numeric types are compared by numeric value, ignoring type. Strings are compared as sequences of characters, ignoring encoding. Collections of the same type generally compare their key sets, and if those are ==, then compare the values for each of those keys, returning true if all such pairs are ==. Other properties are typically not taken into account (such as the exact type).

This operator follows IEEE semantics for floating-point numbers: 0.0 == -0.0 and NaN != NaN.

The result is of type Bool, except when one of the operands is missing, in which case missing is returned (three-valued logic). Collections generally implement three-valued logic akin to all, returning missing if any operands contain missing values and all other pairs are equal. Use isequal or === to always get a Bool result.

Implementation

New numeric types should implement this function for two arguments of the new type, and handle comparison to other types via promotion rules where possible.

Equality and hashing are intimately related; two values that are considered isequal must have the same hash and by default isequal falls back to ==. If a type customizes the behavior of == and/or isequal, then hash must be similarly implemented to ensure isequal and hash agree. Sets, Dicts, and many other internal implementations assume that this invariant holds.

If some type defines ==, isequal, and isless then it should also implement < to ensure consistency of comparisons.

source
Base.:!=Function
!=(x)

Create a function that compares its argument to x using !=, i.e. a function equivalent to y -> y != x. The returned function is of type Base.Fix2{typeof(!=)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
!=(x, y)
 ≠(x,y)

Not-equals comparison operator. Always gives the opposite answer as ==.

Implementation

New types should generally not implement this, and rely on the fallback definition !=(x,y) = !(x==y) instead.

Examples

julia> 3 != 2
 true
 
 julia> "foo" ≠ "foo"
-false
source
Core.:!==Function
!==(x, y)
+false
source
Core.:!==Function
!==(x, y)
 ≢(x,y)

Always gives the opposite answer as ===.

Examples

julia> a = [1, 2]; b = [1, 2];
 
 julia> a ≢ b
 true
 
 julia> a ≢ a
-false
source
Base.:<Function
<(x)

Create a function that compares its argument to x using <, i.e. a function equivalent to y -> y < x. The returned function is of type Base.Fix2{typeof(<)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
<(x, y)

Less-than comparison operator. Falls back to isless. Because of the behavior of floating-point NaN values, this operator implements a partial order.

Implementation

New types with a canonical partial order should implement this function for two arguments of the new type. Types with a canonical total order should implement isless instead.

See also isunordered.

Examples

julia> 'a' < 'b'
+false
source
Base.:<Function
<(x)

Create a function that compares its argument to x using <, i.e. a function equivalent to y -> y < x. The returned function is of type Base.Fix2{typeof(<)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
<(x, y)

Less-than comparison operator. Falls back to isless. Because of the behavior of floating-point NaN values, this operator implements a partial order.

Implementation

New types with a canonical partial order should implement this function for two arguments of the new type. Types with a canonical total order should implement isless instead.

See also isunordered.

Examples

julia> 'a' < 'b'
 true
 
 julia> "abc" < "abd"
 true
 
 julia> 5 < 3
-false
source
Base.:<=Function
<=(x)

Create a function that compares its argument to x using <=, i.e. a function equivalent to y -> y <= x. The returned function is of type Base.Fix2{typeof(<=)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
<=(x, y)
+false
source
Base.:<=Function
<=(x)

Create a function that compares its argument to x using <=, i.e. a function equivalent to y -> y <= x. The returned function is of type Base.Fix2{typeof(<=)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
<=(x, y)
 ≤(x,y)

Less-than-or-equals comparison operator. Falls back to (x < y) | (x == y).

Examples

julia> 'a' <= 'b'
 true
 
@@ -483,7 +483,7 @@
 true
 
 julia> 5 <= 3
-false
source
Base.:>Function
>(x)

Create a function that compares its argument to x using >, i.e. a function equivalent to y -> y > x. The returned function is of type Base.Fix2{typeof(>)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
>(x, y)

Greater-than comparison operator. Falls back to y < x.

Implementation

Generally, new types should implement < instead of this function, and rely on the fallback definition >(x, y) = y < x.

Examples

julia> 'a' > 'b'
+false
source
Base.:>Function
>(x)

Create a function that compares its argument to x using >, i.e. a function equivalent to y -> y > x. The returned function is of type Base.Fix2{typeof(>)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
>(x, y)

Greater-than comparison operator. Falls back to y < x.

Implementation

Generally, new types should implement < instead of this function, and rely on the fallback definition >(x, y) = y < x.

Examples

julia> 'a' > 'b'
 false
 
 julia> 7 > 3 > 1
@@ -493,7 +493,7 @@
 false
 
 julia> 5 > 3
-true
source
Base.:>=Function
>=(x)

Create a function that compares its argument to x using >=, i.e. a function equivalent to y -> y >= x. The returned function is of type Base.Fix2{typeof(>=)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
>=(x, y)
+true
source
Base.:>=Function
>=(x)

Create a function that compares its argument to x using >=, i.e. a function equivalent to y -> y >= x. The returned function is of type Base.Fix2{typeof(>=)}, which can be used to implement specialized methods.

Julia 1.2

This functionality requires at least Julia 1.2.

source
>=(x, y)
 ≥(x,y)

Greater-than-or-equals comparison operator. Falls back to y <= x.

Examples

julia> 'a' >= 'b'
 false
 
@@ -504,7 +504,7 @@
 true
 
 julia> 5 >= 3
-true
source
Base.cmpFunction
cmp(a::AbstractString, b::AbstractString) -> Int

Compare two strings. Return 0 if both strings have the same length and the character at each index is the same in both strings. Return -1 if a is a prefix of b, or if a comes before b in alphabetical order. Return 1 if b is a prefix of a, or if b comes before a in alphabetical order (technically, lexicographical order by Unicode code points).

Examples

julia> cmp("abc", "abc")
+true
source
Base.cmpFunction
cmp(a::AbstractString, b::AbstractString) -> Int

Compare two strings. Return 0 if both strings have the same length and the character at each index is the same in both strings. Return -1 if a is a prefix of b, or if a comes before b in alphabetical order. Return 1 if b is a prefix of a, or if b comes before a in alphabetical order (technically, lexicographical order by Unicode code points).

Examples

julia> cmp("abc", "abc")
 0
 
 julia> cmp("ab", "abc")
@@ -523,7 +523,7 @@
 1
 
 julia> cmp("b", "β")
--1
source
cmp(<, x, y)

Return -1, 0, or 1 depending on whether x is less than, equal to, or greater than y, respectively. The first argument specifies a less-than comparison function to use.

source
cmp(x,y)

Return -1, 0, or 1 depending on whether x is less than, equal to, or greater than y, respectively. Uses the total order implemented by isless.

Examples

julia> cmp(1, 2)
+-1
source
cmp(<, x, y)

Return -1, 0, or 1 depending on whether x is less than, equal to, or greater than y, respectively. The first argument specifies a less-than comparison function to use.

source
cmp(x,y)

Return -1, 0, or 1 depending on whether x is less than, equal to, or greater than y, respectively. Uses the total order implemented by isless.

Examples

julia> cmp(1, 2)
 -1
 
 julia> cmp(2, 1)
@@ -531,14 +531,14 @@
 
 julia> cmp(2+im, 3-im)
 ERROR: MethodError: no method matching isless(::Complex{Int64}, ::Complex{Int64})
-[...]
source
Base.:~Function
~(x)

Bitwise not.

See also: !, &, |.

Examples

julia> ~4
+[...]
source
Base.:~Function
~(x)

Bitwise not.

See also: !, &, |.

Examples

julia> ~4
 -5
 
 julia> ~10
 -11
 
 julia> ~true
-false
source
Base.:&Function
x & y

Bitwise and. Implements three-valued logic, returning missing if one operand is missing and the other is true. Add parentheses for function application form: (&)(x, y).

See also: |, xor, &&.

Examples

julia> 4 & 10
+false
source
Base.:&Function
x & y

Bitwise and. Implements three-valued logic, returning missing if one operand is missing and the other is true. Add parentheses for function application form: (&)(x, y).

See also: |, xor, &&.

Examples

julia> 4 & 10
 0
 
 julia> 4 & 12
@@ -548,7 +548,7 @@
 missing
 
 julia> false & missing
-false
source
Base.:|Function
x | y

Bitwise or. Implements three-valued logic, returning missing if one operand is missing and the other is false.

See also: &, xor, ||.

Examples

julia> 4 | 10
+false
source
Base.:|Function
x | y

Bitwise or. Implements three-valued logic, returning missing if one operand is missing and the other is false.

See also: &, xor, ||.

Examples

julia> 4 | 10
 14
 
 julia> 4 | 1
@@ -558,7 +558,7 @@
 true
 
 julia> false | missing
-missing
source
Base.xorFunction
xor(x, y)
+missing
source
Base.xorFunction
xor(x, y)
 ⊻(x, y)

Bitwise exclusive or of x and y. Implements three-valued logic, returning missing if one of the arguments is missing.

The infix operation a ⊻ b is a synonym for xor(a,b), and can be typed by tab-completing \xor or \veebar in the Julia REPL.

Examples

julia> xor(true, false)
 true
 
@@ -575,7 +575,7 @@
 3-element BitVector:
  0
  1
- 0
source
Base.nandFunction
nand(x, y)
+ 0
source
Base.nandFunction
nand(x, y)
 ⊼(x, y)

Bitwise nand (not and) of x and y. Implements three-valued logic, returning missing if one of the arguments is missing.

The infix operation a ⊼ b is a synonym for nand(a,b), and can be typed by tab-completing \nand or \barwedge in the Julia REPL.

Examples

julia> nand(true, false)
 true
 
@@ -592,7 +592,7 @@
 3-element BitVector:
  0
  1
- 1
source
Base.norFunction
nor(x, y)
+ 1
source
Base.norFunction
nor(x, y)
 ⊽(x, y)

Bitwise nor (not or) of x and y. Implements three-valued logic, returning missing if one of the arguments is missing and the other is not true.

The infix operation a ⊽ b is a synonym for nor(a,b), and can be typed by tab-completing \nor or \barvee in the Julia REPL.

Examples

julia> nor(true, false)
 false
 
@@ -612,14 +612,14 @@
 3-element BitVector:
  0
  0
- 1
source
Base.:!Function
!f::Function

Predicate function negation: when the argument of ! is a function, it returns a composed function which computes the boolean negation of f.

See also .

Examples

julia> str = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε"
+ 1
source
Base.:!Function
!f::Function

Predicate function negation: when the argument of ! is a function, it returns a composed function which computes the boolean negation of f.

See also .

Examples

julia> str = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε"
 "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε"
 
 julia> filter(isletter, str)
 "εδxyδfxfyε"
 
 julia> filter(!isletter, str)
-"∀  > 0, ∃  > 0: |-| <  ⇒ |()-()| < "
Julia 1.9

Starting with Julia 1.9, !f returns a ComposedFunction instead of an anonymous function.

source
!(x)

Boolean not. Implements three-valued logic, returning missing if x is missing.

See also ~ for bitwise not.

Examples

julia> !true
+"∀  > 0, ∃  > 0: |-| <  ⇒ |()-()| < "
Julia 1.9

Starting with Julia 1.9, !f returns a ComposedFunction instead of an anonymous function.

source
!(x)

Boolean not. Implements three-valued logic, returning missing if x is missing.

See also ~ for bitwise not.

Examples

julia> !true
 false
 
 julia> !false
@@ -630,7 +630,7 @@
 
 julia> .![true false true]
 1×3 BitMatrix:
- 0  1  0
source
&&Keyword
x && y

Short-circuiting boolean AND.

This is equivalent to x ? y : false: it returns false if x is false and the result of evaluating y if x is true. Note that if y is an expression, it is only evaluated when x is true, which is called "short-circuiting" behavior.

Also, y does not need to have a boolean value. This means that (condition) && (statement) can be used as shorthand for if condition; statement; end for an arbitrary statement.

See also &, the ternary operator ? :, and the manual section on control flow.

Examples

julia> x = 3;
+ 0  1  0
source
&&Keyword
x && y

Short-circuiting boolean AND.

This is equivalent to x ? y : false: it returns false if x is false and the result of evaluating y if x is true. Note that if y is an expression, it is only evaluated when x is true, which is called "short-circuiting" behavior.

Also, y does not need to have a boolean value. This means that (condition) && (statement) can be used as shorthand for if condition; statement; end for an arbitrary statement.

See also &, the ternary operator ? :, and the manual section on control flow.

Examples

julia> x = 3;
 
 julia> x > 1 && x < 10 && x isa Int
 true
@@ -639,14 +639,14 @@
 false
 
 julia> x > 0 && "not a boolean"
-"not a boolean"
source
||Keyword
x || y

Short-circuiting boolean OR.

This is equivalent to x ? true : y: it returns true if x is true and the result of evaluating y if x is false. Note that if y is an expression, it is only evaluated when x is false, which is called "short-circuiting" behavior.

Also, y does not need to have a boolean value. This means that (condition) || (statement) can be used as shorthand for if !(condition); statement; end for an arbitrary statement.

See also: |, xor, &&.

Examples

julia> pi < 3 || ℯ < 3
+"not a boolean"
source
||Keyword
x || y

Short-circuiting boolean OR.

This is equivalent to x ? true : y: it returns true if x is true and the result of evaluating y if x is false. Note that if y is an expression, it is only evaluated when x is false, which is called "short-circuiting" behavior.

Also, y does not need to have a boolean value. This means that (condition) || (statement) can be used as shorthand for if !(condition); statement; end for an arbitrary statement.

See also: |, xor, &&.

Examples

julia> pi < 3 || ℯ < 3
 true
 
 julia> false || true || println("neither is true!")
 true
 
 julia> pi < 3 || "not a boolean"
-"not a boolean"
source

Mathematical Functions

Base.isapproxFunction
isapprox(x; kwargs...) / ≈(x; kwargs...)

Create a function that compares its argument to x using , i.e. a function equivalent to y -> y ≈ x.

The keyword arguments supported here are the same as those in the 2-argument isapprox.

Julia 1.5

This method requires Julia 1.5 or later.

source
isapprox(x, y; atol::Real=0, rtol::Real=atol>0 ? 0 : √eps, nans::Bool=false[, norm::Function])

Inexact equality comparison. Two numbers compare equal if their relative distance or their absolute distance is within tolerance bounds: isapprox returns true if norm(x-y) <= max(atol, rtol*max(norm(x), norm(y))). The default atol (absolute tolerance) is zero and the default rtol (relative tolerance) depends on the types of x and y. The keyword argument nans determines whether or not NaN values are considered equal (defaults to false).

For real or complex floating-point values, if an atol > 0 is not specified, rtol defaults to the square root of eps of the type of x or y, whichever is bigger (least precise). This corresponds to requiring equality of about half of the significant digits. Otherwise, e.g. for integer arguments or if an atol > 0 is supplied, rtol defaults to zero.

The norm keyword defaults to abs for numeric (x,y) and to LinearAlgebra.norm for arrays (where an alternative norm choice is sometimes useful). When x and y are arrays, if norm(x-y) is not finite (i.e. ±Inf or NaN), the comparison falls back to checking whether all elements of x and y are approximately equal component-wise.

The binary operator is equivalent to isapprox with the default arguments, and x ≉ y is equivalent to !isapprox(x,y).

Note that x ≈ 0 (i.e., comparing to zero with the default tolerances) is equivalent to x == 0 since the default atol is 0. In such cases, you should either supply an appropriate atol (or use norm(x) ≤ atol) or rearrange your code (e.g. use x ≈ y rather than x - y ≈ 0). It is not possible to pick a nonzero atol automatically because it depends on the overall scaling (the "units") of your problem: for example, in x - y ≈ 0, atol=1e-9 is an absurdly small tolerance if x is the radius of the Earth in meters, but an absurdly large tolerance if x is the radius of a Hydrogen atom in meters.

Julia 1.6

Passing the norm keyword argument when comparing numeric (non-array) arguments requires Julia 1.6 or later.

Examples

julia> isapprox(0.1, 0.15; atol=0.05)
+"not a boolean"
source

Mathematical Functions

Base.isapproxFunction
isapprox(x; kwargs...) / ≈(x; kwargs...)

Create a function that compares its argument to x using , i.e. a function equivalent to y -> y ≈ x.

The keyword arguments supported here are the same as those in the 2-argument isapprox.

Julia 1.5

This method requires Julia 1.5 or later.

source
isapprox(x, y; atol::Real=0, rtol::Real=atol>0 ? 0 : √eps, nans::Bool=false[, norm::Function])

Inexact equality comparison. Two numbers compare equal if their relative distance or their absolute distance is within tolerance bounds: isapprox returns true if norm(x-y) <= max(atol, rtol*max(norm(x), norm(y))). The default atol (absolute tolerance) is zero and the default rtol (relative tolerance) depends on the types of x and y. The keyword argument nans determines whether or not NaN values are considered equal (defaults to false).

For real or complex floating-point values, if an atol > 0 is not specified, rtol defaults to the square root of eps of the type of x or y, whichever is bigger (least precise). This corresponds to requiring equality of about half of the significant digits. Otherwise, e.g. for integer arguments or if an atol > 0 is supplied, rtol defaults to zero.

The norm keyword defaults to abs for numeric (x,y) and to LinearAlgebra.norm for arrays (where an alternative norm choice is sometimes useful). When x and y are arrays, if norm(x-y) is not finite (i.e. ±Inf or NaN), the comparison falls back to checking whether all elements of x and y are approximately equal component-wise.

The binary operator is equivalent to isapprox with the default arguments, and x ≉ y is equivalent to !isapprox(x,y).

Note that x ≈ 0 (i.e., comparing to zero with the default tolerances) is equivalent to x == 0 since the default atol is 0. In such cases, you should either supply an appropriate atol (or use norm(x) ≤ atol) or rearrange your code (e.g. use x ≈ y rather than x - y ≈ 0). It is not possible to pick a nonzero atol automatically because it depends on the overall scaling (the "units") of your problem: for example, in x - y ≈ 0, atol=1e-9 is an absurdly small tolerance if x is the radius of the Earth in meters, but an absurdly large tolerance if x is the radius of a Hydrogen atom in meters.

Julia 1.6

Passing the norm keyword argument when comparing numeric (non-array) arguments requires Julia 1.6 or later.

Examples

julia> isapprox(0.1, 0.15; atol=0.05)
 true
 
 julia> isapprox(0.1, 0.15; rtol=0.34)
@@ -665,7 +665,7 @@
 true
 
 julia> isapprox([10.0^9, 1.0], [10.0^9, 2.0]) # using `norm`
-true
source
Base.sinMethod
sin(x::T) where {T <: Number} -> float(T)

Compute sine of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also sind, sinpi, sincos, cis, asin.

Examples

julia> round.(sin.(range(0, 2pi, length=9)'), digits=3)
+true
source
Base.sinMethod
sin(x::T) where {T <: Number} -> float(T)

Compute sine of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also sind, sinpi, sincos, cis, asin.

Examples

julia> round.(sin.(range(0, 2pi, length=9)'), digits=3)
 1×9 Matrix{Float64}:
  0.0  0.707  1.0  0.707  0.0  -0.707  -1.0  -0.707  -0.0
 
@@ -682,7 +682,7 @@
 0.866 + 0.5im
 
 julia> round(exp(im*pi/6), digits=3)
-0.866 + 0.5im
source
Base.cosMethod
cos(x::T) where {T <: Number} -> float(T)

Compute cosine of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also cosd, cospi, sincos, cis.

source
Base.Math.sincosMethod
sincos(x::T) where T -> Tuple{float(T),float(T)}

Simultaneously compute the sine and cosine of x, where x is in radians, returning a tuple (sine, cosine).

Throw a DomainError if isinf(x), return a (T(NaN), T(NaN)) if isnan(x).

See also cis, sincospi, sincosd.

source
Base.tanMethod
tan(x::T) where {T <: Number} -> float(T)

Compute tangent of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also tanh.

source
Base.Math.sindFunction
sind(x::T) where T -> float(T)

Compute sine of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.cosdFunction
cosd(x::T) where T -> float(T)

Compute cosine of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.tandFunction
tand(x::T) where T -> float(T)

Compute tangent of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.sincosdFunction
sincosd(x::T) where T -> Tuple{float(T),float(T)}

Simultaneously compute the sine and cosine of x, where x is in degrees, returning a tuple (sine, cosine).

Throw a DomainError if isinf(x), return a (T(NaN), T(NaN)) tuple if isnan(x).

Julia 1.3

This function requires at least Julia 1.3.

source
Base.Math.sinpiFunction
sinpi(x::T) where T -> float(T)

Compute $\sin(\pi x)$ more accurately than sin(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also sind, cospi, sincospi.

source
Base.Math.cospiFunction
cospi(x::T) where T -> float(T)

Compute $\cos(\pi x)$ more accurately than cos(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also: cispi, sincosd, cospi.

source
Base.Math.tanpiFunction
tanpi(x::T) where T -> float(T)

Compute $\tan(\pi x)$ more accurately than tan(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.10

This function requires at least Julia 1.10.

See also tand, sinpi, cospi, sincospi.

source
Base.Math.sincospiFunction
sincospi(x::T) where T -> Tuple{float(T),float(T)}

Simultaneously compute sinpi(x) and cospi(x) (the sine and cosine of π*x, where x is in radians), returning a tuple (sine, cosine).

Throw a DomainError if isinf(x), return a (T(NaN), T(NaN)) tuple if isnan(x).

Julia 1.6

This function requires Julia 1.6 or later.

See also: cispi, sincosd, sinpi.

source
Base.sinhMethod
sinh(x)

Compute hyperbolic sine of x.

See also sin.

source
Base.coshMethod
cosh(x)

Compute hyperbolic cosine of x.

See also cos.

source
Base.tanhMethod
tanh(x)

Compute hyperbolic tangent of x.

See also tan, atanh.

Examples

julia> tanh.(-3:3f0)  # Here 3f0 isa Float32
+0.866 + 0.5im
source
Base.cosMethod
cos(x::T) where {T <: Number} -> float(T)

Compute cosine of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also cosd, cospi, sincos, cis.

source
Base.Math.sincosMethod
sincos(x::T) where T -> Tuple{float(T),float(T)}

Simultaneously compute the sine and cosine of x, where x is in radians, returning a tuple (sine, cosine).

Throw a DomainError if isinf(x), return a (T(NaN), T(NaN)) if isnan(x).

See also cis, sincospi, sincosd.

source
Base.tanMethod
tan(x::T) where {T <: Number} -> float(T)

Compute tangent of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also tanh.

source
Base.Math.sindFunction
sind(x::T) where T -> float(T)

Compute sine of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.cosdFunction
cosd(x::T) where T -> float(T)

Compute cosine of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.tandFunction
tand(x::T) where T -> float(T)

Compute tangent of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.sincosdFunction
sincosd(x::T) where T -> Tuple{float(T),float(T)}

Simultaneously compute the sine and cosine of x, where x is in degrees, returning a tuple (sine, cosine).

Throw a DomainError if isinf(x), return a (T(NaN), T(NaN)) tuple if isnan(x).

Julia 1.3

This function requires at least Julia 1.3.

source
Base.Math.sinpiFunction
sinpi(x::T) where T -> float(T)

Compute $\sin(\pi x)$ more accurately than sin(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also sind, cospi, sincospi.

source
Base.Math.cospiFunction
cospi(x::T) where T -> float(T)

Compute $\cos(\pi x)$ more accurately than cos(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

See also: cispi, sincosd, cospi.

source
Base.Math.tanpiFunction
tanpi(x::T) where T -> float(T)

Compute $\tan(\pi x)$ more accurately than tan(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.10

This function requires at least Julia 1.10.

See also tand, sinpi, cospi, sincospi.

source
Base.Math.sincospiFunction
sincospi(x::T) where T -> Tuple{float(T),float(T)}

Simultaneously compute sinpi(x) and cospi(x) (the sine and cosine of π*x, where x is in radians), returning a tuple (sine, cosine).

Throw a DomainError if isinf(x), return a (T(NaN), T(NaN)) tuple if isnan(x).

Julia 1.6

This function requires Julia 1.6 or later.

See also: cispi, sincosd, sinpi.

source
Base.sinhMethod
sinh(x)

Compute hyperbolic sine of x.

See also sin.

source
Base.coshMethod
cosh(x)

Compute hyperbolic cosine of x.

See also cos.

source
Base.tanhMethod
tanh(x)

Compute hyperbolic tangent of x.

See also tan, atanh.

Examples

julia> tanh.(-3:3f0)  # Here 3f0 isa Float32
 7-element Vector{Float32}:
  -0.9950548
  -0.9640276
@@ -696,11 +696,11 @@
 3-element Vector{ComplexF64}:
  0.0 + 0.7615941559557649im
  0.0 + 0.9640275800758169im
- 0.0 + 0.9950547536867306im
source
Base.asinMethod
asin(x::T) where {T <: Number} -> float(T)

Compute the inverse sine of x, where the output is in radians.

Return a T(NaN) if isnan(x).

See also asind for output in degrees.

Examples

julia> asin.((0, 1/2, 1))
+ 0.0 + 0.9950547536867306im
source
Base.asinMethod
asin(x::T) where {T <: Number} -> float(T)

Compute the inverse sine of x, where the output is in radians.

Return a T(NaN) if isnan(x).

See also asind for output in degrees.

Examples

julia> asin.((0, 1/2, 1))
 (0.0, 0.5235987755982989, 1.5707963267948966)
 
 julia> asind.((0, 1/2, 1))
-(0.0, 30.000000000000004, 90.0)
source
Base.acosMethod
acos(x::T) where {T <: Number} -> float(T)

Compute the inverse cosine of x, where the output is in radians

Return a T(NaN) if isnan(x).

source
Base.atanMethod
atan(y)
+(0.0, 30.000000000000004, 90.0)
source
Base.acosMethod
acos(x::T) where {T <: Number} -> float(T)

Compute the inverse cosine of x, where the output is in radians

Return a T(NaN) if isnan(x).

source
Base.atanMethod
atan(y)
 atan(y, x)

Compute the inverse tangent of y or y/x, respectively.

For one real argument, this is the angle in radians between the positive x-axis and the point (1, y), returning a value in the interval $[-\pi/2, \pi/2]$.

For two arguments, this is the angle in radians between the positive x-axis and the point (x, y), returning a value in the interval $[-\pi, \pi]$. This corresponds to a standard atan2 function. Note that by convention atan(0.0,x) is defined as $\pi$ and atan(-0.0,x) is defined as $-\pi$ when x < 0.

See also atand for degrees.

Examples

julia> rad2deg(atan(-1/√3))
 -30.000000000000004
 
@@ -708,11 +708,11 @@
 -30.000000000000004
 
 julia> rad2deg(atan(1, -√3))
-150.0
source
Base.Math.asindFunction
asind(x)

Compute the inverse sine of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.acosdFunction
acosd(x)

Compute the inverse cosine of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.atandFunction
atand(y::T) where T -> float(T)
+150.0
source
Base.Math.asindFunction
asind(x)

Compute the inverse sine of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.acosdFunction
acosd(x)

Compute the inverse cosine of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.atandFunction
atand(y::T) where T -> float(T)
 atand(y::T, x::S) where {T,S} -> promote_type(T,S)
-atand(y::AbstractMatrix{T}) where T -> AbstractMatrix{Complex{float(T)}}

Compute the inverse tangent of y or y/x, respectively, where the output is in degrees.

Return a NaN if isnan(y) or isnan(x). The returned NaN is either a T in the single argument version, or a promote_type(T,S) in the two argument version.

Julia 1.7

The one-argument method supports square matrix arguments as of Julia 1.7.

source
Base.Math.secMethod
sec(x::T) where {T <: Number} -> float(T)

Compute the secant of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cscMethod
csc(x::T) where {T <: Number} -> float(T)

Compute the cosecant of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cotMethod
cot(x::T) where {T <: Number} -> float(T)

Compute the cotangent of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.secdFunction
secd(x::T) where {T <: Number} -> float(T)

Compute the secant of x, where x is in degrees.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cscdFunction
cscd(x::T) where {T <: Number} -> float(T)

Compute the cosecant of x, where x is in degrees.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cotdFunction
cotd(x::T) where {T <: Number} -> float(T)

Compute the cotangent of x, where x is in degrees.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.asecMethod
asec(x::T) where {T <: Number} -> float(T)

Compute the inverse secant of x, where the output is in radians.

source
Base.Math.acscMethod
acsc(x::T) where {T <: Number} -> float(T)

Compute the inverse cosecant of x, where the output is in radians.

source
Base.Math.acotMethod
acot(x::T) where {T <: Number} -> float(T)

Compute the inverse cotangent of x, where the output is in radians.

source
Base.Math.asecdFunction
asecd(x)

Compute the inverse secant of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.acscdFunction
acscd(x)

Compute the inverse cosecant of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.acotdFunction
acotd(x)

Compute the inverse cotangent of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.sechMethod
sech(x::T) where {T <: Number} -> float(T)

Compute the hyperbolic secant of x.

Return a T(NaN) if isnan(x).

source
Base.Math.cschMethod
csch(x::T) where {T <: Number} -> float(T)

Compute the hyperbolic cosecant of x.

Return a T(NaN) if isnan(x).

source
Base.Math.cothMethod
coth(x::T) where {T <: Number} -> float(T)

Compute the hyperbolic cotangent of x.

Return a T(NaN) if isnan(x).

source
Base.asinhMethod
asinh(x)

Compute the inverse hyperbolic sine of x.

source
Base.acoshMethod
acosh(x)

Compute the inverse hyperbolic cosine of x.

source
Base.atanhMethod
atanh(x)

Compute the inverse hyperbolic tangent of x.

source
Base.Math.asechMethod
asech(x::T) where {T <: Number} -> float(T)

Compute the inverse hyperbolic secant of x.

source
Base.Math.acschMethod
acsch(x::T) where {T <: Number} -> float(T)

Compute the inverse hyperbolic cosecant of x.

source
Base.Math.acothMethod
acoth(x::T) where {T <: Number} -> float(T)

Compute the inverse hyperbolic cotangent of x.

source
Base.Math.sincFunction
sinc(x::T) where {T <: Number} -> float(T)

Compute normalized sinc function $\operatorname{sinc}(x) = \sin(\pi x) / (\pi x)$ if $x \neq 0$, and $1$ if $x = 0$.

Return a T(NaN) if isnan(x).

See also cosc, its derivative.

source
Base.Math.coscFunction
cosc(x::T) where {T <: Number} -> float(T)

Compute $\cos(\pi x) / x - \sin(\pi x) / (\pi x^2)$ if $x \neq 0$, and $0$ if $x = 0$. This is the derivative of sinc(x).

Return a T(NaN) if isnan(x).

See also sinc.

source
Base.Math.deg2radFunction
deg2rad(x)

Convert x from degrees to radians.

See also rad2deg, sind, pi.

Examples

julia> deg2rad(90)
-1.5707963267948966
source
Base.Math.rad2degFunction
rad2deg(x)

Convert x from radians to degrees.

See also deg2rad.

Examples

julia> rad2deg(pi)
-180.0
source
Base.Math.hypotFunction
hypot(x, y)

Compute the hypotenuse $\sqrt{|x|^2+|y|^2}$ avoiding overflow and underflow.

This code is an implementation of the algorithm described in: An Improved Algorithm for hypot(a,b) by Carlos F. Borges The article is available online at arXiv at the link https://arxiv.org/abs/1904.09481

hypot(x...)

Compute the hypotenuse $\sqrt{\sum |x_i|^2}$ avoiding overflow and underflow.

See also norm in the LinearAlgebra standard library.

Examples

julia> a = Int64(10)^10;
+atand(y::AbstractMatrix{T}) where T -> AbstractMatrix{Complex{float(T)}}

Compute the inverse tangent of y or y/x, respectively, where the output is in degrees.

Return a NaN if isnan(y) or isnan(x). The returned NaN is either a T in the single argument version, or a promote_type(T,S) in the two argument version.

Julia 1.7

The one-argument method supports square matrix arguments as of Julia 1.7.

source
Base.Math.secMethod
sec(x::T) where {T <: Number} -> float(T)

Compute the secant of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cscMethod
csc(x::T) where {T <: Number} -> float(T)

Compute the cosecant of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cotMethod
cot(x::T) where {T <: Number} -> float(T)

Compute the cotangent of x, where x is in radians.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.secdFunction
secd(x::T) where {T <: Number} -> float(T)

Compute the secant of x, where x is in degrees.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cscdFunction
cscd(x::T) where {T <: Number} -> float(T)

Compute the cosecant of x, where x is in degrees.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.cotdFunction
cotd(x::T) where {T <: Number} -> float(T)

Compute the cotangent of x, where x is in degrees.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

source
Base.Math.asecMethod
asec(x::T) where {T <: Number} -> float(T)

Compute the inverse secant of x, where the output is in radians.

source
Base.Math.acscMethod
acsc(x::T) where {T <: Number} -> float(T)

Compute the inverse cosecant of x, where the output is in radians.

source
Base.Math.acotMethod
acot(x::T) where {T <: Number} -> float(T)

Compute the inverse cotangent of x, where the output is in radians.

source
Base.Math.asecdFunction
asecd(x)

Compute the inverse secant of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.acscdFunction
acscd(x)

Compute the inverse cosecant of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.acotdFunction
acotd(x)

Compute the inverse cotangent of x, where the output is in degrees. If x is a matrix, x needs to be a square matrix.

Julia 1.7

Matrix arguments require Julia 1.7 or later.

source
Base.Math.sechMethod
sech(x::T) where {T <: Number} -> float(T)

Compute the hyperbolic secant of x.

Return a T(NaN) if isnan(x).

source
Base.Math.cschMethod
csch(x::T) where {T <: Number} -> float(T)

Compute the hyperbolic cosecant of x.

Return a T(NaN) if isnan(x).

source
Base.Math.cothMethod
coth(x::T) where {T <: Number} -> float(T)

Compute the hyperbolic cotangent of x.

Return a T(NaN) if isnan(x).

source
Base.asinhMethod
asinh(x)

Compute the inverse hyperbolic sine of x.

source
Base.acoshMethod
acosh(x)

Compute the inverse hyperbolic cosine of x.

source
Base.atanhMethod
atanh(x)

Compute the inverse hyperbolic tangent of x.

source
Base.Math.asechMethod
asech(x::T) where {T <: Number} -> float(T)

Compute the inverse hyperbolic secant of x.

source
Base.Math.acschMethod
acsch(x::T) where {T <: Number} -> float(T)

Compute the inverse hyperbolic cosecant of x.

source
Base.Math.acothMethod
acoth(x::T) where {T <: Number} -> float(T)

Compute the inverse hyperbolic cotangent of x.

source
Base.Math.sincFunction
sinc(x::T) where {T <: Number} -> float(T)

Compute normalized sinc function $\operatorname{sinc}(x) = \sin(\pi x) / (\pi x)$ if $x \neq 0$, and $1$ if $x = 0$.

Return a T(NaN) if isnan(x).

See also cosc, its derivative.

source
Base.Math.coscFunction
cosc(x::T) where {T <: Number} -> float(T)

Compute $\cos(\pi x) / x - \sin(\pi x) / (\pi x^2)$ if $x \neq 0$, and $0$ if $x = 0$. This is the derivative of sinc(x).

Return a T(NaN) if isnan(x).

See also sinc.

source
Base.Math.deg2radFunction
deg2rad(x)

Convert x from degrees to radians.

See also rad2deg, sind, pi.

Examples

julia> deg2rad(90)
+1.5707963267948966
source
Base.Math.rad2degFunction
rad2deg(x)

Convert x from radians to degrees.

See also deg2rad.

Examples

julia> rad2deg(pi)
+180.0
source
Base.Math.hypotFunction
hypot(x, y)

Compute the hypotenuse $\sqrt{|x|^2+|y|^2}$ avoiding overflow and underflow.

This code is an implementation of the algorithm described in: An Improved Algorithm for hypot(a,b) by Carlos F. Borges The article is available online at arXiv at the link https://arxiv.org/abs/1904.09481

hypot(x...)

Compute the hypotenuse $\sqrt{\sum |x_i|^2}$ avoiding overflow and underflow.

See also norm in the LinearAlgebra standard library.

Examples

julia> a = Int64(10)^10;
 
 julia> hypot(a, a)
 1.4142135623730951e10
@@ -735,7 +735,7 @@
 julia> using LinearAlgebra
 
 julia> norm([a, a, a, a]) == hypot(a, a, a, a)
-true
source
Base.logMethod
log(x)

Compute the natural logarithm of x.

Throw a DomainError for negative Real arguments. Use Complex arguments to obtain Complex results.

Branch cut

log has a branch cut along the negative real axis; -0.0im is taken to be below the axis.

See also , log1p, log2, log10.

Examples

julia> log(2)
+true
source
Base.logMethod
log(x)

Compute the natural logarithm of x.

Throw a DomainError for negative Real arguments. Use Complex arguments to obtain Complex results.

Branch cut

log has a branch cut along the negative real axis; -0.0im is taken to be below the axis.

See also , log1p, log2, log10.

Examples

julia> log(2)
 0.6931471805599453
 
 julia> log(-3)
@@ -755,7 +755,7 @@
 3-element Vector{Float64}:
  -1.0
   0.0
-  1.0
source
Base.logMethod
log(b,x)

Compute the base b logarithm of x. Throw a DomainError for negative Real arguments.

Examples

julia> log(4,8)
+  1.0
source
Base.logMethod
log(b,x)

Compute the base b logarithm of x. Throw a DomainError for negative Real arguments.

Examples

julia> log(4,8)
 1.5
 
 julia> log(4,2)
@@ -777,7 +777,7 @@
 2.9999999999999996
 
 julia> log10(1000000)/2
-3.0
source
Base.log2Function
log2(x)

Compute the logarithm of x to base 2. Throw a DomainError for negative Real arguments.

See also: exp2, ldexp, ispow2.

Examples

julia> log2(4)
+3.0
source
Base.log2Function
log2(x)

Compute the logarithm of x to base 2. Throw a DomainError for negative Real arguments.

See also: exp2, ldexp, ispow2.

Examples

julia> log2(4)
 2.0
 
 julia> log2(10)
@@ -794,7 +794,7 @@
 3-element Vector{Float64}:
  -1.0
   0.0
-  1.0
source
Base.log10Function
log10(x)

Compute the logarithm of x to base 10. Throw a DomainError for negative Real arguments.

Examples

julia> log10(100)
+  1.0
source
Base.log10Function
log10(x)

Compute the logarithm of x to base 10. Throw a DomainError for negative Real arguments.

Examples

julia> log10(100)
 2.0
 
 julia> log10(2)
@@ -805,7 +805,7 @@
 log10 was called with a negative real argument but will only return a complex result if called with a complex argument. Try log10(Complex(x)).
 Stacktrace:
  [1] throw_complex_domainerror(f::Symbol, x::Float64) at ./math.jl:31
-[...]
source
Base.log1pFunction
log1p(x)

Accurate natural logarithm of 1+x. Throw a DomainError for Real arguments less than -1.

Examples

julia> log1p(-0.5)
+[...]
source
Base.log1pFunction
log1p(x)

Accurate natural logarithm of 1+x. Throw a DomainError for Real arguments less than -1.

Examples

julia> log1p(-0.5)
 -0.6931471805599453
 
 julia> log1p(0)
@@ -816,38 +816,38 @@
 log1p was called with a real argument < -1 but will only return a complex result if called with a complex argument. Try log1p(Complex(x)).
 Stacktrace:
  [1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
-[...]
source
Base.Math.frexpFunction
frexp(val)

Return (x,exp) such that x has a magnitude in the interval $[1/2, 1)$ or 0, and val is equal to $x \times 2^{exp}$.

See also significand, exponent, ldexp.

Examples

julia> frexp(6.0)
+[...]
source
Base.Math.frexpFunction
frexp(val)

Return (x,exp) such that x has a magnitude in the interval $[1/2, 1)$ or 0, and val is equal to $x \times 2^{exp}$.

See also significand, exponent, ldexp.

Examples

julia> frexp(6.0)
 (0.75, 3)
 
 julia> significand(6.0), exponent(6.0)  # interval [1, 2) instead
 (1.5, 2)
 
 julia> frexp(0.0), frexp(NaN), frexp(-Inf)  # exponent would give an error
-((0.0, 0), (NaN, 0), (-Inf, 0))
source
Base.expMethod
exp(x)

Compute the natural base exponential of x, in other words $ℯ^x$.

See also exp2, exp10 and cis.

Examples

julia> exp(1.0)
+((0.0, 0), (NaN, 0), (-Inf, 0))
source
Base.expMethod
exp(x)

Compute the natural base exponential of x, in other words $ℯ^x$.

See also exp2, exp10 and cis.

Examples

julia> exp(1.0)
 2.718281828459045
 
 julia> exp(im * pi) ≈ cis(pi)
-true
source
Base.exp2Function
exp2(x)

Compute the base 2 exponential of x, in other words $2^x$.

See also ldexp, <<.

Examples

julia> exp2(5)
+true
source
Base.exp2Function
exp2(x)

Compute the base 2 exponential of x, in other words $2^x$.

See also ldexp, <<.

Examples

julia> exp2(5)
 32.0
 
 julia> 2^5
 32
 
 julia> exp2(63) > typemax(Int)
-true
source
Base.exp10Function
exp10(x)

Compute the base 10 exponential of x, in other words $10^x$.

Examples

julia> exp10(2)
+true
source
Base.exp10Function
exp10(x)

Compute the base 10 exponential of x, in other words $10^x$.

Examples

julia> exp10(2)
 100.0
 
 julia> 10^2
-100
source
Base.Math.ldexpFunction
ldexp(x, n)

Compute $x \times 2^n$.

See also frexp, exponent.

Examples

julia> ldexp(5.0, 2)
-20.0
source
Base.Math.modfFunction
modf(x)

Return a tuple (fpart, ipart) of the fractional and integral parts of a number. Both parts have the same sign as the argument.

Examples

julia> modf(3.5)
+100
source
Base.Math.ldexpFunction
ldexp(x, n)

Compute $x \times 2^n$.

See also frexp, exponent.

Examples

julia> ldexp(5.0, 2)
+20.0
source
Base.Math.modfFunction
modf(x)

Return a tuple (fpart, ipart) of the fractional and integral parts of a number. Both parts have the same sign as the argument.

Examples

julia> modf(3.5)
 (0.5, 3.0)
 
 julia> modf(-3.5)
-(-0.5, -3.0)
source
Base.expm1Function
expm1(x)

Accurately compute $e^x-1$. It avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small values of x.

Examples

julia> expm1(1e-16)
+(-0.5, -3.0)
source
Base.expm1Function
expm1(x)

Accurately compute $e^x-1$. It avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small values of x.

Examples

julia> expm1(1e-16)
 1.0e-16
 
 julia> exp(1e-16) - 1
-0.0
source
Base.roundFunction
round([T,] x, [r::RoundingMode])
+0.0
source
Base.roundFunction
round([T,] x, [r::RoundingMode])
 round(x, [r::RoundingMode]; digits::Integer=0, base = 10)
 round(x, [r::RoundingMode]; sigdigits::Integer, base = 10)

Rounds the number x.

Without keyword arguments, x is rounded to an integer value, returning a value of type T, or of the same type of x if no T is provided. An InexactError will be thrown if the value is not representable by T, similar to convert.

If the digits keyword argument is provided, it rounds to the specified number of digits after the decimal place (or before if negative), in base base.

If the sigdigits keyword argument is provided, it rounds to the specified number of significant digits, in base base.

The RoundingMode r controls the direction of the rounding; the default is RoundNearest, which rounds to the nearest integer, with ties (fractional values of 0.5) being rounded to the nearest even integer. Note that round may give incorrect results if the global rounding mode is changed (see rounding).

When rounding to a floating point type, will round to integers representable by that type (and Inf) rather than true integers. Inf is treated as one ulp greater than the floatmax(T) for purposes of determining "nearest", similar to convert.

Examples

julia> round(1.7)
 2.0
@@ -887,8 +887,8 @@
 true
 
 julia> round(x, digits=1)
-1.2

Extensions

To extend round to new numeric types, it is typically sufficient to define Base.round(x::NewType, r::RoundingMode).

source
Base.Rounding.RoundingModeType
RoundingMode

A type used for controlling the rounding mode of floating point operations (via rounding/setrounding functions), or as optional arguments for rounding to the nearest integer (via the round function).

Currently supported rounding modes are:

Julia 1.9

RoundFromZero requires at least Julia 1.9. Prior versions support RoundFromZero for BigFloats only.

source
Base.Rounding.RoundNearestConstant
RoundNearest

The default rounding mode. Rounds to the nearest integer, with ties (fractional values of 0.5) being rounded to the nearest even integer.

source
Base.Rounding.RoundNearestTiesAwayConstant
RoundNearestTiesAway

Rounds to nearest integer, with ties rounded away from zero (C/C++ round behaviour).

source
Base.Rounding.RoundNearestTiesUpConstant
RoundNearestTiesUp

Rounds to nearest integer, with ties rounded toward positive infinity (Java/JavaScript round behaviour).

source
Base.Rounding.RoundToZeroConstant
RoundToZero

round using this rounding mode is an alias for trunc.

source
Base.Rounding.RoundFromZeroConstant
RoundFromZero

Rounds away from zero.

Julia 1.9

RoundFromZero requires at least Julia 1.9. Prior versions support RoundFromZero for BigFloats only.

Examples

julia> BigFloat("1.0000000000000001", 5, RoundFromZero)
-1.06
source
Base.Rounding.RoundUpConstant
RoundUp

round using this rounding mode is an alias for ceil.

source
Base.Rounding.RoundDownConstant
RoundDown

round using this rounding mode is an alias for floor.

source
Base.roundMethod
round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]])
+1.2

Extensions

To extend round to new numeric types, it is typically sufficient to define Base.round(x::NewType, r::RoundingMode).

source
Base.Rounding.RoundingModeType
RoundingMode

A type used for controlling the rounding mode of floating point operations (via rounding/setrounding functions), or as optional arguments for rounding to the nearest integer (via the round function).

Currently supported rounding modes are:

Julia 1.9

RoundFromZero requires at least Julia 1.9. Prior versions support RoundFromZero for BigFloats only.

source
Base.Rounding.RoundNearestConstant
RoundNearest

The default rounding mode. Rounds to the nearest integer, with ties (fractional values of 0.5) being rounded to the nearest even integer.

source
Base.Rounding.RoundNearestTiesAwayConstant
RoundNearestTiesAway

Rounds to nearest integer, with ties rounded away from zero (C/C++ round behaviour).

source
Base.Rounding.RoundNearestTiesUpConstant
RoundNearestTiesUp

Rounds to nearest integer, with ties rounded toward positive infinity (Java/JavaScript round behaviour).

source
Base.Rounding.RoundToZeroConstant
RoundToZero

round using this rounding mode is an alias for trunc.

source
Base.Rounding.RoundFromZeroConstant
RoundFromZero

Rounds away from zero.

Julia 1.9

RoundFromZero requires at least Julia 1.9. Prior versions support RoundFromZero for BigFloats only.

Examples

julia> BigFloat("1.0000000000000001", 5, RoundFromZero)
+1.06
source
Base.Rounding.RoundUpConstant
RoundUp

round using this rounding mode is an alias for ceil.

source
Base.Rounding.RoundDownConstant
RoundDown

round using this rounding mode is an alias for floor.

source
Base.roundMethod
round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]])
 round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]]; digits=0, base=10)
 round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]]; sigdigits, base=10)

Return the nearest integral value of the same type as the complex-valued z to z, breaking ties using the specified RoundingModes. The first RoundingMode is used for rounding the real components while the second is used for rounding the imaginary components.

RoundingModeReal and RoundingModeImaginary default to RoundNearest, which rounds to the nearest integer, with ties (fractional values of 0.5) being rounded to the nearest even integer.

Examples

julia> round(3.14 + 4.5im)
 3.0 + 4.0im
@@ -900,11 +900,11 @@
 3.1 + 4.5im
 
 julia> round(3.14159 + 4.512im; sigdigits = 3)
-3.14 + 4.51im
source
Base.ceilFunction
ceil([T,] x)
+3.14 + 4.51im
source
Base.ceilFunction
ceil([T,] x)
 ceil(x; digits::Integer= [, base = 10])
-ceil(x; sigdigits::Integer= [, base = 10])

ceil(x) returns the nearest integral value of the same type as x that is greater than or equal to x.

ceil(T, x) converts the result to type T, throwing an InexactError if the ceiled value is not representable as a T.

Keywords digits, sigdigits and base work as for round.

To support ceil for a new type, define Base.round(x::NewType, ::RoundingMode{:Up}).

source
Base.floorFunction
floor([T,] x)
+ceil(x; sigdigits::Integer= [, base = 10])

ceil(x) returns the nearest integral value of the same type as x that is greater than or equal to x.

ceil(T, x) converts the result to type T, throwing an InexactError if the ceiled value is not representable as a T.

Keywords digits, sigdigits and base work as for round.

To support ceil for a new type, define Base.round(x::NewType, ::RoundingMode{:Up}).

source
Base.floorFunction
floor([T,] x)
 floor(x; digits::Integer= [, base = 10])
-floor(x; sigdigits::Integer= [, base = 10])

floor(x) returns the nearest integral value of the same type as x that is less than or equal to x.

floor(T, x) converts the result to type T, throwing an InexactError if the floored value is not representable a T.

Keywords digits, sigdigits and base work as for round.

To support floor for a new type, define Base.round(x::NewType, ::RoundingMode{:Down}).

source
Base.truncFunction
trunc([T,] x)
+floor(x; sigdigits::Integer= [, base = 10])

floor(x) returns the nearest integral value of the same type as x that is less than or equal to x.

floor(T, x) converts the result to type T, throwing an InexactError if the floored value is not representable a T.

Keywords digits, sigdigits and base work as for round.

To support floor for a new type, define Base.round(x::NewType, ::RoundingMode{:Down}).

source
Base.truncFunction
trunc([T,] x)
 trunc(x; digits::Integer= [, base = 10])
 trunc(x; sigdigits::Integer= [, base = 10])

trunc(x) returns the nearest integral value of the same type as x whose absolute value is less than or equal to the absolute value of x.

trunc(T, x) converts the result to type T, throwing an InexactError if the truncated value is not representable a T.

Keywords digits, sigdigits and base work as for round.

To support trunc for a new type, define Base.round(x::NewType, ::RoundingMode{:ToZero}).

See also: %, floor, unsigned, unsafe_trunc.

Examples

julia> trunc(2.22)
 2.0
@@ -913,27 +913,27 @@
 -2.2
 
 julia> trunc(Int, -2.22)
--2
source
Base.unsafe_truncFunction
unsafe_trunc(T, x)

Return the nearest integral value of type T whose absolute value is less than or equal to the absolute value of x. If the value is not representable by T, an arbitrary value will be returned. See also trunc.

Examples

julia> unsafe_trunc(Int, -2.2)
+-2
source
Base.unsafe_truncFunction
unsafe_trunc(T, x)

Return the nearest integral value of type T whose absolute value is less than or equal to the absolute value of x. If the value is not representable by T, an arbitrary value will be returned. See also trunc.

Examples

julia> unsafe_trunc(Int, -2.2)
 -2
 
 julia> unsafe_trunc(Int, NaN)
--9223372036854775808
source
Base.minFunction
min(x, y, ...)

Return the minimum of the arguments, with respect to isless. If any of the arguments is missing, return missing. See also the minimum function to take the minimum element from a collection.

Examples

julia> min(2, 5, 1)
+-9223372036854775808
source
Base.minFunction
min(x, y, ...)

Return the minimum of the arguments, with respect to isless. If any of the arguments is missing, return missing. See also the minimum function to take the minimum element from a collection.

Examples

julia> min(2, 5, 1)
 1
 
 julia> min(4, missing, 6)
-missing
source
Base.maxFunction
max(x, y, ...)

Return the maximum of the arguments, with respect to isless. If any of the arguments is missing, return missing. See also the maximum function to take the maximum element from a collection.

Examples

julia> max(2, 5, 1)
+missing
source
Base.maxFunction
max(x, y, ...)

Return the maximum of the arguments, with respect to isless. If any of the arguments is missing, return missing. See also the maximum function to take the maximum element from a collection.

Examples

julia> max(2, 5, 1)
 5
 
 julia> max(5, missing, 6)
-missing
source
Base.minmaxFunction
minmax(x, y)

Return (min(x,y), max(x,y)).

See also extrema that returns (minimum(x), maximum(x)).

Examples

julia> minmax('c','b')
-('b', 'c')
source
Base.clampFunction
clamp(x::Integer, r::AbstractUnitRange)

Clamp x to lie within range r.

Julia 1.6

This method requires at least Julia 1.6.

source
clamp(x, T)::T

Clamp x between typemin(T) and typemax(T) and convert the result to type T.

See also trunc.

Examples

julia> clamp(200, Int8)
+missing
source
Base.minmaxFunction
minmax(x, y)

Return (min(x,y), max(x,y)).

See also extrema that returns (minimum(x), maximum(x)).

Examples

julia> minmax('c','b')
+('b', 'c')
source
Base.clampFunction
clamp(x::Integer, r::AbstractUnitRange)

Clamp x to lie within range r.

Julia 1.6

This method requires at least Julia 1.6.

source
clamp(x, T)::T

Clamp x between typemin(T) and typemax(T) and convert the result to type T.

See also trunc.

Examples

julia> clamp(200, Int8)
 127
 
 julia> clamp(-200, Int8)
 -128
 
 julia> trunc(Int, 4pi^2)
-39
source
clamp(x, lo, hi)

Return x if lo <= x <= hi. If x > hi, return hi. If x < lo, return lo. Arguments are promoted to a common type.

See also clamp!, min, max.

Julia 1.3

missing as the first argument requires at least Julia 1.3.

Examples

julia> clamp.([pi, 1.0, big(10)], 2.0, 9.0)
+39
source
clamp(x, lo, hi)

Return x if lo <= x <= hi. If x > hi, return hi. If x < lo, return lo. Arguments are promoted to a common type.

See also clamp!, min, max.

Julia 1.3

missing as the first argument requires at least Julia 1.3.

Examples

julia> clamp.([pi, 1.0, big(10)], 2.0, 9.0)
 3-element Vector{BigFloat}:
  3.141592653589793238462643383279502884197169399375105820974944592307816406286198
  2.0
@@ -943,7 +943,7 @@
 3-element Vector{Int64}:
   6
   6
- 10
source
Base.clamp!Function
clamp!(array::AbstractArray, lo, hi)

Restrict values in array to the specified range, in-place. See also clamp.

Julia 1.3

missing entries in array require at least Julia 1.3.

Examples

julia> row = collect(-4:4)';
+ 10
source
Base.clamp!Function
clamp!(array::AbstractArray, lo, hi)

Restrict values in array to the specified range, in-place. See also clamp.

Julia 1.3

missing entries in array require at least Julia 1.3.

Examples

julia> row = collect(-4:4)';
 
 julia> clamp!(row, 0, Inf)
 1×9 adjoint(::Vector{Int64}) with eltype Int64:
@@ -951,7 +951,7 @@
 
 julia> clamp.((-4:4)', 0, Inf)
 1×9 Matrix{Float64}:
- 0.0  0.0  0.0  0.0  0.0  1.0  2.0  3.0  4.0
source
Base.absFunction
abs(x)

The absolute value of x.

When abs is applied to signed integers, overflow may occur, resulting in the return of a negative value. This overflow occurs only when abs is applied to the minimum representable value of a signed integer. That is, when x == typemin(typeof(x)), abs(x) == x < 0, not -x as might be expected.

See also: abs2, unsigned, sign.

Examples

julia> abs(-3)
+ 0.0  0.0  0.0  0.0  0.0  1.0  2.0  3.0  4.0
source
Base.absFunction
abs(x)

The absolute value of x.

When abs is applied to signed integers, overflow may occur, resulting in the return of a negative value. This overflow occurs only when abs is applied to the minimum representable value of a signed integer. That is, when x == typemin(typeof(x)), abs(x) == x < 0, not -x as might be expected.

See also: abs2, unsigned, sign.

Examples

julia> abs(-3)
 3
 
 julia> abs(1 + im)
@@ -962,18 +962,18 @@
  -128  127  126  0  126  127
 
 julia> maximum(abs, [1, -2, 3, -4])
-4
source
Base.CheckedModule
Checked

The Checked module provides arithmetic functions for the built-in signed and unsigned Integer types which throw an error when an overflow occurs. They are named like checked_sub, checked_div, etc. In addition, add_with_overflow, sub_with_overflow, mul_with_overflow return both the unchecked results and a boolean value denoting the presence of an overflow.

source
Base.Checked.checked_absFunction
Base.checked_abs(x)

Calculates abs(x), checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. Int) cannot represent abs(typemin(Int)), thus leading to an overflow.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_negFunction
Base.checked_neg(x)

Calculates -x, checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. Int) cannot represent -typemin(Int), thus leading to an overflow.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_addFunction
Base.checked_add(x, y)

Calculates x+y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_subFunction
Base.checked_sub(x, y)

Calculates x-y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_mulFunction
Base.checked_mul(x, y)

Calculates x*y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_divFunction
Base.checked_div(x, y)

Calculates div(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_remFunction
Base.checked_rem(x, y)

Calculates x%y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_fldFunction
Base.checked_fld(x, y)

Calculates fld(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_modFunction
Base.checked_mod(x, y)

Calculates mod(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_cldFunction
Base.checked_cld(x, y)

Calculates cld(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_powFunction
Base.checked_pow(x, y)

Calculates ^(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.add_with_overflowFunction
Base.add_with_overflow(x, y) -> (r, f)

Calculates r = x+y, with the flag f indicating whether overflow has occurred.

source
Base.Checked.sub_with_overflowFunction
Base.sub_with_overflow(x, y) -> (r, f)

Calculates r = x-y, with the flag f indicating whether overflow has occurred.

source
Base.Checked.mul_with_overflowFunction
Base.mul_with_overflow(x, y) -> (r, f)

Calculates r = x*y, with the flag f indicating whether overflow has occurred.

source
Base.abs2Function
abs2(x)

Squared absolute value of x.

This can be faster than abs(x)^2, especially for complex numbers where abs(x) requires a square root via hypot.

See also abs, conj, real.

Examples

julia> abs2(-3)
+4
source
Base.CheckedModule
Checked

The Checked module provides arithmetic functions for the built-in signed and unsigned Integer types which throw an error when an overflow occurs. They are named like checked_sub, checked_div, etc. In addition, add_with_overflow, sub_with_overflow, mul_with_overflow return both the unchecked results and a boolean value denoting the presence of an overflow.

source
Base.Checked.checked_absFunction
Base.checked_abs(x)

Calculates abs(x), checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. Int) cannot represent abs(typemin(Int)), thus leading to an overflow.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_negFunction
Base.checked_neg(x)

Calculates -x, checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. Int) cannot represent -typemin(Int), thus leading to an overflow.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_addFunction
Base.checked_add(x, y)

Calculates x+y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_subFunction
Base.checked_sub(x, y)

Calculates x-y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_mulFunction
Base.checked_mul(x, y)

Calculates x*y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_divFunction
Base.checked_div(x, y)

Calculates div(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_remFunction
Base.checked_rem(x, y)

Calculates x%y, checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_fldFunction
Base.checked_fld(x, y)

Calculates fld(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_modFunction
Base.checked_mod(x, y)

Calculates mod(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_cldFunction
Base.checked_cld(x, y)

Calculates cld(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.checked_powFunction
Base.checked_pow(x, y)

Calculates ^(x,y), checking for overflow errors where applicable.

The overflow protection may impose a perceptible performance penalty.

source
Base.Checked.add_with_overflowFunction
Base.add_with_overflow(x, y) -> (r, f)

Calculates r = x+y, with the flag f indicating whether overflow has occurred.

source
Base.Checked.sub_with_overflowFunction
Base.sub_with_overflow(x, y) -> (r, f)

Calculates r = x-y, with the flag f indicating whether overflow has occurred.

source
Base.Checked.mul_with_overflowFunction
Base.mul_with_overflow(x, y) -> (r, f)

Calculates r = x*y, with the flag f indicating whether overflow has occurred.

source
Base.abs2Function
abs2(x)

Squared absolute value of x.

This can be faster than abs(x)^2, especially for complex numbers where abs(x) requires a square root via hypot.

See also abs, conj, real.

Examples

julia> abs2(-3)
 9
 
 julia> abs2(3.0 + 4.0im)
 25.0
 
 julia> sum(abs2, [1+2im, 3+4im])  # LinearAlgebra.norm(x)^2
-30
source
Base.copysignFunction
copysign(x, y) -> z

Return z which has the magnitude of x and the same sign as y.

Examples

julia> copysign(1, -2)
+30
source
Base.copysignFunction
copysign(x, y) -> z

Return z which has the magnitude of x and the same sign as y.

Examples

julia> copysign(1, -2)
 -1
 
 julia> copysign(-1, 2)
-1
source
Base.signFunction
sign(x)

Return zero if x==0 and $x/|x|$ otherwise (i.e., ±1 for real x).

See also signbit, zero, copysign, flipsign.

Examples

julia> sign(-4.0)
+1
source
Base.signFunction
sign(x)

Return zero if x==0 and $x/|x|$ otherwise (i.e., ±1 for real x).

See also signbit, zero, copysign, flipsign.

Examples

julia> sign(-4.0)
 -1.0
 
 julia> sign(99)
@@ -983,7 +983,7 @@
 -0.0
 
 julia> sign(0 + im)
-0.0 + 1.0im
source
Base.signbitFunction
signbit(x)

Return true if the value of the sign of x is negative, otherwise false.

See also sign and copysign.

Examples

julia> signbit(-4)
+0.0 + 1.0im
source
Base.signbitFunction
signbit(x)

Return true if the value of the sign of x is negative, otherwise false.

See also sign and copysign.

Examples

julia> signbit(-4)
 true
 
 julia> signbit(5)
@@ -993,11 +993,11 @@
 false
 
 julia> signbit(-4.1)
-true
source
Base.flipsignFunction
flipsign(x, y)

Return x with its sign flipped if y is negative. For example abs(x) = flipsign(x,x).

Examples

julia> flipsign(5, 3)
+true
source
Base.flipsignFunction
flipsign(x, y)

Return x with its sign flipped if y is negative. For example abs(x) = flipsign(x,x).

Examples

julia> flipsign(5, 3)
 5
 
 julia> flipsign(5, -3)
--5
source
Base.sqrtMethod
sqrt(x)

Return $\sqrt{x}$.

Throw a DomainError for negative Real arguments. Use Complex negative arguments instead to obtain a Complex result.

The prefix operator is equivalent to sqrt.

Branch cut

sqrt has a branch cut along the negative real axis; -0.0im is taken to be below the axis.

See also: hypot.

Examples

julia> sqrt(big(81))
+-5
source
Base.sqrtMethod
sqrt(x)

Return $\sqrt{x}$.

Throw a DomainError for negative Real arguments. Use Complex negative arguments instead to obtain a Complex result.

The prefix operator is equivalent to sqrt.

Branch cut

sqrt has a branch cut along the negative real axis; -0.0im is taken to be below the axis.

See also: hypot.

Examples

julia> sqrt(big(81))
 9.0
 
 julia> sqrt(big(-81))
@@ -1018,12 +1018,12 @@
  1.0
  1.4142135623730951
  1.7320508075688772
- 2.0
source
Base.isqrtFunction
isqrt(n::Integer)

Integer square root: the largest integer m such that m*m <= n.

julia> isqrt(5)
-2
source
Base.Math.cbrtMethod
cbrt(x::Real)

Return the cube root of x, i.e. $x^{1/3}$. Negative values are accepted (returning the negative real root when $x < 0$).

The prefix operator is equivalent to cbrt.

Examples

julia> cbrt(big(27))
+ 2.0
source
Base.isqrtFunction
isqrt(n::Integer)

Integer square root: the largest integer m such that m*m <= n.

julia> isqrt(5)
+2
source
Base.Math.cbrtMethod
cbrt(x::Real)

Return the cube root of x, i.e. $x^{1/3}$. Negative values are accepted (returning the negative real root when $x < 0$).

The prefix operator is equivalent to cbrt.

Examples

julia> cbrt(big(27))
 3.0
 
 julia> cbrt(big(-27))
--3.0
source
Base.Math.fourthrootMethod
fourthroot(x)

Return the fourth root of x by applying sqrt twice successively.

source
Base.realFunction
real(A::AbstractArray)

Return an array containing the real part of each entry in array A.

Equivalent to real.(A), except that when eltype(A) <: Real A is returned without copying, and that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> real([1, 2im, 3 + 4im])
+-3.0
source
Base.Math.fourthrootMethod
fourthroot(x)

Return the fourth root of x by applying sqrt twice successively.

source
Base.realFunction
real(A::AbstractArray)

Return an array containing the real part of each entry in array A.

Equivalent to real.(A), except that when eltype(A) <: Real A is returned without copying, and that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> real([1, 2im, 3 + 4im])
 3-element Vector{Int64}:
  1
  0
@@ -1031,12 +1031,12 @@
 
 julia> real(fill(2 - im))
 0-dimensional Array{Int64, 0}:
-2
source
real(T::Type)

Return the type that represents the real part of a value of type T. e.g: for T == Complex{R}, returns R. Equivalent to typeof(real(zero(T))).

Examples

julia> real(Complex{Int})
+2
source
real(T::Type)

Return the type that represents the real part of a value of type T. e.g: for T == Complex{R}, returns R. Equivalent to typeof(real(zero(T))).

Examples

julia> real(Complex{Int})
 Int64
 
 julia> real(Float64)
-Float64
source
real(z)

Return the real part of the complex number z.

See also: imag, reim, complex, isreal, Real.

Examples

julia> real(1 + 3im)
-1
source
Base.imagFunction
imag(A::AbstractArray)

Return an array containing the imaginary part of each entry in array A.

Equivalent to imag.(A), except that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> imag([1, 2im, 3 + 4im])
+Float64
source
real(z)

Return the real part of the complex number z.

See also: imag, reim, complex, isreal, Real.

Examples

julia> real(1 + 3im)
+1
source
Base.imagFunction
imag(A::AbstractArray)

Return an array containing the imaginary part of each entry in array A.

Equivalent to imag.(A), except that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> imag([1, 2im, 3 + 4im])
 3-element Vector{Int64}:
  0
  2
@@ -1044,13 +1044,13 @@
 
 julia> imag(fill(2 - im))
 0-dimensional Array{Int64, 0}:
--1
source
imag(z)

Return the imaginary part of the complex number z.

See also: conj, reim, adjoint, angle.

Examples

julia> imag(1 + 3im)
-3
source
Base.reimFunction
reim(A::AbstractArray)

Return a tuple of two arrays containing respectively the real and the imaginary part of each entry in A.

Equivalent to (real.(A), imag.(A)), except that when eltype(A) <: Real A is returned without copying to represent the real part, and that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> reim([1, 2im, 3 + 4im])
+-1
source
imag(z)

Return the imaginary part of the complex number z.

See also: conj, reim, adjoint, angle.

Examples

julia> imag(1 + 3im)
+3
source
Base.reimFunction
reim(A::AbstractArray)

Return a tuple of two arrays containing respectively the real and the imaginary part of each entry in A.

Equivalent to (real.(A), imag.(A)), except that when eltype(A) <: Real A is returned without copying to represent the real part, and that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> reim([1, 2im, 3 + 4im])
 ([1, 0, 3], [0, 2, 4])
 
 julia> reim(fill(2 - im))
-(fill(2), fill(-1))
source
reim(z)

Return a tuple of the real and imaginary parts of the complex number z.

Examples

julia> reim(1 + 3im)
-(1, 3)
source
Base.conjFunction
conj(A::AbstractArray)

Return an array containing the complex conjugate of each entry in array A.

Equivalent to conj.(A), except that when eltype(A) <: Real A is returned without copying, and that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> conj([1, 2im, 3 + 4im])
+(fill(2), fill(-1))
source
reim(z)

Return a tuple of the real and imaginary parts of the complex number z.

Examples

julia> reim(1 + 3im)
+(1, 3)
source
Base.conjFunction
conj(A::AbstractArray)

Return an array containing the complex conjugate of each entry in array A.

Equivalent to conj.(A), except that when eltype(A) <: Real A is returned without copying, and that when A has zero dimensions, a 0-dimensional array is returned (rather than a scalar).

Examples

julia> conj([1, 2im, 3 + 4im])
 3-element Vector{Complex{Int64}}:
  1 + 0im
  0 - 2im
@@ -1058,8 +1058,8 @@
 
 julia> conj(fill(2 - im))
 0-dimensional Array{Complex{Int64}, 0}:
-2 + 1im
source
conj(z)

Compute the complex conjugate of a complex number z.

See also: angle, adjoint.

Examples

julia> conj(1 + 3im)
-1 - 3im
source
Base.angleFunction
angle(z)

Compute the phase angle in radians of a complex number z.

Returns a number -pi ≤ angle(z) ≤ pi, and is thus discontinuous along the negative real axis.

See also: atan, cis, rad2deg.

Examples

julia> rad2deg(angle(1 + im))
+2 + 1im
source
conj(z)

Compute the complex conjugate of a complex number z.

See also: angle, adjoint.

Examples

julia> conj(1 + 3im)
+1 - 3im
source
Base.angleFunction
angle(z)

Compute the phase angle in radians of a complex number z.

Returns a number -pi ≤ angle(z) ≤ pi, and is thus discontinuous along the negative real axis.

See also: atan, cis, rad2deg.

Examples

julia> rad2deg(angle(1 + im))
 45.0
 
 julia> rad2deg(angle(1 - im))
@@ -1069,19 +1069,19 @@
 180.0
 
 julia> rad2deg(angle(-1 - 1e-20im))
--180.0
source
Base.cisFunction
cis(x)

More efficient method for exp(im*x) by using Euler's formula: $\cos(x) + i \sin(x) = \exp(i x)$.

See also cispi, sincos, exp, angle.

Examples

julia> cis(π) ≈ -1
-true
source
Base.cispiFunction
cispi(x)

More accurate method for cis(pi*x) (especially for large x).

See also cis, sincospi, exp, angle.

Examples

julia> cispi(10000)
+-180.0
source
Base.cisFunction
cis(x)

More efficient method for exp(im*x) by using Euler's formula: $\cos(x) + i \sin(x) = \exp(i x)$.

See also cispi, sincos, exp, angle.

Examples

julia> cis(π) ≈ -1
+true
source
Base.cispiFunction
cispi(x)

More accurate method for cis(pi*x) (especially for large x).

See also cis, sincospi, exp, angle.

Examples

julia> cispi(10000)
 1.0 + 0.0im
 
 julia> cispi(0.25 + 1im)
-0.030556854645954562 + 0.03055685464595456im
Julia 1.6

This function requires Julia 1.6 or later.

source
Base.binomialFunction
binomial(x::Number, k::Integer)

The generalized binomial coefficient, defined for k ≥ 0 by the polynomial

\[\frac{1}{k!} \prod_{j=0}^{k-1} (x - j)\]

When k < 0 it returns zero.

For the case of integer x, this is equivalent to the ordinary integer binomial coefficient

\[\binom{n}{k} = \frac{n!}{k! (n-k)!}\]

Further generalizations to non-integer k are mathematically possible, but involve the Gamma function and/or the beta function, which are not provided by the Julia standard library but are available in external packages such as SpecialFunctions.jl.

External links

source
binomial(n::Integer, k::Integer)

The binomial coefficient $\binom{n}{k}$, being the coefficient of the $k$th term in the polynomial expansion of $(1+x)^n$.

If $n$ is non-negative, then it is the number of ways to choose k out of n items:

\[\binom{n}{k} = \frac{n!}{k! (n-k)!}\]

where $n!$ is the factorial function.

If $n$ is negative, then it is defined in terms of the identity

\[\binom{n}{k} = (-1)^k \binom{k-n-1}{k}\]

See also factorial.

Examples

julia> binomial(5, 3)
+0.030556854645954562 + 0.03055685464595456im
Julia 1.6

This function requires Julia 1.6 or later.

source
Base.binomialFunction
binomial(x::Number, k::Integer)

The generalized binomial coefficient, defined for k ≥ 0 by the polynomial

\[\frac{1}{k!} \prod_{j=0}^{k-1} (x - j)\]

When k < 0 it returns zero.

For the case of integer x, this is equivalent to the ordinary integer binomial coefficient

\[\binom{n}{k} = \frac{n!}{k! (n-k)!}\]

Further generalizations to non-integer k are mathematically possible, but involve the Gamma function and/or the beta function, which are not provided by the Julia standard library but are available in external packages such as SpecialFunctions.jl.

External links

source
binomial(n::Integer, k::Integer)

The binomial coefficient $\binom{n}{k}$, being the coefficient of the $k$th term in the polynomial expansion of $(1+x)^n$.

If $n$ is non-negative, then it is the number of ways to choose k out of n items:

\[\binom{n}{k} = \frac{n!}{k! (n-k)!}\]

where $n!$ is the factorial function.

If $n$ is negative, then it is defined in terms of the identity

\[\binom{n}{k} = (-1)^k \binom{k-n-1}{k}\]

See also factorial.

Examples

julia> binomial(5, 3)
 10
 
 julia> factorial(5) ÷ (factorial(5-3) * factorial(3))
 10
 
 julia> binomial(-5, 3)
--35

External links

source
Base.factorialFunction
factorial(n::Integer)

Factorial of n. If n is an Integer, the factorial is computed as an integer (promoted to at least 64 bits). Note that this may overflow if n is not small, but you can use factorial(big(n)) to compute the result exactly in arbitrary precision.

See also binomial.

Examples

julia> factorial(6)
+-35

External links

source
Base.factorialFunction
factorial(n::Integer)

Factorial of n. If n is an Integer, the factorial is computed as an integer (promoted to at least 64 bits). Note that this may overflow if n is not small, but you can use factorial(big(n)) to compute the result exactly in arbitrary precision.

See also binomial.

Examples

julia> factorial(6)
 720
 
 julia> factorial(21)
@@ -1090,7 +1090,7 @@
 [...]
 
 julia> factorial(big(21))
-51090942171709440000

External links

source
Base.gcdFunction
gcd(x, y...)

Greatest common (positive) divisor (or zero if all arguments are zero). The arguments may be integer and rational numbers.

Julia 1.4

Rational arguments require Julia 1.4 or later.

Examples

julia> gcd(6, 9)
+51090942171709440000

External links

source
Base.gcdFunction
gcd(x, y...)

Greatest common (positive) divisor (or zero if all arguments are zero). The arguments may be integer and rational numbers.

Julia 1.4

Rational arguments require Julia 1.4 or later.

Examples

julia> gcd(6, 9)
 3
 
 julia> gcd(6, -9)
@@ -1112,7 +1112,7 @@
 1//3
 
 julia> gcd(0, 0, 10, 15)
-5
source
Base.lcmFunction
lcm(x, y...)

Least common (positive) multiple (or zero if any argument is zero). The arguments may be integer and rational numbers.

$a$ is a multiple of $b$ if there exists an integer $m$ such that $a=mb$.

Julia 1.4

Rational arguments require Julia 1.4 or later.

Examples

julia> lcm(2, 3)
+5
source
Base.lcmFunction
lcm(x, y...)

Least common (positive) multiple (or zero if any argument is zero). The arguments may be integer and rational numbers.

$a$ is a multiple of $b$ if there exists an integer $m$ such that $a=mb$.

Julia 1.4

Rational arguments require Julia 1.4 or later.

Examples

julia> lcm(2, 3)
 6
 
 julia> lcm(-2, 3)
@@ -1134,14 +1134,14 @@
 2//1
 
 julia> lcm(1, 3, 5, 7)
-105
source
Base.gcdxFunction
gcdx(a, b...)

Computes the greatest common (positive) divisor of a and b and their Bézout coefficients, i.e. the integer coefficients u and v that satisfy $u*a + v*b = d = gcd(a, b)$. $gcdx(a, b)$ returns $(d, u, v)$.

For more arguments than two, i.e., gcdx(a, b, c, ...) the Bézout coefficients are computed recursively, returning a solution (d, u, v, w, ...) to $u*a + v*b + w*c + ... = d = gcd(a, b, c, ...)$.

The arguments may be integer and rational numbers.

Julia 1.4

Rational arguments require Julia 1.4 or later.

Julia 1.12

More or fewer arguments than two require Julia 1.12 or later.

Examples

julia> gcdx(12, 42)
+105
source
Base.gcdxFunction
gcdx(a, b...)

Computes the greatest common (positive) divisor of a and b and their Bézout coefficients, i.e. the integer coefficients u and v that satisfy $u*a + v*b = d = gcd(a, b)$. $gcdx(a, b)$ returns $(d, u, v)$.

For more arguments than two, i.e., gcdx(a, b, c, ...) the Bézout coefficients are computed recursively, returning a solution (d, u, v, w, ...) to $u*a + v*b + w*c + ... = d = gcd(a, b, c, ...)$.

The arguments may be integer and rational numbers.

Julia 1.4

Rational arguments require Julia 1.4 or later.

Julia 1.12

More or fewer arguments than two require Julia 1.12 or later.

Examples

julia> gcdx(12, 42)
 (6, -3, 1)
 
 julia> gcdx(240, 46)
 (2, -9, 47)
 
 julia> gcdx(15, 12, 20)
-(1, 7, -7, -1)
Note

Bézout coefficients are not uniquely defined. gcdx returns the minimal Bézout coefficients that are computed by the extended Euclidean algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, Algorithm X.) For signed integers, these coefficients u and v are minimal in the sense that $|u| < |b/d|$ and $|v| < |a/d|$. Furthermore, the signs of u and v are chosen so that d is positive. For unsigned integers, the coefficients u and v might be near their typemax, and the identity then holds only via the unsigned integers' modulo arithmetic.

source
Base.ispow2Function
ispow2(n::Number) -> Bool

Test whether n is an integer power of two.

See also count_ones, prevpow, nextpow.

Examples

julia> ispow2(4)
+(1, 7, -7, -1)
Note

Bézout coefficients are not uniquely defined. gcdx returns the minimal Bézout coefficients that are computed by the extended Euclidean algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, Algorithm X.) For signed integers, these coefficients u and v are minimal in the sense that $|u| < |b/d|$ and $|v| < |a/d|$. Furthermore, the signs of u and v are chosen so that d is positive. For unsigned integers, the coefficients u and v might be near their typemax, and the identity then holds only via the unsigned integers' modulo arithmetic.

source
Base.ispow2Function
ispow2(n::Number) -> Bool

Test whether n is an integer power of two.

See also count_ones, prevpow, nextpow.

Examples

julia> ispow2(4)
 true
 
 julia> ispow2(5)
@@ -1154,7 +1154,7 @@
 true
 
 julia> ispow2(1//8)
-true
Julia 1.6

Support for non-Integer arguments was added in Julia 1.6.

source
Base.nextpowFunction
nextpow(a, x)

The smallest a^n not less than x, where n is a non-negative integer. a must be greater than 1, and x must be greater than 0.

See also prevpow.

Examples

julia> nextpow(2, 7)
+true
Julia 1.6

Support for non-Integer arguments was added in Julia 1.6.

source
Base.nextpowFunction
nextpow(a, x)

The smallest a^n not less than x, where n is a non-negative integer. a must be greater than 1, and x must be greater than 0.

See also prevpow.

Examples

julia> nextpow(2, 7)
 8
 
 julia> nextpow(2, 9)
@@ -1164,7 +1164,7 @@
 25
 
 julia> nextpow(4, 16)
-16
source
Base.prevpowFunction
prevpow(a, x)

The largest a^n not greater than x, where n is a non-negative integer. a must be greater than 1, and x must not be less than 1.

See also nextpow, isqrt.

Examples

julia> prevpow(2, 7)
+16
source
Base.prevpowFunction
prevpow(a, x)

The largest a^n not greater than x, where n is a non-negative integer. a must be greater than 1, and x must not be less than 1.

See also nextpow, isqrt.

Examples

julia> prevpow(2, 7)
 4
 
 julia> prevpow(2, 9)
@@ -1174,21 +1174,21 @@
 5
 
 julia> prevpow(4, 16)
-16
source
Base.nextprodFunction
nextprod(factors::Union{Tuple,AbstractVector}, n)

Next integer greater than or equal to n that can be written as $\prod k_i^{p_i}$ for integers $p_1$, $p_2$, etcetera, for factors $k_i$ in factors.

Examples

julia> nextprod((2, 3), 105)
+16
source
Base.nextprodFunction
nextprod(factors::Union{Tuple,AbstractVector}, n)

Next integer greater than or equal to n that can be written as $\prod k_i^{p_i}$ for integers $p_1$, $p_2$, etcetera, for factors $k_i$ in factors.

Examples

julia> nextprod((2, 3), 105)
 108
 
 julia> 2^2 * 3^3
-108
Julia 1.6

The method that accepts a tuple requires Julia 1.6 or later.

source
Base.invmodFunction
invmod(n::Integer, T) where {T <: Base.BitInteger}
+108
Julia 1.6

The method that accepts a tuple requires Julia 1.6 or later.

source
Base.invmodFunction
invmod(n::Integer, T) where {T <: Base.BitInteger}
 invmod(n::T) where {T <: Base.BitInteger}

Compute the modular inverse of n in the integer ring of type T, i.e. modulo 2^N where N = 8*sizeof(T) (e.g. N = 32 for Int32). In other words, these methods satisfy the following identities:

n * invmod(n) == 1
 (n * invmod(n, T)) % T == 1
-(n % T) * invmod(n, T) == 1

Note that * here is modular multiplication in the integer ring, T. This will throw an error if n is even, because then it is not relatively prime with 2^N and thus has no such inverse.

Specifying the modulus implied by an integer type as an explicit value is often inconvenient since the modulus is by definition too big to be represented by the type.

The modular inverse is computed much more efficiently than the general case using the algorithm described in https://arxiv.org/pdf/2204.04342.pdf.

Julia 1.11

The invmod(n) and invmod(n, T) methods require Julia 1.11 or later.

source
invmod(n::Integer, m::Integer)

Take the inverse of n modulo m: y such that $n y = 1 \pmod m$, and $div(y,m) = 0$. This will throw an error if $m = 0$, or if $gcd(n,m) \neq 1$.

Examples

julia> invmod(2, 5)
+(n % T) * invmod(n, T) == 1

Note that * here is modular multiplication in the integer ring, T. This will throw an error if n is even, because then it is not relatively prime with 2^N and thus has no such inverse.

Specifying the modulus implied by an integer type as an explicit value is often inconvenient since the modulus is by definition too big to be represented by the type.

The modular inverse is computed much more efficiently than the general case using the algorithm described in https://arxiv.org/pdf/2204.04342.pdf.

Julia 1.11

The invmod(n) and invmod(n, T) methods require Julia 1.11 or later.

source
invmod(n::Integer, m::Integer)

Take the inverse of n modulo m: y such that $n y = 1 \pmod m$, and $div(y,m) = 0$. This will throw an error if $m = 0$, or if $gcd(n,m) \neq 1$.

Examples

julia> invmod(2, 5)
 3
 
 julia> invmod(2, 3)
 2
 
 julia> invmod(5, 6)
-5
source
Base.powermodFunction
powermod(x::Integer, p::Integer, m)

Compute $x^p \pmod m$.

Examples

julia> powermod(2, 6, 5)
+5
source
Base.powermodFunction
powermod(x::Integer, p::Integer, m)

Compute $x^p \pmod m$.

Examples

julia> powermod(2, 6, 5)
 4
 
 julia> mod(2^6, 5)
@@ -1201,7 +1201,7 @@
 6
 
 julia> powermod(5, 3, 19)
-11
source
Base.ndigitsFunction
ndigits(n::Integer; base::Integer=10, pad::Integer=1)

Compute the number of digits in integer n written in base base (base must not be in [-1, 0, 1]), optionally padded with zeros to a specified size (the result will never be less than pad).

See also digits, count_ones.

Examples

julia> ndigits(0)
+11
source
Base.ndigitsFunction
ndigits(n::Integer; base::Integer=10, pad::Integer=1)

Compute the number of digits in integer n written in base base (base must not be in [-1, 0, 1]), optionally padded with zeros to a specified size (the result will never be less than pad).

See also digits, count_ones.

Examples

julia> ndigits(0)
 1
 
 julia> ndigits(12345)
@@ -1217,23 +1217,23 @@
 5
 
 julia> ndigits(-123)
-3
source
Base.add_sumFunction
Base.add_sum(x, y)

The reduction operator used in sum. The main difference from + is that small integers are promoted to Int/UInt.

source
Base.widemulFunction
widemul(x, y)

Multiply x and y, giving the result as a larger type.

See also promote, Base.add_sum.

Examples

julia> widemul(Float32(3.0), 4.0) isa BigFloat
+3
source
Base.add_sumFunction
Base.add_sum(x, y)

The reduction operator used in sum. The main difference from + is that small integers are promoted to Int/UInt.

source
Base.widemulFunction
widemul(x, y)

Multiply x and y, giving the result as a larger type.

See also promote, Base.add_sum.

Examples

julia> widemul(Float32(3.0), 4.0) isa BigFloat
 true
 
 julia> typemax(Int8) * typemax(Int8)
 1
 
 julia> widemul(typemax(Int8), typemax(Int8))  # == 127^2
-16129
source
Base.Math.evalpolyFunction
evalpoly(x, p)

Evaluate the polynomial $\sum_k x^{k-1} p[k]$ for the coefficients p[1], p[2], ...; that is, the coefficients are given in ascending order by power of x. Loops are unrolled at compile time if the number of coefficients is statically known, i.e. when p is a Tuple. This function generates efficient code using Horner's method if x is real, or using a Goertzel-like [DK62] algorithm if x is complex.

Julia 1.4

This function requires Julia 1.4 or later.

Examples

julia> evalpoly(2, (1, 2, 3))
-17
source
Base.Math.@evalpolyMacro
@evalpoly(z, c...)

Evaluate the polynomial $\sum_k z^{k-1} c[k]$ for the coefficients c[1], c[2], ...; that is, the coefficients are given in ascending order by power of z. This macro expands to efficient inline code that uses either Horner's method or, for complex z, a more efficient Goertzel-like algorithm.

See also evalpoly.

Examples

julia> @evalpoly(3, 1, 0, 1)
+16129
source
Base.Math.evalpolyFunction
evalpoly(x, p)

Evaluate the polynomial $\sum_k x^{k-1} p[k]$ for the coefficients p[1], p[2], ...; that is, the coefficients are given in ascending order by power of x. Loops are unrolled at compile time if the number of coefficients is statically known, i.e. when p is a Tuple. This function generates efficient code using Horner's method if x is real, or using a Goertzel-like [DK62] algorithm if x is complex.

Julia 1.4

This function requires Julia 1.4 or later.

Examples

julia> evalpoly(2, (1, 2, 3))
+17
source
Base.Math.@evalpolyMacro
@evalpoly(z, c...)

Evaluate the polynomial $\sum_k z^{k-1} c[k]$ for the coefficients c[1], c[2], ...; that is, the coefficients are given in ascending order by power of z. This macro expands to efficient inline code that uses either Horner's method or, for complex z, a more efficient Goertzel-like algorithm.

See also evalpoly.

Examples

julia> @evalpoly(3, 1, 0, 1)
 10
 
 julia> @evalpoly(2, 1, 0, 1)
 5
 
 julia> @evalpoly(2, 1, 1, 1)
-7
source
Base.FastMath.@fastmathMacro
@fastmath expr

Execute a transformed version of the expression, which calls functions that may violate strict IEEE semantics. This allows the fastest possible operation, but results are undefined – be careful when doing this, as it may change numerical results.

This sets the LLVM Fast-Math flags, and corresponds to the -ffast-math option in clang. See the notes on performance annotations for more details.

Examples

julia> @fastmath 1+2
+7
source
Base.FastMath.@fastmathMacro
@fastmath expr

Execute a transformed version of the expression, which calls functions that may violate strict IEEE semantics. This allows the fastest possible operation, but results are undefined – be careful when doing this, as it may change numerical results.

This sets the LLVM Fast-Math flags, and corresponds to the -ffast-math option in clang. See the notes on performance annotations for more details.

Examples

julia> @fastmath 1+2
 3
 
 julia> @fastmath(sin(3))
-0.1411200080598672
source

Customizable binary operators

Some unicode characters can be used to define new binary operators that support infix notation. For example ⊗(x,y) = kron(x,y) defines the (otimes) function to be the Kronecker product, and one can call it as binary operator using infix syntax: C = A ⊗ B as well as with the usual prefix syntax C = ⊗(A,B).

Other characters that support such extensions include \odot and \oplus

The complete list is in the parser code: https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm

Those that are parsed like * (in terms of precedence) include * / ÷ % & ⋅ ∘ × |\\| ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍ ▷ ⨝ ⟕ ⟖ ⟗ and those that are parsed like + include + - |\|| ⊕ ⊖ ⊞ ⊟ |++| ∪ ∨ ⊔ ± ∓ ∔ ∸ ≏ ⊎ ⊻ ⊽ ⋎ ⋓ ⟇ ⧺ ⧻ ⨈ ⨢ ⨣ ⨤ ⨥ ⨦ ⨧ ⨨ ⨩ ⨪ ⨫ ⨬ ⨭ ⨮ ⨹ ⨺ ⩁ ⩂ ⩅ ⩊ ⩌ ⩏ ⩐ ⩒ ⩔ ⩖ ⩗ ⩛ ⩝ ⩡ ⩢ ⩣ There are many others that are related to arrows, comparisons, and powers.

+0.1411200080598672source

Customizable binary operators

Some unicode characters can be used to define new binary operators that support infix notation. For example ⊗(x,y) = kron(x,y) defines the (otimes) function to be the Kronecker product, and one can call it as binary operator using infix syntax: C = A ⊗ B as well as with the usual prefix syntax C = ⊗(A,B).

Other characters that support such extensions include \odot and \oplus

The complete list is in the parser code: https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm

Those that are parsed like * (in terms of precedence) include * / ÷ % & ⋅ ∘ × |\\| ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍ ▷ ⨝ ⟕ ⟖ ⟗ and those that are parsed like + include + - |\|| ⊕ ⊖ ⊞ ⊟ |++| ∪ ∨ ⊔ ± ∓ ∔ ∸ ≏ ⊎ ⊻ ⊽ ⋎ ⋓ ⟇ ⧺ ⧻ ⨈ ⨢ ⨣ ⨤ ⨥ ⨦ ⨧ ⨨ ⨩ ⨪ ⨫ ⨬ ⨭ ⨮ ⨹ ⨺ ⩁ ⩂ ⩅ ⩊ ⩌ ⩏ ⩐ ⩒ ⩔ ⩖ ⩗ ⩛ ⩝ ⩡ ⩢ ⩣ There are many others that are related to arrows, comparisons, and powers.

diff --git a/en/v1.12-dev/base/multi-threading/index.html b/en/v1.12-dev/base/multi-threading/index.html index 44b33ebf5f9..9825c68d500 100644 --- a/en/v1.12-dev/base/multi-threading/index.html +++ b/en/v1.12-dev/base/multi-threading/index.html @@ -23,7 +23,7 @@ busywait(1) end end -2.012056 seconds (16.05 k allocations: 883.919 KiB, 0.66% compilation time)

The :dynamic example takes 2 seconds since one of the non-occupied threads is able to run two of the 1-second iterations to complete the for loop.

source
Base.Threads.foreachFunction
Threads.foreach(f, channel::Channel;
+2.012056 seconds (16.05 k allocations: 883.919 KiB, 0.66% compilation time)

The :dynamic example takes 2 seconds since one of the non-occupied threads is able to run two of the 1-second iterations to complete the for loop.

source
Base.Threads.foreachFunction
Threads.foreach(f, channel::Channel;
                 schedule::Threads.AbstractSchedule=Threads.FairSchedule(),
                 ntasks=Threads.threadpoolsize())

Similar to foreach(f, channel), but iteration over channel and calls to f are split across ntasks tasks spawned by Threads.@spawn. This function will wait for all internally spawned tasks to complete before returning.

If schedule isa FairSchedule, Threads.foreach will attempt to spawn tasks in a manner that enables Julia's scheduler to more freely load-balance work items across threads. This approach generally has higher per-item overhead, but may perform better than StaticSchedule in concurrence with other multithreaded workloads.

If schedule isa StaticSchedule, Threads.foreach will spawn tasks in a manner that incurs lower per-item overhead than FairSchedule, but is less amenable to load-balancing. This approach thus may be more suitable for fine-grained, uniform workloads, but may perform worse than FairSchedule in concurrence with other multithreaded workloads.

Examples

julia> n = 20
 
@@ -35,13 +35,13 @@
        end
 
 julia> collect(d)
-collect(d) = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]
Julia 1.6

This function requires Julia 1.6 or later.

source
Base.Threads.@spawnMacro
Threads.@spawn [:default|:interactive] expr

Create a Task and schedule it to run on any available thread in the specified threadpool (:default if unspecified). The task is allocated to a thread once one becomes available. To wait for the task to finish, call wait on the result of this macro, or call fetch to wait and then obtain its return value.

Values can be interpolated into @spawn via $, which copies the value directly into the constructed underlying closure. This allows you to insert the value of a variable, isolating the asynchronous code from changes to the variable's value in the current task.

Note

The thread that the task runs on may change if the task yields, therefore threadid() should not be treated as constant for a task. See Task Migration, and the broader multi-threading manual for further important caveats. See also the chapter on threadpools.

Julia 1.3

This macro is available as of Julia 1.3.

Julia 1.4

Interpolating values via $ is available as of Julia 1.4.

Julia 1.9

A threadpool may be specified as of Julia 1.9.

Examples

julia> t() = println("Hello from ", Threads.threadid());
+collect(d) = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]
Julia 1.6

This function requires Julia 1.6 or later.

source
Base.Threads.@spawnMacro
Threads.@spawn [:default|:interactive] expr

Create a Task and schedule it to run on any available thread in the specified threadpool (:default if unspecified). The task is allocated to a thread once one becomes available. To wait for the task to finish, call wait on the result of this macro, or call fetch to wait and then obtain its return value.

Values can be interpolated into @spawn via $, which copies the value directly into the constructed underlying closure. This allows you to insert the value of a variable, isolating the asynchronous code from changes to the variable's value in the current task.

Note

The thread that the task runs on may change if the task yields, therefore threadid() should not be treated as constant for a task. See Task Migration, and the broader multi-threading manual for further important caveats. See also the chapter on threadpools.

Julia 1.3

This macro is available as of Julia 1.3.

Julia 1.4

Interpolating values via $ is available as of Julia 1.4.

Julia 1.9

A threadpool may be specified as of Julia 1.9.

Examples

julia> t() = println("Hello from ", Threads.threadid());
 
 julia> tasks = fetch.([Threads.@spawn t() for i in 1:4]);
 Hello from 1
 Hello from 1
 Hello from 3
-Hello from 4
source
Base.Threads.threadidFunction
Threads.threadid([t::Task]) -> Int

Get the ID number of the current thread of execution, or the thread of task t. The master thread has ID 1.

Examples

julia> Threads.threadid()
+Hello from 4
source
Base.Threads.threadidFunction
Threads.threadid([t::Task]) -> Int

Get the ID number of the current thread of execution, or the thread of task t. The master thread has ID 1.

Examples

julia> Threads.threadid()
 1
 
 julia> Threads.@threads for i in 1:4
@@ -53,7 +53,7 @@
 4
 
 julia> Threads.threadid(Threads.@spawn "foo")
-2
Note

The thread that a task runs on may change if the task yields, which is known as Task Migration. For this reason in most cases it is not safe to use threadid([task]) to index into, say, a vector of buffers or stateful objects.

source
Base.Threads.maxthreadidFunction
Threads.maxthreadid() -> Int

Get a lower bound on the number of threads (across all thread pools) available to the Julia process, with atomic-acquire semantics. The result will always be greater than or equal to threadid() as well as threadid(task) for any task you were able to observe before calling maxthreadid.

source
Base.Threads.nthreadsFunction
Threads.nthreads(:default | :interactive) -> Int

Get the current number of threads within the specified thread pool. The threads in :interactive have id numbers 1:nthreads(:interactive), and the threads in :default have id numbers in nthreads(:interactive) .+ (1:nthreads(:default)).

See also BLAS.get_num_threads and BLAS.set_num_threads in the LinearAlgebra standard library, and nprocs() in the Distributed standard library and Threads.maxthreadid().

source
Base.Threads.threadpoolFunction
Threads.threadpool(tid = threadid()) -> Symbol

Returns the specified thread's threadpool; either :default, :interactive, or :foreign.

source
Base.Threads.nthreadpoolsFunction
Threads.nthreadpools() -> Int

Returns the number of threadpools currently configured.

source
Base.Threads.threadpoolsizeFunction
Threads.threadpoolsize(pool::Symbol = :default) -> Int

Get the number of threads available to the default thread pool (or to the specified thread pool).

See also: BLAS.get_num_threads and BLAS.set_num_threads in the LinearAlgebra standard library, and nprocs() in the Distributed standard library.

source
Base.Threads.ngcthreadsFunction
Threads.ngcthreads() -> Int

Returns the number of GC threads currently configured. This includes both mark threads and concurrent sweep threads.

source

See also Multi-Threading.

Atomic operations

atomicKeyword

Unsafe pointer operations are compatible with loading and storing pointers declared with _Atomic and std::atomic type in C11 and C++23 respectively. An error may be thrown if there is not support for atomically loading the Julia type T.

See also: unsafe_load, unsafe_modify!, unsafe_replace!, unsafe_store!, unsafe_swap!

source
Base.@atomicMacro
@atomic var
+2
Note

The thread that a task runs on may change if the task yields, which is known as Task Migration. For this reason in most cases it is not safe to use threadid([task]) to index into, say, a vector of buffers or stateful objects.

source
Base.Threads.maxthreadidFunction
Threads.maxthreadid() -> Int

Get a lower bound on the number of threads (across all thread pools) available to the Julia process, with atomic-acquire semantics. The result will always be greater than or equal to threadid() as well as threadid(task) for any task you were able to observe before calling maxthreadid.

source
Base.Threads.nthreadsFunction
Threads.nthreads(:default | :interactive) -> Int

Get the current number of threads within the specified thread pool. The threads in :interactive have id numbers 1:nthreads(:interactive), and the threads in :default have id numbers in nthreads(:interactive) .+ (1:nthreads(:default)).

See also BLAS.get_num_threads and BLAS.set_num_threads in the LinearAlgebra standard library, and nprocs() in the Distributed standard library and Threads.maxthreadid().

source
Base.Threads.threadpoolFunction
Threads.threadpool(tid = threadid()) -> Symbol

Returns the specified thread's threadpool; either :default, :interactive, or :foreign.

source
Base.Threads.nthreadpoolsFunction
Threads.nthreadpools() -> Int

Returns the number of threadpools currently configured.

source
Base.Threads.threadpoolsizeFunction
Threads.threadpoolsize(pool::Symbol = :default) -> Int

Get the number of threads available to the default thread pool (or to the specified thread pool).

See also: BLAS.get_num_threads and BLAS.set_num_threads in the LinearAlgebra standard library, and nprocs() in the Distributed standard library.

source
Base.Threads.ngcthreadsFunction
Threads.ngcthreads() -> Int

Returns the number of GC threads currently configured. This includes both mark threads and concurrent sweep threads.

source

See also Multi-Threading.

Atomic operations

atomicKeyword

Unsafe pointer operations are compatible with loading and storing pointers declared with _Atomic and std::atomic type in C11 and C++23 respectively. An error may be thrown if there is not support for atomically loading the Julia type T.

See also: unsafe_load, unsafe_modify!, unsafe_replace!, unsafe_store!, unsafe_swap!

source
Base.@atomicMacro
@atomic var
 @atomic order ex

Mark var or ex as being performed atomically, if ex is a supported expression. If no order is specified it defaults to :sequentially_consistent.

@atomic a.b.x = new
 @atomic a.b.x += addend
 @atomic :release a.b.x = new
@@ -117,7 +117,7 @@
 4 => 10
 
 julia> @atomic mem[1] max 5 # again change the first value of mem to the max value, with sequential consistency
-10 => 10
Julia 1.7

Atomic fields functionality requires at least Julia 1.7.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Base.@atomicswapMacro
@atomicswap a.b.x = new
+10 => 10
Julia 1.7

Atomic fields functionality requires at least Julia 1.7.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Base.@atomicswapMacro
@atomicswap a.b.x = new
 @atomicswap :sequentially_consistent a.b.x = new
 @atomicswap m[idx] = new
 @atomicswap :sequentially_consistent m[idx] = new

Stores new into a.b.x (m[idx] in case of reference) and returns the old value of a.b.x (the old value stored at m[idx], respectively).

This operation translates to a swapproperty!(a.b, :x, new) or, in case of reference, swapindex_atomic!(mem, order, new, idx) call, with order defaulting to :sequentially_consistent.

See Per-field atomics section in the manual for more details.

Examples

julia> mutable struct Atomic{T}; @atomic x::T; end
@@ -137,7 +137,7 @@
 1
 
 julia> @atomic mem[1] # fetch the first value of mem, with sequential consistency
-4
Julia 1.7

Atomic fields functionality requires at least Julia 1.7.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Base.@atomicreplaceMacro
@atomicreplace a.b.x expected => desired
+4
Julia 1.7

Atomic fields functionality requires at least Julia 1.7.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Base.@atomicreplaceMacro
@atomicreplace a.b.x expected => desired
 @atomicreplace :sequentially_consistent a.b.x expected => desired
 @atomicreplace :sequentially_consistent :monotonic a.b.x expected => desired
 @atomicreplace m[idx] expected => desired
@@ -181,7 +181,7 @@
 (old = 2, success = true)
 
 julia> @atomic mem[1] # fetch the first value of mem, with sequential consistency
-0
Julia 1.7

Atomic fields functionality requires at least Julia 1.7.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Base.@atomiconceMacro
@atomiconce a.b.x = value
+0
Julia 1.7

Atomic fields functionality requires at least Julia 1.7.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Base.@atomiconceMacro
@atomiconce a.b.x = value
 @atomiconce :sequentially_consistent a.b.x = value
 @atomiconce :sequentially_consistent :monotonic a.b.x = value
 @atomiconce m[idx] = value
@@ -221,14 +221,14 @@
 
 julia> @atomic mem[1]
 1-element Vector{Int64}:
- 1
Julia 1.11

Atomic fields functionality requires at least Julia 1.11.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Core.AtomicMemoryType
AtomicMemory{T} == GenericMemory{:atomic, T, Core.CPU}

Fixed-size DenseVector{T}. Fetching of any of its individual elements is performed atomically (with :monotonic ordering by default).

Warning

The access to AtomicMemory must be done by either using the @atomic macro or the lower level interface functions: Base.getindex_atomic, Base.setindex_atomic!, Base.setindexonce_atomic!, Base.swapindex_atomic!, Base.modifyindex_atomic!, and Base.replaceindex_atomic!.

For details, see Atomic Operations as well as macros @atomic, @atomiconce, @atomicswap, and @atomicreplace.

Julia 1.11

This type requires Julia 1.11 or later.

Julia 1.12

Lower level interface functions or @atomic macro requires Julia 1.12 or later.

source

There are also optional memory ordering parameters for the unsafe set of functions, that select the C/C++-compatible versions of these atomic operations, if that parameter is specified to unsafe_load, unsafe_store!, unsafe_swap!, unsafe_replace!, and unsafe_modify!.

Warning

The following APIs are deprecated, though support for them is likely to remain for several releases.

Base.Threads.AtomicType
Threads.Atomic{T}

Holds a reference to an object of type T, ensuring that it is only accessed atomically, i.e. in a thread-safe manner.

Only certain "simple" types can be used atomically, namely the primitive boolean, integer, and float-point types. These are Bool, Int8...Int128, UInt8...UInt128, and Float16...Float64.

New atomic objects can be created from a non-atomic values; if none is specified, the atomic object is initialized with zero.

Atomic objects can be accessed using the [] notation:

Examples

julia> x = Threads.Atomic{Int}(3)
+ 1
Julia 1.11

Atomic fields functionality requires at least Julia 1.11.

Julia 1.12

Atomic reference functionality requires at least Julia 1.12.

source
Core.AtomicMemoryType
AtomicMemory{T} == GenericMemory{:atomic, T, Core.CPU}

Fixed-size DenseVector{T}. Fetching of any of its individual elements is performed atomically (with :monotonic ordering by default).

Warning

The access to AtomicMemory must be done by either using the @atomic macro or the lower level interface functions: Base.getindex_atomic, Base.setindex_atomic!, Base.setindexonce_atomic!, Base.swapindex_atomic!, Base.modifyindex_atomic!, and Base.replaceindex_atomic!.

For details, see Atomic Operations as well as macros @atomic, @atomiconce, @atomicswap, and @atomicreplace.

Julia 1.11

This type requires Julia 1.11 or later.

Julia 1.12

Lower level interface functions or @atomic macro requires Julia 1.12 or later.

source

There are also optional memory ordering parameters for the unsafe set of functions, that select the C/C++-compatible versions of these atomic operations, if that parameter is specified to unsafe_load, unsafe_store!, unsafe_swap!, unsafe_replace!, and unsafe_modify!.

Warning

The following APIs are deprecated, though support for them is likely to remain for several releases.

Base.Threads.AtomicType
Threads.Atomic{T}

Holds a reference to an object of type T, ensuring that it is only accessed atomically, i.e. in a thread-safe manner.

Only certain "simple" types can be used atomically, namely the primitive boolean, integer, and float-point types. These are Bool, Int8...Int128, UInt8...UInt128, and Float16...Float64.

New atomic objects can be created from a non-atomic values; if none is specified, the atomic object is initialized with zero.

Atomic objects can be accessed using the [] notation:

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> x[] = 1
 1
 
 julia> x[]
-1

Atomic operations use an atomic_ prefix, such as atomic_add!, atomic_xchg!, etc.

source
Base.Threads.atomic_cas!Function
Threads.atomic_cas!(x::Atomic{T}, cmp::T, newval::T) where T

Atomically compare-and-set x

Atomically compares the value in x with cmp. If equal, write newval to x. Otherwise, leaves x unmodified. Returns the old value in x. By comparing the returned value to cmp (via ===) one knows whether x was modified and now holds the new value newval.

For further details, see LLVM's cmpxchg instruction.

This function can be used to implement transactional semantics. Before the transaction, one records the value in x. After the transaction, the new value is stored only if x has not been modified in the mean time.

Examples

julia> x = Threads.Atomic{Int}(3)
+1

Atomic operations use an atomic_ prefix, such as atomic_add!, atomic_xchg!, etc.

source
Base.Threads.atomic_cas!Function
Threads.atomic_cas!(x::Atomic{T}, cmp::T, newval::T) where T

Atomically compare-and-set x

Atomically compares the value in x with cmp. If equal, write newval to x. Otherwise, leaves x unmodified. Returns the old value in x. By comparing the returned value to cmp (via ===) one knows whether x was modified and now holds the new value newval.

For further details, see LLVM's cmpxchg instruction.

This function can be used to implement transactional semantics. Before the transaction, one records the value in x. After the transaction, the new value is stored only if x has not been modified in the mean time.

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> Threads.atomic_cas!(x, 4, 2);
@@ -239,67 +239,67 @@
 julia> Threads.atomic_cas!(x, 3, 2);
 
 julia> x
-Base.Threads.Atomic{Int64}(2)
source
Base.Threads.atomic_xchg!Function
Threads.atomic_xchg!(x::Atomic{T}, newval::T) where T

Atomically exchange the value in x

Atomically exchanges the value in x with newval. Returns the old value.

For further details, see LLVM's atomicrmw xchg instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
+Base.Threads.Atomic{Int64}(2)
source
Base.Threads.atomic_xchg!Function
Threads.atomic_xchg!(x::Atomic{T}, newval::T) where T

Atomically exchange the value in x

Atomically exchanges the value in x with newval. Returns the old value.

For further details, see LLVM's atomicrmw xchg instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> Threads.atomic_xchg!(x, 2)
 3
 
 julia> x[]
-2
source
Base.Threads.atomic_add!Function
Threads.atomic_add!(x::Atomic{T}, val::T) where T <: ArithmeticTypes

Atomically add val to x

Performs x[] += val atomically. Returns the old value. Not defined for Atomic{Bool}.

For further details, see LLVM's atomicrmw add instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
+2
source
Base.Threads.atomic_add!Function
Threads.atomic_add!(x::Atomic{T}, val::T) where T <: ArithmeticTypes

Atomically add val to x

Performs x[] += val atomically. Returns the old value. Not defined for Atomic{Bool}.

For further details, see LLVM's atomicrmw add instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> Threads.atomic_add!(x, 2)
 3
 
 julia> x[]
-5
source
Base.Threads.atomic_sub!Function
Threads.atomic_sub!(x::Atomic{T}, val::T) where T <: ArithmeticTypes

Atomically subtract val from x

Performs x[] -= val atomically. Returns the old value. Not defined for Atomic{Bool}.

For further details, see LLVM's atomicrmw sub instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
+5
source
Base.Threads.atomic_sub!Function
Threads.atomic_sub!(x::Atomic{T}, val::T) where T <: ArithmeticTypes

Atomically subtract val from x

Performs x[] -= val atomically. Returns the old value. Not defined for Atomic{Bool}.

For further details, see LLVM's atomicrmw sub instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> Threads.atomic_sub!(x, 2)
 3
 
 julia> x[]
-1
source
Base.Threads.atomic_and!Function
Threads.atomic_and!(x::Atomic{T}, val::T) where T

Atomically bitwise-and x with val

Performs x[] &= val atomically. Returns the old value.

For further details, see LLVM's atomicrmw and instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
+1
source
Base.Threads.atomic_and!Function
Threads.atomic_and!(x::Atomic{T}, val::T) where T

Atomically bitwise-and x with val

Performs x[] &= val atomically. Returns the old value.

For further details, see LLVM's atomicrmw and instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> Threads.atomic_and!(x, 2)
 3
 
 julia> x[]
-2
source
Base.Threads.atomic_nand!Function
Threads.atomic_nand!(x::Atomic{T}, val::T) where T

Atomically bitwise-nand (not-and) x with val

Performs x[] = ~(x[] & val) atomically. Returns the old value.

For further details, see LLVM's atomicrmw nand instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
+2
source
Base.Threads.atomic_nand!Function
Threads.atomic_nand!(x::Atomic{T}, val::T) where T

Atomically bitwise-nand (not-and) x with val

Performs x[] = ~(x[] & val) atomically. Returns the old value.

For further details, see LLVM's atomicrmw nand instruction.

Examples

julia> x = Threads.Atomic{Int}(3)
 Base.Threads.Atomic{Int64}(3)
 
 julia> Threads.atomic_nand!(x, 2)
 3
 
 julia> x[]
--3
source
Base.Threads.atomic_or!Function
Threads.atomic_or!(x::Atomic{T}, val::T) where T

Atomically bitwise-or x with val

Performs x[] |= val atomically. Returns the old value.

For further details, see LLVM's atomicrmw or instruction.

Examples

julia> x = Threads.Atomic{Int}(5)
+-3
source
Base.Threads.atomic_or!Function
Threads.atomic_or!(x::Atomic{T}, val::T) where T

Atomically bitwise-or x with val

Performs x[] |= val atomically. Returns the old value.

For further details, see LLVM's atomicrmw or instruction.

Examples

julia> x = Threads.Atomic{Int}(5)
 Base.Threads.Atomic{Int64}(5)
 
 julia> Threads.atomic_or!(x, 7)
 5
 
 julia> x[]
-7
source
Base.Threads.atomic_xor!Function
Threads.atomic_xor!(x::Atomic{T}, val::T) where T

Atomically bitwise-xor (exclusive-or) x with val

Performs x[] $= val atomically. Returns the old value.

For further details, see LLVM's atomicrmw xor instruction.

Examples

julia> x = Threads.Atomic{Int}(5)
+7
source
Base.Threads.atomic_xor!Function
Threads.atomic_xor!(x::Atomic{T}, val::T) where T

Atomically bitwise-xor (exclusive-or) x with val

Performs x[] $= val atomically. Returns the old value.

For further details, see LLVM's atomicrmw xor instruction.

Examples

julia> x = Threads.Atomic{Int}(5)
 Base.Threads.Atomic{Int64}(5)
 
 julia> Threads.atomic_xor!(x, 7)
 5
 
 julia> x[]
-2
source
Base.Threads.atomic_max!Function
Threads.atomic_max!(x::Atomic{T}, val::T) where T

Atomically store the maximum of x and val in x

Performs x[] = max(x[], val) atomically. Returns the old value.

For further details, see LLVM's atomicrmw max instruction.

Examples

julia> x = Threads.Atomic{Int}(5)
+2
source
Base.Threads.atomic_max!Function
Threads.atomic_max!(x::Atomic{T}, val::T) where T

Atomically store the maximum of x and val in x

Performs x[] = max(x[], val) atomically. Returns the old value.

For further details, see LLVM's atomicrmw max instruction.

Examples

julia> x = Threads.Atomic{Int}(5)
 Base.Threads.Atomic{Int64}(5)
 
 julia> Threads.atomic_max!(x, 7)
 5
 
 julia> x[]
-7
source
Base.Threads.atomic_min!Function
Threads.atomic_min!(x::Atomic{T}, val::T) where T

Atomically store the minimum of x and val in x

Performs x[] = min(x[], val) atomically. Returns the old value.

For further details, see LLVM's atomicrmw min instruction.

Examples

julia> x = Threads.Atomic{Int}(7)
+7
source
Base.Threads.atomic_min!Function
Threads.atomic_min!(x::Atomic{T}, val::T) where T

Atomically store the minimum of x and val in x

Performs x[] = min(x[], val) atomically. Returns the old value.

For further details, see LLVM's atomicrmw min instruction.

Examples

julia> x = Threads.Atomic{Int}(7)
 Base.Threads.Atomic{Int64}(7)
 
 julia> Threads.atomic_min!(x, 5)
 7
 
 julia> x[]
-5
source
Base.Threads.atomic_fenceFunction
Threads.atomic_fence()

Insert a sequential-consistency memory fence

Inserts a memory fence with sequentially-consistent ordering semantics. There are algorithms where this is needed, i.e. where an acquire/release ordering is insufficient.

This is likely a very expensive operation. Given that all other atomic operations in Julia already have acquire/release semantics, explicit fences should not be necessary in most cases.

For further details, see LLVM's fence instruction.

source

ccall using a libuv threadpool (Experimental)

Base.@threadcallMacro
@threadcall((cfunc, clib), rettype, (argtypes...), argvals...)

The @threadcall macro is called in the same way as ccall but does the work in a different thread. This is useful when you want to call a blocking C function without causing the current julia thread to become blocked. Concurrency is limited by size of the libuv thread pool, which defaults to 4 threads but can be increased by setting the UV_THREADPOOL_SIZE environment variable and restarting the julia process.

Note that the called function should never call back into Julia.

source

Low-level synchronization primitives

These building blocks are used to create the regular synchronization objects.

Base.Threads.SpinLockType
SpinLock()

Create a non-reentrant, test-and-test-and-set spin lock. Recursive use will result in a deadlock. This kind of lock should only be used around code that takes little time to execute and does not block (e.g. perform I/O). In general, ReentrantLock should be used instead.

Each lock must be matched with an unlock. If !islocked(lck::SpinLock) holds, trylock(lck) succeeds unless there are other tasks attempting to hold the lock "at the same time."

Test-and-test-and-set spin locks are quickest up to about 30ish contending threads. If you have more contention than that, different synchronization approaches should be considered.

source

Task metrics (Experimental)

Base.Experimental.task_metricsFunction
Base.Experimental.task_metrics(::Bool)

Enable or disable the collection of per-task metrics. A Task created when Base.Experimental.task_metrics(true) is in effect will have Base.Experimental.task_running_time_ns and Base.Experimental.task_wall_time_ns timing information available.

Note

Task metrics can be enabled at start-up via the --task-metrics=yes command line option.

source
Base.Experimental.task_running_time_nsFunction
Base.Experimental.task_running_time_ns(t::Task) -> Union{UInt64, Nothing}

Return the total nanoseconds that the task t has spent running. This metric is only updated when t yields or completes unless t is the current task, in which it will be updated continuously. See also Base.Experimental.task_wall_time_ns.

Returns nothing if task timings are not enabled. See Base.Experimental.task_metrics.

This metric is from the Julia scheduler

A task may be running on an OS thread that is descheduled by the OS scheduler, this time still counts towards the metric.

Julia 1.12

This method was added in Julia 1.12.

source
Base.Experimental.task_wall_time_nsFunction
Base.Experimental.task_wall_time_ns(t::Task) -> Union{UInt64, Nothing}

Return the total nanoseconds that the task t was runnable. This is the time since the task first entered the run queue until the time at which it completed, or until the current time if the task has not yet completed. See also Base.Experimental.task_running_time_ns.

Returns nothing if task timings are not enabled. See Base.Experimental.task_metrics.

Julia 1.12

This method was added in Julia 1.12.

source
+5source
Base.Threads.atomic_fenceFunction
Threads.atomic_fence()

Insert a sequential-consistency memory fence

Inserts a memory fence with sequentially-consistent ordering semantics. There are algorithms where this is needed, i.e. where an acquire/release ordering is insufficient.

This is likely a very expensive operation. Given that all other atomic operations in Julia already have acquire/release semantics, explicit fences should not be necessary in most cases.

For further details, see LLVM's fence instruction.

source

ccall using a libuv threadpool (Experimental)

Base.@threadcallMacro
@threadcall((cfunc, clib), rettype, (argtypes...), argvals...)

The @threadcall macro is called in the same way as ccall but does the work in a different thread. This is useful when you want to call a blocking C function without causing the current julia thread to become blocked. Concurrency is limited by size of the libuv thread pool, which defaults to 4 threads but can be increased by setting the UV_THREADPOOL_SIZE environment variable and restarting the julia process.

Note that the called function should never call back into Julia.

source

Low-level synchronization primitives

These building blocks are used to create the regular synchronization objects.

Base.Threads.SpinLockType
SpinLock()

Create a non-reentrant, test-and-test-and-set spin lock. Recursive use will result in a deadlock. This kind of lock should only be used around code that takes little time to execute and does not block (e.g. perform I/O). In general, ReentrantLock should be used instead.

Each lock must be matched with an unlock. If !islocked(lck::SpinLock) holds, trylock(lck) succeeds unless there are other tasks attempting to hold the lock "at the same time."

Test-and-test-and-set spin locks are quickest up to about 30ish contending threads. If you have more contention than that, different synchronization approaches should be considered.

source

Task metrics (Experimental)

Base.Experimental.task_metricsFunction
Base.Experimental.task_metrics(::Bool)

Enable or disable the collection of per-task metrics. A Task created when Base.Experimental.task_metrics(true) is in effect will have Base.Experimental.task_running_time_ns and Base.Experimental.task_wall_time_ns timing information available.

Note

Task metrics can be enabled at start-up via the --task-metrics=yes command line option.

source
Base.Experimental.task_running_time_nsFunction
Base.Experimental.task_running_time_ns(t::Task) -> Union{UInt64, Nothing}

Return the total nanoseconds that the task t has spent running. This metric is only updated when t yields or completes unless t is the current task, in which it will be updated continuously. See also Base.Experimental.task_wall_time_ns.

Returns nothing if task timings are not enabled. See Base.Experimental.task_metrics.

This metric is from the Julia scheduler

A task may be running on an OS thread that is descheduled by the OS scheduler, this time still counts towards the metric.

Julia 1.12

This method was added in Julia 1.12.

source
Base.Experimental.task_wall_time_nsFunction
Base.Experimental.task_wall_time_ns(t::Task) -> Union{UInt64, Nothing}

Return the total nanoseconds that the task t was runnable. This is the time since the task first entered the run queue until the time at which it completed, or until the current time if the task has not yet completed. See also Base.Experimental.task_running_time_ns.

Returns nothing if task timings are not enabled. See Base.Experimental.task_metrics.

Julia 1.12

This method was added in Julia 1.12.

source
diff --git a/en/v1.12-dev/base/numbers/index.html b/en/v1.12-dev/base/numbers/index.html index b2f2c3bbaea..8d42fb10453 100644 --- a/en/v1.12-dev/base/numbers/index.html +++ b/en/v1.12-dev/base/numbers/index.html @@ -28,21 +28,21 @@ │ └─ UInt128 ├─ Rational └─ AbstractIrrational (Abstract Type) - └─ Irrational

Abstract number types

Core.NumberType
Number

Abstract supertype for all number types.

source
Core.RealType
Real <: Number

Abstract supertype for all real numbers.

source
Core.AbstractFloatType
AbstractFloat <: Real

Abstract supertype for all floating point numbers.

source
Core.IntegerType
Integer <: Real

Abstract supertype for all integers (e.g. Signed, Unsigned, and Bool).

See also isinteger, trunc, div.

Examples

julia> 42 isa Integer
+      └─ Irrational

Abstract number types

Core.RealType
Real <: Number

Abstract supertype for all real numbers.

source
Core.SignedType
Signed <: Integer

Abstract supertype for all signed integers.

source
Core.UnsignedType
Unsigned <: Integer

Abstract supertype for all unsigned integers.

Built-in unsigned integers are printed in hexadecimal, with prefix 0x, and can be entered in the same way.

Examples

julia> typemax(UInt8)
+true
source
Core.SignedType
Signed <: Integer

Abstract supertype for all signed integers.

source
Core.UnsignedType
Unsigned <: Integer

Abstract supertype for all unsigned integers.

Built-in unsigned integers are printed in hexadecimal, with prefix 0x, and can be entered in the same way.

Examples

julia> typemax(UInt8)
 0xff
 
 julia> Int(0x00d)
 13
 
 julia> unsigned(true)
-0x0000000000000001
source
Base.AbstractIrrationalType
AbstractIrrational <: Real

Number type representing an exact irrational value, which is automatically rounded to the correct precision in arithmetic operations with other numeric quantities.

Subtypes MyIrrational <: AbstractIrrational should implement at least ==(::MyIrrational, ::MyIrrational), hash(x::MyIrrational, h::UInt), and convert(::Type{F}, x::MyIrrational) where {F <: Union{BigFloat,Float32,Float64}}.

If a subtype is used to represent values that may occasionally be rational (e.g. a square-root type that represents √n for integers n will give a rational result when n is a perfect square), then it should also implement isinteger, iszero, isone, and == with Real values (since all of these default to false for AbstractIrrational types), as well as defining hash to equal that of the corresponding Rational.

source

Concrete number types

Core.Float16Type
Float16 <: AbstractFloat <: Real

16-bit floating point number type (IEEE 754 standard). Binary format is 1 sign, 5 exponent, 10 fraction bits.

source
Core.Float32Type
Float32 <: AbstractFloat <: Real

32-bit floating point number type (IEEE 754 standard). Binary format is 1 sign, 8 exponent, 23 fraction bits.

The exponent for scientific notation should be entered as lower-case f, thus 2f3 === 2.0f0 * 10^3 === Float32(2_000). For array literals and comprehensions, the element type can be specified before the square brackets: Float32[1,4,9] == Float32[i^2 for i in 1:3].

See also Inf32, NaN32, Float16, exponent, frexp.

source
Core.Float64Type
Float64 <: AbstractFloat <: Real

64-bit floating point number type (IEEE 754 standard). Binary format is 1 sign, 11 exponent, 52 fraction bits. See bitstring, signbit, exponent, frexp, and significand to access various bits.

This is the default for floating point literals, 1.0 isa Float64, and for many operations such as 1/2, 2pi, log(2), range(0,90,length=4). Unlike integers, this default does not change with Sys.WORD_SIZE.

The exponent for scientific notation can be entered as e or E, thus 2e3 === 2.0E3 === 2.0 * 10^3. Doing so is strongly preferred over 10^n because integers overflow, thus 2.0 * 10^19 < 0 but 2e19 > 0.

See also Inf, NaN, floatmax, Float32, Complex.

source
Core.BoolType
Bool <: Integer

Boolean type, containing the values true and false.

Bool is a kind of number: false is numerically equal to 0 and true is numerically equal to 1. Moreover, false acts as a multiplicative "strong zero" against NaN and Inf:

julia> [true, false] == [1, 0]
+0x0000000000000001
source
Base.AbstractIrrationalType
AbstractIrrational <: Real

Number type representing an exact irrational value, which is automatically rounded to the correct precision in arithmetic operations with other numeric quantities.

Subtypes MyIrrational <: AbstractIrrational should implement at least ==(::MyIrrational, ::MyIrrational), hash(x::MyIrrational, h::UInt), and convert(::Type{F}, x::MyIrrational) where {F <: Union{BigFloat,Float32,Float64}}.

If a subtype is used to represent values that may occasionally be rational (e.g. a square-root type that represents √n for integers n will give a rational result when n is a perfect square), then it should also implement isinteger, iszero, isone, and == with Real values (since all of these default to false for AbstractIrrational types), as well as defining hash to equal that of the corresponding Rational.

source

Concrete number types

Core.Float16Type
Float16 <: AbstractFloat <: Real

16-bit floating point number type (IEEE 754 standard). Binary format is 1 sign, 5 exponent, 10 fraction bits.

source
Core.Float32Type
Float32 <: AbstractFloat <: Real

32-bit floating point number type (IEEE 754 standard). Binary format is 1 sign, 8 exponent, 23 fraction bits.

The exponent for scientific notation should be entered as lower-case f, thus 2f3 === 2.0f0 * 10^3 === Float32(2_000). For array literals and comprehensions, the element type can be specified before the square brackets: Float32[1,4,9] == Float32[i^2 for i in 1:3].

See also Inf32, NaN32, Float16, exponent, frexp.

source
Core.Float64Type
Float64 <: AbstractFloat <: Real

64-bit floating point number type (IEEE 754 standard). Binary format is 1 sign, 11 exponent, 52 fraction bits. See bitstring, signbit, exponent, frexp, and significand to access various bits.

This is the default for floating point literals, 1.0 isa Float64, and for many operations such as 1/2, 2pi, log(2), range(0,90,length=4). Unlike integers, this default does not change with Sys.WORD_SIZE.

The exponent for scientific notation can be entered as e or E, thus 2e3 === 2.0E3 === 2.0 * 10^3. Doing so is strongly preferred over 10^n because integers overflow, thus 2.0 * 10^19 < 0 but 2e19 > 0.

See also Inf, NaN, floatmax, Float32, Complex.

source
Core.BoolType
Bool <: Integer

Boolean type, containing the values true and false.

Bool is a kind of number: false is numerically equal to 0 and true is numerically equal to 1. Moreover, false acts as a multiplicative "strong zero" against NaN and Inf:

julia> [true, false] == [1, 0]
 true
 
 julia> 42.0 + true
@@ -58,7 +58,7 @@
 
 julia> map(>(pi), [1 2 3 4 5])
 1×5 Matrix{Bool}:
- 0  0  0  1  1

See also trues, falses, ifelse.

source
Core.Int8Type
Int8 <: Signed <: Integer

8-bit signed integer type.

Represents numbers n ∈ -128:127. Note that such integers overflow without warning, thus typemax(Int8) + Int8(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt8Type
UInt8 <: Unsigned <: Integer

8-bit unsigned integer type.

Printed in hexadecimal, thus 0x07 == 7.

source
Core.Int16Type
Int16 <: Signed <: Integer

16-bit signed integer type.

Represents numbers n ∈ -32768:32767. Note that such integers overflow without warning, thus typemax(Int16) + Int16(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt16Type
UInt16 <: Unsigned <: Integer

16-bit unsigned integer type.

Printed in hexadecimal, thus 0x000f == 15.

source
Core.Int32Type
Int32 <: Signed <: Integer

32-bit signed integer type.

Note that such integers overflow without warning, thus typemax(Int32) + Int32(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt32Type
UInt32 <: Unsigned <: Integer

32-bit unsigned integer type.

Printed in hexadecimal, thus 0x0000001f == 31.

source
Core.Int64Type
Int64 <: Signed <: Integer

64-bit signed integer type.

Note that such integers overflow without warning, thus typemax(Int64) + Int64(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt64Type
UInt64 <: Unsigned <: Integer

64-bit unsigned integer type.

Printed in hexadecimal, thus 0x000000000000003f == 63.

source
Core.Int128Type
Int128 <: Signed <: Integer

128-bit signed integer type.

Note that such integers overflow without warning, thus typemax(Int128) + Int128(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt128Type
UInt128 <: Unsigned <: Integer

128-bit unsigned integer type.

Printed in hexadecimal, thus 0x0000000000000000000000000000007f == 127.

source
Core.IntType
Int

Sys.WORD_SIZE-bit signed integer type, Int <: Signed <: Integer <: Real.

This is the default type of most integer literals and is an alias for either Int32 or Int64, depending on Sys.WORD_SIZE. It is the type returned by functions such as length, and the standard type for indexing arrays.

Note that integers overflow without warning, thus typemax(Int) + 1 < 0 and 10^19 < 0. Overflow can be avoided by using BigInt. Very large integer literals will use a wider type, for instance 10_000_000_000_000_000_000 isa Int128.

Integer division is div alias ÷, whereas / acting on integers returns Float64.

See also Int64, widen, typemax, bitstring.

source
Core.UIntType
UInt

Sys.WORD_SIZE-bit unsigned integer type, UInt <: Unsigned <: Integer.

Like Int, the alias UInt may point to either UInt32 or UInt64, according to the value of Sys.WORD_SIZE on a given computer.

Printed and parsed in hexadecimal: UInt(15) === 0x000000000000000f.

source
Base.ComplexType
Complex{T<:Real} <: Number

Complex number type with real and imaginary part of type T.

ComplexF16, ComplexF32 and ComplexF64 are aliases for Complex{Float16}, Complex{Float32} and Complex{Float64} respectively.

See also: Real, complex, real.

source
Base.RationalType
Rational{T<:Integer} <: Real

Rational number type, with numerator and denominator of type T. Rationals are checked for overflow.

source

Data Formats

Base.digitsFunction
digits([T<:Integer], n::Integer; base::T = 10, pad::Integer = 1)

Return an array with element type T (default Int) of the digits of n in the given base, optionally padded with zeros to a specified size. More significant digits are at higher indices, such that n == sum(digits[k]*base^(k-1) for k in 1:length(digits)).

See also ndigits, digits!, and for base 2 also bitstring, count_ones.

Examples

julia> digits(10)
+ 0  0  0  1  1

See also trues, falses, ifelse.

source
Core.Int8Type
Int8 <: Signed <: Integer

8-bit signed integer type.

Represents numbers n ∈ -128:127. Note that such integers overflow without warning, thus typemax(Int8) + Int8(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt8Type
UInt8 <: Unsigned <: Integer

8-bit unsigned integer type.

Printed in hexadecimal, thus 0x07 == 7.

source
Core.Int16Type
Int16 <: Signed <: Integer

16-bit signed integer type.

Represents numbers n ∈ -32768:32767. Note that such integers overflow without warning, thus typemax(Int16) + Int16(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt16Type
UInt16 <: Unsigned <: Integer

16-bit unsigned integer type.

Printed in hexadecimal, thus 0x000f == 15.

source
Core.Int32Type
Int32 <: Signed <: Integer

32-bit signed integer type.

Note that such integers overflow without warning, thus typemax(Int32) + Int32(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt32Type
UInt32 <: Unsigned <: Integer

32-bit unsigned integer type.

Printed in hexadecimal, thus 0x0000001f == 31.

source
Core.Int64Type
Int64 <: Signed <: Integer

64-bit signed integer type.

Note that such integers overflow without warning, thus typemax(Int64) + Int64(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt64Type
UInt64 <: Unsigned <: Integer

64-bit unsigned integer type.

Printed in hexadecimal, thus 0x000000000000003f == 63.

source
Core.Int128Type
Int128 <: Signed <: Integer

128-bit signed integer type.

Note that such integers overflow without warning, thus typemax(Int128) + Int128(1) < 0.

See also Int, widen, BigInt.

source
Core.UInt128Type
UInt128 <: Unsigned <: Integer

128-bit unsigned integer type.

Printed in hexadecimal, thus 0x0000000000000000000000000000007f == 127.

source
Core.IntType
Int

Sys.WORD_SIZE-bit signed integer type, Int <: Signed <: Integer <: Real.

This is the default type of most integer literals and is an alias for either Int32 or Int64, depending on Sys.WORD_SIZE. It is the type returned by functions such as length, and the standard type for indexing arrays.

Note that integers overflow without warning, thus typemax(Int) + 1 < 0 and 10^19 < 0. Overflow can be avoided by using BigInt. Very large integer literals will use a wider type, for instance 10_000_000_000_000_000_000 isa Int128.

Integer division is div alias ÷, whereas / acting on integers returns Float64.

See also Int64, widen, typemax, bitstring.

source
Core.UIntType
UInt

Sys.WORD_SIZE-bit unsigned integer type, UInt <: Unsigned <: Integer.

Like Int, the alias UInt may point to either UInt32 or UInt64, according to the value of Sys.WORD_SIZE on a given computer.

Printed and parsed in hexadecimal: UInt(15) === 0x000000000000000f.

source
Base.ComplexType
Complex{T<:Real} <: Number

Complex number type with real and imaginary part of type T.

ComplexF16, ComplexF32 and ComplexF64 are aliases for Complex{Float16}, Complex{Float32} and Complex{Float64} respectively.

See also: Real, complex, real.

source
Base.RationalType
Rational{T<:Integer} <: Real

Rational number type, with numerator and denominator of type T. Rationals are checked for overflow.

source

Data Formats

Base.digitsFunction
digits([T<:Integer], n::Integer; base::T = 10, pad::Integer = 1)

Return an array with element type T (default Int) of the digits of n in the given base, optionally padded with zeros to a specified size. More significant digits are at higher indices, such that n == sum(digits[k]*base^(k-1) for k in 1:length(digits)).

See also ndigits, digits!, and for base 2 also bitstring, count_ones.

Examples

julia> digits(10)
 2-element Vector{Int64}:
  0
  1
@@ -81,7 +81,7 @@
 julia> n = rand(-999:999);
 
 julia> n == evalpoly(13, digits(n, base = 13))
-true
source
Base.digits!Function
digits!(array, n::Integer; base::Integer = 10)

Fills an array of the digits of n in the given base. More significant digits are at higher indices. If the array length is insufficient, the least significant digits are filled up to the array length. If the array length is excessive, the excess portion is filled with zeros.

Examples

julia> digits!([2, 2, 2, 2], 10, base = 2)
+true
source
Base.digits!Function
digits!(array, n::Integer; base::Integer = 10)

Fills an array of the digits of n in the given base. More significant digits are at higher indices. If the array length is insufficient, the least significant digits are filled up to the array length. If the array length is excessive, the excess portion is filled with zeros.

Examples

julia> digits!([2, 2, 2, 2], 10, base = 2)
 4-element Vector{Int64}:
  0
  1
@@ -95,11 +95,11 @@
  0
  1
  0
- 0
source
Base.bitstringFunction
bitstring(n)

A string giving the literal bit representation of a primitive type (in bigendian order, i.e. most-significant bit first).

See also count_ones, count_zeros, digits.

Examples

julia> bitstring(Int32(4))
+ 0
source
Base.bitstringFunction
bitstring(n)

A string giving the literal bit representation of a primitive type (in bigendian order, i.e. most-significant bit first).

See also count_ones, count_zeros, digits.

Examples

julia> bitstring(Int32(4))
 "00000000000000000000000000000100"
 
 julia> bitstring(2.2)
-"0100000000000001100110011001100110011001100110011001100110011010"
source
Base.parseFunction
parse(::Type{SimpleColor}, rgb::String)

An analogue of tryparse(SimpleColor, rgb::String) (which see), that raises an error instead of returning nothing.

parse(::Type{Platform}, triplet::AbstractString)

Parses a string platform triplet back into a Platform object.

source
parse(type, str; base)

Parse a string as a number. For Integer types, a base can be specified (the default is 10). For floating-point types, the string is parsed as a decimal floating-point number. Complex types are parsed from decimal strings of the form "R±Iim" as a Complex(R,I) of the requested type; "i" or "j" can also be used instead of "im", and "R" or "Iim" are also permitted. If the string does not contain a valid number, an error is raised.

Julia 1.1

parse(Bool, str) requires at least Julia 1.1.

Examples

julia> parse(Int, "1234")
+"0100000000000001100110011001100110011001100110011001100110011010"
source
Base.parseFunction
parse(::Type{SimpleColor}, rgb::String)

An analogue of tryparse(SimpleColor, rgb::String) (which see), that raises an error instead of returning nothing.

parse(::Type{Platform}, triplet::AbstractString)

Parses a string platform triplet back into a Platform object.

source
parse(type, str; base)

Parse a string as a number. For Integer types, a base can be specified (the default is 10). For floating-point types, the string is parsed as a decimal floating-point number. Complex types are parsed from decimal strings of the form "R±Iim" as a Complex(R,I) of the requested type; "i" or "j" can also be used instead of "im", and "R" or "Iim" are also permitted. If the string does not contain a valid number, an error is raised.

Julia 1.1

parse(Bool, str) requires at least Julia 1.1.

Examples

julia> parse(Int, "1234")
 1234
 
 julia> parse(Int, "1234", base = 5)
@@ -112,23 +112,23 @@
 0.0012
 
 julia> parse(Complex{Float64}, "3.2e-1 + 4.5im")
-0.32 + 4.5im
source
Base.tryparseFunction
tryparse(::Type{SimpleColor}, rgb::String)

Attempt to parse rgb as a SimpleColor. If rgb starts with # and has a length of 7, it is converted into a RGBTuple-backed SimpleColor. If rgb starts with a-z, rgb is interpreted as a color name and converted to a Symbol-backed SimpleColor.

Otherwise, nothing is returned.

Examples

julia> tryparse(SimpleColor, "blue")
+0.32 + 4.5im
source
Base.tryparseFunction
tryparse(::Type{SimpleColor}, rgb::String)

Attempt to parse rgb as a SimpleColor. If rgb starts with # and has a length of 7, it is converted into a RGBTuple-backed SimpleColor. If rgb starts with a-z, rgb is interpreted as a color name and converted to a Symbol-backed SimpleColor.

Otherwise, nothing is returned.

Examples

julia> tryparse(SimpleColor, "blue")
 SimpleColor(blue)
 
 julia> tryparse(SimpleColor, "#9558b2")
 SimpleColor(#9558b2)
 
-julia> tryparse(SimpleColor, "#nocolor")
tryparse(type, str; base)

Like parse, but returns either a value of the requested type, or nothing if the string does not contain a valid number.

source
Base.bigFunction
big(x)

Convert a number to a maximum precision representation (typically BigInt or BigFloat). See BigFloat for information about some pitfalls with floating-point numbers.

source
Base.signedFunction
signed(x)

Convert a number to a signed integer. If the argument is unsigned, it is reinterpreted as signed without checking for overflow.

See also: unsigned, sign, signbit.

source
signed(T::Integer)

Convert an integer bitstype to the signed type of the same size.

Examples

julia> signed(UInt16)
+julia> tryparse(SimpleColor, "#nocolor")
tryparse(type, str; base)

Like parse, but returns either a value of the requested type, or nothing if the string does not contain a valid number.

source
Base.bigFunction
big(x)

Convert a number to a maximum precision representation (typically BigInt or BigFloat). See BigFloat for information about some pitfalls with floating-point numbers.

source
Base.signedFunction
signed(x)

Convert a number to a signed integer. If the argument is unsigned, it is reinterpreted as signed without checking for overflow.

See also: unsigned, sign, signbit.

source
signed(T::Integer)

Convert an integer bitstype to the signed type of the same size.

Examples

julia> signed(UInt16)
 Int16
 julia> signed(UInt64)
-Int64
source
Base.unsignedFunction
unsigned(T::Integer)

Convert an integer bitstype to the unsigned type of the same size.

Examples

julia> unsigned(Int16)
+Int64
source
Base.unsignedFunction
unsigned(T::Integer)

Convert an integer bitstype to the unsigned type of the same size.

Examples

julia> unsigned(Int16)
 UInt16
 julia> unsigned(UInt64)
-UInt64
source
Base.floatMethod
float(x)

Convert a number or array to a floating point data type.

See also: complex, oftype, convert.

Examples

julia> float(1:1000)
 1.0:1.0:1000.0
 
 julia> float(typemax(Int32))
-2.147483647e9
source
Base.Math.significandFunction
significand(x)

Extract the significand (a.k.a. mantissa) of a floating-point number. If x is a non-zero finite number, then the result will be a number of the same type and sign as x, and whose absolute value is on the interval $[1,2)$. Otherwise x is returned.

See also frexp, exponent.

Examples

julia> significand(15.2)
+2.147483647e9
source
Base.Math.significandFunction
significand(x)

Extract the significand (a.k.a. mantissa) of a floating-point number. If x is a non-zero finite number, then the result will be a number of the same type and sign as x, and whose absolute value is on the interval $[1,2)$. Otherwise x is returned.

See also frexp, exponent.

Examples

julia> significand(15.2)
 1.9
 
 julia> significand(-15.2)
@@ -138,7 +138,7 @@
 -15.2
 
 julia> significand(-Inf), significand(Inf), significand(NaN)
-(-Inf, Inf, NaN)
source
Base.Math.exponentFunction
exponent(x::Real) -> Int

Return the largest integer y such that 2^y ≤ abs(x). For a normalized floating-point number x, this corresponds to the exponent of x.

Throws a DomainError when x is zero, infinite, or NaN. For any other non-subnormal floating-point number x, this corresponds to the exponent bits of x.

See also signbit, significand, frexp, issubnormal, log2, ldexp.

Examples

julia> exponent(8)
+(-Inf, Inf, NaN)
source
Base.Math.exponentFunction
exponent(x::Real) -> Int

Return the largest integer y such that 2^y ≤ abs(x). For a normalized floating-point number x, this corresponds to the exponent of x.

Throws a DomainError when x is zero, infinite, or NaN. For any other non-subnormal floating-point number x, this corresponds to the exponent bits of x.

See also signbit, significand, frexp, issubnormal, log2, ldexp.

Examples

julia> exponent(8)
 3
 
 julia> exponent(6.5)
@@ -156,14 +156,14 @@
 julia> exponent(0.0)
 ERROR: DomainError with 0.0:
 Cannot be ±0.0.
-[...]
source
Base.complexMethod
complex(r, [i])

Convert real numbers or arrays to complex. i defaults to zero.

Examples

julia> complex(7)
+[...]
source
Base.complexMethod
complex(r, [i])

Convert real numbers or arrays to complex. i defaults to zero.

Examples

julia> complex(7)
 7 + 0im
 
 julia> complex([1, 2, 3])
 3-element Vector{Complex{Int64}}:
  1 + 0im
  2 + 0im
- 3 + 0im
source
Base.bswapFunction
bswap(n)

Reverse the byte order of n.

(See also ntoh and hton to convert between the current native byte order and big-endian order.)

Examples

julia> a = bswap(0x10203040)
+ 3 + 0im
source
Base.bswapFunction
bswap(n)

Reverse the byte order of n.

(See also ntoh and hton to convert between the current native byte order and big-endian order.)

Examples

julia> a = bswap(0x10203040)
 0x40302010
 
 julia> bswap(a)
@@ -173,7 +173,7 @@
 "1"
 
 julia> string(bswap(1), base = 2)
-"100000000000000000000000000000000000000000000000000000000"
source
Base.hex2bytesFunction
hex2bytes(itr)

Given an iterable itr of ASCII codes for a sequence of hexadecimal digits, returns a Vector{UInt8} of bytes corresponding to the binary representation: each successive pair of hexadecimal digits in itr gives the value of one byte in the return vector.

The length of itr must be even, and the returned array has half of the length of itr. See also hex2bytes! for an in-place version, and bytes2hex for the inverse.

Julia 1.7

Calling hex2bytes with iterators producing UInt8 values requires Julia 1.7 or later. In earlier versions, you can collect the iterator before calling hex2bytes.

Examples

julia> s = string(12345, base = 16)
+"100000000000000000000000000000000000000000000000000000000"
source
Base.hex2bytesFunction
hex2bytes(itr)

Given an iterable itr of ASCII codes for a sequence of hexadecimal digits, returns a Vector{UInt8} of bytes corresponding to the binary representation: each successive pair of hexadecimal digits in itr gives the value of one byte in the return vector.

The length of itr must be even, and the returned array has half of the length of itr. See also hex2bytes! for an in-place version, and bytes2hex for the inverse.

Julia 1.7

Calling hex2bytes with iterators producing UInt8 values requires Julia 1.7 or later. In earlier versions, you can collect the iterator before calling hex2bytes.

Examples

julia> s = string(12345, base = 16)
 "3039"
 
 julia> hex2bytes(s)
@@ -194,7 +194,7 @@
 3-element Vector{UInt8}:
  0x01
  0xab
- 0xef
source
Base.hex2bytes!Function
hex2bytes!(dest::AbstractVector{UInt8}, itr)

Convert an iterable itr of bytes representing a hexadecimal string to its binary representation, similar to hex2bytes except that the output is written in-place to dest. The length of dest must be half the length of itr.

Julia 1.7

Calling hex2bytes! with iterators producing UInt8 requires version 1.7. In earlier versions, you can collect the iterable before calling instead.

source
Base.hex2bytes!Function
hex2bytes!(dest::AbstractVector{UInt8}, itr)

Convert an iterable itr of bytes representing a hexadecimal string to its binary representation, similar to hex2bytes except that the output is written in-place to dest. The length of dest must be half the length of itr.

Julia 1.7

Calling hex2bytes! with iterators producing UInt8 requires version 1.7. In earlier versions, you can collect the iterable before calling instead.

source
Base.bytes2hexFunction
bytes2hex(itr) -> String
 bytes2hex(io::IO, itr)

Convert an iterator itr of bytes to its hexadecimal string representation, either returning a String via bytes2hex(itr) or writing the string to an io stream via bytes2hex(io, itr). The hexadecimal characters are all lowercase.

Julia 1.7

Calling bytes2hex with arbitrary iterators producing UInt8 values requires Julia 1.7 or later. In earlier versions, you can collect the iterator before calling bytes2hex.

Examples

julia> a = string(12345, base = 16)
 "3039"
 
@@ -204,7 +204,7 @@
  0x39
 
 julia> bytes2hex(b)
-"3039"
source

General Number Functions and Constants

General Number Functions and Constants

Base.oneFunction
one(x)
 one(T::Type)

Return a multiplicative identity for x: a value such that one(x)*x == x*one(x) == x. If the multiplicative identity can be deduced from the type alone, then a type may be given as an argument to one (e.g. one(Int) will work because the multiplicative identity is the same for all instances of Int, but one(Matrix{Int}) is not defined because matrices of different shapes have different multiplicative identities.)

If possible, one(x) returns a value of the same type as x, and one(T) returns a value of type T. However, this may not be the case for types representing dimensionful quantities (e.g. time in days), since the multiplicative identity must be dimensionless. In that case, one(x) should return an identity value of the same precision (and shape, for matrices) as x.

If you want a quantity that is of the same type as x, or of type T, even if x is dimensionful, use oneunit instead.

See also the identity function, and I in LinearAlgebra for the identity matrix.

Examples

julia> one(3.7)
 1.0
 
@@ -212,12 +212,12 @@
 1
 
 julia> import Dates; one(Dates.Day(1))
-1
source
Base.oneunitFunction
oneunit(x::T)
 oneunit(T::Type)

Return T(one(x)), where T is either the type of the argument, or the argument itself in cases where the oneunit can be deduced from the type alone. This differs from one for dimensionful quantities: one is dimensionless (a multiplicative identity) while oneunit is dimensionful (of the same type as x, or of type T).

Examples

julia> oneunit(3.7)
 1.0
 
 julia> import Dates; oneunit(Dates.Day)
-1 day
source
Base.zeroFunction
zero(x)
 zero(::Type)

Get the additive identity element for x. If the additive identity can be deduced from the type alone, then a type may be given as an argument to zero.

For example, zero(Int) will work because the additive identity is the same for all instances of Int, but zero(Vector{Int}) is not defined because vectors of different lengths have different additive identities.

See also iszero, one, oneunit, oftype.

Examples

julia> zero(1)
 0
 
@@ -227,16 +227,16 @@
 julia> zero(rand(2,2))
 2×2 Matrix{Float64}:
  0.0  0.0
- 0.0  0.0
source
Base.imConstant
im

The imaginary unit.

See also: imag, angle, complex.

Examples

julia> im * im
 -1 + 0im
 
 julia> (2.0 + 3im)^2
--5.0 + 12.0im
source
Base.MathConstants.piConstant
π
 pi

The constant pi.

Unicode π can be typed by writing \pi then pressing tab in the Julia REPL, and in many editors.

See also: sinpi, sincospi, deg2rad.

Examples

julia> pi
 π = 3.1415926535897...
 
 julia> 1/2pi
-0.15915494309189535
source
Base.MathConstants.ℯConstant
ℯ
 e

The constant ℯ.

Unicode can be typed by writing \euler and pressing tab in the Julia REPL, and in many editors.

See also: exp, cis, cispi.

Examples

julia> ℯ
 ℯ = 2.7182818284590...
 
@@ -244,37 +244,37 @@
 1
 
 julia> ℯ^(im)π ≈ -1
-true
source
Base.MathConstants.catalanConstant
catalan

Catalan's constant.

Examples

julia> Base.MathConstants.catalan
 catalan = 0.9159655941772...
 
 julia> sum(log(x)/(1+x^2) for x in 1:0.01:10^6) * 0.01
-0.9159466120554123
source
Base.MathConstants.eulergammaConstant
γ
 eulergamma

Euler's constant.

Examples

julia> Base.MathConstants.eulergamma
 γ = 0.5772156649015...
 
 julia> dx = 10^-6;
 
 julia> sum(-exp(-x) * log(x) for x in dx:dx:100) * dx
-0.5772078382499133
source
Base.MathConstants.goldenConstant
φ
 golden

The golden ratio.

Examples

julia> Base.MathConstants.golden
 φ = 1.6180339887498...
 
 julia> (2ans - 1)^2 ≈ 5
-true
source
Base.NaNConstant
NaN, NaN64

A not-a-number value of type Float64.

See also: isnan, missing, NaN32, Inf.

Examples

julia> 0/0
 NaN
 
 julia> Inf - Inf
@@ -288,7 +288,7 @@
 NaN32
 
 julia> NaN32p1 === NaN32, isequal(NaN32p1, NaN32), isnan(NaN32p1)
-(false, true, true)
source
Base.NaN64Constant
NaN, NaN64

A not-a-number value of type Float64.

See also: isnan, missing, NaN32, Inf.

Examples

julia> 0/0
+(false, true, true)
source
Base.NaN64Constant
NaN, NaN64

A not-a-number value of type Float64.

See also: isnan, missing, NaN32, Inf.

Examples

julia> 0/0
 NaN
 
 julia> Inf - Inf
@@ -302,33 +302,33 @@
 NaN32
 
 julia> NaN32p1 === NaN32, isequal(NaN32p1, NaN32), isnan(NaN32p1)
-(false, true, true)
source
Base.NaN32Constant
NaN32

A not-a-number value of type Float32.

See also: NaN.

source
Base.NaN16Constant
NaN16

A not-a-number value of type Float16.

See also: NaN.

source
Base.issubnormalFunction
issubnormal(f) -> Bool

Test whether a floating point number is subnormal.

An IEEE floating point number is subnormal when its exponent bits are zero and its significand is not zero.

Examples

julia> floatmin(Float32)
+(false, true, true)
source
Base.NaN32Constant
NaN32

A not-a-number value of type Float32.

See also: NaN.

source
Base.NaN16Constant
NaN16

A not-a-number value of type Float16.

See also: NaN.

source
Base.issubnormalFunction
issubnormal(f) -> Bool

Test whether a floating point number is subnormal.

An IEEE floating point number is subnormal when its exponent bits are zero and its significand is not zero.

Examples

julia> floatmin(Float32)
 1.1754944f-38
 
 julia> issubnormal(1.0f-37)
 false
 
 julia> issubnormal(1.0f-38)
-true
source
Base.isfiniteFunction
isfinite(f) -> Bool

Test whether a number is finite.

Examples

julia> isfinite(5)
+true
source
Base.isfiniteFunction
isfinite(f) -> Bool

Test whether a number is finite.

Examples

julia> isfinite(5)
 true
 
 julia> isfinite(NaN32)
-false
source
Base.isinfFunction
isinf(f) -> Bool

Test whether a number is infinite.

See also: Inf, iszero, isfinite, isnan.

source
Base.isnanFunction
isnan(f) -> Bool

Test whether a number value is a NaN, an indeterminate value which is neither an infinity nor a finite number ("not a number").

See also: iszero, isone, isinf, ismissing.

source
Base.iszeroFunction
iszero(x)

Return true if x == zero(x); if x is an array, this checks whether all of the elements of x are zero.

See also: isone, isinteger, isfinite, isnan.

Examples

julia> iszero(0.0)
+false
source
Base.isinfFunction
isinf(f) -> Bool

Test whether a number is infinite.

See also: Inf, iszero, isfinite, isnan.

source
Base.isnanFunction
isnan(f) -> Bool

Test whether a number value is a NaN, an indeterminate value which is neither an infinity nor a finite number ("not a number").

See also: iszero, isone, isinf, ismissing.

source
Base.iszeroFunction
iszero(x)

Return true if x == zero(x); if x is an array, this checks whether all of the elements of x are zero.

See also: isone, isinteger, isfinite, isnan.

Examples

julia> iszero(0.0)
 true
 
 julia> iszero([1, 9, 0])
 false
 
 julia> iszero([false, 0, 0])
-true
source
Base.isoneFunction
isone(x)

Return true if x == one(x); if x is an array, this checks whether x is an identity matrix.

Examples

julia> isone(1.0)
+true
source
Base.isoneFunction
isone(x)

Return true if x == one(x); if x is an array, this checks whether x is an identity matrix.

Examples

julia> isone(1.0)
 true
 
 julia> isone([1 0; 0 2])
 false
 
 julia> isone([1 0; 0 true])
-true
source
Base.nextfloatFunction
nextfloat(x::AbstractFloat)

Return the smallest floating point number y of the same type as x such that x < y. If no such y exists (e.g. if x is Inf or NaN), then return x.

See also: prevfloat, eps, issubnormal.

source
nextfloat(x::AbstractFloat, n::Integer)

The result of n iterative applications of nextfloat to x if n >= 0, or -n applications of prevfloat if n < 0.

source
Base.prevfloatFunction
prevfloat(x::AbstractFloat)

Return the largest floating point number y of the same type as x such that y < x. If no such y exists (e.g. if x is -Inf or NaN), then return x.

source
prevfloat(x::AbstractFloat, n::Integer)

The result of n iterative applications of prevfloat to x if n >= 0, or -n applications of nextfloat if n < 0.

source
Base.isintegerFunction
isinteger(x) -> Bool

Test whether x is numerically equal to some integer.

Examples

julia> isinteger(4.0)
-true
source
Base.isrealFunction
isreal(x) -> Bool

Test whether x or all its elements are numerically equal to some real number including infinities and NaNs. isreal(x) is true if isequal(x, real(x)) is true.

Examples

julia> isreal(5.)
+true
source
Base.nextfloatFunction
nextfloat(x::AbstractFloat)

Return the smallest floating point number y of the same type as x such that x < y. If no such y exists (e.g. if x is Inf or NaN), then return x.

See also: prevfloat, eps, issubnormal.

source
nextfloat(x::AbstractFloat, n::Integer)

The result of n iterative applications of nextfloat to x if n >= 0, or -n applications of prevfloat if n < 0.

source
Base.prevfloatFunction
prevfloat(x::AbstractFloat)

Return the largest floating point number y of the same type as x such that y < x. If no such y exists (e.g. if x is -Inf or NaN), then return x.

source
prevfloat(x::AbstractFloat, n::Integer)

The result of n iterative applications of prevfloat to x if n >= 0, or -n applications of nextfloat if n < 0.

source
Base.isintegerFunction
isinteger(x) -> Bool

Test whether x is numerically equal to some integer.

Examples

julia> isinteger(4.0)
+true
source
Base.isrealFunction
isreal(x) -> Bool

Test whether x or all its elements are numerically equal to some real number including infinities and NaNs. isreal(x) is true if isequal(x, real(x)) is true.

Examples

julia> isreal(5.)
 true
 
 julia> isreal(1 - 3im)
@@ -338,48 +338,48 @@
 true
 
 julia> isreal([4.; complex(0,1)])
-false
source
Core.Float32Method
Float32(x [, mode::RoundingMode])

Create a Float32 from x. If x is not exactly representable then mode determines how x is rounded.

Examples

julia> Float32(1/3, RoundDown)
+false
source
Core.Float32Method
Float32(x [, mode::RoundingMode])

Create a Float32 from x. If x is not exactly representable then mode determines how x is rounded.

Examples

julia> Float32(1/3, RoundDown)
 0.3333333f0
 
 julia> Float32(1/3, RoundUp)
-0.33333334f0

See RoundingMode for available rounding modes.

source
Core.Float64Method
Float64(x [, mode::RoundingMode])

Create a Float64 from x. If x is not exactly representable then mode determines how x is rounded.

Examples

julia> Float64(pi, RoundDown)
+0.33333334f0

See RoundingMode for available rounding modes.

source
Core.Float64Method
Float64(x [, mode::RoundingMode])

Create a Float64 from x. If x is not exactly representable then mode determines how x is rounded.

Examples

julia> Float64(pi, RoundDown)
 3.141592653589793
 
 julia> Float64(pi, RoundUp)
-3.1415926535897936

See RoundingMode for available rounding modes.

source
Base.Rounding.roundingFunction
rounding(T)

Get the current floating point rounding mode for type T, controlling the rounding of basic arithmetic functions (+, -, *, / and sqrt) and type conversion.

See RoundingMode for available modes.

source
Base.Rounding.setroundingMethod
setrounding(T, mode)

Set the rounding mode of floating point type T, controlling the rounding of basic arithmetic functions (+, -, *, / and sqrt) and type conversion. Other numerical functions may give incorrect or invalid values when using rounding modes other than the default RoundNearest.

Note that this is currently only supported for T == BigFloat.

Warning

This function is not thread-safe. It will affect code running on all threads, but its behavior is undefined if called concurrently with computations that use the setting.

source
Base.Rounding.setroundingMethod
setrounding(f::Function, T, mode)

Change the rounding mode of floating point type T for the duration of f. It is logically equivalent to:

old = rounding(T)
+3.1415926535897936

See RoundingMode for available rounding modes.

source
Base.Rounding.roundingFunction
rounding(T)

Get the current floating point rounding mode for type T, controlling the rounding of basic arithmetic functions (+, -, *, / and sqrt) and type conversion.

See RoundingMode for available modes.

source
Base.Rounding.setroundingMethod
setrounding(T, mode)

Set the rounding mode of floating point type T, controlling the rounding of basic arithmetic functions (+, -, *, / and sqrt) and type conversion. Other numerical functions may give incorrect or invalid values when using rounding modes other than the default RoundNearest.

Note that this is currently only supported for T == BigFloat.

Warning

This function is not thread-safe. It will affect code running on all threads, but its behavior is undefined if called concurrently with computations that use the setting.

source
Base.Rounding.setroundingMethod
setrounding(f::Function, T, mode)

Change the rounding mode of floating point type T for the duration of f. It is logically equivalent to:

old = rounding(T)
 setrounding(T, mode)
 f()
-setrounding(T, old)

See RoundingMode for available rounding modes.

source
Base.Rounding.get_zero_subnormalsFunction
get_zero_subnormals() -> Bool

Return false if operations on subnormal floating-point values ("denormals") obey rules for IEEE arithmetic, and true if they might be converted to zeros.

Warning

This function only affects the current thread.

source
Base.Rounding.set_zero_subnormalsFunction
set_zero_subnormals(yes::Bool) -> Bool

If yes is false, subsequent floating-point operations follow rules for IEEE arithmetic on subnormal values ("denormals"). Otherwise, floating-point operations are permitted (but not required) to convert subnormal inputs or outputs to zero. Returns true unless yes==true but the hardware does not support zeroing of subnormal numbers.

set_zero_subnormals(true) can speed up some computations on some hardware. However, it can break identities such as (x-y==0) == (x==y).

Warning

This function only affects the current thread.

source

Integers

Base.count_onesFunction
count_ones(x::Integer) -> Integer

Number of ones in the binary representation of x.

Examples

julia> count_ones(7)
+setrounding(T, old)

See RoundingMode for available rounding modes.

source
Base.Rounding.get_zero_subnormalsFunction
get_zero_subnormals() -> Bool

Return false if operations on subnormal floating-point values ("denormals") obey rules for IEEE arithmetic, and true if they might be converted to zeros.

Warning

This function only affects the current thread.

source
Base.Rounding.set_zero_subnormalsFunction
set_zero_subnormals(yes::Bool) -> Bool

If yes is false, subsequent floating-point operations follow rules for IEEE arithmetic on subnormal values ("denormals"). Otherwise, floating-point operations are permitted (but not required) to convert subnormal inputs or outputs to zero. Returns true unless yes==true but the hardware does not support zeroing of subnormal numbers.

set_zero_subnormals(true) can speed up some computations on some hardware. However, it can break identities such as (x-y==0) == (x==y).

Warning

This function only affects the current thread.

source

Integers

Base.count_onesFunction
count_ones(x::Integer) -> Integer

Number of ones in the binary representation of x.

Examples

julia> count_ones(7)
 3
 
 julia> count_ones(Int32(-1))
-32
source
Base.count_zerosFunction
count_zeros(x::Integer) -> Integer

Number of zeros in the binary representation of x.

Examples

julia> count_zeros(Int32(2 ^ 16 - 1))
+32
source
Base.count_zerosFunction
count_zeros(x::Integer) -> Integer

Number of zeros in the binary representation of x.

Examples

julia> count_zeros(Int32(2 ^ 16 - 1))
 16
 
 julia> count_zeros(-1)
-0
source
Base.leading_zerosFunction
leading_zeros(x::Integer) -> Integer

Number of zeros leading the binary representation of x.

Examples

julia> leading_zeros(Int32(1))
-31
source
Base.leading_onesFunction
leading_ones(x::Integer) -> Integer

Number of ones leading the binary representation of x.

Examples

julia> leading_ones(UInt32(2 ^ 32 - 2))
-31
source
Base.trailing_zerosFunction
trailing_zeros(x::Integer) -> Integer

Number of zeros trailing the binary representation of x.

Examples

julia> trailing_zeros(2)
-1
source
Base.trailing_onesFunction
trailing_ones(x::Integer) -> Integer

Number of ones trailing the binary representation of x.

Examples

julia> trailing_ones(3)
-2
source
Base.isoddFunction
isodd(x::Number) -> Bool

Return true if x is an odd integer (that is, an integer not divisible by 2), and false otherwise.

Julia 1.7

Non-Integer arguments require Julia 1.7 or later.

Examples

julia> isodd(9)
+0
source
Base.leading_zerosFunction
leading_zeros(x::Integer) -> Integer

Number of zeros leading the binary representation of x.

Examples

julia> leading_zeros(Int32(1))
+31
source
Base.leading_onesFunction
leading_ones(x::Integer) -> Integer

Number of ones leading the binary representation of x.

Examples

julia> leading_ones(UInt32(2 ^ 32 - 2))
+31
source
Base.trailing_zerosFunction
trailing_zeros(x::Integer) -> Integer

Number of zeros trailing the binary representation of x.

Examples

julia> trailing_zeros(2)
+1
source
Base.trailing_onesFunction
trailing_ones(x::Integer) -> Integer

Number of ones trailing the binary representation of x.

Examples

julia> trailing_ones(3)
+2
source
Base.isoddFunction
isodd(x::Number) -> Bool

Return true if x is an odd integer (that is, an integer not divisible by 2), and false otherwise.

Julia 1.7

Non-Integer arguments require Julia 1.7 or later.

Examples

julia> isodd(9)
 true
 
 julia> isodd(10)
-false
source
Base.isevenFunction
iseven(x::Number) -> Bool

Return true if x is an even integer (that is, an integer divisible by 2), and false otherwise.

Julia 1.7

Non-Integer arguments require Julia 1.7 or later.

Examples

julia> iseven(9)
+false
source
Base.isevenFunction
iseven(x::Number) -> Bool

Return true if x is an even integer (that is, an integer divisible by 2), and false otherwise.

Julia 1.7

Non-Integer arguments require Julia 1.7 or later.

Examples

julia> iseven(9)
 false
 
 julia> iseven(10)
-true
source
Core.@int128_strMacro
@int128_str str

Parse str as an Int128. Throw an ArgumentError if the string is not a valid integer.

Examples

julia> int128"123456789123"
+true
source
Core.@int128_strMacro
@int128_str str

Parse str as an Int128. Throw an ArgumentError if the string is not a valid integer.

Examples

julia> int128"123456789123"
 123456789123
 
 julia> int128"123456789123.4"
 ERROR: LoadError: ArgumentError: invalid base 10 digit '.' in "123456789123.4"
-[...]
source
Core.@uint128_strMacro
@uint128_str str

Parse str as an UInt128. Throw an ArgumentError if the string is not a valid integer.

Examples

julia> uint128"123456789123"
+[...]
source
Core.@uint128_strMacro
@uint128_str str

Parse str as an UInt128. Throw an ArgumentError if the string is not a valid integer.

Examples

julia> uint128"123456789123"
 0x00000000000000000000001cbe991a83
 
 julia> uint128"-123456789123"
 ERROR: LoadError: ArgumentError: invalid base 10 digit '-' in "-123456789123"
-[...]
source

BigFloats and BigInts

The BigFloat and BigInt types implements arbitrary-precision floating point and integer arithmetic, respectively. For BigFloat the GNU MPFR library is used, and for BigInt the GNU Multiple Precision Arithmetic Library (GMP) is used.

Base.MPFR.BigFloatMethod
BigFloat(x::Union{Real, AbstractString} [, rounding::RoundingMode=rounding(BigFloat)]; [precision::Integer=precision(BigFloat)])

Create an arbitrary precision floating point number from x, with precision precision. The rounding argument specifies the direction in which the result should be rounded if the conversion cannot be done exactly. If not provided, these are set by the current global values.

BigFloat(x::Real) is the same as convert(BigFloat,x), except if x itself is already BigFloat, in which case it will return a value with the precision set to the current global precision; convert will always return x.

BigFloat(x::AbstractString) is identical to parse. This is provided for convenience since decimal literals are converted to Float64 when parsed, so BigFloat(2.1) may not yield what you expect.

See also:

Julia 1.1

precision as a keyword argument requires at least Julia 1.1. In Julia 1.0 precision is the second positional argument (BigFloat(x, precision)).

Examples

julia> BigFloat(2.1) # 2.1 here is a Float64
+[...]
source

BigFloats and BigInts

The BigFloat and BigInt types implements arbitrary-precision floating point and integer arithmetic, respectively. For BigFloat the GNU MPFR library is used, and for BigInt the GNU Multiple Precision Arithmetic Library (GMP) is used.

Base.MPFR.BigFloatMethod
BigFloat(x::Union{Real, AbstractString} [, rounding::RoundingMode=rounding(BigFloat)]; [precision::Integer=precision(BigFloat)])

Create an arbitrary precision floating point number from x, with precision precision. The rounding argument specifies the direction in which the result should be rounded if the conversion cannot be done exactly. If not provided, these are set by the current global values.

BigFloat(x::Real) is the same as convert(BigFloat,x), except if x itself is already BigFloat, in which case it will return a value with the precision set to the current global precision; convert will always return x.

BigFloat(x::AbstractString) is identical to parse. This is provided for convenience since decimal literals are converted to Float64 when parsed, so BigFloat(2.1) may not yield what you expect.

See also:

Julia 1.1

precision as a keyword argument requires at least Julia 1.1. In Julia 1.0 precision is the second positional argument (BigFloat(x, precision)).

Examples

julia> BigFloat(2.1) # 2.1 here is a Float64
 2.100000000000000088817841970012523233890533447265625
 
 julia> BigFloat("2.1") # the closest BigFloat to 2.1
@@ -389,18 +389,18 @@
 2.100000000000000000000000000000000000000000000000000000000000000000000000000021
 
 julia> BigFloat("2.1", RoundUp, precision=128)
-2.100000000000000000000000000000000000007
source
Base.precisionFunction
precision(num::AbstractFloat; base::Integer=2)
-precision(T::Type; base::Integer=2)

Get the precision of a floating point number, as defined by the effective number of bits in the significand, or the precision of a floating-point type T (its current default, if T is a variable-precision type like BigFloat).

If base is specified, then it returns the maximum corresponding number of significand digits in that base.

Julia 1.8

The base keyword requires at least Julia 1.8.

source
Base.MPFR.setprecisionFunction
setprecision(f::Function, [T=BigFloat,] precision::Integer; base=2)

Change the T arithmetic precision (in the given base) for the duration of f. It is logically equivalent to:

old = precision(BigFloat)
+2.100000000000000000000000000000000000007
source
Base.precisionFunction
precision(num::AbstractFloat; base::Integer=2)
+precision(T::Type; base::Integer=2)

Get the precision of a floating point number, as defined by the effective number of bits in the significand, or the precision of a floating-point type T (its current default, if T is a variable-precision type like BigFloat).

If base is specified, then it returns the maximum corresponding number of significand digits in that base.

Julia 1.8

The base keyword requires at least Julia 1.8.

source
Base.MPFR.setprecisionFunction
setprecision(f::Function, [T=BigFloat,] precision::Integer; base=2)

Change the T arithmetic precision (in the given base) for the duration of f. It is logically equivalent to:

old = precision(BigFloat)
 setprecision(BigFloat, precision)
 f()
-setprecision(BigFloat, old)

Often used as setprecision(T, precision) do ... end

Note: nextfloat(), prevfloat() do not use the precision mentioned by setprecision.

Julia 1.8

The base keyword requires at least Julia 1.8.

source
setprecision([T=BigFloat,] precision::Int; base=2)

Set the precision (in bits, by default) to be used for T arithmetic. If base is specified, then the precision is the minimum required to give at least precision digits in the given base.

Warning

This function is not thread-safe. It will affect code running on all threads, but its behavior is undefined if called concurrently with computations that use the setting.

Julia 1.8

The base keyword requires at least Julia 1.8.

source
Base.GMP.BigIntMethod
BigInt(x)

Create an arbitrary precision integer. x may be an Int (or anything that can be converted to an Int). The usual mathematical operators are defined for this type, and results are promoted to a BigInt.

Instances can be constructed from strings via parse, or using the big string literal.

Examples

julia> parse(BigInt, "42")
+setprecision(BigFloat, old)

Often used as setprecision(T, precision) do ... end

Note: nextfloat(), prevfloat() do not use the precision mentioned by setprecision.

Julia 1.8

The base keyword requires at least Julia 1.8.

source
setprecision([T=BigFloat,] precision::Int; base=2)

Set the precision (in bits, by default) to be used for T arithmetic. If base is specified, then the precision is the minimum required to give at least precision digits in the given base.

Warning

This function is not thread-safe. It will affect code running on all threads, but its behavior is undefined if called concurrently with computations that use the setting.

Julia 1.8

The base keyword requires at least Julia 1.8.

source
Base.GMP.BigIntMethod
BigInt(x)

Create an arbitrary precision integer. x may be an Int (or anything that can be converted to an Int). The usual mathematical operators are defined for this type, and results are promoted to a BigInt.

Instances can be constructed from strings via parse, or using the big string literal.

Examples

julia> parse(BigInt, "42")
 42
 
 julia> big"313"
 313
 
 julia> BigInt(10)^19
-10000000000000000000
source
Core.@big_strMacro
@big_str str

Parse a string into a BigInt or BigFloat, and throw an ArgumentError if the string is not a valid number. For integers _ is allowed in the string as a separator.

Examples

julia> big"123_456"
+10000000000000000000
source
Core.@big_strMacro
@big_str str

Parse a string into a BigInt or BigFloat, and throw an ArgumentError if the string is not a valid number. For integers _ is allowed in the string as a separator.

Examples

julia> big"123_456"
 123456
 
 julia> big"7891.5"
@@ -408,4 +408,4 @@
 
 julia> big"_"
 ERROR: ArgumentError: invalid number format _ for BigInt or BigFloat
-[...]
Warning

Using @big_str for constructing BigFloat values may not result in the behavior that might be naively expected: as a macro, @big_str obeys the global precision (setprecision) and rounding mode (setrounding) settings as they are at load time. Thus, a function like () -> precision(big"0.3") returns a constant whose value depends on the value of the precision at the point when the function is defined, not at the precision at the time when the function is called.

source
+[...]
Warning

Using @big_str for constructing BigFloat values may not result in the behavior that might be naively expected: as a macro, @big_str obeys the global precision (setprecision) and rounding mode (setrounding) settings as they are at load time. Thus, a function like () -> precision(big"0.3") returns a constant whose value depends on the value of the precision at the point when the function is defined, not at the precision at the time when the function is called.

source diff --git a/en/v1.12-dev/base/parallel/index.html b/en/v1.12-dev/base/parallel/index.html index dcc45d2c8ca..1a3934f1a1f 100644 --- a/en/v1.12-dev/base/parallel/index.html +++ b/en/v1.12-dev/base/parallel/index.html @@ -5,7 +5,7 @@ gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash});

Tasks

Core.TaskType
Task(func[, reserved_stack::Int])

Create a Task (i.e. coroutine) to execute the given function func (which must be callable with no arguments). The task exits when this function returns. The task will run in the "world age" from the parent at construction when scheduled.

The optional reserved_stack argument specifies the size of the stack available for this task, in bytes. The default, 0, uses the system-dependent stack size default.

Warning

By default tasks will have the sticky bit set to true t.sticky. This models the historic default for @async. Sticky tasks can only be run on the worker thread they are first scheduled on, and when scheduled will make the task that they were scheduled from sticky. To obtain the behavior of Threads.@spawn set the sticky bit manually to false.

Examples

julia> a() = sum(i for i in 1:1000);
 
-julia> b = Task(a);

In this example, b is a runnable Task that hasn't started yet.

source
Base.@taskMacro
@task

Wrap an expression in a Task without executing it, and return the Task. This only creates a task, and does not run it.

Warning

By default tasks will have the sticky bit set to true t.sticky. This models the historic default for @async. Sticky tasks can only be run on the worker thread they are first scheduled on, and when scheduled will make the task that they were scheduled from sticky. To obtain the behavior of Threads.@spawn set the sticky bit manually to false.

Examples

julia> a1() = sum(i for i in 1:1000);
+julia> b = Task(a);

In this example, b is a runnable Task that hasn't started yet.

source
Base.@taskMacro
@task

Wrap an expression in a Task without executing it, and return the Task. This only creates a task, and does not run it.

Warning

By default tasks will have the sticky bit set to true t.sticky. This models the historic default for @async. Sticky tasks can only be run on the worker thread they are first scheduled on, and when scheduled will make the task that they were scheduled from sticky. To obtain the behavior of Threads.@spawn set the sticky bit manually to false.

Examples

julia> a1() = sum(i for i in 1:1000);
 
 julia> b = @task a1();
 
@@ -17,7 +17,7 @@
 julia> yield();
 
 julia> istaskdone(b)
-true
source
Base.@asyncMacro
@async

Wrap an expression in a Task and add it to the local machine's scheduler queue.

Values can be interpolated into @async via $, which copies the value directly into the constructed underlying closure. This allows you to insert the value of a variable, isolating the asynchronous code from changes to the variable's value in the current task.

Warning

It is strongly encouraged to favor Threads.@spawn over @async always even when no parallelism is required especially in publicly distributed libraries. This is because a use of @async disables the migration of the parent task across worker threads in the current implementation of Julia. Thus, seemingly innocent use of @async in a library function can have a large impact on the performance of very different parts of user applications.

Julia 1.4

Interpolating values via $ is available as of Julia 1.4.

source
Base.asyncmapFunction
asyncmap(f, c...; ntasks=0, batch_size=nothing)

Uses multiple concurrent tasks to map f over a collection (or multiple equal length collections). For multiple collection arguments, f is applied elementwise.

The output is guaranteed to be the same order as the elements of the collection(s) c.

ntasks specifies the number of tasks to run concurrently. Depending on the length of the collections, if ntasks is unspecified, up to 100 tasks will be used for concurrent mapping.

ntasks can also be specified as a zero-arg function. In this case, the number of tasks to run in parallel is checked before processing every element and a new task started if the value of ntasks_func is greater than the current number of tasks.

If batch_size is specified, the collection is processed in batch mode. f must then be a function that must accept a Vector of argument tuples and must return a vector of results. The input vector will have a length of batch_size or less.

The following examples highlight execution in different tasks by returning the objectid of the tasks in which the mapping function is executed.

First, with ntasks undefined, each element is processed in a different task.

julia> tskoid() = objectid(current_task());
+true
source
Base.@asyncMacro
@async

Wrap an expression in a Task and add it to the local machine's scheduler queue.

Values can be interpolated into @async via $, which copies the value directly into the constructed underlying closure. This allows you to insert the value of a variable, isolating the asynchronous code from changes to the variable's value in the current task.

Warning

It is strongly encouraged to favor Threads.@spawn over @async always even when no parallelism is required especially in publicly distributed libraries. This is because a use of @async disables the migration of the parent task across worker threads in the current implementation of Julia. Thus, seemingly innocent use of @async in a library function can have a large impact on the performance of very different parts of user applications.

Julia 1.4

Interpolating values via $ is available as of Julia 1.4.

source
Base.asyncmapFunction
asyncmap(f, c...; ntasks=0, batch_size=nothing)

Uses multiple concurrent tasks to map f over a collection (or multiple equal length collections). For multiple collection arguments, f is applied elementwise.

The output is guaranteed to be the same order as the elements of the collection(s) c.

ntasks specifies the number of tasks to run concurrently. Depending on the length of the collections, if ntasks is unspecified, up to 100 tasks will be used for concurrent mapping.

ntasks can also be specified as a zero-arg function. In this case, the number of tasks to run in parallel is checked before processing every element and a new task started if the value of ntasks_func is greater than the current number of tasks.

If batch_size is specified, the collection is processed in batch mode. f must then be a function that must accept a Vector of argument tuples and must return a vector of results. The input vector will have a length of batch_size or less.

The following examples highlight execution in different tasks by returning the objectid of the tasks in which the mapping function is executed.

First, with ntasks undefined, each element is processed in a different task.

julia> tskoid() = objectid(current_task());
 
 julia> asyncmap(x->tskoid(), 1:5)
 5-element Vector{UInt64}:
@@ -46,7 +46,7 @@
  "args_tuple: (2,), element_val: 2, task: 4904288162898683522"
  "args_tuple: (3,), element_val: 3, task: 9118321258196414413"
  "args_tuple: (4,), element_val: 4, task: 4904288162898683522"
- "args_tuple: (5,), element_val: 5, task: 9118321258196414413"
source
Base.asyncmap!Function
asyncmap!(f, results, c...; ntasks=0, batch_size=nothing)

Like asyncmap, but stores output in results rather than returning a collection.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.istaskdoneFunction
istaskdone(t::Task) -> Bool

Determine whether a task has exited.

Examples

julia> a2() = sum(i for i in 1:1000);
+ "args_tuple: (5,), element_val: 5, task: 9118321258196414413"
source
Base.asyncmap!Function
asyncmap!(f, results, c...; ntasks=0, batch_size=nothing)

Like asyncmap, but stores output in results rather than returning a collection.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

source
Base.istaskdoneFunction
istaskdone(t::Task) -> Bool

Determine whether a task has exited.

Examples

julia> a2() = sum(i for i in 1:1000);
 
 julia> b = Task(a2);
 
@@ -58,12 +58,12 @@
 julia> yield();
 
 julia> istaskdone(b)
-true
source
Base.istaskstartedFunction
istaskstarted(t::Task) -> Bool

Determine whether a task has started executing.

Examples

julia> a3() = sum(i for i in 1:1000);
+true
source
Base.istaskstartedFunction
istaskstarted(t::Task) -> Bool

Determine whether a task has started executing.

Examples

julia> a3() = sum(i for i in 1:1000);
 
 julia> b = Task(a3);
 
 julia> istaskstarted(b)
-false
source
Base.istaskfailedFunction
istaskfailed(t::Task) -> Bool

Determine whether a task has exited because an exception was thrown.

Examples

julia> a4() = error("task failed");
+false
source
Base.istaskfailedFunction
istaskfailed(t::Task) -> Bool

Determine whether a task has exited because an exception was thrown.

Examples

julia> a4() = error("task failed");
 
 julia> b = Task(a4);
 
@@ -75,7 +75,7 @@
 julia> yield();
 
 julia> istaskfailed(b)
-true
Julia 1.3

This function requires at least Julia 1.3.

source
Base.task_local_storageMethod
task_local_storage(body, key, value)

Call the function body with a modified task-local storage, in which value is assigned to key; the previous value of key, or lack thereof, is restored afterwards. Useful for emulating dynamic scoping.

source
Core.ConcurrencyViolationErrorType
ConcurrencyViolationError(msg) <: Exception

An error thrown when a detectable violation of concurrent semantics has occurred.

A non-exhaustive list of examples of when this is used include:

  • Throwing when a deadlock has been detected (e.g. wait(current_task()))
  • Known-unsafe behavior is attempted (e.g. yield(current_task))
  • A known non-threadsafe datastructure is attempted to be modified from multiple concurrent tasks
  • A lock is being unlocked that wasn't locked by this task
source

Scheduling

Base.yieldFunction
yield(t::Task, arg = nothing)

A fast, unfair-scheduling version of schedule(t, arg); yield() which immediately yields to t before calling the scheduler.

Throws a ConcurrencyViolationError if t is the currently running task.

source
yield()

Switch to the scheduler to allow another scheduled task to run. A task that calls this function is still runnable, and will be restarted immediately if there are no other runnable tasks.

source
Base.yieldtoFunction
yieldto(t::Task, arg = nothing)

Switch to the given task. The first time a task is switched to, the task's function is called with no arguments. On subsequent switches, arg is returned from the task's last call to yieldto. This is a low-level call that only switches tasks, not considering states or scheduling in any way. Its use is discouraged.

source
Base.sleepFunction
sleep(seconds)

Block the current task for a specified number of seconds. The minimum sleep time is 1 millisecond or input of 0.001.

source
Base.scheduleFunction
schedule(t::Task, [val]; error=false)

Add a Task to the scheduler's queue. This causes the task to run constantly when the system is otherwise idle, unless the task performs a blocking operation such as wait.

If a second argument val is provided, it will be passed to the task (via the return value of yieldto) when it runs again. If error is true, the value is raised as an exception in the woken task.

Warning

It is incorrect to use schedule on an arbitrary Task that has already been started. See the API reference for more information.

Warning

By default tasks will have the sticky bit set to true t.sticky. This models the historic default for @async. Sticky tasks can only be run on the worker thread they are first scheduled on, and when scheduled will make the task that they were scheduled from sticky. To obtain the behavior of Threads.@spawn set the sticky bit manually to false.

Examples

julia> a5() = sum(i for i in 1:1000);
+true
Julia 1.3

This function requires at least Julia 1.3.

source
Base.task_local_storageMethod
task_local_storage(body, key, value)

Call the function body with a modified task-local storage, in which value is assigned to key; the previous value of key, or lack thereof, is restored afterwards. Useful for emulating dynamic scoping.

source
Core.ConcurrencyViolationErrorType
ConcurrencyViolationError(msg) <: Exception

An error thrown when a detectable violation of concurrent semantics has occurred.

A non-exhaustive list of examples of when this is used include:

  • Throwing when a deadlock has been detected (e.g. wait(current_task()))
  • Known-unsafe behavior is attempted (e.g. yield(current_task))
  • A known non-threadsafe datastructure is attempted to be modified from multiple concurrent tasks
  • A lock is being unlocked that wasn't locked by this task
source

Scheduling

Base.yieldFunction
yield(t::Task, arg = nothing)

A fast, unfair-scheduling version of schedule(t, arg); yield() which immediately yields to t before calling the scheduler.

Throws a ConcurrencyViolationError if t is the currently running task.

source
yield()

Switch to the scheduler to allow another scheduled task to run. A task that calls this function is still runnable, and will be restarted immediately if there are no other runnable tasks.

source
Base.yieldtoFunction
yieldto(t::Task, arg = nothing)

Switch to the given task. The first time a task is switched to, the task's function is called with no arguments. On subsequent switches, arg is returned from the task's last call to yieldto. This is a low-level call that only switches tasks, not considering states or scheduling in any way. Its use is discouraged.

source
Base.sleepFunction
sleep(seconds)

Block the current task for a specified number of seconds. The minimum sleep time is 1 millisecond or input of 0.001.

source
Base.scheduleFunction
schedule(t::Task, [val]; error=false)

Add a Task to the scheduler's queue. This causes the task to run constantly when the system is otherwise idle, unless the task performs a blocking operation such as wait.

If a second argument val is provided, it will be passed to the task (via the return value of yieldto) when it runs again. If error is true, the value is raised as an exception in the woken task.

Warning

It is incorrect to use schedule on an arbitrary Task that has already been started. See the API reference for more information.

Warning

By default tasks will have the sticky bit set to true t.sticky. This models the historic default for @async. Sticky tasks can only be run on the worker thread they are first scheduled on, and when scheduled will make the task that they were scheduled from sticky. To obtain the behavior of Threads.@spawn set the sticky bit manually to false.

Examples

julia> a5() = sum(i for i in 1:1000);
 
 julia> b = Task(a5);
 
@@ -90,10 +90,10 @@
 true
 
 julia> istaskdone(b)
-true
source

Synchronization

Base.errormonitorFunction
errormonitor(t::Task)

Print an error log to stderr if task t fails.

Examples

julia> wait(errormonitor(Threads.@spawn error("task failed")); throw = false)
+true
source

Synchronization

Base.errormonitorFunction
errormonitor(t::Task)

Print an error log to stderr if task t fails.

Examples

julia> wait(errormonitor(Threads.@spawn error("task failed")); throw = false)
 Unhandled Task ERROR: task failed
 Stacktrace:
-[...]
source
Base.@syncMacro
@sync

Wait until all lexically-enclosed uses of @async, @spawn, Distributed.@spawnat and Distributed.@distributed are complete. All exceptions thrown by enclosed async operations are collected and thrown as a CompositeException.

Examples

julia> Threads.nthreads()
+[...]
source
Base.@syncMacro
@sync

Wait until all lexically-enclosed uses of @async, @spawn, Distributed.@spawnat and Distributed.@distributed are complete. All exceptions thrown by enclosed async operations are collected and thrown as a CompositeException.

Examples

julia> Threads.nthreads()
 4
 
 julia> @sync begin
@@ -101,7 +101,7 @@
            Threads.@spawn println("Thread-id $(Threads.threadid()), task 2")
        end;
 Thread-id 3, task 1
-Thread-id 1, task 2
source
Base.waitFunction
wait([x])

Block the current task until some event occurs.

  • Channel: Wait for a value to be appended to the channel.
  • Condition: Wait for notify on a condition and return the val parameter passed to notify. See the Condition-specific docstring of wait for the exact behavior.
  • Process: Wait for a process or process chain to exit. The exitcode field of a process can be used to determine success or failure.
  • Task: Wait for a Task to finish. See the Task-specific docstring of wait for the exact behavior.
  • RawFD: Wait for changes on a file descriptor (see the FileWatching package).

If no argument is passed, the task blocks for an undefined period. A task can only be restarted by an explicit call to schedule or yieldto.

Often wait is called within a while loop to ensure a waited-for condition is met before proceeding.

source
Base.waitanyFunction
waitany(tasks; throw=true) -> (done_tasks, remaining_tasks)

Wait until at least one of the given tasks have been completed.

If throw is true, throw CompositeException when one of the completed tasks completes with an exception.

The return value consists of two task vectors. The first one consists of completed tasks, and the other consists of uncompleted tasks.

Warning

This may scale poorly compared to writing code that uses multiple individual tasks that each runs serially, since this needs to scan the list of tasks each time and synchronize with each one every time this is called. Or consider using waitall(tasks; failfast=true) instead.

source
Base.waitallFunction
waitall(tasks; failfast=true, throw=true) -> (done_tasks, remaining_tasks)

Wait until all the given tasks have been completed.

If failfast is true, the function will return when at least one of the given tasks is finished by exception. If throw is true, throw CompositeException when one of the completed tasks has failed.

failfast and throw keyword arguments work independently; when only throw=true is specified, this function waits for all the tasks to complete.

The return value consists of two task vectors. The first one consists of completed tasks, and the other consists of uncompleted tasks.

source
Base.fetchMethod
fetch(t::Task)

Wait for a Task to finish, then return its result value. If the task fails with an exception, a TaskFailedException (which wraps the failed task) is thrown.

source
Base.timedwaitFunction
timedwait(testcb, timeout::Real; pollint::Real=0.1)

Wait until testcb() returns true or timeout seconds have passed, whichever is earlier. The test function is polled every pollint seconds. The minimum value for pollint is 0.001 seconds, that is, 1 millisecond.

Return :ok or :timed_out.

Examples

julia> cb() = (sleep(5); return);
+Thread-id 1, task 2
source
Base.waitFunction
wait([x])

Block the current task until some event occurs.

  • Channel: Wait for a value to be appended to the channel.
  • Condition: Wait for notify on a condition and return the val parameter passed to notify. See the Condition-specific docstring of wait for the exact behavior.
  • Process: Wait for a process or process chain to exit. The exitcode field of a process can be used to determine success or failure.
  • Task: Wait for a Task to finish. See the Task-specific docstring of wait for the exact behavior.
  • RawFD: Wait for changes on a file descriptor (see the FileWatching package).

If no argument is passed, the task blocks for an undefined period. A task can only be restarted by an explicit call to schedule or yieldto.

Often wait is called within a while loop to ensure a waited-for condition is met before proceeding.

source
Base.waitanyFunction
waitany(tasks; throw=true) -> (done_tasks, remaining_tasks)

Wait until at least one of the given tasks have been completed.

If throw is true, throw CompositeException when one of the completed tasks completes with an exception.

The return value consists of two task vectors. The first one consists of completed tasks, and the other consists of uncompleted tasks.

Warning

This may scale poorly compared to writing code that uses multiple individual tasks that each runs serially, since this needs to scan the list of tasks each time and synchronize with each one every time this is called. Or consider using waitall(tasks; failfast=true) instead.

source
Base.waitallFunction
waitall(tasks; failfast=true, throw=true) -> (done_tasks, remaining_tasks)

Wait until all the given tasks have been completed.

If failfast is true, the function will return when at least one of the given tasks is finished by exception. If throw is true, throw CompositeException when one of the completed tasks has failed.

failfast and throw keyword arguments work independently; when only throw=true is specified, this function waits for all the tasks to complete.

The return value consists of two task vectors. The first one consists of completed tasks, and the other consists of uncompleted tasks.

source
Base.fetchMethod
fetch(t::Task)

Wait for a Task to finish, then return its result value. If the task fails with an exception, a TaskFailedException (which wraps the failed task) is thrown.

source
Base.timedwaitFunction
timedwait(testcb, timeout::Real; pollint::Real=0.1)

Wait until testcb() returns true or timeout seconds have passed, whichever is earlier. The test function is polled every pollint seconds. The minimum value for pollint is 0.001 seconds, that is, 1 millisecond.

Return :ok or :timed_out.

Examples

julia> cb() = (sleep(5); return);
 
 julia> t = @async cb();
 
@@ -109,21 +109,21 @@
 :timed_out
 
 julia> timedwait(()->istaskdone(t), 6.5)
-:ok
source
Base.ConditionType
Condition()

Create an edge-triggered event source that tasks can wait for. Tasks that call wait on a Condition are suspended and queued. Tasks are woken up when notify is later called on the Condition. Waiting on a condition can return a value or raise an error if the optional arguments of notify are used. Edge triggering means that only tasks waiting at the time notify is called can be woken up. For level-triggered notifications, you must keep extra state to keep track of whether a notification has happened. The Channel and Threads.Event types do this, and can be used for level-triggered events.

This object is NOT thread-safe. See Threads.Condition for a thread-safe version.

source
Base.Threads.ConditionType
Threads.Condition([lock])

A thread-safe version of Base.Condition.

To call wait or notify on a Threads.Condition, you must first call lock on it. When wait is called, the lock is atomically released during blocking, and will be reacquired before wait returns. Therefore idiomatic use of a Threads.Condition c looks like the following:

lock(c)
+:ok
source
Base.ConditionType
Condition()

Create an edge-triggered event source that tasks can wait for. Tasks that call wait on a Condition are suspended and queued. Tasks are woken up when notify is later called on the Condition. Waiting on a condition can return a value or raise an error if the optional arguments of notify are used. Edge triggering means that only tasks waiting at the time notify is called can be woken up. For level-triggered notifications, you must keep extra state to keep track of whether a notification has happened. The Channel and Threads.Event types do this, and can be used for level-triggered events.

This object is NOT thread-safe. See Threads.Condition for a thread-safe version.

source
Base.Threads.ConditionType
Threads.Condition([lock])

A thread-safe version of Base.Condition.

To call wait or notify on a Threads.Condition, you must first call lock on it. When wait is called, the lock is atomically released during blocking, and will be reacquired before wait returns. Therefore idiomatic use of a Threads.Condition c looks like the following:

lock(c)
 try
     while !thing_we_are_waiting_for
         wait(c)
     end
 finally
     unlock(c)
-end
Julia 1.2

This functionality requires at least Julia 1.2.

source
Base.EventType
Event([autoreset=false])

Create a level-triggered event source. Tasks that call wait on an Event are suspended and queued until notify is called on the Event. After notify is called, the Event remains in a signaled state and tasks will no longer block when waiting for it, until reset is called.

If autoreset is true, at most one task will be released from wait for each call to notify.

This provides an acquire & release memory ordering on notify/wait.

Julia 1.1

This functionality requires at least Julia 1.1.

Julia 1.8

The autoreset functionality and memory ordering guarantee requires at least Julia 1.8.

source
Base.notifyFunction
notify(condition, val=nothing; all=true, error=false)

Wake up tasks waiting for a condition, passing them val. If all is true (the default), all waiting tasks are woken, otherwise only one is. If error is true, the passed value is raised as an exception in the woken tasks.

Return the count of tasks woken up. Return 0 if no tasks are waiting on condition.

source
Base.resetMethod
reset(::Event)

Reset an Event back into an un-set state. Then any future calls to wait will block until notify is called again.

source
Base.SemaphoreType
Semaphore(sem_size)

Create a counting semaphore that allows at most sem_size acquires to be in use at any time. Each acquire must be matched with a release.

This provides a acquire & release memory ordering on acquire/release calls.

source
Base.acquireFunction
acquire(f, s::Semaphore)

Execute f after acquiring from Semaphore s, and release on completion or error.

For example, a do-block form that ensures only 2 calls of foo will be active at the same time:

s = Base.Semaphore(2)
+end
Julia 1.2

This functionality requires at least Julia 1.2.

source
Base.EventType
Event([autoreset=false])

Create a level-triggered event source. Tasks that call wait on an Event are suspended and queued until notify is called on the Event. After notify is called, the Event remains in a signaled state and tasks will no longer block when waiting for it, until reset is called.

If autoreset is true, at most one task will be released from wait for each call to notify.

This provides an acquire & release memory ordering on notify/wait.

Julia 1.1

This functionality requires at least Julia 1.1.

Julia 1.8

The autoreset functionality and memory ordering guarantee requires at least Julia 1.8.

source
Base.notifyFunction
notify(condition, val=nothing; all=true, error=false)

Wake up tasks waiting for a condition, passing them val. If all is true (the default), all waiting tasks are woken, otherwise only one is. If error is true, the passed value is raised as an exception in the woken tasks.

Return the count of tasks woken up. Return 0 if no tasks are waiting on condition.

source
Base.resetMethod
reset(::Event)

Reset an Event back into an un-set state. Then any future calls to wait will block until notify is called again.

source
Base.SemaphoreType
Semaphore(sem_size)

Create a counting semaphore that allows at most sem_size acquires to be in use at any time. Each acquire must be matched with a release.

This provides a acquire & release memory ordering on acquire/release calls.

source
Base.acquireFunction
acquire(f, s::Semaphore)

Execute f after acquiring from Semaphore s, and release on completion or error.

For example, a do-block form that ensures only 2 calls of foo will be active at the same time:

s = Base.Semaphore(2)
 @sync for _ in 1:100
     Threads.@spawn begin
         Base.acquire(s) do
             foo()
         end
     end
-end
Julia 1.8

This method requires at least Julia 1.8.

source
acquire(s::Semaphore)

Wait for one of the sem_size permits to be available, blocking until one can be acquired.

source
Base.releaseFunction
release(s::Semaphore)

Return one permit to the pool, possibly allowing another task to acquire it and resume execution.

source
Base.lockFunction

lock(f::Function, l::Lockable)

Acquire the lock associated with l, execute f with the lock held, and release the lock when f returns. f will receive one positional argument: the value wrapped by l. If the lock is already locked by a different task/thread, wait for it to become available. When this function returns, the lock has been released, so the caller should not attempt to unlock it.

Julia 1.11

Requires at least Julia 1.11.

source
lock(f::Function, lock)

Acquire the lock, execute f with the lock held, and release the lock when f returns. If the lock is already locked by a different task/thread, wait for it to become available.

When this function returns, the lock has been released, so the caller should not attempt to unlock it.

See also: @lock.

Julia 1.7

Using a Channel as the second argument requires Julia 1.7 or later.

source
lock(lock)

Acquire the lock when it becomes available. If the lock is already locked by a different task/thread, wait for it to become available.

Each lock must be matched by an unlock.

source
Base.unlockFunction
unlock(lock)

Releases ownership of the lock.

If this is a recursive lock which has been acquired before, decrement an internal counter and return immediately.

source
Base.trylockFunction
trylock(lock) -> Success (Boolean)

Acquire the lock if it is available, and return true if successful. If the lock is already locked by a different task/thread, return false.

Each successful trylock must be matched by an unlock.

Function trylock combined with islocked can be used for writing the test-and-test-and-set or exponential backoff algorithms if it is supported by the typeof(lock) (read its documentation).

source
Base.islockedFunction
islocked(lock) -> Status (Boolean)

Check whether the lock is held by any task/thread. This function alone should not be used for synchronization. However, islocked combined with trylock can be used for writing the test-and-test-and-set or exponential backoff algorithms if it is supported by the typeof(lock) (read its documentation).

Extended help

For example, an exponential backoff can be implemented as follows if the lock implementation satisfied the properties documented below.

nspins = 0
+end
Julia 1.8

This method requires at least Julia 1.8.

source
acquire(s::Semaphore)

Wait for one of the sem_size permits to be available, blocking until one can be acquired.

source
Base.releaseFunction
release(s::Semaphore)

Return one permit to the pool, possibly allowing another task to acquire it and resume execution.

source
Base.lockFunction

lock(f::Function, l::Lockable)

Acquire the lock associated with l, execute f with the lock held, and release the lock when f returns. f will receive one positional argument: the value wrapped by l. If the lock is already locked by a different task/thread, wait for it to become available. When this function returns, the lock has been released, so the caller should not attempt to unlock it.

Julia 1.11

Requires at least Julia 1.11.

source
lock(f::Function, lock)

Acquire the lock, execute f with the lock held, and release the lock when f returns. If the lock is already locked by a different task/thread, wait for it to become available.

When this function returns, the lock has been released, so the caller should not attempt to unlock it.

See also: @lock.

Julia 1.7

Using a Channel as the second argument requires Julia 1.7 or later.

source
lock(lock)

Acquire the lock when it becomes available. If the lock is already locked by a different task/thread, wait for it to become available.

Each lock must be matched by an unlock.

source
Base.unlockFunction
unlock(lock)

Releases ownership of the lock.

If this is a recursive lock which has been acquired before, decrement an internal counter and return immediately.

source
Base.trylockFunction
trylock(lock) -> Success (Boolean)

Acquire the lock if it is available, and return true if successful. If the lock is already locked by a different task/thread, return false.

Each successful trylock must be matched by an unlock.

Function trylock combined with islocked can be used for writing the test-and-test-and-set or exponential backoff algorithms if it is supported by the typeof(lock) (read its documentation).

source
Base.islockedFunction
islocked(lock) -> Status (Boolean)

Check whether the lock is held by any task/thread. This function alone should not be used for synchronization. However, islocked combined with trylock can be used for writing the test-and-test-and-set or exponential backoff algorithms if it is supported by the typeof(lock) (read its documentation).

Extended help

For example, an exponential backoff can be implemented as follows if the lock implementation satisfied the properties documented below.

nspins = 0
 while true
     while islocked(lock)
         GC.safepoint()
@@ -132,24 +132,24 @@
     end
     trylock(lock) && break
     backoff()
-end

Implementation

A lock implementation is advised to define islocked with the following properties and note it in its docstring.

  • islocked(lock) is data-race-free.
  • If islocked(lock) returns false, an immediate invocation of trylock(lock) must succeed (returns true) if there is no interference from other tasks.
source
Base.ReentrantLockType
ReentrantLock()

Creates a re-entrant lock for synchronizing Tasks. The same task can acquire the lock as many times as required (this is what the "Reentrant" part of the name means). Each lock must be matched with an unlock.

Calling lock will also inhibit running of finalizers on that thread until the corresponding unlock. Use of the standard lock pattern illustrated below should naturally be supported, but beware of inverting the try/lock order or missing the try block entirely (e.g. attempting to return with the lock still held):

This provides a acquire/release memory ordering on lock/unlock calls.

lock(l)
+end

Implementation

A lock implementation is advised to define islocked with the following properties and note it in its docstring.

  • islocked(lock) is data-race-free.
  • If islocked(lock) returns false, an immediate invocation of trylock(lock) must succeed (returns true) if there is no interference from other tasks.
source
Base.ReentrantLockType
ReentrantLock()

Creates a re-entrant lock for synchronizing Tasks. The same task can acquire the lock as many times as required (this is what the "Reentrant" part of the name means). Each lock must be matched with an unlock.

Calling lock will also inhibit running of finalizers on that thread until the corresponding unlock. Use of the standard lock pattern illustrated below should naturally be supported, but beware of inverting the try/lock order or missing the try block entirely (e.g. attempting to return with the lock still held):

This provides a acquire/release memory ordering on lock/unlock calls.

lock(l)
 try
     <atomic work>
 finally
     unlock(l)
-end

If !islocked(lck::ReentrantLock) holds, trylock(lck) succeeds unless there are other tasks attempting to hold the lock "at the same time."

source
Base.@lockMacro
@lock l expr

Macro version of lock(f, l::AbstractLock) but with expr instead of f function. Expands to:

lock(l)
 try
     expr
 finally
     unlock(l)
-end

This is similar to using lock with a do block, but avoids creating a closure and thus can improve the performance.

Compat

@lock was added in Julia 1.3, and exported in Julia 1.10.

source
Base.LockableType

Lockable(value, lock = ReentrantLock())

Creates a Lockable object that wraps value and associates it with the provided lock. This object supports @lock, lock, trylock, unlock. To access the value, index the lockable object while holding the lock.

Julia 1.11

Requires at least Julia 1.11.

Example

julia> locked_list = Base.Lockable(Int[]);
+end

This is similar to using lock with a do block, but avoids creating a closure and thus can improve the performance.

Compat

@lock was added in Julia 1.3, and exported in Julia 1.10.

source
Base.LockableType

Lockable(value, lock = ReentrantLock())

Creates a Lockable object that wraps value and associates it with the provided lock. This object supports @lock, lock, trylock, unlock. To access the value, index the lockable object while holding the lock.

Julia 1.11

Requires at least Julia 1.11.

Example

julia> locked_list = Base.Lockable(Int[]);
 
 julia> @lock(locked_list, push!(locked_list[], 1)) # must hold the lock to access the value
 1-element Vector{Int64}:
  1
 
 julia> lock(summary, locked_list)
-"1-element Vector{Int64}"
source

Channels

Base.ChannelType
Channel{T=Any}(size::Int=0)

Constructs a Channel with an internal buffer that can hold a maximum of size objects of type T. put! calls on a full channel block until an object is removed with take!.

Channel(0) constructs an unbuffered channel. put! blocks until a matching take! is called. And vice-versa.

Other constructors:

  • Channel(): default constructor, equivalent to Channel{Any}(0)
  • Channel(Inf): equivalent to Channel{Any}(typemax(Int))
  • Channel(sz): equivalent to Channel{Any}(sz)
Julia 1.3

The default constructor Channel() and default size=0 were added in Julia 1.3.

source
Base.ChannelMethod
Channel{T=Any}(func::Function, size=0; taskref=nothing, spawn=false, threadpool=nothing)

Create a new task from func, bind it to a new channel of type T and size size, and schedule the task, all in a single call. The channel is automatically closed when the task terminates.

func must accept the bound channel as its only argument.

If you need a reference to the created task, pass a Ref{Task} object via the keyword argument taskref.

If spawn=true, the Task created for func may be scheduled on another thread in parallel, equivalent to creating a task via Threads.@spawn.

If spawn=true and the threadpool argument is not set, it defaults to :default.

If the threadpool argument is set (to :default or :interactive), this implies that spawn=true and the new Task is spawned to the specified threadpool.

Return a Channel.

Examples

julia> chnl = Channel() do ch
+"1-element Vector{Int64}"
source

Channels

Base.ChannelType
Channel{T=Any}(size::Int=0)

Constructs a Channel with an internal buffer that can hold a maximum of size objects of type T. put! calls on a full channel block until an object is removed with take!.

Channel(0) constructs an unbuffered channel. put! blocks until a matching take! is called. And vice-versa.

Other constructors:

  • Channel(): default constructor, equivalent to Channel{Any}(0)
  • Channel(Inf): equivalent to Channel{Any}(typemax(Int))
  • Channel(sz): equivalent to Channel{Any}(sz)
Julia 1.3

The default constructor Channel() and default size=0 were added in Julia 1.3.

source
Base.ChannelMethod
Channel{T=Any}(func::Function, size=0; taskref=nothing, spawn=false, threadpool=nothing)

Create a new task from func, bind it to a new channel of type T and size size, and schedule the task, all in a single call. The channel is automatically closed when the task terminates.

func must accept the bound channel as its only argument.

If you need a reference to the created task, pass a Ref{Task} object via the keyword argument taskref.

If spawn=true, the Task created for func may be scheduled on another thread in parallel, equivalent to creating a task via Threads.@spawn.

If spawn=true and the threadpool argument is not set, it defaults to :default.

If the threadpool argument is set (to :default or :interactive), this implies that spawn=true and the new Task is spawned to the specified threadpool.

Return a Channel.

Examples

julia> chnl = Channel() do ch
            foreach(i -> put!(ch, i), 1:4)
        end;
 
@@ -183,7 +183,7 @@
 Channel{Char}(1) (2 items available)
 
 julia> String(collect(chnl))
-"hello world"
source
Base.put!Method
put!(c::Channel, v)

Append an item v to the channel c. Blocks if the channel is full.

For unbuffered channels, blocks until a take! is performed by a different task.

Julia 1.1

v now gets converted to the channel's type with convert as put! is called.

source
Base.take!Method
take!(c::Channel)

Removes and returns a value from a Channel in order. Blocks until data is available. For unbuffered channels, blocks until a put! is performed by a different task.

Examples

Buffered channel:

julia> c = Channel(1);
+"hello world"
source
Base.put!Method
put!(c::Channel, v)

Append an item v to the channel c. Blocks if the channel is full.

For unbuffered channels, blocks until a take! is performed by a different task.

Julia 1.1

v now gets converted to the channel's type with convert as put! is called.

source
Base.take!Method
take!(c::Channel)

Removes and returns a value from a Channel in order. Blocks until data is available. For unbuffered channels, blocks until a put! is performed by a different task.

Examples

Buffered channel:

julia> c = Channel(1);
 
 julia> put!(c, 1);
 
@@ -195,7 +195,7 @@
 julia> schedule(task);
 
 julia> take!(c)
-1
source
Base.isfullMethod
isfull(c::Channel)

Determines if a Channel is full, in the sense that calling put!(c, some_value) would have blocked. Returns immediately, does not block.

Note that it may frequently be the case that put! will not block after this returns true. Users must take precautions not to accidentally create live-lock bugs in their code by calling this method, as these are generally harder to debug than deadlocks. It is also possible that put! will block after this call returns false, if there are multiple producer tasks calling put! in parallel.

Examples

Buffered channel:

julia> c = Channel(1); # capacity = 1
+1
source
Base.isfullMethod
isfull(c::Channel)

Determines if a Channel is full, in the sense that calling put!(c, some_value) would have blocked. Returns immediately, does not block.

Note that it may frequently be the case that put! will not block after this returns true. Users must take precautions not to accidentally create live-lock bugs in their code by calling this method, as these are generally harder to debug than deadlocks. It is also possible that put! will block after this call returns false, if there are multiple producer tasks calling put! in parallel.

Examples

Buffered channel:

julia> c = Channel(1); # capacity = 1
 
 julia> isfull(c)
 false
@@ -206,7 +206,7 @@
 true

Unbuffered channel:

julia> c = Channel(); # capacity = 0
 
 julia> isfull(c) # unbuffered channel is always full
-true
source
Base.isreadyMethod
isready(c::Channel)

Determines whether a Channel has a value stored in it. Returns immediately, does not block.

For unbuffered channels, return true if there are tasks waiting on a put!.

Examples

Buffered channel:

julia> c = Channel(1);
+true
source
Base.isreadyMethod
isready(c::Channel)

Determines whether a Channel has a value stored in it. Returns immediately, does not block.

For unbuffered channels, return true if there are tasks waiting on a put!.

Examples

Buffered channel:

julia> c = Channel(1);
 
 julia> isready(c)
 false
@@ -224,7 +224,7 @@
 julia> schedule(task);  # schedule a put! task
 
 julia> isready(c)
-true
source
Base.isopenMethod
isopen(c::Channel)

Determines whether a Channel is open for new put! operations. Notice that a Channelcan be closed and still have buffered elements which can be consumed with [take!`](@ref).

Examples

Buffered channel with task:

julia> c = Channel(ch -> put!(ch, 1), 1);
+true
source
Base.isopenMethod
isopen(c::Channel)

Determines whether a Channel is open for new put! operations. Notice that a Channelcan be closed and still have buffered elements which can be consumed with [take!`](@ref).

Examples

Buffered channel with task:

julia> c = Channel(ch -> put!(ch, 1), 1);
 
 julia> isopen(c) # The channel is closed to new `put!`s
 false
@@ -244,7 +244,7 @@
 julia> close(c)
 
 julia> isopen(c)
-false
source
Base.fetchMethod
fetch(c::Channel)

Waits for and returns (without removing) the first available item from the Channel. Note: fetch is unsupported on an unbuffered (0-size) Channel.

Examples

Buffered channel:

julia> c = Channel(3) do ch
+false
source
Base.fetchMethod
fetch(c::Channel)

Waits for and returns (without removing) the first available item from the Channel. Note: fetch is unsupported on an unbuffered (0-size) Channel.

Examples

Buffered channel:

julia> c = Channel(3) do ch
            foreach(i -> put!(ch, i), 1:3)
        end;
 
@@ -255,7 +255,7 @@
 3-element Vector{Any}:
  1
  2
- 3
source
Base.closeMethod
close(c::Channel[, excp::Exception])

Close a channel. An exception (optionally given by excp), is thrown by:

source
Base.bindMethod
bind(chnl::Channel, task::Task)

Associate the lifetime of chnl with a task. Channel chnl is automatically closed when the task terminates. Any uncaught exception in the task is propagated to all waiters on chnl.

The chnl object can be explicitly closed independent of task termination. Terminating tasks have no effect on already closed Channel objects.

When a channel is bound to multiple tasks, the first task to terminate will close the channel. When multiple channels are bound to the same task, termination of the task will close all of the bound channels.

Examples

julia> c = Channel(0);
+ 3
source
Base.closeMethod
close(c::Channel[, excp::Exception])

Close a channel. An exception (optionally given by excp), is thrown by:

source
Base.bindMethod
bind(chnl::Channel, task::Task)

Associate the lifetime of chnl with a task. Channel chnl is automatically closed when the task terminates. Any uncaught exception in the task is propagated to all waiters on chnl.

The chnl object can be explicitly closed independent of task termination. Terminating tasks have no effect on already closed Channel objects.

When a channel is bound to multiple tasks, the first task to terminate will close the channel. When multiple channels are bound to the same task, termination of the task will close all of the bound channels.

Examples

julia> c = Channel(0);
 
 julia> task = @async foreach(i->put!(c, i), 1:4);
 
@@ -284,7 +284,7 @@
 Stacktrace:
 [...]
     nested task error: foo
-[...]
source

Low-level synchronization using schedule and wait

The easiest correct use of schedule is on a Task that is not started (scheduled) yet. However, it is possible to use schedule and wait as a very low-level building block for constructing synchronization interfaces. A crucial pre-condition of calling schedule(task) is that the caller must "own" the task; i.e., it must know that the call to wait in the given task is happening at the locations known to the code calling schedule(task). One strategy for ensuring such pre-condition is to use atomics, as demonstrated in the following example:

@enum OWEState begin
+[...]
source

Low-level synchronization using schedule and wait

The easiest correct use of schedule is on a Task that is not started (scheduled) yet. However, it is possible to use schedule and wait as a very low-level building block for constructing synchronization interfaces. A crucial pre-condition of calling schedule(task) is that the caller must "own" the task; i.e., it must know that the call to wait in the given task is happening at the locations known to the code calling schedule(task). One strategy for ensuring such pre-condition is to use atomics, as demonstrated in the following example:

@enum OWEState begin
     OWE_EMPTY
     OWE_WAITING
     OWE_NOTIFYING
@@ -349,4 +349,4 @@
 
 # output
 notifying...
-done

OneWayEvent lets one task to wait for another task's notify. It is a limited communication interface since wait can only be used once from a single task (note the non-atomic assignment of ev.task)

In this example, notify(ev::OneWayEvent) is allowed to call schedule(ev.task) if and only if it modifies the state from OWE_WAITING to OWE_NOTIFYING. This lets us know that the task executing wait(ev::OneWayEvent) is now in the ok branch and that there cannot be other tasks that tries to schedule(ev.task) since their @atomicreplace(ev.state, state => OWE_NOTIFYING) will fail.

+done

OneWayEvent lets one task to wait for another task's notify. It is a limited communication interface since wait can only be used once from a single task (note the non-atomic assignment of ev.task)

In this example, notify(ev::OneWayEvent) is allowed to call schedule(ev.task) if and only if it modifies the state from OWE_WAITING to OWE_NOTIFYING. This lets us know that the task executing wait(ev::OneWayEvent) is now in the ok branch and that there cannot be other tasks that tries to schedule(ev.task) since their @atomicreplace(ev.state, state => OWE_NOTIFYING) will fail.

diff --git a/en/v1.12-dev/base/punctuation/index.html b/en/v1.12-dev/base/punctuation/index.html index 5e0070548ca..6a58a5d9a7d 100644 --- a/en/v1.12-dev/base/punctuation/index.html +++ b/en/v1.12-dev/base/punctuation/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Punctuation

Extended documentation for mathematical symbols & functions is here.

symbolmeaning
@the at-sign marks a macro invocation; optionally followed by an argument list
!an exclamation mark is a prefix operator for logical negation ("not")
a!function names that end with an exclamation mark modify one or more of their arguments by convention
#the number sign (or hash or pound) character begins single line comments
#=when followed by an equals sign, it begins a multi-line comment (these are nestable)
=#end a multi-line comment by immediately preceding the number sign with an equals sign
$the dollar sign is used for string and expression interpolation
%the percent symbol is the remainder operator
^the caret is the exponentiation operator
&single ampersand is bitwise and
&&double ampersands is short-circuiting boolean and
|single pipe character is bitwise or
||double pipe characters is short-circuiting boolean or
the unicode xor character is bitwise exclusive or
~the tilde is an operator for bitwise not
'a trailing apostrophe is the adjoint (that is, the complex transpose) operator Aᴴ
*the asterisk is used for multiplication, including matrix multiplication and string concatenation
/forward slash divides the argument on its left by the one on its right
//double forward slash performs exact, rational division
\backslash operator divides the argument on its right by the one on its left, commonly used to solve matrix equations
()parentheses with no arguments constructs an empty Tuple
(a,...)parentheses with comma-separated arguments constructs a tuple containing its arguments
(a=1,...)parentheses with comma-separated assignments constructs a NamedTuple
(x;y)parentheses can also be used to group one or more semicolon separated expressions
a[]array indexing (calling getindex or setindex!)
[,]vector literal constructor (calling vect)
[;]vertical concatenation (calling vcat or hvcat)
[ ]with space-separated expressions, horizontal concatenation (calling hcat or hvcat)
T{ }curly braces following a type list that type's parameters
{}curly braces can also be used to group multiple where expressions in function declarations
;semicolons separate statements, begin a list of keyword arguments in function declarations or calls, or are used to separate array literals for vertical concatenation
,commas separate function arguments or tuple or array components
?the question mark delimits the ternary conditional operator (used like: conditional ? if_true : if_false)
" "the single double-quote character delimits String literals
""" """three double-quote characters delimits string literals that may contain " and ignore leading indentation
' 'the single-quote character delimits Char (that is, character) literals
` `the backtick character delimits external process (Cmd) literals
A...triple periods are a postfix operator that "splat" their arguments' contents into many arguments of a function call or declare a varargs function that "slurps" up many arguments into a single tuple
a.bsingle periods access named fields in objects/modules (calling getproperty or setproperty!)
f.()periods may also prefix parentheses (like f.(...)) or infix operators (like .+) to perform the function element-wise (calling broadcast)
a:bcolons (:) used as a binary infix operator construct a range from a to b (inclusive) with fixed step size 1
a:s:bcolons (:) used as a ternary infix operator construct a range from a to b (inclusive) with step size s
:when used by themselves, Colons represent all indices within a dimension, frequently combined with indexing
::double-colons represent a type annotation or typeassert, depending on context, frequently used when declaring function arguments
:( )quoted expression
:aSymbol a
<:subtype operator
>:supertype operator (reverse of subtype operator)
=single equals sign is assignment
==double equals sign is value equality comparison
===triple equals sign is programmatically identical equality comparison
=>right arrow using an equals sign defines a Pair typically used to populate dictionaries
->right arrow using a hyphen defines an anonymous function on a single line
|>pipe operator passes output from the left argument to input of the right argument, usually a function
function composition operator (typed with \circ{tab}) combines two functions as though they are a single larger function
_underscores may be assigned values which will not be saved, often used to ignore multiple return values or create repetitive comprehensions
+

Punctuation

Extended documentation for mathematical symbols & functions is here.

symbolmeaning
@the at-sign marks a macro invocation; optionally followed by an argument list
!an exclamation mark is a prefix operator for logical negation ("not")
a!function names that end with an exclamation mark modify one or more of their arguments by convention
#the number sign (or hash or pound) character begins single line comments
#=when followed by an equals sign, it begins a multi-line comment (these are nestable)
=#end a multi-line comment by immediately preceding the number sign with an equals sign
$the dollar sign is used for string and expression interpolation
%the percent symbol is the remainder operator
^the caret is the exponentiation operator
&single ampersand is bitwise and
&&double ampersands is short-circuiting boolean and
|single pipe character is bitwise or
||double pipe characters is short-circuiting boolean or
the unicode xor character is bitwise exclusive or
~the tilde is an operator for bitwise not
'a trailing apostrophe is the adjoint (that is, the complex transpose) operator Aᴴ
*the asterisk is used for multiplication, including matrix multiplication and string concatenation
/forward slash divides the argument on its left by the one on its right
//double forward slash performs exact, rational division
\backslash operator divides the argument on its right by the one on its left, commonly used to solve matrix equations
()parentheses with no arguments constructs an empty Tuple
(a,...)parentheses with comma-separated arguments constructs a tuple containing its arguments
(a=1,...)parentheses with comma-separated assignments constructs a NamedTuple
(x;y)parentheses can also be used to group one or more semicolon separated expressions
a[]array indexing (calling getindex or setindex!)
[,]vector literal constructor (calling vect)
[;]vertical concatenation (calling vcat or hvcat)
[ ]with space-separated expressions, horizontal concatenation (calling hcat or hvcat)
T{ }curly braces following a type list that type's parameters
{}curly braces can also be used to group multiple where expressions in function declarations
;semicolons separate statements, begin a list of keyword arguments in function declarations or calls, or are used to separate array literals for vertical concatenation
,commas separate function arguments or tuple or array components
?the question mark delimits the ternary conditional operator (used like: conditional ? if_true : if_false)
" "the single double-quote character delimits String literals
""" """three double-quote characters delimits string literals that may contain " and ignore leading indentation
' 'the single-quote character delimits Char (that is, character) literals
` `the backtick character delimits external process (Cmd) literals
A...triple periods are a postfix operator that "splat" their arguments' contents into many arguments of a function call or declare a varargs function that "slurps" up many arguments into a single tuple
a.bsingle periods access named fields in objects/modules (calling getproperty or setproperty!)
f.()periods may also prefix parentheses (like f.(...)) or infix operators (like .+) to perform the function element-wise (calling broadcast)
a:bcolons (:) used as a binary infix operator construct a range from a to b (inclusive) with fixed step size 1
a:s:bcolons (:) used as a ternary infix operator construct a range from a to b (inclusive) with step size s
:when used by themselves, Colons represent all indices within a dimension, frequently combined with indexing
::double-colons represent a type annotation or typeassert, depending on context, frequently used when declaring function arguments
:( )quoted expression
:aSymbol a
<:subtype operator
>:supertype operator (reverse of subtype operator)
=single equals sign is assignment
==double equals sign is value equality comparison
===triple equals sign is programmatically identical equality comparison
=>right arrow using an equals sign defines a Pair typically used to populate dictionaries
->right arrow using a hyphen defines an anonymous function on a single line
|>pipe operator passes output from the left argument to input of the right argument, usually a function
function composition operator (typed with \circ{tab}) combines two functions as though they are a single larger function
_underscores may be assigned values which will not be saved, often used to ignore multiple return values or create repetitive comprehensions
diff --git a/en/v1.12-dev/base/reflection/index.html b/en/v1.12-dev/base/reflection/index.html index 518027eb6b6..8f7642f6206 100644 --- a/en/v1.12-dev/base/reflection/index.html +++ b/en/v1.12-dev/base/reflection/index.html @@ -38,4 +38,4 @@ @ int.jl:87 within `+` 1 ─ %1 = intrinsic Base.add_int(x, y)::Int64 └── return %1 -) => Int64

Possible values for debuginfo are: :none, :source, and :default. Per default debug information is not printed, but that can be changed by setting Base.IRShow.default_debuginfo[] = :source.

+) => Int64

Possible values for debuginfo are: :none, :source, and :default. Per default debug information is not printed, but that can be changed by setting Base.IRShow.default_debuginfo[] = :source.

diff --git a/en/v1.12-dev/base/scopedvalues/index.html b/en/v1.12-dev/base/scopedvalues/index.html index 2c69b064a74..c55c1b375ab 100644 --- a/en/v1.12-dev/base/scopedvalues/index.html +++ b/en/v1.12-dev/base/scopedvalues/index.html @@ -153,7 +153,7 @@ 2 julia> sval[] -1
Julia 1.11

Scoped values were introduced in Julia 1.11. In Julia 1.8+ a compatible implementation is available from the package ScopedValues.jl.

source
Base.ScopedValues.withFunction
with(f, (var::ScopedValue{T} => val)...)

Execute f in a new dynamic scope with var set to val. val will be converted to type T.

See also: ScopedValues.@with, ScopedValues.ScopedValue, ScopedValues.get.

Examples

julia> using Base.ScopedValues
+1
Julia 1.11

Scoped values were introduced in Julia 1.11. In Julia 1.8+ a compatible implementation is available from the package ScopedValues.jl.

source
Base.ScopedValues.withFunction
with(f, (var::ScopedValue{T} => val)...)

Execute f in a new dynamic scope with var set to val. val will be converted to type T.

See also: ScopedValues.@with, ScopedValues.ScopedValue, ScopedValues.get.

Examples

julia> using Base.ScopedValues
 
 julia> a = ScopedValue(1);
 
@@ -180,7 +180,7 @@
 60
 
 julia> with(() -> a[] * b[], a=>3, b=>4)
-12
source
Base.ScopedValues.@withMacro
@with (var::ScopedValue{T} => val)... expr

Macro version of with. The expression @with var=>val expr evaluates expr in a new dynamic scope with var set to val. val will be converted to type T. @with var=>val expr is equivalent to with(var=>val) do expr end, but @with avoids creating a closure.

See also: ScopedValues.with, ScopedValues.ScopedValue, ScopedValues.get.

Examples

julia> using Base.ScopedValues
+12
source
Base.ScopedValues.@withMacro
@with (var::ScopedValue{T} => val)... expr

Macro version of with. The expression @with var=>val expr evaluates expr in a new dynamic scope with var set to val. val will be converted to type T. @with var=>val expr is equivalent to with(var=>val) do expr end, but @with avoids creating a closure.

See also: ScopedValues.with, ScopedValues.ScopedValue, ScopedValues.get.

Examples

julia> using Base.ScopedValues
 
 julia> const a = ScopedValue(1);
 
@@ -193,7 +193,7 @@
            x = 100
            f(x)
        end
-103
source
Base.isassignedMethod
isassigned(val::ScopedValue)

Test whether a ScopedValue has an assigned value.

See also: ScopedValues.with, ScopedValues.@with, ScopedValues.get.

Examples

julia> using Base.ScopedValues
+103
source
Base.isassignedMethod
isassigned(val::ScopedValue)

Test whether a ScopedValue has an assigned value.

See also: ScopedValues.with, ScopedValues.@with, ScopedValues.get.

Examples

julia> using Base.ScopedValues
 
 julia> a = ScopedValue(1); b = ScopedValue{Int}();
 
@@ -201,7 +201,7 @@
 true
 
 julia> isassigned(b)
-false
source
Base.ScopedValues.getFunction
get(val::ScopedValue{T})::Union{Nothing, Some{T}}

If the scoped value isn't set and doesn't have a default value, return nothing. Otherwise returns Some{T} with the current value.

See also: ScopedValues.with, ScopedValues.@with, ScopedValues.ScopedValue.

Examples

julia> using Base.ScopedValues
+false
source
Base.ScopedValues.getFunction
get(val::ScopedValue{T})::Union{Nothing, Some{T}}

If the scoped value isn't set and doesn't have a default value, return nothing. Otherwise returns Some{T} with the current value.

See also: ScopedValues.with, ScopedValues.@with, ScopedValues.ScopedValue.

Examples

julia> using Base.ScopedValues
 
 julia> a = ScopedValue(42); b = ScopedValue{Int}();
 
@@ -209,4 +209,4 @@
 Some(42)
 
 julia> isnothing(ScopedValues.get(b))
-true
source

Implementation notes and performance

Scopes use a persistent dictionary. Lookup and insertion is O(log(32, n)), upon dynamic scope entry a small amount of data is copied and the unchanged data is shared among other scopes.

The Scope object itself is not user-facing and may be changed in a future version of Julia.

Design inspiration

This design was heavily inspired by JEPS-429, which in turn was inspired by dynamically scoped free variables in many Lisp dialects. In particular Interlisp-D and its deep binding strategy.

A prior design discussed was context variables ala PEPS-567 and implemented in Julia as ContextVariablesX.jl.

+truesource

Implementation notes and performance

Scopes use a persistent dictionary. Lookup and insertion is O(log(32, n)), upon dynamic scope entry a small amount of data is copied and the unchanged data is shared among other scopes.

The Scope object itself is not user-facing and may be changed in a future version of Julia.

Design inspiration

This design was heavily inspired by JEPS-429, which in turn was inspired by dynamically scoped free variables in many Lisp dialects. In particular Interlisp-D and its deep binding strategy.

A prior design discussed was context variables ala PEPS-567 and implemented in Julia as ContextVariablesX.jl.

diff --git a/en/v1.12-dev/base/simd-types/index.html b/en/v1.12-dev/base/simd-types/index.html index e22d372ec78..978dc5234f5 100644 --- a/en/v1.12-dev/base/simd-types/index.html +++ b/en/v1.12-dev/base/simd-types/index.html @@ -16,4 +16,4 @@ triple(c::m128) = add(add(c,c),c) -code_native(triple,(m128,))

However, since the automatic vectorization cannot be relied upon, future use will mostly be via libraries that use llvmcall.

+code_native(triple,(m128,))

However, since the automatic vectorization cannot be relied upon, future use will mostly be via libraries that use llvmcall.

diff --git a/en/v1.12-dev/base/sort/index.html b/en/v1.12-dev/base/sort/index.html index 9b5e4300e92..f1e98dcee6c 100644 --- a/en/v1.12-dev/base/sort/index.html +++ b/en/v1.12-dev/base/sort/index.html @@ -72,7 +72,7 @@ julia> sort!(A, dims = 2); A 2×2 Matrix{Int64}: 1 2 - 3 4source
sort!(v; alg::Base.Sort.Algorithm=Base.Sort.defalg(v), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Sort the vector v in place. A stable algorithm is used by default: the ordering of elements that compare equal is preserved. A specific algorithm can be selected via the alg keyword (see Sorting Algorithms for available algorithms).

Elements are first transformed with the function by and then compared according to either the function lt or the ordering order. Finally, the resulting order is reversed if rev=true (this preserves forward stability: elements that compare equal are not reversed). The current implementation applies the by transformation before each comparison rather than once per element.

Passing an lt other than isless along with an order other than Base.Order.Forward or Base.Order.Reverse is not permitted, otherwise all options are independent and can be used together in all possible combinations. Note that order can also include a "by" transformation, in which case it is applied after that defined with the by keyword. For more information on order values see the documentation on Alternate Orderings.

Relations between two elements are defined as follows (with "less" and "greater" exchanged when rev=true):

The result of sort! is sorted in the sense that every element is greater than or equivalent to the previous one.

The lt function must define a strict weak order, that is, it must be

For example < is a valid lt function for Int values but is not: it violates irreflexivity. For Float64 values even < is invalid as it violates the fourth condition: 1.0 and NaN are equivalent and so are NaN and 2.0 but 1.0 and 2.0 are not equivalent.

See also sort, sortperm, sortslices, partialsort!, partialsortperm, issorted, searchsorted, insorted, Base.Order.ord.

Examples

julia> v = [3, 1, 2]; sort!(v); v
+ 3  4
source
sort!(v; alg::Base.Sort.Algorithm=Base.Sort.defalg(v), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Sort the vector v in place. A stable algorithm is used by default: the ordering of elements that compare equal is preserved. A specific algorithm can be selected via the alg keyword (see Sorting Algorithms for available algorithms).

Elements are first transformed with the function by and then compared according to either the function lt or the ordering order. Finally, the resulting order is reversed if rev=true (this preserves forward stability: elements that compare equal are not reversed). The current implementation applies the by transformation before each comparison rather than once per element.

Passing an lt other than isless along with an order other than Base.Order.Forward or Base.Order.Reverse is not permitted, otherwise all options are independent and can be used together in all possible combinations. Note that order can also include a "by" transformation, in which case it is applied after that defined with the by keyword. For more information on order values see the documentation on Alternate Orderings.

Relations between two elements are defined as follows (with "less" and "greater" exchanged when rev=true):

The result of sort! is sorted in the sense that every element is greater than or equivalent to the previous one.

The lt function must define a strict weak order, that is, it must be

For example < is a valid lt function for Int values but is not: it violates irreflexivity. For Float64 values even < is invalid as it violates the fourth condition: 1.0 and NaN are equivalent and so are NaN and 2.0 but 1.0 and 2.0 are not equivalent.

See also sort, sortperm, sortslices, partialsort!, partialsortperm, issorted, searchsorted, insorted, Base.Order.ord.

Examples

julia> v = [3, 1, 2]; sort!(v); v
 3-element Vector{Int64}:
  1
  2
@@ -120,7 +120,7 @@
  NaN
    1.0
  NaN
-   3.0
source
Base.sortFunction
sort(A; dims::Integer, alg::Base.Sort.Algorithm=Base.Sort.defalg(A), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Sort a multidimensional array A along the given dimension. See sort! for a description of possible keyword arguments.

To sort slices of an array, refer to sortslices.

Examples

julia> A = [4 3; 1 2]
+   3.0
source
Base.sortFunction
sort(A; dims::Integer, alg::Base.Sort.Algorithm=Base.Sort.defalg(A), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Sort a multidimensional array A along the given dimension. See sort! for a description of possible keyword arguments.

To sort slices of an array, refer to sortslices.

Examples

julia> A = [4 3; 1 2]
 2×2 Matrix{Int64}:
  4  3
  1  2
@@ -133,7 +133,7 @@
 julia> sort(A, dims = 2)
 2×2 Matrix{Int64}:
  3  4
- 1  2
source
sort(v::Union{AbstractVector, NTuple}; alg::Base.Sort.Algorithm=Base.Sort.defalg(v), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Variant of sort! that returns a sorted copy of v leaving v itself unmodified.

Julia 1.12

Sorting NTuples requires Julia 1.12 or later.

Examples

julia> v = [3, 1, 2];
+ 1  2
source
sort(v::Union{AbstractVector, NTuple}; alg::Base.Sort.Algorithm=Base.Sort.defalg(v), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Variant of sort! that returns a sorted copy of v leaving v itself unmodified.

Julia 1.12

Sorting NTuples requires Julia 1.12 or later.

Examples

julia> v = [3, 1, 2];
 
 julia> sort(v)
 3-element Vector{Int64}:
@@ -145,7 +145,7 @@
 3-element Vector{Int64}:
  3
  1
- 2
source
Base.sortpermFunction
sortperm(A; alg::Base.Sort.Algorithm=Base.Sort.DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward, [dims::Integer])

Return a permutation vector or array I that puts A[I] in sorted order along the given dimension. If A has more than one dimension, then the dims keyword argument must be specified. The order is specified using the same keywords as sort!. The permutation is guaranteed to be stable even if the sorting algorithm is unstable: the indices of equal elements will appear in ascending order.

See also sortperm!, partialsortperm, invperm, indexin. To sort slices of an array, refer to sortslices.

Julia 1.9

The method accepting dims requires at least Julia 1.9.

Examples

julia> v = [3, 1, 2];
+ 2
source
Base.sortpermFunction
sortperm(A; alg::Base.Sort.Algorithm=Base.Sort.DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward, [dims::Integer])

Return a permutation vector or array I that puts A[I] in sorted order along the given dimension. If A has more than one dimension, then the dims keyword argument must be specified. The order is specified using the same keywords as sort!. The permutation is guaranteed to be stable even if the sorting algorithm is unstable: the indices of equal elements will appear in ascending order.

See also sortperm!, partialsortperm, invperm, indexin. To sort slices of an array, refer to sortslices.

Julia 1.9

The method accepting dims requires at least Julia 1.9.

Examples

julia> v = [3, 1, 2];
 
 julia> p = sortperm(v)
 3-element Vector{Int64}:
@@ -172,7 +172,7 @@
 julia> sortperm(A, dims = 2)
 2×2 Matrix{Int64}:
  3  1
- 2  4
source
Base.Sort.InsertionSortConstant
InsertionSort

Use the insertion sort algorithm.

Insertion sort traverses the collection one element at a time, inserting each element into its correct, sorted position in the output vector.

Characteristics:

  • stable: preserves the ordering of elements that compare equal

(e.g. "a" and "A" in a sort of letters that ignores case).

  • in-place in memory.
  • quadratic performance in the number of elements to be sorted:

it is well-suited to small collections but should not be used for large ones.

source
Base.Sort.MergeSortConstant
MergeSort

Indicate that a sorting function should use the merge sort algorithm. Merge sort divides the collection into subcollections and repeatedly merges them, sorting each subcollection at each step, until the entire collection has been recombined in sorted form.

Characteristics:

  • stable: preserves the ordering of elements that compare equal (e.g. "a" and "A" in a sort of letters that ignores case).
  • not in-place in memory.
  • divide-and-conquer sort strategy.
  • good performance for large collections but typically not quite as fast as QuickSort.
source
Base.Sort.QuickSortConstant
QuickSort

Indicate that a sorting function should use the quick sort algorithm, which is not stable.

Characteristics:

  • not stable: does not preserve the ordering of elements that compare equal (e.g. "a" and "A" in a sort of letters that ignores case).
  • in-place in memory.
  • divide-and-conquer: sort strategy similar to MergeSort.
  • good performance for large collections.
source
Base.Sort.PartialQuickSortType
PartialQuickSort{T <: Union{Integer,OrdinalRange}}

Indicate that a sorting function should use the partial quick sort algorithm. PartialQuickSort(k) is like QuickSort, but is only required to find and sort the elements that would end up in v[k] were v fully sorted.

Characteristics:

  • not stable: does not preserve the ordering of elements that compare equal (e.g. "a" and "A" in a sort of letters that ignores case).
  • in-place in memory.
  • divide-and-conquer: sort strategy similar to MergeSort.

Note that PartialQuickSort(k) does not necessarily sort the whole array. For example,

julia> x = rand(100);
+ 2  4
source
Base.Sort.InsertionSortConstant
InsertionSort

Use the insertion sort algorithm.

Insertion sort traverses the collection one element at a time, inserting each element into its correct, sorted position in the output vector.

Characteristics:

  • stable: preserves the ordering of elements that compare equal

(e.g. "a" and "A" in a sort of letters that ignores case).

  • in-place in memory.
  • quadratic performance in the number of elements to be sorted:

it is well-suited to small collections but should not be used for large ones.

source
Base.Sort.MergeSortConstant
MergeSort

Indicate that a sorting function should use the merge sort algorithm. Merge sort divides the collection into subcollections and repeatedly merges them, sorting each subcollection at each step, until the entire collection has been recombined in sorted form.

Characteristics:

  • stable: preserves the ordering of elements that compare equal (e.g. "a" and "A" in a sort of letters that ignores case).
  • not in-place in memory.
  • divide-and-conquer sort strategy.
  • good performance for large collections but typically not quite as fast as QuickSort.
source
Base.Sort.QuickSortConstant
QuickSort

Indicate that a sorting function should use the quick sort algorithm, which is not stable.

Characteristics:

  • not stable: does not preserve the ordering of elements that compare equal (e.g. "a" and "A" in a sort of letters that ignores case).
  • in-place in memory.
  • divide-and-conquer: sort strategy similar to MergeSort.
  • good performance for large collections.
source
Base.Sort.PartialQuickSortType
PartialQuickSort{T <: Union{Integer,OrdinalRange}}

Indicate that a sorting function should use the partial quick sort algorithm. PartialQuickSort(k) is like QuickSort, but is only required to find and sort the elements that would end up in v[k] were v fully sorted.

Characteristics:

  • not stable: does not preserve the ordering of elements that compare equal (e.g. "a" and "A" in a sort of letters that ignores case).
  • in-place in memory.
  • divide-and-conquer: sort strategy similar to MergeSort.

Note that PartialQuickSort(k) does not necessarily sort the whole array. For example,

julia> x = rand(100);
 
 julia> k = 50:100;
 
@@ -187,7 +187,7 @@
 (true, true)
 
 julia> s1[k] == s2[k]
-true
source
Base.Sort.sortperm!Function
sortperm!(ix, A; alg::Base.Sort.Algorithm=Base.Sort.DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward, [dims::Integer])

Like sortperm, but accepts a preallocated index vector or array ix with the same axes as A. ix is initialized to contain the values LinearIndices(A).

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Julia 1.9

The method accepting dims requires at least Julia 1.9.

Examples

julia> v = [3, 1, 2]; p = zeros(Int, 3);
+true
source
Base.Sort.sortperm!Function
sortperm!(ix, A; alg::Base.Sort.Algorithm=Base.Sort.DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward, [dims::Integer])

Like sortperm, but accepts a preallocated index vector or array ix with the same axes as A. ix is initialized to contain the values LinearIndices(A).

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Julia 1.9

The method accepting dims requires at least Julia 1.9.

Examples

julia> v = [3, 1, 2]; p = zeros(Int, 3);
 
 julia> sortperm!(p, v); p
 3-element Vector{Int64}:
@@ -211,7 +211,7 @@
 julia> sortperm!(p, A; dims=2); p
 2×2 Matrix{Int64}:
  3  1
- 2  4
source
Base.sortslicesFunction
sortslices(A; dims, alg::Algorithm=DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)

Sort slices of an array A. The required keyword argument dims must be either an integer or a tuple of integers. It specifies the dimension(s) over which the slices are sorted.

E.g., if A is a matrix, dims=1 will sort rows, dims=2 will sort columns. Note that the default comparison function on one dimensional slices sorts lexicographically.

For the remaining keyword arguments, see the documentation of sort!.

Examples

julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1) # Sort rows
+ 2  4
source
Base.sortslicesFunction
sortslices(A; dims, alg::Algorithm=DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)

Sort slices of an array A. The required keyword argument dims must be either an integer or a tuple of integers. It specifies the dimension(s) over which the slices are sorted.

E.g., if A is a matrix, dims=1 will sort rows, dims=2 will sort columns. Note that the default comparison function on one dimensional slices sorts lexicographically.

For the remaining keyword arguments, see the documentation of sort!.

Examples

julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1) # Sort rows
 3×3 Matrix{Int64}:
  -1   6  4
   7   3  5
@@ -290,7 +290,7 @@
  4
 
 [:, :, 5] =
- 5
source
Base.issortedFunction
issorted(v, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Test whether a collection is in sorted order. The keywords modify what order is considered sorted, as described in the sort! documentation.

Examples

julia> issorted([1, 2, 3])
+ 5
source
Base.issortedFunction
issorted(v, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)

Test whether a collection is in sorted order. The keywords modify what order is considered sorted, as described in the sort! documentation.

Examples

julia> issorted([1, 2, 3])
 true
 
 julia> issorted([(1, "b"), (2, "a")], by = x -> x[1])
@@ -303,7 +303,7 @@
 true
 
 julia> issorted([1, 2, -2, 3], by=abs)
-true
source
Base.Sort.searchsortedFunction
searchsorted(v, x; by=identity, lt=isless, rev=false)

Return the range of indices in v where values are equivalent to x, or an empty range located at the insertion point if v does not contain values equivalent to x. The vector v must be sorted according to the order defined by the keywords. Refer to sort! for the meaning of the keywords and the definition of equivalence. Note that the by function is applied to the searched value x as well as the values in v.

The range is generally found using binary search, but there are optimized implementations for some inputs.

See also: searchsortedfirst, sort!, insorted, findall.

Examples

julia> searchsorted([1, 2, 4, 5, 5, 7], 4) # single match
+true
source
Base.Sort.searchsortedFunction
searchsorted(v, x; by=identity, lt=isless, rev=false)

Return the range of indices in v where values are equivalent to x, or an empty range located at the insertion point if v does not contain values equivalent to x. The vector v must be sorted according to the order defined by the keywords. Refer to sort! for the meaning of the keywords and the definition of equivalence. Note that the by function is applied to the searched value x as well as the values in v.

The range is generally found using binary search, but there are optimized implementations for some inputs.

See also: searchsortedfirst, sort!, insorted, findall.

Examples

julia> searchsorted([1, 2, 4, 5, 5, 7], 4) # single match
 3:3
 
 julia> searchsorted([1, 2, 4, 5, 5, 7], 5) # multiple matches
@@ -319,7 +319,7 @@
 1:0
 
 julia> searchsorted([1=>"one", 2=>"two", 2=>"two", 4=>"four"], 2=>"two", by=first) # compare the keys of the pairs
-2:3
source
Base.Sort.searchsortedfirstFunction
searchsortedfirst(v, x; by=identity, lt=isless, rev=false)

Return the index of the first value in v that is not ordered before x. If all values in v are ordered before x, return lastindex(v) + 1.

The vector v must be sorted according to the order defined by the keywords. insert!ing x at the returned index will maintain the sorted order. Refer to sort! for the meaning and use of the keywords. Note that the by function is applied to the searched value x as well as the values in v.

The index is generally found using binary search, but there are optimized implementations for some inputs.

See also: searchsortedlast, searchsorted, findfirst.

Examples

julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 4) # single match
+2:3
source
Base.Sort.searchsortedfirstFunction
searchsortedfirst(v, x; by=identity, lt=isless, rev=false)

Return the index of the first value in v that is not ordered before x. If all values in v are ordered before x, return lastindex(v) + 1.

The vector v must be sorted according to the order defined by the keywords. insert!ing x at the returned index will maintain the sorted order. Refer to sort! for the meaning and use of the keywords. Note that the by function is applied to the searched value x as well as the values in v.

The index is generally found using binary search, but there are optimized implementations for some inputs.

See also: searchsortedlast, searchsorted, findfirst.

Examples

julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 4) # single match
 3
 
 julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 5) # multiple matches
@@ -335,7 +335,7 @@
 1
 
 julia> searchsortedfirst([1=>"one", 2=>"two", 4=>"four"], 3=>"three", by=first) # compare the keys of the pairs
-3
source
Base.Sort.searchsortedlastFunction
searchsortedlast(v, x; by=identity, lt=isless, rev=false)

Return the index of the last value in v that is not ordered after x. If all values in v are ordered after x, return firstindex(v) - 1.

The vector v must be sorted according to the order defined by the keywords. insert!ing x immediately after the returned index will maintain the sorted order. Refer to sort! for the meaning and use of the keywords. Note that the by function is applied to the searched value x as well as the values in v.

The index is generally found using binary search, but there are optimized implementations for some inputs

Examples

julia> searchsortedlast([1, 2, 4, 5, 5, 7], 4) # single match
+3
source
Base.Sort.searchsortedlastFunction
searchsortedlast(v, x; by=identity, lt=isless, rev=false)

Return the index of the last value in v that is not ordered after x. If all values in v are ordered after x, return firstindex(v) - 1.

The vector v must be sorted according to the order defined by the keywords. insert!ing x immediately after the returned index will maintain the sorted order. Refer to sort! for the meaning and use of the keywords. Note that the by function is applied to the searched value x as well as the values in v.

The index is generally found using binary search, but there are optimized implementations for some inputs

Examples

julia> searchsortedlast([1, 2, 4, 5, 5, 7], 4) # single match
 3
 
 julia> searchsortedlast([1, 2, 4, 5, 5, 7], 5) # multiple matches
@@ -351,7 +351,7 @@
 0
 
 julia> searchsortedlast([1=>"one", 2=>"two", 4=>"four"], 3=>"three", by=first) # compare the keys of the pairs
-2
source
Base.Sort.insortedFunction
insorted(x, v; by=identity, lt=isless, rev=false) -> Bool

Determine whether a vector v contains any value equivalent to x. The vector v must be sorted according to the order defined by the keywords. Refer to sort! for the meaning of the keywords and the definition of equivalence. Note that the by function is applied to the searched value x as well as the values in v.

The check is generally done using binary search, but there are optimized implementations for some inputs.

See also in.

Examples

julia> insorted(4, [1, 2, 4, 5, 5, 7]) # single match
+2
source
Base.Sort.insortedFunction
insorted(x, v; by=identity, lt=isless, rev=false) -> Bool

Determine whether a vector v contains any value equivalent to x. The vector v must be sorted according to the order defined by the keywords. Refer to sort! for the meaning of the keywords and the definition of equivalence. Note that the by function is applied to the searched value x as well as the values in v.

The check is generally done using binary search, but there are optimized implementations for some inputs.

See also in.

Examples

julia> insorted(4, [1, 2, 4, 5, 5, 7]) # single match
 true
 
 julia> insorted(5, [1, 2, 4, 5, 5, 7]) # multiple matches
@@ -367,7 +367,7 @@
 false
 
 julia> insorted(2=>"TWO", [1=>"one", 2=>"two", 4=>"four"], by=first) # compare the keys of the pairs
-true
Julia 1.6

insorted was added in Julia 1.6.

source
Base.Sort.partialsort!Function
partialsort!(v, k; by=identity, lt=isless, rev=false)

Partially sort the vector v in place so that the value at index k (or range of adjacent values if k is a range) occurs at the position where it would appear if the array were fully sorted. If k is a single index, that value is returned; if k is a range, an array of values at those indices is returned. Note that partialsort! may not fully sort the input array.

For the keyword arguments, see the documentation of sort!.

Examples

julia> a = [1, 2, 4, 3, 4]
+true
Julia 1.6

insorted was added in Julia 1.6.

source
Base.Sort.partialsort!Function
partialsort!(v, k; by=identity, lt=isless, rev=false)

Partially sort the vector v in place so that the value at index k (or range of adjacent values if k is a range) occurs at the position where it would appear if the array were fully sorted. If k is a single index, that value is returned; if k is a range, an array of values at those indices is returned. Note that partialsort! may not fully sort the input array.

For the keyword arguments, see the documentation of sort!.

Examples

julia> a = [1, 2, 4, 3, 4]
 5-element Vector{Int64}:
  1
  2
@@ -403,7 +403,7 @@
  4
  3
  2
- 1
source
Base.Sort.partialsortFunction
partialsort(v, k, by=identity, lt=isless, rev=false)

Variant of partialsort! that copies v before partially sorting it, thereby returning the same thing as partialsort! but leaving v unmodified.

source
Base.Sort.partialsortpermFunction
partialsortperm(v, k; by=identity, lt=isless, rev=false)

Return a partial permutation I of the vector v, so that v[I] returns values of a fully sorted version of v at index k. If k is a range, a vector of indices is returned; if k is an integer, a single index is returned. The order is specified using the same keywords as sort!. The permutation is stable: the indices of equal elements will appear in ascending order.

This function is equivalent to, but more efficient than, calling sortperm(...)[k].

Examples

julia> v = [3, 1, 2, 1];
+ 1
source
Base.Sort.partialsortFunction
partialsort(v, k, by=identity, lt=isless, rev=false)

Variant of partialsort! that copies v before partially sorting it, thereby returning the same thing as partialsort! but leaving v unmodified.

source
Base.Sort.partialsortpermFunction
partialsortperm(v, k; by=identity, lt=isless, rev=false)

Return a partial permutation I of the vector v, so that v[I] returns values of a fully sorted version of v at index k. If k is a range, a vector of indices is returned; if k is an integer, a single index is returned. The order is specified using the same keywords as sort!. The permutation is stable: the indices of equal elements will appear in ascending order.

This function is equivalent to, but more efficient than, calling sortperm(...)[k].

Examples

julia> v = [3, 1, 2, 1];
 
 julia> v[partialsortperm(v, 1)]
 1
@@ -418,7 +418,7 @@
 3-element Vector{Int64}:
  1
  1
- 2
source
Base.Sort.partialsortperm!Function
partialsortperm!(ix, v, k; by=identity, lt=isless, rev=false)

Like partialsortperm, but accepts a preallocated index vector ix the same size as v, which is used to store (a permutation of) the indices of v.

ix is initialized to contain the indices of v.

(Typically, the indices of v will be 1:length(v), although if v has an alternative array type with non-one-based indices, such as an OffsetArray, ix must share those same indices)

Upon return, ix is guaranteed to have the indices k in their sorted positions, such that

partialsortperm!(ix, v, k);
+ 2
source
Base.Sort.partialsortperm!Function
partialsortperm!(ix, v, k; by=identity, lt=isless, rev=false)

Like partialsortperm, but accepts a preallocated index vector ix the same size as v, which is used to store (a permutation of) the indices of v.

ix is initialized to contain the indices of v.

(Typically, the indices of v will be 1:length(v), although if v has an alternative array type with non-one-based indices, such as an OffsetArray, ix must share those same indices)

Upon return, ix is guaranteed to have the indices k in their sorted positions, such that

partialsortperm!(ix, v, k);
 v[ix[k]] == partialsort(v, k)

The return value is the kth element of ix if k is an integer, or view into ix if k is a range.

Warning

Behavior can be unexpected when any mutated argument shares memory with any other argument.

Examples

julia> v = [3, 1, 2, 1];
 
 julia> ix = Vector{Int}(undef, 4);
@@ -431,4 +431,4 @@
 julia> partialsortperm!(ix, v, 2:3)
 2-element view(::Vector{Int64}, 2:3) with eltype Int64:
  4
- 3
source

Sorting Algorithms

There are currently four sorting algorithms publicly available in base Julia:

By default, the sort family of functions uses stable sorting algorithms that are fast on most inputs. The exact algorithm choice is an implementation detail to allow for future performance improvements. Currently, a hybrid of RadixSort, ScratchQuickSort, InsertionSort, and CountingSort is used based on input type, size, and composition. Implementation details are subject to change but currently available in the extended help of ??Base.DEFAULT_STABLE and the docstrings of internal sorting algorithms listed there.

You can explicitly specify your preferred algorithm with the alg keyword (e.g. sort!(v, alg=PartialQuickSort(10:20))) or reconfigure the default sorting algorithm for custom types by adding a specialized method to the Base.Sort.defalg function. For example, InlineStrings.jl defines the following method:

Base.Sort.defalg(::AbstractArray{<:Union{SmallInlineStrings, Missing}}) = InlineStringSort
Julia 1.9

The default sorting algorithm (returned by Base.Sort.defalg) is guaranteed to be stable since Julia 1.9. Previous versions had unstable edge cases when sorting numeric arrays.

Alternate Orderings

By default, sort, searchsorted, and related functions use isless to compare two elements in order to determine which should come first. The Base.Order.Ordering abstract type provides a mechanism for defining alternate orderings on the same set of elements: when calling a sorting function like sort!, an instance of Ordering can be provided with the keyword argument order.

Instances of Ordering define an order through the Base.Order.lt function, which works as a generalization of isless. This function's behavior on custom Orderings must satisfy all the conditions of a strict weak order. See sort! for details and examples of valid and invalid lt functions.

Base.Order.OrderingType
Base.Order.Ordering

Abstract type which represents a strict weak order on some set of elements. See sort! for more.

Use Base.Order.lt to compare two elements according to the ordering.

source
Base.Order.ltFunction
lt(o::Ordering, a, b) -> Bool

Test whether a is less than b according to the ordering o.

source
Base.Order.ordFunction
ord(lt, by, rev::Union{Bool, Nothing}, order::Ordering=Forward)

Construct an Ordering object from the same arguments used by sort!. Elements are first transformed by the function by (which may be identity) and are then compared according to either the function lt or an existing ordering order. lt should be isless or a function that obeys the same rules as the lt parameter of sort!. Finally, the resulting order is reversed if rev=true.

Passing an lt other than isless along with an order other than Base.Order.Forward or Base.Order.Reverse is not permitted, otherwise all options are independent and can be used together in all possible combinations.

source
Base.Order.ForwardConstant
Base.Order.Forward

Default ordering according to isless.

source
Base.Order.ReverseOrderingType
ReverseOrdering(fwd::Ordering=Forward)

A wrapper which reverses an ordering.

For a given Ordering o, the following holds for all a, b:

lt(ReverseOrdering(o), a, b) == lt(o, b, a)
source
Base.Order.ReverseConstant
Base.Order.Reverse

Reverse ordering according to isless.

source
Base.Order.ByType
By(by, order::Ordering=Forward)

Ordering which applies order to elements after they have been transformed by the function by.

source
Base.Order.LtType
Lt(lt)

Ordering that calls lt(a, b) to compare elements. lt must obey the same rules as the lt parameter of sort!.

source
Base.Order.PermType
Perm(order::Ordering, data::AbstractVector)

Ordering on the indices of data where i is less than j if data[i] is less than data[j] according to order. In the case that data[i] and data[j] are equal, i and j are compared by numeric value.

source
+ 3
source

Sorting Algorithms

There are currently four sorting algorithms publicly available in base Julia:

By default, the sort family of functions uses stable sorting algorithms that are fast on most inputs. The exact algorithm choice is an implementation detail to allow for future performance improvements. Currently, a hybrid of RadixSort, ScratchQuickSort, InsertionSort, and CountingSort is used based on input type, size, and composition. Implementation details are subject to change but currently available in the extended help of ??Base.DEFAULT_STABLE and the docstrings of internal sorting algorithms listed there.

You can explicitly specify your preferred algorithm with the alg keyword (e.g. sort!(v, alg=PartialQuickSort(10:20))) or reconfigure the default sorting algorithm for custom types by adding a specialized method to the Base.Sort.defalg function. For example, InlineStrings.jl defines the following method:

Base.Sort.defalg(::AbstractArray{<:Union{SmallInlineStrings, Missing}}) = InlineStringSort
Julia 1.9

The default sorting algorithm (returned by Base.Sort.defalg) is guaranteed to be stable since Julia 1.9. Previous versions had unstable edge cases when sorting numeric arrays.

Alternate Orderings

By default, sort, searchsorted, and related functions use isless to compare two elements in order to determine which should come first. The Base.Order.Ordering abstract type provides a mechanism for defining alternate orderings on the same set of elements: when calling a sorting function like sort!, an instance of Ordering can be provided with the keyword argument order.

Instances of Ordering define an order through the Base.Order.lt function, which works as a generalization of isless. This function's behavior on custom Orderings must satisfy all the conditions of a strict weak order. See sort! for details and examples of valid and invalid lt functions.

Base.Order.OrderingType
Base.Order.Ordering

Abstract type which represents a strict weak order on some set of elements. See sort! for more.

Use Base.Order.lt to compare two elements according to the ordering.

source
Base.Order.ltFunction
lt(o::Ordering, a, b) -> Bool

Test whether a is less than b according to the ordering o.

source
Base.Order.ordFunction
ord(lt, by, rev::Union{Bool, Nothing}, order::Ordering=Forward)

Construct an Ordering object from the same arguments used by sort!. Elements are first transformed by the function by (which may be identity) and are then compared according to either the function lt or an existing ordering order. lt should be isless or a function that obeys the same rules as the lt parameter of sort!. Finally, the resulting order is reversed if rev=true.

Passing an lt other than isless along with an order other than Base.Order.Forward or Base.Order.Reverse is not permitted, otherwise all options are independent and can be used together in all possible combinations.

source
Base.Order.ForwardConstant
Base.Order.Forward

Default ordering according to isless.

source
Base.Order.ReverseOrderingType
ReverseOrdering(fwd::Ordering=Forward)

A wrapper which reverses an ordering.

For a given Ordering o, the following holds for all a, b:

lt(ReverseOrdering(o), a, b) == lt(o, b, a)
source
Base.Order.ReverseConstant
Base.Order.Reverse

Reverse ordering according to isless.

source
Base.Order.ByType
By(by, order::Ordering=Forward)

Ordering which applies order to elements after they have been transformed by the function by.

source
Base.Order.LtType
Lt(lt)

Ordering that calls lt(a, b) to compare elements. lt must obey the same rules as the lt parameter of sort!.

source
Base.Order.PermType
Perm(order::Ordering, data::AbstractVector)

Ordering on the indices of data where i is less than j if data[i] is less than data[j] according to order. In the case that data[i] and data[j] are equal, i and j are compared by numeric value.

source
diff --git a/en/v1.12-dev/base/stacktraces/index.html b/en/v1.12-dev/base/stacktraces/index.html index ef82ec2f06b..b05ffac9e08 100644 --- a/en/v1.12-dev/base/stacktraces/index.html +++ b/en/v1.12-dev/base/stacktraces/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

StackTraces

Base.StackTraces.StackFrameType
StackFrame

Stack information representing execution context, with the following fields:

  • func::Symbol

    The name of the function containing the execution context.

  • linfo::Union{Method, Core.MethodInstance, Core.CodeInstance, Core.CodeInfo, Nothing}

    The Method, MethodInstance, CodeInstance, or CodeInfo containing the execution context (if it could be found), or nothing (for example, if the inlining was a result of macro expansion).

  • file::Symbol

    The path to the file containing the execution context.

  • line::Int

    The line number in the file containing the execution context.

  • from_c::Bool

    True if the code is from C.

  • inlined::Bool

    True if the code is from an inlined frame.

  • pointer::UInt64

    Representation of the pointer to the execution context as returned by backtrace.

source
Base.StackTraces.stacktraceFunction
stacktrace([trace::Vector{Ptr{Cvoid}},] [c_funcs::Bool=false]) -> StackTrace

Return a stack trace in the form of a vector of StackFrames. (By default stacktrace doesn't return C functions, but this can be enabled.) When called without specifying a trace, stacktrace first calls backtrace.

source

The following methods and types in Base.StackTraces are not exported and need to be called e.g. as StackTraces.lookup(ptr).

Base.StackTraces.lookupFunction
lookup(pointer::Ptr{Cvoid}) -> Vector{StackFrame}

Given a pointer to an execution context (usually generated by a call to backtrace), looks up stack frame context information. Returns an array of frame information for all functions inlined at that point, innermost function first.

source
Base.StackTraces.remove_frames!Function
remove_frames!(stack::StackTrace, m::Module)

Return the StackTrace with all StackFrames from the provided Module removed.

source
remove_frames!(stack::StackTrace, name::Symbol)

Takes a StackTrace (a vector of StackFrames) and a function name (a Symbol) and removes the StackFrame specified by the function name from the StackTrace (also removing all frames above the specified function). Primarily used to remove StackTraces functions from the StackTrace prior to returning it.

source
+

StackTraces

Base.StackTraces.StackFrameType
StackFrame

Stack information representing execution context, with the following fields:

  • func::Symbol

    The name of the function containing the execution context.

  • linfo::Union{Method, Core.MethodInstance, Core.CodeInstance, Core.CodeInfo, Nothing}

    The Method, MethodInstance, CodeInstance, or CodeInfo containing the execution context (if it could be found), or nothing (for example, if the inlining was a result of macro expansion).

  • file::Symbol

    The path to the file containing the execution context.

  • line::Int

    The line number in the file containing the execution context.

  • from_c::Bool

    True if the code is from C.

  • inlined::Bool

    True if the code is from an inlined frame.

  • pointer::UInt64

    Representation of the pointer to the execution context as returned by backtrace.

source
Base.StackTraces.stacktraceFunction
stacktrace([trace::Vector{Ptr{Cvoid}},] [c_funcs::Bool=false]) -> StackTrace

Return a stack trace in the form of a vector of StackFrames. (By default stacktrace doesn't return C functions, but this can be enabled.) When called without specifying a trace, stacktrace first calls backtrace.

source

The following methods and types in Base.StackTraces are not exported and need to be called e.g. as StackTraces.lookup(ptr).

Base.StackTraces.lookupFunction
lookup(pointer::Ptr{Cvoid}) -> Vector{StackFrame}

Given a pointer to an execution context (usually generated by a call to backtrace), looks up stack frame context information. Returns an array of frame information for all functions inlined at that point, innermost function first.

source
Base.StackTraces.remove_frames!Function
remove_frames!(stack::StackTrace, m::Module)

Return the StackTrace with all StackFrames from the provided Module removed.

source
remove_frames!(stack::StackTrace, name::Symbol)

Takes a StackTrace (a vector of StackFrames) and a function name (a Symbol) and removes the StackFrame specified by the function name from the StackTrace (also removing all frames above the specified function). Primarily used to remove StackTraces functions from the StackTrace prior to returning it.

source
diff --git a/en/v1.12-dev/base/strings/index.html b/en/v1.12-dev/base/strings/index.html index 7fde4c5182a..4edf1507611 100644 --- a/en/v1.12-dev/base/strings/index.html +++ b/en/v1.12-dev/base/strings/index.html @@ -3,25 +3,25 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Strings

Core.AbstractStringType

The AbstractString type is the supertype of all string implementations in Julia. Strings are encodings of sequences of Unicode code points as represented by the AbstractChar type. Julia makes a few assumptions about strings:

  • Strings are encoded in terms of fixed-size "code units"
    • Code units can be extracted with codeunit(s, i)
    • The first code unit has index 1
    • The last code unit has index ncodeunits(s)
    • Any index i such that 1 ≤ i ≤ ncodeunits(s) is in bounds
  • String indexing is done in terms of these code units:
    • Characters are extracted by s[i] with a valid string index i
    • Each AbstractChar in a string is encoded by one or more code units
    • Only the index of the first code unit of an AbstractChar is a valid index
    • The encoding of an AbstractChar is independent of what precedes or follows it
    • String encodings are self-synchronizing – i.e. isvalid(s, i) is O(1)

Some string functions that extract code units, characters or substrings from strings error if you pass them out-of-bounds or invalid string indices. This includes codeunit(s, i) and s[i]. Functions that do string index arithmetic take a more relaxed approach to indexing and give you the closest valid string index when in-bounds, or when out-of-bounds, behave as if there were an infinite number of characters padding each side of the string. Usually these imaginary padding characters have code unit length 1 but string types may choose different "imaginary" character sizes as makes sense for their implementations (e.g. substrings may pass index arithmetic through to the underlying string they provide a view into). Relaxed indexing functions include those intended for index arithmetic: thisind, nextind and prevind. This model allows index arithmetic to work with out-of-bounds indices as intermediate values so long as one never uses them to retrieve a character, which often helps avoid needing to code around edge cases.

See also codeunit, ncodeunits, thisind, nextind, prevind.

source
Core.AbstractCharType

The AbstractChar type is the supertype of all character implementations in Julia. A character represents a Unicode code point, and can be converted to an integer via the codepoint function in order to obtain the numerical value of the code point, or constructed from the same integer. These numerical values determine how characters are compared with < and ==, for example. New T <: AbstractChar types should define a codepoint(::T) method and a T(::UInt32) constructor, at minimum.

A given AbstractChar subtype may be capable of representing only a subset of Unicode, in which case conversion from an unsupported UInt32 value may throw an error. Conversely, the built-in Char type represents a superset of Unicode (in order to losslessly encode invalid byte streams), in which case conversion of a non-Unicode value to UInt32 throws an error. The isvalid function can be used to check which codepoints are representable in a given AbstractChar type.

Internally, an AbstractChar type may use a variety of encodings. Conversion via codepoint(char) will not reveal this encoding because it always returns the Unicode value of the character. print(io, c) of any c::AbstractChar produces an encoding determined by io (UTF-8 for all built-in IO types), via conversion to Char if necessary.

write(io, c), in contrast, may emit an encoding depending on typeof(c), and read(io, typeof(c)) should read the same encoding as write. New AbstractChar types must provide their own implementations of write and read.

source
Core.CharType
Char(c::Union{Number,AbstractChar})

Char is a 32-bit AbstractChar type that is the default representation of characters in Julia. Char is the type used for character literals like 'x' and it is also the element type of String.

In order to losslessly represent arbitrary byte streams stored in a String, a Char value may store information that cannot be converted to a Unicode codepoint — converting such a Char to UInt32 will throw an error. The isvalid(c::Char) function can be used to query whether c represents a valid Unicode character.

source
Base.codepointFunction
codepoint(c::AbstractChar) -> Integer

Return the Unicode codepoint (an unsigned integer) corresponding to the character c (or throw an exception if c does not represent a valid character). For Char, this is a UInt32 value, but AbstractChar types that represent only a subset of Unicode may return a different-sized integer (e.g. UInt8).

source
Base.lengthMethod
length(s::AbstractString) -> Int
+

Strings

Core.AbstractStringType

The AbstractString type is the supertype of all string implementations in Julia. Strings are encodings of sequences of Unicode code points as represented by the AbstractChar type. Julia makes a few assumptions about strings:

  • Strings are encoded in terms of fixed-size "code units"
    • Code units can be extracted with codeunit(s, i)
    • The first code unit has index 1
    • The last code unit has index ncodeunits(s)
    • Any index i such that 1 ≤ i ≤ ncodeunits(s) is in bounds
  • String indexing is done in terms of these code units:
    • Characters are extracted by s[i] with a valid string index i
    • Each AbstractChar in a string is encoded by one or more code units
    • Only the index of the first code unit of an AbstractChar is a valid index
    • The encoding of an AbstractChar is independent of what precedes or follows it
    • String encodings are self-synchronizing – i.e. isvalid(s, i) is O(1)

Some string functions that extract code units, characters or substrings from strings error if you pass them out-of-bounds or invalid string indices. This includes codeunit(s, i) and s[i]. Functions that do string index arithmetic take a more relaxed approach to indexing and give you the closest valid string index when in-bounds, or when out-of-bounds, behave as if there were an infinite number of characters padding each side of the string. Usually these imaginary padding characters have code unit length 1 but string types may choose different "imaginary" character sizes as makes sense for their implementations (e.g. substrings may pass index arithmetic through to the underlying string they provide a view into). Relaxed indexing functions include those intended for index arithmetic: thisind, nextind and prevind. This model allows index arithmetic to work with out-of-bounds indices as intermediate values so long as one never uses them to retrieve a character, which often helps avoid needing to code around edge cases.

See also codeunit, ncodeunits, thisind, nextind, prevind.

source
Core.AbstractCharType

The AbstractChar type is the supertype of all character implementations in Julia. A character represents a Unicode code point, and can be converted to an integer via the codepoint function in order to obtain the numerical value of the code point, or constructed from the same integer. These numerical values determine how characters are compared with < and ==, for example. New T <: AbstractChar types should define a codepoint(::T) method and a T(::UInt32) constructor, at minimum.

A given AbstractChar subtype may be capable of representing only a subset of Unicode, in which case conversion from an unsupported UInt32 value may throw an error. Conversely, the built-in Char type represents a superset of Unicode (in order to losslessly encode invalid byte streams), in which case conversion of a non-Unicode value to UInt32 throws an error. The isvalid function can be used to check which codepoints are representable in a given AbstractChar type.

Internally, an AbstractChar type may use a variety of encodings. Conversion via codepoint(char) will not reveal this encoding because it always returns the Unicode value of the character. print(io, c) of any c::AbstractChar produces an encoding determined by io (UTF-8 for all built-in IO types), via conversion to Char if necessary.

write(io, c), in contrast, may emit an encoding depending on typeof(c), and read(io, typeof(c)) should read the same encoding as write. New AbstractChar types must provide their own implementations of write and read.

source
Core.CharType
Char(c::Union{Number,AbstractChar})

Char is a 32-bit AbstractChar type that is the default representation of characters in Julia. Char is the type used for character literals like 'x' and it is also the element type of String.

In order to losslessly represent arbitrary byte streams stored in a String, a Char value may store information that cannot be converted to a Unicode codepoint — converting such a Char to UInt32 will throw an error. The isvalid(c::Char) function can be used to query whether c represents a valid Unicode character.

source
Base.codepointFunction
codepoint(c::AbstractChar) -> Integer

Return the Unicode codepoint (an unsigned integer) corresponding to the character c (or throw an exception if c does not represent a valid character). For Char, this is a UInt32 value, but AbstractChar types that represent only a subset of Unicode may return a different-sized integer (e.g. UInt8).

source
Base.lengthMethod
length(s::AbstractString) -> Int
 length(s::AbstractString, i::Integer, j::Integer) -> Int

Return the number of characters in string s from indices i through j.

This is computed as the number of code unit indices from i to j which are valid character indices. With only a single string argument, this computes the number of characters in the entire string. With i and j arguments it computes the number of indices between i and j inclusive that are valid indices in the string s. In addition to in-bounds values, i may take the out-of-bounds value ncodeunits(s) + 1 and j may take the out-of-bounds value 0.

Note

The time complexity of this operation is linear in general. That is, it will take the time proportional to the number of bytes or characters in the string because it counts the value on the fly. This is in contrast to the method for arrays, which is a constant-time operation.

See also isvalid, ncodeunits, lastindex, thisind, nextind, prevind.

Examples

julia> length("jμΛIα")
-5
source
Base.sizeofMethod
sizeof(str::AbstractString)

Size, in bytes, of the string str. Equal to the number of code units in str multiplied by the size, in bytes, of one code unit in str.

Examples

julia> sizeof("")
+5
source
Base.sizeofMethod
sizeof(str::AbstractString)

Size, in bytes, of the string str. Equal to the number of code units in str multiplied by the size, in bytes, of one code unit in str.

Examples

julia> sizeof("")
 0
 
 julia> sizeof("∀")
-3
source
Base.:*Method
*(s::Union{AbstractString, AbstractChar}, t::Union{AbstractString, AbstractChar}...) -> AbstractString

Concatenate strings and/or characters, producing a String or AnnotatedString (as appropriate). This is equivalent to calling the string or annotatedstring function on the arguments. Concatenation of built-in string types always produces a value of type String but other string types may choose to return a string of a different type as appropriate.

Examples

julia> "Hello " * "world"
+3
source
Base.:*Method
*(s::Union{AbstractString, AbstractChar}, t::Union{AbstractString, AbstractChar}...) -> AbstractString

Concatenate strings and/or characters, producing a String or AnnotatedString (as appropriate). This is equivalent to calling the string or annotatedstring function on the arguments. Concatenation of built-in string types always produces a value of type String but other string types may choose to return a string of a different type as appropriate.

Examples

julia> "Hello " * "world"
 "Hello world"
 
 julia> 'j' * "ulia"
-"julia"
source
Base.:^Method
^(s::Union{AbstractString,AbstractChar}, n::Integer) -> AbstractString

Repeat a string or character n times. This can also be written as repeat(s, n).

See also repeat.

Examples

julia> "Test "^3
-"Test Test Test "
source
Base.stringFunction
string(xs...)

Create a string from any values using the print function.

string should usually not be defined directly. Instead, define a method print(io::IO, x::MyType). If string(x) for a certain type needs to be highly efficient, then it may make sense to add a method to string and define print(io::IO, x::MyType) = print(io, string(x)) to ensure the functions are consistent.

See also: String, repr, sprint, show.

Examples

julia> string("a", 1, true)
-"a1true"
source
string(n::Integer; base::Integer = 10, pad::Integer = 1)

Convert an integer n to a string in the given base, optionally specifying a number of digits to pad to.

See also digits, bitstring, count_zeros.

Examples

julia> string(5, base = 13, pad = 4)
+"julia"
source
Base.:^Method
^(s::Union{AbstractString,AbstractChar}, n::Integer) -> AbstractString

Repeat a string or character n times. This can also be written as repeat(s, n).

See also repeat.

Examples

julia> "Test "^3
+"Test Test Test "
source
Base.stringFunction
string(xs...)

Create a string from any values using the print function.

string should usually not be defined directly. Instead, define a method print(io::IO, x::MyType). If string(x) for a certain type needs to be highly efficient, then it may make sense to add a method to string and define print(io::IO, x::MyType) = print(io, string(x)) to ensure the functions are consistent.

See also: String, repr, sprint, show.

Examples

julia> string("a", 1, true)
+"a1true"
source
string(n::Integer; base::Integer = 10, pad::Integer = 1)

Convert an integer n to a string in the given base, optionally specifying a number of digits to pad to.

See also digits, bitstring, count_zeros.

Examples

julia> string(5, base = 13, pad = 4)
 "0005"
 
 julia> string(-13, base = 5, pad = 4)
-"-0023"
source
Base.repeatMethod
repeat(s::AbstractString, r::Integer)

Repeat a string r times. This can be written as s^r.

See also ^.

Examples

julia> repeat("ha", 3)
-"hahaha"
source
Base.repeatMethod
repeat(c::AbstractChar, r::Integer) -> String

Repeat a character r times. This can equivalently be accomplished by calling c^r.

Examples

julia> repeat('A', 3)
-"AAA"
source
Base.reprMethod
repr(x; context=nothing)

Create a string representation of any value using the 2-argument show(io, x) function, which aims to produce a string that is parseable Julia code, where possible. i.e. eval(Meta.parse(repr(x))) == x should hold true. You should not add methods to repr; define a show method instead.

The optional keyword argument context can be set to a :key=>value pair, a tuple of :key=>value pairs, or an IO or IOContext object whose attributes are used for the I/O stream passed to show.

Note that repr(x) is usually similar to how the value of x would be entered in Julia. See also repr(MIME("text/plain"), x) to instead return a "pretty-printed" version of x designed more for human consumption, equivalent to the REPL display of x, using the 3-argument show(io, mime, x).

Julia 1.7

Passing a tuple to keyword context requires Julia 1.7 or later.

Examples

julia> repr(1)
+"-0023"
source
Base.repeatMethod
repeat(s::AbstractString, r::Integer)

Repeat a string r times. This can be written as s^r.

See also ^.

Examples

julia> repeat("ha", 3)
+"hahaha"
source
Base.repeatMethod
repeat(c::AbstractChar, r::Integer) -> String

Repeat a character r times. This can equivalently be accomplished by calling c^r.

Examples

julia> repeat('A', 3)
+"AAA"
source
Base.reprMethod
repr(x; context=nothing)

Create a string representation of any value using the 2-argument show(io, x) function, which aims to produce a string that is parseable Julia code, where possible. i.e. eval(Meta.parse(repr(x))) == x should hold true. You should not add methods to repr; define a show method instead.

The optional keyword argument context can be set to a :key=>value pair, a tuple of :key=>value pairs, or an IO or IOContext object whose attributes are used for the I/O stream passed to show.

Note that repr(x) is usually similar to how the value of x would be entered in Julia. See also repr(MIME("text/plain"), x) to instead return a "pretty-printed" version of x designed more for human consumption, equivalent to the REPL display of x, using the 3-argument show(io, mime, x).

Julia 1.7

Passing a tuple to keyword context requires Julia 1.7 or later.

Examples

julia> repr(1)
 "1"
 
 julia> repr(zeros(3))
@@ -32,7 +32,7 @@
 
 julia> repr(big(1/3), context=:compact => true)
 "0.333333"
-
source
Core.StringMethod
String(s::AbstractString)

Create a new String from an existing AbstractString.

source
Core.StringMethod
String(s::AbstractString)

Create a new String from an existing AbstractString.

source
Base.SubStringType
SubString(s::AbstractString, i::Integer, j::Integer=lastindex(s))
 SubString(s::AbstractString, r::UnitRange{<:Integer})

Like getindex, but returns a view into the parent string s within range i:j or r respectively instead of making a copy.

The @views macro converts any string slices s[i:j] into substrings SubString(s, i, j) in a block of code.

Examples

julia> SubString("abc", 1, 2)
 "ab"
 
@@ -40,12 +40,12 @@
 "ab"
 
 julia> SubString("abc", 2)
-"bc"
source
Base.LazyStringType
LazyString <: AbstractString

A lazy representation of string interpolation. This is useful when a string needs to be constructed in a context where performing the actual interpolation and string construction is unnecessary or undesirable (e.g. in error paths of functions).

This type is designed to be cheap to construct at runtime, trying to offload as much work as possible to either the macro or later printing operations.

Examples

julia> n = 5; str = LazyString("n is ", n)
-"n is 5"

See also @lazy_str.

Julia 1.8

LazyString requires Julia 1.8 or later.

Extended help

Safety properties for concurrent programs

A lazy string itself does not introduce any concurrency problems even if it is printed in multiple Julia tasks. However, if print methods on a captured value can have a concurrency issue when invoked without synchronizations, printing the lazy string may cause an issue. Furthermore, the print methods on the captured values may be invoked multiple times, though only exactly one result will be returned.

Julia 1.9

LazyString is safe in the above sense in Julia 1.9 and later.

source
Base.@lazy_strMacro
lazy"str"

Create a LazyString using regular string interpolation syntax. Note that interpolations are evaluated at LazyString construction time, but printing is delayed until the first access to the string.

See LazyString documentation for the safety properties for concurrent programs.

Examples

julia> n = 5; str = lazy"n is $n"
+"bc"
source
Base.LazyStringType
LazyString <: AbstractString

A lazy representation of string interpolation. This is useful when a string needs to be constructed in a context where performing the actual interpolation and string construction is unnecessary or undesirable (e.g. in error paths of functions).

This type is designed to be cheap to construct at runtime, trying to offload as much work as possible to either the macro or later printing operations.

Examples

julia> n = 5; str = LazyString("n is ", n)
+"n is 5"

See also @lazy_str.

Julia 1.8

LazyString requires Julia 1.8 or later.

Extended help

Safety properties for concurrent programs

A lazy string itself does not introduce any concurrency problems even if it is printed in multiple Julia tasks. However, if print methods on a captured value can have a concurrency issue when invoked without synchronizations, printing the lazy string may cause an issue. Furthermore, the print methods on the captured values may be invoked multiple times, though only exactly one result will be returned.

Julia 1.9

LazyString is safe in the above sense in Julia 1.9 and later.

source
Base.@lazy_strMacro
lazy"str"

Create a LazyString using regular string interpolation syntax. Note that interpolations are evaluated at LazyString construction time, but printing is delayed until the first access to the string.

See LazyString documentation for the safety properties for concurrent programs.

Examples

julia> n = 5; str = lazy"n is $n"
 "n is 5"
 
 julia> typeof(str)
-LazyString
Julia 1.8

lazy"str" requires Julia 1.8 or later.

source
Base.transcodeFunction
transcode(T, src)

Convert string data between Unicode encodings. src is either a String or a Vector{UIntXX} of UTF-XX code units, where XX is 8, 16, or 32. T indicates the encoding of the return value: String to return a (UTF-8 encoded) String or UIntXX to return a Vector{UIntXX} of UTF-XX data. (The alias Cwchar_t can also be used as the integer type, for converting wchar_t* strings used by external C libraries.)

The transcode function succeeds as long as the input data can be reasonably represented in the target encoding; it always succeeds for conversions between UTF-XX encodings, even for invalid Unicode data.

Only conversion to/from UTF-8 is currently supported.

Examples

julia> str = "αβγ"
+LazyString
Julia 1.8

lazy"str" requires Julia 1.8 or later.

source
Base.transcodeFunction
transcode(T, src)

Convert string data between Unicode encodings. src is either a String or a Vector{UIntXX} of UTF-XX code units, where XX is 8, 16, or 32. T indicates the encoding of the return value: String to return a (UTF-8 encoded) String or UIntXX to return a Vector{UIntXX} of UTF-XX data. (The alias Cwchar_t can also be used as the integer type, for converting wchar_t* strings used by external C libraries.)

The transcode function succeeds as long as the input data can be reasonably represented in the target encoding; it always succeeds for conversions between UTF-XX encodings, even for invalid Unicode data.

Only conversion to/from UTF-8 is currently supported.

Examples

julia> str = "αβγ"
 "αβγ"
 
 julia> transcode(UInt16, str)
@@ -55,42 +55,42 @@
  0x03b3
 
 julia> transcode(String, transcode(UInt16, str))
-"αβγ"
source
Base.unsafe_stringFunction
unsafe_string(p::Ptr{UInt8}, [length::Integer])

Copy a string from the address of a C-style (NUL-terminated) string encoded as UTF-8. (The pointer can be safely freed afterwards.) If length is specified (the length of the data in bytes), the string does not have to be NUL-terminated.

This function is labeled "unsafe" because it will crash if p is not a valid memory address to data of the requested length.

source
Base.ncodeunitsMethod
ncodeunits(s::AbstractString) -> Int

Return the number of code units in a string. Indices that are in bounds to access this string must satisfy 1 ≤ i ≤ ncodeunits(s). Not all such indices are valid – they may not be the start of a character, but they will return a code unit value when calling codeunit(s,i).

Examples

julia> ncodeunits("The Julia Language")
+"αβγ"
source
Base.unsafe_stringFunction
unsafe_string(p::Ptr{UInt8}, [length::Integer])

Copy a string from the address of a C-style (NUL-terminated) string encoded as UTF-8. (The pointer can be safely freed afterwards.) If length is specified (the length of the data in bytes), the string does not have to be NUL-terminated.

This function is labeled "unsafe" because it will crash if p is not a valid memory address to data of the requested length.

source
Base.ncodeunitsMethod
ncodeunits(s::AbstractString) -> Int

Return the number of code units in a string. Indices that are in bounds to access this string must satisfy 1 ≤ i ≤ ncodeunits(s). Not all such indices are valid – they may not be the start of a character, but they will return a code unit value when calling codeunit(s,i).

Examples

julia> ncodeunits("The Julia Language")
 18
 
 julia> ncodeunits("∫eˣ")
 6
 
 julia> ncodeunits('∫'), ncodeunits('e'), ncodeunits('ˣ')
-(3, 1, 2)

See also codeunit, checkbounds, sizeof, length, lastindex.

source
Base.codeunitFunction
codeunit(s::AbstractString, i::Integer) -> Union{UInt8, UInt16, UInt32}

Return the code unit value in the string s at index i. Note that

codeunit(s, i) :: codeunit(s)

I.e. the value returned by codeunit(s, i) is of the type returned by codeunit(s).

Examples

julia> a = codeunit("Hello", 2)
+(3, 1, 2)

See also codeunit, checkbounds, sizeof, length, lastindex.

source
Base.codeunitFunction
codeunit(s::AbstractString, i::Integer) -> Union{UInt8, UInt16, UInt32}

Return the code unit value in the string s at index i. Note that

codeunit(s, i) :: codeunit(s)

I.e. the value returned by codeunit(s, i) is of the type returned by codeunit(s).

Examples

julia> a = codeunit("Hello", 2)
 0x65
 
 julia> typeof(a)
-UInt8

See also ncodeunits, checkbounds.

source
codeunit(s::AbstractString) -> Type{<:Union{UInt8, UInt16, UInt32}}

Return the code unit type of the given string object. For ASCII, Latin-1, or UTF-8 encoded strings, this would be UInt8; for UCS-2 and UTF-16 it would be UInt16; for UTF-32 it would be UInt32. The code unit type need not be limited to these three types, but it's hard to think of widely used string encodings that don't use one of these units. codeunit(s) is the same as typeof(codeunit(s,1)) when s is a non-empty string.

See also ncodeunits.

source
Base.codeunitsFunction
codeunits(s::AbstractString)

Obtain a vector-like object containing the code units of a string. Returns a CodeUnits wrapper by default, but codeunits may optionally be defined for new string types if necessary.

Examples

julia> codeunits("Juλia")
+UInt8

See also ncodeunits, checkbounds.

source
codeunit(s::AbstractString) -> Type{<:Union{UInt8, UInt16, UInt32}}

Return the code unit type of the given string object. For ASCII, Latin-1, or UTF-8 encoded strings, this would be UInt8; for UCS-2 and UTF-16 it would be UInt16; for UTF-32 it would be UInt32. The code unit type need not be limited to these three types, but it's hard to think of widely used string encodings that don't use one of these units. codeunit(s) is the same as typeof(codeunit(s,1)) when s is a non-empty string.

See also ncodeunits.

source
Base.codeunitsFunction
codeunits(s::AbstractString)

Obtain a vector-like object containing the code units of a string. Returns a CodeUnits wrapper by default, but codeunits may optionally be defined for new string types if necessary.

Examples

julia> codeunits("Juλia")
 6-element Base.CodeUnits{UInt8, String}:
  0x4a
  0x75
  0xce
  0xbb
  0x69
- 0x61
source
Base.asciiFunction
ascii(s::AbstractString)

Convert a string to String type and check that it contains only ASCII data, otherwise throwing an ArgumentError indicating the position of the first non-ASCII byte.

See also the isascii predicate to filter or replace non-ASCII characters.

Examples

julia> ascii("abcdeγfgh")
+ 0x61
source
Base.asciiFunction
ascii(s::AbstractString)

Convert a string to String type and check that it contains only ASCII data, otherwise throwing an ArgumentError indicating the position of the first non-ASCII byte.

See also the isascii predicate to filter or replace non-ASCII characters.

Examples

julia> ascii("abcdeγfgh")
 ERROR: ArgumentError: invalid ASCII at index 6 in "abcdeγfgh"
 Stacktrace:
 [...]
 
 julia> ascii("abcdefgh")
-"abcdefgh"
source
Base.RegexType
Regex(pattern[, flags]) <: AbstractPattern

A type representing a regular expression. Regex objects can be used to match strings with match.

Regex objects can be created using the @r_str string macro. The Regex(pattern[, flags]) constructor is usually used if the pattern string needs to be interpolated. See the documentation of the string macro for details on flags.

Note

To escape interpolated variables use \Q and \E (e.g. Regex("\\Q$x\\E"))

source
Base.@r_strMacro
@r_str -> Regex

Construct a regex, such as r"^[a-z]*$", without interpolation and unescaping (except for quotation mark " which still has to be escaped). The regex also accepts one or more flags, listed after the ending quote, to change its behaviour:

  • i enables case-insensitive matching
  • m treats the ^ and $ tokens as matching the start and end of individual lines, as opposed to the whole string.
  • s allows the . modifier to match newlines.
  • x enables "free-spacing mode": whitespace between regex tokens is ignored except when escaped with \, and # in the regex is treated as starting a comment (which is ignored to the line ending).
  • a enables ASCII mode (disables UTF and UCP modes). By default \B, \b, \D, \d, \S, \s, \W, \w, etc. match based on Unicode character properties. With this option, these sequences only match ASCII characters. This includes \u also, which will emit the specified character value directly as a single byte, and not attempt to encode it into UTF-8. Importantly, this option allows matching against invalid UTF-8 strings, by treating both matcher and target as simple bytes (as if they were ISO/IEC 8859-1 / Latin-1 bytes) instead of as character encodings. In this case, this option is often combined with s. This option can be further refined by starting the pattern with (UCP) or (UTF).

See Regex if interpolation is needed.

Examples

julia> match(r"a+.*b+.*?d$"ism, "Goodbye,\nOh, angry,\nBad world\n")
-RegexMatch("angry,\nBad world")

This regex has the first three flags enabled.

source
Base.SubstitutionStringType
SubstitutionString(substr) <: AbstractString

Stores the given string substr as a SubstitutionString, for use in regular expression substitutions. Most commonly constructed using the @s_str macro.

Examples

julia> SubstitutionString("Hello \\g<name>, it's \\1")
+"abcdefgh"
source
Base.RegexType
Regex(pattern[, flags]) <: AbstractPattern

A type representing a regular expression. Regex objects can be used to match strings with match.

Regex objects can be created using the @r_str string macro. The Regex(pattern[, flags]) constructor is usually used if the pattern string needs to be interpolated. See the documentation of the string macro for details on flags.

Note

To escape interpolated variables use \Q and \E (e.g. Regex("\\Q$x\\E"))

source
Base.@r_strMacro
@r_str -> Regex

Construct a regex, such as r"^[a-z]*$", without interpolation and unescaping (except for quotation mark " which still has to be escaped). The regex also accepts one or more flags, listed after the ending quote, to change its behaviour:

  • i enables case-insensitive matching
  • m treats the ^ and $ tokens as matching the start and end of individual lines, as opposed to the whole string.
  • s allows the . modifier to match newlines.
  • x enables "free-spacing mode": whitespace between regex tokens is ignored except when escaped with \, and # in the regex is treated as starting a comment (which is ignored to the line ending).
  • a enables ASCII mode (disables UTF and UCP modes). By default \B, \b, \D, \d, \S, \s, \W, \w, etc. match based on Unicode character properties. With this option, these sequences only match ASCII characters. This includes \u also, which will emit the specified character value directly as a single byte, and not attempt to encode it into UTF-8. Importantly, this option allows matching against invalid UTF-8 strings, by treating both matcher and target as simple bytes (as if they were ISO/IEC 8859-1 / Latin-1 bytes) instead of as character encodings. In this case, this option is often combined with s. This option can be further refined by starting the pattern with (UCP) or (UTF).

See Regex if interpolation is needed.

Examples

julia> match(r"a+.*b+.*?d$"ism, "Goodbye,\nOh, angry,\nBad world\n")
+RegexMatch("angry,\nBad world")

This regex has the first three flags enabled.

source
Base.SubstitutionStringType
SubstitutionString(substr) <: AbstractString

Stores the given string substr as a SubstitutionString, for use in regular expression substitutions. Most commonly constructed using the @s_str macro.

Examples

julia> SubstitutionString("Hello \\g<name>, it's \\1")
 s"Hello \g<name>, it's \1"
 
 julia> subst = s"Hello \g<name>, it's \1"
 s"Hello \g<name>, it's \1"
 
 julia> typeof(subst)
-SubstitutionString{String}
source
Base.@s_strMacro
@s_str -> SubstitutionString

Construct a substitution string, used for regular expression substitutions. Within the string, sequences of the form \N refer to the Nth capture group in the regex, and \g<groupname> refers to a named capture group with name groupname.

Examples

julia> msg = "#Hello# from Julia";
+SubstitutionString{String}
source
Base.@s_strMacro
@s_str -> SubstitutionString

Construct a substitution string, used for regular expression substitutions. Within the string, sequences of the form \N refer to the Nth capture group in the regex, and \g<groupname> refers to a named capture group with name groupname.

Examples

julia> msg = "#Hello# from Julia";
 
 julia> replace(msg, r"#(.+)# from (?<from>\w+)" => s"FROM: \g<from>; MESSAGE: \1")
-"FROM: Julia; MESSAGE: Hello"
source
Base.@raw_strMacro
@raw_str -> String

Create a raw string without interpolation and unescaping. The exception is that quotation marks still must be escaped. Backslashes escape both quotation marks and other backslashes, but only when a sequence of backslashes precedes a quote character. Thus, 2n backslashes followed by a quote encodes n backslashes and the end of the literal while 2n+1 backslashes followed by a quote encodes n backslashes followed by a quote character.

Examples

julia> println(raw"\ $x")
+"FROM: Julia; MESSAGE: Hello"
source
Base.@raw_strMacro
@raw_str -> String

Create a raw string without interpolation and unescaping. The exception is that quotation marks still must be escaped. Backslashes escape both quotation marks and other backslashes, but only when a sequence of backslashes precedes a quote character. Thus, 2n backslashes followed by a quote encodes n backslashes and the end of the literal while 2n+1 backslashes followed by a quote encodes n backslashes followed by a quote character.

Examples

julia> println(raw"\ $x")
 \ $x
 
 julia> println(raw"\"")
@@ -100,7 +100,7 @@
 \"
 
 julia> println(raw"\\x \\\"")
-\\x \"
source
Base.@b_strMacro
@b_str

Create an immutable byte (UInt8) vector using string syntax.

Examples

julia> v = b"12\x01\x02"
+\\x \"
source
Base.@b_strMacro
@b_str

Create an immutable byte (UInt8) vector using string syntax.

Examples

julia> v = b"12\x01\x02"
 4-element Base.CodeUnits{UInt8, String}:
  0x31
  0x32
@@ -108,23 +108,23 @@
  0x02
 
 julia> v[2]
-0x32
source
Base.Docs.@html_strMacro
@html_str -> Docs.HTML

Create an HTML object from a literal string.

Examples

julia> html"Julia"
-HTML{String}("Julia")
source
Base.Docs.@text_strMacro
@text_str -> Docs.Text

Create a Text object from a literal string.

Examples

julia> text"Julia"
-Julia
source
Base.isvalidMethod
isvalid(value) -> Bool

Return true if the given value is valid for its type, which currently can be either AbstractChar or String or SubString{String}.

Examples

julia> isvalid(Char(0xd800))
+0x32
source
Base.Docs.@html_strMacro
@html_str -> Docs.HTML

Create an HTML object from a literal string.

Examples

julia> html"Julia"
+HTML{String}("Julia")
source
Base.Docs.@text_strMacro
@text_str -> Docs.Text

Create a Text object from a literal string.

Examples

julia> text"Julia"
+Julia
source
Base.isvalidMethod
isvalid(value) -> Bool

Return true if the given value is valid for its type, which currently can be either AbstractChar or String or SubString{String}.

Examples

julia> isvalid(Char(0xd800))
 false
 
 julia> isvalid(SubString(String(UInt8[0xfe,0x80,0x80,0x80,0x80,0x80]),1,2))
 false
 
 julia> isvalid(Char(0xd799))
-true
source
Base.isvalidMethod
isvalid(T, value) -> Bool

Return true if the given value is valid for that type. Types currently can be either AbstractChar or String. Values for AbstractChar can be of type AbstractChar or UInt32. Values for String can be of that type, SubString{String}, Vector{UInt8}, or a contiguous subarray thereof.

Examples

julia> isvalid(Char, 0xd800)
+true
source
Base.isvalidMethod
isvalid(T, value) -> Bool

Return true if the given value is valid for that type. Types currently can be either AbstractChar or String. Values for AbstractChar can be of type AbstractChar or UInt32. Values for String can be of that type, SubString{String}, Vector{UInt8}, or a contiguous subarray thereof.

Examples

julia> isvalid(Char, 0xd800)
 false
 
 julia> isvalid(String, SubString("thisisvalid",1,5))
 true
 
 julia> isvalid(Char, 0xd799)
-true
Julia 1.6

Support for subarray values was added in Julia 1.6.

source
Base.isvalidMethod
isvalid(s::AbstractString, i::Integer) -> Bool

Predicate indicating whether the given index is the start of the encoding of a character in s or not. If isvalid(s, i) is true then s[i] will return the character whose encoding starts at that index, if it's false, then s[i] will raise an invalid index error or a bounds error depending on if i is in bounds. In order for isvalid(s, i) to be an O(1) function, the encoding of s must be self-synchronizing. This is a basic assumption of Julia's generic string support.

See also getindex, iterate, thisind, nextind, prevind, length.

Examples

julia> str = "αβγdef";
+true
Julia 1.6

Support for subarray values was added in Julia 1.6.

source
Base.isvalidMethod
isvalid(s::AbstractString, i::Integer) -> Bool

Predicate indicating whether the given index is the start of the encoding of a character in s or not. If isvalid(s, i) is true then s[i] will return the character whose encoding starts at that index, if it's false, then s[i] will raise an invalid index error or a bounds error depending on if i is in bounds. In order for isvalid(s, i) to be an O(1) function, the encoding of s must be self-synchronizing. This is a basic assumption of Julia's generic string support.

See also getindex, iterate, thisind, nextind, prevind, length.

Examples

julia> str = "αβγdef";
 
 julia> isvalid(str, 1)
 true
@@ -138,7 +138,7 @@
 julia> str[2]
 ERROR: StringIndexError: invalid index [2], valid nearby indices [1]=>'α', [3]=>'β'
 Stacktrace:
-[...]
source
Base.matchFunction
match(r::Regex, s::AbstractString[, idx::Integer[, addopts]])

Search for the first match of the regular expression r in s and return a RegexMatch object containing the match, or nothing if the match failed. The optional idx argument specifies an index at which to start the search. The matching substring can be retrieved by accessing m.match, the captured sequences can be retrieved by accessing m.captures. The resulting RegexMatch object can be used to construct other collections: e.g. Tuple(m), NamedTuple(m).

Julia 1.11

Constructing NamedTuples and Dicts requires Julia 1.11

Examples

julia> rx = r"a(.)a"
+[...]
source
Base.matchFunction
match(r::Regex, s::AbstractString[, idx::Integer[, addopts]])

Search for the first match of the regular expression r in s and return a RegexMatch object containing the match, or nothing if the match failed. The optional idx argument specifies an index at which to start the search. The matching substring can be retrieved by accessing m.match, the captured sequences can be retrieved by accessing m.captures. The resulting RegexMatch object can be used to construct other collections: e.g. Tuple(m), NamedTuple(m).

Julia 1.11

Constructing NamedTuples and Dicts requires Julia 1.11

Examples

julia> rx = r"a(.)a"
 r"a(.)a"
 
 julia> m = match(rx, "cabac")
@@ -152,7 +152,7 @@
 "aba"
 
 julia> match(rx, "cabac", 3) === nothing
-true
source
Base.eachmatchFunction
eachmatch(r::Regex, s::AbstractString; overlap::Bool=false)

Search for all matches of the regular expression r in s and return an iterator over the matches. If overlap is true, the matching sequences are allowed to overlap indices in the original string, otherwise they must be from distinct character ranges.

Examples

julia> rx = r"a.a"
+true
source
Base.eachmatchFunction
eachmatch(r::Regex, s::AbstractString; overlap::Bool=false)

Search for all matches of the regular expression r in s and return an iterator over the matches. If overlap is true, the matching sequences are allowed to overlap indices in the original string, otherwise they must be from distinct character ranges.

Examples

julia> rx = r"a.a"
 r"a.a"
 
 julia> m = eachmatch(rx, "a1a2a3a")
@@ -167,7 +167,7 @@
 3-element Vector{RegexMatch}:
  RegexMatch("a1a")
  RegexMatch("a2a")
- RegexMatch("a3a")
source
Base.RegexMatchType
RegexMatch <: AbstractMatch

A type representing a single match to a Regex found in a string. Typically created from the match function.

The match field stores the substring of the entire matched string. The captures field stores the substrings for each capture group, indexed by number. To index by capture group name, the entire match object should be indexed instead, as shown in the examples. The location of the start of the match is stored in the offset field. The offsets field stores the locations of the start of each capture group, with 0 denoting a group that was not captured.

This type can be used as an iterator over the capture groups of the Regex, yielding the substrings captured in each group. Because of this, the captures of a match can be destructured. If a group was not captured, nothing will be yielded instead of a substring.

Methods that accept a RegexMatch object are defined for iterate, length, eltype, keys, haskey, and getindex, where keys are the names or numbers of a capture group. See keys for more information.

Tuple(m), NamedTuple(m), and Dict(m) can be used to construct more flexible collection types from RegexMatch objects.

Julia 1.11

Constructing NamedTuples and Dicts from RegexMatches requires Julia 1.11

Examples

julia> m = match(r"(?<hour>\d+):(?<minute>\d+)(am|pm)?", "11:30 in the morning")
+ RegexMatch("a3a")
source
Base.RegexMatchType
RegexMatch <: AbstractMatch

A type representing a single match to a Regex found in a string. Typically created from the match function.

The match field stores the substring of the entire matched string. The captures field stores the substrings for each capture group, indexed by number. To index by capture group name, the entire match object should be indexed instead, as shown in the examples. The location of the start of the match is stored in the offset field. The offsets field stores the locations of the start of each capture group, with 0 denoting a group that was not captured.

This type can be used as an iterator over the capture groups of the Regex, yielding the substrings captured in each group. Because of this, the captures of a match can be destructured. If a group was not captured, nothing will be yielded instead of a substring.

Methods that accept a RegexMatch object are defined for iterate, length, eltype, keys, haskey, and getindex, where keys are the names or numbers of a capture group. See keys for more information.

Tuple(m), NamedTuple(m), and Dict(m) can be used to construct more flexible collection types from RegexMatch objects.

Julia 1.11

Constructing NamedTuples and Dicts from RegexMatches requires Julia 1.11

Examples

julia> m = match(r"(?<hour>\d+):(?<minute>\d+)(am|pm)?", "11:30 in the morning")
 RegexMatch("11:30", hour="11", minute="30", 3=nothing)
 
 julia> m.match
@@ -192,22 +192,22 @@
 Dict{Any, Union{Nothing, SubString{String}}} with 3 entries:
   "hour"   => "11"
   3        => nothing
-  "minute" => "30"
source
Base.keysMethod
keys(m::RegexMatch) -> Vector

Return a vector of keys for all capture groups of the underlying regex. A key is included even if the capture group fails to match. That is, idx will be in the return value even if m[idx] == nothing.

Unnamed capture groups will have integer keys corresponding to their index. Named capture groups will have string keys.

Julia 1.7

This method was added in Julia 1.7

Examples

julia> keys(match(r"(?<hour>\d+):(?<minute>\d+)(am|pm)?", "11:30"))
+  "minute" => "30"
source
Base.keysMethod
keys(m::RegexMatch) -> Vector

Return a vector of keys for all capture groups of the underlying regex. A key is included even if the capture group fails to match. That is, idx will be in the return value even if m[idx] == nothing.

Unnamed capture groups will have integer keys corresponding to their index. Named capture groups will have string keys.

Julia 1.7

This method was added in Julia 1.7

Examples

julia> keys(match(r"(?<hour>\d+):(?<minute>\d+)(am|pm)?", "11:30"))
 3-element Vector{Any}:
   "hour"
   "minute"
- 3
source
Base.islessMethod
isless(a::AbstractString, b::AbstractString) -> Bool

Test whether string a comes before string b in alphabetical order (technically, in lexicographical order by Unicode code points).

Examples

julia> isless("a", "b")
+ 3
source
Base.islessMethod
isless(a::AbstractString, b::AbstractString) -> Bool

Test whether string a comes before string b in alphabetical order (technically, in lexicographical order by Unicode code points).

Examples

julia> isless("a", "b")
 true
 
 julia> isless("β", "α")
 false
 
 julia> isless("a", "a")
-false
source
Base.:==Method
==(a::AbstractString, b::AbstractString) -> Bool

Test whether two strings are equal character by character (technically, Unicode code point by code point). Should either string be a AnnotatedString the string properties must match too.

Examples

julia> "abc" == "abc"
+false
source
Base.:==Method
==(a::AbstractString, b::AbstractString) -> Bool

Test whether two strings are equal character by character (technically, Unicode code point by code point). Should either string be a AnnotatedString the string properties must match too.

Examples

julia> "abc" == "abc"
 true
 
 julia> "abc" == "αβγ"
-false
source
Base.cmpMethod
cmp(a::AbstractString, b::AbstractString) -> Int

Compare two strings. Return 0 if both strings have the same length and the character at each index is the same in both strings. Return -1 if a is a prefix of b, or if a comes before b in alphabetical order. Return 1 if b is a prefix of a, or if b comes before a in alphabetical order (technically, lexicographical order by Unicode code points).

Examples

julia> cmp("abc", "abc")
+false
source
Base.cmpMethod
cmp(a::AbstractString, b::AbstractString) -> Int

Compare two strings. Return 0 if both strings have the same length and the character at each index is the same in both strings. Return -1 if a is a prefix of b, or if a comes before b in alphabetical order. Return 1 if b is a prefix of a, or if b comes before a in alphabetical order (technically, lexicographical order by Unicode code points).

Examples

julia> cmp("abc", "abc")
 0
 
 julia> cmp("ab", "abc")
@@ -226,34 +226,34 @@
 1
 
 julia> cmp("b", "β")
--1
source
Base.lpadFunction
lpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ') -> String

Stringify s and pad the resulting string on the left with p to make it n characters (in textwidth) long. If s is already n characters long, an equal string is returned. Pad with spaces by default.

Examples

julia> lpad("March", 10)
-"     March"
Julia 1.7

In Julia 1.7, this function was changed to use textwidth rather than a raw character (codepoint) count.

source
Base.rpadFunction
rpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ') -> String

Stringify s and pad the resulting string on the right with p to make it n characters (in textwidth) long. If s is already n characters long, an equal string is returned. Pad with spaces by default.

Examples

julia> rpad("March", 20)
-"March               "
Julia 1.7

In Julia 1.7, this function was changed to use textwidth rather than a raw character (codepoint) count.

source
Base.ltruncateFunction
ltruncate(str::AbstractString, maxwidth::Integer, replacement::Union{AbstractString,AbstractChar} = '…')

Truncate str to at most maxwidth columns (as estimated by textwidth), replacing the first characters with replacement if necessary. The default replacement string is "…".

Examples

julia> s = ltruncate("🍕🍕 I love 🍕", 10)
+-1
source
Base.lpadFunction
lpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ') -> String

Stringify s and pad the resulting string on the left with p to make it n characters (in textwidth) long. If s is already n characters long, an equal string is returned. Pad with spaces by default.

Examples

julia> lpad("March", 10)
+"     March"
Julia 1.7

In Julia 1.7, this function was changed to use textwidth rather than a raw character (codepoint) count.

source
Base.rpadFunction
rpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ') -> String

Stringify s and pad the resulting string on the right with p to make it n characters (in textwidth) long. If s is already n characters long, an equal string is returned. Pad with spaces by default.

Examples

julia> rpad("March", 20)
+"March               "
Julia 1.7

In Julia 1.7, this function was changed to use textwidth rather than a raw character (codepoint) count.

source
Base.ltruncateFunction
ltruncate(str::AbstractString, maxwidth::Integer, replacement::Union{AbstractString,AbstractChar} = '…')

Truncate str to at most maxwidth columns (as estimated by textwidth), replacing the first characters with replacement if necessary. The default replacement string is "…".

Examples

julia> s = ltruncate("🍕🍕 I love 🍕", 10)
 "…I love 🍕"
 
 julia> textwidth(s)
 10
 
 julia> ltruncate("foo", 3)
-"foo"
Julia 1.12

This function was added in Julia 1.12.

See also rtruncate and ctruncate.

source
Base.rtruncateFunction
rtruncate(str::AbstractString, maxwidth::Integer, replacement::Union{AbstractString,AbstractChar} = '…')

Truncate str to at most maxwidth columns (as estimated by textwidth), replacing the last characters with replacement if necessary. The default replacement string is "…".

Examples

julia> s = rtruncate("🍕🍕 I love 🍕", 10)
+"foo"
Julia 1.12

This function was added in Julia 1.12.

See also rtruncate and ctruncate.

source
Base.rtruncateFunction
rtruncate(str::AbstractString, maxwidth::Integer, replacement::Union{AbstractString,AbstractChar} = '…')

Truncate str to at most maxwidth columns (as estimated by textwidth), replacing the last characters with replacement if necessary. The default replacement string is "…".

Examples

julia> s = rtruncate("🍕🍕 I love 🍕", 10)
 "🍕🍕 I lo…"
 
 julia> textwidth(s)
 10
 
 julia> rtruncate("foo", 3)
-"foo"
Julia 1.12

This function was added in Julia 1.12.

See also ltruncate and ctruncate.

source
Base.ctruncateFunction
ctruncate(str::AbstractString, maxwidth::Integer, replacement::Union{AbstractString,AbstractChar} = '…'; prefer_left::Bool = true)

Truncate str to at most maxwidth columns (as estimated by textwidth), replacing the middle characters with replacement if necessary. The default replacement string is "…". By default, the truncation prefers keeping chars on the left, but this can be changed by setting prefer_left to false.

Examples

julia> s = ctruncate("🍕🍕 I love 🍕", 10)
+"foo"
Julia 1.12

This function was added in Julia 1.12.

See also ltruncate and ctruncate.

source
Base.ctruncateFunction
ctruncate(str::AbstractString, maxwidth::Integer, replacement::Union{AbstractString,AbstractChar} = '…'; prefer_left::Bool = true)

Truncate str to at most maxwidth columns (as estimated by textwidth), replacing the middle characters with replacement if necessary. The default replacement string is "…". By default, the truncation prefers keeping chars on the left, but this can be changed by setting prefer_left to false.

Examples

julia> s = ctruncate("🍕🍕 I love 🍕", 10)
 "🍕🍕 …e 🍕"
 
 julia> textwidth(s)
 10
 
 julia> ctruncate("foo", 3)
-"foo"
Julia 1.12

This function was added in Julia 1.12.

See also ltruncate and rtruncate.

source
Base.findfirstMethod
findfirst(pattern::AbstractString, string::AbstractString)
 findfirst(pattern::AbstractPattern, string::String)

Find the first occurrence of pattern in string. Equivalent to findnext(pattern, string, firstindex(s)).

Examples

julia> findfirst("z", "Hello to the world") # returns nothing, but not printed in the REPL
 
 julia> findfirst("Julia", "JuliaLang")
-1:5
source
Base.findnextMethod
findnext(pattern::AbstractString, string::AbstractString, start::Integer)
+1:5
source
Base.findnextMethod
findnext(pattern::AbstractString, string::AbstractString, start::Integer)
 findnext(pattern::AbstractPattern, string::String, start::Integer)

Find the next occurrence of pattern in string starting at position start. pattern can be either a string, or a regular expression, in which case string must be of type String.

The return value is a range of indices where the matching sequence is found, such that s[findnext(x, s, i)] == x:

findnext("substring", string, i) == start:stop such that string[start:stop] == "substring" and i <= start, or nothing if unmatched.

Examples

julia> findnext("z", "Hello to the world", 1) === nothing
 true
 
@@ -261,32 +261,32 @@
 8:8
 
 julia> findnext("Lang", "JuliaLang", 2)
-6:9
source
Base.findnextMethod
findnext(ch::AbstractChar, string::AbstractString, start::Integer)

Find the next occurrence of character ch in string starting at position start.

Julia 1.3

This method requires at least Julia 1.3.

Examples

julia> findnext('z', "Hello to the world", 1) === nothing
+6:9
source
Base.findnextMethod
findnext(ch::AbstractChar, string::AbstractString, start::Integer)

Find the next occurrence of character ch in string starting at position start.

Julia 1.3

This method requires at least Julia 1.3.

Examples

julia> findnext('z', "Hello to the world", 1) === nothing
 true
 
 julia> findnext('o', "Hello to the world", 6)
-8
source
Base.findlastMethod
findlast(ch::AbstractChar, string::AbstractString)

Find the last occurrence of character ch in string.

Julia 1.3

This method requires at least Julia 1.3.

Examples

julia> findlast('p', "happy")
+1:5
source
Base.findlastMethod
findlast(ch::AbstractChar, string::AbstractString)

Find the last occurrence of character ch in string.

Julia 1.3

This method requires at least Julia 1.3.

Examples

julia> findlast('p', "happy")
 4
 
 julia> findlast('z', "happy") === nothing
-true
source
Base.findprevMethod
findprev(pattern::AbstractString, string::AbstractString, start::Integer)

Find the previous occurrence of pattern in string starting at position start.

The return value is a range of indices where the matching sequence is found, such that s[findprev(x, s, i)] == x:

findprev("substring", string, i) == start:stop such that string[start:stop] == "substring" and stop <= i, or nothing if unmatched.

Examples

julia> findprev("z", "Hello to the world", 18) === nothing
+true
source
Base.findprevMethod
findprev(pattern::AbstractString, string::AbstractString, start::Integer)

Find the previous occurrence of pattern in string starting at position start.

The return value is a range of indices where the matching sequence is found, such that s[findprev(x, s, i)] == x:

findprev("substring", string, i) == start:stop such that string[start:stop] == "substring" and stop <= i, or nothing if unmatched.

Examples

julia> findprev("z", "Hello to the world", 18) === nothing
 true
 
 julia> findprev("o", "Hello to the world", 18)
 15:15
 
 julia> findprev("Julia", "JuliaLang", 6)
-1:5
source
Base.occursinFunction
occursin(haystack)

Create a function that checks whether its argument occurs in haystack, i.e. a function equivalent to needle -> occursin(needle, haystack).

The returned function is of type Base.Fix2{typeof(occursin)}.

Julia 1.6

This method requires Julia 1.6 or later.

Examples

julia> search_f = occursin("JuliaLang is a programming language");
+1:5
source
Base.occursinFunction
occursin(haystack)

Create a function that checks whether its argument occurs in haystack, i.e. a function equivalent to needle -> occursin(needle, haystack).

The returned function is of type Base.Fix2{typeof(occursin)}.

Julia 1.6

This method requires Julia 1.6 or later.

Examples

julia> search_f = occursin("JuliaLang is a programming language");
 
 julia> search_f("JuliaLang")
 true
 
 julia> search_f("Python")
-false
source
occursin(needle::Union{AbstractString,AbstractPattern,AbstractChar}, haystack::AbstractString)

Determine whether the first argument is a substring of the second. If needle is a regular expression, checks whether haystack contains a match.

Examples

julia> occursin("Julia", "JuliaLang is pretty cool!")
+false
source
occursin(needle::Union{AbstractString,AbstractPattern,AbstractChar}, haystack::AbstractString)

Determine whether the first argument is a substring of the second. If needle is a regular expression, checks whether haystack contains a match.

Examples

julia> occursin("Julia", "JuliaLang is pretty cool!")
 true
 
 julia> occursin('a', "JuliaLang is pretty cool!")
@@ -296,14 +296,14 @@
 true
 
 julia> occursin(r"a.a", "abba")
-false

See also contains.

source
Base.reverseMethod
reverse(s::AbstractString) -> AbstractString

Reverses a string. Technically, this function reverses the codepoints in a string and its main utility is for reversed-order string processing, especially for reversed regular-expression searches. See also reverseind to convert indices in s to indices in reverse(s) and vice-versa, and graphemes from module Unicode to operate on user-visible "characters" (graphemes) rather than codepoints. See also Iterators.reverse for reverse-order iteration without making a copy. Custom string types must implement the reverse function themselves and should typically return a string with the same type and encoding. If they return a string with a different encoding, they must also override reverseind for that string type to satisfy s[reverseind(s,i)] == reverse(s)[i].

Examples

julia> reverse("JuliaLang")
+false

See also contains.

source
Base.reverseMethod
reverse(s::AbstractString) -> AbstractString

Reverses a string. Technically, this function reverses the codepoints in a string and its main utility is for reversed-order string processing, especially for reversed regular-expression searches. See also reverseind to convert indices in s to indices in reverse(s) and vice-versa, and graphemes from module Unicode to operate on user-visible "characters" (graphemes) rather than codepoints. See also Iterators.reverse for reverse-order iteration without making a copy. Custom string types must implement the reverse function themselves and should typically return a string with the same type and encoding. If they return a string with a different encoding, they must also override reverseind for that string type to satisfy s[reverseind(s,i)] == reverse(s)[i].

Examples

julia> reverse("JuliaLang")
 "gnaLailuJ"
Note

The examples below may be rendered differently on different systems. The comments indicate how they're supposed to be rendered

Combining characters can lead to surprising results:

julia> reverse("ax̂e") # hat is above x in the input, above e in the output
 "êxa"
 
 julia> using Unicode
 
 julia> join(reverse(collect(graphemes("ax̂e")))) # reverses graphemes; hat is above x in both in- and output
-"ex̂a"
source
Base.replaceMethod
replace([io::IO], s::AbstractString, pat=>r, [pat2=>r2, ...]; [count::Integer])

Search for the given pattern pat in s, and replace each occurrence with r. If count is provided, replace at most count occurrences. pat may be a single character, a vector or a set of characters, a string, or a regular expression. If r is a function, each occurrence is replaced with r(s) where s is the matched substring (when pat is a AbstractPattern or AbstractString) or character (when pat is an AbstractChar or a collection of AbstractChar). If pat is a regular expression and r is a SubstitutionString, then capture group references in r are replaced with the corresponding matched text. To remove instances of pat from string, set r to the empty String ("").

The return value is a new string after the replacements. If the io::IO argument is supplied, the transformed string is instead written to io (returning io). (For example, this can be used in conjunction with an IOBuffer to re-use a pre-allocated buffer array in-place.)

Multiple patterns can be specified, and they will be applied left-to-right simultaneously, so only one pattern will be applied to any character, and the patterns will only be applied to the input text, not the replacements.

Julia 1.7

Support for multiple patterns requires version 1.7.

Julia 1.10

The io::IO argument requires version 1.10.

Examples

julia> replace("Python is a programming language.", "Python" => "Julia")
+"ex̂a"
source
Base.replaceMethod
replace([io::IO], s::AbstractString, pat=>r, [pat2=>r2, ...]; [count::Integer])

Search for the given pattern pat in s, and replace each occurrence with r. If count is provided, replace at most count occurrences. pat may be a single character, a vector or a set of characters, a string, or a regular expression. If r is a function, each occurrence is replaced with r(s) where s is the matched substring (when pat is a AbstractPattern or AbstractString) or character (when pat is an AbstractChar or a collection of AbstractChar). If pat is a regular expression and r is a SubstitutionString, then capture group references in r are replaced with the corresponding matched text. To remove instances of pat from string, set r to the empty String ("").

The return value is a new string after the replacements. If the io::IO argument is supplied, the transformed string is instead written to io (returning io). (For example, this can be used in conjunction with an IOBuffer to re-use a pre-allocated buffer array in-place.)

Multiple patterns can be specified, and they will be applied left-to-right simultaneously, so only one pattern will be applied to any character, and the patterns will only be applied to the input text, not the replacements.

Julia 1.7

Support for multiple patterns requires version 1.7.

Julia 1.10

The io::IO argument requires version 1.10.

Examples

julia> replace("Python is a programming language.", "Python" => "Julia")
 "Julia is a programming language."
 
 julia> replace("The quick foxes run quickly.", "quick" => "slow", count=1)
@@ -316,7 +316,7 @@
 "The quick buses run quickly."
 
 julia> replace("abcabc", "a" => "b", "b" => "c", r".+" => "a")
-"bca"
source
Base.eachsplitFunction
eachsplit(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
+"bca"
source
Base.eachsplitFunction
eachsplit(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
 eachsplit(str::AbstractString; limit::Integer=0, keepempty::Bool=false)

Split str on occurrences of the delimiter(s) dlm and return an iterator over the substrings. dlm can be any of the formats allowed by findnext's first argument (i.e. as a string, regular expression or a function), or as a single character or collection of characters.

If dlm is omitted, it defaults to isspace.

The optional keyword arguments are:

  • limit: the maximum size of the result. limit=0 implies no maximum (default)
  • keepempty: whether empty fields should be kept in the result. Default is false without a dlm argument, true with a dlm argument.

See also split.

Julia 1.8

The eachsplit function requires at least Julia 1.8.

Examples

julia> a = "Ma.rch"
 "Ma.rch"
 
@@ -326,21 +326,21 @@
 julia> collect(b)
 2-element Vector{SubString{String}}:
  "Ma"
- "rch"
source
Base.eachrsplitFunction
eachrsplit(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
+ "rch"
source
Base.eachrsplitFunction
eachrsplit(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
 eachrsplit(str::AbstractString; limit::Integer=0, keepempty::Bool=false)

Return an iterator over SubStrings of str, produced when splitting on the delimiter(s) dlm, and yielded in reverse order (from right to left). dlm can be any of the formats allowed by findprev's first argument (i.e. a string, a single character or a function), or a collection of characters.

If dlm is omitted, it defaults to isspace, and keepempty default to false.

The optional keyword arguments are:

  • If limit > 0, the iterator will split at most limit - 1 times before returning the rest of the string unsplit. limit < 1 implies no cap to splits (default).
  • keepempty: whether empty fields should be returned when iterating Default is false without a dlm argument, true with a dlm argument.

Note that unlike split, rsplit and eachsplit, this function iterates the substrings right to left as they occur in the input.

See also eachsplit, rsplit.

Julia 1.11

This function requires Julia 1.11 or later.

Examples

julia> a = "Ma.r.ch";
 
 julia> collect(eachrsplit(a, ".")) == ["ch", "r", "Ma"]
 true
 
 julia> collect(eachrsplit(a, "."; limit=2)) == ["ch", "Ma.r"]
-true
source
Base.splitFunction
split(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
+true
source
Base.splitFunction
split(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
 split(str::AbstractString; limit::Integer=0, keepempty::Bool=false)

Split str into an array of substrings on occurrences of the delimiter(s) dlm. dlm can be any of the formats allowed by findnext's first argument (i.e. as a string, regular expression or a function), or as a single character or collection of characters.

If dlm is omitted, it defaults to isspace.

The optional keyword arguments are:

  • limit: the maximum size of the result. limit=0 implies no maximum (default)
  • keepempty: whether empty fields should be kept in the result. Default is false without a dlm argument, true with a dlm argument.

See also rsplit, eachsplit.

Examples

julia> a = "Ma.rch"
 "Ma.rch"
 
 julia> split(a, ".")
 2-element Vector{SubString{String}}:
  "Ma"
- "rch"
source
Base.rsplitFunction
rsplit(s::AbstractString; limit::Integer=0, keepempty::Bool=false)
+ "rch"
source
Base.rsplitFunction
rsplit(s::AbstractString; limit::Integer=0, keepempty::Bool=false)
 rsplit(s::AbstractString, chars; limit::Integer=0, keepempty::Bool=true)

Similar to split, but starting from the end of the string.

Examples

julia> a = "M.a.r.c.h"
 "M.a.r.c.h"
 
@@ -359,31 +359,31 @@
 julia> rsplit(a, "."; limit=2)
 2-element Vector{SubString{String}}:
  "M.a.r.c"
- "h"
source
Base.stripFunction
strip([pred=isspace,] str::AbstractString) -> SubString
+ "h"
source
Base.stripFunction
strip([pred=isspace,] str::AbstractString) -> SubString
 strip(str::AbstractString, chars) -> SubString

Remove leading and trailing characters from str, either those specified by chars or those for which the function pred returns true.

The default behaviour is to remove leading and trailing whitespace and delimiters: see isspace for precise details.

The optional chars argument specifies which characters to remove: it can be a single character, vector or set of characters.

See also lstrip and rstrip.

Julia 1.2

The method which accepts a predicate function requires Julia 1.2 or later.

Examples

julia> strip("{3, 5}\n", ['{', '}', '\n'])
-"3, 5"
source
Base.lstripFunction
lstrip([pred=isspace,] str::AbstractString) -> SubString
+"3, 5"
source
Base.lstripFunction
lstrip([pred=isspace,] str::AbstractString) -> SubString
 lstrip(str::AbstractString, chars) -> SubString

Remove leading characters from str, either those specified by chars or those for which the function pred returns true.

The default behaviour is to remove leading whitespace and delimiters: see isspace for precise details.

The optional chars argument specifies which characters to remove: it can be a single character, or a vector or set of characters.

See also strip and rstrip.

Examples

julia> a = lpad("March", 20)
 "               March"
 
 julia> lstrip(a)
-"March"
source
Base.rstripFunction
rstrip([pred=isspace,] str::AbstractString) -> SubString
+"March"
source
Base.rstripFunction
rstrip([pred=isspace,] str::AbstractString) -> SubString
 rstrip(str::AbstractString, chars) -> SubString

Remove trailing characters from str, either those specified by chars or those for which the function pred returns true.

The default behaviour is to remove trailing whitespace and delimiters: see isspace for precise details.

The optional chars argument specifies which characters to remove: it can be a single character, or a vector or set of characters.

See also strip and lstrip.

Examples

julia> a = rpad("March", 20)
 "March               "
 
 julia> rstrip(a)
-"March"
source
Base.startswithFunction
startswith(s::AbstractString, prefix::Regex)

Return true if s starts with the regex pattern, prefix.

Note

startswith does not compile the anchoring into the regular expression, but instead passes the anchoring as match_option to PCRE. If compile time is amortized, occursin(r"^...", s) is faster than startswith(s, r"...").

See also occursin and endswith.

Julia 1.2

This method requires at least Julia 1.2.

Examples

julia> startswith("JuliaLang", r"Julia|Romeo")
-true
source
startswith(prefix)

Create a function that checks whether its argument starts with prefix, i.e. a function equivalent to y -> startswith(y, prefix).

The returned function is of type Base.Fix2{typeof(startswith)}, which can be used to implement specialized methods.

Julia 1.5

The single argument startswith(prefix) requires at least Julia 1.5.

Examples

julia> startswith("Julia")("JuliaLang")
+"March"
source
Base.startswithFunction
startswith(s::AbstractString, prefix::Regex)

Return true if s starts with the regex pattern, prefix.

Note

startswith does not compile the anchoring into the regular expression, but instead passes the anchoring as match_option to PCRE. If compile time is amortized, occursin(r"^...", s) is faster than startswith(s, r"...").

See also occursin and endswith.

Julia 1.2

This method requires at least Julia 1.2.

Examples

julia> startswith("JuliaLang", r"Julia|Romeo")
+true
source
startswith(prefix)

Create a function that checks whether its argument starts with prefix, i.e. a function equivalent to y -> startswith(y, prefix).

The returned function is of type Base.Fix2{typeof(startswith)}, which can be used to implement specialized methods.

Julia 1.5

The single argument startswith(prefix) requires at least Julia 1.5.

Examples

julia> startswith("Julia")("JuliaLang")
 true
 
 julia> startswith("Julia")("Ends with Julia")
-false
source
startswith(io::IO, prefix::Union{AbstractString,Base.Chars})

Check if an IO object starts with a prefix, which can be either a string, a character, or a tuple/vector/set of characters. See also peek.

source
startswith(s::AbstractString, prefix::Union{AbstractString,Base.Chars})

Return true if s starts with prefix, which can be a string, a character, or a tuple/vector/set of characters. If prefix is a tuple/vector/set of characters, test whether the first character of s belongs to that set.

See also endswith, contains.

Examples

julia> startswith("JuliaLang", "Julia")
-true
source
Base.endswithFunction
endswith(s::AbstractString, suffix::Regex)

Return true if s ends with the regex pattern, suffix.

Note

endswith does not compile the anchoring into the regular expression, but instead passes the anchoring as match_option to PCRE. If compile time is amortized, occursin(r"...$", s) is faster than endswith(s, r"...").

See also occursin and startswith.

Julia 1.2

This method requires at least Julia 1.2.

Examples

julia> endswith("JuliaLang", r"Lang|Roberts")
-true
source
endswith(suffix)

Create a function that checks whether its argument ends with suffix, i.e. a function equivalent to y -> endswith(y, suffix).

The returned function is of type Base.Fix2{typeof(endswith)}, which can be used to implement specialized methods.

Julia 1.5

The single argument endswith(suffix) requires at least Julia 1.5.

Examples

julia> endswith("Julia")("Ends with Julia")
+false
source
startswith(io::IO, prefix::Union{AbstractString,Base.Chars})

Check if an IO object starts with a prefix, which can be either a string, a character, or a tuple/vector/set of characters. See also peek.

source
startswith(s::AbstractString, prefix::Union{AbstractString,Base.Chars})

Return true if s starts with prefix, which can be a string, a character, or a tuple/vector/set of characters. If prefix is a tuple/vector/set of characters, test whether the first character of s belongs to that set.

See also endswith, contains.

Examples

julia> startswith("JuliaLang", "Julia")
+true
source
Base.endswithFunction
endswith(s::AbstractString, suffix::Regex)

Return true if s ends with the regex pattern, suffix.

Note

endswith does not compile the anchoring into the regular expression, but instead passes the anchoring as match_option to PCRE. If compile time is amortized, occursin(r"...$", s) is faster than endswith(s, r"...").

See also occursin and startswith.

Julia 1.2

This method requires at least Julia 1.2.

Examples

julia> endswith("JuliaLang", r"Lang|Roberts")
+true
source
endswith(suffix)

Create a function that checks whether its argument ends with suffix, i.e. a function equivalent to y -> endswith(y, suffix).

The returned function is of type Base.Fix2{typeof(endswith)}, which can be used to implement specialized methods.

Julia 1.5

The single argument endswith(suffix) requires at least Julia 1.5.

Examples

julia> endswith("Julia")("Ends with Julia")
 true
 
 julia> endswith("Julia")("JuliaLang")
-false
source
endswith(s::AbstractString, suffix::Union{AbstractString,Base.Chars})

Return true if s ends with suffix, which can be a string, a character, or a tuple/vector/set of characters. If suffix is a tuple/vector/set of characters, test whether the last character of s belongs to that set.

See also startswith, contains.

Examples

julia> endswith("Sunday", "day")
-true
source
Base.containsFunction
contains(needle)

Create a function that checks whether its argument contains needle, i.e. a function equivalent to haystack -> contains(haystack, needle).

The returned function is of type Base.Fix2{typeof(contains)}, which can be used to implement specialized methods.

source
contains(haystack::AbstractString, needle)

Return true if haystack contains needle. This is the same as occursin(needle, haystack), but is provided for consistency with startswith(haystack, needle) and endswith(haystack, needle).

See also occursin, in, issubset.

Examples

julia> contains("JuliaLang is pretty cool!", "Julia")
+false
source
endswith(s::AbstractString, suffix::Union{AbstractString,Base.Chars})

Return true if s ends with suffix, which can be a string, a character, or a tuple/vector/set of characters. If suffix is a tuple/vector/set of characters, test whether the last character of s belongs to that set.

See also startswith, contains.

Examples

julia> endswith("Sunday", "day")
+true
source
Base.containsFunction
contains(needle)

Create a function that checks whether its argument contains needle, i.e. a function equivalent to haystack -> contains(haystack, needle).

The returned function is of type Base.Fix2{typeof(contains)}, which can be used to implement specialized methods.

source
contains(haystack::AbstractString, needle)

Return true if haystack contains needle. This is the same as occursin(needle, haystack), but is provided for consistency with startswith(haystack, needle) and endswith(haystack, needle).

See also occursin, in, issubset.

Examples

julia> contains("JuliaLang is pretty cool!", "Julia")
 true
 
 julia> contains("JuliaLang is pretty cool!", 'a')
@@ -393,51 +393,51 @@
 true
 
 julia> contains("abba", r"a.a")
-false
Julia 1.5

The contains function requires at least Julia 1.5.

source
Base.firstMethod
first(s::AbstractString, n::Integer)

Get a string consisting of the first n characters of s.

Examples

julia> first("∀ϵ≠0: ϵ²>0", 0)
+false
Julia 1.5

The contains function requires at least Julia 1.5.

source
Base.firstMethod
first(s::AbstractString, n::Integer)

Get a string consisting of the first n characters of s.

Examples

julia> first("∀ϵ≠0: ϵ²>0", 0)
 ""
 
 julia> first("∀ϵ≠0: ϵ²>0", 1)
 "∀"
 
 julia> first("∀ϵ≠0: ϵ²>0", 3)
-"∀ϵ≠"
source
Base.lastMethod
last(s::AbstractString, n::Integer)

Get a string consisting of the last n characters of s.

Examples

julia> last("∀ϵ≠0: ϵ²>0", 0)
+"∀ϵ≠"
source
Base.lastMethod
last(s::AbstractString, n::Integer)

Get a string consisting of the last n characters of s.

Examples

julia> last("∀ϵ≠0: ϵ²>0", 0)
 ""
 
 julia> last("∀ϵ≠0: ϵ²>0", 1)
 "0"
 
 julia> last("∀ϵ≠0: ϵ²>0", 3)
-"²>0"
source
Base.Unicode.uppercaseFunction
uppercase(s::AbstractString)

Return s with all characters converted to uppercase.

See also lowercase, titlecase, uppercasefirst.

Examples

julia> uppercase("Julia")
+"JULIA"
source
uppercase(c::AbstractChar)

Convert c to uppercase.

See also lowercase, titlecase.

Examples

julia> uppercase('a')
 'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
 
 julia> uppercase('ê')
-'Ê': Unicode U+00CA (category Lu: Letter, uppercase)
source
Base.Unicode.lowercaseFunction
lowercase(s::AbstractString)

Return s with all characters converted to lowercase.

See also uppercase, titlecase, lowercasefirst.

Examples

julia> lowercase("STRINGS AND THINGS")
+"strings and things"
source
lowercase(c::AbstractChar)

Convert c to lowercase.

See also uppercase, titlecase.

Examples

julia> lowercase('A')
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
 
 julia> lowercase('Ö')
-'ö': Unicode U+00F6 (category Ll: Letter, lowercase)
source
Base.Unicode.titlecaseFunction
titlecase(s::AbstractString; [wordsep::Function], strict::Bool=true) -> String

Capitalize the first character of each word in s; if strict is true, every other character is converted to lowercase, otherwise they are left unchanged. By default, all non-letters beginning a new grapheme are considered as word separators; a predicate can be passed as the wordsep keyword to determine which characters should be considered as word separators. See also uppercasefirst to capitalize only the first character in s.

See also uppercase, lowercase, uppercasefirst.

Examples

julia> titlecase("the JULIA programming language")
+'ö': Unicode U+00F6 (category Ll: Letter, lowercase)
source
Base.Unicode.titlecaseFunction
titlecase(s::AbstractString; [wordsep::Function], strict::Bool=true) -> String

Capitalize the first character of each word in s; if strict is true, every other character is converted to lowercase, otherwise they are left unchanged. By default, all non-letters beginning a new grapheme are considered as word separators; a predicate can be passed as the wordsep keyword to determine which characters should be considered as word separators. See also uppercasefirst to capitalize only the first character in s.

See also uppercase, lowercase, uppercasefirst.

Examples

julia> titlecase("the JULIA programming language")
 "The Julia Programming Language"
 
 julia> titlecase("ISS - international space station", strict=false)
 "ISS - International Space Station"
 
 julia> titlecase("a-a b-b", wordsep = c->c==' ')
-"A-a B-b"
source
titlecase(c::AbstractChar)

Convert c to titlecase. This may differ from uppercase for digraphs, compare the example below.

See also uppercase, lowercase.

Examples

julia> titlecase('a')
+"A-a B-b"
source
titlecase(c::AbstractChar)

Convert c to titlecase. This may differ from uppercase for digraphs, compare the example below.

See also uppercase, lowercase.

Examples

julia> titlecase('a')
 'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
 
 julia> titlecase('dž')
 'Dž': Unicode U+01C5 (category Lt: Letter, titlecase)
 
 julia> uppercase('dž')
-'DŽ': Unicode U+01C4 (category Lu: Letter, uppercase)
source
Base.joinFunction
join([io::IO,] iterator [, delim [, last]])

Join any iterator into a single string, inserting the given delimiter (if any) between adjacent items. If last is given, it will be used instead of delim between the last two items. Each item of iterator is converted to a string via print(io::IOBuffer, x). If io is given, the result is written to io rather than returned as a String.

Examples

julia> join(["apples", "bananas", "pineapples"], ", ", " and ")
+'DŽ': Unicode U+01C4 (category Lu: Letter, uppercase)
source
Base.joinFunction
join([io::IO,] iterator [, delim [, last]])

Join any iterator into a single string, inserting the given delimiter (if any) between adjacent items. If last is given, it will be used instead of delim between the last two items. Each item of iterator is converted to a string via print(io::IOBuffer, x). If io is given, the result is written to io rather than returned as a String.

Examples

julia> join(["apples", "bananas", "pineapples"], ", ", " and ")
 "apples, bananas and pineapples"
 
 julia> join([1,2,3,4,5])
-"12345"
source
Base.chopFunction
chop(s::AbstractString; head::Integer = 0, tail::Integer = 1)

Remove the first head and the last tail characters from s. The call chop(s) removes the last character from s. If it is requested to remove more characters than length(s) then an empty string is returned.

See also chomp, startswith, first.

Examples

julia> a = "March"
+"12345"
source
Base.chopFunction
chop(s::AbstractString; head::Integer = 0, tail::Integer = 1)

Remove the first head and the last tail characters from s. The call chop(s) removes the last character from s. If it is requested to remove more characters than length(s) then an empty string is returned.

See also chomp, startswith, first.

Examples

julia> a = "March"
 "March"
 
 julia> chop(a)
@@ -447,16 +447,16 @@
 "ar"
 
 julia> chop(a, head = 5, tail = 5)
-""
source
Base.chopprefixFunction
chopprefix(s::AbstractString, prefix::Union{AbstractString,Regex}) -> SubString

Remove the prefix prefix from s. If s does not start with prefix, a string equal to s is returned.

See also chopsuffix.

Julia 1.8

This function is available as of Julia 1.8.

Examples

julia> chopprefix("Hamburger", "Ham")
+""
source
Base.chopprefixFunction
chopprefix(s::AbstractString, prefix::Union{AbstractString,Regex}) -> SubString

Remove the prefix prefix from s. If s does not start with prefix, a string equal to s is returned.

See also chopsuffix.

Julia 1.8

This function is available as of Julia 1.8.

Examples

julia> chopprefix("Hamburger", "Ham")
 "burger"
 
 julia> chopprefix("Hamburger", "hotdog")
-"Hamburger"
source
Base.chopsuffixFunction
chopsuffix(s::AbstractString, suffix::Union{AbstractString,Regex}) -> SubString

Remove the suffix suffix from s. If s does not end with suffix, a string equal to s is returned.

See also chopprefix.

Julia 1.8

This function is available as of Julia 1.8.

Examples

julia> chopsuffix("Hamburger", "er")
+"Hamburger"
source
Base.chopsuffixFunction
chopsuffix(s::AbstractString, suffix::Union{AbstractString,Regex}) -> SubString

Remove the suffix suffix from s. If s does not end with suffix, a string equal to s is returned.

See also chopprefix.

Julia 1.8

This function is available as of Julia 1.8.

Examples

julia> chopsuffix("Hamburger", "er")
 "Hamburg"
 
 julia> chopsuffix("Hamburger", "hotdog")
-"Hamburger"
source
Base.chompFunction
chomp(s::AbstractString) -> SubString

Remove a single trailing newline from a string.

See also chop.

Examples

julia> chomp("Hello\n")
-"Hello"
source
Base.thisindFunction
thisind(s::AbstractString, i::Integer) -> Int

If i is in bounds in s return the index of the start of the character whose encoding code unit i is part of. In other words, if i is the start of a character, return i; if i is not the start of a character, rewind until the start of a character and return that index. If i is equal to 0 or ncodeunits(s)+1 return i. In all other cases throw BoundsError.

Examples

julia> thisind("α", 0)
+"Hamburger"
source
Base.chompFunction
chomp(s::AbstractString) -> SubString

Remove a single trailing newline from a string.

See also chop.

Examples

julia> chomp("Hello\n")
+"Hello"
source
Base.thisindFunction
thisind(s::AbstractString, i::Integer) -> Int

If i is in bounds in s return the index of the start of the character whose encoding code unit i is part of. In other words, if i is the start of a character, return i; if i is not the start of a character, rewind until the start of a character and return that index. If i is equal to 0 or ncodeunits(s)+1 return i. In all other cases throw BoundsError.

Examples

julia> thisind("α", 0)
 0
 
 julia> thisind("α", 1)
@@ -474,7 +474,7 @@
 
 julia> thisind("α", -1)
 ERROR: BoundsError: attempt to access 2-codeunit String at index [-1]
-[...]
source
Base.nextindMethod
nextind(str::AbstractString, i::Integer, n::Integer=1) -> Int
  • Case n == 1

    If i is in bounds in s return the index of the start of the character whose encoding starts after index i. In other words, if i is the start of a character, return the start of the next character; if i is not the start of a character, move forward until the start of a character and return that index. If i is equal to 0 return 1. If i is in bounds but greater or equal to lastindex(str) return ncodeunits(str)+1. Otherwise throw BoundsError.

  • Case n > 1

    Behaves like applying n times nextind for n==1. The only difference is that if n is so large that applying nextind would reach ncodeunits(str)+1 then each remaining iteration increases the returned value by 1. This means that in this case nextind can return a value greater than ncodeunits(str)+1.

  • Case n == 0

    Return i only if i is a valid index in s or is equal to 0. Otherwise StringIndexError or BoundsError is thrown.

Examples

julia> nextind("α", 0)
+[...]
source
Base.nextindMethod
nextind(str::AbstractString, i::Integer, n::Integer=1) -> Int
  • Case n == 1

    If i is in bounds in s return the index of the start of the character whose encoding starts after index i. In other words, if i is the start of a character, return the start of the next character; if i is not the start of a character, move forward until the start of a character and return that index. If i is equal to 0 return 1. If i is in bounds but greater or equal to lastindex(str) return ncodeunits(str)+1. Otherwise throw BoundsError.

  • Case n > 1

    Behaves like applying n times nextind for n==1. The only difference is that if n is so large that applying nextind would reach ncodeunits(str)+1 then each remaining iteration increases the returned value by 1. This means that in this case nextind can return a value greater than ncodeunits(str)+1.

  • Case n == 0

    Return i only if i is a valid index in s or is equal to 0. Otherwise StringIndexError or BoundsError is thrown.

Examples

julia> nextind("α", 0)
 1
 
 julia> nextind("α", 1)
@@ -488,7 +488,7 @@
 3
 
 julia> nextind("α", 1, 2)
-4
source
Base.previndMethod
prevind(str::AbstractString, i::Integer, n::Integer=1) -> Int
  • Case n == 1

    If i is in bounds in s return the index of the start of the character whose encoding starts before index i. In other words, if i is the start of a character, return the start of the previous character; if i is not the start of a character, rewind until the start of a character and return that index. If i is equal to 1 return 0. If i is equal to ncodeunits(str)+1 return lastindex(str). Otherwise throw BoundsError.

  • Case n > 1

    Behaves like applying n times prevind for n==1. The only difference is that if n is so large that applying prevind would reach 0 then each remaining iteration decreases the returned value by 1. This means that in this case prevind can return a negative value.

  • Case n == 0

    Return i only if i is a valid index in str or is equal to ncodeunits(str)+1. Otherwise StringIndexError or BoundsError is thrown.

Examples

julia> prevind("α", 3)
+4
source
Base.previndMethod
prevind(str::AbstractString, i::Integer, n::Integer=1) -> Int
  • Case n == 1

    If i is in bounds in s return the index of the start of the character whose encoding starts before index i. In other words, if i is the start of a character, return the start of the previous character; if i is not the start of a character, rewind until the start of a character and return that index. If i is equal to 1 return 0. If i is equal to ncodeunits(str)+1 return lastindex(str). Otherwise throw BoundsError.

  • Case n > 1

    Behaves like applying n times prevind for n==1. The only difference is that if n is so large that applying prevind would reach 0 then each remaining iteration decreases the returned value by 1. This means that in this case prevind can return a negative value.

  • Case n == 0

    Return i only if i is a valid index in str or is equal to ncodeunits(str)+1. Otherwise StringIndexError or BoundsError is thrown.

Examples

julia> prevind("α", 3)
 1
 
 julia> prevind("α", 1)
@@ -502,12 +502,12 @@
 0
 
 julia> prevind("α", 2, 3)
--1
source
Base.Unicode.textwidthFunction
textwidth(s::AbstractString)

Give the number of columns needed to print a string.

Examples

julia> textwidth("March")
-5
source
textwidth(c)

Give the number of columns needed to print a character.

Examples

julia> textwidth('α')
+-1
source
Base.Unicode.textwidthFunction
textwidth(s::AbstractString)

Give the number of columns needed to print a string.

Examples

julia> textwidth("March")
+5
source
textwidth(c)

Give the number of columns needed to print a character.

Examples

julia> textwidth('α')
 1
 
 julia> textwidth('⛵')
-2
source
Base.isasciiFunction
isascii(cu::AbstractVector{CU}) where {CU <: Integer} -> Bool

Test whether all values in the vector belong to the ASCII character set (0x00 to 0x7f). This function is intended to be used by other string implementations that need a fast ASCII check.

source
isascii(c::Union{AbstractChar,AbstractString}) -> Bool

Test whether a character belongs to the ASCII character set, or whether this is true for all elements of a string.

Examples

julia> isascii('a')
+2
source
Base.isasciiFunction
isascii(cu::AbstractVector{CU}) where {CU <: Integer} -> Bool

Test whether all values in the vector belong to the ASCII character set (0x00 to 0x7f). This function is intended to be used by other string implementations that need a fast ASCII check.

source
isascii(c::Union{AbstractChar,AbstractString}) -> Bool

Test whether a character belongs to the ASCII character set, or whether this is true for all elements of a string.

Examples

julia> isascii('a')
 true
 
 julia> isascii('α')
@@ -521,32 +521,32 @@
 "abcdefgh"
 
 julia> replace("abcdeγfgh", !isascii=>' ') # replace non-ASCII chars with spaces
-"abcde fgh"
source
Base.Unicode.iscntrlFunction
iscntrl(c::AbstractChar) -> Bool

Tests whether a character is a control character. Control characters are the non-printing characters of the Latin-1 subset of Unicode.

Examples

julia> iscntrl('\x01')
+"abcde fgh"
source
Base.Unicode.iscntrlFunction
iscntrl(c::AbstractChar) -> Bool

Tests whether a character is a control character. Control characters are the non-printing characters of the Latin-1 subset of Unicode.

Examples

julia> iscntrl('\x01')
 true
 
 julia> iscntrl('a')
-false
source
Base.Unicode.isdigitFunction
isdigit(c::AbstractChar) -> Bool

Tests whether a character is an ASCII decimal digit (0-9).

See also: isletter.

Examples

julia> isdigit('❤')
+false
source
Base.Unicode.isdigitFunction
isdigit(c::AbstractChar) -> Bool

Tests whether a character is an ASCII decimal digit (0-9).

See also: isletter.

Examples

julia> isdigit('❤')
 false
 
 julia> isdigit('9')
 true
 
 julia> isdigit('α')
-false
source
Base.Unicode.isletterFunction
isletter(c::AbstractChar) -> Bool

Test whether a character is a letter. A character is classified as a letter if it belongs to the Unicode general category Letter, i.e. a character whose category code begins with 'L'.

See also: isdigit.

Examples

julia> isletter('❤')
+false
source
Base.Unicode.isletterFunction
isletter(c::AbstractChar) -> Bool

Test whether a character is a letter. A character is classified as a letter if it belongs to the Unicode general category Letter, i.e. a character whose category code begins with 'L'.

See also: isdigit.

Examples

julia> isletter('❤')
 false
 
 julia> isletter('α')
 true
 
 julia> isletter('9')
-false
source
Base.Unicode.islowercaseFunction
islowercase(c::AbstractChar) -> Bool

Tests whether a character is a lowercase letter (according to the Unicode standard's Lowercase derived property).

See also isuppercase.

Examples

julia> islowercase('α')
+false
source
Base.Unicode.islowercaseFunction
islowercase(c::AbstractChar) -> Bool

Tests whether a character is a lowercase letter (according to the Unicode standard's Lowercase derived property).

See also isuppercase.

Examples

julia> islowercase('α')
 true
 
 julia> islowercase('Γ')
 false
 
 julia> islowercase('❤')
-false
source
Base.Unicode.isnumericFunction
isnumeric(c::AbstractChar) -> Bool

Tests whether a character is numeric. A character is classified as numeric if it belongs to the Unicode general category Number, i.e. a character whose category code begins with 'N'.

Note that this broad category includes characters such as ¾ and ௰. Use isdigit to check whether a character is a decimal digit between 0 and 9.

Examples

julia> isnumeric('௰')
+false
source
Base.Unicode.isnumericFunction
isnumeric(c::AbstractChar) -> Bool

Tests whether a character is numeric. A character is classified as numeric if it belongs to the Unicode general category Number, i.e. a character whose category code begins with 'N'.

Note that this broad category includes characters such as ¾ and ௰. Use isdigit to check whether a character is a decimal digit between 0 and 9.

Examples

julia> isnumeric('௰')
 true
 
 julia> isnumeric('9')
@@ -556,11 +556,11 @@
 false
 
 julia> isnumeric('❤')
-false
source
Base.Unicode.isprintFunction
isprint(c::AbstractChar) -> Bool

Tests whether a character is printable, including spaces, but not a control character.

Examples

julia> isprint('\x01')
+false
source
Base.Unicode.isprintFunction
isprint(c::AbstractChar) -> Bool

Tests whether a character is printable, including spaces, but not a control character.

Examples

julia> isprint('\x01')
 false
 
 julia> isprint('A')
-true
source
Base.Unicode.ispunctFunction
ispunct(c::AbstractChar) -> Bool

Tests whether a character belongs to the Unicode general category Punctuation, i.e. a character whose category code begins with 'P'.

Note

This behavior is different from the ispunct function in C.

Examples

julia> ispunct('α')
+true
source
Base.Unicode.ispunctFunction
ispunct(c::AbstractChar) -> Bool

Tests whether a character belongs to the Unicode general category Punctuation, i.e. a character whose category code begins with 'P'.

Note

This behavior is different from the ispunct function in C.

Examples

julia> ispunct('α')
 false
 
 julia> ispunct('=')
@@ -570,7 +570,7 @@
 true
 
 julia> ispunct(';')
-true
source
Base.Unicode.isspaceFunction
isspace(c::AbstractChar) -> Bool

Tests whether a character is any whitespace character. Includes ASCII characters '\t', '\n', '\v', '\f', '\r', and ' ', Latin-1 character U+0085, and characters in Unicode category Zs.

Examples

julia> isspace('\n')
+true
source
Base.Unicode.isspaceFunction
isspace(c::AbstractChar) -> Bool

Tests whether a character is any whitespace character. Includes ASCII characters '\t', '\n', '\v', '\f', '\r', and ' ', Latin-1 character U+0085, and characters in Unicode category Zs.

Examples

julia> isspace('\n')
 true
 
 julia> isspace('\r')
@@ -580,18 +580,18 @@
 true
 
 julia> isspace('\x20')
-true
source
Base.Unicode.isuppercaseFunction
isuppercase(c::AbstractChar) -> Bool

Tests whether a character is an uppercase letter (according to the Unicode standard's Uppercase derived property).

See also islowercase.

Examples

julia> isuppercase('γ')
+true
source
Base.Unicode.isuppercaseFunction
isuppercase(c::AbstractChar) -> Bool

Tests whether a character is an uppercase letter (according to the Unicode standard's Uppercase derived property).

See also islowercase.

Examples

julia> isuppercase('γ')
 false
 
 julia> isuppercase('Γ')
 true
 
 julia> isuppercase('❤')
-false
source
Base.Unicode.isxdigitFunction
isxdigit(c::AbstractChar) -> Bool

Test whether a character is a valid hexadecimal digit. Note that this does not include x (as in the standard 0x prefix).

Examples

julia> isxdigit('a')
+false
source
Base.Unicode.isxdigitFunction
isxdigit(c::AbstractChar) -> Bool

Test whether a character is a valid hexadecimal digit. Note that this does not include x (as in the standard 0x prefix).

Examples

julia> isxdigit('a')
 true
 
 julia> isxdigit('x')
-false
source
Base.escape_stringFunction
escape_string(str::AbstractString[, esc]; keep=(), ascii=false, fullhex=false)::AbstractString
+false
source
Base.escape_stringFunction
escape_string(str::AbstractString[, esc]; keep=(), ascii=false, fullhex=false)::AbstractString
 escape_string(io, str::AbstractString[, esc]; keep=())::Nothing

General escaping of traditional C and Unicode escape sequences. The first form returns the escaped string, the second prints the result to io.

Backslashes (\) are escaped with a double-backslash ("\\"). Non-printable characters are escaped either with their standard C escape codes, "\0" for NUL (if unambiguous), unicode code point ("\u" prefix) or hex ("\x" prefix).

The optional esc argument specifies any additional characters that should also be escaped by a prepending backslash (" is also escaped by default in the first form).

The argument keep specifies a collection of characters which are to be kept as they are. Notice that esc has precedence here.

The argument ascii can be set to true to escape all non-ASCII characters, whereas the default ascii=false outputs printable Unicode characters as-is. (keep takes precedence over ascii.)

The argument fullhex can be set to true to require all \u escapes to be printed with 4 hex digits, and \U escapes to be printed with 8 hex digits, whereas by default (fullhex=false) they are printed with fewer digits if possible (omitting leading zeros).

See also unescape_string for the reverse operation.

Julia 1.7

The keep argument is available as of Julia 1.7.

Julia 1.12

The ascii and fullhex arguments require Julia 1.12.

Examples

julia> escape_string("aaa\nbbb")
 "aaa\\nbbb"
 
@@ -605,8 +605,8 @@
 "ℵ\\0"
 
 julia> escape_string(string('\u2135','\0','0')) # \0 would be ambiguous
-"ℵ\\x000"
source
Base.escape_raw_stringFunction
escape_raw_string(s::AbstractString, delim='"') -> AbstractString
-escape_raw_string(io, s::AbstractString, delim='"')

Escape a string in the manner used for parsing raw string literals. For each double-quote (") character in input string s (or delim if specified), this function counts the number n of preceding backslash (\) characters, and then increases there the number of backslashes from n to 2n+1 (even for n = 0). It also doubles a sequence of backslashes at the end of the string.

This escaping convention is used in raw strings and other non-standard string literals. (It also happens to be the escaping convention expected by the Microsoft C/C++ compiler runtime when it parses a command-line string into the argv[] array.)

See also Base.escape_string().

source
Base.escape_raw_stringFunction
escape_raw_string(s::AbstractString, delim='"') -> AbstractString
+escape_raw_string(io, s::AbstractString, delim='"')

Escape a string in the manner used for parsing raw string literals. For each double-quote (") character in input string s (or delim if specified), this function counts the number n of preceding backslash (\) characters, and then increases there the number of backslashes from n to 2n+1 (even for n = 0). It also doubles a sequence of backslashes at the end of the string.

This escaping convention is used in raw strings and other non-standard string literals. (It also happens to be the escaping convention expected by the Microsoft C/C++ compiler runtime when it parses a command-line string into the argv[] array.)

See also Base.escape_string().

source
Base.unescape_stringFunction
unescape_string(str::AbstractString, keep = ())::AbstractString
 unescape_string(io, s::AbstractString, keep = ())::Nothing

General unescaping of traditional C and Unicode escape sequences. The first form returns the escaped string, the second prints the result to io. The argument keep specifies a collection of characters which (along with backlashes) are to be kept as they are.

The following escape sequences are recognised:

  • Escaped backslash (\\)
  • Escaped double-quote (\")
  • Standard C escape sequences (\a, \b, \t, \n, \v, \f, \r, \e)
  • Unicode BMP code points (\u with 1-4 trailing hex digits)
  • All Unicode code points (\U with 1-8 trailing hex digits; max value = 0010ffff)
  • Hex bytes (\x with 1-2 trailing hex digits)
  • Octal bytes (\ with 1-3 trailing octal digits)

See also escape_string.

Examples

julia> unescape_string("aaa\\nbbb") # C escape sequence
 "aaa\nbbb"
 
@@ -617,7 +617,7 @@
 "A"
 
 julia> unescape_string("aaa \\g \\n", ['g']) # using `keep` argument
-"aaa \\g \n"
source

AnnotatedStrings

Note

The API for AnnotatedStrings is considered experimental and is subject to change between Julia versions.

Base.AnnotatedStringType
AnnotatedString{S <: AbstractString} <: AbstractString

A string with metadata, in the form of annotated regions.

More specifically, this is a simple wrapper around any other AbstractString that allows for regions of the wrapped string to be annotated with labeled values.

                           C
+"aaa \\g \n"
source

AnnotatedStrings

Note

The API for AnnotatedStrings is considered experimental and is subject to change between Julia versions.

Base.AnnotatedStringType
AnnotatedString{S <: AbstractString} <: AbstractString

A string with metadata, in the form of annotated regions.

More specifically, this is a simple wrapper around any other AbstractString that allows for regions of the wrapped string to be annotated with labeled values.

                           C
                     ┌──────┸─────────┐
   "this is an example annotated string"
   └──┰────────┼─────┘         │
@@ -625,13 +625,13 @@
                     B

The above diagram represents a AnnotatedString where three ranges have been annotated (labeled A, B, and C). Each annotation holds a label (Symbol) and a value (Any). These three pieces of information are held as a @NamedTuple{region::UnitRange{Int64}, label::Symbol, value}.

Labels do not need to be unique, the same region can hold multiple annotations with the same label.

Code written for AnnotatedStrings in general should conserve the following properties:

  • Which characters an annotation is applied to
  • The order in which annotations are applied to each character

Additional semantics may be introduced by specific uses of AnnotatedStrings.

A corollary of these rules is that adjacent, consecutively placed, annotations with identical labels and values are equivalent to a single annotation spanning the combined range.

See also AnnotatedChar, annotatedstring, annotations, and annotate!.

Constructors

AnnotatedString(s::S<:AbstractString) -> AnnotatedString{S}
 AnnotatedString(s::S<:AbstractString, annotations::Vector{@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}})

A AnnotatedString can also be created with annotatedstring, which acts much like string but preserves any annotations present in the arguments.

Examples

julia> AnnotatedString("this is an example annotated string",
                     [(1:18, :A, 1), (12:28, :B, 2), (18:35, :C, 3)])
-"this is an example annotated string"
source
Base.AnnotatedCharType
AnnotatedChar{S <: AbstractChar} <: AbstractChar

A Char with annotations.

More specifically, this is a simple wrapper around any other AbstractChar, which holds a list of arbitrary labelled annotations (@NamedTuple{label::Symbol, value}) with the wrapped character.

See also: AnnotatedString, annotatedstring, annotations, and annotate!.

Constructors

AnnotatedChar(s::S) -> AnnotatedChar{S}
+"this is an example annotated string"
source
Base.AnnotatedCharType
AnnotatedChar{S <: AbstractChar} <: AbstractChar

A Char with annotations.

More specifically, this is a simple wrapper around any other AbstractChar, which holds a list of arbitrary labelled annotations (@NamedTuple{label::Symbol, value}) with the wrapped character.

See also: AnnotatedString, annotatedstring, annotations, and annotate!.

Constructors

AnnotatedChar(s::S) -> AnnotatedChar{S}
 AnnotatedChar(s::S, annotations::Vector{@NamedTuple{label::Symbol, value}})

Examples

julia> AnnotatedChar('j', [(:label, 1)])
-'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)
source
Base.annotatedstringFunction
annotatedstring(values...)

Create a AnnotatedString from any number of values using their printed representation.

This acts like string, but takes care to preserve any annotations present (in the form of AnnotatedString or AnnotatedChar values).

See also AnnotatedString and AnnotatedChar.

Examples

julia> annotatedstring("now a AnnotatedString")
 "now a AnnotatedString"
 
 julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label, 1)]), ", and unannotated")
-"annotated, and unannotated"
source
Base.annotationsFunction
annotations(chr::AnnotatedChar) -> Vector{@NamedTuple{label::Symbol, value}}

Get all annotations of chr, in the form of a vector of annotation pairs.

source
annotations(str::Union{AnnotatedString, SubString{AnnotatedString}},
+"annotated, and unannotated"
source
Base.annotationsFunction
annotations(chr::AnnotatedChar) -> Vector{@NamedTuple{label::Symbol, value}}

Get all annotations of chr, in the form of a vector of annotation pairs.

source
annotations(str::Union{AnnotatedString, SubString{AnnotatedString}},
             [position::Union{Integer, UnitRange}]) ->
-    Vector{@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}}

Get all annotations that apply to str. Should position be provided, only annotations that overlap with position will be returned.

Annotations are provided together with the regions they apply to, in the form of a vector of region–annotation tuples.

In accordance with the semantics documented in AnnotatedString, the order of annotations returned matches the order in which they were applied.

See also: annotate!.

source
Base.annotate!Function
annotate!(char::AnnotatedChar, label::Symbol, value::Any)

Annotate char with the labeled value (label, value).

source
annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol, value)
-annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol, value)

Annotate a range of str (or the entire string) with a labeled value (label, value). To remove existing label annotations, use a value of nothing.

The order in which annotations are applied to str is semantically meaningful, as described in AnnotatedString.

source
+ Vector{@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}}

Get all annotations that apply to str. Should position be provided, only annotations that overlap with position will be returned.

Annotations are provided together with the regions they apply to, in the form of a vector of region–annotation tuples.

In accordance with the semantics documented in AnnotatedString, the order of annotations returned matches the order in which they were applied.

See also: annotate!.

source
Base.annotate!Function
annotate!(char::AnnotatedChar, label::Symbol, value::Any)

Annotate char with the labeled value (label, value).

source
annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol, value)
+annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol, value)

Annotate a range of str (or the entire string) with a labeled value (label, value). To remove existing label annotations, use a value of nothing.

The order in which annotations are applied to str is semantically meaningful, as described in AnnotatedString.

source
diff --git a/en/v1.12-dev/devdocs/EscapeAnalysis/index.html b/en/v1.12-dev/devdocs/EscapeAnalysis/index.html index 7639c4be251..ec64e58c994 100644 --- a/en/v1.12-dev/devdocs/EscapeAnalysis/index.html +++ b/en/v1.12-dev/devdocs/EscapeAnalysis/index.html @@ -432,4 +432,4 @@ ◌ 2 ─ nothing::Nothing3 ─ nothing::Nothing4 ─ nothing::Nothing -◌ 5 ─ return _3

Analysis Usage

analyze_escapes is the entry point to analyze escape information of SSA-IR elements.

Most optimizations like SROA (sroa_pass!) are more effective when applied to an optimized source that the inlining pass (ssa_inlining_pass!) has simplified by resolving inter-procedural calls and expanding callee sources. Accordingly, analyze_escapes is also able to analyze post-inlining IR and collect escape information that is useful for certain memory-related optimizations.

However, since certain optimization passes like inlining can change control flows and eliminate dead code, they can break the inter-procedural validity of escape information. In particularity, in order to collect inter-procedurally valid escape information, we need to analyze a pre-inlining IR.

Because of this reason, analyze_escapes can analyze IRCode at any Julia-level optimization stage, and especially, it is supposed to be used at the following two stages:

Escape information derived by IPO EA is transformed to the ArgEscapeCache data structure and cached globally. By passing an appropriate get_escape_cache callback to analyze_escapes, the escape analysis can improve analysis accuracy by utilizing cached inter-procedural information of non-inlined callees that has been derived by previous IPO EA. More interestingly, it is also valid to use IPO EA escape information for type inference, e.g., inference accuracy can be improved by forming Const/PartialStruct/MustAlias of mutable object.

Base.Compiler.EscapeAnalysis.analyze_escapesFunction
analyze_escapes(ir::IRCode, nargs::Int, get_escape_cache) -> estate::EscapeState

Analyzes escape information in ir:

  • nargs: the number of actual arguments of the analyzed call
  • get_escape_cache(::MethodInstance) -> Union{Bool,ArgEscapeCache}: retrieves cached argument escape information
source
Base.Compiler.EscapeAnalysis.EscapeStateType
estate::EscapeState

Extended lattice that maps arguments and SSA values to escape information represented as EscapeInfo. Escape information imposed on SSA IR element x can be retrieved by estate[x].

source
Base.Compiler.EscapeAnalysis.EscapeInfoType
x::EscapeInfo

A lattice for escape information, which holds the following properties:

  • x.Analyzed::Bool: not formally part of the lattice, only indicates whether x has been analyzed
  • x.ReturnEscape::Bool: indicates x can escape to the caller via return
  • x.ThrownEscape::BitSet: records SSA statement numbers where x can be thrown as exception:
    • isempty(x.ThrownEscape): x will never be thrown in this call frame (the bottom)
    • pc ∈ x.ThrownEscape: x may be thrown at the SSA statement at pc
    • -1 ∈ x.ThrownEscape: x may be thrown at arbitrary points of this call frame (the top)
    This information will be used by escape_exception! to propagate potential escapes via exception.
  • x.AliasInfo::Union{Bool,IndexableFields,Unindexable}: maintains all possible values that can be aliased to fields or array elements of x:
    • x.AliasInfo === false indicates the fields/elements of x aren't analyzed yet
    • x.AliasInfo === true indicates the fields/elements of x can't be analyzed, e.g. the type of x is not known or is not concrete and thus its fields/elements can't be known precisely
    • x.AliasInfo::IndexableFields records all the possible values that can be aliased to fields of object x with precise index information
    • x.AliasInfo::Unindexable records all the possible values that can be aliased to fields/elements of x without precise index information
  • x.Liveness::BitSet: records SSA statement numbers where x should be live, e.g. to be used as a call argument, to be returned to a caller, or preserved for :foreigncall:
    • isempty(x.Liveness): x is never be used in this call frame (the bottom)
    • 0 ∈ x.Liveness also has the special meaning that it's a call argument of the currently analyzed call frame (and thus it's visible from the caller immediately).
    • pc ∈ x.Liveness: x may be used at the SSA statement at pc
    • -1 ∈ x.Liveness: x may be used at arbitrary points of this call frame (the top)

There are utility constructors to create common EscapeInfos, e.g.,

  • NoEscape(): the bottom(-like) element of this lattice, meaning it won't escape to anywhere
  • AllEscape(): the topmost element of this lattice, meaning it will escape to everywhere

analyze_escapes will transition these elements from the bottom to the top, in the same direction as Julia's native type inference routine. An abstract state will be initialized with the bottom(-like) elements:

  • the call arguments are initialized as ArgEscape(), whose Liveness property includes 0 to indicate that it is passed as a call argument and visible from a caller immediately
  • the other states are initialized as NotAnalyzed(), which is a special lattice element that is slightly lower than NoEscape, but at the same time doesn't represent any meaning other than it's not analyzed yet (thus it's not formally part of the lattice)
source

+◌ 5 ─ return _3

Analysis Usage

analyze_escapes is the entry point to analyze escape information of SSA-IR elements.

Most optimizations like SROA (sroa_pass!) are more effective when applied to an optimized source that the inlining pass (ssa_inlining_pass!) has simplified by resolving inter-procedural calls and expanding callee sources. Accordingly, analyze_escapes is also able to analyze post-inlining IR and collect escape information that is useful for certain memory-related optimizations.

However, since certain optimization passes like inlining can change control flows and eliminate dead code, they can break the inter-procedural validity of escape information. In particularity, in order to collect inter-procedurally valid escape information, we need to analyze a pre-inlining IR.

Because of this reason, analyze_escapes can analyze IRCode at any Julia-level optimization stage, and especially, it is supposed to be used at the following two stages:

Escape information derived by IPO EA is transformed to the ArgEscapeCache data structure and cached globally. By passing an appropriate get_escape_cache callback to analyze_escapes, the escape analysis can improve analysis accuracy by utilizing cached inter-procedural information of non-inlined callees that has been derived by previous IPO EA. More interestingly, it is also valid to use IPO EA escape information for type inference, e.g., inference accuracy can be improved by forming Const/PartialStruct/MustAlias of mutable object.

Base.Compiler.EscapeAnalysis.analyze_escapesFunction
analyze_escapes(ir::IRCode, nargs::Int, get_escape_cache) -> estate::EscapeState

Analyzes escape information in ir:

  • nargs: the number of actual arguments of the analyzed call
  • get_escape_cache(::MethodInstance) -> Union{Bool,ArgEscapeCache}: retrieves cached argument escape information
source
Base.Compiler.EscapeAnalysis.EscapeStateType
estate::EscapeState

Extended lattice that maps arguments and SSA values to escape information represented as EscapeInfo. Escape information imposed on SSA IR element x can be retrieved by estate[x].

source
Base.Compiler.EscapeAnalysis.EscapeInfoType
x::EscapeInfo

A lattice for escape information, which holds the following properties:

  • x.Analyzed::Bool: not formally part of the lattice, only indicates whether x has been analyzed
  • x.ReturnEscape::Bool: indicates x can escape to the caller via return
  • x.ThrownEscape::BitSet: records SSA statement numbers where x can be thrown as exception:
    • isempty(x.ThrownEscape): x will never be thrown in this call frame (the bottom)
    • pc ∈ x.ThrownEscape: x may be thrown at the SSA statement at pc
    • -1 ∈ x.ThrownEscape: x may be thrown at arbitrary points of this call frame (the top)
    This information will be used by escape_exception! to propagate potential escapes via exception.
  • x.AliasInfo::Union{Bool,IndexableFields,Unindexable}: maintains all possible values that can be aliased to fields or array elements of x:
    • x.AliasInfo === false indicates the fields/elements of x aren't analyzed yet
    • x.AliasInfo === true indicates the fields/elements of x can't be analyzed, e.g. the type of x is not known or is not concrete and thus its fields/elements can't be known precisely
    • x.AliasInfo::IndexableFields records all the possible values that can be aliased to fields of object x with precise index information
    • x.AliasInfo::Unindexable records all the possible values that can be aliased to fields/elements of x without precise index information
  • x.Liveness::BitSet: records SSA statement numbers where x should be live, e.g. to be used as a call argument, to be returned to a caller, or preserved for :foreigncall:
    • isempty(x.Liveness): x is never be used in this call frame (the bottom)
    • 0 ∈ x.Liveness also has the special meaning that it's a call argument of the currently analyzed call frame (and thus it's visible from the caller immediately).
    • pc ∈ x.Liveness: x may be used at the SSA statement at pc
    • -1 ∈ x.Liveness: x may be used at arbitrary points of this call frame (the top)

There are utility constructors to create common EscapeInfos, e.g.,

  • NoEscape(): the bottom(-like) element of this lattice, meaning it won't escape to anywhere
  • AllEscape(): the topmost element of this lattice, meaning it will escape to everywhere

analyze_escapes will transition these elements from the bottom to the top, in the same direction as Julia's native type inference routine. An abstract state will be initialized with the bottom(-like) elements:

  • the call arguments are initialized as ArgEscape(), whose Liveness property includes 0 to indicate that it is passed as a call argument and visible from a caller immediately
  • the other states are initialized as NotAnalyzed(), which is a special lattice element that is slightly lower than NoEscape, but at the same time doesn't represent any meaning other than it's not analyzed yet (thus it's not formally part of the lattice)
source

diff --git a/en/v1.12-dev/devdocs/aot/index.html b/en/v1.12-dev/devdocs/aot/index.html index d905ffd1252..dd8ce3c2439 100644 --- a/en/v1.12-dev/devdocs/aot/index.html +++ b/en/v1.12-dev/devdocs/aot/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Ahead of Time Compilation

This document describes the design and structure of the ahead-of-time (AOT) compilation system in Julia. This system is used when generating system images and package images. Much of the implementation described here is located in aotcompile.cpp, staticdata.c, and processor.cpp

Introduction

Though Julia normally compiles code just-in-time (JIT), it is possible to compile code ahead of time and save the resulting code to a file. This can be useful for a number of reasons:

  1. To reduce the time it takes to start a Julia process.
  2. To reduce the time spent in the JIT compiler instead of executing code (time to first execution, TTFX).
  3. To reduce the amount of memory used by the JIT compiler.

High-Level Overview

The following descriptions are a snapshot of the current implementation details of the end-to-end pipeline that happens internally when the user compiles a new AOT module, such as occurs when they type using Foo. These details are likely to change over time as we implement better ways to handle them, so current implementations may not exactly match the dataflow and functions described below.

Compiling Code Images

Firstly, the methods that need to be compiled to native code must be identified. This can only be done by actually executing the code to be compiled, as the set of methods that need to be compiled depends on the types of the arguments passed to the methods, and method invocations with certain combinations of types may not be known until runtime. During this process, the exact methods that the compiler sees are tracked for later compilation, producing a compilation trace.

Note

Currently when compiling images, Julia runs the trace generation in a different process than the process performing the AOT compilation. This can have impacts when attempting to use a debugger during precompilation. The best way to debug precompilation with a debugger is to use the rr debugger, record the entire process tree, use rr ps to identify the relevant failing process, and then use rr replay -p PID to replay just the failing process.

Once the methods to be compiled have been identified, they are passed to the jl_create_system_image function. This function sets up a number of data structures that will be used when serializing native code to a file, and then calls jl_create_native with the array of methods. jl_create_native runs codegen on the methods produces one or more LLVM modules. jl_create_system_image then records some useful information about what codegen produced from the module(s).

The module(s) are then passed to jl_dump_native, along with the information recorded by jl_create_system_image. jl_dump_native contains the code necessary to serialize the module(s) to bitcode, object, or assembly files depending on the command-line options passed to Julia. The serialized code and information are then written to a file as an archive.

The final step is to run a system linker on the object files in the archive produced by jl_dump_native. Once this step is complete, a shared library containing the compiled code is produced.

Loading Code Images

When loading a code image, the shared library produced by the linker is loaded into memory. The system image data is then loaded from the shared library. This data contains information about the types, methods, and code instances that were compiled into the shared library. This data is used to restore the state of the runtime to what it was when the code image was compiled.

If the code image was compiled with multiversioning, the loader will pick the appropriate version of each function to use based on the CPU features available on the current machine.

For system images, since no other code has been loaded, the state of the runtime is now the same as it was when the code image was compiled. For package images, the environment may have changed compared to when the code was compiled, so each method must be checked against the global method table to determine if it is still valid code.

Compiling Methods

Tracing Compiled Methods

Julia has a command-line flag to record all of the methods that are compiled by the JIT compiler, --trace-compile=filename. When a function is compiled and this flag has a filename, Julia will print out a precompile statement to that file with the method and argument types it was called with. This therefore generates a precompile script that can be used later in the AOT compilation process. The PrecompileTools package has tooling that can make taking advantage of this functionality easier for package developers.

jl_create_system_image

jl_create_system_image saves all of the Julia-specific metadata necessary to later restore the state of the runtime. This includes data such as code instances, method instances, method tables, and type information. This function also sets up the data structures necessary to serialize the native code to a file. Finally, it calls jl_create_native to create one or more LLVM modules containing the native code for the methods passed to it. jl_create_native is responsible for running codegen on the methods passed to it.

jl_dump_native

jl_dump_native is responsible for serializing the LLVM module containing the native code to a file. In addition to the module, the system image data produced by jl_create_system_image is compiled as a global variable. The output of this method is bitcode, object, and/or assembly archives containing the code and system image data.

jl_dump_native is typically one of the larger time sinks when emitting native code, with much of the time spent in optimizing LLVM IR and emitting machine code. Therefore, this function is capable of multithreading the optimization and machine code emission steps. This multithreading is parameterized on the size of the module, but can be explicitly overridden by setting the JULIA_IMAGE_THREADS environment variable. The default maximum number of threads is half the number of available threads, but setting it to be lower can reduce peak memory usage during compilation.

jl_dump_native can also produce native code optimized for multiple architectures, when integrated with the Julia loader. This is triggered by setting the JULIA_CPU_TARGET environment variable and mediated by the multiversioning pass in the optimization pipeline. To make this work with multithreading, an annotation step is added before the module is split into submodules that are emitted on their own threads, and this annotation step uses information available throughout the entire module to decide what functions are cloned for different architectures. Once the annotation has happened, individual threads can emit code for different architectures in parallel, knowing that a different submodule is guaranteed to produce the necessary functions that will be called by a cloned function.

Some other metadata about how the module was serialized is also stored in the archive, such as the number of threads used to serialize the module and the number of functions that were compiled.

Static Linking

The final step in the AOT compilation process is to run a linker on the object files in the archive produced by jl_dump_native. This produces a shared library containing the compiled code. This shared library can then be loaded by Julia to restore the state of the runtime. When compiling a system image, the native linker used by a C compiler is used to produce the final shared library. For package images, the LLVM linker LLD is used to provide a more consistent linking interface.

Loading Code Images

Loading the Shared Library

The first step in loading a code image is to load the shared library produced by the linker. This is done by calling jl_dlopen on the path to the shared library. This function is responsible for loading the shared library and resolving all of the symbols in the library.

Loading Native Code

The loader first needs to identify whether the native code that was compiled is valid for the architecture that the loader is running on. This is necessary to avoid executing instructions that older CPUs do not recognize. This is done by checking the CPU features available on the current machine against the CPU features that the code was compiled for. When multiversioning is enabled, the loader will pick the appropriate version of each function to use based on the CPU features available on the current machine. If none of the feature sets that were multiversioned, the loader will throw an error.

Part of the multiversioning pass creates a number of global arrays of all of the functions in the module. When this process is multithreaded, an array of arrays is created, which the loader reorganizes into one large array with all of the functions that were compiled for this architecture. A similar process occurs for the global variables in the module.

Setting Up Julia State

The loader then uses the global variables and functions produced from loading native code to set up Julia runtime core data structures in the current process. This setup involves adding types and methods to the Julia runtime, and making the cached native code available for use by other Julia functions and the interpreter. For package images, each method must be validated, in that the global method table's state must match the state that the package image was compiled for. In particular, if a different set of methods exists at the load time compared to compile time of the package image, the method must be invalidated and recompiled on first use. This is necessary to ensure that execution semantics remain the same regardless of if a package was precompiled or if the code was directly executed. System images do not need to perform this validation, since the global method table is empty at load time. Thus, system images have faster load times than package images.

+

Ahead of Time Compilation

This document describes the design and structure of the ahead-of-time (AOT) compilation system in Julia. This system is used when generating system images and package images. Much of the implementation described here is located in aotcompile.cpp, staticdata.c, and processor.cpp

Introduction

Though Julia normally compiles code just-in-time (JIT), it is possible to compile code ahead of time and save the resulting code to a file. This can be useful for a number of reasons:

  1. To reduce the time it takes to start a Julia process.
  2. To reduce the time spent in the JIT compiler instead of executing code (time to first execution, TTFX).
  3. To reduce the amount of memory used by the JIT compiler.

High-Level Overview

The following descriptions are a snapshot of the current implementation details of the end-to-end pipeline that happens internally when the user compiles a new AOT module, such as occurs when they type using Foo. These details are likely to change over time as we implement better ways to handle them, so current implementations may not exactly match the dataflow and functions described below.

Compiling Code Images

Firstly, the methods that need to be compiled to native code must be identified. This can only be done by actually executing the code to be compiled, as the set of methods that need to be compiled depends on the types of the arguments passed to the methods, and method invocations with certain combinations of types may not be known until runtime. During this process, the exact methods that the compiler sees are tracked for later compilation, producing a compilation trace.

Note

Currently when compiling images, Julia runs the trace generation in a different process than the process performing the AOT compilation. This can have impacts when attempting to use a debugger during precompilation. The best way to debug precompilation with a debugger is to use the rr debugger, record the entire process tree, use rr ps to identify the relevant failing process, and then use rr replay -p PID to replay just the failing process.

Once the methods to be compiled have been identified, they are passed to the jl_create_system_image function. This function sets up a number of data structures that will be used when serializing native code to a file, and then calls jl_create_native with the array of methods. jl_create_native runs codegen on the methods produces one or more LLVM modules. jl_create_system_image then records some useful information about what codegen produced from the module(s).

The module(s) are then passed to jl_dump_native, along with the information recorded by jl_create_system_image. jl_dump_native contains the code necessary to serialize the module(s) to bitcode, object, or assembly files depending on the command-line options passed to Julia. The serialized code and information are then written to a file as an archive.

The final step is to run a system linker on the object files in the archive produced by jl_dump_native. Once this step is complete, a shared library containing the compiled code is produced.

Loading Code Images

When loading a code image, the shared library produced by the linker is loaded into memory. The system image data is then loaded from the shared library. This data contains information about the types, methods, and code instances that were compiled into the shared library. This data is used to restore the state of the runtime to what it was when the code image was compiled.

If the code image was compiled with multiversioning, the loader will pick the appropriate version of each function to use based on the CPU features available on the current machine.

For system images, since no other code has been loaded, the state of the runtime is now the same as it was when the code image was compiled. For package images, the environment may have changed compared to when the code was compiled, so each method must be checked against the global method table to determine if it is still valid code.

Compiling Methods

Tracing Compiled Methods

Julia has a command-line flag to record all of the methods that are compiled by the JIT compiler, --trace-compile=filename. When a function is compiled and this flag has a filename, Julia will print out a precompile statement to that file with the method and argument types it was called with. This therefore generates a precompile script that can be used later in the AOT compilation process. The PrecompileTools package has tooling that can make taking advantage of this functionality easier for package developers.

jl_create_system_image

jl_create_system_image saves all of the Julia-specific metadata necessary to later restore the state of the runtime. This includes data such as code instances, method instances, method tables, and type information. This function also sets up the data structures necessary to serialize the native code to a file. Finally, it calls jl_create_native to create one or more LLVM modules containing the native code for the methods passed to it. jl_create_native is responsible for running codegen on the methods passed to it.

jl_dump_native

jl_dump_native is responsible for serializing the LLVM module containing the native code to a file. In addition to the module, the system image data produced by jl_create_system_image is compiled as a global variable. The output of this method is bitcode, object, and/or assembly archives containing the code and system image data.

jl_dump_native is typically one of the larger time sinks when emitting native code, with much of the time spent in optimizing LLVM IR and emitting machine code. Therefore, this function is capable of multithreading the optimization and machine code emission steps. This multithreading is parameterized on the size of the module, but can be explicitly overridden by setting the JULIA_IMAGE_THREADS environment variable. The default maximum number of threads is half the number of available threads, but setting it to be lower can reduce peak memory usage during compilation.

jl_dump_native can also produce native code optimized for multiple architectures, when integrated with the Julia loader. This is triggered by setting the JULIA_CPU_TARGET environment variable and mediated by the multiversioning pass in the optimization pipeline. To make this work with multithreading, an annotation step is added before the module is split into submodules that are emitted on their own threads, and this annotation step uses information available throughout the entire module to decide what functions are cloned for different architectures. Once the annotation has happened, individual threads can emit code for different architectures in parallel, knowing that a different submodule is guaranteed to produce the necessary functions that will be called by a cloned function.

Some other metadata about how the module was serialized is also stored in the archive, such as the number of threads used to serialize the module and the number of functions that were compiled.

Static Linking

The final step in the AOT compilation process is to run a linker on the object files in the archive produced by jl_dump_native. This produces a shared library containing the compiled code. This shared library can then be loaded by Julia to restore the state of the runtime. When compiling a system image, the native linker used by a C compiler is used to produce the final shared library. For package images, the LLVM linker LLD is used to provide a more consistent linking interface.

Loading Code Images

Loading the Shared Library

The first step in loading a code image is to load the shared library produced by the linker. This is done by calling jl_dlopen on the path to the shared library. This function is responsible for loading the shared library and resolving all of the symbols in the library.

Loading Native Code

The loader first needs to identify whether the native code that was compiled is valid for the architecture that the loader is running on. This is necessary to avoid executing instructions that older CPUs do not recognize. This is done by checking the CPU features available on the current machine against the CPU features that the code was compiled for. When multiversioning is enabled, the loader will pick the appropriate version of each function to use based on the CPU features available on the current machine. If none of the feature sets that were multiversioned, the loader will throw an error.

Part of the multiversioning pass creates a number of global arrays of all of the functions in the module. When this process is multithreaded, an array of arrays is created, which the loader reorganizes into one large array with all of the functions that were compiled for this architecture. A similar process occurs for the global variables in the module.

Setting Up Julia State

The loader then uses the global variables and functions produced from loading native code to set up Julia runtime core data structures in the current process. This setup involves adding types and methods to the Julia runtime, and making the cached native code available for use by other Julia functions and the interpreter. For package images, each method must be validated, in that the global method table's state must match the state that the package image was compiled for. In particular, if a different set of methods exists at the load time compared to compile time of the package image, the method must be invalidated and recompiled on first use. This is necessary to ensure that execution semantics remain the same regardless of if a package was precompiled or if the code was directly executed. System images do not need to perform this validation, since the global method table is empty at load time. Thus, system images have faster load times than package images.

diff --git a/en/v1.12-dev/devdocs/ast/index.html b/en/v1.12-dev/devdocs/ast/index.html index c6280f7302e..e0c0fa424a3 100644 --- a/en/v1.12-dev/devdocs/ast/index.html +++ b/en/v1.12-dev/devdocs/ast/index.html @@ -38,4 +38,4 @@ # index into linetable (if defined), else a line number (in the file represented by def) # then index into edges # then index into edges[linetable] -end +end diff --git a/en/v1.12-dev/devdocs/backtraces/index.html b/en/v1.12-dev/devdocs/backtraces/index.html index 35ad2b72ee1..18506ce0d00 100644 --- a/en/v1.12-dev/devdocs/backtraces/index.html +++ b/en/v1.12-dev/devdocs/backtraces/index.html @@ -3,15 +3,15 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Reporting and analyzing crashes (segfaults)

So you managed to break Julia. Congratulations! Collected here are some general procedures you can undergo for common symptoms encountered when something goes awry. Including the information from these debugging steps can greatly help the maintainers when tracking down a segfault or trying to figure out why your script is running slower than expected.

If you've been directed to this page, find the symptom that best matches what you're experiencing and follow the instructions to generate the debugging information requested. Table of symptoms:

Version/Environment info

No matter the error, we will always need to know what version of Julia you are running. When Julia first starts up, a header is printed out with a version number and date. Please also include the output of versioninfo() (exported from the InteractiveUtils standard library) in any report you create:

julia> using InteractiveUtils
julia> versioninfo()Julia Version 1.12.0-DEV.1896 -Commit 2dc3337626c (2025-01-16 02:22 UTC) +

Reporting and analyzing crashes (segfaults)

So you managed to break Julia. Congratulations! Collected here are some general procedures you can undergo for common symptoms encountered when something goes awry. Including the information from these debugging steps can greatly help the maintainers when tracking down a segfault or trying to figure out why your script is running slower than expected.

If you've been directed to this page, find the symptom that best matches what you're experiencing and follow the instructions to generate the debugging information requested. Table of symptoms:

Version/Environment info

No matter the error, we will always need to know what version of Julia you are running. When Julia first starts up, a header is printed out with a version number and date. Please also include the output of versioninfo() (exported from the InteractiveUtils standard library) in any report you create:

julia> using InteractiveUtils
julia> versioninfo()Julia Version 1.12.0-DEV.1897 +Commit b0ae24ffada (2025-01-16 02:23 UTC) Build Info: Official https://julialang.org release Platform Info: OS: Linux (x86_64-linux-gnu) - CPU: 128 × AMD EPYC 7502 32-Core Processor + CPU: 128 × AMD EPYC 9354 32-Core Processor WORD_SIZE: 64 - LLVM: libLLVM-18.1.7 (ORCJIT, znver2) + LLVM: libLLVM-18.1.7 (ORCJIT, znver4) GC: Built with stock GC Threads: 1 default, 0 interactive, 1 GC (on 128 virtual cores) Environment: @@ -25,4 +25,4 @@ Starting program: /home/sabae/src/julia/usr/bin/julia-debug ./test.jl ... (gdb) bt

Create a gist with the backtrace, the version info, and any other pertinent information you can think of and open a new issue on Github with a link to the gist.

Errors during Julia startup

Occasionally errors occur during Julia's startup process (especially when using binary distributions, as opposed to compiling from source) such as the following:

$ julia
-exec: error -5

These errors typically indicate something is not getting loaded properly very early on in the bootup phase, and our best bet in determining what's going wrong is to use external tools to audit the disk activity of the julia process:

  • On Linux, use strace:

    $ strace julia
  • On OSX, use dtruss:

    $ dtruss -f julia

Create a gist with the strace/ dtruss output, the version info, and any other pertinent information and open a new issue on Github with a link to the gist.

Other generic segfaults or unreachables reached

As mentioned elsewhere, julia has good integration with rr for generating traces; this includes, on Linux, the ability to automatically run julia under rr and share the trace after a crash. This can be immensely helpful when debugging such crashes and is strongly encouraged when reporting crash issues to the JuliaLang/julia repo. To run julia under rr automatically, do:

julia --bug-report=rr

To generate the rr trace locally, but not share, you can do:

julia --bug-report=rr-local

Note that this is only works on Linux. The blog post on Time Travelling Bug Reporting has many more details.

Glossary

A few terms have been used as shorthand in this guide:

  • <julia_root> refers to the root directory of the Julia source tree; e.g. it should contain folders such as base, deps, src, test, etc.....
+exec: error -5

These errors typically indicate something is not getting loaded properly very early on in the bootup phase, and our best bet in determining what's going wrong is to use external tools to audit the disk activity of the julia process:

  • On Linux, use strace:

    $ strace julia
  • On OSX, use dtruss:

    $ dtruss -f julia

Create a gist with the strace/ dtruss output, the version info, and any other pertinent information and open a new issue on Github with a link to the gist.

Other generic segfaults or unreachables reached

As mentioned elsewhere, julia has good integration with rr for generating traces; this includes, on Linux, the ability to automatically run julia under rr and share the trace after a crash. This can be immensely helpful when debugging such crashes and is strongly encouraged when reporting crash issues to the JuliaLang/julia repo. To run julia under rr automatically, do:

julia --bug-report=rr

To generate the rr trace locally, but not share, you can do:

julia --bug-report=rr-local

Note that this is only works on Linux. The blog post on Time Travelling Bug Reporting has many more details.

Glossary

A few terms have been used as shorthand in this guide:

  • <julia_root> refers to the root directory of the Julia source tree; e.g. it should contain folders such as base, deps, src, test, etc.....
diff --git a/en/v1.12-dev/devdocs/boundscheck/index.html b/en/v1.12-dev/devdocs/boundscheck/index.html index f7fb908bb68..8da48550de9 100644 --- a/en/v1.12-dev/devdocs/boundscheck/index.html +++ b/en/v1.12-dev/devdocs/boundscheck/index.html @@ -19,4 +19,4 @@ julia> sum(OffsetArray([1, 2, 3], -10)) 9164911648 # inconsistent results or segfault

While the original source of the error here is 1:length(A), the use of @inbounds increases the consequences from a bounds error to a less easily caught and debugged unsafe memory access. It is often difficult or impossible to prove that a method which uses @inbounds is safe, so one must weigh the benefits of performance improvements against the risk of segfaults and silent misbehavior, especially in public facing APIs.

Propagating inbounds

There may be certain scenarios where for code-organization reasons you want more than one layer between the @inbounds and @boundscheck declarations. For instance, the default getindex methods have the chain getindex(A::AbstractArray, i::Real) calls getindex(IndexStyle(A), A, i) calls _getindex(::IndexLinear, A, i).

To override the "one layer of inlining" rule, a function may be marked with Base.@propagate_inbounds to propagate an inbounds context (or out of bounds context) through one additional layer of inlining.

The bounds checking call hierarchy

The overall hierarchy is:

Here A is the array, and I contains the "requested" indices. axes(A) returns a tuple of "permitted" indices of A.

checkbounds(A, I...) throws an error if the indices are invalid, whereas checkbounds(Bool, A, I...) returns false in that circumstance. checkbounds_indices discards any information about the array other than its axes tuple, and performs a pure indices-vs-indices comparison: this allows relatively few compiled methods to serve a huge variety of array types. Indices are specified as tuples, and are usually compared in a 1-1 fashion with individual dimensions handled by calling another important function, checkindex: typically,

checkbounds_indices(Bool, (IA1, IA...), (I1, I...)) = checkindex(Bool, IA1, I1) &
-                                                      checkbounds_indices(Bool, IA, I)

so checkindex checks a single dimension. All of these functions, including the unexported checkbounds_indices have docstrings accessible with ? .

If you have to customize bounds checking for a specific array type, you should specialize checkbounds(Bool, A, I...). However, in most cases you should be able to rely on checkbounds_indices as long as you supply useful axes for your array type.

If you have novel index types, first consider specializing checkindex, which handles a single index for a particular dimension of an array. If you have a custom multidimensional index type (similar to CartesianIndex), then you may have to consider specializing checkbounds_indices.

Note this hierarchy has been designed to reduce the likelihood of method ambiguities. We try to make checkbounds the place to specialize on array type, and try to avoid specializations on index types; conversely, checkindex is intended to be specialized only on index type (especially, the last argument).

Emit bounds checks

Julia can be launched with --check-bounds={yes|no|auto} to emit bounds checks always, never, or respect @inbounds declarations.

+ checkbounds_indices(Bool, IA, I)

so checkindex checks a single dimension. All of these functions, including the unexported checkbounds_indices have docstrings accessible with ? .

If you have to customize bounds checking for a specific array type, you should specialize checkbounds(Bool, A, I...). However, in most cases you should be able to rely on checkbounds_indices as long as you supply useful axes for your array type.

If you have novel index types, first consider specializing checkindex, which handles a single index for a particular dimension of an array. If you have a custom multidimensional index type (similar to CartesianIndex), then you may have to consider specializing checkbounds_indices.

Note this hierarchy has been designed to reduce the likelihood of method ambiguities. We try to make checkbounds the place to specialize on array type, and try to avoid specializations on index types; conversely, checkindex is intended to be specialized only on index type (especially, the last argument).

Emit bounds checks

Julia can be launched with --check-bounds={yes|no|auto} to emit bounds checks always, never, or respect @inbounds declarations.

diff --git a/en/v1.12-dev/devdocs/build/arm/index.html b/en/v1.12-dev/devdocs/build/arm/index.html index 1edb4077b62..9d63b9b3a37 100644 --- a/en/v1.12-dev/devdocs/build/arm/index.html +++ b/en/v1.12-dev/devdocs/build/arm/index.html @@ -4,4 +4,4 @@ gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash});

ARM (Linux)

Julia fully supports ARMv8 (AArch64) processors, and supports ARMv7 and ARMv6 (AArch32) with some caveats. This file provides general guidelines for compilation, in addition to instructions for specific devices.

A list of known issues for ARM is available. If you encounter difficulties, please create an issue including the output from cat /proc/cpuinfo.

32-bit (ARMv6, ARMv7)

Julia has been successfully compiled on several variants of the following ARMv6 & ARMv7 devices:

  • ARMv7 / Cortex A15 Samsung Chromebooks running Ubuntu Linux under Crouton;
  • Raspberry Pi.
  • Odroid.

Julia requires at least the armv6 and vfpv2 instruction sets. It's recommended to use armv7-a. armv5 or soft float are not supported.

Raspberry Pi 1 / Raspberry Pi Zero

If the type of ARM CPU used in the Raspberry Pi is not detected by LLVM, then explicitly set the CPU target by adding the following to Make.user:

JULIA_CPU_TARGET=arm1176jzf-s

To complete the build, you may need to increase the swap file size. To do so, edit /etc/dphys-swapfile, changing the line:

CONF_SWAPSIZE=100

to:

CONF_SWAPSIZE=512

before restarting the swapfile service:

sudo /etc/init.d/dphys-swapfile stop
-sudo /etc/init.d/dphys-swapfile start

Raspberry Pi 2

The type of ARM CPU used in the Raspberry Pi 2 is not detected by LLVM. Explicitly set the CPU target by adding the following to Make.user:

JULIA_CPU_TARGET=cortex-a7

Depending on the exact compiler and distribution, there might be a build failure due to unsupported inline assembly. In that case, add MCPU=armv7-a to Make.user.

AArch64 (ARMv8)

Julia is expected to work and build on ARMv8 cpus. One should follow the general build instructions. Julia expects to have around 8GB of ram or swap enabled to build itself.

Known issues

Starting from Julia v1.10, JITLink is automatically enabled on this architecture for all operating systems when linking to LLVM 15 or later versions. Due to a bug in LLVM memory manager, non-trivial workloads may generate too many memory mappings that on Linux can exceed the limit of memory mappings (mmap) set in the file /proc/sys/vm/max_map_count, resulting in an error like

JIT session error: Cannot allocate memory

Should this happen, ask your system administrator to increase the limit of memory mappings for example with the command

sysctl -w vm.max_map_count=262144
+sudo /etc/init.d/dphys-swapfile start

Raspberry Pi 2

The type of ARM CPU used in the Raspberry Pi 2 is not detected by LLVM. Explicitly set the CPU target by adding the following to Make.user:

JULIA_CPU_TARGET=cortex-a7

Depending on the exact compiler and distribution, there might be a build failure due to unsupported inline assembly. In that case, add MCPU=armv7-a to Make.user.

AArch64 (ARMv8)

Julia is expected to work and build on ARMv8 cpus. One should follow the general build instructions. Julia expects to have around 8GB of ram or swap enabled to build itself.

Known issues

Starting from Julia v1.10, JITLink is automatically enabled on this architecture for all operating systems when linking to LLVM 15 or later versions. Due to a bug in LLVM memory manager, non-trivial workloads may generate too many memory mappings that on Linux can exceed the limit of memory mappings (mmap) set in the file /proc/sys/vm/max_map_count, resulting in an error like

JIT session error: Cannot allocate memory

Should this happen, ask your system administrator to increase the limit of memory mappings for example with the command

sysctl -w vm.max_map_count=262144
diff --git a/en/v1.12-dev/devdocs/build/build/index.html b/en/v1.12-dev/devdocs/build/build/index.html index 2082090d7c3..977ad4698eb 100644 --- a/en/v1.12-dev/devdocs/build/build/index.html +++ b/en/v1.12-dev/devdocs/build/build/index.html @@ -42,4 +42,4 @@ Patches: - [ ] `deps/$(libname).mk` -- [ ] `deps/patches/$(libname)-*.patch`

Note:

Example: OpenLibm

  1. Update Version numbers in deps/openlibm.version
  2. Update Version number in stdlib/OpenLibm_jll/Project.toml
  3. Update checksums in deps/checksums/openlibm
  4. Check if the patch files deps/patches/openlibm-*.patch exist
+- [ ] `deps/patches/$(libname)-*.patch`

Note:

Example: OpenLibm

  1. Update Version numbers in deps/openlibm.version
  2. Update Version number in stdlib/OpenLibm_jll/Project.toml
  3. Update checksums in deps/checksums/openlibm
  4. Check if the patch files deps/patches/openlibm-*.patch exist
diff --git a/en/v1.12-dev/devdocs/build/distributing/index.html b/en/v1.12-dev/devdocs/build/distributing/index.html index aec4a78dd31..ddd8d3bcee9 100644 --- a/en/v1.12-dev/devdocs/build/distributing/index.html +++ b/en/v1.12-dev/devdocs/build/distributing/index.html @@ -47,4 +47,4 @@ signtool sign /f julia-windows-code-sign_2017.p12 /p "PASSWORD" ^ /t http://timestamp.verisign.com/scripts/timstamp.dll ^ /v julia-x.y.z-win32.exe

Note that ^ is a line continuation character in Windows CMD and PASSWORD is a placeholder for the password for this certificate. As usual, contact Elliot or Alex for passwords. If there are no errors, we're all good!

Uploading binaries

Now that everything is signed, we need to upload the binaries to AWS. You can use a program like Cyberduck or the aws command line utility. The binaries should go in the julialang2 bucket in the appropriate folders. For example, Linux x86-64 goes in julialang2/bin/linux/x.y. Be sure to delete the current julia-x.y-latest-linux-<arch>.tar.gz file and replace it with a duplicate of julia-x.y.z-linux-<arch>.tar.gz.

We also need to upload the checksums for everything we've built, including the source tarballs and all release binaries. This is simple:

shasum -a 256 julia-x.y.z* | grep -v -e sha256 -e md5 -e asc > julia-x.y.z.sha256
-md5sum julia-x.y.z* | grep -v -e sha256 -e md5 -e asc > julia-x.y.z.md5

Note that if you're running those commands on macOS, you'll get very slightly different output, which can be reformatted by looking at an existing file. Mac users will also need to use md5 -r instead of md5sum. Upload the .md5 and .sha256 files to julialang2/bin/checksums on AWS.

Ensure that the permissions on AWS for all uploaded files are set to "Everyone: READ."

For each file we've uploaded, we need to purge the Fastly cache so that the links on the website point to the updated files. As an example:

curl -X PURGE https://julialang-s3.julialang.org/bin/checksums/julia-x.y.z.sha256

Sometimes this isn't necessary but it's good to do anyway.

+md5sum julia-x.y.z* | grep -v -e sha256 -e md5 -e asc > julia-x.y.z.md5

Note that if you're running those commands on macOS, you'll get very slightly different output, which can be reformatted by looking at an existing file. Mac users will also need to use md5 -r instead of md5sum. Upload the .md5 and .sha256 files to julialang2/bin/checksums on AWS.

Ensure that the permissions on AWS for all uploaded files are set to "Everyone: READ."

For each file we've uploaded, we need to purge the Fastly cache so that the links on the website point to the updated files. As an example:

curl -X PURGE https://julialang-s3.julialang.org/bin/checksums/julia-x.y.z.sha256

Sometimes this isn't necessary but it's good to do anyway.

diff --git a/en/v1.12-dev/devdocs/build/freebsd/index.html b/en/v1.12-dev/devdocs/build/freebsd/index.html index e1ccf303570..3733fb3628a 100644 --- a/en/v1.12-dev/devdocs/build/freebsd/index.html +++ b/en/v1.12-dev/devdocs/build/freebsd/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

FreeBSD

Clang is the default compiler on FreeBSD 11.0-RELEASE and above. The remaining build tools are available from the Ports Collection, and can be installed using pkg install git gcc gmake cmake pkgconf. To build Julia, simply run gmake. (Note that gmake must be used rather than make, since make on FreeBSD corresponds to the incompatible BSD Make rather than GNU Make.)

As mentioned above, it is important to note that the USE_SYSTEM_* flags should be used with caution on FreeBSD. This is because many system libraries, and even libraries from the Ports Collection, link to the system's libgcc_s.so.1, or to another library which links to the system libgcc_s. This library declares its GCC version to be 4.6, which is too old to build Julia, and conflicts with other libraries when linking. Thus it is highly recommended to simply allow Julia to build all of its dependencies. If you do choose to use the USE_SYSTEM_* flags, note that /usr/local is not on the compiler path by default, so you may need to add LDFLAGS=-L/usr/local/lib and CPPFLAGS=-I/usr/local/include to your Make.user, though doing so may interfere with other dependencies.

Note that the x86 architecture does not support threading due to lack of compiler runtime library support, so you may need to set JULIA_THREADS=0 in your Make.user if you're on a 32-bit system.

+

FreeBSD

Clang is the default compiler on FreeBSD 11.0-RELEASE and above. The remaining build tools are available from the Ports Collection, and can be installed using pkg install git gcc gmake cmake pkgconf. To build Julia, simply run gmake. (Note that gmake must be used rather than make, since make on FreeBSD corresponds to the incompatible BSD Make rather than GNU Make.)

As mentioned above, it is important to note that the USE_SYSTEM_* flags should be used with caution on FreeBSD. This is because many system libraries, and even libraries from the Ports Collection, link to the system's libgcc_s.so.1, or to another library which links to the system libgcc_s. This library declares its GCC version to be 4.6, which is too old to build Julia, and conflicts with other libraries when linking. Thus it is highly recommended to simply allow Julia to build all of its dependencies. If you do choose to use the USE_SYSTEM_* flags, note that /usr/local is not on the compiler path by default, so you may need to add LDFLAGS=-L/usr/local/lib and CPPFLAGS=-I/usr/local/include to your Make.user, though doing so may interfere with other dependencies.

Note that the x86 architecture does not support threading due to lack of compiler runtime library support, so you may need to set JULIA_THREADS=0 in your Make.user if you're on a 32-bit system.

diff --git a/en/v1.12-dev/devdocs/build/linux/index.html b/en/v1.12-dev/devdocs/build/linux/index.html index db5e8ff4311..251e23ee9c0 100644 --- a/en/v1.12-dev/devdocs/build/linux/index.html +++ b/en/v1.12-dev/devdocs/build/linux/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Linux

  • GCC version 4.7 or later is required to build Julia.
  • To use external shared libraries not in the system library search path, set USE_SYSTEM_XXX=1 and LDFLAGS=-Wl,-rpath,/path/to/dir/contains/libXXX.so in Make.user.
  • Instead of setting LDFLAGS, putting the library directory into the environment variable LD_LIBRARY_PATH (at both compile and run time) also works.
  • The USE_SYSTEM_* flags should be used with caution. These are meant only for troubleshooting, porting, and packaging, where package maintainers work closely with the Julia developers to make sure that Julia is built correctly. Production use cases should use the officially provided binaries. Issues arising from the use of these flags will generally not be accepted.
  • See also the external dependencies.

Architecture Customization

Julia can be built for a non-generic architecture by configuring the ARCH Makefile variable in a Make.user file. See the appropriate section of Make.inc for additional customization options, such as MARCH and JULIA_CPU_TARGET.

For example, to build for Pentium 4, set MARCH=pentium4 and install the necessary system libraries for linking. On Ubuntu, these may include lib32gfortran-6-dev, lib32gcc1, and lib32stdc++6, among others.

You can also set MARCH=native in Make.user for a maximum-performance build customized for the current machine CPU.

Linux Build Troubleshooting

ProblemPossible Solution
OpenBLAS build failureSet one of the following build options in Make.user and build again: <ul><li> OPENBLAS_TARGET_ARCH=BARCELONA (AMD CPUs) or OPENBLAS_TARGET_ARCH=NEHALEM (Intel CPUs)<ul>Set OPENBLAS_DYNAMIC_ARCH = 0 to disable compiling multiple architectures in a single binary.</ul></li><li> OPENBLAS_NO_AVX2 = 1 disables AVX2 instructions, allowing OpenBLAS to compile with OPENBLAS_DYNAMIC_ARCH = 1 using old versions of binutils </li><li> USE_SYSTEM_BLAS=1 uses the system provided libblas <ul><li>Set LIBBLAS=-lopenblas and LIBBLASNAME=libopenblas to force the use of the system provided OpenBLAS when multiple BLAS versions are installed. </li></ul></li></ul><p> If you get an error that looks like ../kernel/x86_64/dgemm_kernel_4x4_haswell.S:1709: Error: no such instruction: `vpermpd $ 0xb1,%ymm0,%ymm0', then you need to set OPENBLAS_DYNAMIC_ARCH = 0 or OPENBLAS_NO_AVX2 = 1, or you need a newer version of binutils (2.18 or newer). (Issue #7653)</p><p> If the linker cannot find gfortran and you get an error like julia /usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran, check the path with gfortran -print-file-name=libgfortran.so and use the output to export something similar to this: export LDFLAGS=-L/usr/lib/gcc/x86_64-linux-gnu/8/. See Issue #6150.</p>
Illegal Instruction errorCheck if your CPU supports AVX while your OS does not (e.g. through virtualization, as described in this issue).
+

Linux

  • GCC version 4.7 or later is required to build Julia.
  • To use external shared libraries not in the system library search path, set USE_SYSTEM_XXX=1 and LDFLAGS=-Wl,-rpath,/path/to/dir/contains/libXXX.so in Make.user.
  • Instead of setting LDFLAGS, putting the library directory into the environment variable LD_LIBRARY_PATH (at both compile and run time) also works.
  • The USE_SYSTEM_* flags should be used with caution. These are meant only for troubleshooting, porting, and packaging, where package maintainers work closely with the Julia developers to make sure that Julia is built correctly. Production use cases should use the officially provided binaries. Issues arising from the use of these flags will generally not be accepted.
  • See also the external dependencies.

Architecture Customization

Julia can be built for a non-generic architecture by configuring the ARCH Makefile variable in a Make.user file. See the appropriate section of Make.inc for additional customization options, such as MARCH and JULIA_CPU_TARGET.

For example, to build for Pentium 4, set MARCH=pentium4 and install the necessary system libraries for linking. On Ubuntu, these may include lib32gfortran-6-dev, lib32gcc1, and lib32stdc++6, among others.

You can also set MARCH=native in Make.user for a maximum-performance build customized for the current machine CPU.

Linux Build Troubleshooting

ProblemPossible Solution
OpenBLAS build failureSet one of the following build options in Make.user and build again: <ul><li> OPENBLAS_TARGET_ARCH=BARCELONA (AMD CPUs) or OPENBLAS_TARGET_ARCH=NEHALEM (Intel CPUs)<ul>Set OPENBLAS_DYNAMIC_ARCH = 0 to disable compiling multiple architectures in a single binary.</ul></li><li> OPENBLAS_NO_AVX2 = 1 disables AVX2 instructions, allowing OpenBLAS to compile with OPENBLAS_DYNAMIC_ARCH = 1 using old versions of binutils </li><li> USE_SYSTEM_BLAS=1 uses the system provided libblas <ul><li>Set LIBBLAS=-lopenblas and LIBBLASNAME=libopenblas to force the use of the system provided OpenBLAS when multiple BLAS versions are installed. </li></ul></li></ul><p> If you get an error that looks like ../kernel/x86_64/dgemm_kernel_4x4_haswell.S:1709: Error: no such instruction: `vpermpd $ 0xb1,%ymm0,%ymm0', then you need to set OPENBLAS_DYNAMIC_ARCH = 0 or OPENBLAS_NO_AVX2 = 1, or you need a newer version of binutils (2.18 or newer). (Issue #7653)</p><p> If the linker cannot find gfortran and you get an error like julia /usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran, check the path with gfortran -print-file-name=libgfortran.so and use the output to export something similar to this: export LDFLAGS=-L/usr/lib/gcc/x86_64-linux-gnu/8/. See Issue #6150.</p>
Illegal Instruction errorCheck if your CPU supports AVX while your OS does not (e.g. through virtualization, as described in this issue).
diff --git a/en/v1.12-dev/devdocs/build/macos/index.html b/en/v1.12-dev/devdocs/build/macos/index.html index f599d723fc0..9a684e40fb8 100644 --- a/en/v1.12-dev/devdocs/build/macos/index.html +++ b/en/v1.12-dev/devdocs/build/macos/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

macOS

You need to have the current Xcode command line utilities installed: run xcode-select --install in the terminal. You will need to rerun this terminal command after each macOS update, otherwise you may run into errors involving missing libraries or headers.

The dependent libraries are now built with BinaryBuilder and will be automatically downloaded. This is the preferred way to build Julia source. In case you want to build them all on your own, you will need a 64-bit gfortran to compile Julia dependencies.

brew install gcc

If you have set LD_LIBRARY_PATH or DYLD_LIBRARY_PATH in your .bashrc or equivalent, Julia may be unable to find various libraries that come bundled with it. These environment variables need to be unset for Julia to work.

+

macOS

You need to have the current Xcode command line utilities installed: run xcode-select --install in the terminal. You will need to rerun this terminal command after each macOS update, otherwise you may run into errors involving missing libraries or headers.

The dependent libraries are now built with BinaryBuilder and will be automatically downloaded. This is the preferred way to build Julia source. In case you want to build them all on your own, you will need a 64-bit gfortran to compile Julia dependencies.

brew install gcc

If you have set LD_LIBRARY_PATH or DYLD_LIBRARY_PATH in your .bashrc or equivalent, Julia may be unable to find various libraries that come bundled with it. These environment variables need to be unset for Julia to work.

diff --git a/en/v1.12-dev/devdocs/build/riscv/index.html b/en/v1.12-dev/devdocs/build/riscv/index.html index d4e6ed14b75..3a0653824d7 100644 --- a/en/v1.12-dev/devdocs/build/riscv/index.html +++ b/en/v1.12-dev/devdocs/build/riscv/index.html @@ -14,4 +14,4 @@ OS=Linux export QEMU_LD_PREFIX=/opt/riscv/sysroot

Note that you will have to execute make with PATH set to include the cross-compilation toolchain, e.g., by running:

PATH=/opt/riscv/bin:$PATH make -j$(nproc)

Because of the RISC-V sysroot we use being very barren, you may need to add additional libraries that the Julia build system currently expects to be available system-wide. For example, the build currently relies on a system-provided libz, so you may need to copy this library from the Julia build into the system root:

make -C deps install-zlib
 cp -v usr/lib/libz.*   /opt/riscv/sysroot/usr/lib
-cp -v usr/include/z*.h /opt/riscv/sysroot/usr/include
+cp -v usr/include/z*.h /opt/riscv/sysroot/usr/include diff --git a/en/v1.12-dev/devdocs/build/windows/index.html b/en/v1.12-dev/devdocs/build/windows/index.html index e6dcd761b91..a183ec00eab 100644 --- a/en/v1.12-dev/devdocs/build/windows/index.html +++ b/en/v1.12-dev/devdocs/build/windows/index.html @@ -28,4 +28,4 @@ # switch all of the following to their "-posix" variants (interactively): for pkg in i686-w64-mingw32-g++ i686-w64-mingw32-gcc i686-w64-mingw32-gfortran x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gfortran; do sudo update-alternatives --config $pkg -done

On Mac: Install XCode, XCode command line tools, X11 (now XQuartz), and MacPorts or Homebrew. Then run port install wine wget mingw-w64, or brew install wine wget mingw-w64, as appropriate.

Then run the build:

  1. git clone https://github.com/JuliaLang/julia.git julia-win32
  2. cd julia-win32
  3. echo override XC_HOST = i686-w64-mingw32 >> Make.user
  4. make
  5. make win-extras (Necessary before running make binary-dist)
  6. make binary-dist then make exe to create the Windows installer.
  7. move the julia-*.exe installer to the target machine

If you are building for 64-bit Windows, the steps are essentially the same. Just replace i686 in XC_HOST with x86_64. (Note: on Mac, wine only runs in 32-bit mode).

Debugging a cross-compiled build under wine

The most effective way to debug a cross-compiled version of Julia on the cross-compilation host is to install a Windows version of GDB and run it under wine as usual. The pre-built packages available as part of the MSYS2 project are known to work. Apart from the GDB package you may also need the python and termcap packages. Finally, GDB's prompt may not work when launched from the command line. This can be worked around by prepending wineconsole to the regular GDB invocation.

After compiling

Compiling using one of the options above creates a basic Julia build, but not some extra components that are included if you run the full Julia binary installer. If you need these components, the easiest way to get them is to build the installer yourself using make win-extras followed by make binary-dist and make exe. Then run the resulting installer.

Windows Build Debugging

GDB hangs with Cygwin mintty

GDB not attaching to the right process

GDB not showing the right backtrace

Build process is slow/eats memory/hangs my computer

+done

On Mac: Install XCode, XCode command line tools, X11 (now XQuartz), and MacPorts or Homebrew. Then run port install wine wget mingw-w64, or brew install wine wget mingw-w64, as appropriate.

Then run the build:

  1. git clone https://github.com/JuliaLang/julia.git julia-win32
  2. cd julia-win32
  3. echo override XC_HOST = i686-w64-mingw32 >> Make.user
  4. make
  5. make win-extras (Necessary before running make binary-dist)
  6. make binary-dist then make exe to create the Windows installer.
  7. move the julia-*.exe installer to the target machine

If you are building for 64-bit Windows, the steps are essentially the same. Just replace i686 in XC_HOST with x86_64. (Note: on Mac, wine only runs in 32-bit mode).

Debugging a cross-compiled build under wine

The most effective way to debug a cross-compiled version of Julia on the cross-compilation host is to install a Windows version of GDB and run it under wine as usual. The pre-built packages available as part of the MSYS2 project are known to work. Apart from the GDB package you may also need the python and termcap packages. Finally, GDB's prompt may not work when launched from the command line. This can be worked around by prepending wineconsole to the regular GDB invocation.

After compiling

Compiling using one of the options above creates a basic Julia build, but not some extra components that are included if you run the full Julia binary installer. If you need these components, the easiest way to get them is to build the installer yourself using make win-extras followed by make binary-dist and make exe. Then run the resulting installer.

Windows Build Debugging

GDB hangs with Cygwin mintty

GDB not attaching to the right process

GDB not showing the right backtrace

Build process is slow/eats memory/hangs my computer

diff --git a/en/v1.12-dev/devdocs/builtins/index.html b/en/v1.12-dev/devdocs/builtins/index.html index 509fc1f37f9..5d9515ab53f 100644 --- a/en/v1.12-dev/devdocs/builtins/index.html +++ b/en/v1.12-dev/devdocs/builtins/index.html @@ -4,6 +4,6 @@ gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash});

Core.Builtins

Builtin Function APIs

The following Builtin function APIs are considered unstable, but provide the basic definitions for what defines the abilities and behaviors of a Julia program. They are typically accessed through a higher level generic API.

Core.memoryrefnewFunction
Core.memoryrefnew(::GenericMemory)
-Core.memoryrefnew(::GenericMemoryRef, index::Int, [boundscheck::Bool])

Return a GenericMemoryRef for a GenericMemory. See memoryref.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefoffsetFunction
Core..memoryrefoffset(::GenericMemoryRef)

Return the offset index that was used to construct the MemoryRef. See memoryref.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefgetFunction
Core.memoryrefget(::GenericMemoryRef, ordering::Symbol, boundscheck::Bool)

Return the value stored at the MemoryRef, throwing a BoundsError if the Memory is empty. See ref[]. The memory ordering specified must be compatible with the isatomic parameter.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefset!Function
Core.memoryrefset!(::GenericMemoryRef, value, ordering::Symbol, boundscheck::Bool)

Store the value to the MemoryRef, throwing a BoundsError if the Memory is empty. See ref[] = value. The memory ordering specified must be compatible with the isatomic parameter.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryref_isassignedFunction
Core.memoryref_isassigned(::GenericMemoryRef, ordering::Symbol, boundscheck::Bool)

Return whether there is a value stored at the MemoryRef, returning false if the Memory is empty. See isassigned(::Base.RefValue), Core.memoryrefget. The memory ordering specified must be compatible with the isatomic parameter.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefswap!Function
Core.memoryrefswap!(::GenericMemoryRef, value, ordering::Symbol, boundscheck::Bool)

Atomically perform the operations to simultaneously get and set a MemoryRef value.

Julia 1.11

This function requires Julia 1.11 or later.

See also swapproperty! and Core.memoryrefset!.

source
Core.memoryrefmodify!Function
Core.memoryrefmodify!(::GenericMemoryRef, op, value, ordering::Symbol, boundscheck::Bool) -> Pair

Atomically perform the operations to get and set a MemoryRef value after applying the function op.

Julia 1.11

This function requires Julia 1.11 or later.

See also modifyproperty! and Core.memoryrefset!.

source
Core.memoryrefreplace!Function
Core.memoryrefreplace!(::GenericMemoryRef, expected, desired,
-                       success_order::Symbol, fail_order::Symbol=success_order, boundscheck::Bool) -> (; old, success::Bool)

Atomically perform the operations to get and conditionally set a MemoryRef value.

Julia 1.11

This function requires Julia 1.11 or later.

See also replaceproperty! and Core.memoryrefset!.

source
Core.memoryrefsetonce!Function
Core.memoryrefsetonce!(::GenericMemoryRef, value,
-                       success_order::Symbol, fail_order::Symbol=success_order, boundscheck::Bool) -> success::Bool

Atomically perform the operations to set a MemoryRef to a given value, only if it was previously not set.

Julia 1.11

This function requires Julia 1.11 or later.

See also setpropertyonce! and Core.memoryrefset!.

source
Core.get_binding_typeFunction
Core.get_binding_type(module::Module, name::Symbol)

Retrieve the declared type of the binding name from the module module.

Julia 1.9

This function requires Julia 1.9 or later.

source
Core.IntrinsicFunctionType
Core.IntrinsicFunction <: Core.Builtin <: Function

The Core.IntrinsicFunction function define some basic primitives for what defines the abilities and behaviors of a Julia program

source
Core.IntrinsicsModule
Core.Intrinsics

The Core.Intrinsics module holds the Core.IntrinsicFunction objects.

source
Core.IRModule
Core.IR

The Core.IR module exports the IR object model.

source
+Core.memoryrefnew(::GenericMemoryRef, index::Int, [boundscheck::Bool])

Return a GenericMemoryRef for a GenericMemory. See memoryref.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefoffsetFunction
Core..memoryrefoffset(::GenericMemoryRef)

Return the offset index that was used to construct the MemoryRef. See memoryref.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefgetFunction
Core.memoryrefget(::GenericMemoryRef, ordering::Symbol, boundscheck::Bool)

Return the value stored at the MemoryRef, throwing a BoundsError if the Memory is empty. See ref[]. The memory ordering specified must be compatible with the isatomic parameter.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefset!Function
Core.memoryrefset!(::GenericMemoryRef, value, ordering::Symbol, boundscheck::Bool)

Store the value to the MemoryRef, throwing a BoundsError if the Memory is empty. See ref[] = value. The memory ordering specified must be compatible with the isatomic parameter.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryref_isassignedFunction
Core.memoryref_isassigned(::GenericMemoryRef, ordering::Symbol, boundscheck::Bool)

Return whether there is a value stored at the MemoryRef, returning false if the Memory is empty. See isassigned(::Base.RefValue), Core.memoryrefget. The memory ordering specified must be compatible with the isatomic parameter.

Julia 1.11

This function requires Julia 1.11 or later.

source
Core.memoryrefswap!Function
Core.memoryrefswap!(::GenericMemoryRef, value, ordering::Symbol, boundscheck::Bool)

Atomically perform the operations to simultaneously get and set a MemoryRef value.

Julia 1.11

This function requires Julia 1.11 or later.

See also swapproperty! and Core.memoryrefset!.

source
Core.memoryrefmodify!Function
Core.memoryrefmodify!(::GenericMemoryRef, op, value, ordering::Symbol, boundscheck::Bool) -> Pair

Atomically perform the operations to get and set a MemoryRef value after applying the function op.

Julia 1.11

This function requires Julia 1.11 or later.

See also modifyproperty! and Core.memoryrefset!.

source
Core.memoryrefreplace!Function
Core.memoryrefreplace!(::GenericMemoryRef, expected, desired,
+                       success_order::Symbol, fail_order::Symbol=success_order, boundscheck::Bool) -> (; old, success::Bool)

Atomically perform the operations to get and conditionally set a MemoryRef value.

Julia 1.11

This function requires Julia 1.11 or later.

See also replaceproperty! and Core.memoryrefset!.

source
Core.memoryrefsetonce!Function
Core.memoryrefsetonce!(::GenericMemoryRef, value,
+                       success_order::Symbol, fail_order::Symbol=success_order, boundscheck::Bool) -> success::Bool

Atomically perform the operations to set a MemoryRef to a given value, only if it was previously not set.

Julia 1.11

This function requires Julia 1.11 or later.

See also setpropertyonce! and Core.memoryrefset!.

source
Core.Intrinsics.atomic_pointerrefFunction
Core.Intrinsics.atomic_pointerref(pointer::Ptr{T}, order::Symbol) --> T
Julia 1.7

This function requires Julia 1.7 or later.

See unsafe_load.

source
Core.Intrinsics.atomic_pointersetFunction
Core.Intrinsics.atomic_pointerset(pointer::Ptr{T}, new::T, order::Symbol) --> pointer
Julia 1.7

This function requires Julia 1.7 or later.

See unsafe_store!.

source
Core.Intrinsics.atomic_pointerswapFunction
Core.Intrinsics.atomic_pointerswap(pointer::Ptr{T}, new::T, order::Symbol) --> old
Julia 1.7

This function requires Julia 1.7 or later.

See unsafe_swap!.

source
Core.Intrinsics.atomic_pointermodifyFunction
Core.Intrinsics.atomic_pointermodify(pointer::Ptr{T}, function::(old::T,arg::S)->T, arg::S, order::Symbol) --> old
Julia 1.7

This function requires Julia 1.7 or later.

See unsafe_modify!.

source
Core.Intrinsics.atomic_pointerreplaceFunction
Core.Intrinsics.atomic_pointerreplace(pointer::Ptr{T}, expected::Any, new::T, success_order::Symbol, failure_order::Symbol) --> (old, cmp)
Julia 1.7

This function requires Julia 1.7 or later.

See unsafe_replace!.

source
Core.get_binding_typeFunction
Core.get_binding_type(module::Module, name::Symbol)

Retrieve the declared type of the binding name from the module module.

Julia 1.9

This function requires Julia 1.9 or later.

source
Core.IntrinsicFunctionType
Core.IntrinsicFunction <: Core.Builtin <: Function

The Core.IntrinsicFunction function define some basic primitives for what defines the abilities and behaviors of a Julia program

source
Core.IntrinsicsModule
Core.Intrinsics

The Core.Intrinsics module holds the Core.IntrinsicFunction objects.

source
Core.IRModule
Core.IR

The Core.IR module exports the IR object model.

source
diff --git a/en/v1.12-dev/devdocs/callconv/index.html b/en/v1.12-dev/devdocs/callconv/index.html index 52461e71d49..d9642827118 100644 --- a/en/v1.12-dev/devdocs/callconv/index.html +++ b/en/v1.12-dev/devdocs/callconv/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Calling Conventions

Julia uses three calling conventions for four distinct purposes:

NamePrefixPurpose
Nativejulia_Speed via specialized signatures
JL Calljlcall_Wrapper for generic calls
JL Calljl_Builtins
C ABIjlcapi_Wrapper callable from C

Julia Native Calling Convention

The native calling convention is designed for fast non-generic calls. It usually uses a specialized signature.

  • LLVM ghosts (zero-length types) are omitted.
  • LLVM scalars and vectors are passed by value.
  • LLVM aggregates (arrays and structs) are passed by reference.

A small return values is returned as LLVM return values. A large return values is returned via the "structure return" (sret) convention, where the caller provides a pointer to a return slot.

An argument or return values that is a homogeneous tuple is sometimes represented as an LLVM vector instead of an LLVM array.

JL Call Convention

The JL Call convention is for builtins and generic dispatch. Hand-written functions using this convention are declared via the macro JL_CALLABLE. The convention uses exactly 3 parameters:

  • F - Julia representation of function that is being applied
  • args - pointer to array of pointers to boxes
  • nargs - length of the array

The return value is a pointer to a box.

C ABI

C ABI wrappers enable calling Julia from C. The wrapper calls a function using the native calling convention.

Tuples are always represented as C arrays.

+

Calling Conventions

Julia uses three calling conventions for four distinct purposes:

NamePrefixPurpose
Nativejulia_Speed via specialized signatures
JL Calljlcall_Wrapper for generic calls
JL Calljl_Builtins
C ABIjlcapi_Wrapper callable from C

Julia Native Calling Convention

The native calling convention is designed for fast non-generic calls. It usually uses a specialized signature.

  • LLVM ghosts (zero-length types) are omitted.
  • LLVM scalars and vectors are passed by value.
  • LLVM aggregates (arrays and structs) are passed by reference.

A small return values is returned as LLVM return values. A large return values is returned via the "structure return" (sret) convention, where the caller provides a pointer to a return slot.

An argument or return values that is a homogeneous tuple is sometimes represented as an LLVM vector instead of an LLVM array.

JL Call Convention

The JL Call convention is for builtins and generic dispatch. Hand-written functions using this convention are declared via the macro JL_CALLABLE. The convention uses exactly 3 parameters:

  • F - Julia representation of function that is being applied
  • args - pointer to array of pointers to boxes
  • nargs - length of the array

The return value is a pointer to a box.

C ABI

C ABI wrappers enable calling Julia from C. The wrapper calls a function using the native calling convention.

Tuples are always represented as C arrays.

diff --git a/en/v1.12-dev/devdocs/cartesian/index.html b/en/v1.12-dev/devdocs/cartesian/index.html index e23acfc56e2..9005c70e572 100644 --- a/en/v1.12-dev/devdocs/cartesian/index.html +++ b/en/v1.12-dev/devdocs/cartesian/index.html @@ -35,17 +35,17 @@ j_1 = min(i_1, 5) s += A[j_1, j_2] end -end

If you want just a post-expression, supply nothing for the pre-expression. Using parentheses and semicolons, you can supply multi-statement expressions.

source
Base.Cartesian.@nrefMacro
@nref N A indexexpr

Generate expressions like A[i_1, i_2, ...]. indexexpr can either be an iteration-symbol prefix, or an anonymous-function expression.

Examples

julia> @macroexpand Base.Cartesian.@nref 3 A i
-:(A[i_1, i_2, i_3])
source
Base.Cartesian.@nextractMacro
@nextract N esym isym

Generate N variables esym_1, esym_2, ..., esym_N to extract values from isym. isym can be either a Symbol or anonymous-function expression.

@nextract 2 x y would generate

x_1 = y[1]
+end

If you want just a post-expression, supply nothing for the pre-expression. Using parentheses and semicolons, you can supply multi-statement expressions.

source
Base.Cartesian.@nrefMacro
@nref N A indexexpr

Generate expressions like A[i_1, i_2, ...]. indexexpr can either be an iteration-symbol prefix, or an anonymous-function expression.

Examples

julia> @macroexpand Base.Cartesian.@nref 3 A i
+:(A[i_1, i_2, i_3])
source
Base.Cartesian.@nextractMacro
@nextract N esym isym

Generate N variables esym_1, esym_2, ..., esym_N to extract values from isym. isym can be either a Symbol or anonymous-function expression.

@nextract 2 x y would generate

x_1 = y[1]
 x_2 = y[2]

while @nextract 3 x d->y[2d-1] yields

x_1 = y[1]
 x_2 = y[3]
-x_3 = y[5]
source
Base.Cartesian.@nexprsMacro
@nexprs N expr

Generate N expressions. expr should be an anonymous-function expression.

Examples

julia> @macroexpand Base.Cartesian.@nexprs 4 i -> y[i] = A[i+j]
+x_3 = y[5]
source
Base.Cartesian.@nexprsMacro
@nexprs N expr

Generate N expressions. expr should be an anonymous-function expression.

Examples

julia> @macroexpand Base.Cartesian.@nexprs 4 i -> y[i] = A[i+j]
 quote
     y[1] = A[1 + j]
     y[2] = A[2 + j]
     y[3] = A[3 + j]
     y[4] = A[4 + j]
-end
source
Base.Cartesian.@ncallMacro
@ncall N f sym...

Generate a function call expression. sym represents any number of function arguments, the last of which may be an anonymous-function expression and is expanded into N arguments.

For example, @ncall 3 func a generates

func(a_1, a_2, a_3)

while @ncall 2 func a b i->c[i] yields

func(a, b, c[1], c[2])
source
Base.Cartesian.@ncallkwMacro
@ncallkw N f kw sym...

Generate a function call expression with keyword arguments kw.... As in the case of @ncall, sym represents any number of function arguments, the last of which may be an anonymous-function expression and is expanded into N arguments.

Examples

julia> using Base.Cartesian
+end
source
Base.Cartesian.@ncallMacro
@ncall N f sym...

Generate a function call expression. sym represents any number of function arguments, the last of which may be an anonymous-function expression and is expanded into N arguments.

For example, @ncall 3 func a generates

func(a_1, a_2, a_3)

while @ncall 2 func a b i->c[i] yields

func(a, b, c[1], c[2])
source
Base.Cartesian.@ncallkwMacro
@ncallkw N f kw sym...

Generate a function call expression with keyword arguments kw.... As in the case of @ncall, sym represents any number of function arguments, the last of which may be an anonymous-function expression and is expanded into N arguments.

Examples

julia> using Base.Cartesian
 
 julia> f(x...; a, b = 1, c = 2, d = 3) = +(x..., a, b, c, d);
 
@@ -53,11 +53,11 @@
 
 julia> @ncallkw 2 f (; a = 0, b, kw...) x
 -3
-
source
Base.Cartesian.@ntupleMacro
@ntuple N expr

Generates an N-tuple. @ntuple 2 i would generate (i_1, i_2), and @ntuple 2 k->k+1 would generate (2,3).

source
Base.Cartesian.@nallMacro
@nall N expr

Check whether all of the expressions generated by the anonymous-function expression expr evaluate to true.

@nall 3 d->(i_d > 1) would generate the expression (i_1 > 1 && i_2 > 1 && i_3 > 1). This can be convenient for bounds-checking.

source
Base.Cartesian.@nanyMacro
@nany N expr

Check whether any of the expressions generated by the anonymous-function expression expr evaluate to true.

@nany 3 d->(i_d > 1) would generate the expression (i_1 > 1 || i_2 > 1 || i_3 > 1).

source
Base.Cartesian.@nifMacro
@nif N conditionexpr expr
+
source
Base.Cartesian.@ntupleMacro
@ntuple N expr

Generates an N-tuple. @ntuple 2 i would generate (i_1, i_2), and @ntuple 2 k->k+1 would generate (2,3).

source
Base.Cartesian.@nallMacro
@nall N expr

Check whether all of the expressions generated by the anonymous-function expression expr evaluate to true.

@nall 3 d->(i_d > 1) would generate the expression (i_1 > 1 && i_2 > 1 && i_3 > 1). This can be convenient for bounds-checking.

source
Base.Cartesian.@nanyMacro
@nany N expr

Check whether any of the expressions generated by the anonymous-function expression expr evaluate to true.

@nany 3 d->(i_d > 1) would generate the expression (i_1 > 1 || i_2 > 1 || i_3 > 1).

source
Base.Cartesian.@nifMacro
@nif N conditionexpr expr
 @nif N conditionexpr expr elseexpr

Generates a sequence of if ... elseif ... else ... end statements. For example:

@nif 3 d->(i_d >= size(A,d)) d->(error("Dimension ", d, " too big")) d->println("All OK")

would generate:

if i_1 > size(A, 1)
     error("Dimension ", 1, " too big")
 elseif i_2 > size(A, 2)
     error("Dimension ", 2, " too big")
 else
     println("All OK")
-end
source
+endsource diff --git a/en/v1.12-dev/devdocs/compiler/index.html b/en/v1.12-dev/devdocs/compiler/index.html index 3138f0b8e89..0b8bcdb99a9 100644 --- a/en/v1.12-dev/devdocs/compiler/index.html +++ b/en/v1.12-dev/devdocs/compiler/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

High-level Overview of the Native-Code Generation Process

Representation of Pointers

When emitting code to an object file, pointers will be emitted as relocations. The deserialization code will ensure any object that pointed to one of these constants gets recreated and contains the right runtime pointer.

Otherwise, they will be emitted as literal constants.

To emit one of these objects, call literal_pointer_val. It'll handle tracking the Julia value and the LLVM global, ensuring they are valid both for the current runtime and after deserialization.

When emitted into the object file, these globals are stored as references in a large gvals table. This allows the deserializer to reference them by index, and implement a custom manual mechanism similar to a Global Offset Table (GOT) to restore them.

Function pointers are handled similarly. They are stored as values in a large fvals table. Like globals, this allows the deserializer to reference them by index.

Note that extern functions are handled separately, with names, via the usual symbol resolution mechanism in the linker.

Note too that ccall functions are also handled separately, via a manual GOT and Procedure Linkage Table (PLT).

Representation of Intermediate Values

Values are passed around in a jl_cgval_t struct. This represents an R-value, and includes enough information to determine how to assign or pass it somewhere.

They are created via one of the helper constructors, usually: mark_julia_type (for immediate values) and mark_julia_slot (for pointers to values).

The function convert_julia_type can transform between any two types. It returns an R-value with cgval.typ set to typ. It'll cast the object to the requested representation, making heap boxes, allocating stack copies, and computing tagged unions as needed to change the representation.

By contrast update_julia_type will change cgval.typ to typ, only if it can be done at zero-cost (i.e. without emitting any code).

Union representation

Inferred union types may be stack allocated via a tagged type representation.

The primitive routines that need to be able to handle tagged unions are:

  • mark-type
  • load-local
  • store-local
  • isa
  • is
  • emit_typeof
  • emit_sizeof
  • boxed
  • unbox
  • specialized cc-ret

Everything else should be possible to handle in inference by using these primitives to implement union-splitting.

The representation of the tagged-union is as a pair of < void* union, byte selector >. The selector is fixed-size as byte & 0x7f, and will union-tag the first 126 isbits. It records the one-based depth-first count into the type-union of the isbits objects inside. An index of zero indicates that the union* is actually a tagged heap-allocated jl_value_t*, and needs to be treated as normal for a boxed object rather than as a tagged union.

The high bit of the selector (byte & 0x80) can be tested to determine if the void* is actually a heap-allocated (jl_value_t*) box, thus avoiding the cost of re-allocating a box, while maintaining the ability to efficiently handle union-splitting based on the low bits.

It is guaranteed that byte & 0x7f is an exact test for the type, if the value can be represented by a tag – it will never be marked byte = 0x80. It is not necessary to also test the type-tag when testing isa.

The union* memory region may be allocated at any size. The only constraint is that it is big enough to contain the data currently specified by selector. It might not be big enough to contain the union of all types that could be stored there according to the associated Union type field. Use appropriate care when copying.

Specialized Calling Convention Signature Representation

A jl_returninfo_t object describes the specialized calling convention details of any callable. It can be generated from any (specTypes, rettype) pair, such as a CodeInstance, or other place they are declared. This is the expected calling convention for specptr, but other data may be stored there. Only if the function pointer stored there has the expected specialized calling convention will the corresponding flag be set in specsigflags to indicate it is useable.

If any of the arguments or return type of a method can be represented unboxed, and none are unable to be represented unboxed (such as an unbounded vararg), it will be given an optimized calling convention signature based on the specTypes and rettype values.

The general principles are that:

  • Primitive types get passed in int/float registers.
  • Tuples of VecElement types get passed in vector registers.
  • Structs get passed on the stack.
  • Return values are handle similarly to arguments, with a size-cutoff at which they will instead be returned via a hidden sret argument.

The total logic for this is implemented by get_specsig_function and deserves_sret.

Additionally, if the return type is a union, it may be returned as a pair of values (a pointer and a tag). If the union values can be stack-allocated, then sufficient space to store them will also be passed as a hidden first argument. If the struct to return needs gc roots, space for those will be passed as a hidden second argument. It is up to the callee whether the returned pointer will point to this space, a boxed object, or even other constant memory.

+

High-level Overview of the Native-Code Generation Process

Representation of Pointers

When emitting code to an object file, pointers will be emitted as relocations. The deserialization code will ensure any object that pointed to one of these constants gets recreated and contains the right runtime pointer.

Otherwise, they will be emitted as literal constants.

To emit one of these objects, call literal_pointer_val. It'll handle tracking the Julia value and the LLVM global, ensuring they are valid both for the current runtime and after deserialization.

When emitted into the object file, these globals are stored as references in a large gvals table. This allows the deserializer to reference them by index, and implement a custom manual mechanism similar to a Global Offset Table (GOT) to restore them.

Function pointers are handled similarly. They are stored as values in a large fvals table. Like globals, this allows the deserializer to reference them by index.

Note that extern functions are handled separately, with names, via the usual symbol resolution mechanism in the linker.

Note too that ccall functions are also handled separately, via a manual GOT and Procedure Linkage Table (PLT).

Representation of Intermediate Values

Values are passed around in a jl_cgval_t struct. This represents an R-value, and includes enough information to determine how to assign or pass it somewhere.

They are created via one of the helper constructors, usually: mark_julia_type (for immediate values) and mark_julia_slot (for pointers to values).

The function convert_julia_type can transform between any two types. It returns an R-value with cgval.typ set to typ. It'll cast the object to the requested representation, making heap boxes, allocating stack copies, and computing tagged unions as needed to change the representation.

By contrast update_julia_type will change cgval.typ to typ, only if it can be done at zero-cost (i.e. without emitting any code).

Union representation

Inferred union types may be stack allocated via a tagged type representation.

The primitive routines that need to be able to handle tagged unions are:

  • mark-type
  • load-local
  • store-local
  • isa
  • is
  • emit_typeof
  • emit_sizeof
  • boxed
  • unbox
  • specialized cc-ret

Everything else should be possible to handle in inference by using these primitives to implement union-splitting.

The representation of the tagged-union is as a pair of < void* union, byte selector >. The selector is fixed-size as byte & 0x7f, and will union-tag the first 126 isbits. It records the one-based depth-first count into the type-union of the isbits objects inside. An index of zero indicates that the union* is actually a tagged heap-allocated jl_value_t*, and needs to be treated as normal for a boxed object rather than as a tagged union.

The high bit of the selector (byte & 0x80) can be tested to determine if the void* is actually a heap-allocated (jl_value_t*) box, thus avoiding the cost of re-allocating a box, while maintaining the ability to efficiently handle union-splitting based on the low bits.

It is guaranteed that byte & 0x7f is an exact test for the type, if the value can be represented by a tag – it will never be marked byte = 0x80. It is not necessary to also test the type-tag when testing isa.

The union* memory region may be allocated at any size. The only constraint is that it is big enough to contain the data currently specified by selector. It might not be big enough to contain the union of all types that could be stored there according to the associated Union type field. Use appropriate care when copying.

Specialized Calling Convention Signature Representation

A jl_returninfo_t object describes the specialized calling convention details of any callable. It can be generated from any (specTypes, rettype) pair, such as a CodeInstance, or other place they are declared. This is the expected calling convention for specptr, but other data may be stored there. Only if the function pointer stored there has the expected specialized calling convention will the corresponding flag be set in specsigflags to indicate it is useable.

If any of the arguments or return type of a method can be represented unboxed, and none are unable to be represented unboxed (such as an unbounded vararg), it will be given an optimized calling convention signature based on the specTypes and rettype values.

The general principles are that:

  • Primitive types get passed in int/float registers.
  • Tuples of VecElement types get passed in vector registers.
  • Structs get passed on the stack.
  • Return values are handle similarly to arguments, with a size-cutoff at which they will instead be returned via a hidden sret argument.

The total logic for this is implemented by get_specsig_function and deserves_sret.

Additionally, if the return type is a union, it may be returned as a pair of values (a pointer and a tag). If the union values can be stack-allocated, then sufficient space to store them will also be passed as a hidden first argument. If the struct to return needs gc roots, space for those will be passed as a hidden second argument. It is up to the callee whether the returned pointer will point to this space, a boxed object, or even other constant memory.

diff --git a/en/v1.12-dev/devdocs/debuggingtips/index.html b/en/v1.12-dev/devdocs/debuggingtips/index.html index a144c122168..991784d650f 100644 --- a/en/v1.12-dev/devdocs/debuggingtips/index.html +++ b/en/v1.12-dev/devdocs/debuggingtips/index.html @@ -29,4 +29,4 @@ Expr(:return, Expr(:call, :box, :Float32, Expr(:call, :fptrunc, :Float32, :x)::Any)::Any)::Any)::Any)::Any

Finally, and perhaps most usefully, we can force the function to be recompiled in order to step through the codegen process. To do this, clear the cached functionObject from the jl_lamdbda_info_t*:

(gdb) p f->linfo->functionObject
 $8 = (void *) 0x1289d070
 (gdb) set f->linfo->functionObject = NULL

Then, set a breakpoint somewhere useful (e.g. emit_function, emit_expr, emit_call, etc.), and run codegen:

(gdb) p jl_compile(f)
-... # your breakpoint here

Debugging precompilation errors

Module precompilation spawns a separate Julia process to precompile each module. Setting a breakpoint or catching failures in a precompile worker requires attaching a debugger to the worker. The easiest approach is to set the debugger watch for new process launches matching a given name. For example:

(gdb) attach -w -n julia-debug

or:

(lldb) process attach -w -n julia-debug

Then run a script/command to start precompilation. As described earlier, use conditional breakpoints in the parent process to catch specific file-loading events and narrow the debugging window. (some operating systems may require alternative approaches, such as following each fork from the parent process)

Mozilla's Record and Replay Framework (rr)

Julia now works out of the box with rr, the lightweight recording and deterministic debugging framework from Mozilla. This allows you to replay the trace of an execution deterministically. The replayed execution's address spaces, register contents, syscall data etc are exactly the same in every run.

A recent version of rr (3.1.0 or higher) is required.

Reproducing concurrency bugs with rr

rr simulates a single-threaded machine by default. In order to debug concurrent code you can use rr record --chaos which will cause rr to simulate between one to eight cores, chosen randomly. You might therefore want to set JULIA_NUM_THREADS=8 and rerun your code under rr until you have caught your bug.

+... # your breakpoint here

Debugging precompilation errors

Module precompilation spawns a separate Julia process to precompile each module. Setting a breakpoint or catching failures in a precompile worker requires attaching a debugger to the worker. The easiest approach is to set the debugger watch for new process launches matching a given name. For example:

(gdb) attach -w -n julia-debug

or:

(lldb) process attach -w -n julia-debug

Then run a script/command to start precompilation. As described earlier, use conditional breakpoints in the parent process to catch specific file-loading events and narrow the debugging window. (some operating systems may require alternative approaches, such as following each fork from the parent process)

Mozilla's Record and Replay Framework (rr)

Julia now works out of the box with rr, the lightweight recording and deterministic debugging framework from Mozilla. This allows you to replay the trace of an execution deterministically. The replayed execution's address spaces, register contents, syscall data etc are exactly the same in every run.

A recent version of rr (3.1.0 or higher) is required.

Reproducing concurrency bugs with rr

rr simulates a single-threaded machine by default. In order to debug concurrent code you can use rr record --chaos which will cause rr to simulate between one to eight cores, chosen randomly. You might therefore want to set JULIA_NUM_THREADS=8 and rerun your code under rr until you have caught your bug.

diff --git a/en/v1.12-dev/devdocs/eval/index.html b/en/v1.12-dev/devdocs/eval/index.html index bd4d814fa48..58bfee2a293 100644 --- a/en/v1.12-dev/devdocs/eval/index.html +++ b/en/v1.12-dev/devdocs/eval/index.html @@ -6,4 +6,4 @@

Eval of Julia code

One of the hardest parts about learning how the Julia Language runs code is learning how all of the pieces work together to execute a block of code.

Each chunk of code typically makes a trip through many steps with potentially unfamiliar names, such as (in no particular order): flisp, AST, C++, LLVM, eval, typeinf, macroexpand, sysimg (or system image), bootstrapping, compile, parse, execute, JIT, interpret, box, unbox, intrinsic function, and primitive function, before turning into the desired result (hopefully).

Definitions
  • REPL

    REPL stands for Read-Eval-Print Loop. It's just what we call the command line environment for short.

  • AST

    Abstract Syntax Tree The AST is the digital representation of the code structure. In this form the code has been tokenized for meaning so that it is more suitable for manipulation and execution.

Diagram of the compiler flow

Julia Execution

The 10,000 foot view of the whole process is as follows:

  1. The user starts julia.
  2. The C function main() from cli/loader_exe.c gets called. This function processes the command line arguments, filling in the jl_options struct and setting the variable ARGS. It then initializes Julia (by calling julia_init in init.c, which may load a previously compiled sysimg). Finally, it passes off control to Julia by calling Base._start().
  3. When _start() takes over control, the subsequent sequence of commands depends on the command line arguments given. For example, if a filename was supplied, it will proceed to execute that file. Otherwise, it will start an interactive REPL.
  4. Skipping the details about how the REPL interacts with the user, let's just say the program ends up with a block of code that it wants to run.
  5. If the block of code to run is in a file, jl_load(char *filename) gets invoked to load the file and parse it. Each fragment of code is then passed to eval to execute.
  6. Each fragment of code (or AST), is handed off to eval() to turn into results.
  7. eval() takes each code fragment and tries to run it in jl_toplevel_eval_flex().
  8. jl_toplevel_eval_flex() decides whether the code is a "toplevel" action (such as using or module), which would be invalid inside a function. If so, it passes off the code to the toplevel interpreter.
  9. jl_toplevel_eval_flex() then expands the code to eliminate any macros and to "lower" the AST to make it simpler to execute.
  10. jl_toplevel_eval_flex() then uses some simple heuristics to decide whether to JIT compile the AST or to interpret it directly.
  11. The bulk of the work to interpret code is handled by eval in interpreter.c.
  12. If instead, the code is compiled, the bulk of the work is handled by codegen.cpp. Whenever a Julia function is called for the first time with a given set of argument types, type inference will be run on that function. This information is used by the codegen step to generate faster code.
  13. Eventually, the user quits the REPL, or the end of the program is reached, and the _start() method returns.
  14. Just before exiting, main() calls jl_atexit_hook(exit_code). This calls Base._atexit() (which calls any functions registered to atexit() inside Julia). Then it calls jl_gc_run_all_finalizers(). Finally, it gracefully cleans up all libuv handles and waits for them to flush and close.

Parsing

The Julia parser is a small lisp program written in femtolisp, the source-code for which is distributed inside Julia in src/flisp.

The interface functions for this are primarily defined in jlfrontend.scm. The code in ast.c handles this handoff on the Julia side.

The other relevant files at this stage are julia-parser.scm, which handles tokenizing Julia code and turning it into an AST, and julia-syntax.scm, which handles transforming complex AST representations into simpler, "lowered" AST representations which are more suitable for analysis and execution.

If you want to test the parser without re-building Julia in its entirety, you can run the frontend on its own as follows:

$ cd src
 $ flisp/flisp
 > (load "jlfrontend.scm")
-> (jl-parse-file "<filename>")

Macro Expansion

When eval() encounters a macro, it expands that AST node before attempting to evaluate the expression. Macro expansion involves a handoff from eval() (in Julia), to the parser function jl_macroexpand() (written in flisp) to the Julia macro itself (written in - what else - Julia) via fl_invoke_julia_macro(), and back.

Typically, macro expansion is invoked as a first step during a call to Meta.lower()/jl_expand(), although it can also be invoked directly by a call to macroexpand()/jl_macroexpand().

Type Inference

Type inference is implemented in Julia by typeinf() in compiler/typeinfer.jl. Type inference is the process of examining a Julia function and determining bounds for the types of each of its variables, as well as bounds on the type of the return value from the function. This enables many future optimizations, such as unboxing of known immutable values, and compile-time hoisting of various run-time operations such as computing field offsets and function pointers. Type inference may also include other steps such as constant propagation and inlining.

More Definitions
  • JIT

    Just-In-Time Compilation The process of generating native-machine code into memory right when it is needed.

  • LLVM

    Low-Level Virtual Machine (a compiler) The Julia JIT compiler is a program/library called libLLVM. Codegen in Julia refers both to the process of taking a Julia AST and turning it into LLVM instructions, and the process of LLVM optimizing that and turning it into native assembly instructions.

  • C++

    The programming language that LLVM is implemented in, which means that codegen is also implemented in this language. The rest of Julia's library is implemented in C, in part because its smaller feature set makes it more usable as a cross-language interface layer.

  • box

    This term is used to describe the process of taking a value and allocating a wrapper around the data that is tracked by the garbage collector (gc) and is tagged with the object's type.

  • unbox

    The reverse of boxing a value. This operation enables more efficient manipulation of data when the type of that data is fully known at compile-time (through type inference).

  • generic function

    A Julia function composed of multiple "methods" that are selected for dynamic dispatch based on the argument type-signature

  • anonymous function or "method"

    A Julia function without a name and without type-dispatch capabilities

  • primitive function

    A function implemented in C but exposed in Julia as a named function "method" (albeit without generic function dispatch capabilities, similar to a anonymous function)

  • intrinsic function

    A low-level operation exposed as a function in Julia. These pseudo-functions implement operations on raw bits such as add and sign extend that cannot be expressed directly in any other way. Since they operate on bits directly, they must be compiled into a function and surrounded by a call to Core.Intrinsics.box(T, ...) to reassign type information to the value.

JIT Code Generation

Codegen is the process of turning a Julia AST into native machine code.

The JIT environment is initialized by an early call to jl_init_codegen in codegen.cpp.

On demand, a Julia method is converted into a native function by the function emit_function(jl_method_instance_t*). (note, when using the MCJIT (in LLVM v3.4+), each function must be JIT into a new module.) This function recursively calls emit_expr() until the entire function has been emitted.

Much of the remaining bulk of this file is devoted to various manual optimizations of specific code patterns. For example, emit_known_call() knows how to inline many of the primitive functions (defined in builtins.c) for various combinations of argument types.

Other parts of codegen are handled by various helper files:

  • debuginfo.cpp

    Handles backtraces for JIT functions

  • ccall.cpp

    Handles the ccall and llvmcall FFI, along with various abi_*.cpp files

  • intrinsics.cpp

    Handles the emission of various low-level intrinsic functions

Bootstrapping

The process of creating a new system image is called "bootstrapping".

The etymology of this word comes from the phrase "pulling oneself up by the bootstraps", and refers to the idea of starting from a very limited set of available functions and definitions and ending with the creation of a full-featured environment.

System Image

The system image is a precompiled archive of a set of Julia files. The sys.ji file distributed with Julia is one such system image, generated by executing the file sysimg.jl, and serializing the resulting environment (including Types, Functions, Modules, and all other defined values) into a file. Therefore, it contains a frozen version of the Main, Core, and Base modules (and whatever else was in the environment at the end of bootstrapping). This serializer/deserializer is implemented by jl_save_system_image/jl_restore_system_image in staticdata.c.

If there is no sysimg file (jl_options.image_file == NULL), this also implies that --build was given on the command line, so the final result should be a new sysimg file. During Julia initialization, minimal Core and Main modules are created. Then a file named boot.jl is evaluated from the current directory. Julia then evaluates any file given as a command line argument until it reaches the end. Finally, it saves the resulting environment to a "sysimg" file for use as a starting point for a future Julia run.

+> (jl-parse-file "<filename>")

Macro Expansion

When eval() encounters a macro, it expands that AST node before attempting to evaluate the expression. Macro expansion involves a handoff from eval() (in Julia), to the parser function jl_macroexpand() (written in flisp) to the Julia macro itself (written in - what else - Julia) via fl_invoke_julia_macro(), and back.

Typically, macro expansion is invoked as a first step during a call to Meta.lower()/jl_expand(), although it can also be invoked directly by a call to macroexpand()/jl_macroexpand().

Type Inference

Type inference is implemented in Julia by typeinf() in compiler/typeinfer.jl. Type inference is the process of examining a Julia function and determining bounds for the types of each of its variables, as well as bounds on the type of the return value from the function. This enables many future optimizations, such as unboxing of known immutable values, and compile-time hoisting of various run-time operations such as computing field offsets and function pointers. Type inference may also include other steps such as constant propagation and inlining.

More Definitions

JIT Code Generation

Codegen is the process of turning a Julia AST into native machine code.

The JIT environment is initialized by an early call to jl_init_codegen in codegen.cpp.

On demand, a Julia method is converted into a native function by the function emit_function(jl_method_instance_t*). (note, when using the MCJIT (in LLVM v3.4+), each function must be JIT into a new module.) This function recursively calls emit_expr() until the entire function has been emitted.

Much of the remaining bulk of this file is devoted to various manual optimizations of specific code patterns. For example, emit_known_call() knows how to inline many of the primitive functions (defined in builtins.c) for various combinations of argument types.

Other parts of codegen are handled by various helper files:

Bootstrapping

The process of creating a new system image is called "bootstrapping".

The etymology of this word comes from the phrase "pulling oneself up by the bootstraps", and refers to the idea of starting from a very limited set of available functions and definitions and ending with the creation of a full-featured environment.

System Image

The system image is a precompiled archive of a set of Julia files. The sys.ji file distributed with Julia is one such system image, generated by executing the file sysimg.jl, and serializing the resulting environment (including Types, Functions, Modules, and all other defined values) into a file. Therefore, it contains a frozen version of the Main, Core, and Base modules (and whatever else was in the environment at the end of bootstrapping). This serializer/deserializer is implemented by jl_save_system_image/jl_restore_system_image in staticdata.c.

If there is no sysimg file (jl_options.image_file == NULL), this also implies that --build was given on the command line, so the final result should be a new sysimg file. During Julia initialization, minimal Core and Main modules are created. Then a file named boot.jl is evaluated from the current directory. Julia then evaluates any file given as a command line argument until it reaches the end. Finally, it saves the resulting environment to a "sysimg" file for use as a starting point for a future Julia run.

diff --git a/en/v1.12-dev/devdocs/external_profilers/index.html b/en/v1.12-dev/devdocs/external_profilers/index.html index a2fb79f1d4a..f8b1b8fbc0c 100644 --- a/en/v1.12-dev/devdocs/external_profilers/index.html +++ b/en/v1.12-dev/devdocs/external_profilers/index.html @@ -8,4 +8,4 @@ Base.compilecache(pkg) end

Here, we use a custom port for tracy which makes it easier to find the correct client in the Tracy UI to connect to.

Adding metadata to zones

The various jl_timing_show_* and jl_timing_printf functions can be used to attach a string (or strings) to a zone. For example, the trace zone for inference shows the method instance that is being inferred.

The TracyCZoneColor function can be used to set the color of a certain zone. Search through the codebase to see how it is used.

Viewing Tracy files in your browser

Visit https://topolarity.github.io/trace-viewer/ for an (experimental) web viewer for Tracy traces.

You can open a local .tracy file or provide a URL from the web (e.g. a file in a Github repo). If you load a trace file from the web, you can also share the page URL directly with others, enabling them to view the same trace.

Enabling stack trace samples

To enable call stack sampling in Tracy, build Julia with these options in your Make.user file:

WITH_TRACY := 1
 WITH_TRACY_CALLSTACKS := 1
-USE_BINARYBUILDER_LIBTRACYCLIENT := 0

You may also need to run make -C deps clean-libtracyclient to force a re-build of Tracy.

This feature has a significant impact on trace size and profiling overhead, so it is recommended to leave call stack sampling off when possible, especially if you intend to share your trace files online.

Note that the Julia JIT runtime does not yet have integration for Tracy's symbolification, so Julia functions will typically be unknown in these stack traces.

Intel VTune (ITTAPI) Profiler

This section is yet to be written.

+USE_BINARYBUILDER_LIBTRACYCLIENT := 0

You may also need to run make -C deps clean-libtracyclient to force a re-build of Tracy.

This feature has a significant impact on trace size and profiling overhead, so it is recommended to leave call stack sampling off when possible, especially if you intend to share your trace files online.

Note that the Julia JIT runtime does not yet have integration for Tracy's symbolification, so Julia functions will typically be unknown in these stack traces.

Intel VTune (ITTAPI) Profiler

This section is yet to be written.

diff --git a/en/v1.12-dev/devdocs/functions/index.html b/en/v1.12-dev/devdocs/functions/index.html index a01014d488f..2d736918288 100644 --- a/en/v1.12-dev/devdocs/functions/index.html +++ b/en/v1.12-dev/devdocs/functions/index.html @@ -43,4 +43,4 @@ # unless `options` is empty #circle#1(color, fill, pairs(options), circle, center, radius) -end

The function Core.kwftype(t) creates the field t.name.mt.kwsorter (if it hasn't been created yet), and returns the type of that function.

This design has the feature that call sites that don't use keyword arguments require no special handling; everything works as if they were not part of the language at all. Call sites that do use keyword arguments are dispatched directly to the called function's kwsorter. For example the call:

circle((0, 0), 1.0, color = red; other...)

is lowered to:

kwcall(merge((color = red,), other), circle, (0, 0), 1.0)

kwcall (also inCore) denotes a kwcall signature and dispatch. The keyword splatting operation (written as other...) calls the named tuple merge function. This function further unpacks each element of other, expecting each one to contain two values (a symbol and a value). Naturally, a more efficient implementation is available if all splatted arguments are named tuples. Notice that the original circle function is passed through, to handle closures.

Compiler efficiency issues

Generating a new type for every function has potentially serious consequences for compiler resource use when combined with Julia's "specialize on all arguments by default" design. Indeed, the initial implementation of this design suffered from much longer build and test times, higher memory use, and a system image nearly 2x larger than the baseline. In a naive implementation, the problem is bad enough to make the system nearly unusable. Several significant optimizations were needed to make the design practical.

The first issue is excessive specialization of functions for different values of function-valued arguments. Many functions simply "pass through" an argument to somewhere else, e.g. to another function or to a storage location. Such functions do not need to be specialized for every closure that might be passed in. Fortunately this case is easy to distinguish by simply considering whether a function calls one of its arguments (i.e. the argument appears in "head position" somewhere). Performance-critical higher-order functions like map certainly call their argument function and so will still be specialized as expected. This optimization is implemented by recording which arguments are called during the analyze-variables pass in the front end. When cache_method sees an argument in the Function type hierarchy passed to a slot declared as Any or Function, it behaves as if the @nospecialize annotation were applied. This heuristic seems to be extremely effective in practice.

The next issue concerns the structure of method cache hash tables. Empirical studies show that the vast majority of dynamically-dispatched calls involve one or two arguments. In turn, many of these cases can be resolved by considering only the first argument. (Aside: proponents of single dispatch would not be surprised by this at all. However, this argument means "multiple dispatch is easy to optimize in practice", and that we should therefore use it, not "we should use single dispatch"!) So the method cache uses the type of the first argument as its primary key. Note, however, that this corresponds to the second element of the tuple type for a function call (the first element being the type of the function itself). Typically, type variation in head position is extremely low – indeed, the majority of functions belong to singleton types with no parameters. However, this is not the case for constructors, where a single method table holds constructors for every type. Therefore the Type method table is special-cased to use the first tuple type element instead of the second.

The front end generates type declarations for all closures. Initially, this was implemented by generating normal type declarations. However, this produced an extremely large number of constructors, all of which were trivial (simply passing all arguments through to new). Since methods are partially ordered, inserting all of these methods is O(n²), plus there are just too many of them to keep around. This was optimized by generating struct_type expressions directly (bypassing default constructor generation), and using new directly to create closure instances. Not the prettiest thing ever, but you do what you gotta do.

The next problem was the @test macro, which generated a 0-argument closure for each test case. This is not really necessary, since each test case is simply run once in place. Therefore, @test was modified to expand to a try-catch block that records the test result (true, false, or exception raised) and calls the test suite handler on it.

+end

The function Core.kwftype(t) creates the field t.name.mt.kwsorter (if it hasn't been created yet), and returns the type of that function.

This design has the feature that call sites that don't use keyword arguments require no special handling; everything works as if they were not part of the language at all. Call sites that do use keyword arguments are dispatched directly to the called function's kwsorter. For example the call:

circle((0, 0), 1.0, color = red; other...)

is lowered to:

kwcall(merge((color = red,), other), circle, (0, 0), 1.0)

kwcall (also inCore) denotes a kwcall signature and dispatch. The keyword splatting operation (written as other...) calls the named tuple merge function. This function further unpacks each element of other, expecting each one to contain two values (a symbol and a value). Naturally, a more efficient implementation is available if all splatted arguments are named tuples. Notice that the original circle function is passed through, to handle closures.

Compiler efficiency issues

Generating a new type for every function has potentially serious consequences for compiler resource use when combined with Julia's "specialize on all arguments by default" design. Indeed, the initial implementation of this design suffered from much longer build and test times, higher memory use, and a system image nearly 2x larger than the baseline. In a naive implementation, the problem is bad enough to make the system nearly unusable. Several significant optimizations were needed to make the design practical.

The first issue is excessive specialization of functions for different values of function-valued arguments. Many functions simply "pass through" an argument to somewhere else, e.g. to another function or to a storage location. Such functions do not need to be specialized for every closure that might be passed in. Fortunately this case is easy to distinguish by simply considering whether a function calls one of its arguments (i.e. the argument appears in "head position" somewhere). Performance-critical higher-order functions like map certainly call their argument function and so will still be specialized as expected. This optimization is implemented by recording which arguments are called during the analyze-variables pass in the front end. When cache_method sees an argument in the Function type hierarchy passed to a slot declared as Any or Function, it behaves as if the @nospecialize annotation were applied. This heuristic seems to be extremely effective in practice.

The next issue concerns the structure of method cache hash tables. Empirical studies show that the vast majority of dynamically-dispatched calls involve one or two arguments. In turn, many of these cases can be resolved by considering only the first argument. (Aside: proponents of single dispatch would not be surprised by this at all. However, this argument means "multiple dispatch is easy to optimize in practice", and that we should therefore use it, not "we should use single dispatch"!) So the method cache uses the type of the first argument as its primary key. Note, however, that this corresponds to the second element of the tuple type for a function call (the first element being the type of the function itself). Typically, type variation in head position is extremely low – indeed, the majority of functions belong to singleton types with no parameters. However, this is not the case for constructors, where a single method table holds constructors for every type. Therefore the Type method table is special-cased to use the first tuple type element instead of the second.

The front end generates type declarations for all closures. Initially, this was implemented by generating normal type declarations. However, this produced an extremely large number of constructors, all of which were trivial (simply passing all arguments through to new). Since methods are partially ordered, inserting all of these methods is O(n²), plus there are just too many of them to keep around. This was optimized by generating struct_type expressions directly (bypassing default constructor generation), and using new directly to create closure instances. Not the prettiest thing ever, but you do what you gotta do.

The next problem was the @test macro, which generated a 0-argument closure for each test case. This is not really necessary, since each test case is simply run once in place. Therefore, @test was modified to expand to a try-catch block that records the test result (true, false, or exception raised) and calls the test suite handler on it.

diff --git a/en/v1.12-dev/devdocs/gc-sa/index.html b/en/v1.12-dev/devdocs/gc-sa/index.html index bd15d0f72da..5ef4ad1011b 100644 --- a/en/v1.12-dev/devdocs/gc-sa/index.html +++ b/en/v1.12-dev/devdocs/gc-sa/index.html @@ -72,4 +72,4 @@ // that val is rooted under these conditions JL_GC_PROMISE_ROOTED(val); } -}

Completeness of analysis

The analyzer only looks at local information. In particular, e.g. in the PROPAGATES_ROOT case above, it assumes that such memory is only modified in ways it can see, not in any called functions (unless it happens to decide to consider them in its analysis) and not in any concurrently running threads. As such, it may miss a few problematic cases, though in practice such concurrent modification is fairly rare. Improving the analyzer to handle more such cases may be an interesting topic for future work.

+}

Completeness of analysis

The analyzer only looks at local information. In particular, e.g. in the PROPAGATES_ROOT case above, it assumes that such memory is only modified in ways it can see, not in any called functions (unless it happens to decide to consider them in its analysis) and not in any concurrently running threads. As such, it may miss a few problematic cases, though in practice such concurrent modification is fairly rare. Improving the analyzer to handle more such cases may be an interesting topic for future work.

diff --git a/en/v1.12-dev/devdocs/gc/index.html b/en/v1.12-dev/devdocs/gc/index.html index 5fbdc4ede7f..cb52a651ac4 100644 --- a/en/v1.12-dev/devdocs/gc/index.html +++ b/en/v1.12-dev/devdocs/gc/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Garbage Collection in Julia

Introduction

Julia has a non-moving, partially concurrent, parallel, generational and mostly precise mark-sweep collector (an interface for conservative stack scanning is provided as an option for users who wish to call Julia from C).

Allocation

Julia uses two types of allocators, the size of the allocation request determining which one is used. Objects up to 2k bytes are allocated on a per-thread free-list pool allocator, while objects larger than 2k bytes are allocated through libc malloc.

Julia’s pool allocator partitions objects on different size classes, so that a memory page managed by the pool allocator (which spans 4 operating system pages on 64bit platforms) only contains objects of the same size class. Each memory page from the pool allocator is paired with some page metadata stored on per-thread lock-free lists. The page metadata contains information such as whether the page has live objects at all, number of free slots, and offsets to the first and last objects in the free-list contained in that page. These metadata are used to optimize the collection phase: a page which has no live objects at all may be returned to the operating system without any need of scanning it, for example.

While a page that has no objects may be returned to the operating system, its associated metadata is permanently allocated and may outlive the given page. As mentioned above, metadata for allocated pages are stored on per-thread lock-free lists. Metadata for free pages, however, may be stored into three separate lock-free lists depending on whether the page has been mapped but never accessed (page_pool_clean), or whether the page has been lazily sweeped and it's waiting to be madvised by a background GC thread (page_pool_lazily_freed), or whether the page has been madvised (page_pool_freed).

Julia's pool allocator follows a "tiered" allocation discipline. When requesting a memory page for the pool allocator, Julia will:

  • Try to claim a page from page_pool_lazily_freed, which contains pages which were empty on the last stop-the-world phase, but not yet madvised by a concurrent sweeper GC thread.

  • If it failed claiming a page from page_pool_lazily_freed, it will try to claim a page from the page_pool_clean, which contains pages which were mmaped on a previous page allocation request but never accessed.

  • If it failed claiming a page from pool_page_clean and from page_pool_lazily_freed, it will try to claim a page from page_pool_freed, which contains pages which have already been madvised by a concurrent sweeper GC thread and whose underlying virtual address can be recycled.

  • If it failed in all of the attempts mentioned above, it will mmap a batch of pages, claim one page for itself, and insert the remaining pages into page_pool_clean.

Diagram of tiered pool allocation

Marking and Generational Collection

Julia’s mark phase is implemented through a parallel iterative depth-first-search over the object graph. Julia’s collector is non-moving, so object age information can’t be determined through the memory region in which the object resides alone, but has to be somehow encoded in the object header or on a side table. The lowest two bits of an object’s header are used to store, respectively, a mark bit that is set when an object is scanned during the mark phase and an age bit for the generational collection.

Generational collection is implemented through sticky bits: objects are only pushed to the mark-stack, and therefore traced, if their mark-bits are not set. When objects reach the oldest generation, their mark-bits are not reset during the so-called "quick-sweep", which leads to these objects not being traced in a subsequent mark phase. A "full-sweep", however, causes the mark-bits of all objects to be reset, leading to all objects being traced in a subsequent mark phase. Objects are promoted to the next generation during every sweep phase they survive. On the mutator side, field writes are intercepted through a write barrier that pushes an object’s address into a per-thread remembered set if the object is in the last generation, and if the object at the field being written is not. Objects in this remembered set are then traced during the mark phase.

Sweeping

Sweeping of object pools for Julia may fall into two categories: if a given page managed by the pool allocator contains at least one live object, then a free-list must be threaded through its dead objects; if a given page contains no live objects at all, then its underlying physical memory may be returned to the operating system through, for instance, the use of madvise system calls on Linux.

The first category of sweeping is parallelized through work-stealing. For the second category of sweeping, if concurrent page sweeping is enabled through the flag --gcthreads=X,1 we perform the madvise system calls in a background sweeper thread, concurrently with the mutator threads. During the stop-the-world phase of the collector, pool allocated pages which contain no live objects are initially pushed into the pool_page_lazily_freed. The background sweeping thread is then woken up and is responsible for removing pages from pool_page_lazily_freed, calling madvise on them, and inserting them into pool_page_freed. As described above, pool_page_lazily_freed is also shared with mutator threads. This implies that on allocation-heavy multithreaded workloads, mutator threads would often avoid a page fault on allocation (coming from accessing a fresh mmaped page or accessing a madvised page) by directly allocating from a page in pool_page_lazily_freed, while the background sweeper thread needs to madvise a reduce number of pages given some of them were already claimed by the mutators.

Heuristics

GC heuristics tune the GC by changing the size of the allocation interval between garbage collections.

The GC heuristics measure how big the heap size is after a collection and set the next collection according to the algorithm described by https://dl.acm.org/doi/10.1145/3563323, in summary, it argues that the heap target should have a square root relationship with the live heap, and that it should also be scaled by how fast the GC is freeing objects and how fast the mutators are allocating. The heuristics measure the heap size by counting the number of pages that are in use and the objects that use malloc. Previously we measured the heap size by counting the alive objects, but that doesn't take into account fragmentation which could lead to bad decisions, that also meant that we used thread local information (allocations) to make decisions about a process wide (when to GC), measuring pages means the decision is global.

The GC will do full collections when the heap size reaches 80% of the maximum allowed size.

+

Garbage Collection in Julia

Introduction

Julia has a non-moving, partially concurrent, parallel, generational and mostly precise mark-sweep collector (an interface for conservative stack scanning is provided as an option for users who wish to call Julia from C).

Allocation

Julia uses two types of allocators, the size of the allocation request determining which one is used. Objects up to 2k bytes are allocated on a per-thread free-list pool allocator, while objects larger than 2k bytes are allocated through libc malloc.

Julia’s pool allocator partitions objects on different size classes, so that a memory page managed by the pool allocator (which spans 4 operating system pages on 64bit platforms) only contains objects of the same size class. Each memory page from the pool allocator is paired with some page metadata stored on per-thread lock-free lists. The page metadata contains information such as whether the page has live objects at all, number of free slots, and offsets to the first and last objects in the free-list contained in that page. These metadata are used to optimize the collection phase: a page which has no live objects at all may be returned to the operating system without any need of scanning it, for example.

While a page that has no objects may be returned to the operating system, its associated metadata is permanently allocated and may outlive the given page. As mentioned above, metadata for allocated pages are stored on per-thread lock-free lists. Metadata for free pages, however, may be stored into three separate lock-free lists depending on whether the page has been mapped but never accessed (page_pool_clean), or whether the page has been lazily sweeped and it's waiting to be madvised by a background GC thread (page_pool_lazily_freed), or whether the page has been madvised (page_pool_freed).

Julia's pool allocator follows a "tiered" allocation discipline. When requesting a memory page for the pool allocator, Julia will:

  • Try to claim a page from page_pool_lazily_freed, which contains pages which were empty on the last stop-the-world phase, but not yet madvised by a concurrent sweeper GC thread.

  • If it failed claiming a page from page_pool_lazily_freed, it will try to claim a page from the page_pool_clean, which contains pages which were mmaped on a previous page allocation request but never accessed.

  • If it failed claiming a page from pool_page_clean and from page_pool_lazily_freed, it will try to claim a page from page_pool_freed, which contains pages which have already been madvised by a concurrent sweeper GC thread and whose underlying virtual address can be recycled.

  • If it failed in all of the attempts mentioned above, it will mmap a batch of pages, claim one page for itself, and insert the remaining pages into page_pool_clean.

Diagram of tiered pool allocation

Marking and Generational Collection

Julia’s mark phase is implemented through a parallel iterative depth-first-search over the object graph. Julia’s collector is non-moving, so object age information can’t be determined through the memory region in which the object resides alone, but has to be somehow encoded in the object header or on a side table. The lowest two bits of an object’s header are used to store, respectively, a mark bit that is set when an object is scanned during the mark phase and an age bit for the generational collection.

Generational collection is implemented through sticky bits: objects are only pushed to the mark-stack, and therefore traced, if their mark-bits are not set. When objects reach the oldest generation, their mark-bits are not reset during the so-called "quick-sweep", which leads to these objects not being traced in a subsequent mark phase. A "full-sweep", however, causes the mark-bits of all objects to be reset, leading to all objects being traced in a subsequent mark phase. Objects are promoted to the next generation during every sweep phase they survive. On the mutator side, field writes are intercepted through a write barrier that pushes an object’s address into a per-thread remembered set if the object is in the last generation, and if the object at the field being written is not. Objects in this remembered set are then traced during the mark phase.

Sweeping

Sweeping of object pools for Julia may fall into two categories: if a given page managed by the pool allocator contains at least one live object, then a free-list must be threaded through its dead objects; if a given page contains no live objects at all, then its underlying physical memory may be returned to the operating system through, for instance, the use of madvise system calls on Linux.

The first category of sweeping is parallelized through work-stealing. For the second category of sweeping, if concurrent page sweeping is enabled through the flag --gcthreads=X,1 we perform the madvise system calls in a background sweeper thread, concurrently with the mutator threads. During the stop-the-world phase of the collector, pool allocated pages which contain no live objects are initially pushed into the pool_page_lazily_freed. The background sweeping thread is then woken up and is responsible for removing pages from pool_page_lazily_freed, calling madvise on them, and inserting them into pool_page_freed. As described above, pool_page_lazily_freed is also shared with mutator threads. This implies that on allocation-heavy multithreaded workloads, mutator threads would often avoid a page fault on allocation (coming from accessing a fresh mmaped page or accessing a madvised page) by directly allocating from a page in pool_page_lazily_freed, while the background sweeper thread needs to madvise a reduce number of pages given some of them were already claimed by the mutators.

Heuristics

GC heuristics tune the GC by changing the size of the allocation interval between garbage collections.

The GC heuristics measure how big the heap size is after a collection and set the next collection according to the algorithm described by https://dl.acm.org/doi/10.1145/3563323, in summary, it argues that the heap target should have a square root relationship with the live heap, and that it should also be scaled by how fast the GC is freeing objects and how fast the mutators are allocating. The heuristics measure the heap size by counting the number of pages that are in use and the objects that use malloc. Previously we measured the heap size by counting the alive objects, but that doesn't take into account fragmentation which could lead to bad decisions, that also meant that we used thread local information (allocations) to make decisions about a process wide (when to GC), measuring pages means the decision is global.

The GC will do full collections when the heap size reaches 80% of the maximum allowed size.

diff --git a/en/v1.12-dev/devdocs/inference/index.html b/en/v1.12-dev/devdocs/inference/index.html index 592ebd20fef..3e91026311a 100644 --- a/en/v1.12-dev/devdocs/inference/index.html +++ b/en/v1.12-dev/devdocs/inference/index.html @@ -28,4 +28,4 @@ 0 4 ─ goto #5 0 5 ─ %11 = builtin Core.tuple(%8)::Tuple{Float64} 0 └── return %11 -

The line costs are in the left column. This includes the consequences of inlining and other forms of optimization.

+

The line costs are in the left column. This includes the consequences of inlining and other forms of optimization.

diff --git a/en/v1.12-dev/devdocs/init/index.html b/en/v1.12-dev/devdocs/init/index.html index c39f2dacfb7..66ec83d2d81 100644 --- a/en/v1.12-dev/devdocs/init/index.html +++ b/en/v1.12-dev/devdocs/init/index.html @@ -12,4 +12,4 @@ jl_any_type, jl_emptysvec, 32);

jl_init_tasks() creates the jl_datatype_t* jl_task_type object; initializes the global jl_root_task struct; and sets jl_current_task to the root task.

jl_init_codegen() initializes the LLVM library.

jl_init_serializer() initializes 8-bit serialization tags for builtin jl_value_t values.

If there is no sysimg file (!jl_options.image_file) then the Core and Main modules are created and boot.jl is evaluated:

jl_core_module = jl_new_module(jl_symbol("Core")) creates the Julia Core module.

jl_init_intrinsic_functions() creates a new Julia module Intrinsics containing constant jl_intrinsic_type symbols. These define an integer code for each intrinsic function. emit_intrinsic() translates these symbols into LLVM instructions during code generation.

jl_init_primitives() hooks C functions up to Julia function symbols. e.g. the symbol Core.:(===)() is bound to C function pointer jl_f_is() by calling add_builtin_func("===", jl_f_is).

jl_new_main_module() creates the global "Main" module and sets jl_current_task->current_module = jl_main_module.

Note: _julia_init() then sets jl_root_task->current_module = jl_core_module. jl_root_task is an alias of jl_current_task at this point, so the current_module set by jl_new_main_module() above is overwritten.

jl_load("boot.jl", sizeof("boot.jl")) calls jl_parse_eval_all which repeatedly calls jl_toplevel_eval_flex() to execute boot.jl. <!– TODO – drill down into eval? –>

jl_get_builtin_hooks() initializes global C pointers to Julia globals defined in boot.jl.

jl_init_box_caches() pre-allocates global boxed integer value objects for values up to 1024. This speeds up allocation of boxed ints later on. e.g.:

jl_value_t *jl_box_uint8(uint32_t x)
 {
     return boxed_uint8_cache[(uint8_t)x];
-}

_julia_init() iterates over the jl_core_module->bindings.table looking for jl_datatype_t values and sets the type name's module prefix to jl_core_module.

jl_add_standard_imports(jl_main_module) does "using Base" in the "Main" module.

Note: _julia_init() now reverts to jl_root_task->current_module = jl_main_module as it was before being set to jl_core_module above.

Platform specific signal handlers are initialized for SIGSEGV (OSX, Linux), and SIGFPE (Windows).

Other signals (SIGINFO, SIGBUS, SIGILL, SIGTERM, SIGABRT, SIGQUIT, SIGSYS and SIGPIPE) are hooked up to sigdie_handler() which prints a backtrace.

jl_init_restored_module() calls jl_module_run_initializer() for each deserialized module to run the __init__() function.

Finally sigint_handler() is hooked up to SIGINT and calls jl_throw(jl_interrupt_exception).

_julia_init() then returns back to main() in cli/loader_exe.c and main() calls repl_entrypoint(argc, (char**)argv).

sysimg

If there is a sysimg file, it contains a pre-cooked image of the Core and Main modules (and whatever else is created by boot.jl). See Building the Julia system image.

jl_restore_system_image() deserializes the saved sysimg into the current Julia runtime environment and initialization continues after jl_init_box_caches() below...

Note: jl_restore_system_image() (and staticdata.c in general) uses the Legacy ios.c library.

repl_entrypoint()

repl_entrypoint() loads the contents of argv[] into Base.ARGS.

If a .jl "program" file was supplied on the command line, then exec_program() calls jl_load(program,len) which calls jl_parse_eval_all which repeatedly calls jl_toplevel_eval_flex() to execute the program.

However, in our example (julia -e 'println("Hello World!")'), jl_get_global(jl_base_module, jl_symbol("_start")) looks up Base._start and jl_apply() executes it.

Base._start

Base._start calls Base.exec_options which calls jl_parse_input_line("println("Hello World!")") to create an expression object and Core.eval(Main, ex) to execute the parsed expression ex in the module context of Main.

Core.eval

Core.eval(Main, ex) calls jl_toplevel_eval_in(m, ex), which calls jl_toplevel_eval_flex. jl_toplevel_eval_flex implements a simple heuristic to decide whether to compile a given code thunk or run it by interpreter. When given println("Hello World!"), it would usually decide to run the code by interpreter, in which case it calls jl_interpret_toplevel_thunk, which then calls eval_body.

The stack dump below shows how the interpreter works its way through various methods of Base.println() and Base.print() before arriving at write(s::IO, a::Array{T}) where T which does ccall(jl_uv_write()).

jl_uv_write() calls uv_write() to write "Hello World!" to JL_STDOUT. See Libuv wrappers for stdio.:

Hello World!
Stack frameSource codeNotes
jl_uv_write()jl_uv.ccalled though ccall
julia_write_282942stream.jlfunction write!(s::IO, a::Array{T}) where T
julia_print_284639ascii.jlprint(io::IO, s::String) = (write(io, s); nothing)
jlcall_print_284639
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.print(Base.TTY, String)
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.print(Base.TTY, String, Char, Char...)
jl_apply()julia.h
jl_f_apply()builtins.c
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.println(Base.TTY, String, String...)
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.println(String,)
jl_apply()julia.h
do_call()interpreter.c
eval_body()interpreter.c
jl_interpret_toplevel_thunkinterpreter.c
jl_toplevel_eval_flextoplevel.c
jl_toplevel_eval_intoplevel.c
Core.evalboot.jl

Since our example has just one function call, which has done its job of printing "Hello World!", the stack now rapidly unwinds back to main().

jl_atexit_hook()

main() calls jl_atexit_hook(). This calls Base._atexit, then calls jl_gc_run_all_finalizers() and cleans up libuv handles.

julia_save()

Finally, main() calls julia_save(), which if requested on the command line, saves the runtime state to a new system image. See jl_compile_all() and jl_save_system_image().

+}

_julia_init() iterates over the jl_core_module->bindings.table looking for jl_datatype_t values and sets the type name's module prefix to jl_core_module.

jl_add_standard_imports(jl_main_module) does "using Base" in the "Main" module.

Note: _julia_init() now reverts to jl_root_task->current_module = jl_main_module as it was before being set to jl_core_module above.

Platform specific signal handlers are initialized for SIGSEGV (OSX, Linux), and SIGFPE (Windows).

Other signals (SIGINFO, SIGBUS, SIGILL, SIGTERM, SIGABRT, SIGQUIT, SIGSYS and SIGPIPE) are hooked up to sigdie_handler() which prints a backtrace.

jl_init_restored_module() calls jl_module_run_initializer() for each deserialized module to run the __init__() function.

Finally sigint_handler() is hooked up to SIGINT and calls jl_throw(jl_interrupt_exception).

_julia_init() then returns back to main() in cli/loader_exe.c and main() calls repl_entrypoint(argc, (char**)argv).

sysimg

If there is a sysimg file, it contains a pre-cooked image of the Core and Main modules (and whatever else is created by boot.jl). See Building the Julia system image.

jl_restore_system_image() deserializes the saved sysimg into the current Julia runtime environment and initialization continues after jl_init_box_caches() below...

Note: jl_restore_system_image() (and staticdata.c in general) uses the Legacy ios.c library.

repl_entrypoint()

repl_entrypoint() loads the contents of argv[] into Base.ARGS.

If a .jl "program" file was supplied on the command line, then exec_program() calls jl_load(program,len) which calls jl_parse_eval_all which repeatedly calls jl_toplevel_eval_flex() to execute the program.

However, in our example (julia -e 'println("Hello World!")'), jl_get_global(jl_base_module, jl_symbol("_start")) looks up Base._start and jl_apply() executes it.

Base._start

Base._start calls Base.exec_options which calls jl_parse_input_line("println("Hello World!")") to create an expression object and Core.eval(Main, ex) to execute the parsed expression ex in the module context of Main.

Core.eval

Core.eval(Main, ex) calls jl_toplevel_eval_in(m, ex), which calls jl_toplevel_eval_flex. jl_toplevel_eval_flex implements a simple heuristic to decide whether to compile a given code thunk or run it by interpreter. When given println("Hello World!"), it would usually decide to run the code by interpreter, in which case it calls jl_interpret_toplevel_thunk, which then calls eval_body.

The stack dump below shows how the interpreter works its way through various methods of Base.println() and Base.print() before arriving at write(s::IO, a::Array{T}) where T which does ccall(jl_uv_write()).

jl_uv_write() calls uv_write() to write "Hello World!" to JL_STDOUT. See Libuv wrappers for stdio.:

Hello World!
Stack frameSource codeNotes
jl_uv_write()jl_uv.ccalled though ccall
julia_write_282942stream.jlfunction write!(s::IO, a::Array{T}) where T
julia_print_284639ascii.jlprint(io::IO, s::String) = (write(io, s); nothing)
jlcall_print_284639
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.print(Base.TTY, String)
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.print(Base.TTY, String, Char, Char...)
jl_apply()julia.h
jl_f_apply()builtins.c
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.println(Base.TTY, String, String...)
jl_apply()julia.h
jl_trampoline()builtins.c
jl_apply()julia.h
jl_apply_generic()gf.cBase.println(String,)
jl_apply()julia.h
do_call()interpreter.c
eval_body()interpreter.c
jl_interpret_toplevel_thunkinterpreter.c
jl_toplevel_eval_flextoplevel.c
jl_toplevel_eval_intoplevel.c
Core.evalboot.jl

Since our example has just one function call, which has done its job of printing "Hello World!", the stack now rapidly unwinds back to main().

jl_atexit_hook()

main() calls jl_atexit_hook(). This calls Base._atexit, then calls jl_gc_run_all_finalizers() and cleans up libuv handles.

julia_save()

Finally, main() calls julia_save(), which if requested on the command line, saves the runtime state to a new system image. See jl_compile_all() and jl_save_system_image().

diff --git a/en/v1.12-dev/devdocs/isbitsunionarrays/index.html b/en/v1.12-dev/devdocs/isbitsunionarrays/index.html index 6d5eca029ff..7fe2e0e209d 100644 --- a/en/v1.12-dev/devdocs/isbitsunionarrays/index.html +++ b/en/v1.12-dev/devdocs/isbitsunionarrays/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

isbits Union Optimizations

In Julia, the Array type holds both "bits" values as well as heap-allocated "boxed" values. The distinction is whether the value itself is stored inline (in the direct allocated memory of the array), or if the memory of the array is simply a collection of pointers to objects allocated elsewhere. In terms of performance, accessing values inline is clearly an advantage over having to follow a pointer to the actual value. The definition of "isbits" generally means any Julia type with a fixed, determinate size, meaning no "pointer" fields, see ?isbitstype.

Julia also supports Union types, quite literally the union of a set of types. Custom Union type definitions can be extremely handy for applications wishing to "cut across" the nominal type system (i.e. explicit subtype relationships) and define methods or functionality on these, otherwise unrelated, set of types. A compiler challenge, however, is in determining how to treat these Union types. The naive approach (and indeed, what Julia itself did pre-0.7), is to simply make a "box" and then a pointer in the box to the actual value, similar to the previously mentioned "boxed" values. This is unfortunate, however, because of the number of small, primitive "bits" types (think UInt8, Int32, Float64, etc.) that would easily fit themselves inline in this "box" without needing any indirection for value access. There are two main ways Julia can take advantage of this optimization as of 0.7: isbits Union fields in types, and isbits Union Arrays.

isbits Union Structs

Julia now includes an optimization wherein "isbits Union" fields in types (mutable struct, struct, etc.) will be stored inline. This is accomplished by determining the "inline size" of the Union type (e.g. Union{UInt8, Int16} will have a size of two bytes, which represents the size needed of the largest Union type Int16), and in addition, allocating an extra "type tag byte" (UInt8), whose value signals the type of the actual value stored inline of the "Union bytes". The type tag byte value is the index of the actual value's type in the Union type's order of types. For example, a type tag value of 0x02 for a field with type Union{Nothing, UInt8, Int16} would indicate that an Int16 value is stored in the 16 bits of the field in the structure's memory; a 0x01 value would indicate that a UInt8 value was stored in the first 8 bits of the 16 bits of the field's memory. Lastly, a value of 0x00 signals that the nothing value will be returned for this field, even though, as a singleton type with a single type instance, it technically has a size of 0. The type tag byte for a type's Union field is stored directly after the field's computed Union memory.

isbits Union Memory

Julia can now also store "isbits Union" values inline in a Memory, as opposed to requiring an indirection box. The optimization is accomplished by storing an extra "type tag memory" of bytes, one byte per element, alongside the bytes of the actual data. This type tag memory serves the same function as the type field case: its value signals the type of the actual stored Union value. The "type tag memory" directly follows the regular data space. So the formula to access an isbits Union Array's type tag bytes is a->data + a->length * a->elsize.

+

isbits Union Optimizations

In Julia, the Array type holds both "bits" values as well as heap-allocated "boxed" values. The distinction is whether the value itself is stored inline (in the direct allocated memory of the array), or if the memory of the array is simply a collection of pointers to objects allocated elsewhere. In terms of performance, accessing values inline is clearly an advantage over having to follow a pointer to the actual value. The definition of "isbits" generally means any Julia type with a fixed, determinate size, meaning no "pointer" fields, see ?isbitstype.

Julia also supports Union types, quite literally the union of a set of types. Custom Union type definitions can be extremely handy for applications wishing to "cut across" the nominal type system (i.e. explicit subtype relationships) and define methods or functionality on these, otherwise unrelated, set of types. A compiler challenge, however, is in determining how to treat these Union types. The naive approach (and indeed, what Julia itself did pre-0.7), is to simply make a "box" and then a pointer in the box to the actual value, similar to the previously mentioned "boxed" values. This is unfortunate, however, because of the number of small, primitive "bits" types (think UInt8, Int32, Float64, etc.) that would easily fit themselves inline in this "box" without needing any indirection for value access. There are two main ways Julia can take advantage of this optimization as of 0.7: isbits Union fields in types, and isbits Union Arrays.

isbits Union Structs

Julia now includes an optimization wherein "isbits Union" fields in types (mutable struct, struct, etc.) will be stored inline. This is accomplished by determining the "inline size" of the Union type (e.g. Union{UInt8, Int16} will have a size of two bytes, which represents the size needed of the largest Union type Int16), and in addition, allocating an extra "type tag byte" (UInt8), whose value signals the type of the actual value stored inline of the "Union bytes". The type tag byte value is the index of the actual value's type in the Union type's order of types. For example, a type tag value of 0x02 for a field with type Union{Nothing, UInt8, Int16} would indicate that an Int16 value is stored in the 16 bits of the field in the structure's memory; a 0x01 value would indicate that a UInt8 value was stored in the first 8 bits of the 16 bits of the field's memory. Lastly, a value of 0x00 signals that the nothing value will be returned for this field, even though, as a singleton type with a single type instance, it technically has a size of 0. The type tag byte for a type's Union field is stored directly after the field's computed Union memory.

isbits Union Memory

Julia can now also store "isbits Union" values inline in a Memory, as opposed to requiring an indirection box. The optimization is accomplished by storing an extra "type tag memory" of bytes, one byte per element, alongside the bytes of the actual data. This type tag memory serves the same function as the type field case: its value signals the type of the actual stored Union value. The "type tag memory" directly follows the regular data space. So the formula to access an isbits Union Array's type tag bytes is a->data + a->length * a->elsize.

diff --git a/en/v1.12-dev/devdocs/jit/index.html b/en/v1.12-dev/devdocs/jit/index.html index 79c092468d6..e94e4ecc618 100644 --- a/en/v1.12-dev/devdocs/jit/index.html +++ b/en/v1.12-dev/devdocs/jit/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

JIT Design and Implementation

This document explains the design and implementation of Julia's JIT, after codegen has finished and unoptimized LLVM IR has been produced. The JIT is responsible for optimizing and compiling this IR to machine code, and for linking it into the current process and making the code available for execution.

Introduction

The JIT is responsible for managing compilation resources, looking up previously compiled code, and compiling new code. It is primarily built on LLVM's On-Request-Compilation (ORCv2) technology, which provides support for a number of useful features such as concurrent compilation, lazy compilation, and the ability to compile code in a separate process. Though LLVM provides a basic JIT compiler in the form of LLJIT, Julia uses many ORCv2 APIs directly to create its own custom JIT compiler.

Overview

Diagram of the compiler flow

Codegen produces an LLVM module containing IR for one or more Julia functions from the original Julia SSA IR produced by type inference (labeled as translate on the compiler diagram above). It also produces a mapping of code-instance to LLVM function name. However, though some optimizations have been applied by the Julia-based compiler on Julia IR, the LLVM IR produced by codegen still contains many opportunities for optimization. Thus, the first step the JIT takes is to run a target-independent optimization pipeline[tdp] on the LLVM module. Then, the JIT runs a target-dependent optimization pipeline, which includes target-specific optimizations and code generation, and outputs an object file. Finally, the JIT links the resulting object file into the current process and makes the code available for execution. All of this is controlled by code in src/jitlayers.cpp.

Currently, only one thread at a time is permitted to enter the optimize-compile-link pipeline at a time, due to restrictions imposed by one of our linkers (RuntimeDyld). However, the JIT is designed to support concurrent optimization and compilation, and the linker restriction is expected to be lifted in the future when RuntimeDyld has been fully superseded on all platforms.

Optimization Pipeline

The optimization pipeline is based off LLVM's new pass manager, but the pipeline is customized for Julia's needs. The pipeline is defined in src/pipeline.cpp, and broadly proceeds through a number of stages as detailed below.

  1. Early Simplification
    1. These passes are mainly used to simplify the IR and canonicalize patterns so that later passes can identify those patterns more easily. Additionally, various intrinsic calls such as branch prediction hints and annotations are lowered into other metadata or other IR features. SimplifyCFG (simplify control flow graph), DCE (dead code elimination), and SROA (scalar replacement of aggregates) are some of the key players here.
  2. Early Optimization
    1. These passes are typically cheap and are primarily focused around reducing the number of instructions in the IR and propagating knowledge to other instructions. For example, EarlyCSE is used to perform common subexpression elimination, and InstCombine and InstSimplify perform a number of small peephole optimizations to make operations less expensive.
  3. Loop Optimization
    1. These passes canonicalize and simplify loops. Loops are often hot code, which makes loop optimization extremely important for performance. Key players here include LoopRotate, LICM, and LoopFullUnroll. Some bounds check elimination also happens here, as a result of the IRCE pass which can prove certain bounds are never exceeded.
  4. Scalar Optimization
    1. The scalar optimization pipeline contains a number of more expensive, but more powerful passes such as GVN (global value numbering), SCCP (sparse conditional constant propagation), and another round of bounds check elimination. These passes are expensive, but they can often remove large amounts of code and make vectorization much more successful and effective. Several other simplification and optimization passes intersperse the more expensive ones to reduce the amount of work they have to do.
  5. Vectorization
    1. Automatic vectorization is an extremely powerful transformation for CPU-intensive code. Briefly, vectorization allows execution of a single instruction on multiple data (SIMD), e.g. performing 8 addition operations at the same time. However, proving code to be both capable of vectorization and profitable to vectorize is difficult, and this relies heavily on the prior optimization passes to massage the IR into a state where vectorization is worth it.
  6. Intrinsic Lowering
    1. Julia inserts a number of custom intrinsics, for reasons such as object allocation, garbage collection, and exception handling. These intrinsics were originally placed to make optimization opportunities more obvious, but they are now lowered into LLVM IR to enable the IR to be emitted as machine code.
  7. Cleanup
    1. These passes are last-chance optimizations, and perform small optimizations such as fused multiply-add propagation and division-remainder simplification. Additionally, targets that do not support half-precision floating point numbers will have their half-precision instructions lowered into single-precision instructions here, and passes are added to provide sanitizer support.

Target-Dependent Optimization and Code Generation

LLVM provides target-dependent optimization and machine code generation in the same pipeline, located in the TargetMachine for a given platform. These passes include instruction selection, instruction scheduling, register allocation, and machine code emission. The LLVM documentation provides a good overview of the process, and the LLVM source code is the best place to look for details on the pipeline and passes.

Linking

Currently, Julia is transitioning between two linkers: the older RuntimeDyld linker, and the newer JITLink linker. JITLink contains a number of features that RuntimeDyld does not have, such as concurrent and reentrant linking, but currently lacks good support for profiling integrations and does not yet support all of the platforms that RuntimeDyld supports. Over time, JITLink is expected to replace RuntimeDyld entirely. Further details on JITLink can be found in the LLVM documentation.

Execution

Once the code has been linked into the current process, it is available for execution. This fact is made known to the generating codeinst by updating the invoke, specsigflags, and specptr fields appropriately. Codeinsts support upgrading invoke, specsigflags, and specptr fields, so long as every combination of these fields that exists at any given point in time is valid to be called. This allows the JIT to update these fields without invalidating existing codeinsts, supporting a potential future concurrent JIT. Specifically, the following states may be valid:

  1. invoke is NULL, specsigflags is 0b00, specptr is NULL
    1. This is the initial state of a codeinst, and indicates that the codeinst has not yet been compiled.
  2. invoke is non-null, specsigflags is 0b00, specptr is NULL
    1. This indicates that the codeinst was not compiled with any specialization, and that the codeinst should be invoked directly. Note that in this instance, invoke does not read either the specsigflags or specptr fields, and therefore they may be modified without invalidating the invoke pointer.
  3. invoke is non-null, specsigflags is 0b10, specptr is non-null
    1. This indicates that the codeinst was compiled, but a specialized function signature was deemed unnecessary by codegen.
  4. invoke is non-null, specsigflags is 0b11, specptr is non-null
    1. This indicates that the codeinst was compiled, and a specialized function signature was deemed necessary by codegen. The specptr field contains a pointer to the specialized function signature. The invoke pointer is permitted to read both specsigflags and specptr fields.

In addition, there are a number of different transitional states that occur during the update process. To account for these potential situations, the following write and read patterns should be used when dealing with these codeinst fields.

  1. When writing invoke, specsigflags, and specptr:
    1. Perform an atomic compare-exchange operation of specptr assuming the old value was NULL. This compare-exchange operation should have at least acquire-release ordering, to provide ordering guarantees of the remaining memory operations in the write.
    2. If specptr was non-null, cease the write operation and wait for bit 0b10 of specsigflags to be written, then restart from step 1 if desired.
    3. Write the new low bit of specsigflags to its final value. This may be a relaxed write.
    4. Write the new invoke pointer to its final value. This must have at least a release memory ordering to synchronize with reads of invoke.
    5. Set the second bit of specsigflags to 1. This must be at least a release memory ordering to synchronize with reads of specsigflags. This step completes the write operation and announces to all other threads that all fields have been set.
  2. When reading all of invoke, specsigflags, and specptr:
    1. Read the specptr field with any memory ordering.
    2. Read the invoke field with at least an acquire memory ordering. This load will be referred to as initial_invoke.
    3. If initial_invoke is NULL, the codeinst is not yet executable. invoke is NULL, specsigflags may be treated as 0b00, specptr may be treated as NULL.
    4. If specptr is NULL, then the initial_invoke pointer must not be relying on specptr to guarantee correct execution. Therefore, invoke is non-null, specsigflags may be treated as 0b00, specptr may be treated as NULL.
    5. If specptr is non-null, then initial_invoke might not be the final invoke field that uses specptr. This can occur if specptr has been written, but invoke has not yet been written. Therefore, spin on the second bit of specsigflags until it is set to 1 with at least acquire memory ordering.
    6. Re-read the invoke field with any memory ordering. This load will be referred to as final_invoke.
    7. Read the specsigflags field with any memory ordering.
    8. invoke is final_invoke, specsigflags is the value read in step 7, specptr is the value read in step 3.
  3. When updating a specptr to a different but equivalent function pointer:
    1. Perform a release store of the new function pointer to specptr. Races here must be benign, as the old function pointer is required to still be valid, and any new ones are also required to be valid as well. Once a pointer has been written to specptr, it must always be callable whether or not it is later overwritten.

Correctly reading these fields is implemented in jl_read_codeinst_invoke.

Although these write, read, and update steps are complicated, they ensure that the JIT can update codeinsts without invalidating existing codeinsts, and that the JIT can update codeinsts without invalidating existing invoke pointers. This allows the JIT to potentially reoptimize functions at higher optimization levels in the future, and also will allow the JIT to support concurrent compilation of functions in the future.

  • tdpThis is not a totally-target independent pipeline, as transformations such as vectorization rely upon target information such as vector register width and cost modeling. Additionally, codegen itself makes a few target-dependent assumptions, and the optimization pipeline will take advantage of that knowledge.
+

JIT Design and Implementation

This document explains the design and implementation of Julia's JIT, after codegen has finished and unoptimized LLVM IR has been produced. The JIT is responsible for optimizing and compiling this IR to machine code, and for linking it into the current process and making the code available for execution.

Introduction

The JIT is responsible for managing compilation resources, looking up previously compiled code, and compiling new code. It is primarily built on LLVM's On-Request-Compilation (ORCv2) technology, which provides support for a number of useful features such as concurrent compilation, lazy compilation, and the ability to compile code in a separate process. Though LLVM provides a basic JIT compiler in the form of LLJIT, Julia uses many ORCv2 APIs directly to create its own custom JIT compiler.

Overview

Diagram of the compiler flow

Codegen produces an LLVM module containing IR for one or more Julia functions from the original Julia SSA IR produced by type inference (labeled as translate on the compiler diagram above). It also produces a mapping of code-instance to LLVM function name. However, though some optimizations have been applied by the Julia-based compiler on Julia IR, the LLVM IR produced by codegen still contains many opportunities for optimization. Thus, the first step the JIT takes is to run a target-independent optimization pipeline[tdp] on the LLVM module. Then, the JIT runs a target-dependent optimization pipeline, which includes target-specific optimizations and code generation, and outputs an object file. Finally, the JIT links the resulting object file into the current process and makes the code available for execution. All of this is controlled by code in src/jitlayers.cpp.

Currently, only one thread at a time is permitted to enter the optimize-compile-link pipeline at a time, due to restrictions imposed by one of our linkers (RuntimeDyld). However, the JIT is designed to support concurrent optimization and compilation, and the linker restriction is expected to be lifted in the future when RuntimeDyld has been fully superseded on all platforms.

Optimization Pipeline

The optimization pipeline is based off LLVM's new pass manager, but the pipeline is customized for Julia's needs. The pipeline is defined in src/pipeline.cpp, and broadly proceeds through a number of stages as detailed below.

  1. Early Simplification
    1. These passes are mainly used to simplify the IR and canonicalize patterns so that later passes can identify those patterns more easily. Additionally, various intrinsic calls such as branch prediction hints and annotations are lowered into other metadata or other IR features. SimplifyCFG (simplify control flow graph), DCE (dead code elimination), and SROA (scalar replacement of aggregates) are some of the key players here.
  2. Early Optimization
    1. These passes are typically cheap and are primarily focused around reducing the number of instructions in the IR and propagating knowledge to other instructions. For example, EarlyCSE is used to perform common subexpression elimination, and InstCombine and InstSimplify perform a number of small peephole optimizations to make operations less expensive.
  3. Loop Optimization
    1. These passes canonicalize and simplify loops. Loops are often hot code, which makes loop optimization extremely important for performance. Key players here include LoopRotate, LICM, and LoopFullUnroll. Some bounds check elimination also happens here, as a result of the IRCE pass which can prove certain bounds are never exceeded.
  4. Scalar Optimization
    1. The scalar optimization pipeline contains a number of more expensive, but more powerful passes such as GVN (global value numbering), SCCP (sparse conditional constant propagation), and another round of bounds check elimination. These passes are expensive, but they can often remove large amounts of code and make vectorization much more successful and effective. Several other simplification and optimization passes intersperse the more expensive ones to reduce the amount of work they have to do.
  5. Vectorization
    1. Automatic vectorization is an extremely powerful transformation for CPU-intensive code. Briefly, vectorization allows execution of a single instruction on multiple data (SIMD), e.g. performing 8 addition operations at the same time. However, proving code to be both capable of vectorization and profitable to vectorize is difficult, and this relies heavily on the prior optimization passes to massage the IR into a state where vectorization is worth it.
  6. Intrinsic Lowering
    1. Julia inserts a number of custom intrinsics, for reasons such as object allocation, garbage collection, and exception handling. These intrinsics were originally placed to make optimization opportunities more obvious, but they are now lowered into LLVM IR to enable the IR to be emitted as machine code.
  7. Cleanup
    1. These passes are last-chance optimizations, and perform small optimizations such as fused multiply-add propagation and division-remainder simplification. Additionally, targets that do not support half-precision floating point numbers will have their half-precision instructions lowered into single-precision instructions here, and passes are added to provide sanitizer support.

Target-Dependent Optimization and Code Generation

LLVM provides target-dependent optimization and machine code generation in the same pipeline, located in the TargetMachine for a given platform. These passes include instruction selection, instruction scheduling, register allocation, and machine code emission. The LLVM documentation provides a good overview of the process, and the LLVM source code is the best place to look for details on the pipeline and passes.

Linking

Currently, Julia is transitioning between two linkers: the older RuntimeDyld linker, and the newer JITLink linker. JITLink contains a number of features that RuntimeDyld does not have, such as concurrent and reentrant linking, but currently lacks good support for profiling integrations and does not yet support all of the platforms that RuntimeDyld supports. Over time, JITLink is expected to replace RuntimeDyld entirely. Further details on JITLink can be found in the LLVM documentation.

Execution

Once the code has been linked into the current process, it is available for execution. This fact is made known to the generating codeinst by updating the invoke, specsigflags, and specptr fields appropriately. Codeinsts support upgrading invoke, specsigflags, and specptr fields, so long as every combination of these fields that exists at any given point in time is valid to be called. This allows the JIT to update these fields without invalidating existing codeinsts, supporting a potential future concurrent JIT. Specifically, the following states may be valid:

  1. invoke is NULL, specsigflags is 0b00, specptr is NULL
    1. This is the initial state of a codeinst, and indicates that the codeinst has not yet been compiled.
  2. invoke is non-null, specsigflags is 0b00, specptr is NULL
    1. This indicates that the codeinst was not compiled with any specialization, and that the codeinst should be invoked directly. Note that in this instance, invoke does not read either the specsigflags or specptr fields, and therefore they may be modified without invalidating the invoke pointer.
  3. invoke is non-null, specsigflags is 0b10, specptr is non-null
    1. This indicates that the codeinst was compiled, but a specialized function signature was deemed unnecessary by codegen.
  4. invoke is non-null, specsigflags is 0b11, specptr is non-null
    1. This indicates that the codeinst was compiled, and a specialized function signature was deemed necessary by codegen. The specptr field contains a pointer to the specialized function signature. The invoke pointer is permitted to read both specsigflags and specptr fields.

In addition, there are a number of different transitional states that occur during the update process. To account for these potential situations, the following write and read patterns should be used when dealing with these codeinst fields.

  1. When writing invoke, specsigflags, and specptr:
    1. Perform an atomic compare-exchange operation of specptr assuming the old value was NULL. This compare-exchange operation should have at least acquire-release ordering, to provide ordering guarantees of the remaining memory operations in the write.
    2. If specptr was non-null, cease the write operation and wait for bit 0b10 of specsigflags to be written, then restart from step 1 if desired.
    3. Write the new low bit of specsigflags to its final value. This may be a relaxed write.
    4. Write the new invoke pointer to its final value. This must have at least a release memory ordering to synchronize with reads of invoke.
    5. Set the second bit of specsigflags to 1. This must be at least a release memory ordering to synchronize with reads of specsigflags. This step completes the write operation and announces to all other threads that all fields have been set.
  2. When reading all of invoke, specsigflags, and specptr:
    1. Read the specptr field with any memory ordering.
    2. Read the invoke field with at least an acquire memory ordering. This load will be referred to as initial_invoke.
    3. If initial_invoke is NULL, the codeinst is not yet executable. invoke is NULL, specsigflags may be treated as 0b00, specptr may be treated as NULL.
    4. If specptr is NULL, then the initial_invoke pointer must not be relying on specptr to guarantee correct execution. Therefore, invoke is non-null, specsigflags may be treated as 0b00, specptr may be treated as NULL.
    5. If specptr is non-null, then initial_invoke might not be the final invoke field that uses specptr. This can occur if specptr has been written, but invoke has not yet been written. Therefore, spin on the second bit of specsigflags until it is set to 1 with at least acquire memory ordering.
    6. Re-read the invoke field with any memory ordering. This load will be referred to as final_invoke.
    7. Read the specsigflags field with any memory ordering.
    8. invoke is final_invoke, specsigflags is the value read in step 7, specptr is the value read in step 3.
  3. When updating a specptr to a different but equivalent function pointer:
    1. Perform a release store of the new function pointer to specptr. Races here must be benign, as the old function pointer is required to still be valid, and any new ones are also required to be valid as well. Once a pointer has been written to specptr, it must always be callable whether or not it is later overwritten.

Correctly reading these fields is implemented in jl_read_codeinst_invoke.

Although these write, read, and update steps are complicated, they ensure that the JIT can update codeinsts without invalidating existing codeinsts, and that the JIT can update codeinsts without invalidating existing invoke pointers. This allows the JIT to potentially reoptimize functions at higher optimization levels in the future, and also will allow the JIT to support concurrent compilation of functions in the future.

  • tdpThis is not a totally-target independent pipeline, as transformations such as vectorization rely upon target information such as vector register width and cost modeling. Additionally, codegen itself makes a few target-dependent assumptions, and the optimization pipeline will take advantage of that knowledge.
diff --git a/en/v1.12-dev/devdocs/llvm-passes/index.html b/en/v1.12-dev/devdocs/llvm-passes/index.html index 0a3f1d538cd..dae66c51974 100644 --- a/en/v1.12-dev/devdocs/llvm-passes/index.html +++ b/en/v1.12-dev/devdocs/llvm-passes/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Custom LLVM Passes

Julia has a number of custom LLVM passes. Broadly, they can be classified into passes that are required to be run to maintain Julia semantics, and passes that take advantage of Julia semantics to optimize LLVM IR.

Semantic Passes

These passes are used to transform LLVM IR into code that is legal to be run on a CPU. Their main purpose is to enable simpler IR to be emitted by codegen, which then enables other LLVM passes to optimize common patterns.

CPUFeatures

  • Filename: llvm-cpufeatures.cpp
  • Class Name: CPUFeaturesPass
  • Opt Name: module(CPUFeatures)

This pass lowers the julia.cpu.have_fma.(f32|f64) intrinsic to either true or false, depending on the target architecture and target features present on the function. This intrinsic is often used to determine if using algorithms dependent on fast fused multiply-add operations is better than using standard algorithms not dependent on such instructions.

DemoteFloat16

  • Filename: llvm-demote-float16.cpp
  • ClassName: DemoteFloat16Pass
  • Opt Name function(DemoteFloat16)

This pass replaces float16 operations with float32 operations on architectures that do not natively support float16 operations. This is done by inserting fpext and fptrunc instructions around any float16 operation. On architectures that do support native float16 operations, this pass is a no-op.

LateGCLowering

  • Filename: llvm-late-gc-lowering.cpp
  • Class Name: LateLowerGCPass
  • Opt Name: function(LateLowerGCFrame)

This pass performs most of the GC rooting work required to track pointers between GC safepoints. It also lowers several intrinsics to their corresponding instruction translation, and is permitted to violate the non-integral invariants previously established (pointer_from_objref is lowered to a ptrtoint instruction here). This pass typically occupies the most time out of all the custom Julia passes, due to its dataflow algorithm to minimize the number of objects live at any safepoint.

FinalGCLowering

  • Filename: llvm-final-gc-lowering.cpp
  • Class Name: FinalLowerGCPass
  • Opt Name: module(FinalLowerGC)

This pass lowers a few last intrinsics to their final form targeting functions in the libjulia library. Separating this from LateGCLowering enables other backends (GPU compilation) to supply their own custom lowerings for these intrinsics, enabling the Julia pipeline to be used on those backends as well.

LowerHandlers

  • Filename: llvm-lower-handlers.cpp
  • Class Name: LowerExcHandlersPass
  • Opt Name: function(LowerExcHandlers)

This pass lowers exception handling intrinsics into calls to runtime functions that are actually called when handling exceptions.

RemoveNI

  • Filename: llvm-remove-ni.cpp
  • Class Name: RemoveNIPass
  • Opt Name: module(RemoveNI)

This pass removes the non-integral address spaces from the module's datalayout string. This enables the backend to lower Julia's custom address spaces directly to machine code, without a costly rewrite of every pointer operation to address space 0.

SIMDLoop

  • Filename: llvm-simdloop.cpp
  • Class Name: LowerSIMDLoopPass
  • Opt Name: loop(LowerSIMDLoop)

This pass acts as the main driver of the @simd annotation. Codegen inserts a !llvm.loopid marker at the back branch of a loop, which this pass uses to identify loops that were originally marked with @simd. Then, this pass looks for a chain of floating point operations that form a reduce and adds the contract and reassoc fast math flags to allow reassociation (and thus vectorization). This pass does not preserve either loop information nor inference correctness, so it may violate Julia semantics in surprising ways. If the loop was annotated with ivdep as well, then the pass marks the loop as having no loop-carried dependencies (the resulting behavior is undefined if the user annotation was incorrect or gets applied to the wrong loop).

LowerPTLS

  • Filename: llvm-ptls.cpp
  • Class Name: LowerPTLSPass
  • Opt Name: module(LowerPTLSPass)

This pass lowers thread-local Julia intrinsics to assembly instructions. Julia relies on thread-local storage for garbage collection and multithreading task scheduling. When compiling code for system images and package images, this pass replaces calls to intrinsics with loads from global variables that are initialized at load time.

If codegen produces a function with a swiftself argument and calling convention, this pass assumes the swiftself argument is the pgcstack and will replace the intrinsics with that argument. Doing so provides speedups on architectures that have slow thread local storage accesses.

RemoveAddrspaces

  • Filename: llvm-remove-addrspaces.cpp
  • Class Name: RemoveAddrspacesPass
  • Opt Name: module(RemoveAddrspaces)

This pass renames pointers in one address space to another address space. This is used to remove Julia-specific address spaces from LLVM IR.

RemoveJuliaAddrspaces

  • Filename: llvm-remove-addrspaces.cpp
  • Class Name: RemoveJuliaAddrspacesPass
  • Opt Name: module(RemoveJuliaAddrspaces)

This pass removes Julia-specific address spaces from LLVM IR. It is mostly used for displaying LLVM IR in a less cluttered format. Internally, it is implemented off the RemoveAddrspaces pass.

Multiversioning

  • Filename: llvm-multiversioning.cpp
  • Class Name: MultiVersioningPass
  • Opt Name: module(JuliaMultiVersioning)

This pass performs modifications to a module to create functions that are optimized for running on different architectures (see sysimg.md and pkgimg.md for more details). Implementation-wise, it clones functions and applies different target-specific attributes to them to allow the optimizer to use advanced features such as vectorization and instruction scheduling for that platform. It also creates some infrastructure to enable the Julia image loader to select the appropriate version of the function to call based on the architecture the loader is running on. The target-specific attributes are controlled by the julia.mv.specs module flag, which during compilation is derived from the JULIA_CPU_TARGET environment variable. The pass must also be enabled by providing a julia.mv.enable module flag with a value of 1.

Warning

Use of llvmcall with multiversioning is dangerous. llvmcall enables access to features not typically exposed by the Julia APIs, and are therefore usually not available on all architectures. If multiversioning is enabled and code generation is requested for a target architecture that does not support the feature required by an llvmcall expression, LLVM will probably error out, likely with an abort and the message LLVM ERROR: Do not know how to split the result of this operator!.

GCInvariantVerifier

  • Filename: llvm-gc-invariant-verifier.cpp
  • Class Name: GCInvariantVerifierPass
  • Opt Name: module(GCInvariantVerifier)

This pass is used to verify Julia's invariants about LLVM IR. This includes things such as the nonexistence of ptrtoint in Julia's non-integral address spaces [nislides] and the existence of only blessed addrspacecast instructions (Tracked -> Derived, 0 -> Tracked, etc). It performs no transformations on IR.

Optimization Passes

These passes are used to perform transformations on LLVM IR that LLVM will not perform itself, e.g. fast math flag propagation, escape analysis, and optimizations on Julia-specific internal functions. They use knowledge about Julia's semantics to perform these optimizations.

AllocOpt

  • Filename: llvm-alloc-opt.cpp
  • Class Name: AllocOptPass
  • Opt Name: function(AllocOpt)

Julia does not have the concept of a program stack as a place to allocate mutable objects. However, allocating objects on the stack reduces GC pressure and is critical for GPU compilation. Thus, AllocOpt performs heap to stack conversion of objects that it can prove do not escape the current function. It also performs a number of other optimizations on allocations, such as removing allocations that are never used, optimizing typeof calls to freshly allocated objects, and removing stores to allocations that are immediately overwritten. The escape analysis implementation is located in llvm-alloc-helpers.cpp. Currently, this pass does not use information from EscapeAnalysis.jl, though that may change in the future.

PropagateJuliaAddrspaces

  • Filename: llvm-propagate-addrspaces.cpp
  • Class Name: PropagateJuliaAddrspacesPass
  • Opt Name: function(PropagateJuliaAddrspaces)

This pass is used to propagate Julia-specific address spaces through operations on pointers. LLVM is not allowed to introduce or remove addrspacecast instructions by optimizations, so this pass acts to eliminate redundant addrspace casts by replacing operations with their equivalent in a Julia address space. For more information on Julia's address spaces, see (TODO link to llvm.md).

JuliaLICM

  • Filename: llvm-julia-licm.cpp
  • Class Name: JuliaLICMPass
  • Opt Name: loop(JuliaLICM)

This pass is used to hoist Julia-specific intrinsics out of loops. Specifically, it performs the following transformations:

  1. Hoist gc_preserve_begin and sink gc_preserve_end out of loops when the preserved objects are loop-invariant.
    1. Since objects preserved within a loop are likely preserved for the duration of the loop, this transformation can reduce the number of gc_preserve_begin/gc_preserve_end pairs in the IR. This makes it easier for the LateLowerGCPass to identify where particular objects are preserved.
  2. Hoist write barriers with invariant objects
    1. Here we assume that there are only two generations that an object can be a part of. Given that, a write barrier needs to only execute once for any pair of the same object. Thus, we can hoist write barriers out of loops when the object being written to is loop-invariant.
  3. Hoist allocations out of loops when they do not escape the loop
    1. We use a very conservative definition of escape here, the same as the one used in AllocOptPass. This transformation can reduce the number of allocations in the IR, even when an allocation escapes the function altogether.
Note

This pass is required to preserve LLVM's MemorySSA (Short Video, Longer Video) and ScalarEvolution (Newer Slides Older Slides) analyses.

  • nislideshttps://llvm.org/devmtg/2015-02/slides/chisnall-pointers-not-int.pdf
+

Custom LLVM Passes

Julia has a number of custom LLVM passes. Broadly, they can be classified into passes that are required to be run to maintain Julia semantics, and passes that take advantage of Julia semantics to optimize LLVM IR.

Semantic Passes

These passes are used to transform LLVM IR into code that is legal to be run on a CPU. Their main purpose is to enable simpler IR to be emitted by codegen, which then enables other LLVM passes to optimize common patterns.

CPUFeatures

  • Filename: llvm-cpufeatures.cpp
  • Class Name: CPUFeaturesPass
  • Opt Name: module(CPUFeatures)

This pass lowers the julia.cpu.have_fma.(f32|f64) intrinsic to either true or false, depending on the target architecture and target features present on the function. This intrinsic is often used to determine if using algorithms dependent on fast fused multiply-add operations is better than using standard algorithms not dependent on such instructions.

DemoteFloat16

  • Filename: llvm-demote-float16.cpp
  • ClassName: DemoteFloat16Pass
  • Opt Name function(DemoteFloat16)

This pass replaces float16 operations with float32 operations on architectures that do not natively support float16 operations. This is done by inserting fpext and fptrunc instructions around any float16 operation. On architectures that do support native float16 operations, this pass is a no-op.

LateGCLowering

  • Filename: llvm-late-gc-lowering.cpp
  • Class Name: LateLowerGCPass
  • Opt Name: function(LateLowerGCFrame)

This pass performs most of the GC rooting work required to track pointers between GC safepoints. It also lowers several intrinsics to their corresponding instruction translation, and is permitted to violate the non-integral invariants previously established (pointer_from_objref is lowered to a ptrtoint instruction here). This pass typically occupies the most time out of all the custom Julia passes, due to its dataflow algorithm to minimize the number of objects live at any safepoint.

FinalGCLowering

  • Filename: llvm-final-gc-lowering.cpp
  • Class Name: FinalLowerGCPass
  • Opt Name: module(FinalLowerGC)

This pass lowers a few last intrinsics to their final form targeting functions in the libjulia library. Separating this from LateGCLowering enables other backends (GPU compilation) to supply their own custom lowerings for these intrinsics, enabling the Julia pipeline to be used on those backends as well.

LowerHandlers

  • Filename: llvm-lower-handlers.cpp
  • Class Name: LowerExcHandlersPass
  • Opt Name: function(LowerExcHandlers)

This pass lowers exception handling intrinsics into calls to runtime functions that are actually called when handling exceptions.

RemoveNI

  • Filename: llvm-remove-ni.cpp
  • Class Name: RemoveNIPass
  • Opt Name: module(RemoveNI)

This pass removes the non-integral address spaces from the module's datalayout string. This enables the backend to lower Julia's custom address spaces directly to machine code, without a costly rewrite of every pointer operation to address space 0.

SIMDLoop

  • Filename: llvm-simdloop.cpp
  • Class Name: LowerSIMDLoopPass
  • Opt Name: loop(LowerSIMDLoop)

This pass acts as the main driver of the @simd annotation. Codegen inserts a !llvm.loopid marker at the back branch of a loop, which this pass uses to identify loops that were originally marked with @simd. Then, this pass looks for a chain of floating point operations that form a reduce and adds the contract and reassoc fast math flags to allow reassociation (and thus vectorization). This pass does not preserve either loop information nor inference correctness, so it may violate Julia semantics in surprising ways. If the loop was annotated with ivdep as well, then the pass marks the loop as having no loop-carried dependencies (the resulting behavior is undefined if the user annotation was incorrect or gets applied to the wrong loop).

LowerPTLS

  • Filename: llvm-ptls.cpp
  • Class Name: LowerPTLSPass
  • Opt Name: module(LowerPTLSPass)

This pass lowers thread-local Julia intrinsics to assembly instructions. Julia relies on thread-local storage for garbage collection and multithreading task scheduling. When compiling code for system images and package images, this pass replaces calls to intrinsics with loads from global variables that are initialized at load time.

If codegen produces a function with a swiftself argument and calling convention, this pass assumes the swiftself argument is the pgcstack and will replace the intrinsics with that argument. Doing so provides speedups on architectures that have slow thread local storage accesses.

RemoveAddrspaces

  • Filename: llvm-remove-addrspaces.cpp
  • Class Name: RemoveAddrspacesPass
  • Opt Name: module(RemoveAddrspaces)

This pass renames pointers in one address space to another address space. This is used to remove Julia-specific address spaces from LLVM IR.

RemoveJuliaAddrspaces

  • Filename: llvm-remove-addrspaces.cpp
  • Class Name: RemoveJuliaAddrspacesPass
  • Opt Name: module(RemoveJuliaAddrspaces)

This pass removes Julia-specific address spaces from LLVM IR. It is mostly used for displaying LLVM IR in a less cluttered format. Internally, it is implemented off the RemoveAddrspaces pass.

Multiversioning

  • Filename: llvm-multiversioning.cpp
  • Class Name: MultiVersioningPass
  • Opt Name: module(JuliaMultiVersioning)

This pass performs modifications to a module to create functions that are optimized for running on different architectures (see sysimg.md and pkgimg.md for more details). Implementation-wise, it clones functions and applies different target-specific attributes to them to allow the optimizer to use advanced features such as vectorization and instruction scheduling for that platform. It also creates some infrastructure to enable the Julia image loader to select the appropriate version of the function to call based on the architecture the loader is running on. The target-specific attributes are controlled by the julia.mv.specs module flag, which during compilation is derived from the JULIA_CPU_TARGET environment variable. The pass must also be enabled by providing a julia.mv.enable module flag with a value of 1.

Warning

Use of llvmcall with multiversioning is dangerous. llvmcall enables access to features not typically exposed by the Julia APIs, and are therefore usually not available on all architectures. If multiversioning is enabled and code generation is requested for a target architecture that does not support the feature required by an llvmcall expression, LLVM will probably error out, likely with an abort and the message LLVM ERROR: Do not know how to split the result of this operator!.

GCInvariantVerifier

  • Filename: llvm-gc-invariant-verifier.cpp
  • Class Name: GCInvariantVerifierPass
  • Opt Name: module(GCInvariantVerifier)

This pass is used to verify Julia's invariants about LLVM IR. This includes things such as the nonexistence of ptrtoint in Julia's non-integral address spaces [nislides] and the existence of only blessed addrspacecast instructions (Tracked -> Derived, 0 -> Tracked, etc). It performs no transformations on IR.

Optimization Passes

These passes are used to perform transformations on LLVM IR that LLVM will not perform itself, e.g. fast math flag propagation, escape analysis, and optimizations on Julia-specific internal functions. They use knowledge about Julia's semantics to perform these optimizations.

AllocOpt

  • Filename: llvm-alloc-opt.cpp
  • Class Name: AllocOptPass
  • Opt Name: function(AllocOpt)

Julia does not have the concept of a program stack as a place to allocate mutable objects. However, allocating objects on the stack reduces GC pressure and is critical for GPU compilation. Thus, AllocOpt performs heap to stack conversion of objects that it can prove do not escape the current function. It also performs a number of other optimizations on allocations, such as removing allocations that are never used, optimizing typeof calls to freshly allocated objects, and removing stores to allocations that are immediately overwritten. The escape analysis implementation is located in llvm-alloc-helpers.cpp. Currently, this pass does not use information from EscapeAnalysis.jl, though that may change in the future.

PropagateJuliaAddrspaces

  • Filename: llvm-propagate-addrspaces.cpp
  • Class Name: PropagateJuliaAddrspacesPass
  • Opt Name: function(PropagateJuliaAddrspaces)

This pass is used to propagate Julia-specific address spaces through operations on pointers. LLVM is not allowed to introduce or remove addrspacecast instructions by optimizations, so this pass acts to eliminate redundant addrspace casts by replacing operations with their equivalent in a Julia address space. For more information on Julia's address spaces, see (TODO link to llvm.md).

JuliaLICM

  • Filename: llvm-julia-licm.cpp
  • Class Name: JuliaLICMPass
  • Opt Name: loop(JuliaLICM)

This pass is used to hoist Julia-specific intrinsics out of loops. Specifically, it performs the following transformations:

  1. Hoist gc_preserve_begin and sink gc_preserve_end out of loops when the preserved objects are loop-invariant.
    1. Since objects preserved within a loop are likely preserved for the duration of the loop, this transformation can reduce the number of gc_preserve_begin/gc_preserve_end pairs in the IR. This makes it easier for the LateLowerGCPass to identify where particular objects are preserved.
  2. Hoist write barriers with invariant objects
    1. Here we assume that there are only two generations that an object can be a part of. Given that, a write barrier needs to only execute once for any pair of the same object. Thus, we can hoist write barriers out of loops when the object being written to is loop-invariant.
  3. Hoist allocations out of loops when they do not escape the loop
    1. We use a very conservative definition of escape here, the same as the one used in AllocOptPass. This transformation can reduce the number of allocations in the IR, even when an allocation escapes the function altogether.
Note

This pass is required to preserve LLVM's MemorySSA (Short Video, Longer Video) and ScalarEvolution (Newer Slides Older Slides) analyses.

  • nislideshttps://llvm.org/devmtg/2015-02/slides/chisnall-pointers-not-int.pdf
diff --git a/en/v1.12-dev/devdocs/llvm/index.html b/en/v1.12-dev/devdocs/llvm/index.html index b195ffb831b..e76a05082cc 100644 --- a/en/v1.12-dev/devdocs/llvm/index.html +++ b/en/v1.12-dev/devdocs/llvm/index.html @@ -18,4 +18,4 @@ error("An error occurred") end

During constant folding, LLVM may discover that the condition is always false, and can remove the basic block. However, if GC root lowering is done early, the GC root slots used in the deleted block, as well as any values kept alive in those slots only because they were used in the error path, would be kept alive by LLVM. By doing GC root lowering late, we give LLVM the license to do any of its usual optimizations (constant folding, dead code elimination, etc.), without having to worry (too much) about which values may or may not be GC tracked.

However, in order to be able to do late GC root placement, we need to be able to identify a) which pointers are GC tracked and b) all uses of such pointers. The goal of the GC placement pass is thus simple:

Minimize the number of needed GC roots/stores to them subject to the constraint that at every safepoint, any live GC-tracked pointer (i.e. for which there is a path after this point that contains a use of this pointer) is in some GC slot.

Representation

The primary difficulty is thus choosing an IR representation that allows us to identify GC-tracked pointers and their uses, even after the program has been run through the optimizer. Our design makes use of three LLVM features to achieve this:

Custom address spaces allow us to tag every point with an integer that needs to be preserved through optimizations. The compiler may not insert casts between address spaces that did not exist in the original program and it must never change the address space of a pointer on a load/store/etc operation. This allows us to annotate which pointers are GC-tracked in an optimizer-resistant way. Note that metadata would not be able to achieve the same purpose. Metadata is supposed to always be discardable without altering the semantics of the program. However, failing to identify a GC-tracked pointer alters the resulting program behavior dramatically - it'll probably crash or return wrong results. We currently use three different address spaces (their numbers are defined in src/codegen_shared.cpp):

Invariants

The GC root placement pass makes use of several invariants, which need to be observed by the frontend and are preserved by the optimizer.

First, only the following address space casts are allowed:

Now let us consider what constitutes a use:

We explicitly allow load/stores and simple calls in address spaces Tracked/Derived. Elements of jlcall argument arrays must always be in address space Tracked (it is required by the ABI that they are valid jl_value_t* pointers). The same is true for return instructions (though note that struct return arguments are allowed to have any of the address spaces). The only allowable use of an address space CalleeRooted pointer is to pass it to a call (which must have an appropriately typed operand).

Further, we disallow getelementptr in addrspace Tracked. This is because unless the operation is a noop, the resulting pointer will not be validly storable to a GC slot and may thus not be in this address space. If such a pointer is required, it should be decayed to addrspace Derived first.

Lastly, we disallow inttoptr/ptrtoint instructions in these address spaces. Having these instructions would mean that some i64 values are really GC tracked. This is problematic, because it breaks that stated requirement that we're able to identify GC-relevant pointers. This invariant is accomplished using the LLVM "non-integral pointers" feature, which is new in LLVM 5.0. It prohibits the optimizer from making optimizations that would introduce these operations. Note we can still insert static constants at JIT time by using inttoptr in address space 0 and then decaying to the appropriate address space afterwards.

Supporting ccall

One important aspect missing from the discussion so far is the handling of ccall. ccall has the peculiar feature that the location and scope of a use do not coincide. As an example consider:

A = randn(1024)
 ccall(:foo, Cvoid, (Ptr{Float64},), A)

In lowering, the compiler will insert a conversion from the array to the pointer which drops the reference to the array value. However, we of course need to make sure that the array does stay alive while we're doing the ccall. To understand how this is done, lets look at a hypothetical approximate possible lowering of the above code:

return $(Expr(:foreigncall, :(:foo), Cvoid, svec(Ptr{Float64}), 0, :(:ccall), Expr(:foreigncall, :(:jl_array_ptr), Ptr{Float64}, svec(Any), 0, :(:ccall), :(A)), :(A)))

The last :(A), is an extra argument list inserted during lowering that informs the code generator which Julia level values need to be kept alive for the duration of this ccall. We then take this information and represent it in an "operand bundle" at the IR level. An operand bundle is essentially a fake use that is attached to the call site. At the IR level, this looks like so:

call void inttoptr (i64 ... to void (double*)*)(double* %5) [ "jl_roots"(%jl_value_t addrspace(10)* %A) ]

The GC root placement pass will treat the jl_roots operand bundle as if it were a regular operand. However, as a final step, after the GC roots are inserted, it will drop the operand bundle to avoid confusing instruction selection.

Supporting pointer_from_objref

pointer_from_objref is special because it requires the user to take explicit control of GC rooting. By our above invariants, this function is illegal, because it performs an address space cast from 10 to 0. However, it can be useful, in certain situations, so we provide a special intrinsic:

declared %jl_value_t *julia.pointer_from_objref(%jl_value_t addrspace(10)*)

which is lowered to the corresponding address space cast after GC root lowering. Do note however that by using this intrinsic, the caller assumes all responsibility for making sure that the value in question is rooted. Further this intrinsic is not considered a use, so the GC root placement pass will not provide a GC root for the function. As a result, the external rooting must be arranged while the value is still tracked by the system. I.e. it is not valid to attempt to use the result of this operation to establish a global root - the optimizer may have already dropped the value.

Keeping values alive in the absence of uses

In certain cases it is necessary to keep an object alive, even though there is no compiler-visible use of said object. This may be case for low level code that operates on the memory-representation of an object directly or code that needs to interface with C code. In order to allow this, we provide the following intrinsics at the LLVM level:

token @llvm.julia.gc_preserve_begin(...)
-void @llvm.julia.gc_preserve_end(token)

(The llvm. in the name is required in order to be able to use the token type). The semantics of these intrinsics are as follows: At any safepoint that is dominated by a gc_preserve_begin call, but that is not not dominated by a corresponding gc_preserve_end call (i.e. a call whose argument is the token returned by a gc_preserve_begin call), the values passed as arguments to that gc_preserve_begin will be kept live. Note that the gc_preserve_begin still counts as a regular use of those values, so the standard lifetime semantics will ensure that the values will be kept alive before entering the preserve region.

+void @llvm.julia.gc_preserve_end(token)

(The llvm. in the name is required in order to be able to use the token type). The semantics of these intrinsics are as follows: At any safepoint that is dominated by a gc_preserve_begin call, but that is not not dominated by a corresponding gc_preserve_end call (i.e. a call whose argument is the token returned by a gc_preserve_begin call), the values passed as arguments to that gc_preserve_begin will be kept live. Note that the gc_preserve_begin still counts as a regular use of those values, so the standard lifetime semantics will ensure that the values will be kept alive before entering the preserve region.

diff --git a/en/v1.12-dev/devdocs/locks/index.html b/en/v1.12-dev/devdocs/locks/index.html index e6594627e1f..286198e8772 100644 --- a/en/v1.12-dev/devdocs/locks/index.html +++ b/en/v1.12-dev/devdocs/locks/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Proper maintenance and care of multi-threading locks

The following strategies are used to ensure that the code is dead-lock free (generally by addressing the 4th Coffman condition: circular wait).

  1. structure code such that only one lock will need to be acquired at a time
  2. always acquire shared locks in the same order, as given by the table below
  3. avoid constructs that expect to need unrestricted recursion

Locks

Below are all of the locks that exist in the system and the mechanisms for using them that avoid the potential for deadlocks (no Ostrich algorithm allowed here):

The following are definitely leaf locks (level 1), and must not try to acquire any other lock:

  • safepoint

    Note that this lock is acquired implicitly by JL_LOCK and JL_UNLOCK. use the _NOGC variants to avoid that for level 1 locks.

    While holding this lock, the code must not do any allocation or hit any safepoints. Note that there are safepoints when doing allocation, enabling / disabling GC, entering / restoring exception frames, and taking / releasing locks.

  • shared_map

  • finalizers

  • pagealloc

  • gcpermlock

  • flisp

  • jlinstackwalk (Win32)

  • ResourcePool<?>::mutex

  • RLST_mutex

  • llvmprintingmutex

  • jllockedstream::mutex

  • debuginfo_asyncsafe

  • inferencetimingmutex

  • ExecutionEngine::SessionLock

    flisp itself is already threadsafe, this lock only protects the jl_ast_context_list_t pool likewise, the ResourcePool<?>::mutexes just protect the associated resource pool

The following is a leaf lock (level 2), and only acquires level 1 locks (safepoint) internally:

  • globalrootslock
  • Module->lock
  • JLDebuginfoPlugin::PluginMutex
  • newlyinferredmutex

The following is a level 3 lock, which can only acquire level 1 or level 2 locks internally:

  • Method->writelock
  • typecache

The following is a level 4 lock, which can only recurse to acquire level 1, 2, or 3 locks:

  • MethodTable->writelock

No Julia code may be called while holding a lock above this point.

orc::ThreadSafeContext (TSCtx) locks occupy a special spot in the locking hierarchy. They are used to protect LLVM's global non-threadsafe state, but there may be an arbitrary number of them. By default, all of these locks may be treated as level 5 locks for the purposes of comparing with the rest of the hierarchy. Acquiring a TSCtx should only be done from the JIT's pool of TSCtx's, and all locks on that TSCtx should be released prior to returning it to the pool. If multiple TSCtx locks must be acquired at the same time (due to recursive compilation), then locks should be acquired in the order that the TSCtxs were borrowed from the pool.

The following is a level 5 lock

  • JuliaOJIT::EmissionMutex

The following are a level 6 lock, which can only recurse to acquire locks at lower levels:

  • jlmodulesmutex

The following lock synchronizes IO operation. Be aware that doing any I/O (for example, printing warning messages or debug information) while holding any other lock listed above may result in pernicious and hard-to-find deadlocks. BE VERY CAREFUL!

  • iolock

  • Individual ThreadSynchronizers locks

    this may continue to be held after releasing the iolock, or acquired without it, but be very careful to never attempt to acquire the iolock while holding it

  • Libdl.LazyLibrary lock

The following is the root lock, meaning no other lock shall be held when trying to acquire it:

  • toplevel

    this should be held while attempting a top-level action (such as making a new type or defining a new method): trying to obtain this lock inside a staged function will cause a deadlock condition!

    additionally, it's unclear if any code can safely run in parallel with an arbitrary toplevel expression, so it may require all threads to get to a safepoint first

Broken Locks

The following locks are broken:

  • toplevel

    doesn't exist right now

    fix: create it

  • Module->lock

    This is vulnerable to deadlocks since it can't be certain it is acquired in sequence. Some operations (such as import_module) are missing a lock.

    fix: replace with jl_modules_mutex?

  • loading.jl: require and register_root_module

    This file potentially has numerous problems.

    fix: needs locks

Shared Global Data Structures

These data structures each need locks due to being shared mutable global state. It is the inverse list for the above lock priority list. This list does not include level 1 leaf resources due to their simplicity.

MethodTable modifications (def, cache) : MethodTable->writelock

Type declarations : toplevel lock

Type application : typecache lock

Global variable tables : Module->lock

Module serializer : toplevel lock

JIT & type-inference : codegen lock

MethodInstance/CodeInstance updates : Method->writelock

  • These are set at construction and immutable:
    • specTypes
    • sparam_vals
    • def
    • owner
  • Function pointers:
    • these transition once, from NULL to a value, which is coordinated internal to the JIT

Method : Method->writelock

  • roots array (serializer and codegen)
  • invoke / specializations / tfunc modifications
+

Proper maintenance and care of multi-threading locks

The following strategies are used to ensure that the code is dead-lock free (generally by addressing the 4th Coffman condition: circular wait).

  1. structure code such that only one lock will need to be acquired at a time
  2. always acquire shared locks in the same order, as given by the table below
  3. avoid constructs that expect to need unrestricted recursion

Locks

Below are all of the locks that exist in the system and the mechanisms for using them that avoid the potential for deadlocks (no Ostrich algorithm allowed here):

The following are definitely leaf locks (level 1), and must not try to acquire any other lock:

  • safepoint

    Note that this lock is acquired implicitly by JL_LOCK and JL_UNLOCK. use the _NOGC variants to avoid that for level 1 locks.

    While holding this lock, the code must not do any allocation or hit any safepoints. Note that there are safepoints when doing allocation, enabling / disabling GC, entering / restoring exception frames, and taking / releasing locks.

  • shared_map

  • finalizers

  • pagealloc

  • gcpermlock

  • flisp

  • jlinstackwalk (Win32)

  • ResourcePool<?>::mutex

  • RLST_mutex

  • llvmprintingmutex

  • jllockedstream::mutex

  • debuginfo_asyncsafe

  • inferencetimingmutex

  • ExecutionEngine::SessionLock

    flisp itself is already threadsafe, this lock only protects the jl_ast_context_list_t pool likewise, the ResourcePool<?>::mutexes just protect the associated resource pool

The following is a leaf lock (level 2), and only acquires level 1 locks (safepoint) internally:

  • globalrootslock
  • Module->lock
  • JLDebuginfoPlugin::PluginMutex
  • newlyinferredmutex

The following is a level 3 lock, which can only acquire level 1 or level 2 locks internally:

  • Method->writelock
  • typecache

The following is a level 4 lock, which can only recurse to acquire level 1, 2, or 3 locks:

  • MethodTable->writelock

No Julia code may be called while holding a lock above this point.

orc::ThreadSafeContext (TSCtx) locks occupy a special spot in the locking hierarchy. They are used to protect LLVM's global non-threadsafe state, but there may be an arbitrary number of them. By default, all of these locks may be treated as level 5 locks for the purposes of comparing with the rest of the hierarchy. Acquiring a TSCtx should only be done from the JIT's pool of TSCtx's, and all locks on that TSCtx should be released prior to returning it to the pool. If multiple TSCtx locks must be acquired at the same time (due to recursive compilation), then locks should be acquired in the order that the TSCtxs were borrowed from the pool.

The following is a level 5 lock

  • JuliaOJIT::EmissionMutex

The following are a level 6 lock, which can only recurse to acquire locks at lower levels:

  • jlmodulesmutex

The following lock synchronizes IO operation. Be aware that doing any I/O (for example, printing warning messages or debug information) while holding any other lock listed above may result in pernicious and hard-to-find deadlocks. BE VERY CAREFUL!

  • iolock

  • Individual ThreadSynchronizers locks

    this may continue to be held after releasing the iolock, or acquired without it, but be very careful to never attempt to acquire the iolock while holding it

  • Libdl.LazyLibrary lock

The following is the root lock, meaning no other lock shall be held when trying to acquire it:

  • toplevel

    this should be held while attempting a top-level action (such as making a new type or defining a new method): trying to obtain this lock inside a staged function will cause a deadlock condition!

    additionally, it's unclear if any code can safely run in parallel with an arbitrary toplevel expression, so it may require all threads to get to a safepoint first

Broken Locks

The following locks are broken:

  • toplevel

    doesn't exist right now

    fix: create it

  • Module->lock

    This is vulnerable to deadlocks since it can't be certain it is acquired in sequence. Some operations (such as import_module) are missing a lock.

    fix: replace with jl_modules_mutex?

  • loading.jl: require and register_root_module

    This file potentially has numerous problems.

    fix: needs locks

Shared Global Data Structures

These data structures each need locks due to being shared mutable global state. It is the inverse list for the above lock priority list. This list does not include level 1 leaf resources due to their simplicity.

MethodTable modifications (def, cache) : MethodTable->writelock

Type declarations : toplevel lock

Type application : typecache lock

Global variable tables : Module->lock

Module serializer : toplevel lock

JIT & type-inference : codegen lock

MethodInstance/CodeInstance updates : Method->writelock

  • These are set at construction and immutable:
    • specTypes
    • sparam_vals
    • def
    • owner
  • Function pointers:
    • these transition once, from NULL to a value, which is coordinated internal to the JIT

Method : Method->writelock

  • roots array (serializer and codegen)
  • invoke / specializations / tfunc modifications
diff --git a/en/v1.12-dev/devdocs/meta/index.html b/en/v1.12-dev/devdocs/meta/index.html index 36153b52059..c3e998b5739 100644 --- a/en/v1.12-dev/devdocs/meta/index.html +++ b/en/v1.12-dev/devdocs/meta/index.html @@ -12,4 +12,4 @@ Expr(:meta, :inline) x*(x+3) end -end

Base.pushmeta!(ex, tag::Union{Symbol,Expr}) appends :tag to the end of the :meta expression, creating a new :meta expression if necessary.

To use the metadata, you have to parse these :meta expressions. If your implementation can be performed within Julia, Base.popmeta! is very handy: Base.popmeta!(body, :symbol) will scan a function body expression (one without the function signature) for the first :meta expression containing :symbol, extract any arguments, and return a tuple (found::Bool, args::Array{Any}). If the metadata did not have any arguments, or :symbol was not found, the args array will be empty.

Not yet provided is a convenient infrastructure for parsing :meta expressions from C++.

+end

Base.pushmeta!(ex, tag::Union{Symbol,Expr}) appends :tag to the end of the :meta expression, creating a new :meta expression if necessary.

To use the metadata, you have to parse these :meta expressions. If your implementation can be performed within Julia, Base.popmeta! is very handy: Base.popmeta!(body, :symbol) will scan a function body expression (one without the function signature) for the first :meta expression containing :symbol, extract any arguments, and return a tuple (found::Bool, args::Array{Any}). If the metadata did not have any arguments, or :symbol was not found, the args array will be empty.

Not yet provided is a convenient infrastructure for parsing :meta expressions from C++.

diff --git a/en/v1.12-dev/devdocs/object/index.html b/en/v1.12-dev/devdocs/object/index.html index c6fa6591d87..d718e208b8f 100644 --- a/en/v1.12-dev/devdocs/object/index.html +++ b/en/v1.12-dev/devdocs/object/index.html @@ -24,4 +24,4 @@ jl_array_t *jl_alloc_array_1d(jl_value_t *atype, size_t nr); jl_array_t *jl_alloc_array_nd(jl_value_t *atype, size_t *dims, size_t ndims);

Note that many of these have alternative allocation functions for various special-purposes. The list here reflects the more common usages, but a more complete list can be found by reading the julia.h header file.

Internal to Julia, storage is typically allocated by newstruct() (or newobj() for the special types):

jl_value_t *newstruct(jl_value_t *type);
 jl_value_t *newobj(jl_value_t *type, size_t nfields);

And at the lowest level, memory is getting allocated by a call to the garbage collector (in gc-stock.c), then tagged with its type:

jl_value_t *jl_gc_allocobj(size_t nbytes);
-void jl_set_typeof(jl_value_t *v, jl_datatype_t *type);
Out of date Warning

The documentation and usage for the function jl_gc_allocobj may be out of date

Note that all objects are allocated in multiples of 4 bytes and aligned to the platform pointer size. Memory is allocated from a pool for smaller objects, or directly with malloc() for large objects.

Singleton Types

Singleton types have only one instance and no data fields. Singleton instances have a size of 0 bytes, and consist only of their metadata. e.g. nothing::Nothing.

See Singleton Types and Nothingness and missing values

+void jl_set_typeof(jl_value_t *v, jl_datatype_t *type);
Out of date Warning

The documentation and usage for the function jl_gc_allocobj may be out of date

Note that all objects are allocated in multiples of 4 bytes and aligned to the platform pointer size. Memory is allocated from a pool for smaller objects, or directly with malloc() for large objects.

Singleton Types

Singleton types have only one instance and no data fields. Singleton instances have a size of 0 bytes, and consist only of their metadata. e.g. nothing::Nothing.

See Singleton Types and Nothingness and missing values

diff --git a/en/v1.12-dev/devdocs/offset-arrays/index.html b/en/v1.12-dev/devdocs/offset-arrays/index.html index 80aa0389a80..11418bc7636 100644 --- a/en/v1.12-dev/devdocs/offset-arrays/index.html +++ b/en/v1.12-dev/devdocs/offset-arrays/index.html @@ -23,4 +23,4 @@ function Base.similar(f::Union{Function,DataType}, shape::Tuple{ZeroRange,Vararg{ZeroRange}}) # body -end

Both of these should allocate your custom array type.

Specializing reshape

Optionally, define a method

Base.reshape(A::AbstractArray, shape::Tuple{ZeroRange,Vararg{ZeroRange}}) = ...

and you can reshape an array so that the result has custom indices.

For objects that mimic AbstractArray but are not subtypes

has_offset_axes depends on having axes defined for the objects you call it on. If there is some reason you don't have an axes method defined for your object, consider defining a method

Base.has_offset_axes(obj::MyNon1IndexedArraylikeObject) = true

This will allow code that assumes 1-based indexing to detect a problem and throw a helpful error, rather than returning incorrect results or segfaulting julia.

Catching errors

If your new array type triggers errors in other code, one helpful debugging step can be to comment out @boundscheck in your getindex and setindex! implementation. This will ensure that every element access checks bounds. Or, restart julia with --check-bounds=yes.

In some cases it may also be helpful to temporarily disable size and length for your new array type, since code that makes incorrect assumptions frequently uses these functions.

+end

Both of these should allocate your custom array type.

Specializing reshape

Optionally, define a method

Base.reshape(A::AbstractArray, shape::Tuple{ZeroRange,Vararg{ZeroRange}}) = ...

and you can reshape an array so that the result has custom indices.

For objects that mimic AbstractArray but are not subtypes

has_offset_axes depends on having axes defined for the objects you call it on. If there is some reason you don't have an axes method defined for your object, consider defining a method

Base.has_offset_axes(obj::MyNon1IndexedArraylikeObject) = true

This will allow code that assumes 1-based indexing to detect a problem and throw a helpful error, rather than returning incorrect results or segfaulting julia.

Catching errors

If your new array type triggers errors in other code, one helpful debugging step can be to comment out @boundscheck in your getindex and setindex! implementation. This will ensure that every element access checks bounds. Or, restart julia with --check-bounds=yes.

In some cases it may also be helpful to temporarily disable size and length for your new array type, since code that makes incorrect assumptions frequently uses these functions.

diff --git a/en/v1.12-dev/devdocs/pkgimg/index.html b/en/v1.12-dev/devdocs/pkgimg/index.html index ffcec0cebd6..dda42f5a8ac 100644 --- a/en/v1.12-dev/devdocs/pkgimg/index.html +++ b/en/v1.12-dev/devdocs/pkgimg/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

Package Images

Julia package images provide object (native code) caches for Julia packages. They are similar to Julia's system image and support many of the same features. In fact the underlying serialization format is the same, and the system image is the base image that the package images are build against.

High-level overview

Package images are shared libraries that contain both code and data. Like .ji cache files, they are generated per package. The data section contains both global data (global variables in the package) as well as the necessary metadata about what methods and types are defined by the package. The code section contains native objects that cache the final output of Julia's LLVM-based compiler.

The command line option --pkgimages=no can be used to turn off object caching for this session. Note that this means that cache files have to likely be regenerated. See JULIA_MAX_NUM_PRECOMPILE_FILES for the upper limit of variants Julia caches per default.

Note

While the package images present themselves as native shared libraries, they are only an approximation thereof. You will not be able to link against them from a native program and they must be loaded from Julia.

Linking

Since the package images contain native code, we must run a linker over them before we can use them. You can set the environment variable JULIA_VERBOSE_LINKING to true to make the package image linking process verbose.

Furthermore, we cannot assume that the user has a working system linker installed. Therefore, Julia ships with LLD, the LLVM linker, to provide a working out of the box experience. In base/linking.jl, we implement a limited interface to be able to link package images on all supported platforms.

Quirks

Despite LLD being a multi-platform linker, it does not provide a consistent interface across platforms. Furthermore, it is meant to be used from clang or another compiler driver, we therefore reimplement some of the logic from llvm-project/clang/lib/Driver/ToolChains. Thankfully one can use lld -flavor to set lld to the right platform

Windows

To avoid having to deal with link.exe we use -flavor gnu, effectively turning lld into a cross-linker from a mingw32 environment. Windows DLLs are required to contain a _DllMainCRTStartup function and to minimize our dependence on mingw32 libraries, we inject a stub definition ourselves.

MacOS

Dynamic libraries on macOS need to link against -lSystem. On recent macOS versions, -lSystem is only available for linking when Xcode is available. To that effect we link with -undefined dynamic_lookup.

Package images optimized for multiple microarchitectures

Similar to multi-versioning for system images, package images support multi-versioning. If you are in a heterogeneous environment, with a unified cache, you can set the environment variable JULIA_CPU_TARGET=generic to multi-version the object caches.

Flags that impact package image creation and selection

These are the Julia command line flags that impact cache selection. Package images that were created with different flags will be rejected.

  • -g, --debug-info: Exact match required since it changes code generation.
  • --check-bounds: Exact match required since it changes code generation.
  • --inline: Exact match required since it changes code generation.
  • --pkgimages: To allow running without object caching enabled.
  • -O, --optimize: Reject package images generated for a lower optimization level, but allow for higher optimization levels to be loaded.
+

Package Images

Julia package images provide object (native code) caches for Julia packages. They are similar to Julia's system image and support many of the same features. In fact the underlying serialization format is the same, and the system image is the base image that the package images are build against.

High-level overview

Package images are shared libraries that contain both code and data. Like .ji cache files, they are generated per package. The data section contains both global data (global variables in the package) as well as the necessary metadata about what methods and types are defined by the package. The code section contains native objects that cache the final output of Julia's LLVM-based compiler.

The command line option --pkgimages=no can be used to turn off object caching for this session. Note that this means that cache files have to likely be regenerated. See JULIA_MAX_NUM_PRECOMPILE_FILES for the upper limit of variants Julia caches per default.

Note

While the package images present themselves as native shared libraries, they are only an approximation thereof. You will not be able to link against them from a native program and they must be loaded from Julia.

Linking

Since the package images contain native code, we must run a linker over them before we can use them. You can set the environment variable JULIA_VERBOSE_LINKING to true to make the package image linking process verbose.

Furthermore, we cannot assume that the user has a working system linker installed. Therefore, Julia ships with LLD, the LLVM linker, to provide a working out of the box experience. In base/linking.jl, we implement a limited interface to be able to link package images on all supported platforms.

Quirks

Despite LLD being a multi-platform linker, it does not provide a consistent interface across platforms. Furthermore, it is meant to be used from clang or another compiler driver, we therefore reimplement some of the logic from llvm-project/clang/lib/Driver/ToolChains. Thankfully one can use lld -flavor to set lld to the right platform

Windows

To avoid having to deal with link.exe we use -flavor gnu, effectively turning lld into a cross-linker from a mingw32 environment. Windows DLLs are required to contain a _DllMainCRTStartup function and to minimize our dependence on mingw32 libraries, we inject a stub definition ourselves.

MacOS

Dynamic libraries on macOS need to link against -lSystem. On recent macOS versions, -lSystem is only available for linking when Xcode is available. To that effect we link with -undefined dynamic_lookup.

Package images optimized for multiple microarchitectures

Similar to multi-versioning for system images, package images support multi-versioning. If you are in a heterogeneous environment, with a unified cache, you can set the environment variable JULIA_CPU_TARGET=generic to multi-version the object caches.

Flags that impact package image creation and selection

These are the Julia command line flags that impact cache selection. Package images that were created with different flags will be rejected.

  • -g, --debug-info: Exact match required since it changes code generation.
  • --check-bounds: Exact match required since it changes code generation.
  • --inline: Exact match required since it changes code generation.
  • --pkgimages: To allow running without object caching enabled.
  • -O, --optimize: Reject package images generated for a lower optimization level, but allow for higher optimization levels to be loaded.
diff --git a/en/v1.12-dev/devdocs/precompile_hang/index.html b/en/v1.12-dev/devdocs/precompile_hang/index.html index 0d144f05956..a34242ca404 100644 --- a/en/v1.12-dev/devdocs/precompile_hang/index.html +++ b/en/v1.12-dev/devdocs/precompile_hang/index.html @@ -14,4 +14,4 @@ MWE\Project.toml MWE\src\MWE.jl

where the source code of MWE.jl is

module MWE
 using ThePackageYouThinkIsCausingTheProblem
-end

and you've added ThePackageYouThinkIsCausingTheProblem to MWE's dependencies.

If that MWE reproduces the hang, you've found your culprit: ThePackageYouThinkIsCausingTheProblem.__init__ must be creating the Timer object. If the timer object can be safely closed, that's a good option. Otherwise, the most common solution is to avoid creating the timer while any package is being precompiled: add

ccall(:jl_generating_output, Cint, ()) == 1 && return nothing

as the first line of ThePackageYouThinkIsCausingTheProblem.__init__, and it will avoid doing any initialization in any Julia process whose purpose is to precompile packages.

Fixing package code to avoid hangs

Search your package for suggestive words (here like "Timer") and see if you can identify where the problem is being created. Note that a method definition like

maketimer() = Timer(timer -> println("hi"), 0; interval=1)

is not problematic in and of itself: it can cause this problem only if maketimer gets called while the module is being defined. This might be happening from a top-level statement such as

const GLOBAL_TIMER = maketimer()

or it might conceivably occur in a precompile workload.

If you struggle to identify the causative lines, then consider doing a binary search: comment out sections of your package (or include lines to omit entire files) until you've reduced the problem in scope.

+end

and you've added ThePackageYouThinkIsCausingTheProblem to MWE's dependencies.

If that MWE reproduces the hang, you've found your culprit: ThePackageYouThinkIsCausingTheProblem.__init__ must be creating the Timer object. If the timer object can be safely closed, that's a good option. Otherwise, the most common solution is to avoid creating the timer while any package is being precompiled: add

ccall(:jl_generating_output, Cint, ()) == 1 && return nothing

as the first line of ThePackageYouThinkIsCausingTheProblem.__init__, and it will avoid doing any initialization in any Julia process whose purpose is to precompile packages.

Fixing package code to avoid hangs

Search your package for suggestive words (here like "Timer") and see if you can identify where the problem is being created. Note that a method definition like

maketimer() = Timer(timer -> println("hi"), 0; interval=1)

is not problematic in and of itself: it can cause this problem only if maketimer gets called while the module is being defined. This might be happening from a top-level statement such as

const GLOBAL_TIMER = maketimer()

or it might conceivably occur in a precompile workload.

If you struggle to identify the causative lines, then consider doing a binary search: comment out sections of your package (or include lines to omit entire files) until you've reduced the problem in scope.

diff --git a/en/v1.12-dev/devdocs/probes/index.html b/en/v1.12-dev/devdocs/probes/index.html index bf4b48e65a1..66db2dad0e8 100644 --- a/en/v1.12-dev/devdocs/probes/index.html +++ b/en/v1.12-dev/devdocs/probes/index.html @@ -108,4 +108,4 @@ Thread wake up! 3e312190

Even though we only spawned a single task (which only one thread could process at a time), we woke up all of our other threads! In the future, a smarter task runtime might only wake up a single thread (or none at all; the spawning thread could execute this task!), and we should see this behavior go away.

Task Monitor with BPFnative.jl

BPFnative.jl is able to attach to USDT probe points just like bpftrace. There is a demo available for monitoring the task runtime, GC, and thread sleep/wake transitions here.

Notes on using bpftrace

An example probe in the bpftrace format looks like:

usdt:usr/lib/libjulia-internal.so:julia:gc__begin
 {
   @start[pid] = nsecs;
-}

The probe declaration takes the kind usdt, then either the path to the library or the PID, the provider name julia and the probe name gc__begin. Note that I am using a relative path to the libjulia-internal.so, but this might need to be an absolute path on a production system.

Useful references:

+}

The probe declaration takes the kind usdt, then either the path to the library or the PID, the provider name julia and the probe name gc__begin. Note that I am using a relative path to the libjulia-internal.so, but this might need to be an absolute path on a production system.

Useful references:

diff --git a/en/v1.12-dev/devdocs/require/index.html b/en/v1.12-dev/devdocs/require/index.html index 3d91ccd90ca..01dc5666ac6 100644 --- a/en/v1.12-dev/devdocs/require/index.html +++ b/en/v1.12-dev/devdocs/require/index.html @@ -9,4 +9,4 @@ julia> loaded_packages 1-element Vector{Base.PkgId}: - Example [7876af07-990d-54b4-ab0e-23690620f79a] + Example [7876af07-990d-54b4-ab0e-23690620f79a] diff --git a/en/v1.12-dev/devdocs/sanitizers/index.html b/en/v1.12-dev/devdocs/sanitizers/index.html index 1a6dd8e8d14..0c48b529fee 100644 --- a/en/v1.12-dev/devdocs/sanitizers/index.html +++ b/en/v1.12-dev/devdocs/sanitizers/index.html @@ -38,4 +38,4 @@ # tell libblastrampoline to not use RTLD_DEEPBIND export LBT_USE_RTLD_DEEPBIND=0

Run:

cd $BUILD_WORKTREE
-make debug

to build julia-debug with ASAN.

Memory Sanitizer (MSAN)

For detecting use of uninitialized memory, you can use Clang's memory sanitizer (MSAN) by compiling with SANITIZE_MEMORY=1.

Thread Sanitizer (TSAN)

For debugging data-races and other threading related issues you can use Clang's thread sanitizer (TSAN) by compiling with SANITIZE_THREAD=1.

+make debug

to build julia-debug with ASAN.

Memory Sanitizer (MSAN)

For detecting use of uninitialized memory, you can use Clang's memory sanitizer (MSAN) by compiling with SANITIZE_MEMORY=1.

Thread Sanitizer (TSAN)

For debugging data-races and other threading related issues you can use Clang's thread sanitizer (TSAN) by compiling with SANITIZE_THREAD=1.

diff --git a/en/v1.12-dev/devdocs/ssair/index.html b/en/v1.12-dev/devdocs/ssair/index.html index c4c6891933f..42adec39f9d 100644 --- a/en/v1.12-dev/devdocs/ssair/index.html +++ b/en/v1.12-dev/devdocs/ssair/index.html @@ -74,4 +74,4 @@ 5 ─ $(Expr(:pop_exception, :(%2)))::Any │ $(Expr(:throw_undef_if_not, :y, :(%13)))::Any │ %19 = Core.tuple(%15, %14) -└── return %19

Note in particular that every value live into the critical region gets an upsilon node at the top of the critical region. This is because catch blocks are considered to have an invisible control flow edge from outside the function. As a result, no SSA value dominates the catch blocks, and all incoming values have to come through a φᶜ node.

Main SSA data structure

The main SSAIR data structure is worthy of discussion. It draws inspiration from LLVM and Webkit's B3 IR. The core of the data structure is a flat vector of statements. Each statement is implicitly assigned an SSA value based on its position in the vector (i.e. the result of the statement at idx 1 can be accessed using SSAValue(1) etc). For each SSA value, we additionally maintain its type. Since, SSA values are definitionally assigned only once, this type is also the result type of the expression at the corresponding index. However, while this representation is rather efficient (since the assignments don't need to be explicitly encoded), it of course carries the drawback that order is semantically significant, so reorderings and insertions change statement numbers. Additionally, we do not keep use lists (i.e. it is impossible to walk from a def to all its uses without explicitly computing this map–def lists however are trivial since you can look up the corresponding statement from the index), so the LLVM-style RAUW (replace-all-uses-with) operation is unavailable.

Instead, we do the following:

There is a compact! function that compacts the above data structure by performing the insertion of nodes in the appropriate place, trivial copy propagation, and renaming of uses to any changed SSA values. However, the clever part of this scheme is that this compaction can be done lazily as part of the subsequent pass. Most optimization passes need to walk over the entire list of statements, performing analysis or modifications along the way. We provide an IncrementalCompact iterator that can be used to iterate over the statement list. It will perform any necessary compaction and return the new index of the node, as well as the node itself. It is legal at this point to walk def-use chains, as well as make any modifications or deletions to the IR (insertions are disallowed however).

The idea behind this arrangement is that, since the optimization passes need to touch the corresponding memory anyway and incur the corresponding memory access penalty, performing the extra housekeeping should have comparatively little overhead (and save the overhead of maintaining these data structures during IR modification).

+└── return %19

Note in particular that every value live into the critical region gets an upsilon node at the top of the critical region. This is because catch blocks are considered to have an invisible control flow edge from outside the function. As a result, no SSA value dominates the catch blocks, and all incoming values have to come through a φᶜ node.

Main SSA data structure

The main SSAIR data structure is worthy of discussion. It draws inspiration from LLVM and Webkit's B3 IR. The core of the data structure is a flat vector of statements. Each statement is implicitly assigned an SSA value based on its position in the vector (i.e. the result of the statement at idx 1 can be accessed using SSAValue(1) etc). For each SSA value, we additionally maintain its type. Since, SSA values are definitionally assigned only once, this type is also the result type of the expression at the corresponding index. However, while this representation is rather efficient (since the assignments don't need to be explicitly encoded), it of course carries the drawback that order is semantically significant, so reorderings and insertions change statement numbers. Additionally, we do not keep use lists (i.e. it is impossible to walk from a def to all its uses without explicitly computing this map–def lists however are trivial since you can look up the corresponding statement from the index), so the LLVM-style RAUW (replace-all-uses-with) operation is unavailable.

Instead, we do the following:

There is a compact! function that compacts the above data structure by performing the insertion of nodes in the appropriate place, trivial copy propagation, and renaming of uses to any changed SSA values. However, the clever part of this scheme is that this compaction can be done lazily as part of the subsequent pass. Most optimization passes need to walk over the entire list of statements, performing analysis or modifications along the way. We provide an IncrementalCompact iterator that can be used to iterate over the statement list. It will perform any necessary compaction and return the new index of the node, as well as the node itself. It is legal at this point to walk def-use chains, as well as make any modifications or deletions to the IR (insertions are disallowed however).

The idea behind this arrangement is that, since the optimization passes need to touch the corresponding memory anyway and incur the corresponding memory access penalty, performing the extra housekeeping should have comparatively little overhead (and save the overhead of maintaining these data structures during IR modification).

diff --git a/en/v1.12-dev/devdocs/stdio/index.html b/en/v1.12-dev/devdocs/stdio/index.html index e132d014b75..e076437fd20 100644 --- a/en/v1.12-dev/devdocs/stdio/index.html +++ b/en/v1.12-dev/devdocs/stdio/index.html @@ -18,4 +18,4 @@ jl_uv.c: -> int jl_uv_write(uv_stream_t *stream, ...) -> uv_write(uvw, stream, buf, ...)

printf() during initialization

The libuv streams relied upon by jl_printf() etc., are not available until midway through initialization of the runtime (see init.c, init_stdio()). Error messages or warnings that need to be printed before this are routed to the standard C library fwrite() function by the following mechanism:

In sys.c, the JL_STD* stream pointers are statically initialized to integer constants: STD*_FILENO (0, 1 and 2). In jl_uv.c the jl_uv_puts() function checks its uv_stream_t* stream argument and calls fwrite() if stream is set to STDOUT_FILENO or STDERR_FILENO.

This allows for uniform use of jl_printf() throughout the runtime regardless of whether or not any particular piece of code is reachable before initialization is complete.

Legacy ios.c library

The src/support/ios.c library is inherited from femtolisp. It provides cross-platform buffered file IO and in-memory temporary buffers.

ios.c is still used by:

Use of ios.c in these modules is mostly self-contained and separated from the libuv I/O system. However, there is one place where femtolisp calls through to jl_printf() with a legacy ios_t stream.

There is a hack in ios.h that makes the ios_t.bm field line up with the uv_stream_t.type and ensures that the values used for ios_t.bm to not overlap with valid UV_HANDLE_TYPE values. This allows uv_stream_t pointers to point to ios_t streams.

This is needed because jl_printf() caller jl_static_show() is passed an ios_t stream by femtolisp's fl_print() function. Julia's jl_uv_puts() function has special handling for this:

if (stream->type > UV_HANDLE_TYPE_MAX) {
     return ios_write((ios_t*)stream, str, n);
-}
+} diff --git a/en/v1.12-dev/devdocs/subarrays/index.html b/en/v1.12-dev/devdocs/subarrays/index.html index ca882316bca..cf5bae6fc03 100644 --- a/en/v1.12-dev/devdocs/subarrays/index.html +++ b/en/v1.12-dev/devdocs/subarrays/index.html @@ -66,4 +66,4 @@ 3 2

then A[2:2:4,:] does not have uniform stride, so we cannot guarantee efficient linear indexing. Since we have to base this decision based purely on types encoded in the parameters of the SubArray, S = view(A, 2:2:4, :) cannot implement efficient linear indexing.

A few details

+S = view(A, :, :, 1:1) # Appending extra indices is supported

Naively, you'd think you could just set S.parent = A and S.indices = (:,:,1:1), but supporting this dramatically complicates the reindexing process, especially for views of views. Not only do you need to dispatch on the types of the stored indices, but you need to examine whether a given index is the final one and "merge" any remaining stored indices together. This is not an easy task, and even worse: it's slow since it implicitly depends upon linear indexing.

Fortunately, this is precisely the computation that ReshapedArray performs, and it does so linearly if possible. Consequently, view ensures that the parent array is the appropriate dimensionality for the given indices by reshaping it if needed. The inner SubArray constructor ensures that this invariant is satisfied.

  • CartesianIndex and arrays thereof throw a nasty wrench into the reindex scheme. Recall that reindex simply dispatches on the type of the stored indices in order to determine how many passed indices should be used and where they should go. But with CartesianIndex, there's no longer a one-to-one correspondence between the number of passed arguments and the number of dimensions that they index into. If we return to the above example of Base.reindex(S1, S1.indices, (i, j)), you can see that the expansion is incorrect for i, j = CartesianIndex(), CartesianIndex(2,1). It should skip the CartesianIndex() entirely and return:

    (CartesianIndex(2,1)[1], S1.indices[2], S1.indices[3][CartesianIndex(2,1)[2]])

    Instead, though, we get:

    (CartesianIndex(), S1.indices[2], S1.indices[3][CartesianIndex(2,1)])

    Doing this correctly would require combined dispatch on both the stored and passed indices across all combinations of dimensionalities in an intractable manner. As such, reindex must never be called with CartesianIndex indices. Fortunately, the scalar case is easily handled by first flattening the CartesianIndex arguments to plain integers. Arrays of CartesianIndex, however, cannot be split apart into orthogonal pieces so easily. Before attempting to use reindex, view must ensure that there are no arrays of CartesianIndex in the argument list. If there are, it can simply "punt" by avoiding the reindex calculation entirely, constructing a nested SubArray with two levels of indirection instead.

  • diff --git a/en/v1.12-dev/devdocs/sysimg/index.html b/en/v1.12-dev/devdocs/sysimg/index.html index f8468d9981e..8e52a0b8377 100644 --- a/en/v1.12-dev/devdocs/sysimg/index.html +++ b/en/v1.12-dev/devdocs/sysimg/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    System Image Building

    Building the Julia system image

    Julia ships with a preparsed system image containing the contents of the Base module, named sys.ji. This file is also precompiled into a shared library called sys.{so,dll,dylib} on as many platforms as possible, so as to give vastly improved startup times. On systems that do not ship with a precompiled system image file, one can be generated from the source files shipped in Julia's DATAROOTDIR/julia/base folder.

    Julia will by default generate its system image on half of the available system threads. This may be controlled by the JULIA_IMAGE_THREADS environment variable.

    This operation is useful for multiple reasons. A user may:

    • Build a precompiled shared library system image on a platform that did not ship with one, thereby improving startup times.
    • Modify Base, rebuild the system image and use the new Base next time Julia is started.
    • Include a userimg.jl file that includes packages into the system image, thereby creating a system image that has packages embedded into the startup environment.

    The PackageCompiler.jl package contains convenient wrapper functions to automate this process.

    System image optimized for multiple microarchitectures

    The system image can be compiled simultaneously for multiple CPU microarchitectures under the same instruction set architecture (ISA). Multiple versions of the same function may be created with minimum dispatch point inserted into shared functions in order to take advantage of different ISA extensions or other microarchitecture features. The version that offers the best performance will be selected automatically at runtime based on available CPU features.

    Specifying multiple system image targets

    A multi-microarchitecture system image can be enabled by passing multiple targets during system image compilation. This can be done either with the JULIA_CPU_TARGET make option or with the -C command line option when running the compilation command manually. Multiple targets are separated by ; in the option string. The syntax for each target is a CPU name followed by multiple features separated by ,. All features supported by LLVM are supported and a feature can be disabled with a - prefix. (+ prefix is also allowed and ignored to be consistent with LLVM syntax). Additionally, a few special features are supported to control the function cloning behavior.

    Note

    It is good practice to specify either clone_all or base(<n>) for every target apart from the first one. This makes it explicit which targets have all functions cloned, and which targets are based on other targets. If this is not done, the default behavior is to not clone every function, and to use the first target's function definition as the fallback when not cloning a function.

    1. clone_all

      By default, only functions that are the most likely to benefit from the microarchitecture features will be cloned. When clone_all is specified for a target, however, all functions in the system image will be cloned for the target. The negative form -clone_all can be used to prevent the built-in heuristic from cloning all functions.

    2. base(<n>)

      Where <n> is a placeholder for a non-negative number (e.g. base(0), base(1)). By default, a partially cloned (i.e. not clone_all) target will use functions from the default target (first one specified) if a function is not cloned. This behavior can be changed by specifying a different base with the base(<n>) option. The nth target (0-based) will be used as the base target instead of the default (0th) one. The base target has to be either 0 or another clone_all target. Specifying a non-clone_all target as the base target will cause an error.

    3. opt_size

      This causes the function for the target to be optimized for size when there isn't a significant runtime performance impact. This corresponds to -Os GCC and Clang option.

    4. min_size

      This causes the function for the target to be optimized for size that might have a significant runtime performance impact. This corresponds to -Oz Clang option.

    As an example, at the time of this writing, the following string is used in the creation of the official x86_64 Julia binaries downloadable from julialang.org:

    generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)

    This creates a system image with three separate targets; one for a generic x86_64 processor, one with a sandybridge ISA (explicitly excluding xsaveopt) that explicitly clones all functions, and one targeting the haswell ISA, based off of the sandybridge sysimg version, and also excluding rdrnd. When a Julia implementation loads the generated sysimg, it will check the host processor for matching CPU capability flags, enabling the highest ISA level possible. Note that the base level (generic) requires the cx16 instruction, which is disabled in some virtualization software and must be enabled for the generic target to be loaded. Alternatively, a sysimg could be generated with the target generic,-cx16 for greater compatibility, however note that this may cause performance and stability problems in some code.

    Implementation overview

    This is a brief overview of different part involved in the implementation. See code comments for each components for more implementation details.

    1. System image compilation

      The parsing and cloning decision are done in src/processor*. We currently support cloning of function based on the present of loops, simd instructions, or other math operations (e.g. fastmath, fma, muladd). This information is passed on to src/llvm-multiversioning.cpp which does the actual cloning. In addition to doing the cloning and insert dispatch slots (see comments in MultiVersioning::runOnModule for how this is done), the pass also generates metadata so that the runtime can load and initialize the system image correctly. A detailed description of the metadata is available in src/processor.h.

    2. System image loading

      The loading and initialization of the system image is done in src/processor* by parsing the metadata saved during system image generation. Host feature detection and selection decision are done in src/processor_*.cpp depending on the ISA. The target selection will prefer exact CPU name match, larger vector register size, and larger number of features. An overview of this process is in src/processor.cpp.

    Trimming

    System images are typically quite large, since Base includes a lot of functionality, and by default system images also include several packages such as LinearAlgebra for convenience and backwards compatibility. Most programs will use only a fraction of the functions in these packages. Therefore it makes sense to build binaries that exclude unused functions to save space, referred to as "trimming".

    While the basic idea of trimming is sound, Julia has dynamic and reflective features that make it difficult (or impossible) to know in general which functions are unused. As an extreme example, consider code like

    getglobal(Base, Symbol(readchomp(stdin)))(1)

    This code reads a function name from stdin and calls the named function from Base on the value 1. In this case it is impossible to predict which function will be called, so no functions can reliably be considered "unused". With some noteworthy exceptions (Julia's own REPL being one of them), most real-world programs do not do things like this.

    Less extreme cases occur, for example, when there are type instabilities that make it impossible for the compiler to predict which method will be called. However, if code is well-typed and does not use reflection, a complete and (hopefully) relatively small set of needed methods can be determined, and the rest can be removed. The --trim command-line option requests this kind of compilation.

    When --trim is specified in a command used to build a system image, the compiler begins tracing calls starting at methods marked using Base.Experimental.entrypoint. If a call is too dynamic to reasonably narrow down the possible call targets, an error is given at compile time showing the location of the call. For testing purposes, it is possible to skip these errors by specifying --trim=unsafe or --trim=unsafe-warn. Then you will get a system image built, but it may crash at run time if needed code is not present.

    It typically makes sense to specify --strip-ir along with --trim, since trimmed binaries are fully compiled and therefore don't need Julia IR. At some point we may make --trim imply --strip-ir, but for now we have kept them orthogonal.

    To get the smallest possible binary, it will also help to specify --strip-metadata and run the Unix strip utility. However, those steps remove Julia-specific and native (DWARF format) debug info, respectively, and so will make debugging more difficult.

    Common problems

    • The Base global variables stdin, stdout, and stderr are non-constant and so their types are not known. All printing should use a specific IO object with a known type. The easiest substitution is to use print(Core.stdout, x) instead of print(x) or print(stdout, x).
    • Use tools like JET.jl, Cthulhu.jl, and/or SnoopCompile to identify failures of type-inference, and follow our Performance Tips to fix them.

    Compatibility concerns

    We have identified many small changes to Base that significantly increase the set of programs that can be reliably trimmed. Unfortunately some of those changes would be considered breaking, and so are only applied when trimming is requested (this is done by an external build script, currently maintained inside the test suite as contrib/juliac-buildscript.jl). Therefore in many cases trimming will require you to opt in to new variants of Base and some standard libraries.

    If you want to use trimming, it is important to set up continuous integration testing that performs a trimmed build and fully tests the resulting program. Fortunately, if your program successfully compiles with --trim then it is very likely to work the same as it did before. However, CI is needed to ensure that your program continues to build with trimming as you develop it.

    Package authors may wish to test that their package is "trimming safe", however this is impossible in general. Trimming is only expected to work given concrete entry points such as main() and library entry points meant to be called from outside Julia. For generic packages, existing tests for type stability like @inferred and JET.@report_call are about as close as you can get to checking trim compatibility.

    Trimming also introduces new compatibility issues between minor versions of Julia. At this time, we are not able to guarantee that a program that can be trimmed in one version of Julia can also be trimmed in all future versions of Julia. However, breakage of that kind is expected to be rare. We also plan to try to increase the set of programs that can be trimmed over time.

    +

    System Image Building

    Building the Julia system image

    Julia ships with a preparsed system image containing the contents of the Base module, named sys.ji. This file is also precompiled into a shared library called sys.{so,dll,dylib} on as many platforms as possible, so as to give vastly improved startup times. On systems that do not ship with a precompiled system image file, one can be generated from the source files shipped in Julia's DATAROOTDIR/julia/base folder.

    Julia will by default generate its system image on half of the available system threads. This may be controlled by the JULIA_IMAGE_THREADS environment variable.

    This operation is useful for multiple reasons. A user may:

    • Build a precompiled shared library system image on a platform that did not ship with one, thereby improving startup times.
    • Modify Base, rebuild the system image and use the new Base next time Julia is started.
    • Include a userimg.jl file that includes packages into the system image, thereby creating a system image that has packages embedded into the startup environment.

    The PackageCompiler.jl package contains convenient wrapper functions to automate this process.

    System image optimized for multiple microarchitectures

    The system image can be compiled simultaneously for multiple CPU microarchitectures under the same instruction set architecture (ISA). Multiple versions of the same function may be created with minimum dispatch point inserted into shared functions in order to take advantage of different ISA extensions or other microarchitecture features. The version that offers the best performance will be selected automatically at runtime based on available CPU features.

    Specifying multiple system image targets

    A multi-microarchitecture system image can be enabled by passing multiple targets during system image compilation. This can be done either with the JULIA_CPU_TARGET make option or with the -C command line option when running the compilation command manually. Multiple targets are separated by ; in the option string. The syntax for each target is a CPU name followed by multiple features separated by ,. All features supported by LLVM are supported and a feature can be disabled with a - prefix. (+ prefix is also allowed and ignored to be consistent with LLVM syntax). Additionally, a few special features are supported to control the function cloning behavior.

    Note

    It is good practice to specify either clone_all or base(<n>) for every target apart from the first one. This makes it explicit which targets have all functions cloned, and which targets are based on other targets. If this is not done, the default behavior is to not clone every function, and to use the first target's function definition as the fallback when not cloning a function.

    1. clone_all

      By default, only functions that are the most likely to benefit from the microarchitecture features will be cloned. When clone_all is specified for a target, however, all functions in the system image will be cloned for the target. The negative form -clone_all can be used to prevent the built-in heuristic from cloning all functions.

    2. base(<n>)

      Where <n> is a placeholder for a non-negative number (e.g. base(0), base(1)). By default, a partially cloned (i.e. not clone_all) target will use functions from the default target (first one specified) if a function is not cloned. This behavior can be changed by specifying a different base with the base(<n>) option. The nth target (0-based) will be used as the base target instead of the default (0th) one. The base target has to be either 0 or another clone_all target. Specifying a non-clone_all target as the base target will cause an error.

    3. opt_size

      This causes the function for the target to be optimized for size when there isn't a significant runtime performance impact. This corresponds to -Os GCC and Clang option.

    4. min_size

      This causes the function for the target to be optimized for size that might have a significant runtime performance impact. This corresponds to -Oz Clang option.

    As an example, at the time of this writing, the following string is used in the creation of the official x86_64 Julia binaries downloadable from julialang.org:

    generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)

    This creates a system image with three separate targets; one for a generic x86_64 processor, one with a sandybridge ISA (explicitly excluding xsaveopt) that explicitly clones all functions, and one targeting the haswell ISA, based off of the sandybridge sysimg version, and also excluding rdrnd. When a Julia implementation loads the generated sysimg, it will check the host processor for matching CPU capability flags, enabling the highest ISA level possible. Note that the base level (generic) requires the cx16 instruction, which is disabled in some virtualization software and must be enabled for the generic target to be loaded. Alternatively, a sysimg could be generated with the target generic,-cx16 for greater compatibility, however note that this may cause performance and stability problems in some code.

    Implementation overview

    This is a brief overview of different part involved in the implementation. See code comments for each components for more implementation details.

    1. System image compilation

      The parsing and cloning decision are done in src/processor*. We currently support cloning of function based on the present of loops, simd instructions, or other math operations (e.g. fastmath, fma, muladd). This information is passed on to src/llvm-multiversioning.cpp which does the actual cloning. In addition to doing the cloning and insert dispatch slots (see comments in MultiVersioning::runOnModule for how this is done), the pass also generates metadata so that the runtime can load and initialize the system image correctly. A detailed description of the metadata is available in src/processor.h.

    2. System image loading

      The loading and initialization of the system image is done in src/processor* by parsing the metadata saved during system image generation. Host feature detection and selection decision are done in src/processor_*.cpp depending on the ISA. The target selection will prefer exact CPU name match, larger vector register size, and larger number of features. An overview of this process is in src/processor.cpp.

    Trimming

    System images are typically quite large, since Base includes a lot of functionality, and by default system images also include several packages such as LinearAlgebra for convenience and backwards compatibility. Most programs will use only a fraction of the functions in these packages. Therefore it makes sense to build binaries that exclude unused functions to save space, referred to as "trimming".

    While the basic idea of trimming is sound, Julia has dynamic and reflective features that make it difficult (or impossible) to know in general which functions are unused. As an extreme example, consider code like

    getglobal(Base, Symbol(readchomp(stdin)))(1)

    This code reads a function name from stdin and calls the named function from Base on the value 1. In this case it is impossible to predict which function will be called, so no functions can reliably be considered "unused". With some noteworthy exceptions (Julia's own REPL being one of them), most real-world programs do not do things like this.

    Less extreme cases occur, for example, when there are type instabilities that make it impossible for the compiler to predict which method will be called. However, if code is well-typed and does not use reflection, a complete and (hopefully) relatively small set of needed methods can be determined, and the rest can be removed. The --trim command-line option requests this kind of compilation.

    When --trim is specified in a command used to build a system image, the compiler begins tracing calls starting at methods marked using Base.Experimental.entrypoint. If a call is too dynamic to reasonably narrow down the possible call targets, an error is given at compile time showing the location of the call. For testing purposes, it is possible to skip these errors by specifying --trim=unsafe or --trim=unsafe-warn. Then you will get a system image built, but it may crash at run time if needed code is not present.

    It typically makes sense to specify --strip-ir along with --trim, since trimmed binaries are fully compiled and therefore don't need Julia IR. At some point we may make --trim imply --strip-ir, but for now we have kept them orthogonal.

    To get the smallest possible binary, it will also help to specify --strip-metadata and run the Unix strip utility. However, those steps remove Julia-specific and native (DWARF format) debug info, respectively, and so will make debugging more difficult.

    Common problems

    • The Base global variables stdin, stdout, and stderr are non-constant and so their types are not known. All printing should use a specific IO object with a known type. The easiest substitution is to use print(Core.stdout, x) instead of print(x) or print(stdout, x).
    • Use tools like JET.jl, Cthulhu.jl, and/or SnoopCompile to identify failures of type-inference, and follow our Performance Tips to fix them.

    Compatibility concerns

    We have identified many small changes to Base that significantly increase the set of programs that can be reliably trimmed. Unfortunately some of those changes would be considered breaking, and so are only applied when trimming is requested (this is done by an external build script, currently maintained inside the test suite as contrib/juliac-buildscript.jl). Therefore in many cases trimming will require you to opt in to new variants of Base and some standard libraries.

    If you want to use trimming, it is important to set up continuous integration testing that performs a trimmed build and fully tests the resulting program. Fortunately, if your program successfully compiles with --trim then it is very likely to work the same as it did before. However, CI is needed to ensure that your program continues to build with trimming as you develop it.

    Package authors may wish to test that their package is "trimming safe", however this is impossible in general. Trimming is only expected to work given concrete entry points such as main() and library entry points meant to be called from outside Julia. For generic packages, existing tests for type stability like @inferred and JET.@report_call are about as close as you can get to checking trim compatibility.

    Trimming also introduces new compatibility issues between minor versions of Julia. At this time, we are not able to guarantee that a program that can be trimmed in one version of Julia can also be trimmed in all future versions of Julia. However, breakage of that kind is expected to be rare. We also plan to try to increase the set of programs that can be trimmed over time.

    diff --git a/en/v1.12-dev/devdocs/types/index.html b/en/v1.12-dev/devdocs/types/index.html index b422c542847..37aefb81d06 100644 --- a/en/v1.12-dev/devdocs/types/index.html +++ b/en/v1.12-dev/devdocs/types/index.html @@ -137,4 +137,4 @@ f(nothing, 2.0)

    These examples are telling us something: when x is nothing::Nothing, there are no extra constraints on y. It is as if the method signature had y::Any. Indeed, we have the following type equivalence:

    (Tuple{Union{Nothing,T},T} where T) == Union{Tuple{Nothing,Any}, Tuple{T,T} where T}

    The general rule is: a concrete variable in covariant position acts like it's not concrete if the subtyping algorithm only uses it once. When x has type Nothing, we don't need to use the T in Union{Nothing,T}; we only use it in the second slot. This arises naturally from the observation that in Tuple{T} where T restricting T to concrete types makes no difference; the type is equal to Tuple{Any} either way.

    However, appearing in invariant position disqualifies a variable from being concrete whether that appearance of the variable is used or not. Otherwise types can behave differently depending on which other types they are compared to, making subtyping not transitive. For example, consider

    Tuple{Int,Int8,Vector{Integer}} <: Tuple{T,T,Vector{Union{Integer,T}}} where T

    If the T inside the Union is ignored, then T is concrete and the answer is "false" since the first two types aren't the same. But consider instead

    Tuple{Int,Int8,Vector{Any}} <: Tuple{T,T,Vector{Union{Integer,T}}} where T

    Now we cannot ignore the T in the Union (we must have T == Any), so T is not concrete and the answer is "true". That would make the concreteness of T depend on the other type, which is not acceptable since a type must have a clear meaning on its own. Therefore the appearance of T inside Vector is considered in both cases.

    Subtyping diagonal variables

    The subtyping algorithm for diagonal variables has two components: (1) identifying variable occurrences, and (2) ensuring that diagonal variables range over concrete types only.

    The first task is accomplished by keeping counters occurs_inv and occurs_cov (in src/subtype.c) for each variable in the environment, tracking the number of invariant and covariant occurrences, respectively. A variable is diagonal when occurs_inv == 0 && occurs_cov > 1.

    The second task is accomplished by imposing a condition on a variable's lower bound. As the subtyping algorithm runs, it narrows the bounds of each variable (raising lower bounds and lowering upper bounds) to keep track of the range of variable values for which the subtype relation would hold. When we are done evaluating the body of a UnionAll type whose variable is diagonal, we look at the final values of the bounds. Since the variable must be concrete, a contradiction occurs if its lower bound could not be a subtype of a concrete type. For example, an abstract type like AbstractArray cannot be a subtype of a concrete type, but a concrete type like Int can be, and the empty type Bottom can be as well. If a lower bound fails this test the algorithm stops with the answer false.

    For example, in the problem Tuple{Int,String} <: Tuple{T,T} where T, we derive that this would be true if T were a supertype of Union{Int,String}. However, Union{Int,String} is an abstract type, so the relation does not hold.

    This concreteness test is done by the function is_leaf_bound. Note that this test is slightly different from jl_is_leaf_type, since it also returns true for Bottom. Currently this function is heuristic, and does not catch all possible concrete types. The difficulty is that whether a lower bound is concrete might depend on the values of other type variable bounds. For example, Vector{T} is equivalent to the concrete type Vector{Int} only if both the upper and lower bounds of T equal Int. We have not yet worked out a complete algorithm for this.

    Introduction to the internal machinery

    Most operations for dealing with types are found in the files jltypes.c and subtype.c. A good way to start is to watch subtyping in action. Build Julia with make debug and fire up Julia within a debugger. gdb debugging tips has some tips which may be useful.

    Because the subtyping code is used heavily in the REPL itself – and hence breakpoints in this code get triggered often – it will be easiest if you make the following definition:

    julia> function mysubtype(a,b)
                ccall(:jl_breakpoint, Cvoid, (Any,), nothing)
                a <: b
    -       end

    and then set a breakpoint in jl_breakpoint. Once this breakpoint gets triggered, you can set breakpoints in other functions.

    As a warm-up, try the following:

    mysubtype(Tuple{Int, Float64}, Tuple{Integer, Real})

    We can make it more interesting by trying a more complex case:

    mysubtype(Tuple{Array{Int,2}, Int8}, Tuple{Array{T}, T} where T)

    Subtyping and method sorting

    The type_morespecific functions are used for imposing a partial order on functions in method tables (from most-to-least specific). Specificity is strict; if a is more specific than b, then a does not equal b and b is not more specific than a.

    If a is a strict subtype of b, then it is automatically considered more specific. From there, type_morespecific employs some less formal rules. For example, subtype is sensitive to the number of arguments, but type_morespecific may not be. In particular, Tuple{Int,AbstractFloat} is more specific than Tuple{Integer}, even though it is not a subtype. (Of Tuple{Int,AbstractFloat} and Tuple{Integer,Float64}, neither is more specific than the other.) Likewise, Tuple{Int,Vararg{Int}} is not a subtype of Tuple{Integer}, but it is considered more specific. However, morespecific does get a bonus for length: in particular, Tuple{Int,Int} is more specific than Tuple{Int,Vararg{Int}}.

    Additionally, if 2 methods are defined with identical signatures, per type-equal, then they will instead by compared by order of addition, such that the later method is more specific than the earlier one.

    + end

    and then set a breakpoint in jl_breakpoint. Once this breakpoint gets triggered, you can set breakpoints in other functions.

    As a warm-up, try the following:

    mysubtype(Tuple{Int, Float64}, Tuple{Integer, Real})

    We can make it more interesting by trying a more complex case:

    mysubtype(Tuple{Array{Int,2}, Int8}, Tuple{Array{T}, T} where T)

    Subtyping and method sorting

    The type_morespecific functions are used for imposing a partial order on functions in method tables (from most-to-least specific). Specificity is strict; if a is more specific than b, then a does not equal b and b is not more specific than a.

    If a is a strict subtype of b, then it is automatically considered more specific. From there, type_morespecific employs some less formal rules. For example, subtype is sensitive to the number of arguments, but type_morespecific may not be. In particular, Tuple{Int,AbstractFloat} is more specific than Tuple{Integer}, even though it is not a subtype. (Of Tuple{Int,AbstractFloat} and Tuple{Integer,Float64}, neither is more specific than the other.) Likewise, Tuple{Int,Vararg{Int}} is not a subtype of Tuple{Integer}, but it is considered more specific. However, morespecific does get a bonus for length: in particular, Tuple{Int,Int} is more specific than Tuple{Int,Vararg{Int}}.

    Additionally, if 2 methods are defined with identical signatures, per type-equal, then they will instead by compared by order of addition, such that the later method is more specific than the earlier one.

    diff --git a/en/v1.12-dev/devdocs/valgrind/index.html b/en/v1.12-dev/devdocs/valgrind/index.html index 456150798cf..b77e5a24401 100644 --- a/en/v1.12-dev/devdocs/valgrind/index.html +++ b/en/v1.12-dev/devdocs/valgrind/index.html @@ -7,4 +7,4 @@ --xxxxxx-- You may be able to write your own handler. --xxxxxx-- Read the file README_MISSING_SYSCALL_OR_IOCTL. --xxxxxx-- Nevertheless we consider this a bug. Please report ---xxxxxx-- it at http://valgrind.org/support/bug_reports.html.

    This issue has been reported to the Valgrind developers as they have requested.

    Caveats

    Valgrind currently does not support multiple rounding modes, so code that adjusts the rounding mode will behave differently when run under Valgrind.

    In general, if after setting --smc-check=all-non-file you find that your program behaves differently when run under Valgrind, it may help to pass --tool=none to valgrind as you investigate further. This will enable the minimal Valgrind machinery but will also run much faster than when the full memory checker is enabled.

    +--xxxxxx-- it at http://valgrind.org/support/bug_reports.html.

    This issue has been reported to the Valgrind developers as they have requested.

    Caveats

    Valgrind currently does not support multiple rounding modes, so code that adjusts the rounding mode will behave differently when run under Valgrind.

    In general, if after setting --smc-check=all-non-file you find that your program behaves differently when run under Valgrind, it may help to pass --tool=none to valgrind as you investigate further. This will enable the minimal Valgrind machinery but will also run much faster than when the full memory checker is enabled.

    diff --git a/en/v1.12-dev/index.html b/en/v1.12-dev/index.html index 88c2dffc4c1..1ab3de98a2c 100644 --- a/en/v1.12-dev/index.html +++ b/en/v1.12-dev/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Julia 1.12-DEV Documentation

    Welcome to the documentation for Julia 1.12-DEV.

    Work in progress!

    This documentation is for an unreleased, in-development, version of Julia.

    Please read the release notes to see what has changed since the last release.

    Note

    The documentation is also available in PDF format: julia-1.12.0-DEV.pdf.

    Below is a non-exhaustive list of links that will be useful as you learn and use the Julia programming language.

    Introduction

    Scientific computing has traditionally required the highest performance, yet domain experts have largely moved to slower dynamic languages for daily work. We believe there are many good reasons to prefer dynamic languages for these applications, and we do not expect their use to diminish. Fortunately, modern language design and compiler techniques make it possible to mostly eliminate the performance trade-off and provide a single environment productive enough for prototyping and efficient enough for deploying performance-intensive applications. The Julia programming language fills this role: it is a flexible dynamic language, appropriate for scientific and numerical computing, with performance comparable to traditional statically-typed languages.

    Because Julia's compiler is different from the interpreters used for languages like Python or R, you may find that Julia's performance is unintuitive at first. If you find that something is slow, we highly recommend reading through the Performance Tips section before trying anything else. Once you understand how Julia works, it is easy to write code that is nearly as fast as C.

    Julia Compared to Other Languages

    Julia features optional typing, multiple dispatch, and good performance, achieved using type inference and just-in-time (JIT) compilation (and optional ahead-of-time compilation), implemented using LLVM. It is multi-paradigm, combining features of imperative, functional, and object-oriented programming. Julia provides ease and expressiveness for high-level numerical computing, in the same way as languages such as R, MATLAB, and Python, but also supports general programming. To achieve this, Julia builds upon the lineage of mathematical programming languages, but also borrows much from popular dynamic languages, including Lisp, Perl, Python, Lua, and Ruby.

    The most significant departures of Julia from typical dynamic languages are:

    • The core language imposes very little; Julia Base and the standard library are written in Julia itself, including primitive operations like integer arithmetic
    • A rich language of types for constructing and describing objects, that can also optionally be used to make type declarations
    • The ability to define function behavior across many combinations of argument types via multiple dispatch
    • Automatic generation of efficient, specialized code for different argument types
    • Good performance, approaching that of statically-compiled languages like C

    Although one sometimes speaks of dynamic languages as being "typeless", they are definitely not. Every object, whether primitive or user-defined, has a type. The lack of type declarations in most dynamic languages, however, means that one cannot instruct the compiler about the types of values, and often cannot explicitly talk about types at all. In static languages, on the other hand, while one can – and usually must – annotate types for the compiler, types exist only at compile time and cannot be manipulated or expressed at run time. In Julia, types are themselves run-time objects, and can also be used to convey information to the compiler.

    What Makes Julia, Julia?

    While the casual programmer need not explicitly use types or multiple dispatch, they are the core unifying features of Julia: functions are defined on different combinations of argument types, and applied by dispatching to the most specific matching definition. This model is a good fit for mathematical programming, where it is unnatural for the first argument to "own" an operation as in traditional object-oriented dispatch. Operators are just functions with special notation – to extend addition to new user-defined data types, you define new methods for the + function. Existing code then seamlessly applies to the new data types.

    Partly because of run-time type inference (augmented by optional type annotations), and partly because of a strong focus on performance from the inception of the project, Julia's computational efficiency exceeds that of other dynamic languages, and even rivals that of statically-compiled languages. For large scale numerical problems, speed always has been, continues to be, and probably always will be crucial: the amount of data being processed has easily kept pace with Moore's Law over the past decades.

    Advantages of Julia

    Julia aims to create an unprecedented combination of ease-of-use, power, and efficiency in a single language. In addition to the above, some advantages of Julia over comparable systems include:

    • Free and open source (MIT licensed)
    • User-defined types are as fast and compact as built-ins
    • No need to vectorize code for performance; devectorized code is fast
    • Designed for parallelism and distributed computation
    • Lightweight "green" threading (coroutines)
    • Unobtrusive yet powerful type system
    • Elegant and extensible conversions and promotions for numeric and other types
    • Efficient support for Unicode, including but not limited to UTF-8
    • Call C functions directly (no wrappers or special APIs needed)
    • Powerful shell-like capabilities for managing other processes
    • Lisp-like macros and other metaprogramming facilities
    +

    Julia 1.12-DEV Documentation

    Welcome to the documentation for Julia 1.12-DEV.

    Work in progress!

    This documentation is for an unreleased, in-development, version of Julia.

    Please read the release notes to see what has changed since the last release.

    Note

    The documentation is also available in PDF format: julia-1.12.0-DEV.pdf.

    Below is a non-exhaustive list of links that will be useful as you learn and use the Julia programming language.

    Introduction

    Scientific computing has traditionally required the highest performance, yet domain experts have largely moved to slower dynamic languages for daily work. We believe there are many good reasons to prefer dynamic languages for these applications, and we do not expect their use to diminish. Fortunately, modern language design and compiler techniques make it possible to mostly eliminate the performance trade-off and provide a single environment productive enough for prototyping and efficient enough for deploying performance-intensive applications. The Julia programming language fills this role: it is a flexible dynamic language, appropriate for scientific and numerical computing, with performance comparable to traditional statically-typed languages.

    Because Julia's compiler is different from the interpreters used for languages like Python or R, you may find that Julia's performance is unintuitive at first. If you find that something is slow, we highly recommend reading through the Performance Tips section before trying anything else. Once you understand how Julia works, it is easy to write code that is nearly as fast as C.

    Julia Compared to Other Languages

    Julia features optional typing, multiple dispatch, and good performance, achieved using type inference and just-in-time (JIT) compilation (and optional ahead-of-time compilation), implemented using LLVM. It is multi-paradigm, combining features of imperative, functional, and object-oriented programming. Julia provides ease and expressiveness for high-level numerical computing, in the same way as languages such as R, MATLAB, and Python, but also supports general programming. To achieve this, Julia builds upon the lineage of mathematical programming languages, but also borrows much from popular dynamic languages, including Lisp, Perl, Python, Lua, and Ruby.

    The most significant departures of Julia from typical dynamic languages are:

    • The core language imposes very little; Julia Base and the standard library are written in Julia itself, including primitive operations like integer arithmetic
    • A rich language of types for constructing and describing objects, that can also optionally be used to make type declarations
    • The ability to define function behavior across many combinations of argument types via multiple dispatch
    • Automatic generation of efficient, specialized code for different argument types
    • Good performance, approaching that of statically-compiled languages like C

    Although one sometimes speaks of dynamic languages as being "typeless", they are definitely not. Every object, whether primitive or user-defined, has a type. The lack of type declarations in most dynamic languages, however, means that one cannot instruct the compiler about the types of values, and often cannot explicitly talk about types at all. In static languages, on the other hand, while one can – and usually must – annotate types for the compiler, types exist only at compile time and cannot be manipulated or expressed at run time. In Julia, types are themselves run-time objects, and can also be used to convey information to the compiler.

    What Makes Julia, Julia?

    While the casual programmer need not explicitly use types or multiple dispatch, they are the core unifying features of Julia: functions are defined on different combinations of argument types, and applied by dispatching to the most specific matching definition. This model is a good fit for mathematical programming, where it is unnatural for the first argument to "own" an operation as in traditional object-oriented dispatch. Operators are just functions with special notation – to extend addition to new user-defined data types, you define new methods for the + function. Existing code then seamlessly applies to the new data types.

    Partly because of run-time type inference (augmented by optional type annotations), and partly because of a strong focus on performance from the inception of the project, Julia's computational efficiency exceeds that of other dynamic languages, and even rivals that of statically-compiled languages. For large scale numerical problems, speed always has been, continues to be, and probably always will be crucial: the amount of data being processed has easily kept pace with Moore's Law over the past decades.

    Advantages of Julia

    Julia aims to create an unprecedented combination of ease-of-use, power, and efficiency in a single language. In addition to the above, some advantages of Julia over comparable systems include:

    • Free and open source (MIT licensed)
    • User-defined types are as fast and compact as built-ins
    • No need to vectorize code for performance; devectorized code is fast
    • Designed for parallelism and distributed computation
    • Lightweight "green" threading (coroutines)
    • Unobtrusive yet powerful type system
    • Elegant and extensible conversions and promotions for numeric and other types
    • Efficient support for Unicode, including but not limited to UTF-8
    • Call C functions directly (no wrappers or special APIs needed)
    • Powerful shell-like capabilities for managing other processes
    • Lisp-like macros and other metaprogramming facilities
    diff --git a/en/v1.12-dev/manual/arrays/index.html b/en/v1.12-dev/manual/arrays/index.html index 5062dbb2c0e..eadeaeecdfb 100644 --- a/en/v1.12-dev/manual/arrays/index.html +++ b/en/v1.12-dev/manual/arrays/index.html @@ -490,4 +490,4 @@ julia> stride(V, 1) 3

    This view is similarly selecting every other column from our original A — and thus it needs to skip the equivalent of two five-element columns when moving between indices in the second dimension:

    julia> stride(V, 2)
     10

    The third dimension is interesting because its order is reversed! Thus to get from the first "page" to the second one it must go backwards in memory, and so its stride in this dimension is negative!

    julia> stride(V, 3)
    --35

    This means that the pointer for V is actually pointing into the middle of A's memory block, and it refers to elements both backwards and forwards in memory. See the interface guide for strided arrays for more details on defining your own strided arrays. StridedVector and StridedMatrix are convenient aliases for many of the builtin array types that are considered strided arrays, allowing them to dispatch to select specialized implementations that call highly tuned and optimized BLAS and LAPACK functions using just the pointer and strides.

    It is worth emphasizing that strides are about offsets in memory rather than indexing. If you are looking to convert between linear (single-index) indexing and cartesian (multi-index) indexing, see LinearIndices and CartesianIndices.

    +-35

    This means that the pointer for V is actually pointing into the middle of A's memory block, and it refers to elements both backwards and forwards in memory. See the interface guide for strided arrays for more details on defining your own strided arrays. StridedVector and StridedMatrix are convenient aliases for many of the builtin array types that are considered strided arrays, allowing them to dispatch to select specialized implementations that call highly tuned and optimized BLAS and LAPACK functions using just the pointer and strides.

    It is worth emphasizing that strides are about offsets in memory rather than indexing. If you are looking to convert between linear (single-index) indexing and cartesian (multi-index) indexing, see LinearIndices and CartesianIndices.

    diff --git a/en/v1.12-dev/manual/asynchronous-programming/index.html b/en/v1.12-dev/manual/asynchronous-programming/index.html index b10a61be12c..afdf3fdadc2 100644 --- a/en/v1.12-dev/manual/asynchronous-programming/index.html +++ b/en/v1.12-dev/manual/asynchronous-programming/index.html @@ -127,4 +127,4 @@ 10 finished in 0.64 seconds 12 finished in 0.5 seconds 11 finished in 0.97 seconds -0.029772311

    Instead of errormonitor(t), a more robust solution may be to use bind(results, t), as that will not only log any unexpected failures, but also force the associated resources to close and propagate the exception everywhere.

    More task operations

    Task operations are built on a low-level primitive called yieldto. yieldto(task, value) suspends the current task, switches to the specified task, and causes that task's last yieldto call to return the specified value. Notice that yieldto is the only operation required to use task-style control flow; instead of calling and returning we are always just switching to a different task. This is why this feature is also called "symmetric coroutines"; each task is switched to and from using the same mechanism.

    yieldto is powerful, but most uses of tasks do not invoke it directly. Consider why this might be. If you switch away from the current task, you will probably want to switch back to it at some point, but knowing when to switch back, and knowing which task has the responsibility of switching back, can require considerable coordination. For example, put! and take! are blocking operations, which, when used in the context of channels maintain state to remember who the consumers are. Not needing to manually keep track of the consuming task is what makes put! easier to use than the low-level yieldto.

    In addition to yieldto, a few other basic functions are needed to use tasks effectively.

    Tasks and events

    Most task switches occur as a result of waiting for events such as I/O requests, and are performed by a scheduler included in Julia Base. The scheduler maintains a queue of runnable tasks, and executes an event loop that restarts tasks based on external events such as message arrival.

    The basic function for waiting for an event is wait. Several objects implement wait; for example, given a Process object, wait will wait for it to exit. wait is often implicit; for example, a wait can happen inside a call to read to wait for data to be available.

    In all of these cases, wait ultimately operates on a Condition object, which is in charge of queueing and restarting tasks. When a task calls wait on a Condition, the task is marked as non-runnable, added to the condition's queue, and switches to the scheduler. The scheduler will then pick another task to run, or block waiting for external events. If all goes well, eventually an event handler will call notify on the condition, which causes tasks waiting for that condition to become runnable again.

    A task created explicitly by calling Task is initially not known to the scheduler. This allows you to manage tasks manually using yieldto if you wish. However, when such a task waits for an event, it still gets restarted automatically when the event happens, as you would expect.

    +0.029772311

    Instead of errormonitor(t), a more robust solution may be to use bind(results, t), as that will not only log any unexpected failures, but also force the associated resources to close and propagate the exception everywhere.

    More task operations

    Task operations are built on a low-level primitive called yieldto. yieldto(task, value) suspends the current task, switches to the specified task, and causes that task's last yieldto call to return the specified value. Notice that yieldto is the only operation required to use task-style control flow; instead of calling and returning we are always just switching to a different task. This is why this feature is also called "symmetric coroutines"; each task is switched to and from using the same mechanism.

    yieldto is powerful, but most uses of tasks do not invoke it directly. Consider why this might be. If you switch away from the current task, you will probably want to switch back to it at some point, but knowing when to switch back, and knowing which task has the responsibility of switching back, can require considerable coordination. For example, put! and take! are blocking operations, which, when used in the context of channels maintain state to remember who the consumers are. Not needing to manually keep track of the consuming task is what makes put! easier to use than the low-level yieldto.

    In addition to yieldto, a few other basic functions are needed to use tasks effectively.

    Tasks and events

    Most task switches occur as a result of waiting for events such as I/O requests, and are performed by a scheduler included in Julia Base. The scheduler maintains a queue of runnable tasks, and executes an event loop that restarts tasks based on external events such as message arrival.

    The basic function for waiting for an event is wait. Several objects implement wait; for example, given a Process object, wait will wait for it to exit. wait is often implicit; for example, a wait can happen inside a call to read to wait for data to be available.

    In all of these cases, wait ultimately operates on a Condition object, which is in charge of queueing and restarting tasks. When a task calls wait on a Condition, the task is marked as non-runnable, added to the condition's queue, and switches to the scheduler. The scheduler will then pick another task to run, or block waiting for external events. If all goes well, eventually an event handler will call notify on the condition, which causes tasks waiting for that condition to become runnable again.

    A task created explicitly by calling Task is initially not known to the scheduler. This allows you to manage tasks manually using yieldto if you wish. However, when such a task waits for an event, it still gets restarted automatically when the event happens, as you would expect.

    diff --git a/en/v1.12-dev/manual/calling-c-and-fortran-code/index.html b/en/v1.12-dev/manual/calling-c-and-fortran-code/index.html index 0369c7c8d51..806fe94301b 100644 --- a/en/v1.12-dev/manual/calling-c-and-fortran-code/index.html +++ b/en/v1.12-dev/manual/calling-c-and-fortran-code/index.html @@ -158,4 +158,4 @@ 8

    ccall interface

    There is another alternative interface to @ccall. This interface is slightly less convenient but it does allow one to specify a calling convention.

    The arguments to ccall are:

    1. A (:function, "library") pair (most common),

      OR

      a :function name symbol or "function" name string (for symbols in the current process or libc),

      OR

      a function pointer (for example, from dlsym).

    2. The function's return type

    3. A tuple of input types, corresponding to the function signature. One common mistake is forgetting that a 1-tuple of argument types must be written with a trailing comma.

    4. The actual argument values to be passed to the function, if any; each is a separate parameter.

    Note

    The (:function, "library") pair, return type, and input types must be literal constants (i.e., they can't be variables, but see Non-constant Function Specifications).

    The remaining parameters are evaluated at compile-time, when the containing method is defined.

    A table of translations between the macro and function interfaces is given below.

    @ccallccall
    @ccall clock()::Int32ccall(:clock, Int32, ())
    @ccall f(a::Cint)::Cintccall(:a, Cint, (Cint,), a)
    @ccall "mylib".f(a::Cint, b::Cdouble)::Cvoidccall((:f, "mylib"), Cvoid, (Cint, Cdouble), a, b)
    @ccall $fptr.f()::Cvoidccall(fptr, f, Cvoid, ())
    @ccall printf("%s = %d\n"::Cstring ; "foo"::Cstring, foo::Cint)::Cint<unavailable>
    @ccall printf("%s = %s\n"::Cstring ; "2 + 2"::Cstring, "5"::Cstring)::Cintccall(:printf, Cint, (Cstring, Cstring...), "%s = %s\n", "2 + 2", "5")
    <unavailable>ccall(:gethostname, stdcall, Int32, (Ptr{UInt8}, UInt32), hn, length(hn))

    Calling Convention

    The second argument to ccall (immediately preceding return type) can optionally be a calling convention specifier (the @ccall macro currently does not support giving a calling convention). Without any specifier, the platform-default C calling convention is used. Other supported conventions are: stdcall, cdecl, fastcall, and thiscall (no-op on 64-bit Windows). For example (from base/libc.jl) we see the same gethostnameccall as above, but with the correct signature for Windows:

    hn = Vector{UInt8}(undef, 256)
     err = ccall(:gethostname, stdcall, Int32, (Ptr{UInt8}, UInt32), hn, length(hn))

    For more information, please see the LLVM Language Reference.

    There is one additional special calling convention llvmcall, which allows inserting calls to LLVM intrinsics directly. This can be especially useful when targeting unusual platforms such as GPGPUs. For example, for CUDA, we need to be able to read the thread index:

    ccall("llvm.nvvm.read.ptx.sreg.tid.x", llvmcall, Int32, ())

    As with any ccall, it is essential to get the argument signature exactly correct. Also, note that there is no compatibility layer that ensures the intrinsic makes sense and works on the current target, unlike the equivalent Julia functions exposed by Core.Intrinsics.

    Accessing Global Variables

    Global variables exported by native libraries can be accessed by name using the cglobal function. The arguments to cglobal are a symbol specification identical to that used by ccall, and a type describing the value stored in the variable:

    julia> cglobal((:errno, :libc), Int32)
     Ptr{Int32} @0x00007f418d0816b8

    The result is a pointer giving the address of the value. The value can be manipulated through this pointer using unsafe_load and unsafe_store!.

    Note

    This errno symbol may not be found in a library named "libc", as this is an implementation detail of your system compiler. Typically standard library symbols should be accessed just by name, allowing the compiler to fill in the correct one. Also, however, the errno symbol shown in this example is special in most compilers, and so the value seen here is probably not what you expect or want. Compiling the equivalent code in C on any multi-threaded-capable system would typically actually call a different function (via macro preprocessor overloading), and may give a different result than the legacy value printed here.

    Accessing Data through a Pointer

    The following methods are described as "unsafe" because a bad pointer or type declaration can cause Julia to terminate abruptly.

    Given a Ptr{T}, the contents of type T can generally be copied from the referenced memory into a Julia object using unsafe_load(ptr, [index]). The index argument is optional (default is 1), and follows the Julia-convention of 1-based indexing. This function is intentionally similar to the behavior of getindex and setindex! (e.g. [] access syntax).

    The return value will be a new object initialized to contain a copy of the contents of the referenced memory. The referenced memory can safely be freed or released.

    If T is Any, then the memory is assumed to contain a reference to a Julia object (a jl_value_t*), the result will be a reference to this object, and the object will not be copied. You must be careful in this case to ensure that the object was always visible to the garbage collector (pointers do not count, but the new reference does) to ensure the memory is not prematurely freed. Note that if the object was not originally allocated by Julia, the new object will never be finalized by Julia's garbage collector. If the Ptr itself is actually a jl_value_t*, it can be converted back to a Julia object reference by unsafe_pointer_to_objref(ptr). (Julia values v can be converted to jl_value_t* pointers, as Ptr{Cvoid}, by calling pointer_from_objref(v).)

    The reverse operation (writing data to a Ptr{T}), can be performed using unsafe_store!(ptr, value, [index]). Currently, this is only supported for primitive types or other pointer-free (isbits) immutable struct types.

    Any operation that throws an error is probably currently unimplemented and should be posted as a bug so that it can be resolved.

    If the pointer of interest is a plain-data array (primitive type or immutable struct), the function unsafe_wrap(Array, ptr,dims, own = false) may be more useful. The final parameter should be true if Julia should "take ownership" of the underlying buffer and call free(ptr) when the returned Array object is finalized. If the own parameter is omitted or false, the caller must ensure the buffer remains in existence until all access is complete.

    Arithmetic on the Ptr type in Julia (e.g. using +) does not behave the same as C's pointer arithmetic. Adding an integer to a Ptr in Julia always moves the pointer by some number of bytes, not elements. This way, the address values obtained from pointer arithmetic do not depend on the element types of pointers.

    Thread-safety

    Some C libraries execute their callbacks from a different thread, and since Julia isn't thread-safe you'll need to take some extra precautions. In particular, you'll need to set up a two-layered system: the C callback should only schedule (via Julia's event loop) the execution of your "real" callback. To do this, create an AsyncCondition object and wait on it:

    cond = Base.AsyncCondition()
    -wait(cond)

    The callback you pass to C should only execute a ccall to :uv_async_send, passing cond.handle as the argument, taking care to avoid any allocations or other interactions with the Julia runtime.

    Note that events may be coalesced, so multiple calls to uv_async_send may result in a single wakeup notification to the condition.

    More About Callbacks

    For more details on how to pass callbacks to C libraries, see this blog post.

    C++

    For tools to create C++ bindings, see the CxxWrap package.

    +wait(cond)

    The callback you pass to C should only execute a ccall to :uv_async_send, passing cond.handle as the argument, taking care to avoid any allocations or other interactions with the Julia runtime.

    Note that events may be coalesced, so multiple calls to uv_async_send may result in a single wakeup notification to the condition.

    More About Callbacks

    For more details on how to pass callbacks to C libraries, see this blog post.

    C++

    For tools to create C++ bindings, see the CxxWrap package.

    diff --git a/en/v1.12-dev/manual/code-loading/index.html b/en/v1.12-dev/manual/code-loading/index.html index c1db986b57e..6a92e7270a6 100644 --- a/en/v1.12-dev/manual/code-loading/index.html +++ b/en/v1.12-dev/manual/code-loading/index.html @@ -150,4 +150,4 @@ MyPackage/ Project.toml # projects = ["test"] test/ - Project.toml

    Package/Environment Preferences

    Preferences are dictionaries of metadata that influence package behavior within an environment. The preferences system supports reading preferences at compile-time, which means that at code-loading time, we must ensure that the precompilation files selected by Julia were built with the same preferences as the current environment before loading them. The public API for modifying Preferences is contained within the Preferences.jl package. Preferences are stored as TOML dictionaries within a (Julia)LocalPreferences.toml file next to the currently-active project. If a preference is "exported", it is instead stored within the (Julia)Project.toml instead. The intention is to allow shared projects to contain shared preferences, while allowing for users themselves to override those preferences with their own settings in the LocalPreferences.toml file, which should be .gitignored as the name implies.

    Preferences that are accessed during compilation are automatically marked as compile-time preferences, and any change recorded to these preferences will cause the Julia compiler to recompile any cached precompilation file(s) (.ji and corresponding .so, .dll, or .dylib files) for that module. This is done by serializing the hash of all compile-time preferences during compilation, then checking that hash against the current environment when searching for the proper file(s) to load.

    Preferences can be set with depot-wide defaults; if package Foo is installed within your global environment and it has preferences set, these preferences will apply as long as your global environment is part of your LOAD_PATH. Preferences in environments higher up in the environment stack get overridden by the more proximal entries in the load path, ending with the currently active project. This allows depot-wide preference defaults to exist, with active projects able to merge or even completely overwrite these inherited preferences. See the docstring for Preferences.set_preferences!() for the full details of how to set preferences to allow or disallow merging.

    Conclusion

    Federated package management and precise software reproducibility are difficult but worthy goals in a package system. In combination, these goals lead to a more complex package loading mechanism than most dynamic languages have, but it also yields scalability and reproducibility that is more commonly associated with static languages. Typically, Julia users should be able to use the built-in package manager to manage their projects without needing a precise understanding of these interactions. A call to Pkg.add("X") will add to the appropriate project and manifest files, selected via Pkg.activate("Y"), so that a future call to import X will load X without further thought.

    + Project.toml

    Package/Environment Preferences

    Preferences are dictionaries of metadata that influence package behavior within an environment. The preferences system supports reading preferences at compile-time, which means that at code-loading time, we must ensure that the precompilation files selected by Julia were built with the same preferences as the current environment before loading them. The public API for modifying Preferences is contained within the Preferences.jl package. Preferences are stored as TOML dictionaries within a (Julia)LocalPreferences.toml file next to the currently-active project. If a preference is "exported", it is instead stored within the (Julia)Project.toml instead. The intention is to allow shared projects to contain shared preferences, while allowing for users themselves to override those preferences with their own settings in the LocalPreferences.toml file, which should be .gitignored as the name implies.

    Preferences that are accessed during compilation are automatically marked as compile-time preferences, and any change recorded to these preferences will cause the Julia compiler to recompile any cached precompilation file(s) (.ji and corresponding .so, .dll, or .dylib files) for that module. This is done by serializing the hash of all compile-time preferences during compilation, then checking that hash against the current environment when searching for the proper file(s) to load.

    Preferences can be set with depot-wide defaults; if package Foo is installed within your global environment and it has preferences set, these preferences will apply as long as your global environment is part of your LOAD_PATH. Preferences in environments higher up in the environment stack get overridden by the more proximal entries in the load path, ending with the currently active project. This allows depot-wide preference defaults to exist, with active projects able to merge or even completely overwrite these inherited preferences. See the docstring for Preferences.set_preferences!() for the full details of how to set preferences to allow or disallow merging.

    Conclusion

    Federated package management and precise software reproducibility are difficult but worthy goals in a package system. In combination, these goals lead to a more complex package loading mechanism than most dynamic languages have, but it also yields scalability and reproducibility that is more commonly associated with static languages. Typically, Julia users should be able to use the built-in package manager to manage their projects without needing a precise understanding of these interactions. A call to Pkg.add("X") will add to the appropriate project and manifest files, selected via Pkg.activate("Y"), so that a future call to import X will load X without further thought.

    diff --git a/en/v1.12-dev/manual/command-line-interface/index.html b/en/v1.12-dev/manual/command-line-interface/index.html index f725ce63590..648e2ae4246 100644 --- a/en/v1.12-dev/manual/command-line-interface/index.html +++ b/en/v1.12-dev/manual/command-line-interface/index.html @@ -30,4 +30,4 @@ ...

    Note that although you should have a ~/.julia directory once you've run Julia for the first time, you may need to create the ~/.julia/config folder and the ~/.julia/config/startup.jl file if you use it.

    To have startup code run only in The Julia REPL (and not when julia is e.g. run on a script), use atreplinit in startup.jl:

    atreplinit() do repl
         # ...
    -end

    Command-line switches for Julia

    There are various ways to run Julia code and provide options, similar to those available for the perl and ruby programs:

    julia [switches] -- [programfile] [args...]

    The following is a complete list of command-line switches available when launching julia (a '*' marks the default value, if applicable; settings marked '($)' may trigger package precompilation):

    SwitchDescription
    -v, --versionDisplay version information
    -h, --helpPrint command-line options (this message)
    --help-hiddenPrint uncommon options not shown by -h
    --project[={<dir>|@temp|@.}]Set <dir> as the active project/environment. Or, create a temporary environment with @temp. The default @. option will search through parent directories until a Project.toml or JuliaProject.toml file is found.
    -J, --sysimage <file>Start up with the given system image file
    -H, --home <dir>Set location of julia executable
    --startup-file={yes*|no}Load JULIA_DEPOT_PATH/config/startup.jl; if JULIA_DEPOT_PATH environment variable is unset, load ~/.julia/config/startup.jl
    --handle-signals={yes*|no}Enable or disable Julia's default signal handlers
    --sysimage-native-code={yes*|no}Use native code from system image if available
    --compiled-modules={yes*|no|existing|strict}Enable or disable incremental precompilation of modules. The existing option allows use of existing compiled modules that were previously precompiled, but disallows creation of new precompile files. The strict option is similar, but will error if no precompile file is found.
    --pkgimages={yes*|no|existing}Enable or disable usage of native code caching in the form of pkgimages. The existing option allows use of existing pkgimages but disallows creation of new ones
    -e, --eval <expr>Evaluate <expr>
    -E, --print <expr>Evaluate <expr> and display the result
    -m, --module <Package> [args]Run entry point of Package (@main function) with `args'
    -L, --load <file>Load <file> immediately on all processors
    -t, --threads {auto|N[,auto|M]}Enable N[+M] threads; N threads are assigned to the default threadpool, and if M is specified, M threads are assigned to the interactive threadpool; auto tries to infer a useful default number of threads to use but the exact behavior might change in the future. Currently sets N to the number of CPUs assigned to this Julia process based on the OS-specific affinity assignment interface if supported (Linux and Windows) or to the number of CPU threads if not supported (MacOS) or if process affinity is not configured, and sets M to 1.
    --gcthreads=N[,M]Use N threads for the mark phase of GC and M (0 or 1) threads for the concurrent sweeping phase of GC. N is set to the number of compute threads and M is set to 0 if unspecified.
    -p, --procs {N|auto}Integer value N launches N additional local worker processes; auto launches as many workers as the number of local CPU threads (logical cores)
    --machine-file <file>Run processes on hosts listed in <file>
    -i, --interactiveInteractive mode; REPL runs and isinteractive() is true
    -q, --quietQuiet startup: no banner, suppress REPL warnings
    --banner={yes|no|short|auto*}Enable or disable startup banner
    --color={yes|no|auto*}Enable or disable color text
    --history-file={yes*|no}Load or save history
    --depwarn={yes|no*|error}Enable or disable syntax and method deprecation warnings (error turns warnings into errors)
    --warn-overwrite={yes|no*}Enable or disable method overwrite warnings
    --warn-scope={yes*|no}Enable or disable warning for ambiguous top-level scope
    -C, --cpu-target <target>Limit usage of CPU features up to <target>; set to help to see the available options
    -O, --optimize={0|1|2*|3}Set the optimization level (level is 3 if -O is used without a level) ($)
    --min-optlevel={0*|1|2|3}Set the lower bound on per-module optimization
    -g, --debug-info={0|1*|2}Set the level of debug info generation (level is 2 if -g is used without a level) ($)
    --inline={yes|no}Control whether inlining is permitted, including overriding @inline declarations
    --check-bounds={yes|no|auto*}Emit bounds checks always, never, or respect @inbounds declarations ($)
    --math-mode={ieee|user*}Always follow ieee floating point semantics or respect @fastmath declarations
    --polly={yes*|no}Enable or disable the polyhedral optimizer Polly (overrides @polly declaration)
    --code-coverage[={none*|user|all}]Count executions of source lines (omitting setting is equivalent to user)
    --code-coverage=@<path>Count executions but only in files that fall under the given file path/directory. The @ prefix is required to select this option. A @ with no path will track the current directory.
    --code-coverage=tracefile.infoAppend coverage information to the LCOV tracefile (filename supports format tokens).
    --track-allocation[={none*|user|all}]Count bytes allocated by each source line (omitting setting is equivalent to "user")
    --track-allocation=@<path>Count bytes but only in files that fall under the given file path/directory. The @ prefix is required to select this option. A @ with no path will track the current directory.
    --task-metrics={yes|no*}Enable the collection of per-task metrics
    --bug-report=KINDLaunch a bug report session. It can be used to start a REPL, run a script, or evaluate expressions. It first tries to use BugReporting.jl installed in current environment and falls back to the latest compatible BugReporting.jl if not. For more information, see --bug-report=help.
    --heap-size-hint=<size>Forces garbage collection if memory usage is higher than the given value. The value may be specified as a number of bytes, optionally in units of KB, MB, GB, or TB, or as a percentage of physical memory with %.
    --compile={yes*|no|all|min}Enable or disable JIT compiler, or request exhaustive or minimal compilation
    --output-o <name>Generate an object file (including system image data)
    --output-ji <name>Generate a system image data file (.ji)
    --strip-metadataRemove docstrings and source location info from system image
    --strip-irRemove IR (intermediate representation) of compiled functions
    --output-unopt-bc <name>Generate unoptimized LLVM bitcode (.bc)
    --output-bc <name>Generate LLVM bitcode (.bc)
    --output-asm <name>Generate an assembly file (.s)
    --output-incremental={yes|no*}Generate an incremental output file (rather than complete)
    --trace-compile={stderr|name}Print precompile statements for methods compiled during execution or save to stderr or a path. Methods that were recompiled are printed in yellow or with a trailing comment if color is not supported
    --trace-compile-timingIf --trace-compile is enabled show how long each took to compile in ms
    --trace-dispatch={stderr|name}Print precompile statements for methods dispatched during execution or save to stderr or a path.
    --image-codegenForce generate code in imaging mode
    --permalloc-pkgimg={yes|no*}Copy the data section of package images into memory
    --trim={no*|safe|unsafe|unsafe-warn}Build a sysimage including only code provably reachable from methods marked by calling entrypoint. The three non-default options differ in how they handle dynamic call sites. In safe mode, such sites result in compile-time errors. In unsafe mode, such sites are allowed but the resulting binary might be missing needed code and can throw runtime errors. With unsafe-warn, such sites will trigger warnings at compile-time and might error at runtime.

    Options that have the form --option={...} can be specified either as --option=value or as --option value. For example, julia --banner=no is equivalent to julia --banner no. This is especially relevant for options that take a filename for output, because forgetting to specifying the argument for (say) --trace-compile will cause the option following it to be interpreted as the filename, possibly unintentionally overwriting it.

    Note that options of the form --option[=...] can not be specified as --option value, but only as --option=value (or simply --option, when no argument is provided).

    Julia 1.1

    In Julia 1.0, the default --project=@. option did not search up from the root directory of a Git repository for the Project.toml file. From Julia 1.1 forward, it does.

    +end

    Command-line switches for Julia

    There are various ways to run Julia code and provide options, similar to those available for the perl and ruby programs:

    julia [switches] -- [programfile] [args...]

    The following is a complete list of command-line switches available when launching julia (a '*' marks the default value, if applicable; settings marked '($)' may trigger package precompilation):

    SwitchDescription
    -v, --versionDisplay version information
    -h, --helpPrint command-line options (this message)
    --help-hiddenPrint uncommon options not shown by -h
    --project[={<dir>|@temp|@.}]Set <dir> as the active project/environment. Or, create a temporary environment with @temp. The default @. option will search through parent directories until a Project.toml or JuliaProject.toml file is found.
    -J, --sysimage <file>Start up with the given system image file
    -H, --home <dir>Set location of julia executable
    --startup-file={yes*|no}Load JULIA_DEPOT_PATH/config/startup.jl; if JULIA_DEPOT_PATH environment variable is unset, load ~/.julia/config/startup.jl
    --handle-signals={yes*|no}Enable or disable Julia's default signal handlers
    --sysimage-native-code={yes*|no}Use native code from system image if available
    --compiled-modules={yes*|no|existing|strict}Enable or disable incremental precompilation of modules. The existing option allows use of existing compiled modules that were previously precompiled, but disallows creation of new precompile files. The strict option is similar, but will error if no precompile file is found.
    --pkgimages={yes*|no|existing}Enable or disable usage of native code caching in the form of pkgimages. The existing option allows use of existing pkgimages but disallows creation of new ones
    -e, --eval <expr>Evaluate <expr>
    -E, --print <expr>Evaluate <expr> and display the result
    -m, --module <Package> [args]Run entry point of Package (@main function) with `args'
    -L, --load <file>Load <file> immediately on all processors
    -t, --threads {auto|N[,auto|M]}Enable N[+M] threads; N threads are assigned to the default threadpool, and if M is specified, M threads are assigned to the interactive threadpool; auto tries to infer a useful default number of threads to use but the exact behavior might change in the future. Currently sets N to the number of CPUs assigned to this Julia process based on the OS-specific affinity assignment interface if supported (Linux and Windows) or to the number of CPU threads if not supported (MacOS) or if process affinity is not configured, and sets M to 1.
    --gcthreads=N[,M]Use N threads for the mark phase of GC and M (0 or 1) threads for the concurrent sweeping phase of GC. N is set to the number of compute threads and M is set to 0 if unspecified.
    -p, --procs {N|auto}Integer value N launches N additional local worker processes; auto launches as many workers as the number of local CPU threads (logical cores)
    --machine-file <file>Run processes on hosts listed in <file>
    -i, --interactiveInteractive mode; REPL runs and isinteractive() is true
    -q, --quietQuiet startup: no banner, suppress REPL warnings
    --banner={yes|no|short|auto*}Enable or disable startup banner
    --color={yes|no|auto*}Enable or disable color text
    --history-file={yes*|no}Load or save history
    --depwarn={yes|no*|error}Enable or disable syntax and method deprecation warnings (error turns warnings into errors)
    --warn-overwrite={yes|no*}Enable or disable method overwrite warnings
    --warn-scope={yes*|no}Enable or disable warning for ambiguous top-level scope
    -C, --cpu-target <target>Limit usage of CPU features up to <target>; set to help to see the available options
    -O, --optimize={0|1|2*|3}Set the optimization level (level is 3 if -O is used without a level) ($)
    --min-optlevel={0*|1|2|3}Set the lower bound on per-module optimization
    -g, --debug-info={0|1*|2}Set the level of debug info generation (level is 2 if -g is used without a level) ($)
    --inline={yes|no}Control whether inlining is permitted, including overriding @inline declarations
    --check-bounds={yes|no|auto*}Emit bounds checks always, never, or respect @inbounds declarations ($)
    --math-mode={ieee|user*}Always follow ieee floating point semantics or respect @fastmath declarations
    --polly={yes*|no}Enable or disable the polyhedral optimizer Polly (overrides @polly declaration)
    --code-coverage[={none*|user|all}]Count executions of source lines (omitting setting is equivalent to user)
    --code-coverage=@<path>Count executions but only in files that fall under the given file path/directory. The @ prefix is required to select this option. A @ with no path will track the current directory.
    --code-coverage=tracefile.infoAppend coverage information to the LCOV tracefile (filename supports format tokens).
    --track-allocation[={none*|user|all}]Count bytes allocated by each source line (omitting setting is equivalent to "user")
    --track-allocation=@<path>Count bytes but only in files that fall under the given file path/directory. The @ prefix is required to select this option. A @ with no path will track the current directory.
    --task-metrics={yes|no*}Enable the collection of per-task metrics
    --bug-report=KINDLaunch a bug report session. It can be used to start a REPL, run a script, or evaluate expressions. It first tries to use BugReporting.jl installed in current environment and falls back to the latest compatible BugReporting.jl if not. For more information, see --bug-report=help.
    --heap-size-hint=<size>Forces garbage collection if memory usage is higher than the given value. The value may be specified as a number of bytes, optionally in units of KB, MB, GB, or TB, or as a percentage of physical memory with %.
    --compile={yes*|no|all|min}Enable or disable JIT compiler, or request exhaustive or minimal compilation
    --output-o <name>Generate an object file (including system image data)
    --output-ji <name>Generate a system image data file (.ji)
    --strip-metadataRemove docstrings and source location info from system image
    --strip-irRemove IR (intermediate representation) of compiled functions
    --output-unopt-bc <name>Generate unoptimized LLVM bitcode (.bc)
    --output-bc <name>Generate LLVM bitcode (.bc)
    --output-asm <name>Generate an assembly file (.s)
    --output-incremental={yes|no*}Generate an incremental output file (rather than complete)
    --trace-compile={stderr|name}Print precompile statements for methods compiled during execution or save to stderr or a path. Methods that were recompiled are printed in yellow or with a trailing comment if color is not supported
    --trace-compile-timingIf --trace-compile is enabled show how long each took to compile in ms
    --trace-dispatch={stderr|name}Print precompile statements for methods dispatched during execution or save to stderr or a path.
    --image-codegenForce generate code in imaging mode
    --permalloc-pkgimg={yes|no*}Copy the data section of package images into memory
    --trim={no*|safe|unsafe|unsafe-warn}Build a sysimage including only code provably reachable from methods marked by calling entrypoint. The three non-default options differ in how they handle dynamic call sites. In safe mode, such sites result in compile-time errors. In unsafe mode, such sites are allowed but the resulting binary might be missing needed code and can throw runtime errors. With unsafe-warn, such sites will trigger warnings at compile-time and might error at runtime.

    Options that have the form --option={...} can be specified either as --option=value or as --option value. For example, julia --banner=no is equivalent to julia --banner no. This is especially relevant for options that take a filename for output, because forgetting to specifying the argument for (say) --trace-compile will cause the option following it to be interpreted as the filename, possibly unintentionally overwriting it.

    Note that options of the form --option[=...] can not be specified as --option value, but only as --option=value (or simply --option, when no argument is provided).

    Julia 1.1

    In Julia 1.0, the default --project=@. option did not search up from the root directory of a Git repository for the Project.toml file. From Julia 1.1 forward, it does.

    diff --git a/en/v1.12-dev/manual/complex-and-rational-numbers/index.html b/en/v1.12-dev/manual/complex-and-rational-numbers/index.html index 9d547f5ea61..ce5a1c57930 100644 --- a/en/v1.12-dev/manual/complex-and-rational-numbers/index.html +++ b/en/v1.12-dev/manual/complex-and-rational-numbers/index.html @@ -201,4 +201,4 @@ true julia> 1//3 - 0.33 -0.0033333333333332993 +0.0033333333333332993 diff --git a/en/v1.12-dev/manual/constructors/index.html b/en/v1.12-dev/manual/constructors/index.html index ca67a612402..ad6c999ef6b 100644 --- a/en/v1.12-dev/manual/constructors/index.html +++ b/en/v1.12-dev/manual/constructors/index.html @@ -254,4 +254,4 @@ julia> (::Type{S})() = S(8) # overwrites the previous constructor method julia> S() -S(8)
    +S(8)
    diff --git a/en/v1.12-dev/manual/control-flow/index.html b/en/v1.12-dev/manual/control-flow/index.html index 3e12484f93b..47776825341 100644 --- a/en/v1.12-dev/manual/control-flow/index.html +++ b/en/v1.12-dev/manual/control-flow/index.html @@ -375,4 +375,4 @@ # operate on file f finally close(f) -end

    When control leaves the try block (for example due to a return, or just finishing normally), close(f) will be executed. If the try block exits due to an exception, the exception will continue propagating. A catch block may be combined with try and finally as well. In this case the finally block will run after catch has handled the error.

    Tasks (aka Coroutines)

    Tasks are a control flow feature that allows computations to be suspended and resumed in a flexible manner. We mention them here only for completeness; for a full discussion see Asynchronous Programming.

    +end

    When control leaves the try block (for example due to a return, or just finishing normally), close(f) will be executed. If the try block exits due to an exception, the exception will continue propagating. A catch block may be combined with try and finally as well. In this case the finally block will run after catch has handled the error.

    Tasks (aka Coroutines)

    Tasks are a control flow feature that allows computations to be suspended and resumed in a flexible manner. We mention them here only for completeness; for a full discussion see Asynchronous Programming.

    diff --git a/en/v1.12-dev/manual/conversion-and-promotion/index.html b/en/v1.12-dev/manual/conversion-and-promotion/index.html index f7211443f90..9b08549ce8e 100644 --- a/en/v1.12-dev/manual/conversion-and-promotion/index.html +++ b/en/v1.12-dev/manual/conversion-and-promotion/index.html @@ -61,4 +61,4 @@ Int64

    Note that we do not overload promote_type directly: we overload promote_rule instead. promote_type uses promote_rule, and adds the symmetry. Overloading it directly can cause ambiguity errors. We overload promote_rule to define how things should be promoted, and we use promote_type to query that.

    Internally, promote_type is used inside of promote to determine what type argument values should be converted to for promotion. The curious reader can read the code in promotion.jl, which defines the complete promotion mechanism in about 35 lines.

    Case Study: Rational Promotions

    Finally, we finish off our ongoing case study of Julia's rational number type, which makes relatively sophisticated use of the promotion mechanism with the following promotion rules:

    import Base: promote_rule
     promote_rule(::Type{Rational{T}}, ::Type{S}) where {T<:Integer,S<:Integer} = Rational{promote_type(T,S)}
     promote_rule(::Type{Rational{T}}, ::Type{Rational{S}}) where {T<:Integer,S<:Integer} = Rational{promote_type(T,S)}
    -promote_rule(::Type{Rational{T}}, ::Type{S}) where {T<:Integer,S<:AbstractFloat} = promote_type(T,S)

    The first rule says that promoting a rational number with any other integer type promotes to a rational type whose numerator/denominator type is the result of promotion of its numerator/denominator type with the other integer type. The second rule applies the same logic to two different types of rational numbers, resulting in a rational of the promotion of their respective numerator/denominator types. The third and final rule dictates that promoting a rational with a float results in the same type as promoting the numerator/denominator type with the float.

    This small handful of promotion rules, together with the type's constructors and the default convert method for numbers, are sufficient to make rational numbers interoperate completely naturally with all of Julia's other numeric types – integers, floating-point numbers, and complex numbers. By providing appropriate conversion methods and promotion rules in the same manner, any user-defined numeric type can interoperate just as naturally with Julia's predefined numerics.

    +promote_rule(::Type{Rational{T}}, ::Type{S}) where {T<:Integer,S<:AbstractFloat} = promote_type(T,S)

    The first rule says that promoting a rational number with any other integer type promotes to a rational type whose numerator/denominator type is the result of promotion of its numerator/denominator type with the other integer type. The second rule applies the same logic to two different types of rational numbers, resulting in a rational of the promotion of their respective numerator/denominator types. The third and final rule dictates that promoting a rational with a float results in the same type as promoting the numerator/denominator type with the float.

    This small handful of promotion rules, together with the type's constructors and the default convert method for numbers, are sufficient to make rational numbers interoperate completely naturally with all of Julia's other numeric types – integers, floating-point numbers, and complex numbers. By providing appropriate conversion methods and promotion rules in the same manner, any user-defined numeric type can interoperate just as naturally with Julia's predefined numerics.

    diff --git a/en/v1.12-dev/manual/distributed-computing/index.html b/en/v1.12-dev/manual/distributed-computing/index.html index 0c401002213..228debcd5b0 100644 --- a/en/v1.12-dev/manual/distributed-computing/index.html +++ b/en/v1.12-dev/manual/distributed-computing/index.html @@ -495,4 +495,4 @@ @printf("sum of ranks: %s\n", sr) end -MPI.Finalize()
    mpirun -np 4 ./julia example.jl
    +MPI.Finalize()
    mpirun -np 4 ./julia example.jl
    diff --git a/en/v1.12-dev/manual/documentation/index.html b/en/v1.12-dev/manual/documentation/index.html index c50547add5f..177b882bf5e 100644 --- a/en/v1.12-dev/manual/documentation/index.html +++ b/en/v1.12-dev/manual/documentation/index.html @@ -223,4 +223,4 @@ 1 julia> "Docstring" @macroception -1source +1source diff --git a/en/v1.12-dev/manual/embedding/index.html b/en/v1.12-dev/manual/embedding/index.html index c7808c1876a..56364cdef87 100644 --- a/en/v1.12-dev/manual/embedding/index.html +++ b/en/v1.12-dev/manual/embedding/index.html @@ -237,4 +237,4 @@ [J 2] i = 4 -> 2.0 [C 23938640] i = 5 [J 1] i = 3 -> 1.7320508075688772 -[J 2] i = 5 -> 2.23606797749979

    As can be seen, Julia thread 1 corresponds to pthread ID 3bfd9c00, and Julia thread 2 corresponds to ID 23938640, showing that indeed multiple threads are used at the C level, and that we can safely call Julia C API routines from those threads.

    +[J 2] i = 5 -> 2.23606797749979

    As can be seen, Julia thread 1 corresponds to pthread ID 3bfd9c00, and Julia thread 2 corresponds to ID 23938640, showing that indeed multiple threads are used at the C level, and that we can safely call Julia C API routines from those threads.

    diff --git a/en/v1.12-dev/manual/environment-variables/index.html b/en/v1.12-dev/manual/environment-variables/index.html index 4aa34cb0ac1..9733cd3c677 100644 --- a/en/v1.12-dev/manual/environment-variables/index.html +++ b/en/v1.12-dev/manual/environment-variables/index.html @@ -14,4 +14,4 @@ - M (mebibytes) - G (gibibytes) - T (tebibytes) -- % (percentage of physical memory)

    For example, JULIA_HEAP_SIZE_HINT=1G would provide a 1 GB heap size hint to the garbage collector.

    REPL formatting

    Environment variables that determine how REPL output should be formatted at the terminal. The JULIA_*_COLOR variables should be set to ANSI terminal escape sequences. Julia provides a high-level interface with much of the same functionality; see the section on The Julia REPL.

    JULIA_ERROR_COLOR

    The formatting Base.error_color() (default: light red, "\033[91m") that errors should have at the terminal.

    JULIA_WARN_COLOR

    The formatting Base.warn_color() (default: yellow, "\033[93m") that warnings should have at the terminal.

    JULIA_INFO_COLOR

    The formatting Base.info_color() (default: cyan, "\033[36m") that info should have at the terminal.

    JULIA_INPUT_COLOR

    The formatting Base.input_color() (default: normal, "\033[0m") that input should have at the terminal.

    JULIA_ANSWER_COLOR

    The formatting Base.answer_color() (default: normal, "\033[0m") that output should have at the terminal.

    NO_COLOR

    When this variable is present and not an empty string (regardless of its value) then colored text will be disabled on the REPL. Can be overridden with the flag --color=yes or with the environment variable FORCE_COLOR. This environment variable is commonly recognized by command-line applications.

    FORCE_COLOR

    When this variable is present and not an empty string (regardless of its value) then colored text will be enabled on the REPL. Can be overridden with the flag --color=no. This environment variable is commonly recognized by command-line applications.

    System and Package Image Building

    JULIA_CPU_TARGET

    Modify the target machine architecture for (pre)compiling system and package images. JULIA_CPU_TARGET only affects machine code image generation being output to a disk cache. Unlike the --cpu-target, or -C, command line option, it does not influence just-in-time (JIT) code generation within a Julia session where machine code is only stored in memory.

    Valid values for JULIA_CPU_TARGET can be obtained by executing julia -C help.

    Setting JULIA_CPU_TARGET is important for heterogeneous compute systems where processors of distinct types or features may be present. This is commonly encountered in high performance computing (HPC) clusters since the component nodes may be using distinct processors.

    The CPU target string is a list of strings separated by ; each string starts with a CPU or architecture name and followed by an optional list of features separated by ,. A generic or empty CPU name means the basic required feature set of the target ISA which is at least the architecture the C/C++ runtime is compiled with. Each string is interpreted by LLVM.

    A few special features are supported:

    1. clone_all

      This forces the target to have all functions in sysimg cloned. When used in negative form (i.e. -clone_all), this disables full clone that's enabled by default for certain targets.

    2. base([0-9]*)

      This specifies the (0-based) base target index. The base target is the target that the current target is based on, i.e. the functions that are not being cloned will use the version in the base target. This option causes the base target to be fully cloned (as if clone_all is specified for it) if it is not the default target (0). The index can only be smaller than the current index.

    3. opt_size

      Optimize for size with minimum performance impact. Clang/GCC's -Os.

    4. min_size

      Optimize only for size. Clang's -Oz.

    Debugging and profiling

    JULIA_DEBUG

    Enable debug logging for a file or module, see Logging for more information.

    JULIA_PROFILE_PEEK_HEAP_SNAPSHOT

    Enable collecting of a heap snapshot during execution via the profiling peek mechanism. See Triggered During Execution.

    JULIA_TIMING_SUBSYSTEMS

    Allows you to enable or disable zones for a specific Julia run. For instance, setting the variable to +GC,-INFERENCE will enable the GC zones and disable the INFERENCE zones. See Dynamically Enabling and Disabling Zones.

    JULIA_GC_NO_GENERATIONAL

    If set to anything besides 0, then the Julia garbage collector never performs "quick sweeps" of memory.

    Note

    This environment variable only has an effect if Julia was compiled with garbage-collection debugging (that is, if WITH_GC_DEBUG_ENV is set to 1 in the build configuration).

    JULIA_GC_WAIT_FOR_DEBUGGER

    If set to anything besides 0, then the Julia garbage collector will wait for a debugger to attach instead of aborting whenever there's a critical error.

    Note

    This environment variable only has an effect if Julia was compiled with garbage-collection debugging (that is, if WITH_GC_DEBUG_ENV is set to 1 in the build configuration).

    ENABLE_JITPROFILING

    If set to anything besides 0, then the compiler will create and register an event listener for just-in-time (JIT) profiling.

    Note

    This environment variable only has an effect if Julia was compiled with JIT profiling support, using either

    ENABLE_GDBLISTENER

    If set to anything besides 0 enables GDB registration of Julia code on release builds. On debug builds of Julia this is always enabled. Recommended to use with -g 2.

    JULIA_LLVM_ARGS

    Arguments to be passed to the LLVM backend.

    JULIA_FALLBACK_REPL

    Forces the fallback repl instead of REPL.jl.

    +- % (percentage of physical memory)

    For example, JULIA_HEAP_SIZE_HINT=1G would provide a 1 GB heap size hint to the garbage collector.

    REPL formatting

    Environment variables that determine how REPL output should be formatted at the terminal. The JULIA_*_COLOR variables should be set to ANSI terminal escape sequences. Julia provides a high-level interface with much of the same functionality; see the section on The Julia REPL.

    JULIA_ERROR_COLOR

    The formatting Base.error_color() (default: light red, "\033[91m") that errors should have at the terminal.

    JULIA_WARN_COLOR

    The formatting Base.warn_color() (default: yellow, "\033[93m") that warnings should have at the terminal.

    JULIA_INFO_COLOR

    The formatting Base.info_color() (default: cyan, "\033[36m") that info should have at the terminal.

    JULIA_INPUT_COLOR

    The formatting Base.input_color() (default: normal, "\033[0m") that input should have at the terminal.

    JULIA_ANSWER_COLOR

    The formatting Base.answer_color() (default: normal, "\033[0m") that output should have at the terminal.

    NO_COLOR

    When this variable is present and not an empty string (regardless of its value) then colored text will be disabled on the REPL. Can be overridden with the flag --color=yes or with the environment variable FORCE_COLOR. This environment variable is commonly recognized by command-line applications.

    FORCE_COLOR

    When this variable is present and not an empty string (regardless of its value) then colored text will be enabled on the REPL. Can be overridden with the flag --color=no. This environment variable is commonly recognized by command-line applications.

    System and Package Image Building

    JULIA_CPU_TARGET

    Modify the target machine architecture for (pre)compiling system and package images. JULIA_CPU_TARGET only affects machine code image generation being output to a disk cache. Unlike the --cpu-target, or -C, command line option, it does not influence just-in-time (JIT) code generation within a Julia session where machine code is only stored in memory.

    Valid values for JULIA_CPU_TARGET can be obtained by executing julia -C help.

    Setting JULIA_CPU_TARGET is important for heterogeneous compute systems where processors of distinct types or features may be present. This is commonly encountered in high performance computing (HPC) clusters since the component nodes may be using distinct processors.

    The CPU target string is a list of strings separated by ; each string starts with a CPU or architecture name and followed by an optional list of features separated by ,. A generic or empty CPU name means the basic required feature set of the target ISA which is at least the architecture the C/C++ runtime is compiled with. Each string is interpreted by LLVM.

    A few special features are supported:

    1. clone_all

      This forces the target to have all functions in sysimg cloned. When used in negative form (i.e. -clone_all), this disables full clone that's enabled by default for certain targets.

    2. base([0-9]*)

      This specifies the (0-based) base target index. The base target is the target that the current target is based on, i.e. the functions that are not being cloned will use the version in the base target. This option causes the base target to be fully cloned (as if clone_all is specified for it) if it is not the default target (0). The index can only be smaller than the current index.

    3. opt_size

      Optimize for size with minimum performance impact. Clang/GCC's -Os.

    4. min_size

      Optimize only for size. Clang's -Oz.

    Debugging and profiling

    JULIA_DEBUG

    Enable debug logging for a file or module, see Logging for more information.

    JULIA_PROFILE_PEEK_HEAP_SNAPSHOT

    Enable collecting of a heap snapshot during execution via the profiling peek mechanism. See Triggered During Execution.

    JULIA_TIMING_SUBSYSTEMS

    Allows you to enable or disable zones for a specific Julia run. For instance, setting the variable to +GC,-INFERENCE will enable the GC zones and disable the INFERENCE zones. See Dynamically Enabling and Disabling Zones.

    JULIA_GC_NO_GENERATIONAL

    If set to anything besides 0, then the Julia garbage collector never performs "quick sweeps" of memory.

    Note

    This environment variable only has an effect if Julia was compiled with garbage-collection debugging (that is, if WITH_GC_DEBUG_ENV is set to 1 in the build configuration).

    JULIA_GC_WAIT_FOR_DEBUGGER

    If set to anything besides 0, then the Julia garbage collector will wait for a debugger to attach instead of aborting whenever there's a critical error.

    Note

    This environment variable only has an effect if Julia was compiled with garbage-collection debugging (that is, if WITH_GC_DEBUG_ENV is set to 1 in the build configuration).

    ENABLE_JITPROFILING

    If set to anything besides 0, then the compiler will create and register an event listener for just-in-time (JIT) profiling.

    Note

    This environment variable only has an effect if Julia was compiled with JIT profiling support, using either

    ENABLE_GDBLISTENER

    If set to anything besides 0 enables GDB registration of Julia code on release builds. On debug builds of Julia this is always enabled. Recommended to use with -g 2.

    JULIA_LLVM_ARGS

    Arguments to be passed to the LLVM backend.

    JULIA_FALLBACK_REPL

    Forces the fallback repl instead of REPL.jl.

    diff --git a/en/v1.12-dev/manual/faq/index.html b/en/v1.12-dev/manual/faq/index.html index 7d58975553e..c0b12278f03 100644 --- a/en/v1.12-dev/manual/faq/index.html +++ b/en/v1.12-dev/manual/faq/index.html @@ -328,4 +328,4 @@ A = randn(1000, 1000) B = randn(1000, 1000) @btime $A \ $B -@btime $A * $B

    can be different when compared to other languages like Matlab or R.

    Since operations like this are very thin wrappers over the relevant BLAS functions, the reason for the discrepancy is very likely to be

    1. the BLAS library each language is using,

    2. the number of concurrent threads.

    Julia compiles and uses its own copy of OpenBLAS, with threads currently capped at 8 (or the number of your cores).

    Modifying OpenBLAS settings or compiling Julia with a different BLAS library, eg Intel MKL, may provide performance improvements. You can use MKL.jl, a package that makes Julia's linear algebra use Intel MKL BLAS and LAPACK instead of OpenBLAS, or search the discussion forum for suggestions on how to set this up manually. Note that Intel MKL cannot be bundled with Julia, as it is not open source.

    Computing cluster

    How do I manage precompilation caches in distributed file systems?

    When using Julia in high-performance computing (HPC) facilities with shared filesystems, it is recommended to use a shared depot (via the JULIA_DEPOT_PATH environment variable). Since Julia v1.10, multiple Julia processes on functionally similar workers and using the same depot will coordinate via pidfile locks to only spend effort precompiling on one process while the others wait. The precompilation process will indicate when the process is precompiling or waiting for another that is precompiling. If non-interactive the messages are via @debug.

    However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to get a single cache that is usable throughout the HPC environment.

    Julia Releases

    Do I want to use the Stable, LTS, or nightly version of Julia?

    The Stable version of Julia is the latest released version of Julia, this is the version most people will want to run. It has the latest features, including improved performance. The Stable version of Julia is versioned according to SemVer as v1.x.y. A new minor release of Julia corresponding to a new Stable version is made approximately every 4-5 months after a few weeks of testing as a release candidate. Unlike the LTS version the Stable version will not normally receive bugfixes after another Stable version of Julia has been released. However, upgrading to the next Stable release will always be possible as each release of Julia v1.x will continue to run code written for earlier versions.

    You may prefer the LTS (Long Term Support) version of Julia if you are looking for a very stable code base. The current LTS version of Julia is versioned according to SemVer as v1.6.x; this branch will continue to receive bugfixes until a new LTS branch is chosen, at which point the v1.6.x series will no longer received regular bug fixes and all but the most conservative users will be advised to upgrade to the new LTS version series. As a package developer, you may prefer to develop for the LTS version, to maximize the number of users who can use your package. As per SemVer, code written for v1.0 will continue to work for all future LTS and Stable versions. In general, even if targeting the LTS, one can develop and run code in the latest Stable version, to take advantage of the improved performance; so long as one avoids using new features (such as added library functions or new methods).

    You may prefer the nightly version of Julia if you want to take advantage of the latest updates to the language, and don't mind if the version available today occasionally doesn't actually work. As the name implies, releases to the nightly version are made roughly every night (depending on build infrastructure stability). In general nightly released are fairly safe to use—your code will not catch on fire. However, they may be occasional regressions and or issues that will not be found until more thorough pre-release testing. You may wish to test against the nightly version to ensure that such regressions that affect your use case are caught before a release is made.

    Finally, you may also consider building Julia from source for yourself. This option is mainly for those individuals who are comfortable at the command line, or interested in learning. If this describes you, you may also be interested in reading our guidelines for contributing.

    Links to each of these download types can be found on the download page at https://julialang.org/downloads/. Note that not all versions of Julia are available for all platforms.

    How can I transfer the list of installed packages after updating my version of Julia?

    Each minor version of julia has its own default environment. As a result, upon installing a new minor version of Julia, the packages you added using the previous minor version will not be available by default. The environment for a given julia version is defined by the files Project.toml and Manifest.toml in a folder matching the version number in .julia/environments/, for instance, .julia/environments/v1.3.

    If you install a new minor version of Julia, say 1.4, and want to use in its default environment the same packages as in a previous version (e.g. 1.3), you can copy the contents of the file Project.toml from the 1.3 folder to 1.4. Then, in a session of the new Julia version, enter the "package management mode" by typing the key ], and run the command instantiate.

    This operation will resolve a set of feasible packages from the copied file that are compatible with the target Julia version, and will install or update them if suitable. If you want to reproduce not only the set of packages, but also the versions you were using in the previous Julia version, you should also copy the Manifest.toml file before running the Pkg command instantiate. However, note that packages may define compatibility constraints that may be affected by changing the version of Julia, so the exact set of versions you had in 1.3 may not work for 1.4.

    +@btime $A * $B

    can be different when compared to other languages like Matlab or R.

    Since operations like this are very thin wrappers over the relevant BLAS functions, the reason for the discrepancy is very likely to be

    1. the BLAS library each language is using,

    2. the number of concurrent threads.

    Julia compiles and uses its own copy of OpenBLAS, with threads currently capped at 8 (or the number of your cores).

    Modifying OpenBLAS settings or compiling Julia with a different BLAS library, eg Intel MKL, may provide performance improvements. You can use MKL.jl, a package that makes Julia's linear algebra use Intel MKL BLAS and LAPACK instead of OpenBLAS, or search the discussion forum for suggestions on how to set this up manually. Note that Intel MKL cannot be bundled with Julia, as it is not open source.

    Computing cluster

    How do I manage precompilation caches in distributed file systems?

    When using Julia in high-performance computing (HPC) facilities with shared filesystems, it is recommended to use a shared depot (via the JULIA_DEPOT_PATH environment variable). Since Julia v1.10, multiple Julia processes on functionally similar workers and using the same depot will coordinate via pidfile locks to only spend effort precompiling on one process while the others wait. The precompilation process will indicate when the process is precompiling or waiting for another that is precompiling. If non-interactive the messages are via @debug.

    However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to get a single cache that is usable throughout the HPC environment.

    Julia Releases

    Do I want to use the Stable, LTS, or nightly version of Julia?

    The Stable version of Julia is the latest released version of Julia, this is the version most people will want to run. It has the latest features, including improved performance. The Stable version of Julia is versioned according to SemVer as v1.x.y. A new minor release of Julia corresponding to a new Stable version is made approximately every 4-5 months after a few weeks of testing as a release candidate. Unlike the LTS version the Stable version will not normally receive bugfixes after another Stable version of Julia has been released. However, upgrading to the next Stable release will always be possible as each release of Julia v1.x will continue to run code written for earlier versions.

    You may prefer the LTS (Long Term Support) version of Julia if you are looking for a very stable code base. The current LTS version of Julia is versioned according to SemVer as v1.6.x; this branch will continue to receive bugfixes until a new LTS branch is chosen, at which point the v1.6.x series will no longer received regular bug fixes and all but the most conservative users will be advised to upgrade to the new LTS version series. As a package developer, you may prefer to develop for the LTS version, to maximize the number of users who can use your package. As per SemVer, code written for v1.0 will continue to work for all future LTS and Stable versions. In general, even if targeting the LTS, one can develop and run code in the latest Stable version, to take advantage of the improved performance; so long as one avoids using new features (such as added library functions or new methods).

    You may prefer the nightly version of Julia if you want to take advantage of the latest updates to the language, and don't mind if the version available today occasionally doesn't actually work. As the name implies, releases to the nightly version are made roughly every night (depending on build infrastructure stability). In general nightly released are fairly safe to use—your code will not catch on fire. However, they may be occasional regressions and or issues that will not be found until more thorough pre-release testing. You may wish to test against the nightly version to ensure that such regressions that affect your use case are caught before a release is made.

    Finally, you may also consider building Julia from source for yourself. This option is mainly for those individuals who are comfortable at the command line, or interested in learning. If this describes you, you may also be interested in reading our guidelines for contributing.

    Links to each of these download types can be found on the download page at https://julialang.org/downloads/. Note that not all versions of Julia are available for all platforms.

    How can I transfer the list of installed packages after updating my version of Julia?

    Each minor version of julia has its own default environment. As a result, upon installing a new minor version of Julia, the packages you added using the previous minor version will not be available by default. The environment for a given julia version is defined by the files Project.toml and Manifest.toml in a folder matching the version number in .julia/environments/, for instance, .julia/environments/v1.3.

    If you install a new minor version of Julia, say 1.4, and want to use in its default environment the same packages as in a previous version (e.g. 1.3), you can copy the contents of the file Project.toml from the 1.3 folder to 1.4. Then, in a session of the new Julia version, enter the "package management mode" by typing the key ], and run the command instantiate.

    This operation will resolve a set of feasible packages from the copied file that are compatible with the target Julia version, and will install or update them if suitable. If you want to reproduce not only the set of packages, but also the versions you were using in the previous Julia version, you should also copy the Manifest.toml file before running the Pkg command instantiate. However, note that packages may define compatibility constraints that may be affected by changing the version of Julia, so the exact set of versions you had in 1.3 may not work for 1.4.

    diff --git a/en/v1.12-dev/manual/functions/index.html b/en/v1.12-dev/manual/functions/index.html index 44c6374e88c..7f2b9743c6b 100644 --- a/en/v1.12-dev/manual/functions/index.html +++ b/en/v1.12-dev/manual/functions/index.html @@ -418,4 +418,4 @@ 0.5 6 -4 - true

    All functions in the fused broadcast are always called for every element of the result. Thus X .+ σ .* randn.() will add a mask of independent and identically sampled random values to each element of the array X, but X .+ σ .* randn() will add the same random sample to each element. In cases where the fused computation is constant along one or more axes of the broadcast iteration, it may be possible to leverage a space-time tradeoff and allocate intermediate values to reduce the number of computations. See more at performance tips.

    Further Reading

    We should mention here that this is far from a complete picture of defining functions. Julia has a sophisticated type system and allows multiple dispatch on argument types. None of the examples given here provide any type annotations on their arguments, meaning that they are applicable to all types of arguments. The type system is described in Types and defining a function in terms of methods chosen by multiple dispatch on run-time argument types is described in Methods.

    + true

    All functions in the fused broadcast are always called for every element of the result. Thus X .+ σ .* randn.() will add a mask of independent and identically sampled random values to each element of the array X, but X .+ σ .* randn() will add the same random sample to each element. In cases where the fused computation is constant along one or more axes of the broadcast iteration, it may be possible to leverage a space-time tradeoff and allocate intermediate values to reduce the number of computations. See more at performance tips.

    Further Reading

    We should mention here that this is far from a complete picture of defining functions. Julia has a sophisticated type system and allows multiple dispatch on argument types. None of the examples given here provide any type annotations on their arguments, meaning that they are applicable to all types of arguments. The type system is described in Types and defining a function in terms of methods chosen by multiple dispatch on run-time argument types is described in Methods.

    diff --git a/en/v1.12-dev/manual/getting-started/index.html b/en/v1.12-dev/manual/getting-started/index.html index cb69ff439d9..281cb170566 100644 --- a/en/v1.12-dev/manual/getting-started/index.html +++ b/en/v1.12-dev/manual/getting-started/index.html @@ -10,8 +10,8 @@ (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | - | | |_| | | | (_| | | Version 1.12.0-DEV.1896 (2025-01-16) - _/ |\__'_|_|_|\__'_| | Commit 2dc3337626c (0 days old master) + | | |_| | | | (_| | | Version 1.12.0-DEV.1897 (2025-01-16) + _/ |\__'_|_|_|\__'_| | Commit b0ae24ffada (0 days old master) |__/ | @@ -24,4 +24,4 @@ begin - begin...end denotes a block of code.

    If you already know Julia a bit, you might want to peek ahead at Performance Tips and Workflow Tips, or check out the comprehensive ModernJuliaWorkflows blog.

    + begin...end denotes a block of code.

    If you already know Julia a bit, you might want to peek ahead at Performance Tips and Workflow Tips, or check out the comprehensive ModernJuliaWorkflows blog.

    diff --git a/en/v1.12-dev/manual/handling-operating-system-variation/index.html b/en/v1.12-dev/manual/handling-operating-system-variation/index.html index b49904f6a46..4e42705ec85 100644 --- a/en/v1.12-dev/manual/handling-operating-system-variation/index.html +++ b/en/v1.12-dev/manual/handling-operating-system-variation/index.html @@ -11,4 +11,4 @@ apple_specific_thing(a) else generic_thing(a) -end

    When nesting conditionals, the @static must be repeated for each level (parentheses optional, but recommended for readability):

    @static Sys.iswindows() ? :a : (@static Sys.isapple() ? :b : :c)
    +end

    When nesting conditionals, the @static must be repeated for each level (parentheses optional, but recommended for readability):

    @static Sys.iswindows() ? :a : (@static Sys.isapple() ? :b : :c)
    diff --git a/en/v1.12-dev/manual/installation/index.html b/en/v1.12-dev/manual/installation/index.html index c9ab7a90a53..bbace53fd10 100644 --- a/en/v1.12-dev/manual/installation/index.html +++ b/en/v1.12-dev/manual/installation/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Installation

    There are many ways to install Julia. The following sections highlight the recommended method for each of the main supported platforms, and then present alternative ways that might be useful in specialized situations.

    The current installation recommendation is a solution based on Juliaup. If you installed Julia previously with a method that is not based on Juliaup and want to switch your system to an installation that is based on Juliaup, we recommend that you uninstall all previous Julia versions, ensure that you remove anything Julia related from your PATH variable and then install Julia with one of the methods described below.

    Windows

    On Windows Julia can be installed directly from the Windows store here. One can also install exactly the same version by executing

    winget install julia -s msstore

    in any shell.

    Mac and Linux

    Julia can be installed on Linux or Mac by executing

    curl -fsSL https://install.julialang.org | sh

    in a shell.

    Command line arguments

    One can pass various command line arguments to the Julia installer. The syntax for installer arguments is

    curl -fsSL https://install.julialang.org | sh -s -- <ARGS>

    Here <ARGS> should be replaced with one or more of the following arguments:

    • --yes (or -y): Run the installer in a non-interactive mode. All configuration values use their default or a value supplied as a command line argument.
    • --default-channel=<NAME>: Configure the default Juliaup channel. For example --default-channel lts would install the lts channel and configure it as the default.
    • --add-to-path=<yes|no>: Configure whether Julia should be added to the PATH environment variable. Valid values are yes (default) and no.
    • --background-selfupdate=<SECONDS>: Configure an optional CRON job that auto-updates Juliaup if <SECONDS> has a value larger than 0. The actual value controls how often the CRON job will run to check for a new Juliaup version in seconds. The default value is 0, i.e. no CRON job will be created.
    • --startup-selfupdate=<MINUTES>: Configure how often Julia will check for new versions of Juliaup when Julia is started. The default is every 1440 minutes.
    • -p=<PATH> (or --path): Configure where the Julia and Juliaup binaries are installed. The default is ~/.juliaup.

    Alternative installation methods

    Note that we recommend the following methods only if none of the installation methods described above work for your system.

    Some of the installation methods described below recommend installing a package called juliaup. Note that this nevertheless installs a fully functional Julia system, not just Juliaup.

    App Installer (Windows)

    If the Windows Store is blocked on a system, we have an alternative MSIX App Installer based setup. To use the App Installer version, download this file and open it by double clicking on it.

    MSI Installer (Windows)

    If neither the Windows Store nor the App Installer version work on your Windows system, you can also use a MSI based installer. Note that this installation methods comes with serious limitations and is generally not recommended unless no other method works. For example, there is no automatic update mechanism for Juliaup with this installation method. The 64 bit version of the MSI installer can be downloaded from here and the 32 bit version from here.

    By default the install will be a per-user install that does not require elevation. You can also do a system install by running the following command from a shell:

    msiexec /i <PATH_TO_JULIA_MSI> ALLUSERS=1

    Homebrew (Mac and Linux)

    On systems with brew, you can install Julia by running

    brew install juliaup

    in a shell. Note that you will have to update Juliaup with standard brew commands.

    Arch Linux - AUR (Linux)

    On Arch Linux, Juliaup is available in the Arch User Repository (AUR).

    openSUSE Tumbleweed (Linux)

    On openSUSE Tumbleweed, you can install Julia by running

    zypper install juliaup

    in a shell with root privileges.

    cargo (Windows, Mac and Linux)

    To install Julia via Rust's cargo, run:

    cargo install juliaup
    +

    Installation

    There are many ways to install Julia. The following sections highlight the recommended method for each of the main supported platforms, and then present alternative ways that might be useful in specialized situations.

    The current installation recommendation is a solution based on Juliaup. If you installed Julia previously with a method that is not based on Juliaup and want to switch your system to an installation that is based on Juliaup, we recommend that you uninstall all previous Julia versions, ensure that you remove anything Julia related from your PATH variable and then install Julia with one of the methods described below.

    Windows

    On Windows Julia can be installed directly from the Windows store here. One can also install exactly the same version by executing

    winget install julia -s msstore

    in any shell.

    Mac and Linux

    Julia can be installed on Linux or Mac by executing

    curl -fsSL https://install.julialang.org | sh

    in a shell.

    Command line arguments

    One can pass various command line arguments to the Julia installer. The syntax for installer arguments is

    curl -fsSL https://install.julialang.org | sh -s -- <ARGS>

    Here <ARGS> should be replaced with one or more of the following arguments:

    • --yes (or -y): Run the installer in a non-interactive mode. All configuration values use their default or a value supplied as a command line argument.
    • --default-channel=<NAME>: Configure the default Juliaup channel. For example --default-channel lts would install the lts channel and configure it as the default.
    • --add-to-path=<yes|no>: Configure whether Julia should be added to the PATH environment variable. Valid values are yes (default) and no.
    • --background-selfupdate=<SECONDS>: Configure an optional CRON job that auto-updates Juliaup if <SECONDS> has a value larger than 0. The actual value controls how often the CRON job will run to check for a new Juliaup version in seconds. The default value is 0, i.e. no CRON job will be created.
    • --startup-selfupdate=<MINUTES>: Configure how often Julia will check for new versions of Juliaup when Julia is started. The default is every 1440 minutes.
    • -p=<PATH> (or --path): Configure where the Julia and Juliaup binaries are installed. The default is ~/.juliaup.

    Alternative installation methods

    Note that we recommend the following methods only if none of the installation methods described above work for your system.

    Some of the installation methods described below recommend installing a package called juliaup. Note that this nevertheless installs a fully functional Julia system, not just Juliaup.

    App Installer (Windows)

    If the Windows Store is blocked on a system, we have an alternative MSIX App Installer based setup. To use the App Installer version, download this file and open it by double clicking on it.

    MSI Installer (Windows)

    If neither the Windows Store nor the App Installer version work on your Windows system, you can also use a MSI based installer. Note that this installation methods comes with serious limitations and is generally not recommended unless no other method works. For example, there is no automatic update mechanism for Juliaup with this installation method. The 64 bit version of the MSI installer can be downloaded from here and the 32 bit version from here.

    By default the install will be a per-user install that does not require elevation. You can also do a system install by running the following command from a shell:

    msiexec /i <PATH_TO_JULIA_MSI> ALLUSERS=1

    Homebrew (Mac and Linux)

    On systems with brew, you can install Julia by running

    brew install juliaup

    in a shell. Note that you will have to update Juliaup with standard brew commands.

    Arch Linux - AUR (Linux)

    On Arch Linux, Juliaup is available in the Arch User Repository (AUR).

    openSUSE Tumbleweed (Linux)

    On openSUSE Tumbleweed, you can install Julia by running

    zypper install juliaup

    in a shell with root privileges.

    cargo (Windows, Mac and Linux)

    To install Julia via Rust's cargo, run:

    cargo install juliaup
    diff --git a/en/v1.12-dev/manual/integers-and-floating-point-numbers/index.html b/en/v1.12-dev/manual/integers-and-floating-point-numbers/index.html index 5bca9093423..38809d7410d 100644 --- a/en/v1.12-dev/manual/integers-and-floating-point-numbers/index.html +++ b/en/v1.12-dev/manual/integers-and-floating-point-numbers/index.html @@ -327,4 +327,4 @@ 1 julia> one(BigFloat) -1.0 +1.0 diff --git a/en/v1.12-dev/manual/interfaces/index.html b/en/v1.12-dev/manual/interfaces/index.html index 746b8d2deb7..45b6cceda54 100644 --- a/en/v1.12-dev/manual/interfaces/index.html +++ b/en/v1.12-dev/manual/interfaces/index.html @@ -263,4 +263,4 @@ Interval{Float64}(2.0, 3.0) julia> trunc(x) -Interval{Float64}(1.0, 2.0) +Interval{Float64}(1.0, 2.0) diff --git a/en/v1.12-dev/manual/mathematical-operations/index.html b/en/v1.12-dev/manual/mathematical-operations/index.html index 85d82b0b575..a0244efc108 100644 --- a/en/v1.12-dev/manual/mathematical-operations/index.html +++ b/en/v1.12-dev/manual/mathematical-operations/index.html @@ -179,4 +179,4 @@ asin acos atan acot asec acsc asinh acosh atanh acoth asech acsch sinc cosc

    These are all single-argument functions, with atan also accepting two arguments corresponding to a traditional atan2 function.

    Additionally, sinpi(x) and cospi(x) are provided for more accurate computations of sin(pi * x) and cos(pi * x) respectively.

    In order to compute trigonometric functions with degrees instead of radians, suffix the function with d. For example, sind(x) computes the sine of x where x is specified in degrees. The complete list of trigonometric functions with degree variants is:

    sind   cosd   tand   cotd   secd   cscd
    -asind  acosd  atand  acotd  asecd  acscd

    Special functions

    Many other special mathematical functions are provided by the package SpecialFunctions.jl.

    +asind acosd atand acotd asecd acscd

    Special functions

    Many other special mathematical functions are provided by the package SpecialFunctions.jl.

    diff --git a/en/v1.12-dev/manual/metaprogramming/index.html b/en/v1.12-dev/manual/metaprogramming/index.html index 65584a4626a..b3c58735f6d 100644 --- a/en/v1.12-dev/manual/metaprogramming/index.html +++ b/en/v1.12-dev/manual/metaprogramming/index.html @@ -502,4 +502,4 @@ end; julia> sub2ind_gen((3, 5), 1, 2) -4

    Internally, this code creates two implementations of the function: a generated one where the first block in if @generated is used, and a normal one where the else block is used. Inside the then part of the if @generated block, code has the same semantics as other generated functions: argument names refer to types, and the code should return an expression. Multiple if @generated blocks may occur, in which case the generated implementation uses all of the then blocks and the alternate implementation uses all of the else blocks.

    Notice that we added an error check to the top of the function. This code will be common to both versions, and is run-time code in both versions (it will be quoted and returned as an expression from the generated version). That means that the values and types of local variables are not available at code generation time –- the code-generation code can only see the types of arguments.

    In this style of definition, the code generation feature is essentially an optional optimization. The compiler will use it if convenient, but otherwise may choose to use the normal implementation instead. This style is preferred, since it allows the compiler to make more decisions and compile programs in more ways, and since normal code is more readable than code-generating code. However, which implementation is used depends on compiler implementation details, so it is essential for the two implementations to behave identically.

    +4

    Internally, this code creates two implementations of the function: a generated one where the first block in if @generated is used, and a normal one where the else block is used. Inside the then part of the if @generated block, code has the same semantics as other generated functions: argument names refer to types, and the code should return an expression. Multiple if @generated blocks may occur, in which case the generated implementation uses all of the then blocks and the alternate implementation uses all of the else blocks.

    Notice that we added an error check to the top of the function. This code will be common to both versions, and is run-time code in both versions (it will be quoted and returned as an expression from the generated version). That means that the values and types of local variables are not available at code generation time –- the code-generation code can only see the types of arguments.

    In this style of definition, the code generation feature is essentially an optional optimization. The compiler will use it if convenient, but otherwise may choose to use the normal implementation instead. This style is preferred, since it allows the compiler to make more decisions and compile programs in more ways, and since normal code is more readable than code-generating code. However, which implementation is used depends on compiler implementation details, so it is essential for the two implementations to behave identically.

    diff --git a/en/v1.12-dev/manual/methods/index.html b/en/v1.12-dev/manual/methods/index.html index eeff5a37256..7dcaedf7cca 100644 --- a/en/v1.12-dev/manual/methods/index.html +++ b/en/v1.12-dev/manual/methods/index.html @@ -466,4 +466,4 @@ else x -> x - 1 end -end
    +end
    diff --git a/en/v1.12-dev/manual/missing/index.html b/en/v1.12-dev/manual/missing/index.html index a2a5b61ea18..de254bf6224 100644 --- a/en/v1.12-dev/manual/missing/index.html +++ b/en/v1.12-dev/manual/missing/index.html @@ -161,4 +161,4 @@ true julia> any([false, missing]) -missing +missing diff --git a/en/v1.12-dev/manual/modules/index.html b/en/v1.12-dev/manual/modules/index.html index 1b0101940b0..c83a4fcd5ed 100644 --- a/en/v1.12-dev/manual/modules/index.html +++ b/en/v1.12-dev/manual/modules/index.html @@ -132,4 +132,4 @@ # instead use accessor functions: getstdout() = Base.stdout #= best option =# # or move the assignment into the runtime: -__init__() = global mystdout = Base.stdout #= also works =#

    Several additional restrictions are placed on the operations that can be done while precompiling code to help the user avoid other wrong-behavior situations:

    1. Calling eval to cause a side-effect in another module. This will also cause a warning to be emitted when the incremental precompile flag is set.
    2. global const statements from local scope after __init__() has been started (see issue #12010 for plans to add an error for this)
    3. Replacing a module is a runtime error while doing an incremental precompile.

    A few other points to be aware of:

    1. No code reload / cache invalidation is performed after changes are made to the source files themselves, (including by Pkg.update), and no cleanup is done after Pkg.rm
    2. The memory sharing behavior of a reshaped array is disregarded by precompilation (each view gets its own copy)
    3. Expecting the filesystem to be unchanged between compile-time and runtime e.g. @__FILE__/source_path() to find resources at runtime, or the BinDeps @checked_lib macro. Sometimes this is unavoidable. However, when possible, it can be good practice to copy resources into the module at compile-time so they won't need to be found at runtime.
    4. WeakRef objects and finalizers are not currently handled properly by the serializer (this will be fixed in an upcoming release).
    5. It is usually best to avoid capturing references to instances of internal metadata objects such as Method, MethodInstance, MethodTable, TypeMapLevel, TypeMapEntry and fields of those objects, as this can confuse the serializer and may not lead to the outcome you desire. It is not necessarily an error to do this, but you simply need to be prepared that the system will try to copy some of these and to create a single unique instance of others.

    It is sometimes helpful during module development to turn off incremental precompilation. The command line flag --compiled-modules={yes|no|existing} enables you to toggle module precompilation on and off. When Julia is started with --compiled-modules=no the serialized modules in the compile cache are ignored when loading modules and module dependencies. In some cases, you may want to load existing precompiled modules, but not create new ones. This can be done by starting Julia with --compiled-modules=existing. More fine-grained control is available with --pkgimages={yes|no|existing}, which only affects native-code storage during precompilation. Base.compilecache can still be called manually. The state of this command line flag is passed to Pkg.build to disable automatic precompilation triggering when installing, updating, and explicitly building packages.

    You can also debug some precompilation failures with environment variables. Setting JULIA_VERBOSE_LINKING=true may help resolve failures in linking shared libraries of compiled native code. See the Developer Documentation part of the Julia manual, where you will find further details in the section documenting Julia's internals under "Package Images".

    +__init__() = global mystdout = Base.stdout #= also works =#

    Several additional restrictions are placed on the operations that can be done while precompiling code to help the user avoid other wrong-behavior situations:

    1. Calling eval to cause a side-effect in another module. This will also cause a warning to be emitted when the incremental precompile flag is set.
    2. global const statements from local scope after __init__() has been started (see issue #12010 for plans to add an error for this)
    3. Replacing a module is a runtime error while doing an incremental precompile.

    A few other points to be aware of:

    1. No code reload / cache invalidation is performed after changes are made to the source files themselves, (including by Pkg.update), and no cleanup is done after Pkg.rm
    2. The memory sharing behavior of a reshaped array is disregarded by precompilation (each view gets its own copy)
    3. Expecting the filesystem to be unchanged between compile-time and runtime e.g. @__FILE__/source_path() to find resources at runtime, or the BinDeps @checked_lib macro. Sometimes this is unavoidable. However, when possible, it can be good practice to copy resources into the module at compile-time so they won't need to be found at runtime.
    4. WeakRef objects and finalizers are not currently handled properly by the serializer (this will be fixed in an upcoming release).
    5. It is usually best to avoid capturing references to instances of internal metadata objects such as Method, MethodInstance, MethodTable, TypeMapLevel, TypeMapEntry and fields of those objects, as this can confuse the serializer and may not lead to the outcome you desire. It is not necessarily an error to do this, but you simply need to be prepared that the system will try to copy some of these and to create a single unique instance of others.

    It is sometimes helpful during module development to turn off incremental precompilation. The command line flag --compiled-modules={yes|no|existing} enables you to toggle module precompilation on and off. When Julia is started with --compiled-modules=no the serialized modules in the compile cache are ignored when loading modules and module dependencies. In some cases, you may want to load existing precompiled modules, but not create new ones. This can be done by starting Julia with --compiled-modules=existing. More fine-grained control is available with --pkgimages={yes|no|existing}, which only affects native-code storage during precompilation. Base.compilecache can still be called manually. The state of this command line flag is passed to Pkg.build to disable automatic precompilation triggering when installing, updating, and explicitly building packages.

    You can also debug some precompilation failures with environment variables. Setting JULIA_VERBOSE_LINKING=true may help resolve failures in linking shared libraries of compiled native code. See the Developer Documentation part of the Julia manual, where you will find further details in the section documenting Julia's internals under "Package Images".

    diff --git a/en/v1.12-dev/manual/multi-threading/index.html b/en/v1.12-dev/manual/multi-threading/index.html index aa074b1f9cf..31dc1448bb6 100644 --- a/en/v1.12-dev/manual/multi-threading/index.html +++ b/en/v1.12-dev/manual/multi-threading/index.html @@ -172,4 +172,4 @@ end end nothing -end
  • A related third strategy is to use a yield-free queue. We don't currently have a lock-free queue implemented in Base, but Base.IntrusiveLinkedListSynchronized{T} is suitable. This can frequently be a good strategy to use for code with event loops. For example, this strategy is employed by Gtk.jl to manage lifetime ref-counting. In this approach, we don't do any explicit work inside the finalizer, and instead add it to a queue to run at a safer time. In fact, Julia's task scheduler already uses this, so defining the finalizer as x -> @spawn do_cleanup(x) is one example of this approach. Note however that this doesn't control which thread do_cleanup runs on, so do_cleanup would still need to acquire a lock. That doesn't need to be true if you implement your own queue, as you can explicitly only drain that queue from your thread.

  • +end
  • A related third strategy is to use a yield-free queue. We don't currently have a lock-free queue implemented in Base, but Base.IntrusiveLinkedListSynchronized{T} is suitable. This can frequently be a good strategy to use for code with event loops. For example, this strategy is employed by Gtk.jl to manage lifetime ref-counting. In this approach, we don't do any explicit work inside the finalizer, and instead add it to a queue to run at a safer time. In fact, Julia's task scheduler already uses this, so defining the finalizer as x -> @spawn do_cleanup(x) is one example of this approach. Note however that this doesn't control which thread do_cleanup runs on, so do_cleanup would still need to acquire a lock. That doesn't need to be true if you implement your own queue, as you can explicitly only drain that queue from your thread.

  • diff --git a/en/v1.12-dev/manual/networking-and-streams/index.html b/en/v1.12-dev/manual/networking-and-streams/index.html index 1cc09b52ef6..a11f3e3978b 100644 --- a/en/v1.12-dev/manual/networking-and-streams/index.html +++ b/en/v1.12-dev/manual/networking-and-streams/index.html @@ -157,4 +157,4 @@ group = Sockets.IPv6("ff05::5:6:7") socket = Sockets.UDPSocket() send(socket, group, 6789, "Hello over IPv6") -close(socket) +close(socket) diff --git a/en/v1.12-dev/manual/noteworthy-differences/index.html b/en/v1.12-dev/manual/noteworthy-differences/index.html index b6b755c5340..9f61c79febc 100644 --- a/en/v1.12-dev/manual/noteworthy-differences/index.html +++ b/en/v1.12-dev/manual/noteworthy-differences/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Noteworthy Differences from other Languages

    Noteworthy differences from MATLAB

    Although MATLAB users may find Julia's syntax familiar, Julia is not a MATLAB clone. There are major syntactic and functional differences. The following are some noteworthy differences that may trip up Julia users accustomed to MATLAB:

    • Julia arrays are indexed with square brackets, A[i,j].
    • Julia arrays are not copied when assigned to another variable. After A = B, changing elements of B will modify A as well. To avoid this, use A = copy(B).
    • Julia values are not copied when passed to a function. If a function modifies an array, the changes will be visible in the caller.
    • Julia does not automatically grow arrays in an assignment statement. Whereas in MATLAB a(4) = 3.2 can create the array a = [0 0 0 3.2] and a(5) = 7 can grow it into a = [0 0 0 3.2 7], the corresponding Julia statement a[5] = 7 throws an error if the length of a is less than 5 or if this statement is the first use of the identifier a. Julia has push! and append!, which grow Vectors much more efficiently than MATLAB's a(end+1) = val.
    • The imaginary unit sqrt(-1) is represented in Julia as im, not i or j as in MATLAB.
    • In Julia, literal numbers without a decimal point (such as 42) create integers instead of floating point numbers. As a result, some operations can throw a domain error if they expect a float; for example, julia> a = -1; 2^a throws a domain error, as the result is not an integer (see the FAQ entry on domain errors for details).
    • In Julia, multiple values are returned and assigned as tuples, e.g. (a, b) = (1, 2) or a, b = 1, 2. MATLAB's nargout, which is often used in MATLAB to do optional work based on the number of returned values, does not exist in Julia. Instead, users can use optional and keyword arguments to achieve similar capabilities.
    • Julia has true one-dimensional arrays. Column vectors are of size N, not Nx1. For example, rand(N) makes a 1-dimensional array.
    • In Julia, [x,y,z] will always construct a 3-element array containing x, y and z.
      • To concatenate in the first ("vertical") dimension use either vcat(x,y,z) or separate with semicolons ([x; y; z]).
      • To concatenate in the second ("horizontal") dimension use either hcat(x,y,z) or separate with spaces ([x y z]).
      • To construct block matrices (concatenating in the first two dimensions), use either hvcat or combine spaces and semicolons ([a b; c d]).
    • In Julia, a:b and a:b:c construct AbstractRange objects. To construct a full vector like in MATLAB, use collect(a:b). Generally, there is no need to call collect though. An AbstractRange object will act like a normal array in most cases but is more efficient because it lazily computes its values. This pattern of creating specialized objects instead of full arrays is used frequently, and is also seen in functions such as range, or with iterators such as enumerate, and zip. The special objects can mostly be used as if they were normal arrays.
    • Functions in Julia return values from their last expression or the return keyword instead of listing the names of variables to return in the function definition (see The return Keyword for details).
    • A Julia script may contain any number of functions, and all definitions will be externally visible when the file is loaded. Function definitions can be loaded from files outside the current working directory.
    • In Julia, reductions such as sum, prod, and maximum are performed over every element of an array when called with a single argument, as in sum(A), even if A has more than one dimension.
    • In Julia, parentheses must be used to call a function with zero arguments, like in rand().
    • Julia discourages the use of semicolons to end statements. The results of statements are not automatically printed (except at the interactive prompt), and lines of code do not need to end with semicolons. println or @printf can be used to print specific output.
    • In Julia, if A and B are arrays, logical comparison operations like A == B do not return an array of booleans. Instead, use A .== B, and similarly for the other boolean operators like <, >.
    • In Julia, when you want to apply a scalar-valued function elementwise to an array, use broadcasting syntax: f.(A) instead of f(A). In some cases, both operations are defined but mean different things: in MATLAB exp(A) applies elementwise and expm(A) is the matrix exponential, but in Julia exp.(A) applies elementwise and exp(A) is the matrix exponential.
    • In Julia, the operators &, |, and (xor) perform the bitwise operations equivalent to and, or, and xor respectively in MATLAB, and have precedence similar to Python's bitwise operators (unlike C). They can operate on scalars or element-wise across arrays and can be used to combine logical arrays, but note the difference in order of operations: parentheses may be required (e.g., to select elements of A equal to 1 or 2 use (A .== 1) .| (A .== 2)).
    • In Julia, the elements of a collection can be passed as arguments to a function using the splat operator ..., as in xs=[1,2]; f(xs...).
    • Julia's svd returns singular values as a vector instead of as a dense diagonal matrix.
    • In Julia, ... is not used to continue lines of code. Instead, incomplete expressions automatically continue onto the next line.
    • In both Julia and MATLAB, the variable ans is set to the value of the last expression issued in an interactive session. In Julia, unlike MATLAB, ans is not set when Julia code is run in non-interactive mode.
    • Julia's structs do not support dynamically adding fields at runtime, unlike MATLAB's classes. Instead, use a Dict. Dict in Julia isn't ordered.
    • In Julia each module has its own global scope/namespace, whereas in MATLAB there is just one global scope.
    • In MATLAB, an idiomatic way to remove unwanted values is to use logical indexing, like in the expression x(x>3) or in the statement x(x>3) = [] to modify x in-place. In contrast, Julia provides the higher order functions filter and filter!, allowing users to write filter(z->z>3, x) and filter!(z->z>3, x) as alternatives to the corresponding transliterations x[x.>3] and x = x[x.>3]. Using filter! reduces the use of temporary arrays.
    • Following on from the previous point, to replace values that meet specific criteria, for example a thresholding operation on all elements in a matrix, could be achieved in Matlab as follows A(A < threshold) = 0. The Julia equivalent would be A[A .< threshold] .= 0.
    • The analogue of extracting (or "dereferencing") all elements of a cell array, e.g. in vertcat(A{:}) in MATLAB, is written using the splat operator in Julia, e.g. as vcat(A...).
    • In Julia, the adjoint function performs conjugate transposition; in MATLAB, adjoint provides the "adjugate" or classical adjoint, which is the transpose of the matrix of cofactors.
    • In Julia, a^b^c is evaluated a^(b^c) while in MATLAB it's (a^b)^c.

    Noteworthy differences from R

    One of Julia's goals is to provide an effective language for data analysis and statistical programming. For users coming to Julia from R, these are some noteworthy differences:

    • Julia's single quotes enclose characters, not strings.

    • Julia can create substrings by indexing into strings. In R, strings must be converted into character vectors before creating substrings.

    • In Julia, like Python but unlike R, strings can be created with triple quotes """ ... """. This syntax is convenient for constructing strings that contain line breaks.

    • In Julia, varargs are specified using the splat operator ..., which always follows the name of a specific variable, unlike R, for which ... can occur in isolation.

    • In Julia, modulus is mod(a, b), not a %% b. % in Julia is the remainder operator.

    • Julia constructs vectors using brackets. Julia's [1, 2, 3] is the equivalent of R's c(1, 2, 3).

    • In Julia, not all data structures support logical indexing. Furthermore, logical indexing in Julia is supported only with vectors of length equal to the object being indexed. For example:

      • In R, c(1, 2, 3, 4)[c(TRUE, FALSE)] is equivalent to c(1, 3).
      • In R, c(1, 2, 3, 4)[c(TRUE, FALSE, TRUE, FALSE)] is equivalent to c(1, 3).
      • In Julia, [1, 2, 3, 4][[true, false]] throws a BoundsError.
      • In Julia, [1, 2, 3, 4][[true, false, true, false]] produces [1, 3].
    • Like many languages, Julia does not always allow operations on vectors of different lengths, unlike R where the vectors only need to share a common index range. For example, c(1, 2, 3, 4) + c(1, 2) is valid R but the equivalent [1, 2, 3, 4] + [1, 2] will throw an error in Julia.

    • Julia allows an optional trailing comma when that comma does not change the meaning of code. This can cause confusion among R users when indexing into arrays. For example, x[1,] in R would return the first row of a matrix; in Julia, however, the comma is ignored, so x[1,] == x[1], and will return the first element. To extract a row, be sure to use :, as in x[1,:].

    • Julia's map takes the function first, then its arguments, unlike lapply(<structure>, function, ...) in R. Similarly Julia's equivalent of apply(X, MARGIN, FUN, ...) in R is mapslices where the function is the first argument.

    • Multivariate apply in R, e.g. mapply(choose, 11:13, 1:3), can be written as broadcast(binomial, 11:13, 1:3) in Julia. Equivalently Julia offers a shorter dot syntax for vectorizing functions binomial.(11:13, 1:3).

    • Julia uses end to denote the end of conditional blocks, like if, loop blocks, like while/ for, and functions. In lieu of the one-line if ( cond ) statement, Julia allows statements of the form if cond; statement; end, cond && statement and !cond || statement. Assignment statements in the latter two syntaxes must be explicitly wrapped in parentheses, e.g. cond && (x = value).

    • In Julia, <-, <<- and -> are not assignment operators.

    • Julia's -> creates an anonymous function.

    • Julia's * operator can perform matrix multiplication, unlike in R. If A and B are matrices, then A * B denotes a matrix multiplication in Julia, equivalent to R's A %*% B. In R, this same notation would perform an element-wise (Hadamard) product. To get the element-wise multiplication operation, you need to write A .* B in Julia.

    • Julia performs matrix transposition using the transpose function and conjugated transposition using the ' operator or the adjoint function. Julia's transpose(A) is therefore equivalent to R's t(A). Additionally a non-recursive transpose in Julia is provided by the permutedims function.

    • Julia does not require parentheses when writing if statements or for/while loops: use for i in [1, 2, 3] instead of for (i in c(1, 2, 3)) and if i == 1 instead of if (i == 1).

    • Julia does not treat the numbers 0 and 1 as Booleans. You cannot write if (1) in Julia, because if statements accept only booleans. Instead, you can write if true, if Bool(1), or if 1==1.

    • Julia does not provide nrow and ncol. Instead, use size(M, 1) for nrow(M) and size(M, 2) for ncol(M).

    • Julia is careful to distinguish scalars, vectors and matrices. In R, 1 and c(1) are the same. In Julia, they cannot be used interchangeably.

    • Julia's diag and diagm are not like R's.

    • Julia cannot assign to the results of function calls on the left hand side of an assignment operation: you cannot write diag(M) = fill(1, n).

    • Julia discourages populating the main namespace with functions. Most statistical functionality for Julia is found in packages under the JuliaStats organization. For example:

    • Julia provides tuples and real hash tables, but not R-style lists. When returning multiple items, you should typically use a tuple or a named tuple: instead of list(a = 1, b = 2), use (1, 2) or (a=1, b=2).

    • Julia encourages users to write their own types, which are easier to use than S3 or S4 objects in R. Julia's multiple dispatch system means that table(x::TypeA) and table(x::TypeB) act like R's table.TypeA(x) and table.TypeB(x).

    • In Julia, values are not copied when assigned or passed to a function. If a function modifies an array, the changes will be visible in the caller. This is very different from R and allows new functions to operate on large data structures much more efficiently.

    • In Julia, vectors and matrices are concatenated using hcat, vcat and hvcat, not c, rbind and cbind like in R.

    • In Julia, a range like a:b is not shorthand for a vector like in R, but is a specialized AbstractRange object that is used for iteration. To convert a range into a vector, use collect(a:b).

    • The : operator has a different precedence in R and Julia. In particular, in Julia arithmetic operators have higher precedence than the : operator, whereas the reverse is true in R. For example, 1:n-1 in Julia is equivalent to 1:(n-1) in R.

    • Julia's max and min are the equivalent of pmax and pmin respectively in R, but both arguments need to have the same dimensions. While maximum and minimum replace max and min in R, there are important differences.

    • Julia's sum, prod, maximum, and minimum are different from their counterparts in R. They all accept an optional keyword argument dims, which indicates the dimensions, over which the operation is carried out. For instance, let A = [1 2; 3 4] in Julia and B <- rbind(c(1,2),c(3,4)) be the same matrix in R. Then sum(A) gives the same result as sum(B), but sum(A, dims=1) is a row vector containing the sum over each column and sum(A, dims=2) is a column vector containing the sum over each row. This contrasts to the behavior of R, where separate colSums(B) and rowSums(B) functions provide these functionalities. If the dims keyword argument is a vector, then it specifies all the dimensions over which the sum is performed, while retaining the dimensions of the summed array, e.g. sum(A, dims=(1,2)) == hcat(10). It should be noted that there is no error checking regarding the second argument.

    • Julia has several functions that can mutate their arguments. For example, it has both sort and sort!.

    • In R, performance requires vectorization. In Julia, almost the opposite is true: the best performing code is often achieved by using devectorized loops.

    • Julia is eagerly evaluated and does not support R-style lazy evaluation. For most users, this means that there are very few unquoted expressions or column names.

    • Julia does not support the NULL type. The closest equivalent is nothing, but it behaves like a scalar value rather than like a list. Use x === nothing instead of is.null(x).

    • In Julia, missing values are represented by the missing object rather than by NA. Use ismissing(x) (or ismissing.(x) for element-wise operation on vectors) instead of is.na(x). The skipmissing function is generally used instead of na.rm=TRUE (though in some particular cases functions take a skipmissing argument).

    • Julia lacks the equivalent of R's assign or get.

    • In Julia, return does not require parentheses.

    • In R, an idiomatic way to remove unwanted values is to use logical indexing, like in the expression x[x>3] or in the statement x = x[x>3] to modify x in-place. In contrast, Julia provides the higher order functions filter and filter!, allowing users to write filter(z->z>3, x) and filter!(z->z>3, x) as alternatives to the corresponding transliterations x[x.>3] and x = x[x.>3]. Using filter! reduces the use of temporary arrays.

    Noteworthy differences from Python

    • Julia's for, if, while, etc. blocks are terminated by the end keyword. Indentation level is not significant as it is in Python. Unlike Python, Julia has no pass keyword.
    • Strings are denoted by double quotation marks ("text") in Julia (with three double quotation marks for multi-line strings), whereas in Python they can be denoted either by single ('text') or double quotation marks ("text"). Single quotation marks are used for characters in Julia ('c').
    • String concatenation is done with * in Julia, not + like in Python. Analogously, string repetition is done with ^, not *. Implicit string concatenation of string literals like in Python (e.g. 'ab' 'cd' == 'abcd') is not done in Julia.
    • Python Lists—flexible but slow—correspond to the Julia Vector{Any} type or more generally Vector{T} where T is some non-concrete element type. "Fast" arrays like NumPy arrays that store elements in-place (i.e., dtype is np.float64, [('f1', np.uint64), ('f2', np.int32)], etc.) can be represented by Array{T} where T is a concrete, immutable element type. This includes built-in types like Float64, Int32, Int64 but also more complex types like Tuple{UInt64,Float64} and many user-defined types as well.
    • In Julia, indexing of arrays, strings, etc. is 1-based not 0-based.
    • Julia's slice indexing includes the last element, unlike in Python. a[2:3] in Julia is a[1:3] in Python.
    • Unlike Python, Julia allows AbstractArrays with arbitrary indexes. Python's special interpretation of negative indexing, a[-1] and a[-2], should be written a[end] and a[end-1] in Julia.
    • Julia requires end for indexing until the last element. x[2:end] in Julia is equivalent to x[1:] in Python.
    • In Julia, : before any object creates a Symbol or quotes an expression; so, x[:5] is the same as x[5]. If you want to get the first n elements of an array, then use range indexing.
    • Julia's range indexing has the format of x[start:step:stop], whereas Python's format is x[start:(stop+1):step]. Hence, x[0:10:2] in Python is equivalent to x[1:2:10] in Julia. Similarly, x[::-1] in Python, which refers to the reversed array, is equivalent to x[end:-1:1] in Julia.
    • In Julia, ranges can be constructed independently as start:step:stop, the same syntax it uses in array-indexing. The range function is also supported.
    • In Julia, indexing a matrix with arrays like X[[1,2], [1,3]] refers to a sub-matrix that contains the intersections of the first and second rows with the first and third columns. In Python, X[[1,2], [1,3]] refers to a vector that contains the values of cell [1,1] and [2,3] in the matrix. X[[1,2], [1,3]] in Julia is equivalent with X[np.ix_([0,1],[0,2])] in Python. X[[0,1], [0,2]] in Python is equivalent with X[[CartesianIndex(1,1), CartesianIndex(2,3)]] in Julia.
    • Julia has no line continuation syntax: if, at the end of a line, the input so far is a complete expression, it is considered done; otherwise the input continues. One way to force an expression to continue is to wrap it in parentheses.
    • Julia arrays are column-major (Fortran-ordered) whereas NumPy arrays are row-major (C-ordered) by default. To get optimal performance when looping over arrays, the order of the loops should be reversed in Julia relative to NumPy (see relevant section of Performance Tips).
    • Julia's updating operators (e.g. +=, -=, ...) are not in-place whereas NumPy's are. This means A = [1, 1]; B = A; B += [3, 3] doesn't change values in A, it rather rebinds the name B to the result of the right-hand side B = B + 3, which is a new array. For in-place operation, use B .+= 3 (see also dot operators), explicit loops, or InplaceOps.jl.
    • Julia evaluates default values of function arguments every time the method is invoked, unlike in Python where the default values are evaluated only once when the function is defined. For example, the function f(x=rand()) = x returns a new random number every time it is invoked without argument. On the other hand, the function g(x=[1,2]) = push!(x,3) returns [1,2,3] every time it is called as g().
    • In Julia, keyword arguments must be passed using keywords, unlike Python in which it is usually possible to pass them positionally. Attempting to pass a keyword argument positionally alters the method signature leading to a MethodError or calling of the wrong method.
    • In Julia % is the remainder operator, whereas in Python it is the modulus.
    • In Julia, the commonly used Int type corresponds to the machine integer type (Int32 or Int64), unlike in Python, where int is an arbitrary length integer. This means in Julia the Int type will overflow, such that 2^64 == 0. If you need larger values use another appropriate type, such as Int128, BigInt or a floating point type like Float64.
    • The imaginary unit sqrt(-1) is represented in Julia as im, not j as in Python.
    • In Julia, the exponentiation operator is ^, not ** as in Python.
    • Julia uses nothing of type Nothing to represent a null value, whereas Python uses None of type NoneType.
    • In Julia, the standard operators over a matrix type are matrix operations, whereas, in Python, the standard operators are element-wise operations. When both A and B are matrices, A * B in Julia performs matrix multiplication, not element-wise multiplication as in Python. A * B in Julia is equivalent with A @ B in Python, whereas A * B in Python is equivalent with A .* B in Julia.
    • In Julia, when you want to apply a scalar-valued function elementwise to an array, use broadcasting syntax: f.(A) instead of f(A). In some cases, both operations are defined but mean different things: numpy.exp(A) applies elementwise and scipy.linalg.expm(A) is the matrix exponential, but in Julia exp.(A) applies elementwise and exp(A) is the matrix exponential.
    • The adjoint operator ' in Julia returns an adjoint of a vector (a lazy representation of row vector), whereas the transpose operator .T over a vector in Python returns the original vector (non-op).
    • In Julia, a function may contain multiple concrete implementations (called methods), which are selected via multiple dispatch based on the types of all arguments to the call, as compared to functions in Python, which have a single implementation and no polymorphism (as opposed to Python method calls which use a different syntax and allows dispatch on the receiver of the method).
    • There are no classes in Julia. Instead there are structures (mutable or immutable), containing data but no methods.
    • Calling a method of a class instance in Python (x = MyClass(*args); x.f(y)) corresponds to a function call in Julia, e.g. x = MyType(args...); f(x, y). In general, multiple dispatch is more flexible and powerful than the Python class system.
    • Julia structures may have exactly one abstract supertype, whereas Python classes can inherit from one or more (abstract or concrete) superclasses.
    • The logical Julia program structure (Packages and Modules) is independent of the file structure, whereas the Python code structure is defined by directories (Packages) and files (Modules).
    • In Julia, it is idiomatic to split the text of large modules into multiple files, without introducing a new module per file. The code is reassembled inside a single module in a main file via include. While the Python equivalent (exec) is not typical for this use (it will silently clobber prior definitions), Julia programs are defined as a unit at the module level with using or import, which will only get executed once when first needed–like include in Python. Within those modules, the individual files that make up that module are loaded with include by listing them once in the intended order.
    • The ternary operator x > 0 ? 1 : -1 in Julia corresponds to a conditional expression in Python 1 if x > 0 else -1.
    • In Julia the @ symbol refers to a macro, whereas in Python it refers to a decorator.
    • Exception handling in Julia is done using trycatchfinally, instead of tryexceptfinally. In contrast to Python, it is not recommended to use exception handling as part of the normal workflow in Julia (compared with Python, Julia is faster at ordinary control flow but slower at exception-catching).
    • In Julia loops are fast, there is no need to write "vectorized" code for performance reasons.
    • Be careful with non-constant global variables in Julia, especially in tight loops. Since you can write close-to-metal code in Julia (unlike Python), the effect of globals can be drastic (see Performance Tips).
    • In Julia, rounding and truncation are explicit. Python's int(3.7) should be floor(Int, 3.7) or Int(floor(3.7)) and is distinguished from round(Int, 3.7). floor(x) and round(x) on their own return an integer value of the same type as x rather than always returning Int.
    • In Julia, parsing is explicit. Python's float("3.7") would be parse(Float64, "3.7") in Julia.
    • In Python, the majority of values can be used in logical contexts (e.g. if "a": means the following block is executed, and if "": means it is not). In Julia, you need explicit conversion to Bool (e.g. if "a" throws an exception). If you want to test for a non-empty string in Julia, you would explicitly write if !isempty(""). Perhaps surprisingly, in Python if "False" and bool("False") both evaluate to True (because "False" is a non-empty string); in Julia, parse(Bool, "false") returns false.
    • In Julia, a new local scope is introduced by most code blocks, including loops and trycatchfinally. Note that comprehensions (list, generator, etc.) introduce a new local scope both in Python and Julia, whereas if blocks do not introduce a new local scope in both languages.

    Noteworthy differences from C/C++

    • Julia arrays are indexed with square brackets, and can have more than one dimension A[i,j]. This syntax is not just syntactic sugar for a reference to a pointer or address as in C/C++. See the manual entry about array construction.
    • In Julia, indexing of arrays, strings, etc. is 1-based not 0-based.
    • Julia arrays are not copied when assigned to another variable. After A = B, changing elements of B will modify A as well. Updating operators like += do not operate in-place, they are equivalent to A = A + B which rebinds the left-hand side to the result of the right-hand side expression.
    • Julia arrays are column major (Fortran ordered) whereas C/C++ arrays are row major ordered by default. To get optimal performance when looping over arrays, the order of the loops should be reversed in Julia relative to C/C++ (see relevant section of Performance Tips).
    • Julia values are not copied when assigned or passed to a function. If a function modifies an array, the changes will be visible in the caller.
    • In Julia, whitespace is significant, unlike C/C++, so care must be taken when adding/removing whitespace from a Julia program.
    • In Julia, literal numbers without a decimal point (such as 42) create signed integers, of type Int, but literals too large to fit in the machine word size will automatically be promoted to a larger size type, such as Int64 (if Int is Int32), Int128, or the arbitrarily large BigInt type. There are no numeric literal suffixes, such as L, LL, U, UL, ULL to indicate unsigned and/or signed vs. unsigned. Decimal literals are always signed, and hexadecimal literals (which start with 0x like C/C++), are unsigned, unless when they encode more than 128 bits, in which case they are of type BigInt. Hexadecimal literals also, unlike C/C++/Java and unlike decimal literals in Julia, have a type based on the length of the literal, including leading 0s. For example, 0x0 and 0x00 have type UInt8, 0x000 and 0x0000 have type UInt16, then literals with 5 to 8 hex digits have type UInt32, 9 to 16 hex digits type UInt64, 17 to 32 hex digits type UInt128, and more that 32 hex digits type BigInt. This needs to be taken into account when defining hexadecimal masks, for example ~0xf == 0xf0 is very different from ~0x000f == 0xfff0. 64 bit Float64 and 32 bit Float32 bit literals are expressed as 1.0 and 1.0f0 respectively. Floating point literals are rounded (and not promoted to the BigFloat type) if they can not be exactly represented. Floating point literals are closer in behavior to C/C++. Octal (prefixed with 0o) and binary (prefixed with 0b) literals are also treated as unsigned (or BigInt for more than 128 bits).
    • In Julia, the division operator / returns a floating point number when both operands are of integer type. To perform integer division, use div or ÷.
    • Indexing an Array with floating point types is generally an error in Julia. The Julia equivalent of the C expression a[i / 2] is a[i ÷ 2 + 1], where i is of integer type.
    • String literals can be delimited with either " or """, """ delimited literals can contain " characters without quoting it like "\"". String literals can have values of other variables or expressions interpolated into them, indicated by $variablename or $(expression), which evaluates the variable name or the expression in the context of the function.
    • // indicates a Rational number, and not a single-line comment (which is # in Julia)
    • #= indicates the start of a multiline comment, and =# ends it.
    • Functions in Julia return values from their last expression(s) or the return keyword. Multiple values can be returned from functions and assigned as tuples, e.g. (a, b) = myfunction() or a, b = myfunction(), instead of having to pass pointers to values as one would have to do in C/C++ (i.e. a = myfunction(&b).
    • Julia does not require the use of semicolons to end statements. The results of expressions are not automatically printed (except at the interactive prompt, i.e. the REPL), and lines of code do not need to end with semicolons. println or @printf can be used to print specific output. In the REPL, ; can be used to suppress output. ; also has a different meaning within [ ], something to watch out for. ; can be used to separate expressions on a single line, but are not strictly necessary in many cases, and are more an aid to readability.
    • In Julia, the operator (xor) performs the bitwise XOR operation, i.e. ^ in C/C++. Also, the bitwise operators do not have the same precedence as C/C++, so parenthesis may be required.
    • Julia's ^ is exponentiation (pow), not bitwise XOR as in C/C++ (use , or xor, in Julia)
    • Julia has two right-shift operators, >> and >>>. >> performs an arithmetic shift, >>> always performs a logical shift, unlike C/C++, where the meaning of >> depends on the type of the value being shifted.
    • Julia's -> creates an anonymous function, it does not access a member via a pointer.
    • Julia does not require parentheses when writing if statements or for/while loops: use for i in [1, 2, 3] instead of for (int i=1; i <= 3; i++) and if i == 1 instead of if (i == 1).
    • Julia does not treat the numbers 0 and 1 as Booleans. You cannot write if (1) in Julia, because if statements accept only booleans. Instead, you can write if true, if Bool(1), or if 1==1.
    • Julia uses end to denote the end of conditional blocks, like if, loop blocks, like while/ for, and functions. In lieu of the one-line if ( cond ) statement, Julia allows statements of the form if cond; statement; end, cond && statement and !cond || statement. Assignment statements in the latter two syntaxes must be explicitly wrapped in parentheses, e.g. cond && (x = value), because of the operator precedence.
    • Julia has no line continuation syntax: if, at the end of a line, the input so far is a complete expression, it is considered done; otherwise the input continues. One way to force an expression to continue is to wrap it in parentheses.
    • Julia macros operate on parsed expressions, rather than the text of the program, which allows them to perform sophisticated transformations of Julia code. Macro names start with the @ character, and have both a function-like syntax, @mymacro(arg1, arg2, arg3), and a statement-like syntax, @mymacro arg1 arg2 arg3. The forms are interchangeable; the function-like form is particularly useful if the macro appears within another expression, and is often clearest. The statement-like form is often used to annotate blocks, as in the distributed for construct: @distributed for i in 1:n; #= body =#; end. Where the end of the macro construct may be unclear, use the function-like form.
    • Julia has an enumeration type, expressed using the macro @enum(name, value1, value2, ...) For example: @enum(Fruit, banana=1, apple, pear)
    • By convention, functions that modify their arguments have a ! at the end of the name, for example push!.
    • In C++, by default, you have static dispatch, i.e. you need to annotate a function as virtual, in order to have dynamic dispatch. On the other hand, in Julia every method is "virtual" (although it's more general than that since methods are dispatched on every argument type, not only this, using the most-specific-declaration rule).

    Julia ⇔ C/C++: Namespaces

    • C/C++ namespaces correspond roughly to Julia modules.
    • There are no private globals or fields in Julia. Everything is publicly accessible through fully qualified paths (or relative paths, if desired).
    • using MyNamespace::myfun (C++) corresponds roughly to import MyModule: myfun (Julia).
    • using namespace MyNamespace (C++) corresponds roughly to using MyModule (Julia)
      • In Julia, only exported symbols are made available to the calling module.
      • In C++, only elements found in the included (public) header files are made available.
    • Caveat: import/using keywords (Julia) also load modules (see below).
    • Caveat: import/using (Julia) works only at the global scope level (modules)
      • In C++, using namespace X works within arbitrary scopes (ex: function scope).

    Julia ⇔ C/C++: Module loading

    • When you think of a C/C++ "library", you are likely looking for a Julia "package".
      • Caveat: C/C++ libraries often house multiple "software modules" whereas Julia "packages" typically house one.
      • Reminder: Julia modules are global scopes (not necessarily "software modules").
    • Instead of build/make scripts, Julia uses "Project Environments" (sometimes called either "Project" or "Environment").
      • Build scripts are only needed for more complex applications (like those needing to compile or download C/C++ executables).
      • To develop application or project in Julia, you can initialize its root directory as a "Project Environment", and house application-specific code/packages there. This provides good control over project dependencies, and future reproducibility.
      • Available packages are added to a "Project Environment" with the Pkg.add() function or Pkg REPL mode. (This does not load said package, however).
      • The list of available packages (direct dependencies) for a "Project Environment" are saved in its Project.toml file.
      • The full dependency information for a "Project Environment" is auto-generated & saved in its Manifest.toml file by Pkg.resolve().
    • Packages ("software modules") available to the "Project Environment" are loaded with import or using.
      • In C/C++, you #include <moduleheader> to get object/function declarations, and link in libraries when you build the executable.
      • In Julia, calling using/import again just brings the existing module into scope, but does not load it again (similar to adding the non-standard #pragma once to C/C++).
    • Directory-based package repositories (Julia) can be made available by adding repository paths to the Base.LOAD_PATH array.
      • Packages from directory-based repositories do not require the Pkg.add() tool prior to being loaded with import or using. They are simply available to the project.
      • Directory-based package repositories are the quickest solution to developing local libraries of "software modules".

    Julia ⇔ C/C++: Assembling modules

    • In C/C++, .c/.cpp files are compiled & added to a library with build/make scripts.
      • In Julia, import [PkgName]/using [PkgName] statements load [PkgName].jl located in a package's [PkgName]/src/ subdirectory.
      • In turn, [PkgName].jl typically loads associated source files with calls to include "[someotherfile].jl".
    • include "./path/to/somefile.jl" (Julia) is very similar to #include "./path/to/somefile.jl" (C/C++).
      • However include "..." (Julia) is not used to include header files (not required).
      • Do not use include "..." (Julia) to load code from other "software modules" (use import/using instead).
      • include "path/to/some/module.jl" (Julia) would instantiate multiple versions of the same code in different modules (creating distinct types (etc.) with the same names).
      • include "somefile.jl" is typically used to assemble multiple files within the same Julia package ("software module"). It is therefore relatively straightforward to ensure file are included only once (No #ifdef confusion).

    Julia ⇔ C/C++: Module interface

    • C++ exposes interfaces using "public" .h/.hpp files whereas Julia modules mark specific symbols that are intended for their users as publicor exported.
      • Often, Julia modules simply add functionality by generating new "methods" to existing functions (ex: Base.push!).
      • Developers of Julia packages therefore cannot rely on header files for interface documentation.
      • Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ...
    • Some developers choose not to export all symbols required to use their package/module, but should still mark unexported user facing symbols as public.
      • Users might be expected to access these components by qualifying functions/structs/... with the package/module name (ex: MyModule.run_this_task(...)).

    Julia ⇔ C/C++: Quick reference

    Software ConceptJuliaC/C++
    unnamed scopebegin ... end{ ... }
    function scopefunction x() ... endint x() { ... }
    global scopemodule MyMod ... endnamespace MyNS { ... }
    software moduleA Julia "package".h/.hpp files<br>+compiled somelib.a
    assembling<br>software modulesSomePkg.jl: ...<br>import("subfile1.jl")<br>import("subfile2.jl")<br>...$(AR) *.o &rArr; somelib.a
    import<br>software moduleimport SomePkg#include <somelib><br>+link in somelib.a
    module libraryLOAD_PATH[], *Git repository,<br>**custom package registrymore .h/.hpp files<br>+bigger compiled somebiglib.a

    * The Julia package manager supports registering multiple packages from a single Git repository.<br> * This allows users to house a library of related packages in a single repository.<br> ** Julia registries are primarily designed to provide versioning \& distribution of packages.<br> ** Custom package registries can be used to create a type of module library.

    Noteworthy differences from Common Lisp

    • Julia uses 1-based indexing for arrays by default, and it can also handle arbitrary index offsets.

    • Functions and variables share the same namespace (“Lisp-1”).

    • There is a Pair type, but it is not meant to be used as a COMMON-LISP:CONS. Various iterable collections can be used interchangeably in most parts of the language (eg splatting, tuples, etc). Tuples are the closest to Common Lisp lists for short collections of heterogeneous elements. Use NamedTuples in place of alists. For larger collections of homogeneous types, Arrays and Dicts should be used.

    • The typical Julia workflow for prototyping also uses continuous manipulation of the image, implemented with the Revise.jl package.

    • For performance, Julia prefers that operations have type stability. Where Common Lisp abstracts away from the underlying machine operations, Julia cleaves closer to them. For example:

      • Integer division using / always returns a floating-point result, even if the computation is exact.
        • // always returns a rational result
        • ÷ always returns a (truncated) integer result
      • Bignums are supported, but conversion is not automatic; ordinary integers overflow.
      • Complex numbers are supported, but to get complex results, you need complex inputs.
      • There are multiple Complex and Rational types, with different component types.
    • Modules (namespaces) can be hierarchical. import and using have a dual role: they load the code and make it available in the namespace. import for only the module name is possible (roughly equivalent to ASDF:LOAD-OP). Slot names don't need to be exported separately. Global variables can't be assigned to from outside the module (except with eval(mod, :(var = val)) as an escape hatch).

    • Macros start with @, and are not as seamlessly integrated into the language as Common Lisp; consequently, macro usage is not as widespread as in the latter. A form of hygiene for macros is supported by the language. Because of the different surface syntax, there is no equivalent to COMMON-LISP:&BODY.

    • All functions are generic and use multiple dispatch. Argument lists don't have to follow the same template, which leads to a powerful idiom (see do). Optional and keyword arguments are handled differently. Method ambiguities are not resolved like in the Common Lisp Object System, necessitating the definition of a more specific method for the intersection.

    • Symbols do not belong to any package, and do not contain any values per se. M.var evaluates the symbol var in the module M.

    • A functional programming style is fully supported by the language, including closures, but isn't always the idiomatic solution for Julia. Some workarounds may be necessary for performance when modifying captured variables.

    +

    Noteworthy Differences from other Languages

    Noteworthy differences from MATLAB

    Although MATLAB users may find Julia's syntax familiar, Julia is not a MATLAB clone. There are major syntactic and functional differences. The following are some noteworthy differences that may trip up Julia users accustomed to MATLAB:

    • Julia arrays are indexed with square brackets, A[i,j].
    • Julia arrays are not copied when assigned to another variable. After A = B, changing elements of B will modify A as well. To avoid this, use A = copy(B).
    • Julia values are not copied when passed to a function. If a function modifies an array, the changes will be visible in the caller.
    • Julia does not automatically grow arrays in an assignment statement. Whereas in MATLAB a(4) = 3.2 can create the array a = [0 0 0 3.2] and a(5) = 7 can grow it into a = [0 0 0 3.2 7], the corresponding Julia statement a[5] = 7 throws an error if the length of a is less than 5 or if this statement is the first use of the identifier a. Julia has push! and append!, which grow Vectors much more efficiently than MATLAB's a(end+1) = val.
    • The imaginary unit sqrt(-1) is represented in Julia as im, not i or j as in MATLAB.
    • In Julia, literal numbers without a decimal point (such as 42) create integers instead of floating point numbers. As a result, some operations can throw a domain error if they expect a float; for example, julia> a = -1; 2^a throws a domain error, as the result is not an integer (see the FAQ entry on domain errors for details).
    • In Julia, multiple values are returned and assigned as tuples, e.g. (a, b) = (1, 2) or a, b = 1, 2. MATLAB's nargout, which is often used in MATLAB to do optional work based on the number of returned values, does not exist in Julia. Instead, users can use optional and keyword arguments to achieve similar capabilities.
    • Julia has true one-dimensional arrays. Column vectors are of size N, not Nx1. For example, rand(N) makes a 1-dimensional array.
    • In Julia, [x,y,z] will always construct a 3-element array containing x, y and z.
      • To concatenate in the first ("vertical") dimension use either vcat(x,y,z) or separate with semicolons ([x; y; z]).
      • To concatenate in the second ("horizontal") dimension use either hcat(x,y,z) or separate with spaces ([x y z]).
      • To construct block matrices (concatenating in the first two dimensions), use either hvcat or combine spaces and semicolons ([a b; c d]).
    • In Julia, a:b and a:b:c construct AbstractRange objects. To construct a full vector like in MATLAB, use collect(a:b). Generally, there is no need to call collect though. An AbstractRange object will act like a normal array in most cases but is more efficient because it lazily computes its values. This pattern of creating specialized objects instead of full arrays is used frequently, and is also seen in functions such as range, or with iterators such as enumerate, and zip. The special objects can mostly be used as if they were normal arrays.
    • Functions in Julia return values from their last expression or the return keyword instead of listing the names of variables to return in the function definition (see The return Keyword for details).
    • A Julia script may contain any number of functions, and all definitions will be externally visible when the file is loaded. Function definitions can be loaded from files outside the current working directory.
    • In Julia, reductions such as sum, prod, and maximum are performed over every element of an array when called with a single argument, as in sum(A), even if A has more than one dimension.
    • In Julia, parentheses must be used to call a function with zero arguments, like in rand().
    • Julia discourages the use of semicolons to end statements. The results of statements are not automatically printed (except at the interactive prompt), and lines of code do not need to end with semicolons. println or @printf can be used to print specific output.
    • In Julia, if A and B are arrays, logical comparison operations like A == B do not return an array of booleans. Instead, use A .== B, and similarly for the other boolean operators like <, >.
    • In Julia, when you want to apply a scalar-valued function elementwise to an array, use broadcasting syntax: f.(A) instead of f(A). In some cases, both operations are defined but mean different things: in MATLAB exp(A) applies elementwise and expm(A) is the matrix exponential, but in Julia exp.(A) applies elementwise and exp(A) is the matrix exponential.
    • In Julia, the operators &, |, and (xor) perform the bitwise operations equivalent to and, or, and xor respectively in MATLAB, and have precedence similar to Python's bitwise operators (unlike C). They can operate on scalars or element-wise across arrays and can be used to combine logical arrays, but note the difference in order of operations: parentheses may be required (e.g., to select elements of A equal to 1 or 2 use (A .== 1) .| (A .== 2)).
    • In Julia, the elements of a collection can be passed as arguments to a function using the splat operator ..., as in xs=[1,2]; f(xs...).
    • Julia's svd returns singular values as a vector instead of as a dense diagonal matrix.
    • In Julia, ... is not used to continue lines of code. Instead, incomplete expressions automatically continue onto the next line.
    • In both Julia and MATLAB, the variable ans is set to the value of the last expression issued in an interactive session. In Julia, unlike MATLAB, ans is not set when Julia code is run in non-interactive mode.
    • Julia's structs do not support dynamically adding fields at runtime, unlike MATLAB's classes. Instead, use a Dict. Dict in Julia isn't ordered.
    • In Julia each module has its own global scope/namespace, whereas in MATLAB there is just one global scope.
    • In MATLAB, an idiomatic way to remove unwanted values is to use logical indexing, like in the expression x(x>3) or in the statement x(x>3) = [] to modify x in-place. In contrast, Julia provides the higher order functions filter and filter!, allowing users to write filter(z->z>3, x) and filter!(z->z>3, x) as alternatives to the corresponding transliterations x[x.>3] and x = x[x.>3]. Using filter! reduces the use of temporary arrays.
    • Following on from the previous point, to replace values that meet specific criteria, for example a thresholding operation on all elements in a matrix, could be achieved in Matlab as follows A(A < threshold) = 0. The Julia equivalent would be A[A .< threshold] .= 0.
    • The analogue of extracting (or "dereferencing") all elements of a cell array, e.g. in vertcat(A{:}) in MATLAB, is written using the splat operator in Julia, e.g. as vcat(A...).
    • In Julia, the adjoint function performs conjugate transposition; in MATLAB, adjoint provides the "adjugate" or classical adjoint, which is the transpose of the matrix of cofactors.
    • In Julia, a^b^c is evaluated a^(b^c) while in MATLAB it's (a^b)^c.

    Noteworthy differences from R

    One of Julia's goals is to provide an effective language for data analysis and statistical programming. For users coming to Julia from R, these are some noteworthy differences:

    • Julia's single quotes enclose characters, not strings.

    • Julia can create substrings by indexing into strings. In R, strings must be converted into character vectors before creating substrings.

    • In Julia, like Python but unlike R, strings can be created with triple quotes """ ... """. This syntax is convenient for constructing strings that contain line breaks.

    • In Julia, varargs are specified using the splat operator ..., which always follows the name of a specific variable, unlike R, for which ... can occur in isolation.

    • In Julia, modulus is mod(a, b), not a %% b. % in Julia is the remainder operator.

    • Julia constructs vectors using brackets. Julia's [1, 2, 3] is the equivalent of R's c(1, 2, 3).

    • In Julia, not all data structures support logical indexing. Furthermore, logical indexing in Julia is supported only with vectors of length equal to the object being indexed. For example:

      • In R, c(1, 2, 3, 4)[c(TRUE, FALSE)] is equivalent to c(1, 3).
      • In R, c(1, 2, 3, 4)[c(TRUE, FALSE, TRUE, FALSE)] is equivalent to c(1, 3).
      • In Julia, [1, 2, 3, 4][[true, false]] throws a BoundsError.
      • In Julia, [1, 2, 3, 4][[true, false, true, false]] produces [1, 3].
    • Like many languages, Julia does not always allow operations on vectors of different lengths, unlike R where the vectors only need to share a common index range. For example, c(1, 2, 3, 4) + c(1, 2) is valid R but the equivalent [1, 2, 3, 4] + [1, 2] will throw an error in Julia.

    • Julia allows an optional trailing comma when that comma does not change the meaning of code. This can cause confusion among R users when indexing into arrays. For example, x[1,] in R would return the first row of a matrix; in Julia, however, the comma is ignored, so x[1,] == x[1], and will return the first element. To extract a row, be sure to use :, as in x[1,:].

    • Julia's map takes the function first, then its arguments, unlike lapply(<structure>, function, ...) in R. Similarly Julia's equivalent of apply(X, MARGIN, FUN, ...) in R is mapslices where the function is the first argument.

    • Multivariate apply in R, e.g. mapply(choose, 11:13, 1:3), can be written as broadcast(binomial, 11:13, 1:3) in Julia. Equivalently Julia offers a shorter dot syntax for vectorizing functions binomial.(11:13, 1:3).

    • Julia uses end to denote the end of conditional blocks, like if, loop blocks, like while/ for, and functions. In lieu of the one-line if ( cond ) statement, Julia allows statements of the form if cond; statement; end, cond && statement and !cond || statement. Assignment statements in the latter two syntaxes must be explicitly wrapped in parentheses, e.g. cond && (x = value).

    • In Julia, <-, <<- and -> are not assignment operators.

    • Julia's -> creates an anonymous function.

    • Julia's * operator can perform matrix multiplication, unlike in R. If A and B are matrices, then A * B denotes a matrix multiplication in Julia, equivalent to R's A %*% B. In R, this same notation would perform an element-wise (Hadamard) product. To get the element-wise multiplication operation, you need to write A .* B in Julia.

    • Julia performs matrix transposition using the transpose function and conjugated transposition using the ' operator or the adjoint function. Julia's transpose(A) is therefore equivalent to R's t(A). Additionally a non-recursive transpose in Julia is provided by the permutedims function.

    • Julia does not require parentheses when writing if statements or for/while loops: use for i in [1, 2, 3] instead of for (i in c(1, 2, 3)) and if i == 1 instead of if (i == 1).

    • Julia does not treat the numbers 0 and 1 as Booleans. You cannot write if (1) in Julia, because if statements accept only booleans. Instead, you can write if true, if Bool(1), or if 1==1.

    • Julia does not provide nrow and ncol. Instead, use size(M, 1) for nrow(M) and size(M, 2) for ncol(M).

    • Julia is careful to distinguish scalars, vectors and matrices. In R, 1 and c(1) are the same. In Julia, they cannot be used interchangeably.

    • Julia's diag and diagm are not like R's.

    • Julia cannot assign to the results of function calls on the left hand side of an assignment operation: you cannot write diag(M) = fill(1, n).

    • Julia discourages populating the main namespace with functions. Most statistical functionality for Julia is found in packages under the JuliaStats organization. For example:

    • Julia provides tuples and real hash tables, but not R-style lists. When returning multiple items, you should typically use a tuple or a named tuple: instead of list(a = 1, b = 2), use (1, 2) or (a=1, b=2).

    • Julia encourages users to write their own types, which are easier to use than S3 or S4 objects in R. Julia's multiple dispatch system means that table(x::TypeA) and table(x::TypeB) act like R's table.TypeA(x) and table.TypeB(x).

    • In Julia, values are not copied when assigned or passed to a function. If a function modifies an array, the changes will be visible in the caller. This is very different from R and allows new functions to operate on large data structures much more efficiently.

    • In Julia, vectors and matrices are concatenated using hcat, vcat and hvcat, not c, rbind and cbind like in R.

    • In Julia, a range like a:b is not shorthand for a vector like in R, but is a specialized AbstractRange object that is used for iteration. To convert a range into a vector, use collect(a:b).

    • The : operator has a different precedence in R and Julia. In particular, in Julia arithmetic operators have higher precedence than the : operator, whereas the reverse is true in R. For example, 1:n-1 in Julia is equivalent to 1:(n-1) in R.

    • Julia's max and min are the equivalent of pmax and pmin respectively in R, but both arguments need to have the same dimensions. While maximum and minimum replace max and min in R, there are important differences.

    • Julia's sum, prod, maximum, and minimum are different from their counterparts in R. They all accept an optional keyword argument dims, which indicates the dimensions, over which the operation is carried out. For instance, let A = [1 2; 3 4] in Julia and B <- rbind(c(1,2),c(3,4)) be the same matrix in R. Then sum(A) gives the same result as sum(B), but sum(A, dims=1) is a row vector containing the sum over each column and sum(A, dims=2) is a column vector containing the sum over each row. This contrasts to the behavior of R, where separate colSums(B) and rowSums(B) functions provide these functionalities. If the dims keyword argument is a vector, then it specifies all the dimensions over which the sum is performed, while retaining the dimensions of the summed array, e.g. sum(A, dims=(1,2)) == hcat(10). It should be noted that there is no error checking regarding the second argument.

    • Julia has several functions that can mutate their arguments. For example, it has both sort and sort!.

    • In R, performance requires vectorization. In Julia, almost the opposite is true: the best performing code is often achieved by using devectorized loops.

    • Julia is eagerly evaluated and does not support R-style lazy evaluation. For most users, this means that there are very few unquoted expressions or column names.

    • Julia does not support the NULL type. The closest equivalent is nothing, but it behaves like a scalar value rather than like a list. Use x === nothing instead of is.null(x).

    • In Julia, missing values are represented by the missing object rather than by NA. Use ismissing(x) (or ismissing.(x) for element-wise operation on vectors) instead of is.na(x). The skipmissing function is generally used instead of na.rm=TRUE (though in some particular cases functions take a skipmissing argument).

    • Julia lacks the equivalent of R's assign or get.

    • In Julia, return does not require parentheses.

    • In R, an idiomatic way to remove unwanted values is to use logical indexing, like in the expression x[x>3] or in the statement x = x[x>3] to modify x in-place. In contrast, Julia provides the higher order functions filter and filter!, allowing users to write filter(z->z>3, x) and filter!(z->z>3, x) as alternatives to the corresponding transliterations x[x.>3] and x = x[x.>3]. Using filter! reduces the use of temporary arrays.

    Noteworthy differences from Python

    • Julia's for, if, while, etc. blocks are terminated by the end keyword. Indentation level is not significant as it is in Python. Unlike Python, Julia has no pass keyword.
    • Strings are denoted by double quotation marks ("text") in Julia (with three double quotation marks for multi-line strings), whereas in Python they can be denoted either by single ('text') or double quotation marks ("text"). Single quotation marks are used for characters in Julia ('c').
    • String concatenation is done with * in Julia, not + like in Python. Analogously, string repetition is done with ^, not *. Implicit string concatenation of string literals like in Python (e.g. 'ab' 'cd' == 'abcd') is not done in Julia.
    • Python Lists—flexible but slow—correspond to the Julia Vector{Any} type or more generally Vector{T} where T is some non-concrete element type. "Fast" arrays like NumPy arrays that store elements in-place (i.e., dtype is np.float64, [('f1', np.uint64), ('f2', np.int32)], etc.) can be represented by Array{T} where T is a concrete, immutable element type. This includes built-in types like Float64, Int32, Int64 but also more complex types like Tuple{UInt64,Float64} and many user-defined types as well.
    • In Julia, indexing of arrays, strings, etc. is 1-based not 0-based.
    • Julia's slice indexing includes the last element, unlike in Python. a[2:3] in Julia is a[1:3] in Python.
    • Unlike Python, Julia allows AbstractArrays with arbitrary indexes. Python's special interpretation of negative indexing, a[-1] and a[-2], should be written a[end] and a[end-1] in Julia.
    • Julia requires end for indexing until the last element. x[2:end] in Julia is equivalent to x[1:] in Python.
    • In Julia, : before any object creates a Symbol or quotes an expression; so, x[:5] is the same as x[5]. If you want to get the first n elements of an array, then use range indexing.
    • Julia's range indexing has the format of x[start:step:stop], whereas Python's format is x[start:(stop+1):step]. Hence, x[0:10:2] in Python is equivalent to x[1:2:10] in Julia. Similarly, x[::-1] in Python, which refers to the reversed array, is equivalent to x[end:-1:1] in Julia.
    • In Julia, ranges can be constructed independently as start:step:stop, the same syntax it uses in array-indexing. The range function is also supported.
    • In Julia, indexing a matrix with arrays like X[[1,2], [1,3]] refers to a sub-matrix that contains the intersections of the first and second rows with the first and third columns. In Python, X[[1,2], [1,3]] refers to a vector that contains the values of cell [1,1] and [2,3] in the matrix. X[[1,2], [1,3]] in Julia is equivalent with X[np.ix_([0,1],[0,2])] in Python. X[[0,1], [0,2]] in Python is equivalent with X[[CartesianIndex(1,1), CartesianIndex(2,3)]] in Julia.
    • Julia has no line continuation syntax: if, at the end of a line, the input so far is a complete expression, it is considered done; otherwise the input continues. One way to force an expression to continue is to wrap it in parentheses.
    • Julia arrays are column-major (Fortran-ordered) whereas NumPy arrays are row-major (C-ordered) by default. To get optimal performance when looping over arrays, the order of the loops should be reversed in Julia relative to NumPy (see relevant section of Performance Tips).
    • Julia's updating operators (e.g. +=, -=, ...) are not in-place whereas NumPy's are. This means A = [1, 1]; B = A; B += [3, 3] doesn't change values in A, it rather rebinds the name B to the result of the right-hand side B = B + 3, which is a new array. For in-place operation, use B .+= 3 (see also dot operators), explicit loops, or InplaceOps.jl.
    • Julia evaluates default values of function arguments every time the method is invoked, unlike in Python where the default values are evaluated only once when the function is defined. For example, the function f(x=rand()) = x returns a new random number every time it is invoked without argument. On the other hand, the function g(x=[1,2]) = push!(x,3) returns [1,2,3] every time it is called as g().
    • In Julia, keyword arguments must be passed using keywords, unlike Python in which it is usually possible to pass them positionally. Attempting to pass a keyword argument positionally alters the method signature leading to a MethodError or calling of the wrong method.
    • In Julia % is the remainder operator, whereas in Python it is the modulus.
    • In Julia, the commonly used Int type corresponds to the machine integer type (Int32 or Int64), unlike in Python, where int is an arbitrary length integer. This means in Julia the Int type will overflow, such that 2^64 == 0. If you need larger values use another appropriate type, such as Int128, BigInt or a floating point type like Float64.
    • The imaginary unit sqrt(-1) is represented in Julia as im, not j as in Python.
    • In Julia, the exponentiation operator is ^, not ** as in Python.
    • Julia uses nothing of type Nothing to represent a null value, whereas Python uses None of type NoneType.
    • In Julia, the standard operators over a matrix type are matrix operations, whereas, in Python, the standard operators are element-wise operations. When both A and B are matrices, A * B in Julia performs matrix multiplication, not element-wise multiplication as in Python. A * B in Julia is equivalent with A @ B in Python, whereas A * B in Python is equivalent with A .* B in Julia.
    • In Julia, when you want to apply a scalar-valued function elementwise to an array, use broadcasting syntax: f.(A) instead of f(A). In some cases, both operations are defined but mean different things: numpy.exp(A) applies elementwise and scipy.linalg.expm(A) is the matrix exponential, but in Julia exp.(A) applies elementwise and exp(A) is the matrix exponential.
    • The adjoint operator ' in Julia returns an adjoint of a vector (a lazy representation of row vector), whereas the transpose operator .T over a vector in Python returns the original vector (non-op).
    • In Julia, a function may contain multiple concrete implementations (called methods), which are selected via multiple dispatch based on the types of all arguments to the call, as compared to functions in Python, which have a single implementation and no polymorphism (as opposed to Python method calls which use a different syntax and allows dispatch on the receiver of the method).
    • There are no classes in Julia. Instead there are structures (mutable or immutable), containing data but no methods.
    • Calling a method of a class instance in Python (x = MyClass(*args); x.f(y)) corresponds to a function call in Julia, e.g. x = MyType(args...); f(x, y). In general, multiple dispatch is more flexible and powerful than the Python class system.
    • Julia structures may have exactly one abstract supertype, whereas Python classes can inherit from one or more (abstract or concrete) superclasses.
    • The logical Julia program structure (Packages and Modules) is independent of the file structure, whereas the Python code structure is defined by directories (Packages) and files (Modules).
    • In Julia, it is idiomatic to split the text of large modules into multiple files, without introducing a new module per file. The code is reassembled inside a single module in a main file via include. While the Python equivalent (exec) is not typical for this use (it will silently clobber prior definitions), Julia programs are defined as a unit at the module level with using or import, which will only get executed once when first needed–like include in Python. Within those modules, the individual files that make up that module are loaded with include by listing them once in the intended order.
    • The ternary operator x > 0 ? 1 : -1 in Julia corresponds to a conditional expression in Python 1 if x > 0 else -1.
    • In Julia the @ symbol refers to a macro, whereas in Python it refers to a decorator.
    • Exception handling in Julia is done using trycatchfinally, instead of tryexceptfinally. In contrast to Python, it is not recommended to use exception handling as part of the normal workflow in Julia (compared with Python, Julia is faster at ordinary control flow but slower at exception-catching).
    • In Julia loops are fast, there is no need to write "vectorized" code for performance reasons.
    • Be careful with non-constant global variables in Julia, especially in tight loops. Since you can write close-to-metal code in Julia (unlike Python), the effect of globals can be drastic (see Performance Tips).
    • In Julia, rounding and truncation are explicit. Python's int(3.7) should be floor(Int, 3.7) or Int(floor(3.7)) and is distinguished from round(Int, 3.7). floor(x) and round(x) on their own return an integer value of the same type as x rather than always returning Int.
    • In Julia, parsing is explicit. Python's float("3.7") would be parse(Float64, "3.7") in Julia.
    • In Python, the majority of values can be used in logical contexts (e.g. if "a": means the following block is executed, and if "": means it is not). In Julia, you need explicit conversion to Bool (e.g. if "a" throws an exception). If you want to test for a non-empty string in Julia, you would explicitly write if !isempty(""). Perhaps surprisingly, in Python if "False" and bool("False") both evaluate to True (because "False" is a non-empty string); in Julia, parse(Bool, "false") returns false.
    • In Julia, a new local scope is introduced by most code blocks, including loops and trycatchfinally. Note that comprehensions (list, generator, etc.) introduce a new local scope both in Python and Julia, whereas if blocks do not introduce a new local scope in both languages.

    Noteworthy differences from C/C++

    • Julia arrays are indexed with square brackets, and can have more than one dimension A[i,j]. This syntax is not just syntactic sugar for a reference to a pointer or address as in C/C++. See the manual entry about array construction.
    • In Julia, indexing of arrays, strings, etc. is 1-based not 0-based.
    • Julia arrays are not copied when assigned to another variable. After A = B, changing elements of B will modify A as well. Updating operators like += do not operate in-place, they are equivalent to A = A + B which rebinds the left-hand side to the result of the right-hand side expression.
    • Julia arrays are column major (Fortran ordered) whereas C/C++ arrays are row major ordered by default. To get optimal performance when looping over arrays, the order of the loops should be reversed in Julia relative to C/C++ (see relevant section of Performance Tips).
    • Julia values are not copied when assigned or passed to a function. If a function modifies an array, the changes will be visible in the caller.
    • In Julia, whitespace is significant, unlike C/C++, so care must be taken when adding/removing whitespace from a Julia program.
    • In Julia, literal numbers without a decimal point (such as 42) create signed integers, of type Int, but literals too large to fit in the machine word size will automatically be promoted to a larger size type, such as Int64 (if Int is Int32), Int128, or the arbitrarily large BigInt type. There are no numeric literal suffixes, such as L, LL, U, UL, ULL to indicate unsigned and/or signed vs. unsigned. Decimal literals are always signed, and hexadecimal literals (which start with 0x like C/C++), are unsigned, unless when they encode more than 128 bits, in which case they are of type BigInt. Hexadecimal literals also, unlike C/C++/Java and unlike decimal literals in Julia, have a type based on the length of the literal, including leading 0s. For example, 0x0 and 0x00 have type UInt8, 0x000 and 0x0000 have type UInt16, then literals with 5 to 8 hex digits have type UInt32, 9 to 16 hex digits type UInt64, 17 to 32 hex digits type UInt128, and more that 32 hex digits type BigInt. This needs to be taken into account when defining hexadecimal masks, for example ~0xf == 0xf0 is very different from ~0x000f == 0xfff0. 64 bit Float64 and 32 bit Float32 bit literals are expressed as 1.0 and 1.0f0 respectively. Floating point literals are rounded (and not promoted to the BigFloat type) if they can not be exactly represented. Floating point literals are closer in behavior to C/C++. Octal (prefixed with 0o) and binary (prefixed with 0b) literals are also treated as unsigned (or BigInt for more than 128 bits).
    • In Julia, the division operator / returns a floating point number when both operands are of integer type. To perform integer division, use div or ÷.
    • Indexing an Array with floating point types is generally an error in Julia. The Julia equivalent of the C expression a[i / 2] is a[i ÷ 2 + 1], where i is of integer type.
    • String literals can be delimited with either " or """, """ delimited literals can contain " characters without quoting it like "\"". String literals can have values of other variables or expressions interpolated into them, indicated by $variablename or $(expression), which evaluates the variable name or the expression in the context of the function.
    • // indicates a Rational number, and not a single-line comment (which is # in Julia)
    • #= indicates the start of a multiline comment, and =# ends it.
    • Functions in Julia return values from their last expression(s) or the return keyword. Multiple values can be returned from functions and assigned as tuples, e.g. (a, b) = myfunction() or a, b = myfunction(), instead of having to pass pointers to values as one would have to do in C/C++ (i.e. a = myfunction(&b).
    • Julia does not require the use of semicolons to end statements. The results of expressions are not automatically printed (except at the interactive prompt, i.e. the REPL), and lines of code do not need to end with semicolons. println or @printf can be used to print specific output. In the REPL, ; can be used to suppress output. ; also has a different meaning within [ ], something to watch out for. ; can be used to separate expressions on a single line, but are not strictly necessary in many cases, and are more an aid to readability.
    • In Julia, the operator (xor) performs the bitwise XOR operation, i.e. ^ in C/C++. Also, the bitwise operators do not have the same precedence as C/C++, so parenthesis may be required.
    • Julia's ^ is exponentiation (pow), not bitwise XOR as in C/C++ (use , or xor, in Julia)
    • Julia has two right-shift operators, >> and >>>. >> performs an arithmetic shift, >>> always performs a logical shift, unlike C/C++, where the meaning of >> depends on the type of the value being shifted.
    • Julia's -> creates an anonymous function, it does not access a member via a pointer.
    • Julia does not require parentheses when writing if statements or for/while loops: use for i in [1, 2, 3] instead of for (int i=1; i <= 3; i++) and if i == 1 instead of if (i == 1).
    • Julia does not treat the numbers 0 and 1 as Booleans. You cannot write if (1) in Julia, because if statements accept only booleans. Instead, you can write if true, if Bool(1), or if 1==1.
    • Julia uses end to denote the end of conditional blocks, like if, loop blocks, like while/ for, and functions. In lieu of the one-line if ( cond ) statement, Julia allows statements of the form if cond; statement; end, cond && statement and !cond || statement. Assignment statements in the latter two syntaxes must be explicitly wrapped in parentheses, e.g. cond && (x = value), because of the operator precedence.
    • Julia has no line continuation syntax: if, at the end of a line, the input so far is a complete expression, it is considered done; otherwise the input continues. One way to force an expression to continue is to wrap it in parentheses.
    • Julia macros operate on parsed expressions, rather than the text of the program, which allows them to perform sophisticated transformations of Julia code. Macro names start with the @ character, and have both a function-like syntax, @mymacro(arg1, arg2, arg3), and a statement-like syntax, @mymacro arg1 arg2 arg3. The forms are interchangeable; the function-like form is particularly useful if the macro appears within another expression, and is often clearest. The statement-like form is often used to annotate blocks, as in the distributed for construct: @distributed for i in 1:n; #= body =#; end. Where the end of the macro construct may be unclear, use the function-like form.
    • Julia has an enumeration type, expressed using the macro @enum(name, value1, value2, ...) For example: @enum(Fruit, banana=1, apple, pear)
    • By convention, functions that modify their arguments have a ! at the end of the name, for example push!.
    • In C++, by default, you have static dispatch, i.e. you need to annotate a function as virtual, in order to have dynamic dispatch. On the other hand, in Julia every method is "virtual" (although it's more general than that since methods are dispatched on every argument type, not only this, using the most-specific-declaration rule).

    Julia ⇔ C/C++: Namespaces

    • C/C++ namespaces correspond roughly to Julia modules.
    • There are no private globals or fields in Julia. Everything is publicly accessible through fully qualified paths (or relative paths, if desired).
    • using MyNamespace::myfun (C++) corresponds roughly to import MyModule: myfun (Julia).
    • using namespace MyNamespace (C++) corresponds roughly to using MyModule (Julia)
      • In Julia, only exported symbols are made available to the calling module.
      • In C++, only elements found in the included (public) header files are made available.
    • Caveat: import/using keywords (Julia) also load modules (see below).
    • Caveat: import/using (Julia) works only at the global scope level (modules)
      • In C++, using namespace X works within arbitrary scopes (ex: function scope).

    Julia ⇔ C/C++: Module loading

    • When you think of a C/C++ "library", you are likely looking for a Julia "package".
      • Caveat: C/C++ libraries often house multiple "software modules" whereas Julia "packages" typically house one.
      • Reminder: Julia modules are global scopes (not necessarily "software modules").
    • Instead of build/make scripts, Julia uses "Project Environments" (sometimes called either "Project" or "Environment").
      • Build scripts are only needed for more complex applications (like those needing to compile or download C/C++ executables).
      • To develop application or project in Julia, you can initialize its root directory as a "Project Environment", and house application-specific code/packages there. This provides good control over project dependencies, and future reproducibility.
      • Available packages are added to a "Project Environment" with the Pkg.add() function or Pkg REPL mode. (This does not load said package, however).
      • The list of available packages (direct dependencies) for a "Project Environment" are saved in its Project.toml file.
      • The full dependency information for a "Project Environment" is auto-generated & saved in its Manifest.toml file by Pkg.resolve().
    • Packages ("software modules") available to the "Project Environment" are loaded with import or using.
      • In C/C++, you #include <moduleheader> to get object/function declarations, and link in libraries when you build the executable.
      • In Julia, calling using/import again just brings the existing module into scope, but does not load it again (similar to adding the non-standard #pragma once to C/C++).
    • Directory-based package repositories (Julia) can be made available by adding repository paths to the Base.LOAD_PATH array.
      • Packages from directory-based repositories do not require the Pkg.add() tool prior to being loaded with import or using. They are simply available to the project.
      • Directory-based package repositories are the quickest solution to developing local libraries of "software modules".

    Julia ⇔ C/C++: Assembling modules

    • In C/C++, .c/.cpp files are compiled & added to a library with build/make scripts.
      • In Julia, import [PkgName]/using [PkgName] statements load [PkgName].jl located in a package's [PkgName]/src/ subdirectory.
      • In turn, [PkgName].jl typically loads associated source files with calls to include "[someotherfile].jl".
    • include "./path/to/somefile.jl" (Julia) is very similar to #include "./path/to/somefile.jl" (C/C++).
      • However include "..." (Julia) is not used to include header files (not required).
      • Do not use include "..." (Julia) to load code from other "software modules" (use import/using instead).
      • include "path/to/some/module.jl" (Julia) would instantiate multiple versions of the same code in different modules (creating distinct types (etc.) with the same names).
      • include "somefile.jl" is typically used to assemble multiple files within the same Julia package ("software module"). It is therefore relatively straightforward to ensure file are included only once (No #ifdef confusion).

    Julia ⇔ C/C++: Module interface

    • C++ exposes interfaces using "public" .h/.hpp files whereas Julia modules mark specific symbols that are intended for their users as publicor exported.
      • Often, Julia modules simply add functionality by generating new "methods" to existing functions (ex: Base.push!).
      • Developers of Julia packages therefore cannot rely on header files for interface documentation.
      • Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ...
    • Some developers choose not to export all symbols required to use their package/module, but should still mark unexported user facing symbols as public.
      • Users might be expected to access these components by qualifying functions/structs/... with the package/module name (ex: MyModule.run_this_task(...)).

    Julia ⇔ C/C++: Quick reference

    Software ConceptJuliaC/C++
    unnamed scopebegin ... end{ ... }
    function scopefunction x() ... endint x() { ... }
    global scopemodule MyMod ... endnamespace MyNS { ... }
    software moduleA Julia "package".h/.hpp files<br>+compiled somelib.a
    assembling<br>software modulesSomePkg.jl: ...<br>import("subfile1.jl")<br>import("subfile2.jl")<br>...$(AR) *.o &rArr; somelib.a
    import<br>software moduleimport SomePkg#include <somelib><br>+link in somelib.a
    module libraryLOAD_PATH[], *Git repository,<br>**custom package registrymore .h/.hpp files<br>+bigger compiled somebiglib.a

    * The Julia package manager supports registering multiple packages from a single Git repository.<br> * This allows users to house a library of related packages in a single repository.<br> ** Julia registries are primarily designed to provide versioning \& distribution of packages.<br> ** Custom package registries can be used to create a type of module library.

    Noteworthy differences from Common Lisp

    • Julia uses 1-based indexing for arrays by default, and it can also handle arbitrary index offsets.

    • Functions and variables share the same namespace (“Lisp-1”).

    • There is a Pair type, but it is not meant to be used as a COMMON-LISP:CONS. Various iterable collections can be used interchangeably in most parts of the language (eg splatting, tuples, etc). Tuples are the closest to Common Lisp lists for short collections of heterogeneous elements. Use NamedTuples in place of alists. For larger collections of homogeneous types, Arrays and Dicts should be used.

    • The typical Julia workflow for prototyping also uses continuous manipulation of the image, implemented with the Revise.jl package.

    • For performance, Julia prefers that operations have type stability. Where Common Lisp abstracts away from the underlying machine operations, Julia cleaves closer to them. For example:

      • Integer division using / always returns a floating-point result, even if the computation is exact.
        • // always returns a rational result
        • ÷ always returns a (truncated) integer result
      • Bignums are supported, but conversion is not automatic; ordinary integers overflow.
      • Complex numbers are supported, but to get complex results, you need complex inputs.
      • There are multiple Complex and Rational types, with different component types.
    • Modules (namespaces) can be hierarchical. import and using have a dual role: they load the code and make it available in the namespace. import for only the module name is possible (roughly equivalent to ASDF:LOAD-OP). Slot names don't need to be exported separately. Global variables can't be assigned to from outside the module (except with eval(mod, :(var = val)) as an escape hatch).

    • Macros start with @, and are not as seamlessly integrated into the language as Common Lisp; consequently, macro usage is not as widespread as in the latter. A form of hygiene for macros is supported by the language. Because of the different surface syntax, there is no equivalent to COMMON-LISP:&BODY.

    • All functions are generic and use multiple dispatch. Argument lists don't have to follow the same template, which leads to a powerful idiom (see do). Optional and keyword arguments are handled differently. Method ambiguities are not resolved like in the Common Lisp Object System, necessitating the definition of a more specific method for the intersection.

    • Symbols do not belong to any package, and do not contain any values per se. M.var evaluates the symbol var in the module M.

    • A functional programming style is fully supported by the language, including closures, but isn't always the idiomatic solution for Julia. Some workarounds may be necessary for performance when modifying captured variables.

    diff --git a/en/v1.12-dev/manual/parallel-computing/index.html b/en/v1.12-dev/manual/parallel-computing/index.html index 1b88674ca80..a9c144722e0 100644 --- a/en/v1.12-dev/manual/parallel-computing/index.html +++ b/en/v1.12-dev/manual/parallel-computing/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Parallel Computing

    Julia supports these four categories of concurrent and parallel programming:

    1. Asynchronous "tasks", or coroutines:

      Julia Tasks allow suspending and resuming computations for I/O, event handling, producer-consumer processes, and similar patterns. Tasks can synchronize through operations like wait and fetch, and communicate via Channels. While strictly not parallel computing by themselves, Julia lets you schedule Tasks on several threads.

    2. Multi-threading:

      Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on a single large multi-core server. Julia's multi-threading is composable. When one multi-threaded function calls another multi-threaded function, Julia will schedule all the threads globally on available resources, without oversubscribing.

    3. Distributed computing:

      Distributed computing runs multiple Julia processes with separate memory spaces. These can be on the same computer or multiple computers. The Distributed standard library provides the capability for remote execution of a Julia function. With this basic building block, it is possible to build many different kinds of distributed computing abstractions. Packages like DistributedArrays.jl are an example of such an abstraction. On the other hand, packages like MPI.jl and Elemental.jl provide access to the existing MPI ecosystem of libraries.

    4. GPU computing:

      The Julia GPU compiler provides the ability to run Julia code natively on GPUs. There is a rich ecosystem of Julia packages that target GPUs. The JuliaGPU.org website provides a list of capabilities, supported GPUs, related packages and documentation.

    +

    Parallel Computing

    Julia supports these four categories of concurrent and parallel programming:

    1. Asynchronous "tasks", or coroutines:

      Julia Tasks allow suspending and resuming computations for I/O, event handling, producer-consumer processes, and similar patterns. Tasks can synchronize through operations like wait and fetch, and communicate via Channels. While strictly not parallel computing by themselves, Julia lets you schedule Tasks on several threads.

    2. Multi-threading:

      Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on a single large multi-core server. Julia's multi-threading is composable. When one multi-threaded function calls another multi-threaded function, Julia will schedule all the threads globally on available resources, without oversubscribing.

    3. Distributed computing:

      Distributed computing runs multiple Julia processes with separate memory spaces. These can be on the same computer or multiple computers. The Distributed standard library provides the capability for remote execution of a Julia function. With this basic building block, it is possible to build many different kinds of distributed computing abstractions. Packages like DistributedArrays.jl are an example of such an abstraction. On the other hand, packages like MPI.jl and Elemental.jl provide access to the existing MPI ecosystem of libraries.

    4. GPU computing:

      The Julia GPU compiler provides the ability to run Julia code natively on GPUs. There is a rich ecosystem of Julia packages that target GPUs. The JuliaGPU.org website provides a list of capabilities, supported GPUs, related packages and documentation.

    diff --git a/en/v1.12-dev/manual/performance-tips/index.html b/en/v1.12-dev/manual/performance-tips/index.html index cfaaf5190b5..376defefcda 100644 --- a/en/v1.12-dev/manual/performance-tips/index.html +++ b/en/v1.12-dev/manual/performance-tips/index.html @@ -628,4 +628,4 @@ for (idx, pid) in enumerate(workers()) refs[idx] = @spawnat pid foo(args...) end -responses = [fetch(r) for r in refs]

    The former results in a single network round-trip to every worker, while the latter results in two network calls - first by the @spawnat and the second due to the fetch (or even a wait). The fetch/wait is also being executed serially resulting in an overall poorer performance.

    Use MutableArithmetics for more control over allocation for mutable arithmetic types

    Some Number subtypes, such as BigInt or BigFloat, may be implemented as mutable struct types, or they may have mutable components. The arithmetic interfaces in Julia Base usually opt for convenience over efficiency in such cases, so using them in a naive manner may result in suboptimal performance. The abstractions of the MutableArithmetics package, on the other hand, make it possible to exploit the mutability of such types for writing fast code that allocates only as much as necessary. MutableArithmetics also makes it possible to copy values of mutable arithmetic types explicitly when necessary. MutableArithmetics is a user package and is not affiliated with the Julia project.

    +responses = [fetch(r) for r in refs]

    The former results in a single network round-trip to every worker, while the latter results in two network calls - first by the @spawnat and the second due to the fetch (or even a wait). The fetch/wait is also being executed serially resulting in an overall poorer performance.

    Use MutableArithmetics for more control over allocation for mutable arithmetic types

    Some Number subtypes, such as BigInt or BigFloat, may be implemented as mutable struct types, or they may have mutable components. The arithmetic interfaces in Julia Base usually opt for convenience over efficiency in such cases, so using them in a naive manner may result in suboptimal performance. The abstractions of the MutableArithmetics package, on the other hand, make it possible to exploit the mutability of such types for writing fast code that allocates only as much as necessary. MutableArithmetics also makes it possible to copy values of mutable arithmetic types explicitly when necessary. MutableArithmetics is a user package and is not affiliated with the Julia project.

    diff --git a/en/v1.12-dev/manual/profile/index.html b/en/v1.12-dev/manual/profile/index.html index 35fdd7670f7..f1fe5fd60cf 100644 --- a/en/v1.12-dev/manual/profile/index.html +++ b/en/v1.12-dev/manual/profile/index.html @@ -236,4 +236,4 @@ "alloc-profile.pb.gz"

    Then you can view the profile by navigating to http://localhost:62261, and the profile is saved to disk. See PProf package for more options.

    Allocation Profiling Tips

    As stated above, aim for around 1-10 thousand samples in your profile.

    Note that we are uniformly sampling in the space of all allocations, and are not weighting our samples by the size of the allocation. So a given allocation profile may not give a representative profile of where most bytes are allocated in your program, unless you had set sample_rate=1.

    Allocations can come from users directly constructing objects, but can also come from inside the runtime or be inserted into compiled code to handle type instability. Looking at the "source code" view can be helpful to isolate them, and then other external tools such as Cthulhu.jl can be useful for identifying the cause of the allocation.

    Allocation Profile Visualization Tools

    There are several profiling visualization tools now that can all display Allocation Profiles. Here is a small list of some of the main ones we know about:

    Line-by-Line Allocation Tracking

    An alternative way to measure allocations is to start Julia with the --track-allocation=<setting> command-line option, for which you can choose none (the default, do not measure allocation), user (measure memory allocation everywhere except Julia's core code), or all (measure memory allocation at each line of Julia code). Allocation gets measured for each line of compiled code. When you quit Julia, the cumulative results are written to text files with .mem appended after the file name, residing in the same directory as the source file. Each line lists the total number of bytes allocated. The Coverage package contains some elementary analysis tools, for example to sort the lines in order of number of bytes allocated.

    In interpreting the results, there are a few important details. Under the user setting, the first line of any function directly called from the REPL will exhibit allocation due to events that happen in the REPL code itself. More significantly, JIT-compilation also adds to allocation counts, because much of Julia's compiler is written in Julia (and compilation usually requires memory allocation). The recommended procedure is to force compilation by executing all the commands you want to analyze, then call Profile.clear_malloc_data() to reset all allocation counters. Finally, execute the desired commands and quit Julia to trigger the generation of the .mem files.

    Note

    --track-allocation changes code generation to log the allocations, and so the allocations may be different than what happens without the option. We recommend using the allocation profiler instead.

    External Profiling

    Currently Julia supports Intel VTune, OProfile and perf as external profiling tools.

    Depending on the tool you choose, compile with USE_INTEL_JITEVENTS, USE_OPROFILE_JITEVENTS and USE_PERF_JITEVENTS set to 1 in Make.user. Multiple flags are supported.

    Before running Julia set the environment variable ENABLE_JITPROFILING to 1.

    Now you have a multitude of ways to employ those tools! For example with OProfile you can try a simple recording :

    >ENABLE_JITPROFILING=1 sudo operf -Vdebug ./julia test/fastmath.jl
     >opreport -l `which ./julia`

    Or similarly with perf :

    $ ENABLE_JITPROFILING=1 perf record -o /tmp/perf.data --call-graph dwarf -k 1 ./julia /test/fastmath.jl
     $ perf inject --jit --input /tmp/perf.data --output /tmp/perf-jit.data
    -$ perf report --call-graph -G -i /tmp/perf-jit.data

    There are many more interesting things that you can measure about your program, to get a comprehensive list please read the Linux perf examples page.

    Remember that perf saves for each execution a perf.data file that, even for small programs, can get quite large. Also the perf LLVM module saves temporarily debug objects in ~/.debug/jit, remember to clean that folder frequently.

    +$ perf report --call-graph -G -i /tmp/perf-jit.data

    There are many more interesting things that you can measure about your program, to get a comprehensive list please read the Linux perf examples page.

    Remember that perf saves for each execution a perf.data file that, even for small programs, can get quite large. Also the perf LLVM module saves temporarily debug objects in ~/.debug/jit, remember to clean that folder frequently.

    diff --git a/en/v1.12-dev/manual/running-external-programs/index.html b/en/v1.12-dev/manual/running-external-programs/index.html index 874b56c5d7f..25640f421aa 100644 --- a/en/v1.12-dev/manual/running-external-programs/index.html +++ b/en/v1.12-dev/manual/running-external-programs/index.html @@ -142,4 +142,4 @@ foo ever! julia> run(addenv(`sh -c "echo foo \$HOWLONG"`, "HOWLONG" => "ever!")); -foo ever! +foo ever! diff --git a/en/v1.12-dev/manual/stacktraces/index.html b/en/v1.12-dev/manual/stacktraces/index.html index 4b05f42a836..d93911b4a72 100644 --- a/en/v1.12-dev/manual/stacktraces/index.html +++ b/en/v1.12-dev/manual/stacktraces/index.html @@ -196,4 +196,4 @@ jl_apply_generic at gf.c:2167 julia> println("The top frame is from $(frame[1].func)!") -The top frame is from jl_apply_generic! +The top frame is from jl_apply_generic! diff --git a/en/v1.12-dev/manual/strings/index.html b/en/v1.12-dev/manual/strings/index.html index d79a7cc5959..e42a687dec9 100644 --- a/en/v1.12-dev/manual/strings/index.html +++ b/en/v1.12-dev/manual/strings/index.html @@ -469,4 +469,4 @@ "hello there julia" julia> str * str2 == Base.annotatedstring(str, str2) # *-concatenation still works -true

    The annotations of a AnnotatedString can be accessed and modified via the annotations and annotate! functions.

    +true

    The annotations of a AnnotatedString can be accessed and modified via the annotations and annotate! functions.

    diff --git a/en/v1.12-dev/manual/style-guide/index.html b/en/v1.12-dev/manual/style-guide/index.html index fd24426bf57..9a0be6302b9 100644 --- a/en/v1.12-dev/manual/style-guide/index.html +++ b/en/v1.12-dev/manual/style-guide/index.html @@ -72,4 +72,4 @@ 1.0 julia> h(1) -2//1

    Thus, use Int literals when possible, with Rational{Int} for literal non-integer numbers, in order to make it easier to use your code.

    +2//1

    Thus, use Int literals when possible, with Rational{Int} for literal non-integer numbers, in order to make it easier to use your code.

    diff --git a/en/v1.12-dev/manual/types/index.html b/en/v1.12-dev/manual/types/index.html index 92e26b1509a..364d9186070 100644 --- a/en/v1.12-dev/manual/types/index.html +++ b/en/v1.12-dev/manual/types/index.html @@ -463,4 +463,4 @@ "First" julia> firstlast(Val(false)) -"Last"

    For consistency across Julia, the call site should always pass a Val instance rather than using a type, i.e., use foo(Val(:bar)) rather than foo(Val{:bar}).

    It's worth noting that it's extremely easy to mis-use parametric "value" types, including Val; in unfavorable cases, you can easily end up making the performance of your code much worse. In particular, you would never want to write actual code as illustrated above. For more information about the proper (and improper) uses of Val, please read the more extensive discussion in the performance tips.

    +"Last"

    For consistency across Julia, the call site should always pass a Val instance rather than using a type, i.e., use foo(Val(:bar)) rather than foo(Val{:bar}).

    It's worth noting that it's extremely easy to mis-use parametric "value" types, including Val; in unfavorable cases, you can easily end up making the performance of your code much worse. In particular, you would never want to write actual code as illustrated above. For more information about the proper (and improper) uses of Val, please read the more extensive discussion in the performance tips.

    diff --git a/en/v1.12-dev/manual/unicode-input/index.html b/en/v1.12-dev/manual/unicode-input/index.html index 862958ab91e..153187f57b4 100644 --- a/en/v1.12-dev/manual/unicode-input/index.html +++ b/en/v1.12-dev/manual/unicode-input/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Unicode Input

    The following table lists Unicode characters that can be entered via tab completion of LaTeX-like abbreviations in the Julia REPL (and in various other editing environments). You can also get information on how to type a symbol by entering it in the REPL help, i.e. by typing ? and then entering the symbol in the REPL (e.g., by copy-paste from somewhere you saw the symbol).

    Warning

    This table may appear to contain missing characters in the second column, or even show characters that are inconsistent with the characters as they are rendered in the Julia REPL. In these cases, users are strongly advised to check their choice of fonts in their browser and REPL environment, as there are known issues with glyphs in many fonts.

    Code point(s)Character(s)Tab completion sequence(s)Unicode name(s)
    U+000A1¡\exclamdownInverted Exclamation Mark
    U+000A3£\sterlingPound Sign
    U+000A5¥\yenYen Sign
    U+000A6¦\brokenbarBroken Bar / Broken Vertical Bar
    U+000A7§\SSection Sign
    U+000A9©\copyright, \:copyright:Copyright Sign
    U+000AAª\ordfeminineFeminine Ordinal Indicator
    U+000AB«\guillemotleftLeft-Pointing Double Angle Quotation Mark / Left Pointing Guillemet
    U+000AC¬\negNot Sign
    U+000AE®\circledR, \:registered:Registered Sign / Registered Trade Mark Sign
    U+000AF¯\highminusMacron / Spacing Macron
    U+000B0°\degreeDegree Sign
    U+000B1±\pmPlus-Minus Sign / Plus-Or-Minus Sign
    U+000B2²\^2Superscript Two / Superscript Digit Two
    U+000B3³\^3Superscript Three / Superscript Digit Three
    U+000B6\PPilcrow Sign / Paragraph Sign
    U+000B7·\cdotpMiddle Dot
    U+000B9¹\^1Superscript One / Superscript Digit One
    U+000BAº\ordmasculineMasculine Ordinal Indicator
    U+000BB»\guillemotrightRight-Pointing Double Angle Quotation Mark / Right Pointing Guillemet
    U+000BC¼\1/4Vulgar Fraction One Quarter / Fraction One Quarter
    U+000BD½\1/2Vulgar Fraction One Half / Fraction One Half
    U+000BE¾\3/4Vulgar Fraction Three Quarters / Fraction Three Quarters
    U+000BF¿\questiondownInverted Question Mark
    U+000C5Å\AALatin Capital Letter A With Ring Above / Latin Capital Letter A Ring
    U+000C6Æ\AELatin Capital Letter Ae / Latin Capital Letter A E
    U+000D0Ð\DHLatin Capital Letter Eth
    U+000D7×\timesMultiplication Sign
    U+000D8Ø\OLatin Capital Letter O With Stroke / Latin Capital Letter O Slash
    U+000DEÞ\THLatin Capital Letter Thorn
    U+000DFß\ssLatin Small Letter Sharp S
    U+000E5å\aaLatin Small Letter A With Ring Above / Latin Small Letter A Ring
    U+000E6æ\aeLatin Small Letter Ae / Latin Small Letter A E
    U+000F0ð\eth, \dhLatin Small Letter Eth
    U+000F7÷\divDivision Sign
    U+000F8ø\oLatin Small Letter O With Stroke / Latin Small Letter O Slash
    U+000FEþ\thLatin Small Letter Thorn
    U+00110Đ\DJLatin Capital Letter D With Stroke / Latin Capital Letter D Bar
    U+00111đ\djLatin Small Letter D With Stroke / Latin Small Letter D Bar
    U+00127ħ\hbarLatin Small Letter H With Stroke / Latin Small Letter H Bar
    U+00131ı\imathLatin Small Letter Dotless I
    U+00141Ł\LLatin Capital Letter L With Stroke / Latin Capital Letter L Slash
    U+00142ł\lLatin Small Letter L With Stroke / Latin Small Letter L Slash
    U+0014AŊ\NGLatin Capital Letter Eng
    U+0014Bŋ\ngLatin Small Letter Eng
    U+00152Œ\OELatin Capital Ligature Oe / Latin Capital Letter O E
    U+00153œ\oeLatin Small Ligature Oe / Latin Small Letter O E
    U+00195ƕ\hvligLatin Small Letter Hv / Latin Small Letter H V
    U+0019Eƞ\nrlegLatin Small Letter N With Long Right Leg
    U+001B5Ƶ\ZbarLatin Capital Letter Z With Stroke / Latin Capital Letter Z Bar
    U+001C2ǂ\doublepipeLatin Letter Alveolar Click / Latin Letter Pipe Double Bar
    U+00237ȷ\jmathLatin Small Letter Dotless J
    U+00250ɐ\trnaLatin Small Letter Turned A
    U+00252ɒ\trnsaLatin Small Letter Turned Alpha / Latin Small Letter Turned Script A
    U+00254ɔ\openoLatin Small Letter Open O
    U+00256ɖ\rtldLatin Small Letter D With Tail / Latin Small Letter D Retroflex Hook
    U+00259ə\schwaLatin Small Letter Schwa
    U+00263ɣ\pgammaLatin Small Letter Gamma
    U+00264ɤ\pbgamLatin Small Letter Rams Horn / Latin Small Letter Baby Gamma
    U+00265ɥ\trnhLatin Small Letter Turned H
    U+0026Cɬ\btdlLatin Small Letter L With Belt / Latin Small Letter L Belt
    U+0026Dɭ\rtllLatin Small Letter L With Retroflex Hook / Latin Small Letter L Retroflex Hook
    U+0026Fɯ\trnmLatin Small Letter Turned M
    U+00270ɰ\trnmlrLatin Small Letter Turned M With Long Leg
    U+00271ɱ\ltlmrLatin Small Letter M With Hook / Latin Small Letter M Hook
    U+00272ɲ\ltlnLatin Small Letter N With Left Hook / Latin Small Letter N Hook
    U+00273ɳ\rtlnLatin Small Letter N With Retroflex Hook / Latin Small Letter N Retroflex Hook
    U+00277ɷ\clomegLatin Small Letter Closed Omega
    U+00278ɸ\ltphiLatin Small Letter Phi
    U+00279ɹ\trnrLatin Small Letter Turned R
    U+0027Aɺ\trnrlLatin Small Letter Turned R With Long Leg
    U+0027Bɻ\rttrnrLatin Small Letter Turned R With Hook / Latin Small Letter Turned R Hook
    U+0027Cɼ\rlLatin Small Letter R With Long Leg
    U+0027Dɽ\rtlrLatin Small Letter R With Tail / Latin Small Letter R Hook
    U+0027Eɾ\fhrLatin Small Letter R With Fishhook / Latin Small Letter Fishhook R
    U+00282ʂ\rtlsLatin Small Letter S With Hook / Latin Small Letter S Hook
    U+00283ʃ\eshLatin Small Letter Esh
    U+00287ʇ\trntLatin Small Letter Turned T
    U+00288ʈ\rtltLatin Small Letter T With Retroflex Hook / Latin Small Letter T Retroflex Hook
    U+0028Aʊ\pupsilLatin Small Letter Upsilon
    U+0028Bʋ\pscrvLatin Small Letter V With Hook / Latin Small Letter Script V
    U+0028Cʌ\invvLatin Small Letter Turned V
    U+0028Dʍ\invwLatin Small Letter Turned W
    U+0028Eʎ\trnyLatin Small Letter Turned Y
    U+00290ʐ\rtlzLatin Small Letter Z With Retroflex Hook / Latin Small Letter Z Retroflex Hook
    U+00292ʒ\yoghLatin Small Letter Ezh / Latin Small Letter Yogh
    U+00294ʔ\glstLatin Letter Glottal Stop
    U+00295ʕ\reglstLatin Letter Pharyngeal Voiced Fricative / Latin Letter Reversed Glottal Stop
    U+00296ʖ\inglstLatin Letter Inverted Glottal Stop
    U+0029Eʞ\turnkLatin Small Letter Turned K
    U+002A4ʤ\dyoghLatin Small Letter Dezh Digraph / Latin Small Letter D Yogh
    U+002A7ʧ\teshLatin Small Letter Tesh Digraph / Latin Small Letter T Esh
    U+002B0ʰ\^hModifier Letter Small H
    U+002B2ʲ\^jModifier Letter Small J
    U+002B3ʳ\^rModifier Letter Small R
    U+002B7ʷ\^wModifier Letter Small W
    U+002B8ʸ\^yModifier Letter Small Y
    U+002BCʼ\raspModifier Letter Apostrophe
    U+002C8ˈ\vertsModifier Letter Vertical Line
    U+002CCˌ\vertiModifier Letter Low Vertical Line
    U+002D0ː\lmrkModifier Letter Triangular Colon
    U+002D1ˑ\hlmrkModifier Letter Half Triangular Colon
    U+002D2˒\sbrhrModifier Letter Centred Right Half Ring / Modifier Letter Centered Right Half Ring
    U+002D3˓\sblhrModifier Letter Centred Left Half Ring / Modifier Letter Centered Left Half Ring
    U+002D4˔\raisModifier Letter Up Tack
    U+002D5˕\lowModifier Letter Down Tack
    U+002D8˘\uBreve / Spacing Breve
    U+002DC˜\tildelowSmall Tilde / Spacing Tilde
    U+002E1ˡ\^lModifier Letter Small L
    U+002E2ˢ\^sModifier Letter Small S
    U+002E3ˣ\^xModifier Letter Small X
    U+002F1˱\_<Modifier Letter Low Left Arrowhead
    U+002F2˲\_>Modifier Letter Low Right Arrowhead
    U+00300 ̀ \graveCombining Grave Accent / Non-Spacing Grave
    U+00301 ́ \acuteCombining Acute Accent / Non-Spacing Acute
    U+00302 ̂ \hatCombining Circumflex Accent / Non-Spacing Circumflex
    U+00303 ̃ \tildeCombining Tilde / Non-Spacing Tilde
    U+00304 ̄ \barCombining Macron / Non-Spacing Macron
    U+00305 ̅ \overbarCombining Overline / Non-Spacing Overscore
    U+00306 ̆ \breveCombining Breve / Non-Spacing Breve
    U+00307 ̇ \dotCombining Dot Above / Non-Spacing Dot Above
    U+00308 ̈ \ddotCombining Diaeresis / Non-Spacing Diaeresis
    U+00309 ̉ \ovhookCombining Hook Above / Non-Spacing Hook Above
    U+0030A ̊ \ocircCombining Ring Above / Non-Spacing Ring Above
    U+0030B ̋ \HCombining Double Acute Accent / Non-Spacing Double Acute
    U+0030C ̌ \checkCombining Caron / Non-Spacing Hacek
    U+00310 ̐ \candraCombining Candrabindu / Non-Spacing Candrabindu
    U+00312 ̒ \oturnedcommaCombining Turned Comma Above / Non-Spacing Turned Comma Above
    U+00315 ̕ \ocommatoprightCombining Comma Above Right / Non-Spacing Comma Above Right
    U+0031A ̚ \droangCombining Left Angle Above / Non-Spacing Left Angle Above
    U+00321 ̡ \palhCombining Palatalized Hook Below / Non-Spacing Palatalized Hook Below
    U+00322 ̢ \rhCombining Retroflex Hook Below / Non-Spacing Retroflex Hook Below
    U+00327 ̧ \cCombining Cedilla / Non-Spacing Cedilla
    U+00328 ̨ \kCombining Ogonek / Non-Spacing Ogonek
    U+0032A ̪ \sbbrgCombining Bridge Below / Non-Spacing Bridge Below
    U+00330 ̰ \wideutildeCombining Tilde Below / Non-Spacing Tilde Below
    U+00332 ̲ \underbarCombining Low Line / Non-Spacing Underscore
    U+00336 ̶ \strike, \soutCombining Long Stroke Overlay / Non-Spacing Long Bar Overlay
    U+00338 ̸ \notCombining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0034D ͍ \underleftrightarrowCombining Left Right Arrow Below
    U+00391Α\AlphaGreek Capital Letter Alpha
    U+00392Β\BetaGreek Capital Letter Beta
    U+00393Γ\GammaGreek Capital Letter Gamma
    U+00394Δ\DeltaGreek Capital Letter Delta
    U+00395Ε\EpsilonGreek Capital Letter Epsilon
    U+00396Ζ\ZetaGreek Capital Letter Zeta
    U+00397Η\EtaGreek Capital Letter Eta
    U+00398Θ\ThetaGreek Capital Letter Theta
    U+00399Ι\IotaGreek Capital Letter Iota
    U+0039AΚ\KappaGreek Capital Letter Kappa
    U+0039BΛ\LambdaGreek Capital Letter Lamda / Greek Capital Letter Lambda
    U+0039CΜ\MuGreek Capital Letter Mu
    U+0039DΝ\NuGreek Capital Letter Nu
    U+0039EΞ\XiGreek Capital Letter Xi
    U+0039FΟ\OmicronGreek Capital Letter Omicron
    U+003A0Π\PiGreek Capital Letter Pi
    U+003A1Ρ\RhoGreek Capital Letter Rho
    U+003A3Σ\SigmaGreek Capital Letter Sigma
    U+003A4Τ\TauGreek Capital Letter Tau
    U+003A5Υ\UpsilonGreek Capital Letter Upsilon
    U+003A6Φ\PhiGreek Capital Letter Phi
    U+003A7Χ\ChiGreek Capital Letter Chi
    U+003A8Ψ\PsiGreek Capital Letter Psi
    U+003A9Ω\OmegaGreek Capital Letter Omega
    U+003B1α\alphaGreek Small Letter Alpha
    U+003B2β\betaGreek Small Letter Beta
    U+003B3γ\gammaGreek Small Letter Gamma
    U+003B4δ\deltaGreek Small Letter Delta
    U+003B5ε\varepsilonGreek Small Letter Epsilon
    U+003B6ζ\zetaGreek Small Letter Zeta
    U+003B7η\etaGreek Small Letter Eta
    U+003B8θ\thetaGreek Small Letter Theta
    U+003B9ι\iotaGreek Small Letter Iota
    U+003BAκ\kappaGreek Small Letter Kappa
    U+003BBλ\lambdaGreek Small Letter Lamda / Greek Small Letter Lambda
    U+003BCμ\muGreek Small Letter Mu
    U+003BDν\nuGreek Small Letter Nu
    U+003BEξ\xiGreek Small Letter Xi
    U+003BFο\omicronGreek Small Letter Omicron
    U+003C0π\piGreek Small Letter Pi
    U+003C1ρ\rhoGreek Small Letter Rho
    U+003C2ς\varsigmaGreek Small Letter Final Sigma
    U+003C3σ\sigmaGreek Small Letter Sigma
    U+003C4τ\tauGreek Small Letter Tau
    U+003C5υ\upsilonGreek Small Letter Upsilon
    U+003C6φ\varphiGreek Small Letter Phi
    U+003C7χ\chiGreek Small Letter Chi
    U+003C8ψ\psiGreek Small Letter Psi
    U+003C9ω\omegaGreek Small Letter Omega
    U+003D0ϐ\varbetaGreek Beta Symbol / Greek Small Letter Curled Beta
    U+003D1ϑ\varthetaGreek Theta Symbol / Greek Small Letter Script Theta
    U+003D5ϕ\phiGreek Phi Symbol / Greek Small Letter Script Phi
    U+003D6ϖ\varpiGreek Pi Symbol / Greek Small Letter Omega Pi
    U+003D8Ϙ\oldKoppaGreek Letter Archaic Koppa
    U+003D9ϙ\oldkoppaGreek Small Letter Archaic Koppa
    U+003DAϚ\StigmaGreek Letter Stigma / Greek Capital Letter Stigma
    U+003DBϛ\stigmaGreek Small Letter Stigma
    U+003DCϜ\DigammaGreek Letter Digamma / Greek Capital Letter Digamma
    U+003DDϝ\digammaGreek Small Letter Digamma
    U+003DEϞ\KoppaGreek Letter Koppa / Greek Capital Letter Koppa
    U+003DFϟ\koppaGreek Small Letter Koppa
    U+003E0Ϡ\SampiGreek Letter Sampi / Greek Capital Letter Sampi
    U+003E1ϡ\sampiGreek Small Letter Sampi
    U+003F0ϰ\varkappaGreek Kappa Symbol / Greek Small Letter Script Kappa
    U+003F1ϱ\varrhoGreek Rho Symbol / Greek Small Letter Tailed Rho
    U+003F4ϴ\varThetaGreek Capital Theta Symbol
    U+003F5ϵ\epsilonGreek Lunate Epsilon Symbol
    U+003F6϶\backepsilonGreek Reversed Lunate Epsilon Symbol
    U+01D2C\^AModifier Letter Capital A
    U+01D2E\^BModifier Letter Capital B
    U+01D30\^DModifier Letter Capital D
    U+01D31\^EModifier Letter Capital E
    U+01D33\^GModifier Letter Capital G
    U+01D34\^HModifier Letter Capital H
    U+01D35\^IModifier Letter Capital I
    U+01D36\^JModifier Letter Capital J
    U+01D37\^KModifier Letter Capital K
    U+01D38\^LModifier Letter Capital L
    U+01D39\^MModifier Letter Capital M
    U+01D3A\^NModifier Letter Capital N
    U+01D3C\^OModifier Letter Capital O
    U+01D3E\^PModifier Letter Capital P
    U+01D3Fᴿ\^RModifier Letter Capital R
    U+01D40\^TModifier Letter Capital T
    U+01D41\^UModifier Letter Capital U
    U+01D42\^WModifier Letter Capital W
    U+01D43\^aModifier Letter Small A
    U+01D45\^alphaModifier Letter Small Alpha
    U+01D47\^bModifier Letter Small B
    U+01D48\^dModifier Letter Small D
    U+01D49\^eModifier Letter Small E
    U+01D4B\^epsilonModifier Letter Small Open E
    U+01D4D\^gModifier Letter Small G
    U+01D4F\^kModifier Letter Small K
    U+01D50\^mModifier Letter Small M
    U+01D52\^oModifier Letter Small O
    U+01D56\^pModifier Letter Small P
    U+01D57\^tModifier Letter Small T
    U+01D58\^uModifier Letter Small U
    U+01D5B\^vModifier Letter Small V
    U+01D5D\^betaModifier Letter Small Beta
    U+01D5E\^gammaModifier Letter Small Greek Gamma
    U+01D5F\^deltaModifier Letter Small Delta
    U+01D60\^phiModifier Letter Small Greek Phi
    U+01D61\^chiModifier Letter Small Chi
    U+01D62\_iLatin Subscript Small Letter I
    U+01D63\_rLatin Subscript Small Letter R
    U+01D64\_uLatin Subscript Small Letter U
    U+01D65\_vLatin Subscript Small Letter V
    U+01D66\_betaGreek Subscript Small Letter Beta
    U+01D67\_gammaGreek Subscript Small Letter Gamma
    U+01D68\_rhoGreek Subscript Small Letter Rho
    U+01D69\_phiGreek Subscript Small Letter Phi
    U+01D6A\_chiGreek Subscript Small Letter Chi
    U+01D9C\^cModifier Letter Small C
    U+01DA0\^fModifier Letter Small F
    U+01DA5\^iotaModifier Letter Small Iota
    U+01DB2\^ltphiModifier Letter Small Phi
    U+01DBB\^zModifier Letter Small Z
    U+01DBFᶿ\^thetaModifier Letter Small Theta
    U+02002\enspaceEn Space
    U+02003\quadEm Space
    U+02005\thickspaceFour-Per-Em Space
    U+02009\thinspaceThin Space
    U+0200A\hspaceHair Space
    U+02013\endashEn Dash
    U+02014\emdashEm Dash
    U+02016\VertDouble Vertical Line / Double Vertical Bar
    U+02018\lqLeft Single Quotation Mark / Single Turned Comma Quotation Mark
    U+02019\rqRight Single Quotation Mark / Single Comma Quotation Mark
    U+0201B\reaposSingle High-Reversed-9 Quotation Mark / Single Reversed Comma Quotation Mark
    U+0201C\ldqLeft Double Quotation Mark / Double Turned Comma Quotation Mark
    U+0201D\rdqRight Double Quotation Mark / Double Comma Quotation Mark
    U+02020\daggerDagger
    U+02021\ddaggerDouble Dagger
    U+02022\bulletBullet
    U+02026\dots, \ldotsHorizontal Ellipsis
    U+02030\perthousandPer Mille Sign
    U+02031\pertenthousandPer Ten Thousand Sign
    U+02032\primePrime
    U+02033\pprimeDouble Prime
    U+02034\ppprimeTriple Prime
    U+02035\backprimeReversed Prime
    U+02036\backpprimeReversed Double Prime
    U+02037\backppprimeReversed Triple Prime
    U+02039\guilsinglleftSingle Left-Pointing Angle Quotation Mark / Left Pointing Single Guillemet
    U+0203A\guilsinglrightSingle Right-Pointing Angle Quotation Mark / Right Pointing Single Guillemet
    U+0203C\:bangbang:Double Exclamation Mark
    U+02040\tieconcatCharacter Tie
    U+02049\:interrobang:Exclamation Question Mark
    U+02057\pppprimeQuadruple Prime
    U+0205D\tricolonTricolon
    U+02060\nolinebreakWord Joiner
    U+02070\^0Superscript Zero / Superscript Digit Zero
    U+02071\^iSuperscript Latin Small Letter I
    U+02074\^4Superscript Four / Superscript Digit Four
    U+02075\^5Superscript Five / Superscript Digit Five
    U+02076\^6Superscript Six / Superscript Digit Six
    U+02077\^7Superscript Seven / Superscript Digit Seven
    U+02078\^8Superscript Eight / Superscript Digit Eight
    U+02079\^9Superscript Nine / Superscript Digit Nine
    U+0207A\^+Superscript Plus Sign
    U+0207B\^-Superscript Minus / Superscript Hyphen-Minus
    U+0207C\^=Superscript Equals Sign
    U+0207D\^(Superscript Left Parenthesis / Superscript Opening Parenthesis
    U+0207E\^)Superscript Right Parenthesis / Superscript Closing Parenthesis
    U+0207F\^nSuperscript Latin Small Letter N
    U+02080\_0Subscript Zero / Subscript Digit Zero
    U+02081\_1Subscript One / Subscript Digit One
    U+02082\_2Subscript Two / Subscript Digit Two
    U+02083\_3Subscript Three / Subscript Digit Three
    U+02084\_4Subscript Four / Subscript Digit Four
    U+02085\_5Subscript Five / Subscript Digit Five
    U+02086\_6Subscript Six / Subscript Digit Six
    U+02087\_7Subscript Seven / Subscript Digit Seven
    U+02088\_8Subscript Eight / Subscript Digit Eight
    U+02089\_9Subscript Nine / Subscript Digit Nine
    U+0208A\_+Subscript Plus Sign
    U+0208B\_-Subscript Minus / Subscript Hyphen-Minus
    U+0208C\_=Subscript Equals Sign
    U+0208D\_(Subscript Left Parenthesis / Subscript Opening Parenthesis
    U+0208E\_)Subscript Right Parenthesis / Subscript Closing Parenthesis
    U+02090\_aLatin Subscript Small Letter A
    U+02091\_eLatin Subscript Small Letter E
    U+02092\_oLatin Subscript Small Letter O
    U+02093\_xLatin Subscript Small Letter X
    U+02094\_schwaLatin Subscript Small Letter Schwa
    U+02095\_hLatin Subscript Small Letter H
    U+02096\_kLatin Subscript Small Letter K
    U+02097\_lLatin Subscript Small Letter L
    U+02098\_mLatin Subscript Small Letter M
    U+02099\_nLatin Subscript Small Letter N
    U+0209A\_pLatin Subscript Small Letter P
    U+0209B\_sLatin Subscript Small Letter S
    U+0209C\_tLatin Subscript Small Letter T
    U+020A7\pesPeseta Sign
    U+020AC\euroEuro Sign
    U+020D0 ⃐ \leftharpoonaccentCombining Left Harpoon Above / Non-Spacing Left Harpoon Above
    U+020D1 ⃑ \rightharpoonaccentCombining Right Harpoon Above / Non-Spacing Right Harpoon Above
    U+020D2 ⃒ \vertoverlayCombining Long Vertical Line Overlay / Non-Spacing Long Vertical Bar Overlay
    U+020D6 ⃖ \overleftarrowCombining Left Arrow Above / Non-Spacing Left Arrow Above
    U+020D7 ⃗ \vecCombining Right Arrow Above / Non-Spacing Right Arrow Above
    U+020DB ⃛ \dddotCombining Three Dots Above / Non-Spacing Three Dots Above
    U+020DC ⃜ \ddddotCombining Four Dots Above / Non-Spacing Four Dots Above
    U+020DD ⃝ \enclosecircleCombining Enclosing Circle / Enclosing Circle
    U+020DE ⃞ \enclosesquareCombining Enclosing Square / Enclosing Square
    U+020DF ⃟ \enclosediamondCombining Enclosing Diamond / Enclosing Diamond
    U+020E1 ⃡ \overleftrightarrowCombining Left Right Arrow Above / Non-Spacing Left Right Arrow Above
    U+020E4 ⃤ \enclosetriangleCombining Enclosing Upward Pointing Triangle
    U+020E7 ⃧ \annuityCombining Annuity Symbol
    U+020E8 ⃨ \threeunderdotCombining Triple Underdot
    U+020E9 ⃩ \widebridgeaboveCombining Wide Bridge Above
    U+020EC ⃬ \underrightharpoondownCombining Rightwards Harpoon With Barb Downwards
    U+020ED ⃭ \underleftharpoondownCombining Leftwards Harpoon With Barb Downwards
    U+020EE ⃮ \underleftarrowCombining Left Arrow Below
    U+020EF ⃯ \underrightarrowCombining Right Arrow Below
    U+020F0 ⃰ \asteraccentCombining Asterisk Above
    U+02102\bbCDouble-Struck Capital C / Double-Struck C
    U+02107\eulermascheroniEuler Constant / Eulers
    U+0210A\scrgScript Small G
    U+0210B\scrHScript Capital H / Script H
    U+0210C\frakHBlack-Letter Capital H / Black-Letter H
    U+0210D\bbHDouble-Struck Capital H / Double-Struck H
    U+0210E\ith, \planckPlanck Constant
    U+0210F\hslashPlanck Constant Over Two Pi / Planck Constant Over 2 Pi
    U+02110\scrIScript Capital I / Script I
    U+02111\Im, \frakIBlack-Letter Capital I / Black-Letter I
    U+02112\scrLScript Capital L / Script L
    U+02113\ellScript Small L
    U+02115\bbNDouble-Struck Capital N / Double-Struck N
    U+02116\numeroNumero Sign / Numero
    U+02118\wpScript Capital P / Script P
    U+02119\bbPDouble-Struck Capital P / Double-Struck P
    U+0211A\bbQDouble-Struck Capital Q / Double-Struck Q
    U+0211B\scrRScript Capital R / Script R
    U+0211C\Re, \frakRBlack-Letter Capital R / Black-Letter R
    U+0211D\bbRDouble-Struck Capital R / Double-Struck R
    U+0211E\xratPrescription Take
    U+02122\trademark, \:tm:Trade Mark Sign / Trademark
    U+02124\bbZDouble-Struck Capital Z / Double-Struck Z
    U+02126\ohmOhm Sign / Ohm
    U+02127\mhoInverted Ohm Sign / Mho
    U+02128\frakZBlack-Letter Capital Z / Black-Letter Z
    U+02129\turnediotaTurned Greek Small Letter Iota
    U+0212B\AngstromAngstrom Sign / Angstrom Unit
    U+0212C\scrBScript Capital B / Script B
    U+0212D\frakCBlack-Letter Capital C / Black-Letter C
    U+0212F\scre, \eulerScript Small E
    U+02130\scrEScript Capital E / Script E
    U+02131\scrFScript Capital F / Script F
    U+02132\FinvTurned Capital F / Turned F
    U+02133\scrMScript Capital M / Script M
    U+02134\scroScript Small O
    U+02135\alephAlef Symbol / First Transfinite Cardinal
    U+02136\bethBet Symbol / Second Transfinite Cardinal
    U+02137\gimelGimel Symbol / Third Transfinite Cardinal
    U+02138\dalethDalet Symbol / Fourth Transfinite Cardinal
    U+02139\:information_source:Information Source
    U+0213C\bbpiDouble-Struck Small Pi
    U+0213D\bbgammaDouble-Struck Small Gamma
    U+0213E\bbGammaDouble-Struck Capital Gamma
    U+0213F\bbPiDouble-Struck Capital Pi
    U+02140\bbsumDouble-Struck N-Ary Summation
    U+02141\GameTurned Sans-Serif Capital G
    U+02142\sansLturnedTurned Sans-Serif Capital L
    U+02143\sansLmirroredReversed Sans-Serif Capital L
    U+02144\YupTurned Sans-Serif Capital Y
    U+02145\bbiDDouble-Struck Italic Capital D
    U+02146\bbidDouble-Struck Italic Small D
    U+02147\bbieDouble-Struck Italic Small E
    U+02148\bbiiDouble-Struck Italic Small I
    U+02149\bbijDouble-Struck Italic Small J
    U+0214A\PropertyLineProperty Line
    U+0214B\upandTurned Ampersand
    U+02150\1/7Vulgar Fraction One Seventh
    U+02151\1/9Vulgar Fraction One Ninth
    U+02152\1/10Vulgar Fraction One Tenth
    U+02153\1/3Vulgar Fraction One Third / Fraction One Third
    U+02154\2/3Vulgar Fraction Two Thirds / Fraction Two Thirds
    U+02155\1/5Vulgar Fraction One Fifth / Fraction One Fifth
    U+02156\2/5Vulgar Fraction Two Fifths / Fraction Two Fifths
    U+02157\3/5Vulgar Fraction Three Fifths / Fraction Three Fifths
    U+02158\4/5Vulgar Fraction Four Fifths / Fraction Four Fifths
    U+02159\1/6Vulgar Fraction One Sixth / Fraction One Sixth
    U+0215A\5/6Vulgar Fraction Five Sixths / Fraction Five Sixths
    U+0215B\1/8Vulgar Fraction One Eighth / Fraction One Eighth
    U+0215C\3/8Vulgar Fraction Three Eighths / Fraction Three Eighths
    U+0215D\5/8Vulgar Fraction Five Eighths / Fraction Five Eighths
    U+0215E\7/8Vulgar Fraction Seven Eighths / Fraction Seven Eighths
    U+0215F\1/Fraction Numerator One
    U+02189\0/3Vulgar Fraction Zero Thirds
    U+02190\leftarrowLeftwards Arrow / Left Arrow
    U+02191\uparrowUpwards Arrow / Up Arrow
    U+02192\to, \rightarrowRightwards Arrow / Right Arrow
    U+02193\downarrowDownwards Arrow / Down Arrow
    U+02194\leftrightarrow, \:left_right_arrow:Left Right Arrow
    U+02195\updownarrow, \:arrow_up_down:Up Down Arrow
    U+02196\nwarrow, \:arrow_upper_left:North West Arrow / Upper Left Arrow
    U+02197\nearrow, \:arrow_upper_right:North East Arrow / Upper Right Arrow
    U+02198\searrow, \:arrow_lower_right:South East Arrow / Lower Right Arrow
    U+02199\swarrow, \:arrow_lower_left:South West Arrow / Lower Left Arrow
    U+0219A\nleftarrowLeftwards Arrow With Stroke / Left Arrow With Stroke
    U+0219B\nrightarrowRightwards Arrow With Stroke / Right Arrow With Stroke
    U+0219C\leftwavearrowLeftwards Wave Arrow / Left Wave Arrow
    U+0219D\rightwavearrowRightwards Wave Arrow / Right Wave Arrow
    U+0219E\twoheadleftarrowLeftwards Two Headed Arrow / Left Two Headed Arrow
    U+0219F\twoheaduparrowUpwards Two Headed Arrow / Up Two Headed Arrow
    U+021A0\twoheadrightarrowRightwards Two Headed Arrow / Right Two Headed Arrow
    U+021A1\twoheaddownarrowDownwards Two Headed Arrow / Down Two Headed Arrow
    U+021A2\leftarrowtailLeftwards Arrow With Tail / Left Arrow With Tail
    U+021A3\rightarrowtailRightwards Arrow With Tail / Right Arrow With Tail
    U+021A4\mapsfromLeftwards Arrow From Bar / Left Arrow From Bar
    U+021A5\mapsupUpwards Arrow From Bar / Up Arrow From Bar
    U+021A6\mapstoRightwards Arrow From Bar / Right Arrow From Bar
    U+021A7\mapsdownDownwards Arrow From Bar / Down Arrow From Bar
    U+021A8\updownarrowbarUp Down Arrow With Base
    U+021A9\hookleftarrow, \:leftwards_arrow_with_hook:Leftwards Arrow With Hook / Left Arrow With Hook
    U+021AA\hookrightarrow, \:arrow_right_hook:Rightwards Arrow With Hook / Right Arrow With Hook
    U+021AB\looparrowleftLeftwards Arrow With Loop / Left Arrow With Loop
    U+021AC\looparrowrightRightwards Arrow With Loop / Right Arrow With Loop
    U+021AD\leftrightsquigarrowLeft Right Wave Arrow
    U+021AE\nleftrightarrowLeft Right Arrow With Stroke
    U+021AF\downzigzagarrowDownwards Zigzag Arrow / Down Zigzag Arrow
    U+021B0\LshUpwards Arrow With Tip Leftwards / Up Arrow With Tip Left
    U+021B1\RshUpwards Arrow With Tip Rightwards / Up Arrow With Tip Right
    U+021B2\LdshDownwards Arrow With Tip Leftwards / Down Arrow With Tip Left
    U+021B3\RdshDownwards Arrow With Tip Rightwards / Down Arrow With Tip Right
    U+021B4\linefeedRightwards Arrow With Corner Downwards / Right Arrow With Corner Down
    U+021B5\carriagereturnDownwards Arrow With Corner Leftwards / Down Arrow With Corner Left
    U+021B6\curvearrowleftAnticlockwise Top Semicircle Arrow
    U+021B7\curvearrowrightClockwise Top Semicircle Arrow
    U+021B8\barovernorthwestarrowNorth West Arrow To Long Bar / Upper Left Arrow To Long Bar
    U+021B9\barleftarrowrightarrowbarLeftwards Arrow To Bar Over Rightwards Arrow To Bar / Left Arrow To Bar Over Right Arrow To Bar
    U+021BA\circlearrowleftAnticlockwise Open Circle Arrow
    U+021BB\circlearrowrightClockwise Open Circle Arrow
    U+021BC\leftharpoonupLeftwards Harpoon With Barb Upwards / Left Harpoon With Barb Up
    U+021BD\leftharpoondownLeftwards Harpoon With Barb Downwards / Left Harpoon With Barb Down
    U+021BE\upharpoonrightUpwards Harpoon With Barb Rightwards / Up Harpoon With Barb Right
    U+021BF\upharpoonleftUpwards Harpoon With Barb Leftwards / Up Harpoon With Barb Left
    U+021C0\rightharpoonupRightwards Harpoon With Barb Upwards / Right Harpoon With Barb Up
    U+021C1\rightharpoondownRightwards Harpoon With Barb Downwards / Right Harpoon With Barb Down
    U+021C2\downharpoonrightDownwards Harpoon With Barb Rightwards / Down Harpoon With Barb Right
    U+021C3\downharpoonleftDownwards Harpoon With Barb Leftwards / Down Harpoon With Barb Left
    U+021C4\rightleftarrowsRightwards Arrow Over Leftwards Arrow / Right Arrow Over Left Arrow
    U+021C5\dblarrowupdownUpwards Arrow Leftwards Of Downwards Arrow / Up Arrow Left Of Down Arrow
    U+021C6\leftrightarrowsLeftwards Arrow Over Rightwards Arrow / Left Arrow Over Right Arrow
    U+021C7\leftleftarrowsLeftwards Paired Arrows / Left Paired Arrows
    U+021C8\upuparrowsUpwards Paired Arrows / Up Paired Arrows
    U+021C9\rightrightarrowsRightwards Paired Arrows / Right Paired Arrows
    U+021CA\downdownarrowsDownwards Paired Arrows / Down Paired Arrows
    U+021CB\leftrightharpoonsLeftwards Harpoon Over Rightwards Harpoon / Left Harpoon Over Right Harpoon
    U+021CC\rightleftharpoonsRightwards Harpoon Over Leftwards Harpoon / Right Harpoon Over Left Harpoon
    U+021CD\nLeftarrowLeftwards Double Arrow With Stroke / Left Double Arrow With Stroke
    U+021CE\nLeftrightarrowLeft Right Double Arrow With Stroke
    U+021CF\nRightarrowRightwards Double Arrow With Stroke / Right Double Arrow With Stroke
    U+021D0\LeftarrowLeftwards Double Arrow / Left Double Arrow
    U+021D1\UparrowUpwards Double Arrow / Up Double Arrow
    U+021D2\RightarrowRightwards Double Arrow / Right Double Arrow
    U+021D3\DownarrowDownwards Double Arrow / Down Double Arrow
    U+021D4\LeftrightarrowLeft Right Double Arrow
    U+021D5\UpdownarrowUp Down Double Arrow
    U+021D6\NwarrowNorth West Double Arrow / Upper Left Double Arrow
    U+021D7\NearrowNorth East Double Arrow / Upper Right Double Arrow
    U+021D8\SearrowSouth East Double Arrow / Lower Right Double Arrow
    U+021D9\SwarrowSouth West Double Arrow / Lower Left Double Arrow
    U+021DA\LleftarrowLeftwards Triple Arrow / Left Triple Arrow
    U+021DB\RrightarrowRightwards Triple Arrow / Right Triple Arrow
    U+021DC\leftsquigarrowLeftwards Squiggle Arrow / Left Squiggle Arrow
    U+021DD\rightsquigarrowRightwards Squiggle Arrow / Right Squiggle Arrow
    U+021DE\nHuparrowUpwards Arrow With Double Stroke / Up Arrow With Double Stroke
    U+021DF\nHdownarrowDownwards Arrow With Double Stroke / Down Arrow With Double Stroke
    U+021E0\leftdasharrowLeftwards Dashed Arrow / Left Dashed Arrow
    U+021E1\updasharrowUpwards Dashed Arrow / Up Dashed Arrow
    U+021E2\rightdasharrowRightwards Dashed Arrow / Right Dashed Arrow
    U+021E3\downdasharrowDownwards Dashed Arrow / Down Dashed Arrow
    U+021E4\barleftarrowLeftwards Arrow To Bar / Left Arrow To Bar
    U+021E5\rightarrowbarRightwards Arrow To Bar / Right Arrow To Bar
    U+021E6\leftwhitearrowLeftwards White Arrow / White Left Arrow
    U+021E7\upwhitearrowUpwards White Arrow / White Up Arrow
    U+021E8\rightwhitearrowRightwards White Arrow / White Right Arrow
    U+021E9\downwhitearrowDownwards White Arrow / White Down Arrow
    U+021EA\whitearrowupfrombarUpwards White Arrow From Bar / White Up Arrow From Bar
    U+021F4\circleonrightarrowRight Arrow With Small Circle
    U+021F5\DownArrowUpArrowDownwards Arrow Leftwards Of Upwards Arrow
    U+021F6\rightthreearrowsThree Rightwards Arrows
    U+021F7\nvleftarrowLeftwards Arrow With Vertical Stroke
    U+021F8\nvrightarrowRightwards Arrow With Vertical Stroke
    U+021F9\nvleftrightarrowLeft Right Arrow With Vertical Stroke
    U+021FA\nVleftarrowLeftwards Arrow With Double Vertical Stroke
    U+021FB\nVrightarrowRightwards Arrow With Double Vertical Stroke
    U+021FC\nVleftrightarrowLeft Right Arrow With Double Vertical Stroke
    U+021FD\leftarrowtriangleLeftwards Open-Headed Arrow
    U+021FE\rightarrowtriangleRightwards Open-Headed Arrow
    U+021FF\leftrightarrowtriangleLeft Right Open-Headed Arrow
    U+02200\forallFor All
    U+02201\complementComplement
    U+02202\partialPartial Differential
    U+02203\existsThere Exists
    U+02204\nexistsThere Does Not Exist
    U+02205\varnothing, \emptysetEmpty Set
    U+02206\incrementIncrement
    U+02207\del, \nablaNabla
    U+02208\inElement Of
    U+02209\notinNot An Element Of
    U+0220A\smallinSmall Element Of
    U+0220B\niContains As Member
    U+0220C\nniDoes Not Contain As Member
    U+0220D\smallniSmall Contains As Member
    U+0220E\QEDEnd Of Proof
    U+0220F\prodN-Ary Product
    U+02210\coprodN-Ary Coproduct
    U+02211\sumN-Ary Summation
    U+02212\minusMinus Sign
    U+02213\mpMinus-Or-Plus Sign
    U+02214\dotplusDot Plus
    U+02216\setminusSet Minus
    U+02217\astAsterisk Operator
    U+02218\circRing Operator
    U+02219\vysmblkcircleBullet Operator
    U+0221A\surd, \sqrtSquare Root
    U+0221B\cbrtCube Root
    U+0221C\fourthrootFourth Root
    U+0221D\proptoProportional To
    U+0221E\inftyInfinity
    U+0221F\rightangleRight Angle
    U+02220\angleAngle
    U+02221\measuredangleMeasured Angle
    U+02222\sphericalangleSpherical Angle
    U+02223\midDivides
    U+02224\nmidDoes Not Divide
    U+02225\parallelParallel To
    U+02226\nparallelNot Parallel To
    U+02227\wedgeLogical And
    U+02228\veeLogical Or
    U+02229\capIntersection
    U+0222A\cupUnion
    U+0222B\intIntegral
    U+0222C\iintDouble Integral
    U+0222D\iiintTriple Integral
    U+0222E\ointContour Integral
    U+0222F\oiintSurface Integral
    U+02230\oiiintVolume Integral
    U+02231\clwintegralClockwise Integral
    U+02232\varointclockwiseClockwise Contour Integral
    U+02233\ointctrclockwiseAnticlockwise Contour Integral
    U+02234\thereforeTherefore
    U+02235\becauseBecause
    U+02237\ColonProportion
    U+02238\dotminusDot Minus
    U+0223A\dotsminusdotsGeometric Proportion
    U+0223B\kernelcontractionHomothetic
    U+0223C\simTilde Operator
    U+0223D\backsimReversed Tilde
    U+0223E\lazysinvInverted Lazy S
    U+0223F\sinewaveSine Wave
    U+02240\wrWreath Product
    U+02241\nsimNot Tilde
    U+02242\eqsimMinus Tilde
    U+02242 + U+00338≂̸\neqsimMinus Tilde + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02243\simeqAsymptotically Equal To
    U+02244\nsimeNot Asymptotically Equal To
    U+02245\congApproximately Equal To
    U+02246\approxnotequalApproximately But Not Actually Equal To
    U+02247\ncongNeither Approximately Nor Actually Equal To
    U+02248\approxAlmost Equal To
    U+02249\napproxNot Almost Equal To
    U+0224A\approxeqAlmost Equal Or Equal To
    U+0224B\tildetrplTriple Tilde
    U+0224C\allequalAll Equal To
    U+0224D\asympEquivalent To
    U+0224E\BumpeqGeometrically Equivalent To
    U+0224E + U+00338≎̸\nBumpeqGeometrically Equivalent To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0224F\bumpeqDifference Between
    U+0224F + U+00338≏̸\nbumpeqDifference Between + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02250\doteqApproaches The Limit
    U+02251\DoteqGeometrically Equal To
    U+02252\fallingdotseqApproximately Equal To Or The Image Of
    U+02253\risingdotseqImage Of Or Approximately Equal To
    U+02254\coloneqColon Equals / Colon Equal
    U+02255\eqcolonEquals Colon / Equal Colon
    U+02256\eqcircRing In Equal To
    U+02257\circeqRing Equal To
    U+02258\arceqCorresponds To
    U+02259\wedgeqEstimates
    U+0225A\veeeqEquiangular To
    U+0225B\starequalStar Equals
    U+0225C\triangleqDelta Equal To
    U+0225D\eqdefEqual To By Definition
    U+0225E\measeqMeasured By
    U+0225F\questeqQuestioned Equal To
    U+02260\ne, \neqNot Equal To
    U+02261\equivIdentical To
    U+02262\nequivNot Identical To
    U+02263\EquivStrictly Equivalent To
    U+02264\le, \leqLess-Than Or Equal To / Less Than Or Equal To
    U+02265\ge, \geqGreater-Than Or Equal To / Greater Than Or Equal To
    U+02266\leqqLess-Than Over Equal To / Less Than Over Equal To
    U+02267\geqqGreater-Than Over Equal To / Greater Than Over Equal To
    U+02268\lneqqLess-Than But Not Equal To / Less Than But Not Equal To
    U+02268 + U+0FE00≨︀\lvertneqqLess-Than But Not Equal To / Less Than But Not Equal To + Variation Selector-1
    U+02269\gneqqGreater-Than But Not Equal To / Greater Than But Not Equal To
    U+02269 + U+0FE00≩︀\gvertneqqGreater-Than But Not Equal To / Greater Than But Not Equal To + Variation Selector-1
    U+0226A\llMuch Less-Than / Much Less Than
    U+0226A + U+00338≪̸\NotLessLessMuch Less-Than / Much Less Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0226B\ggMuch Greater-Than / Much Greater Than
    U+0226B + U+00338≫̸\NotGreaterGreaterMuch Greater-Than / Much Greater Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0226C\betweenBetween
    U+0226D\nasympNot Equivalent To
    U+0226E\nlessNot Less-Than / Not Less Than
    U+0226F\ngtrNot Greater-Than / Not Greater Than
    U+02270\nleqNeither Less-Than Nor Equal To / Neither Less Than Nor Equal To
    U+02271\ngeqNeither Greater-Than Nor Equal To / Neither Greater Than Nor Equal To
    U+02272\lesssimLess-Than Or Equivalent To / Less Than Or Equivalent To
    U+02273\gtrsimGreater-Than Or Equivalent To / Greater Than Or Equivalent To
    U+02274\nlesssimNeither Less-Than Nor Equivalent To / Neither Less Than Nor Equivalent To
    U+02275\ngtrsimNeither Greater-Than Nor Equivalent To / Neither Greater Than Nor Equivalent To
    U+02276\lessgtrLess-Than Or Greater-Than / Less Than Or Greater Than
    U+02277\gtrlessGreater-Than Or Less-Than / Greater Than Or Less Than
    U+02278\notlessgreaterNeither Less-Than Nor Greater-Than / Neither Less Than Nor Greater Than
    U+02279\notgreaterlessNeither Greater-Than Nor Less-Than / Neither Greater Than Nor Less Than
    U+0227A\precPrecedes
    U+0227B\succSucceeds
    U+0227C\preccurlyeqPrecedes Or Equal To
    U+0227D\succcurlyeqSucceeds Or Equal To
    U+0227E\precsimPrecedes Or Equivalent To
    U+0227E + U+00338≾̸\nprecsimPrecedes Or Equivalent To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0227F\succsimSucceeds Or Equivalent To
    U+0227F + U+00338≿̸\nsuccsimSucceeds Or Equivalent To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02280\nprecDoes Not Precede
    U+02281\nsuccDoes Not Succeed
    U+02282\subsetSubset Of
    U+02283\supsetSuperset Of
    U+02284\nsubsetNot A Subset Of
    U+02285\nsupsetNot A Superset Of
    U+02286\subseteqSubset Of Or Equal To
    U+02287\supseteqSuperset Of Or Equal To
    U+02288\nsubseteqNeither A Subset Of Nor Equal To
    U+02289\nsupseteqNeither A Superset Of Nor Equal To
    U+0228A\subsetneqSubset Of With Not Equal To / Subset Of Or Not Equal To
    U+0228A + U+0FE00⊊︀\varsubsetneqqSubset Of With Not Equal To / Subset Of Or Not Equal To + Variation Selector-1
    U+0228B\supsetneqSuperset Of With Not Equal To / Superset Of Or Not Equal To
    U+0228B + U+0FE00⊋︀\varsupsetneqSuperset Of With Not Equal To / Superset Of Or Not Equal To + Variation Selector-1
    U+0228D\cupdotMultiset Multiplication
    U+0228E\uplusMultiset Union
    U+0228F\sqsubsetSquare Image Of
    U+0228F + U+00338⊏̸\NotSquareSubsetSquare Image Of + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02290\sqsupsetSquare Original Of
    U+02290 + U+00338⊐̸\NotSquareSupersetSquare Original Of + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02291\sqsubseteqSquare Image Of Or Equal To
    U+02292\sqsupseteqSquare Original Of Or Equal To
    U+02293\sqcapSquare Cap
    U+02294\sqcupSquare Cup
    U+02295\oplusCircled Plus
    U+02296\ominusCircled Minus
    U+02297\otimesCircled Times
    U+02298\oslashCircled Division Slash
    U+02299\odotCircled Dot Operator
    U+0229A\circledcircCircled Ring Operator
    U+0229B\circledastCircled Asterisk Operator
    U+0229C\circledequalCircled Equals
    U+0229D\circleddashCircled Dash
    U+0229E\boxplusSquared Plus
    U+0229F\boxminusSquared Minus
    U+022A0\boxtimesSquared Times
    U+022A1\boxdotSquared Dot Operator
    U+022A2\vdashRight Tack
    U+022A3\dashvLeft Tack
    U+022A4\topDown Tack
    U+022A5\botUp Tack
    U+022A7\modelsModels
    U+022A8\vDashTrue
    U+022A9\VdashForces
    U+022AA\VvdashTriple Vertical Bar Right Turnstile
    U+022AB\VDashDouble Vertical Bar Double Right Turnstile
    U+022AC\nvdashDoes Not Prove
    U+022AD\nvDashNot True
    U+022AE\nVdashDoes Not Force
    U+022AF\nVDashNegated Double Vertical Bar Double Right Turnstile
    U+022B0\prurelPrecedes Under Relation
    U+022B1\scurelSucceeds Under Relation
    U+022B2\vartriangleleftNormal Subgroup Of
    U+022B3\vartrianglerightContains As Normal Subgroup
    U+022B4\trianglelefteqNormal Subgroup Of Or Equal To
    U+022B5\trianglerighteqContains As Normal Subgroup Or Equal To
    U+022B6\originalOriginal Of
    U+022B7\imageImage Of
    U+022B8\multimapMultimap
    U+022B9\hermitconjmatrixHermitian Conjugate Matrix
    U+022BA\intercalIntercalate
    U+022BB\veebar, \xorXor
    U+022BC\barwedge, \nandNand
    U+022BD\barvee, \norNor
    U+022BE\rightanglearcRight Angle With Arc
    U+022BF\varlrtriangleRight Triangle
    U+022C0\bigwedgeN-Ary Logical And
    U+022C1\bigveeN-Ary Logical Or
    U+022C2\bigcapN-Ary Intersection
    U+022C3\bigcupN-Ary Union
    U+022C4\diamondDiamond Operator
    U+022C5\cdotDot Operator
    U+022C6\starStar Operator
    U+022C7\divideontimesDivision Times
    U+022C8\bowtieBowtie
    U+022C9\ltimesLeft Normal Factor Semidirect Product
    U+022CA\rtimesRight Normal Factor Semidirect Product
    U+022CB\leftthreetimesLeft Semidirect Product
    U+022CC\rightthreetimesRight Semidirect Product
    U+022CD\backsimeqReversed Tilde Equals
    U+022CE\curlyveeCurly Logical Or
    U+022CF\curlywedgeCurly Logical And
    U+022D0\SubsetDouble Subset
    U+022D1\SupsetDouble Superset
    U+022D2\CapDouble Intersection
    U+022D3\CupDouble Union
    U+022D4\pitchforkPitchfork
    U+022D5\equalparallelEqual And Parallel To
    U+022D6\lessdotLess-Than With Dot / Less Than With Dot
    U+022D7\gtrdotGreater-Than With Dot / Greater Than With Dot
    U+022D8\verymuchlessVery Much Less-Than / Very Much Less Than
    U+022D9\gggVery Much Greater-Than / Very Much Greater Than
    U+022DA\lesseqgtrLess-Than Equal To Or Greater-Than / Less Than Equal To Or Greater Than
    U+022DB\gtreqlessGreater-Than Equal To Or Less-Than / Greater Than Equal To Or Less Than
    U+022DC\eqlessEqual To Or Less-Than / Equal To Or Less Than
    U+022DD\eqgtrEqual To Or Greater-Than / Equal To Or Greater Than
    U+022DE\curlyeqprecEqual To Or Precedes
    U+022DF\curlyeqsuccEqual To Or Succeeds
    U+022E0\npreccurlyeqDoes Not Precede Or Equal
    U+022E1\nsucccurlyeqDoes Not Succeed Or Equal
    U+022E2\nsqsubseteqNot Square Image Of Or Equal To
    U+022E3\nsqsupseteqNot Square Original Of Or Equal To
    U+022E4\sqsubsetneqSquare Image Of Or Not Equal To
    U+022E5\sqsupsetneqSquare Original Of Or Not Equal To
    U+022E6\lnsimLess-Than But Not Equivalent To / Less Than But Not Equivalent To
    U+022E7\gnsimGreater-Than But Not Equivalent To / Greater Than But Not Equivalent To
    U+022E8\precnsimPrecedes But Not Equivalent To
    U+022E9\succnsimSucceeds But Not Equivalent To
    U+022EA\ntriangleleftNot Normal Subgroup Of
    U+022EB\ntrianglerightDoes Not Contain As Normal Subgroup
    U+022EC\ntrianglelefteqNot Normal Subgroup Of Or Equal To
    U+022ED\ntrianglerighteqDoes Not Contain As Normal Subgroup Or Equal
    U+022EE\vdotsVertical Ellipsis
    U+022EF\cdotsMidline Horizontal Ellipsis
    U+022F0\adotsUp Right Diagonal Ellipsis
    U+022F1\ddotsDown Right Diagonal Ellipsis
    U+022F2\disinElement Of With Long Horizontal Stroke
    U+022F3\varisinsElement Of With Vertical Bar At End Of Horizontal Stroke
    U+022F4\isinsSmall Element Of With Vertical Bar At End Of Horizontal Stroke
    U+022F5\isindotElement Of With Dot Above
    U+022F6\varisinobarElement Of With Overbar
    U+022F7\isinobarSmall Element Of With Overbar
    U+022F8\isinvbElement Of With Underbar
    U+022F9\isinEElement Of With Two Horizontal Strokes
    U+022FA\nisdContains With Long Horizontal Stroke
    U+022FB\varnisContains With Vertical Bar At End Of Horizontal Stroke
    U+022FC\nisSmall Contains With Vertical Bar At End Of Horizontal Stroke
    U+022FD\varniobarContains With Overbar
    U+022FE\niobarSmall Contains With Overbar
    U+022FF\bagmemberZ Notation Bag Membership
    U+02300\diameterDiameter Sign
    U+02302\houseHouse
    U+02305\varbarwedgeProjective
    U+02306\vardoublebarwedgePerspective
    U+02308\lceilLeft Ceiling
    U+02309\rceilRight Ceiling
    U+0230A\lfloorLeft Floor
    U+0230B\rfloorRight Floor
    U+02310\invnotReversed Not Sign
    U+02311\sqlozengeSquare Lozenge
    U+02312\proflineArc
    U+02313\profsurfSegment
    U+02315\recorderTelephone Recorder
    U+02317\viewdataViewdata Square
    U+02319\turnednotTurned Not Sign
    U+0231A\:watch:Watch
    U+0231B\:hourglass:Hourglass
    U+0231C\ulcornerTop Left Corner
    U+0231D\urcornerTop Right Corner
    U+0231E\llcornerBottom Left Corner
    U+0231F\lrcornerBottom Right Corner
    U+02322\frownFrown
    U+02323\smileSmile
    U+0232C\varhexagonlrbondsBenzene Ring
    U+02332\conictaperConical Taper
    U+02336\topbotApl Functional Symbol I-Beam
    U+0233D\obarApl Functional Symbol Circle Stile
    U+0233F\notslashApl Functional Symbol Slash Bar
    U+02340\notbackslashApl Functional Symbol Backslash Bar
    U+02353\boxupcaretApl Functional Symbol Quad Up Caret
    U+02370\boxquestionApl Functional Symbol Quad Question
    U+02394\hexagonSoftware-Function Symbol
    U+023A3\dlcornLeft Square Bracket Lower Corner
    U+023B0\lmoustacheUpper Left Or Lower Right Curly Bracket Section
    U+023B1\rmoustacheUpper Right Or Lower Left Curly Bracket Section
    U+023B4\overbracketTop Square Bracket
    U+023B5\underbracketBottom Square Bracket
    U+023B6\bbrktbrkBottom Square Bracket Over Top Square Bracket
    U+023B7\sqrtbottomRadical Symbol Bottom
    U+023B8\lvboxlineLeft Vertical Box Line
    U+023B9\rvboxlineRight Vertical Box Line
    U+023CE\varcarriagereturnReturn Symbol
    U+023DE\overbraceTop Curly Bracket
    U+023DF\underbraceBottom Curly Bracket
    U+023E2\trapeziumWhite Trapezium
    U+023E3\benzenrBenzene Ring With Circle
    U+023E4\strnsStraightness
    U+023E5\fltnsFlatness
    U+023E6\accurrentAc Current
    U+023E7\elintersElectrical Intersection
    U+023E9\:fast_forward:Black Right-Pointing Double Triangle
    U+023EA\:rewind:Black Left-Pointing Double Triangle
    U+023EB\:arrow_double_up:Black Up-Pointing Double Triangle
    U+023EC\:arrow_double_down:Black Down-Pointing Double Triangle
    U+023F0\:alarm_clock:Alarm Clock
    U+023F3\:hourglass_flowing_sand:Hourglass With Flowing Sand
    U+02422\blanksymbolBlank Symbol / Blank
    U+02423\visiblespaceOpen Box
    U+024C2\:m:Circled Latin Capital Letter M
    U+024C8\circledSCircled Latin Capital Letter S
    U+02506\dshfncBox Drawings Light Triple Dash Vertical / Forms Light Triple Dash Vertical
    U+02519\sqfnwBox Drawings Up Light And Left Heavy / Forms Up Light And Left Heavy
    U+02571\diagupBox Drawings Light Diagonal Upper Right To Lower Left / Forms Light Diagonal Upper Right To Lower Left
    U+02572\diagdownBox Drawings Light Diagonal Upper Left To Lower Right / Forms Light Diagonal Upper Left To Lower Right
    U+02580\blockuphalfUpper Half Block
    U+02584\blocklowhalfLower Half Block
    U+02588\blockfullFull Block
    U+0258C\blocklefthalfLeft Half Block
    U+02590\blockrighthalfRight Half Block
    U+02591\blockqtrshadedLight Shade
    U+02592\blockhalfshadedMedium Shade
    U+02593\blockthreeqtrshadedDark Shade
    U+025A0\blacksquareBlack Square
    U+025A1\squareWhite Square
    U+025A2\squovalWhite Square With Rounded Corners
    U+025A3\blackinwhitesquareWhite Square Containing Black Small Square
    U+025A4\squarehfillSquare With Horizontal Fill
    U+025A5\squarevfillSquare With Vertical Fill
    U+025A6\squarehvfillSquare With Orthogonal Crosshatch Fill
    U+025A7\squarenwsefillSquare With Upper Left To Lower Right Fill
    U+025A8\squareneswfillSquare With Upper Right To Lower Left Fill
    U+025A9\squarecrossfillSquare With Diagonal Crosshatch Fill
    U+025AA\smblksquare, \:black_small_square:Black Small Square
    U+025AB\smwhtsquare, \:white_small_square:White Small Square
    U+025AC\hrectangleblackBlack Rectangle
    U+025AD\hrectangleWhite Rectangle
    U+025AE\vrectangleblackBlack Vertical Rectangle
    U+025AF\vrectoWhite Vertical Rectangle
    U+025B0\parallelogramblackBlack Parallelogram
    U+025B1\parallelogramWhite Parallelogram
    U+025B2\bigblacktriangleupBlack Up-Pointing Triangle / Black Up Pointing Triangle
    U+025B3\bigtriangleupWhite Up-Pointing Triangle / White Up Pointing Triangle
    U+025B4\blacktriangleBlack Up-Pointing Small Triangle / Black Up Pointing Small Triangle
    U+025B5\vartriangleWhite Up-Pointing Small Triangle / White Up Pointing Small Triangle
    U+025B6\blacktriangleright, \:arrow_forward:Black Right-Pointing Triangle / Black Right Pointing Triangle
    U+025B7\trianglerightWhite Right-Pointing Triangle / White Right Pointing Triangle
    U+025B8\smallblacktrianglerightBlack Right-Pointing Small Triangle / Black Right Pointing Small Triangle
    U+025B9\smalltrianglerightWhite Right-Pointing Small Triangle / White Right Pointing Small Triangle
    U+025BA\blackpointerrightBlack Right-Pointing Pointer / Black Right Pointing Pointer
    U+025BB\whitepointerrightWhite Right-Pointing Pointer / White Right Pointing Pointer
    U+025BC\bigblacktriangledownBlack Down-Pointing Triangle / Black Down Pointing Triangle
    U+025BD\bigtriangledownWhite Down-Pointing Triangle / White Down Pointing Triangle
    U+025BE\blacktriangledownBlack Down-Pointing Small Triangle / Black Down Pointing Small Triangle
    U+025BF\triangledownWhite Down-Pointing Small Triangle / White Down Pointing Small Triangle
    U+025C0\blacktriangleleft, \:arrow_backward:Black Left-Pointing Triangle / Black Left Pointing Triangle
    U+025C1\triangleleftWhite Left-Pointing Triangle / White Left Pointing Triangle
    U+025C2\smallblacktriangleleftBlack Left-Pointing Small Triangle / Black Left Pointing Small Triangle
    U+025C3\smalltriangleleftWhite Left-Pointing Small Triangle / White Left Pointing Small Triangle
    U+025C4\blackpointerleftBlack Left-Pointing Pointer / Black Left Pointing Pointer
    U+025C5\whitepointerleftWhite Left-Pointing Pointer / White Left Pointing Pointer
    U+025C6\mdlgblkdiamondBlack Diamond
    U+025C7\mdlgwhtdiamondWhite Diamond
    U+025C8\blackinwhitediamondWhite Diamond Containing Black Small Diamond
    U+025C9\fisheyeFisheye
    U+025CA\lozengeLozenge
    U+025CB\bigcircWhite Circle
    U+025CC\dottedcircleDotted Circle
    U+025CD\circlevertfillCircle With Vertical Fill
    U+025CE\bullseyeBullseye
    U+025CF\mdlgblkcircleBlack Circle
    U+025D0\cirflCircle With Left Half Black
    U+025D1\cirfrCircle With Right Half Black
    U+025D2\cirfbCircle With Lower Half Black
    U+025D3\circletophalfblackCircle With Upper Half Black
    U+025D4\circleurquadblackCircle With Upper Right Quadrant Black
    U+025D5\blackcircleulquadwhiteCircle With All But Upper Left Quadrant Black
    U+025D6\blacklefthalfcircleLeft Half Black Circle
    U+025D7\blackrighthalfcircleRight Half Black Circle
    U+025D8\rvbullInverse Bullet
    U+025D9\inversewhitecircleInverse White Circle
    U+025DA\invwhiteupperhalfcircleUpper Half Inverse White Circle
    U+025DB\invwhitelowerhalfcircleLower Half Inverse White Circle
    U+025DC\ularcUpper Left Quadrant Circular Arc
    U+025DD\urarcUpper Right Quadrant Circular Arc
    U+025DE\lrarcLower Right Quadrant Circular Arc
    U+025DF\llarcLower Left Quadrant Circular Arc
    U+025E0\topsemicircleUpper Half Circle
    U+025E1\botsemicircleLower Half Circle
    U+025E2\lrblacktriangleBlack Lower Right Triangle
    U+025E3\llblacktriangleBlack Lower Left Triangle
    U+025E4\ulblacktriangleBlack Upper Left Triangle
    U+025E5\urblacktriangleBlack Upper Right Triangle
    U+025E6\smwhtcircleWhite Bullet
    U+025E7\sqflSquare With Left Half Black
    U+025E8\sqfrSquare With Right Half Black
    U+025E9\squareulblackSquare With Upper Left Diagonal Half Black
    U+025EA\sqfseSquare With Lower Right Diagonal Half Black
    U+025EB\boxbarWhite Square With Vertical Bisecting Line
    U+025EC\trianglecdotWhite Up-Pointing Triangle With Dot / White Up Pointing Triangle With Dot
    U+025ED\triangleleftblackUp-Pointing Triangle With Left Half Black / Up Pointing Triangle With Left Half Black
    U+025EE\trianglerightblackUp-Pointing Triangle With Right Half Black / Up Pointing Triangle With Right Half Black
    U+025EF\lgwhtcircleLarge Circle
    U+025F0\squareulquadWhite Square With Upper Left Quadrant
    U+025F1\squarellquadWhite Square With Lower Left Quadrant
    U+025F2\squarelrquadWhite Square With Lower Right Quadrant
    U+025F3\squareurquadWhite Square With Upper Right Quadrant
    U+025F4\circleulquadWhite Circle With Upper Left Quadrant
    U+025F5\circlellquadWhite Circle With Lower Left Quadrant
    U+025F6\circlelrquadWhite Circle With Lower Right Quadrant
    U+025F7\circleurquadWhite Circle With Upper Right Quadrant
    U+025F8\ultriangleUpper Left Triangle
    U+025F9\urtriangleUpper Right Triangle
    U+025FA\lltriangleLower Left Triangle
    U+025FB\mdwhtsquare, \:white_medium_square:White Medium Square
    U+025FC\mdblksquare, \:black_medium_square:Black Medium Square
    U+025FD\mdsmwhtsquare, \:white_medium_small_square:White Medium Small Square
    U+025FE\mdsmblksquare, \:black_medium_small_square:Black Medium Small Square
    U+025FF\lrtriangleLower Right Triangle
    U+02600\:sunny:Black Sun With Rays
    U+02601\:cloud:Cloud
    U+02605\bigstarBlack Star
    U+02606\bigwhitestarWhite Star
    U+02609\astrosunSun
    U+0260E\:phone:Black Telephone
    U+02611\:ballot_box_with_check:Ballot Box With Check
    U+02614\:umbrella_with_rain_drops:, \:umbrella:Umbrella With Rain Drops
    U+02615\:coffee:Hot Beverage
    U+0261D\:point_up:White Up Pointing Index
    U+02621\dangerCaution Sign
    U+0263A\:relaxed:White Smiling Face
    U+0263B\blacksmileyBlack Smiling Face
    U+0263C\sunWhite Sun With Rays
    U+0263D\rightmoonFirst Quarter Moon
    U+0263E\leftmoonLast Quarter Moon
    U+0263F\mercuryMercury
    U+02640\venus, \femaleFemale Sign
    U+02642\male, \marsMale Sign
    U+02643\jupiterJupiter
    U+02644\saturnSaturn
    U+02645\uranusUranus
    U+02646\neptuneNeptune
    U+02647\plutoPluto
    U+02648\aries, \:aries:Aries
    U+02649\taurus, \:taurus:Taurus
    U+0264A\gemini, \:gemini:Gemini
    U+0264B\cancer, \:cancer:Cancer
    U+0264C\leo, \:leo:Leo
    U+0264D\virgo, \:virgo:Virgo
    U+0264E\libra, \:libra:Libra
    U+0264F\scorpio, \:scorpius:Scorpius
    U+02650\sagittarius, \:sagittarius:Sagittarius
    U+02651\capricornus, \:capricorn:Capricorn
    U+02652\aquarius, \:aquarius:Aquarius
    U+02653\pisces, \:pisces:Pisces
    U+02660\spadesuit, \:spades:Black Spade Suit
    U+02661\heartsuitWhite Heart Suit
    U+02662\diamondsuitWhite Diamond Suit
    U+02663\clubsuit, \:clubs:Black Club Suit
    U+02664\varspadesuitWhite Spade Suit
    U+02665\varheartsuit, \:hearts:Black Heart Suit
    U+02666\vardiamondsuit, \:diamonds:Black Diamond Suit
    U+02667\varclubsuitWhite Club Suit
    U+02668\:hotsprings:Hot Springs
    U+02669\quarternoteQuarter Note
    U+0266A\eighthnoteEighth Note
    U+0266B\twonotesBeamed Eighth Notes / Barred Eighth Notes
    U+0266D\flatMusic Flat Sign / Flat
    U+0266E\naturalMusic Natural Sign / Natural
    U+0266F\sharpMusic Sharp Sign / Sharp
    U+0267B\:recycle:Black Universal Recycling Symbol
    U+0267E\acidfreePermanent Paper Sign
    U+0267F\:wheelchair:Wheelchair Symbol
    U+02680\diceiDie Face-1
    U+02681\diceiiDie Face-2
    U+02682\diceiiiDie Face-3
    U+02683\diceivDie Face-4
    U+02684\dicevDie Face-5
    U+02685\diceviDie Face-6
    U+02686\circledrightdotWhite Circle With Dot Right
    U+02687\circledtwodotsWhite Circle With Two Dots
    U+02688\blackcircledrightdotBlack Circle With White Dot Right
    U+02689\blackcircledtwodotsBlack Circle With Two White Dots
    U+02693\:anchor:Anchor
    U+026A0\:warning:Warning Sign
    U+026A1\:zap:High Voltage Sign
    U+026A5\hermaphroditeMale And Female Sign
    U+026AA\mdwhtcircle, \:white_circle:Medium White Circle
    U+026AB\mdblkcircle, \:black_circle:Medium Black Circle
    U+026AC\mdsmwhtcircleMedium Small White Circle
    U+026B2\neuterNeuter
    U+026BD\:soccer:Soccer Ball
    U+026BE\:baseball:Baseball
    U+026C4\:snowman:, \:snowman_without_snow:Snowman Without Snow
    U+026C5\:partly_sunny:Sun Behind Cloud
    U+026CE\:ophiuchus:Ophiuchus
    U+026D4\:no_entry:No Entry
    U+026EA\:church:Church
    U+026F2\:fountain:Fountain
    U+026F3\:golf:Flag In Hole
    U+026F5\:boat:Sailboat
    U+026FA\:tent:Tent
    U+026FD\:fuelpump:Fuel Pump
    U+02702\:scissors:Black Scissors
    U+02705\:white_check_mark:White Heavy Check Mark
    U+02708\:airplane:Airplane
    U+02709\:email:Envelope
    U+0270A\:fist:Raised Fist
    U+0270B\:hand:Raised Hand
    U+0270C\:v:Victory Hand
    U+0270F\:pencil2:Pencil
    U+02712\:black_nib:Black Nib
    U+02713\checkmarkCheck Mark
    U+02714\:heavy_check_mark:Heavy Check Mark
    U+02716\:heavy_multiplication_x:Heavy Multiplication X
    U+02720\malteseMaltese Cross
    U+02728\:sparkles:Sparkles
    U+0272A\circledstarCircled White Star
    U+02733\:eight_spoked_asterisk:Eight Spoked Asterisk
    U+02734\:eight_pointed_black_star:Eight Pointed Black Star
    U+02736\varstarSix Pointed Black Star
    U+0273D\dingasteriskHeavy Teardrop-Spoked Asterisk
    U+02744\:snowflake:Snowflake
    U+02747\:sparkle:Sparkle
    U+0274C\:x:Cross Mark
    U+0274E\:negative_squared_cross_mark:Negative Squared Cross Mark
    U+02753\:question:Black Question Mark Ornament
    U+02754\:grey_question:White Question Mark Ornament
    U+02755\:grey_exclamation:White Exclamation Mark Ornament
    U+02757\:exclamation:Heavy Exclamation Mark Symbol
    U+02764\:heart:Heavy Black Heart
    U+02795\:heavy_plus_sign:Heavy Plus Sign
    U+02796\:heavy_minus_sign:Heavy Minus Sign
    U+02797\:heavy_division_sign:Heavy Division Sign
    U+0279B\draftingarrowDrafting Point Rightwards Arrow / Drafting Point Right Arrow
    U+027A1\:arrow_right:Black Rightwards Arrow / Black Right Arrow
    U+027B0\:curly_loop:Curly Loop
    U+027BF\:loop:Double Curly Loop
    U+027C0\threedangleThree Dimensional Angle
    U+027C1\whiteinwhitetriangleWhite Triangle Containing Small White Triangle
    U+027C2\perpPerpendicular
    U+027C7\veedotOr With Dot Inside
    U+027C8\bsolhsubReverse Solidus Preceding Subset
    U+027C9\suphsolSuperset Preceding Solidus
    U+027D1\wedgedotAnd With Dot
    U+027D2\upinElement Of Opening Upwards
    U+027D5\leftouterjoinLeft Outer Join
    U+027D6\rightouterjoinRight Outer Join
    U+027D7\fullouterjoinFull Outer Join
    U+027D8\bigbotLarge Up Tack
    U+027D9\bigtopLarge Down Tack
    U+027E6\llbracket, \openbracketleftMathematical Left White Square Bracket
    U+027E7\openbracketright, \rrbracketMathematical Right White Square Bracket
    U+027E8\langleMathematical Left Angle Bracket
    U+027E9\rangleMathematical Right Angle Bracket
    U+027F0\UUparrowUpwards Quadruple Arrow
    U+027F1\DDownarrowDownwards Quadruple Arrow
    U+027F5\longleftarrowLong Leftwards Arrow
    U+027F6\longrightarrowLong Rightwards Arrow
    U+027F7\longleftrightarrowLong Left Right Arrow
    U+027F8\impliedby, \LongleftarrowLong Leftwards Double Arrow
    U+027F9\implies, \LongrightarrowLong Rightwards Double Arrow
    U+027FA\Longleftrightarrow, \iffLong Left Right Double Arrow
    U+027FB\longmapsfromLong Leftwards Arrow From Bar
    U+027FC\longmapstoLong Rightwards Arrow From Bar
    U+027FD\LongmapsfromLong Leftwards Double Arrow From Bar
    U+027FE\LongmapstoLong Rightwards Double Arrow From Bar
    U+027FF\longrightsquigarrowLong Rightwards Squiggle Arrow
    U+02900\nvtwoheadrightarrowRightwards Two-Headed Arrow With Vertical Stroke
    U+02901\nVtwoheadrightarrowRightwards Two-Headed Arrow With Double Vertical Stroke
    U+02902\nvLeftarrowLeftwards Double Arrow With Vertical Stroke
    U+02903\nvRightarrowRightwards Double Arrow With Vertical Stroke
    U+02904\nvLeftrightarrowLeft Right Double Arrow With Vertical Stroke
    U+02905\twoheadmapstoRightwards Two-Headed Arrow From Bar
    U+02906\MapsfromLeftwards Double Arrow From Bar
    U+02907\MapstoRightwards Double Arrow From Bar
    U+02908\downarrowbarredDownwards Arrow With Horizontal Stroke
    U+02909\uparrowbarredUpwards Arrow With Horizontal Stroke
    U+0290A\UuparrowUpwards Triple Arrow
    U+0290B\DdownarrowDownwards Triple Arrow
    U+0290C\leftbkarrowLeftwards Double Dash Arrow
    U+0290D\bkarowRightwards Double Dash Arrow
    U+0290E\leftdbkarrowLeftwards Triple Dash Arrow
    U+0290F\dbkarowRightwards Triple Dash Arrow
    U+02910\drbkarrowRightwards Two-Headed Triple Dash Arrow
    U+02911\rightdotarrowRightwards Arrow With Dotted Stem
    U+02912\UpArrowBarUpwards Arrow To Bar
    U+02913\DownArrowBarDownwards Arrow To Bar
    U+02914\nvrightarrowtailRightwards Arrow With Tail With Vertical Stroke
    U+02915\nVrightarrowtailRightwards Arrow With Tail With Double Vertical Stroke
    U+02916\twoheadrightarrowtailRightwards Two-Headed Arrow With Tail
    U+02917\nvtwoheadrightarrowtailRightwards Two-Headed Arrow With Tail With Vertical Stroke
    U+02918\nVtwoheadrightarrowtailRightwards Two-Headed Arrow With Tail With Double Vertical Stroke
    U+0291D\diamondleftarrowLeftwards Arrow To Black Diamond
    U+0291E\rightarrowdiamondRightwards Arrow To Black Diamond
    U+0291F\diamondleftarrowbarLeftwards Arrow From Bar To Black Diamond
    U+02920\barrightarrowdiamondRightwards Arrow From Bar To Black Diamond
    U+02925\hksearowSouth East Arrow With Hook
    U+02926\hkswarowSouth West Arrow With Hook
    U+02927\tonaNorth West Arrow And North East Arrow
    U+02928\toeaNorth East Arrow And South East Arrow
    U+02929\tosaSouth East Arrow And South West Arrow
    U+0292A\towaSouth West Arrow And North West Arrow
    U+0292B\rdiagovfdiagRising Diagonal Crossing Falling Diagonal
    U+0292C\fdiagovrdiagFalling Diagonal Crossing Rising Diagonal
    U+0292D\seovnearrowSouth East Arrow Crossing North East Arrow
    U+0292E\neovsearrowNorth East Arrow Crossing South East Arrow
    U+0292F\fdiagovnearrowFalling Diagonal Crossing North East Arrow
    U+02930\rdiagovsearrowRising Diagonal Crossing South East Arrow
    U+02931\neovnwarrowNorth East Arrow Crossing North West Arrow
    U+02932\nwovnearrowNorth West Arrow Crossing North East Arrow
    U+02934\:arrow_heading_up:Arrow Pointing Rightwards Then Curving Upwards
    U+02935\:arrow_heading_down:Arrow Pointing Rightwards Then Curving Downwards
    U+02942\RlarrRightwards Arrow Above Short Leftwards Arrow
    U+02944\rLarrShort Rightwards Arrow Above Leftwards Arrow
    U+02945\rightarrowplusRightwards Arrow With Plus Below
    U+02946\leftarrowplusLeftwards Arrow With Plus Below
    U+02947\rarrxRightwards Arrow Through X
    U+02948\leftrightarrowcircleLeft Right Arrow Through Small Circle
    U+02949\twoheaduparrowcircleUpwards Two-Headed Arrow From Small Circle
    U+0294A\leftrightharpoonupdownLeft Barb Up Right Barb Down Harpoon
    U+0294B\leftrightharpoondownupLeft Barb Down Right Barb Up Harpoon
    U+0294C\updownharpoonrightleftUp Barb Right Down Barb Left Harpoon
    U+0294D\updownharpoonleftrightUp Barb Left Down Barb Right Harpoon
    U+0294E\LeftRightVectorLeft Barb Up Right Barb Up Harpoon
    U+0294F\RightUpDownVectorUp Barb Right Down Barb Right Harpoon
    U+02950\DownLeftRightVectorLeft Barb Down Right Barb Down Harpoon
    U+02951\LeftUpDownVectorUp Barb Left Down Barb Left Harpoon
    U+02952\LeftVectorBarLeftwards Harpoon With Barb Up To Bar
    U+02953\RightVectorBarRightwards Harpoon With Barb Up To Bar
    U+02954\RightUpVectorBarUpwards Harpoon With Barb Right To Bar
    U+02955\RightDownVectorBarDownwards Harpoon With Barb Right To Bar
    U+02956\DownLeftVectorBarLeftwards Harpoon With Barb Down To Bar
    U+02957\DownRightVectorBarRightwards Harpoon With Barb Down To Bar
    U+02958\LeftUpVectorBarUpwards Harpoon With Barb Left To Bar
    U+02959\LeftDownVectorBarDownwards Harpoon With Barb Left To Bar
    U+0295A\LeftTeeVectorLeftwards Harpoon With Barb Up From Bar
    U+0295B\RightTeeVectorRightwards Harpoon With Barb Up From Bar
    U+0295C\RightUpTeeVectorUpwards Harpoon With Barb Right From Bar
    U+0295D\RightDownTeeVectorDownwards Harpoon With Barb Right From Bar
    U+0295E\DownLeftTeeVectorLeftwards Harpoon With Barb Down From Bar
    U+0295F\DownRightTeeVectorRightwards Harpoon With Barb Down From Bar
    U+02960\LeftUpTeeVectorUpwards Harpoon With Barb Left From Bar
    U+02961\LeftDownTeeVectorDownwards Harpoon With Barb Left From Bar
    U+02962\leftharpoonsupdownLeftwards Harpoon With Barb Up Above Leftwards Harpoon With Barb Down
    U+02963\upharpoonsleftrightUpwards Harpoon With Barb Left Beside Upwards Harpoon With Barb Right
    U+02964\rightharpoonsupdownRightwards Harpoon With Barb Up Above Rightwards Harpoon With Barb Down
    U+02965\downharpoonsleftrightDownwards Harpoon With Barb Left Beside Downwards Harpoon With Barb Right
    U+02966\leftrightharpoonsupLeftwards Harpoon With Barb Up Above Rightwards Harpoon With Barb Up
    U+02967\leftrightharpoonsdownLeftwards Harpoon With Barb Down Above Rightwards Harpoon With Barb Down
    U+02968\rightleftharpoonsupRightwards Harpoon With Barb Up Above Leftwards Harpoon With Barb Up
    U+02969\rightleftharpoonsdownRightwards Harpoon With Barb Down Above Leftwards Harpoon With Barb Down
    U+0296A\leftharpoonupdashLeftwards Harpoon With Barb Up Above Long Dash
    U+0296B\dashleftharpoondownLeftwards Harpoon With Barb Down Below Long Dash
    U+0296C\rightharpoonupdashRightwards Harpoon With Barb Up Above Long Dash
    U+0296D\dashrightharpoondownRightwards Harpoon With Barb Down Below Long Dash
    U+0296E\UpEquilibriumUpwards Harpoon With Barb Left Beside Downwards Harpoon With Barb Right
    U+0296F\ReverseUpEquilibriumDownwards Harpoon With Barb Left Beside Upwards Harpoon With Barb Right
    U+02970\RoundImpliesRight Double Arrow With Rounded Head
    U+02977\leftarrowlessLeftwards Arrow Through Less-Than
    U+0297A\leftarrowsubsetLeftwards Arrow Through Subset
    U+02980\VvertTriple Vertical Bar Delimiter
    U+02986\ElroangRight White Parenthesis
    U+02999\ddfncDotted Fence
    U+0299B\measuredangleleftMeasured Angle Opening Left
    U+0299C\AngleRight Angle Variant With Square
    U+0299D\rightanglemdotMeasured Right Angle With Dot
    U+0299E\anglesAngle With S Inside
    U+0299F\angdnrAcute Angle
    U+029A0\lpargtSpherical Angle Opening Left
    U+029A1\sphericalangleupSpherical Angle Opening Up
    U+029A2\turnangleTurned Angle
    U+029A3\revangleReversed Angle
    U+029A4\angleubarAngle With Underbar
    U+029A5\revangleubarReversed Angle With Underbar
    U+029A6\wideangledownOblique Angle Opening Up
    U+029A7\wideangleupOblique Angle Opening Down
    U+029A8\measanglerutoneMeasured Angle With Open Arm Ending In Arrow Pointing Up And Right
    U+029A9\measanglelutonwMeasured Angle With Open Arm Ending In Arrow Pointing Up And Left
    U+029AA\measanglerdtoseMeasured Angle With Open Arm Ending In Arrow Pointing Down And Right
    U+029AB\measangleldtoswMeasured Angle With Open Arm Ending In Arrow Pointing Down And Left
    U+029AC\measangleurtoneMeasured Angle With Open Arm Ending In Arrow Pointing Right And Up
    U+029AD\measangleultonwMeasured Angle With Open Arm Ending In Arrow Pointing Left And Up
    U+029AE\measangledrtoseMeasured Angle With Open Arm Ending In Arrow Pointing Right And Down
    U+029AF\measangledltoswMeasured Angle With Open Arm Ending In Arrow Pointing Left And Down
    U+029B0\revemptysetReversed Empty Set
    U+029B1\emptysetobarEmpty Set With Overbar
    U+029B2\emptysetocircEmpty Set With Small Circle Above
    U+029B3\emptysetoarrEmpty Set With Right Arrow Above
    U+029B4\emptysetoarrlEmpty Set With Left Arrow Above
    U+029B7\circledparallelCircled Parallel
    U+029B8\obslashCircled Reverse Solidus
    U+029BC\odotslashdotCircled Anticlockwise-Rotated Division Sign
    U+029BE\circledwhitebulletCircled White Bullet
    U+029BF⦿\circledbulletCircled Bullet
    U+029C0\olessthanCircled Less-Than
    U+029C1\ogreaterthanCircled Greater-Than
    U+029C4\boxdiagSquared Rising Diagonal Slash
    U+029C5\boxbslashSquared Falling Diagonal Slash
    U+029C6\boxastSquared Asterisk
    U+029C7\boxcircleSquared Small Circle
    U+029CA\LapTriangle With Dot Above
    U+029CB\defasTriangle With Underbar
    U+029CF\LeftTriangleBarLeft Triangle Beside Vertical Bar
    U+029CF + U+00338⧏̸\NotLeftTriangleBarLeft Triangle Beside Vertical Bar + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+029D0\RightTriangleBarVertical Bar Beside Right Triangle
    U+029D0 + U+00338⧐̸\NotRightTriangleBarVertical Bar Beside Right Triangle + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+029DF\dualmapDouble-Ended Multimap
    U+029E1\lrtriangleeqIncreases As
    U+029E2\shuffleShuffle Product
    U+029E3\eparslEquals Sign And Slanted Parallel
    U+029E4\smeparslEquals Sign And Slanted Parallel With Tilde Above
    U+029E5\eqvparslIdentical To And Slanted Parallel
    U+029EB\blacklozengeBlack Lozenge
    U+029F4\RuleDelayedRule-Delayed
    U+029F6\dsolSolidus With Overbar
    U+029F7\rsolbarReverse Solidus With Horizontal Stroke
    U+029FA\doubleplusDouble Plus
    U+029FB\tripleplusTriple Plus
    U+02A00\bigodotN-Ary Circled Dot Operator
    U+02A01\bigoplusN-Ary Circled Plus Operator
    U+02A02\bigotimesN-Ary Circled Times Operator
    U+02A03\bigcupdotN-Ary Union Operator With Dot
    U+02A04\biguplusN-Ary Union Operator With Plus
    U+02A05\bigsqcapN-Ary Square Intersection Operator
    U+02A06\bigsqcupN-Ary Square Union Operator
    U+02A07\conjquantTwo Logical And Operator
    U+02A08\disjquantTwo Logical Or Operator
    U+02A09\bigtimesN-Ary Times Operator
    U+02A0A\modtwosumModulo Two Sum
    U+02A0B\sumintSummation With Integral
    U+02A0C\iiiintQuadruple Integral Operator
    U+02A0D\intbarFinite Part Integral
    U+02A0E\intBarIntegral With Double Stroke
    U+02A0F\clockointIntegral Average With Slash
    U+02A10\cirfnintCirculation Function
    U+02A11\awintAnticlockwise Integration
    U+02A12\rppolintLine Integration With Rectangular Path Around Pole
    U+02A13\scpolintLine Integration With Semicircular Path Around Pole
    U+02A14\npolintLine Integration Not Including The Pole
    U+02A15\pointintIntegral Around A Point Operator
    U+02A16\sqrintQuaternion Integral Operator
    U+02A18\intxIntegral With Times Sign
    U+02A19\intcapIntegral With Intersection
    U+02A1A\intcupIntegral With Union
    U+02A1B\upintIntegral With Overbar
    U+02A1C\lowintIntegral With Underbar
    U+02A1D\joinJoin
    U+02A1F\bbsemiZ Notation Schema Composition
    U+02A22\ringplusPlus Sign With Small Circle Above
    U+02A23\plushatPlus Sign With Circumflex Accent Above
    U+02A24\simplusPlus Sign With Tilde Above
    U+02A25\plusdotPlus Sign With Dot Below
    U+02A26\plussimPlus Sign With Tilde Below
    U+02A27\plussubtwoPlus Sign With Subscript Two
    U+02A28\plustrifPlus Sign With Black Triangle
    U+02A29\commaminusMinus Sign With Comma Above
    U+02A2A\minusdotMinus Sign With Dot Below
    U+02A2B\minusfdotsMinus Sign With Falling Dots
    U+02A2C\minusrdotsMinus Sign With Rising Dots
    U+02A2D\opluslhrimPlus Sign In Left Half Circle
    U+02A2E\oplusrhrimPlus Sign In Right Half Circle
    U+02A2F\TimesVector Or Cross Product
    U+02A30\dottimesMultiplication Sign With Dot Above
    U+02A31\timesbarMultiplication Sign With Underbar
    U+02A32\btimesSemidirect Product With Bottom Closed
    U+02A33\smashtimesSmash Product
    U+02A34\otimeslhrimMultiplication Sign In Left Half Circle
    U+02A35\otimesrhrimMultiplication Sign In Right Half Circle
    U+02A36\otimeshatCircled Multiplication Sign With Circumflex Accent
    U+02A37\OtimesMultiplication Sign In Double Circle
    U+02A38\odivCircled Division Sign
    U+02A39\triangleplusPlus Sign In Triangle
    U+02A3A\triangleminusMinus Sign In Triangle
    U+02A3B\triangletimesMultiplication Sign In Triangle
    U+02A3C\intprodInterior Product
    U+02A3D\intprodrRighthand Interior Product
    U+02A3F⨿\amalgAmalgamation Or Coproduct
    U+02A40\capdotIntersection With Dot
    U+02A41\uminusUnion With Minus Sign
    U+02A42\barcupUnion With Overbar
    U+02A43\barcapIntersection With Overbar
    U+02A44\capwedgeIntersection With Logical And
    U+02A45\cupveeUnion With Logical Or
    U+02A4A\twocupsUnion Beside And Joined With Union
    U+02A4B\twocapsIntersection Beside And Joined With Intersection
    U+02A4C\closedvarcupClosed Union With Serifs
    U+02A4D\closedvarcapClosed Intersection With Serifs
    U+02A4E\SqcapDouble Square Intersection
    U+02A4F\SqcupDouble Square Union
    U+02A50\closedvarcupsmashprodClosed Union With Serifs And Smash Product
    U+02A51\wedgeodotLogical And With Dot Above
    U+02A52\veeodotLogical Or With Dot Above
    U+02A53\AndDouble Logical And
    U+02A54\OrDouble Logical Or
    U+02A55\wedgeonwedgeTwo Intersecting Logical And
    U+02A56\ElOrTwo Intersecting Logical Or
    U+02A57\bigslopedveeSloping Large Or
    U+02A58\bigslopedwedgeSloping Large And
    U+02A5A\wedgemidvertLogical And With Middle Stem
    U+02A5B\veemidvertLogical Or With Middle Stem
    U+02A5C\midbarwedgeLogical And With Horizontal Dash
    U+02A5D\midbarveeLogical Or With Horizontal Dash
    U+02A5E\perspcorrespondLogical And With Double Overbar
    U+02A5F\minhatLogical And With Underbar
    U+02A60\wedgedoublebarLogical And With Double Underbar
    U+02A61\varveebarSmall Vee With Underbar
    U+02A62\doublebarveeLogical Or With Double Overbar
    U+02A63\veedoublebarLogical Or With Double Underbar
    U+02A66\eqdotEquals Sign With Dot Below
    U+02A67\dotequivIdentical With Dot Above
    U+02A6A\dotsimTilde Operator With Dot Above
    U+02A6B\simrdotsTilde Operator With Rising Dots
    U+02A6C\simminussimSimilar Minus Similar
    U+02A6D\congdotCongruent With Dot Above
    U+02A6E\asteqEquals With Asterisk
    U+02A6F\hatapproxAlmost Equal To With Circumflex Accent
    U+02A70\approxeqqApproximately Equal Or Equal To
    U+02A71\eqqplusEquals Sign Above Plus Sign
    U+02A72\pluseqqPlus Sign Above Equals Sign
    U+02A73\eqqsimEquals Sign Above Tilde Operator
    U+02A74\ColoneqDouble Colon Equal
    U+02A75\EqualTwo Consecutive Equals Signs
    U+02A76\eqeqeqThree Consecutive Equals Signs
    U+02A77\ddotseqEquals Sign With Two Dots Above And Two Dots Below
    U+02A78\equivDDEquivalent With Four Dots Above
    U+02A79\ltcirLess-Than With Circle Inside
    U+02A7A\gtcirGreater-Than With Circle Inside
    U+02A7B\ltquestLess-Than With Question Mark Above
    U+02A7C\gtquestGreater-Than With Question Mark Above
    U+02A7D\leqslantLess-Than Or Slanted Equal To
    U+02A7D + U+00338⩽̸\nleqslantLess-Than Or Slanted Equal To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02A7E\geqslantGreater-Than Or Slanted Equal To
    U+02A7E + U+00338⩾̸\ngeqslantGreater-Than Or Slanted Equal To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02A7F⩿\lesdotLess-Than Or Slanted Equal To With Dot Inside
    U+02A80\gesdotGreater-Than Or Slanted Equal To With Dot Inside
    U+02A81\lesdotoLess-Than Or Slanted Equal To With Dot Above
    U+02A82\gesdotoGreater-Than Or Slanted Equal To With Dot Above
    U+02A83\lesdotorLess-Than Or Slanted Equal To With Dot Above Right
    U+02A84\gesdotolGreater-Than Or Slanted Equal To With Dot Above Left
    U+02A85\lessapproxLess-Than Or Approximate
    U+02A86\gtrapproxGreater-Than Or Approximate
    U+02A87\lneqLess-Than And Single-Line Not Equal To
    U+02A88\gneqGreater-Than And Single-Line Not Equal To
    U+02A89\lnapproxLess-Than And Not Approximate
    U+02A8A\gnapproxGreater-Than And Not Approximate
    U+02A8B\lesseqqgtrLess-Than Above Double-Line Equal Above Greater-Than
    U+02A8C\gtreqqlessGreater-Than Above Double-Line Equal Above Less-Than
    U+02A8D\lsimeLess-Than Above Similar Or Equal
    U+02A8E\gsimeGreater-Than Above Similar Or Equal
    U+02A8F\lsimgLess-Than Above Similar Above Greater-Than
    U+02A90\gsimlGreater-Than Above Similar Above Less-Than
    U+02A91\lgELess-Than Above Greater-Than Above Double-Line Equal
    U+02A92\glEGreater-Than Above Less-Than Above Double-Line Equal
    U+02A93\lesgesLess-Than Above Slanted Equal Above Greater-Than Above Slanted Equal
    U+02A94\geslesGreater-Than Above Slanted Equal Above Less-Than Above Slanted Equal
    U+02A95\eqslantlessSlanted Equal To Or Less-Than
    U+02A96\eqslantgtrSlanted Equal To Or Greater-Than
    U+02A97\elsdotSlanted Equal To Or Less-Than With Dot Inside
    U+02A98\egsdotSlanted Equal To Or Greater-Than With Dot Inside
    U+02A99\eqqlessDouble-Line Equal To Or Less-Than
    U+02A9A\eqqgtrDouble-Line Equal To Or Greater-Than
    U+02A9B\eqqslantlessDouble-Line Slanted Equal To Or Less-Than
    U+02A9C\eqqslantgtrDouble-Line Slanted Equal To Or Greater-Than
    U+02A9D\simlessSimilar Or Less-Than
    U+02A9E\simgtrSimilar Or Greater-Than
    U+02A9F\simlESimilar Above Less-Than Above Equals Sign
    U+02AA0\simgESimilar Above Greater-Than Above Equals Sign
    U+02AA1\NestedLessLessDouble Nested Less-Than
    U+02AA1 + U+00338⪡̸\NotNestedLessLessDouble Nested Less-Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AA2\NestedGreaterGreaterDouble Nested Greater-Than
    U+02AA2 + U+00338⪢̸\NotNestedGreaterGreaterDouble Nested Greater-Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AA3\partialmeetcontractionDouble Nested Less-Than With Underbar
    U+02AA4\gljGreater-Than Overlapping Less-Than
    U+02AA5\glaGreater-Than Beside Less-Than
    U+02AA6\ltccLess-Than Closed By Curve
    U+02AA7\gtccGreater-Than Closed By Curve
    U+02AA8\lesccLess-Than Closed By Curve Above Slanted Equal
    U+02AA9\gesccGreater-Than Closed By Curve Above Slanted Equal
    U+02AAA\smtSmaller Than
    U+02AAB\latLarger Than
    U+02AAC\smteSmaller Than Or Equal To
    U+02AAD\lateLarger Than Or Equal To
    U+02AAE\bumpeqqEquals Sign With Bumpy Above
    U+02AAF\preceqPrecedes Above Single-Line Equals Sign
    U+02AAF + U+00338⪯̸\npreceqPrecedes Above Single-Line Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AB0\succeqSucceeds Above Single-Line Equals Sign
    U+02AB0 + U+00338⪰̸\nsucceqSucceeds Above Single-Line Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AB1\precneqPrecedes Above Single-Line Not Equal To
    U+02AB2\succneqSucceeds Above Single-Line Not Equal To
    U+02AB3\preceqqPrecedes Above Equals Sign
    U+02AB4\succeqqSucceeds Above Equals Sign
    U+02AB5\precneqqPrecedes Above Not Equal To
    U+02AB6\succneqqSucceeds Above Not Equal To
    U+02AB7\precapproxPrecedes Above Almost Equal To
    U+02AB8\succapproxSucceeds Above Almost Equal To
    U+02AB9\precnapproxPrecedes Above Not Almost Equal To
    U+02ABA\succnapproxSucceeds Above Not Almost Equal To
    U+02ABB\PrecDouble Precedes
    U+02ABC\SuccDouble Succeeds
    U+02ABD\subsetdotSubset With Dot
    U+02ABE\supsetdotSuperset With Dot
    U+02ABF⪿\subsetplusSubset With Plus Sign Below
    U+02AC0\supsetplusSuperset With Plus Sign Below
    U+02AC1\submultSubset With Multiplication Sign Below
    U+02AC2\supmultSuperset With Multiplication Sign Below
    U+02AC3\subedotSubset Of Or Equal To With Dot Above
    U+02AC4\supedotSuperset Of Or Equal To With Dot Above
    U+02AC5\subseteqqSubset Of Above Equals Sign
    U+02AC5 + U+00338⫅̸\nsubseteqqSubset Of Above Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AC6\supseteqqSuperset Of Above Equals Sign
    U+02AC6 + U+00338⫆̸\nsupseteqqSuperset Of Above Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AC7\subsimSubset Of Above Tilde Operator
    U+02AC8\supsimSuperset Of Above Tilde Operator
    U+02AC9\subsetapproxSubset Of Above Almost Equal To
    U+02ACA\supsetapproxSuperset Of Above Almost Equal To
    U+02ACB\subsetneqqSubset Of Above Not Equal To
    U+02ACC\supsetneqqSuperset Of Above Not Equal To
    U+02ACD\lsqhookSquare Left Open Box Operator
    U+02ACE\rsqhookSquare Right Open Box Operator
    U+02ACF\csubClosed Subset
    U+02AD0\csupClosed Superset
    U+02AD1\csubeClosed Subset Or Equal To
    U+02AD2\csupeClosed Superset Or Equal To
    U+02AD3\subsupSubset Above Superset
    U+02AD4\supsubSuperset Above Subset
    U+02AD5\subsubSubset Above Subset
    U+02AD6\supsupSuperset Above Superset
    U+02AD7\suphsubSuperset Beside Subset
    U+02AD8\supdsubSuperset Beside And Joined By Dash With Subset
    U+02AD9\forkvElement Of Opening Downwards
    U+02ADB\mlcpTransversal Intersection
    U+02ADC\forksForking
    U+02ADD\forksnotNonforking
    U+02AE3\dashVDouble Vertical Bar Left Turnstile
    U+02AE4\DashvVertical Bar Double Left Turnstile
    U+02AEA\Top, \downvDashDouble Down Tack
    U+02AEB\upvDash, \Bot, \indepDouble Up Tack
    U+02AF4\interleaveTriple Vertical Bar Binary Relation
    U+02AF6\tdcolTriple Colon Operator
    U+02AF7\lllnestTriple Nested Less-Than
    U+02AF8\gggnestTriple Nested Greater-Than
    U+02AF9\leqqslantDouble-Line Slanted Less-Than Or Equal To
    U+02AFA\geqqslantDouble-Line Slanted Greater-Than Or Equal To
    U+02B05\:arrow_left:Leftwards Black Arrow
    U+02B06\:arrow_up:Upwards Black Arrow
    U+02B07\:arrow_down:Downwards Black Arrow
    U+02B12\squaretopblackSquare With Top Half Black
    U+02B13\squarebotblackSquare With Bottom Half Black
    U+02B14\squareurblackSquare With Upper Right Diagonal Half Black
    U+02B15\squarellblackSquare With Lower Left Diagonal Half Black
    U+02B16\diamondleftblackDiamond With Left Half Black
    U+02B17\diamondrightblackDiamond With Right Half Black
    U+02B18\diamondtopblackDiamond With Top Half Black
    U+02B19\diamondbotblackDiamond With Bottom Half Black
    U+02B1A\dottedsquareDotted Square
    U+02B1B\lgblksquare, \:black_large_square:Black Large Square
    U+02B1C\lgwhtsquare, \:white_large_square:White Large Square
    U+02B1D\vysmblksquareBlack Very Small Square
    U+02B1E\vysmwhtsquareWhite Very Small Square
    U+02B1F\pentagonblackBlack Pentagon
    U+02B20\pentagonWhite Pentagon
    U+02B21\varhexagonWhite Hexagon
    U+02B22\varhexagonblackBlack Hexagon
    U+02B23\hexagonblackHorizontal Black Hexagon
    U+02B24\lgblkcircleBlack Large Circle
    U+02B25\mdblkdiamondBlack Medium Diamond
    U+02B26\mdwhtdiamondWhite Medium Diamond
    U+02B27\mdblklozengeBlack Medium Lozenge
    U+02B28\mdwhtlozengeWhite Medium Lozenge
    U+02B29\smblkdiamondBlack Small Diamond
    U+02B2A\smblklozengeBlack Small Lozenge
    U+02B2B\smwhtlozengeWhite Small Lozenge
    U+02B2C\blkhorzovalBlack Horizontal Ellipse
    U+02B2D\whthorzovalWhite Horizontal Ellipse
    U+02B2E\blkvertovalBlack Vertical Ellipse
    U+02B2F\whtvertovalWhite Vertical Ellipse
    U+02B30\circleonleftarrowLeft Arrow With Small Circle
    U+02B31\leftthreearrowsThree Leftwards Arrows
    U+02B32\leftarrowonoplusLeft Arrow With Circled Plus
    U+02B33\longleftsquigarrowLong Leftwards Squiggle Arrow
    U+02B34\nvtwoheadleftarrowLeftwards Two-Headed Arrow With Vertical Stroke
    U+02B35\nVtwoheadleftarrowLeftwards Two-Headed Arrow With Double Vertical Stroke
    U+02B36\twoheadmapsfromLeftwards Two-Headed Arrow From Bar
    U+02B37\twoheadleftdbkarrowLeftwards Two-Headed Triple Dash Arrow
    U+02B38\leftdotarrowLeftwards Arrow With Dotted Stem
    U+02B39\nvleftarrowtailLeftwards Arrow With Tail With Vertical Stroke
    U+02B3A\nVleftarrowtailLeftwards Arrow With Tail With Double Vertical Stroke
    U+02B3B\twoheadleftarrowtailLeftwards Two-Headed Arrow With Tail
    U+02B3C\nvtwoheadleftarrowtailLeftwards Two-Headed Arrow With Tail With Vertical Stroke
    U+02B3D\nVtwoheadleftarrowtailLeftwards Two-Headed Arrow With Tail With Double Vertical Stroke
    U+02B3E\leftarrowxLeftwards Arrow Through X
    U+02B3F⬿\leftcurvedarrowWave Arrow Pointing Directly Left
    U+02B40\equalleftarrowEquals Sign Above Leftwards Arrow
    U+02B41\bsimilarleftarrowReverse Tilde Operator Above Leftwards Arrow
    U+02B42\leftarrowbackapproxLeftwards Arrow Above Reverse Almost Equal To
    U+02B43\rightarrowgtrRightwards Arrow Through Greater-Than
    U+02B44\rightarrowsupsetRightwards Arrow Through Superset
    U+02B45\LLeftarrowLeftwards Quadruple Arrow
    U+02B46\RRightarrowRightwards Quadruple Arrow
    U+02B47\bsimilarrightarrowReverse Tilde Operator Above Rightwards Arrow
    U+02B48\rightarrowbackapproxRightwards Arrow Above Reverse Almost Equal To
    U+02B49\similarleftarrowTilde Operator Above Leftwards Arrow
    U+02B4A\leftarrowapproxLeftwards Arrow Above Almost Equal To
    U+02B4B\leftarrowbsimilarLeftwards Arrow Above Reverse Tilde Operator
    U+02B4C\rightarrowbsimilarRightwards Arrow Above Reverse Tilde Operator
    U+02B50\medwhitestar, \:star:White Medium Star
    U+02B51\medblackstarBlack Small Star
    U+02B52\smwhitestarWhite Small Star
    U+02B53\rightpentagonblackBlack Right-Pointing Pentagon
    U+02B54\rightpentagonWhite Right-Pointing Pentagon
    U+02B55\:o:Heavy Large Circle
    U+02C7C\_jLatin Subscript Small Letter J
    U+02C7D\^VModifier Letter Capital V
    U+03012\postalmarkPostal Mark
    U+03030\:wavy_dash:Wavy Dash
    U+0303D\:part_alternation_mark:Part Alternation Mark
    U+03297\:congratulations:Circled Ideograph Congratulation
    U+03299\:secret:Circled Ideograph Secret
    U+0A71B\^uparrowModifier Letter Raised Up Arrow
    U+0A71C\^downarrowModifier Letter Raised Down Arrow
    U+0A71D\^!Modifier Letter Raised Exclamation Mark
    U+1D106𝄆\leftrepeatsignMusical Symbol Left Repeat Sign
    U+1D107𝄇\rightrepeatsignMusical Symbol Right Repeat Sign
    U+1D109𝄉\dalsegnoMusical Symbol Dal Segno
    U+1D10A𝄊\dacapoMusical Symbol Da Capo
    U+1D10B𝄋\segnoMusical Symbol Segno
    U+1D10C𝄌\codaMusical Symbol Coda
    U+1D11E𝄞\clefgMusical Symbol G Clef
    U+1D11F𝄟\clefg8vaMusical Symbol G Clef Ottava Alta
    U+1D120𝄠\clefg8vbMusical Symbol G Clef Ottava Bassa
    U+1D121𝄡\clefcMusical Symbol C Clef
    U+1D122𝄢\cleffMusical Symbol F Clef
    U+1D123𝄣\cleff8vaMusical Symbol F Clef Ottava Alta
    U+1D124𝄤\cleff8vbMusical Symbol F Clef Ottava Bassa
    U+1D12A𝄪\sharpsharpMusical Symbol Double Sharp
    U+1D12B𝄫\flatflatMusical Symbol Double Flat
    U+1D13A𝄺\restmultiMusical Symbol Multi Rest
    U+1D13B𝄻\restwholeMusical Symbol Whole Rest
    U+1D13C𝄼\resthalfMusical Symbol Half Rest
    U+1D13D𝄽\restquarterMusical Symbol Quarter Rest
    U+1D13E𝄾\rest8thMusical Symbol Eighth Rest
    U+1D13F𝄿\rest16thMusical Symbol Sixteenth Rest
    U+1D140𝅀\rest32thMusical Symbol Thirty-Second Rest
    U+1D141𝅁\rest64thMusical Symbol Sixty-Fourth Rest
    U+1D142𝅂\rest128thMusical Symbol One Hundred Twenty-Eighth Rest
    U+1D15C𝅜\notedoublewholeMusical Symbol Breve
    U+1D15D𝅝\notewholeMusical Symbol Whole Note
    U+1D15E𝅗𝅥\notehalfMusical Symbol Half Note
    U+1D15F𝅘𝅥\notequarterMusical Symbol Quarter Note
    U+1D160𝅘𝅥𝅮\note8thMusical Symbol Eighth Note
    U+1D161𝅘𝅥𝅯\note16thMusical Symbol Sixteenth Note
    U+1D162𝅘𝅥𝅰\note32thMusical Symbol Thirty-Second Note
    U+1D163𝅘𝅥𝅱\note64thMusical Symbol Sixty-Fourth Note
    U+1D164𝅘𝅥𝅲\note128thMusical Symbol One Hundred Twenty-Eighth Note
    U+1D400𝐀\bfAMathematical Bold Capital A
    U+1D401𝐁\bfBMathematical Bold Capital B
    U+1D402𝐂\bfCMathematical Bold Capital C
    U+1D403𝐃\bfDMathematical Bold Capital D
    U+1D404𝐄\bfEMathematical Bold Capital E
    U+1D405𝐅\bfFMathematical Bold Capital F
    U+1D406𝐆\bfGMathematical Bold Capital G
    U+1D407𝐇\bfHMathematical Bold Capital H
    U+1D408𝐈\bfIMathematical Bold Capital I
    U+1D409𝐉\bfJMathematical Bold Capital J
    U+1D40A𝐊\bfKMathematical Bold Capital K
    U+1D40B𝐋\bfLMathematical Bold Capital L
    U+1D40C𝐌\bfMMathematical Bold Capital M
    U+1D40D𝐍\bfNMathematical Bold Capital N
    U+1D40E𝐎\bfOMathematical Bold Capital O
    U+1D40F𝐏\bfPMathematical Bold Capital P
    U+1D410𝐐\bfQMathematical Bold Capital Q
    U+1D411𝐑\bfRMathematical Bold Capital R
    U+1D412𝐒\bfSMathematical Bold Capital S
    U+1D413𝐓\bfTMathematical Bold Capital T
    U+1D414𝐔\bfUMathematical Bold Capital U
    U+1D415𝐕\bfVMathematical Bold Capital V
    U+1D416𝐖\bfWMathematical Bold Capital W
    U+1D417𝐗\bfXMathematical Bold Capital X
    U+1D418𝐘\bfYMathematical Bold Capital Y
    U+1D419𝐙\bfZMathematical Bold Capital Z
    U+1D41A𝐚\bfaMathematical Bold Small A
    U+1D41B𝐛\bfbMathematical Bold Small B
    U+1D41C𝐜\bfcMathematical Bold Small C
    U+1D41D𝐝\bfdMathematical Bold Small D
    U+1D41E𝐞\bfeMathematical Bold Small E
    U+1D41F𝐟\bffMathematical Bold Small F
    U+1D420𝐠\bfgMathematical Bold Small G
    U+1D421𝐡\bfhMathematical Bold Small H
    U+1D422𝐢\bfiMathematical Bold Small I
    U+1D423𝐣\bfjMathematical Bold Small J
    U+1D424𝐤\bfkMathematical Bold Small K
    U+1D425𝐥\bflMathematical Bold Small L
    U+1D426𝐦\bfmMathematical Bold Small M
    U+1D427𝐧\bfnMathematical Bold Small N
    U+1D428𝐨\bfoMathematical Bold Small O
    U+1D429𝐩\bfpMathematical Bold Small P
    U+1D42A𝐪\bfqMathematical Bold Small Q
    U+1D42B𝐫\bfrMathematical Bold Small R
    U+1D42C𝐬\bfsMathematical Bold Small S
    U+1D42D𝐭\bftMathematical Bold Small T
    U+1D42E𝐮\bfuMathematical Bold Small U
    U+1D42F𝐯\bfvMathematical Bold Small V
    U+1D430𝐰\bfwMathematical Bold Small W
    U+1D431𝐱\bfxMathematical Bold Small X
    U+1D432𝐲\bfyMathematical Bold Small Y
    U+1D433𝐳\bfzMathematical Bold Small Z
    U+1D434𝐴\itAMathematical Italic Capital A
    U+1D435𝐵\itBMathematical Italic Capital B
    U+1D436𝐶\itCMathematical Italic Capital C
    U+1D437𝐷\itDMathematical Italic Capital D
    U+1D438𝐸\itEMathematical Italic Capital E
    U+1D439𝐹\itFMathematical Italic Capital F
    U+1D43A𝐺\itGMathematical Italic Capital G
    U+1D43B𝐻\itHMathematical Italic Capital H
    U+1D43C𝐼\itIMathematical Italic Capital I
    U+1D43D𝐽\itJMathematical Italic Capital J
    U+1D43E𝐾\itKMathematical Italic Capital K
    U+1D43F𝐿\itLMathematical Italic Capital L
    U+1D440𝑀\itMMathematical Italic Capital M
    U+1D441𝑁\itNMathematical Italic Capital N
    U+1D442𝑂\itOMathematical Italic Capital O
    U+1D443𝑃\itPMathematical Italic Capital P
    U+1D444𝑄\itQMathematical Italic Capital Q
    U+1D445𝑅\itRMathematical Italic Capital R
    U+1D446𝑆\itSMathematical Italic Capital S
    U+1D447𝑇\itTMathematical Italic Capital T
    U+1D448𝑈\itUMathematical Italic Capital U
    U+1D449𝑉\itVMathematical Italic Capital V
    U+1D44A𝑊\itWMathematical Italic Capital W
    U+1D44B𝑋\itXMathematical Italic Capital X
    U+1D44C𝑌\itYMathematical Italic Capital Y
    U+1D44D𝑍\itZMathematical Italic Capital Z
    U+1D44E𝑎\itaMathematical Italic Small A
    U+1D44F𝑏\itbMathematical Italic Small B
    U+1D450𝑐\itcMathematical Italic Small C
    U+1D451𝑑\itdMathematical Italic Small D
    U+1D452𝑒\iteMathematical Italic Small E
    U+1D453𝑓\itfMathematical Italic Small F
    U+1D454𝑔\itgMathematical Italic Small G
    U+1D456𝑖\itiMathematical Italic Small I
    U+1D457𝑗\itjMathematical Italic Small J
    U+1D458𝑘\itkMathematical Italic Small K
    U+1D459𝑙\itlMathematical Italic Small L
    U+1D45A𝑚\itmMathematical Italic Small M
    U+1D45B𝑛\itnMathematical Italic Small N
    U+1D45C𝑜\itoMathematical Italic Small O
    U+1D45D𝑝\itpMathematical Italic Small P
    U+1D45E𝑞\itqMathematical Italic Small Q
    U+1D45F𝑟\itrMathematical Italic Small R
    U+1D460𝑠\itsMathematical Italic Small S
    U+1D461𝑡\ittMathematical Italic Small T
    U+1D462𝑢\ituMathematical Italic Small U
    U+1D463𝑣\itvMathematical Italic Small V
    U+1D464𝑤\itwMathematical Italic Small W
    U+1D465𝑥\itxMathematical Italic Small X
    U+1D466𝑦\ityMathematical Italic Small Y
    U+1D467𝑧\itzMathematical Italic Small Z
    U+1D468𝑨\biAMathematical Bold Italic Capital A
    U+1D469𝑩\biBMathematical Bold Italic Capital B
    U+1D46A𝑪\biCMathematical Bold Italic Capital C
    U+1D46B𝑫\biDMathematical Bold Italic Capital D
    U+1D46C𝑬\biEMathematical Bold Italic Capital E
    U+1D46D𝑭\biFMathematical Bold Italic Capital F
    U+1D46E𝑮\biGMathematical Bold Italic Capital G
    U+1D46F𝑯\biHMathematical Bold Italic Capital H
    U+1D470𝑰\biIMathematical Bold Italic Capital I
    U+1D471𝑱\biJMathematical Bold Italic Capital J
    U+1D472𝑲\biKMathematical Bold Italic Capital K
    U+1D473𝑳\biLMathematical Bold Italic Capital L
    U+1D474𝑴\biMMathematical Bold Italic Capital M
    U+1D475𝑵\biNMathematical Bold Italic Capital N
    U+1D476𝑶\biOMathematical Bold Italic Capital O
    U+1D477𝑷\biPMathematical Bold Italic Capital P
    U+1D478𝑸\biQMathematical Bold Italic Capital Q
    U+1D479𝑹\biRMathematical Bold Italic Capital R
    U+1D47A𝑺\biSMathematical Bold Italic Capital S
    U+1D47B𝑻\biTMathematical Bold Italic Capital T
    U+1D47C𝑼\biUMathematical Bold Italic Capital U
    U+1D47D𝑽\biVMathematical Bold Italic Capital V
    U+1D47E𝑾\biWMathematical Bold Italic Capital W
    U+1D47F𝑿\biXMathematical Bold Italic Capital X
    U+1D480𝒀\biYMathematical Bold Italic Capital Y
    U+1D481𝒁\biZMathematical Bold Italic Capital Z
    U+1D482𝒂\biaMathematical Bold Italic Small A
    U+1D483𝒃\bibMathematical Bold Italic Small B
    U+1D484𝒄\bicMathematical Bold Italic Small C
    U+1D485𝒅\bidMathematical Bold Italic Small D
    U+1D486𝒆\bieMathematical Bold Italic Small E
    U+1D487𝒇\bifMathematical Bold Italic Small F
    U+1D488𝒈\bigMathematical Bold Italic Small G
    U+1D489𝒉\bihMathematical Bold Italic Small H
    U+1D48A𝒊\biiMathematical Bold Italic Small I
    U+1D48B𝒋\bijMathematical Bold Italic Small J
    U+1D48C𝒌\bikMathematical Bold Italic Small K
    U+1D48D𝒍\bilMathematical Bold Italic Small L
    U+1D48E𝒎\bimMathematical Bold Italic Small M
    U+1D48F𝒏\binMathematical Bold Italic Small N
    U+1D490𝒐\bioMathematical Bold Italic Small O
    U+1D491𝒑\bipMathematical Bold Italic Small P
    U+1D492𝒒\biqMathematical Bold Italic Small Q
    U+1D493𝒓\birMathematical Bold Italic Small R
    U+1D494𝒔\bisMathematical Bold Italic Small S
    U+1D495𝒕\bitMathematical Bold Italic Small T
    U+1D496𝒖\biuMathematical Bold Italic Small U
    U+1D497𝒗\bivMathematical Bold Italic Small V
    U+1D498𝒘\biwMathematical Bold Italic Small W
    U+1D499𝒙\bixMathematical Bold Italic Small X
    U+1D49A𝒚\biyMathematical Bold Italic Small Y
    U+1D49B𝒛\bizMathematical Bold Italic Small Z
    U+1D49C𝒜\scrAMathematical Script Capital A
    U+1D49E𝒞\scrCMathematical Script Capital C
    U+1D49F𝒟\scrDMathematical Script Capital D
    U+1D4A2𝒢\scrGMathematical Script Capital G
    U+1D4A5𝒥\scrJMathematical Script Capital J
    U+1D4A6𝒦\scrKMathematical Script Capital K
    U+1D4A9𝒩\scrNMathematical Script Capital N
    U+1D4AA𝒪\scrOMathematical Script Capital O
    U+1D4AB𝒫\scrPMathematical Script Capital P
    U+1D4AC𝒬\scrQMathematical Script Capital Q
    U+1D4AE𝒮\scrSMathematical Script Capital S
    U+1D4AF𝒯\scrTMathematical Script Capital T
    U+1D4B0𝒰\scrUMathematical Script Capital U
    U+1D4B1𝒱\scrVMathematical Script Capital V
    U+1D4B2𝒲\scrWMathematical Script Capital W
    U+1D4B3𝒳\scrXMathematical Script Capital X
    U+1D4B4𝒴\scrYMathematical Script Capital Y
    U+1D4B5𝒵\scrZMathematical Script Capital Z
    U+1D4B6𝒶\scraMathematical Script Small A
    U+1D4B7𝒷\scrbMathematical Script Small B
    U+1D4B8𝒸\scrcMathematical Script Small C
    U+1D4B9𝒹\scrdMathematical Script Small D
    U+1D4BB𝒻\scrfMathematical Script Small F
    U+1D4BD𝒽\scrhMathematical Script Small H
    U+1D4BE𝒾\scriMathematical Script Small I
    U+1D4BF𝒿\scrjMathematical Script Small J
    U+1D4C0𝓀\scrkMathematical Script Small K
    U+1D4C1𝓁\scrlMathematical Script Small L
    U+1D4C2𝓂\scrmMathematical Script Small M
    U+1D4C3𝓃\scrnMathematical Script Small N
    U+1D4C5𝓅\scrpMathematical Script Small P
    U+1D4C6𝓆\scrqMathematical Script Small Q
    U+1D4C7𝓇\scrrMathematical Script Small R
    U+1D4C8𝓈\scrsMathematical Script Small S
    U+1D4C9𝓉\scrtMathematical Script Small T
    U+1D4CA𝓊\scruMathematical Script Small U
    U+1D4CB𝓋\scrvMathematical Script Small V
    U+1D4CC𝓌\scrwMathematical Script Small W
    U+1D4CD𝓍\scrxMathematical Script Small X
    U+1D4CE𝓎\scryMathematical Script Small Y
    U+1D4CF𝓏\scrzMathematical Script Small Z
    U+1D4D0𝓐\bscrAMathematical Bold Script Capital A
    U+1D4D1𝓑\bscrBMathematical Bold Script Capital B
    U+1D4D2𝓒\bscrCMathematical Bold Script Capital C
    U+1D4D3𝓓\bscrDMathematical Bold Script Capital D
    U+1D4D4𝓔\bscrEMathematical Bold Script Capital E
    U+1D4D5𝓕\bscrFMathematical Bold Script Capital F
    U+1D4D6𝓖\bscrGMathematical Bold Script Capital G
    U+1D4D7𝓗\bscrHMathematical Bold Script Capital H
    U+1D4D8𝓘\bscrIMathematical Bold Script Capital I
    U+1D4D9𝓙\bscrJMathematical Bold Script Capital J
    U+1D4DA𝓚\bscrKMathematical Bold Script Capital K
    U+1D4DB𝓛\bscrLMathematical Bold Script Capital L
    U+1D4DC𝓜\bscrMMathematical Bold Script Capital M
    U+1D4DD𝓝\bscrNMathematical Bold Script Capital N
    U+1D4DE𝓞\bscrOMathematical Bold Script Capital O
    U+1D4DF𝓟\bscrPMathematical Bold Script Capital P
    U+1D4E0𝓠\bscrQMathematical Bold Script Capital Q
    U+1D4E1𝓡\bscrRMathematical Bold Script Capital R
    U+1D4E2𝓢\bscrSMathematical Bold Script Capital S
    U+1D4E3𝓣\bscrTMathematical Bold Script Capital T
    U+1D4E4𝓤\bscrUMathematical Bold Script Capital U
    U+1D4E5𝓥\bscrVMathematical Bold Script Capital V
    U+1D4E6𝓦\bscrWMathematical Bold Script Capital W
    U+1D4E7𝓧\bscrXMathematical Bold Script Capital X
    U+1D4E8𝓨\bscrYMathematical Bold Script Capital Y
    U+1D4E9𝓩\bscrZMathematical Bold Script Capital Z
    U+1D4EA𝓪\bscraMathematical Bold Script Small A
    U+1D4EB𝓫\bscrbMathematical Bold Script Small B
    U+1D4EC𝓬\bscrcMathematical Bold Script Small C
    U+1D4ED𝓭\bscrdMathematical Bold Script Small D
    U+1D4EE𝓮\bscreMathematical Bold Script Small E
    U+1D4EF𝓯\bscrfMathematical Bold Script Small F
    U+1D4F0𝓰\bscrgMathematical Bold Script Small G
    U+1D4F1𝓱\bscrhMathematical Bold Script Small H
    U+1D4F2𝓲\bscriMathematical Bold Script Small I
    U+1D4F3𝓳\bscrjMathematical Bold Script Small J
    U+1D4F4𝓴\bscrkMathematical Bold Script Small K
    U+1D4F5𝓵\bscrlMathematical Bold Script Small L
    U+1D4F6𝓶\bscrmMathematical Bold Script Small M
    U+1D4F7𝓷\bscrnMathematical Bold Script Small N
    U+1D4F8𝓸\bscroMathematical Bold Script Small O
    U+1D4F9𝓹\bscrpMathematical Bold Script Small P
    U+1D4FA𝓺\bscrqMathematical Bold Script Small Q
    U+1D4FB𝓻\bscrrMathematical Bold Script Small R
    U+1D4FC𝓼\bscrsMathematical Bold Script Small S
    U+1D4FD𝓽\bscrtMathematical Bold Script Small T
    U+1D4FE𝓾\bscruMathematical Bold Script Small U
    U+1D4FF𝓿\bscrvMathematical Bold Script Small V
    U+1D500𝔀\bscrwMathematical Bold Script Small W
    U+1D501𝔁\bscrxMathematical Bold Script Small X
    U+1D502𝔂\bscryMathematical Bold Script Small Y
    U+1D503𝔃\bscrzMathematical Bold Script Small Z
    U+1D504𝔄\frakAMathematical Fraktur Capital A
    U+1D505𝔅\frakBMathematical Fraktur Capital B
    U+1D507𝔇\frakDMathematical Fraktur Capital D
    U+1D508𝔈\frakEMathematical Fraktur Capital E
    U+1D509𝔉\frakFMathematical Fraktur Capital F
    U+1D50A𝔊\frakGMathematical Fraktur Capital G
    U+1D50D𝔍\frakJMathematical Fraktur Capital J
    U+1D50E𝔎\frakKMathematical Fraktur Capital K
    U+1D50F𝔏\frakLMathematical Fraktur Capital L
    U+1D510𝔐\frakMMathematical Fraktur Capital M
    U+1D511𝔑\frakNMathematical Fraktur Capital N
    U+1D512𝔒\frakOMathematical Fraktur Capital O
    U+1D513𝔓\frakPMathematical Fraktur Capital P
    U+1D514𝔔\frakQMathematical Fraktur Capital Q
    U+1D516𝔖\frakSMathematical Fraktur Capital S
    U+1D517𝔗\frakTMathematical Fraktur Capital T
    U+1D518𝔘\frakUMathematical Fraktur Capital U
    U+1D519𝔙\frakVMathematical Fraktur Capital V
    U+1D51A𝔚\frakWMathematical Fraktur Capital W
    U+1D51B𝔛\frakXMathematical Fraktur Capital X
    U+1D51C𝔜\frakYMathematical Fraktur Capital Y
    U+1D51E𝔞\frakaMathematical Fraktur Small A
    U+1D51F𝔟\frakbMathematical Fraktur Small B
    U+1D520𝔠\frakcMathematical Fraktur Small C
    U+1D521𝔡\frakdMathematical Fraktur Small D
    U+1D522𝔢\frakeMathematical Fraktur Small E
    U+1D523𝔣\frakfMathematical Fraktur Small F
    U+1D524𝔤\frakgMathematical Fraktur Small G
    U+1D525𝔥\frakhMathematical Fraktur Small H
    U+1D526𝔦\frakiMathematical Fraktur Small I
    U+1D527𝔧\frakjMathematical Fraktur Small J
    U+1D528𝔨\frakkMathematical Fraktur Small K
    U+1D529𝔩\fraklMathematical Fraktur Small L
    U+1D52A𝔪\frakmMathematical Fraktur Small M
    U+1D52B𝔫\fraknMathematical Fraktur Small N
    U+1D52C𝔬\frakoMathematical Fraktur Small O
    U+1D52D𝔭\frakpMathematical Fraktur Small P
    U+1D52E𝔮\frakqMathematical Fraktur Small Q
    U+1D52F𝔯\frakrMathematical Fraktur Small R
    U+1D530𝔰\fraksMathematical Fraktur Small S
    U+1D531𝔱\fraktMathematical Fraktur Small T
    U+1D532𝔲\frakuMathematical Fraktur Small U
    U+1D533𝔳\frakvMathematical Fraktur Small V
    U+1D534𝔴\frakwMathematical Fraktur Small W
    U+1D535𝔵\frakxMathematical Fraktur Small X
    U+1D536𝔶\frakyMathematical Fraktur Small Y
    U+1D537𝔷\frakzMathematical Fraktur Small Z
    U+1D538𝔸\bbAMathematical Double-Struck Capital A
    U+1D539𝔹\bbBMathematical Double-Struck Capital B
    U+1D53B𝔻\bbDMathematical Double-Struck Capital D
    U+1D53C𝔼\bbEMathematical Double-Struck Capital E
    U+1D53D𝔽\bbFMathematical Double-Struck Capital F
    U+1D53E𝔾\bbGMathematical Double-Struck Capital G
    U+1D540𝕀\bbIMathematical Double-Struck Capital I
    U+1D541𝕁\bbJMathematical Double-Struck Capital J
    U+1D542𝕂\bbKMathematical Double-Struck Capital K
    U+1D543𝕃\bbLMathematical Double-Struck Capital L
    U+1D544𝕄\bbMMathematical Double-Struck Capital M
    U+1D546𝕆\bbOMathematical Double-Struck Capital O
    U+1D54A𝕊\bbSMathematical Double-Struck Capital S
    U+1D54B𝕋\bbTMathematical Double-Struck Capital T
    U+1D54C𝕌\bbUMathematical Double-Struck Capital U
    U+1D54D𝕍\bbVMathematical Double-Struck Capital V
    U+1D54E𝕎\bbWMathematical Double-Struck Capital W
    U+1D54F𝕏\bbXMathematical Double-Struck Capital X
    U+1D550𝕐\bbYMathematical Double-Struck Capital Y
    U+1D552𝕒\bbaMathematical Double-Struck Small A
    U+1D553𝕓\bbbMathematical Double-Struck Small B
    U+1D554𝕔\bbcMathematical Double-Struck Small C
    U+1D555𝕕\bbdMathematical Double-Struck Small D
    U+1D556𝕖\bbeMathematical Double-Struck Small E
    U+1D557𝕗\bbfMathematical Double-Struck Small F
    U+1D558𝕘\bbgMathematical Double-Struck Small G
    U+1D559𝕙\bbhMathematical Double-Struck Small H
    U+1D55A𝕚\bbiMathematical Double-Struck Small I
    U+1D55B𝕛\bbjMathematical Double-Struck Small J
    U+1D55C𝕜\bbkMathematical Double-Struck Small K
    U+1D55D𝕝\bblMathematical Double-Struck Small L
    U+1D55E𝕞\bbmMathematical Double-Struck Small M
    U+1D55F𝕟\bbnMathematical Double-Struck Small N
    U+1D560𝕠\bboMathematical Double-Struck Small O
    U+1D561𝕡\bbpMathematical Double-Struck Small P
    U+1D562𝕢\bbqMathematical Double-Struck Small Q
    U+1D563𝕣\bbrMathematical Double-Struck Small R
    U+1D564𝕤\bbsMathematical Double-Struck Small S
    U+1D565𝕥\bbtMathematical Double-Struck Small T
    U+1D566𝕦\bbuMathematical Double-Struck Small U
    U+1D567𝕧\bbvMathematical Double-Struck Small V
    U+1D568𝕨\bbwMathematical Double-Struck Small W
    U+1D569𝕩\bbxMathematical Double-Struck Small X
    U+1D56A𝕪\bbyMathematical Double-Struck Small Y
    U+1D56B𝕫\bbzMathematical Double-Struck Small Z
    U+1D56C𝕬\bfrakAMathematical Bold Fraktur Capital A
    U+1D56D𝕭\bfrakBMathematical Bold Fraktur Capital B
    U+1D56E𝕮\bfrakCMathematical Bold Fraktur Capital C
    U+1D56F𝕯\bfrakDMathematical Bold Fraktur Capital D
    U+1D570𝕰\bfrakEMathematical Bold Fraktur Capital E
    U+1D571𝕱\bfrakFMathematical Bold Fraktur Capital F
    U+1D572𝕲\bfrakGMathematical Bold Fraktur Capital G
    U+1D573𝕳\bfrakHMathematical Bold Fraktur Capital H
    U+1D574𝕴\bfrakIMathematical Bold Fraktur Capital I
    U+1D575𝕵\bfrakJMathematical Bold Fraktur Capital J
    U+1D576𝕶\bfrakKMathematical Bold Fraktur Capital K
    U+1D577𝕷\bfrakLMathematical Bold Fraktur Capital L
    U+1D578𝕸\bfrakMMathematical Bold Fraktur Capital M
    U+1D579𝕹\bfrakNMathematical Bold Fraktur Capital N
    U+1D57A𝕺\bfrakOMathematical Bold Fraktur Capital O
    U+1D57B𝕻\bfrakPMathematical Bold Fraktur Capital P
    U+1D57C𝕼\bfrakQMathematical Bold Fraktur Capital Q
    U+1D57D𝕽\bfrakRMathematical Bold Fraktur Capital R
    U+1D57E𝕾\bfrakSMathematical Bold Fraktur Capital S
    U+1D57F𝕿\bfrakTMathematical Bold Fraktur Capital T
    U+1D580𝖀\bfrakUMathematical Bold Fraktur Capital U
    U+1D581𝖁\bfrakVMathematical Bold Fraktur Capital V
    U+1D582𝖂\bfrakWMathematical Bold Fraktur Capital W
    U+1D583𝖃\bfrakXMathematical Bold Fraktur Capital X
    U+1D584𝖄\bfrakYMathematical Bold Fraktur Capital Y
    U+1D585𝖅\bfrakZMathematical Bold Fraktur Capital Z
    U+1D586𝖆\bfrakaMathematical Bold Fraktur Small A
    U+1D587𝖇\bfrakbMathematical Bold Fraktur Small B
    U+1D588𝖈\bfrakcMathematical Bold Fraktur Small C
    U+1D589𝖉\bfrakdMathematical Bold Fraktur Small D
    U+1D58A𝖊\bfrakeMathematical Bold Fraktur Small E
    U+1D58B𝖋\bfrakfMathematical Bold Fraktur Small F
    U+1D58C𝖌\bfrakgMathematical Bold Fraktur Small G
    U+1D58D𝖍\bfrakhMathematical Bold Fraktur Small H
    U+1D58E𝖎\bfrakiMathematical Bold Fraktur Small I
    U+1D58F𝖏\bfrakjMathematical Bold Fraktur Small J
    U+1D590𝖐\bfrakkMathematical Bold Fraktur Small K
    U+1D591𝖑\bfraklMathematical Bold Fraktur Small L
    U+1D592𝖒\bfrakmMathematical Bold Fraktur Small M
    U+1D593𝖓\bfraknMathematical Bold Fraktur Small N
    U+1D594𝖔\bfrakoMathematical Bold Fraktur Small O
    U+1D595𝖕\bfrakpMathematical Bold Fraktur Small P
    U+1D596𝖖\bfrakqMathematical Bold Fraktur Small Q
    U+1D597𝖗\bfrakrMathematical Bold Fraktur Small R
    U+1D598𝖘\bfraksMathematical Bold Fraktur Small S
    U+1D599𝖙\bfraktMathematical Bold Fraktur Small T
    U+1D59A𝖚\bfrakuMathematical Bold Fraktur Small U
    U+1D59B𝖛\bfrakvMathematical Bold Fraktur Small V
    U+1D59C𝖜\bfrakwMathematical Bold Fraktur Small W
    U+1D59D𝖝\bfrakxMathematical Bold Fraktur Small X
    U+1D59E𝖞\bfrakyMathematical Bold Fraktur Small Y
    U+1D59F𝖟\bfrakzMathematical Bold Fraktur Small Z
    U+1D5A0𝖠\sansAMathematical Sans-Serif Capital A
    U+1D5A1𝖡\sansBMathematical Sans-Serif Capital B
    U+1D5A2𝖢\sansCMathematical Sans-Serif Capital C
    U+1D5A3𝖣\sansDMathematical Sans-Serif Capital D
    U+1D5A4𝖤\sansEMathematical Sans-Serif Capital E
    U+1D5A5𝖥\sansFMathematical Sans-Serif Capital F
    U+1D5A6𝖦\sansGMathematical Sans-Serif Capital G
    U+1D5A7𝖧\sansHMathematical Sans-Serif Capital H
    U+1D5A8𝖨\sansIMathematical Sans-Serif Capital I
    U+1D5A9𝖩\sansJMathematical Sans-Serif Capital J
    U+1D5AA𝖪\sansKMathematical Sans-Serif Capital K
    U+1D5AB𝖫\sansLMathematical Sans-Serif Capital L
    U+1D5AC𝖬\sansMMathematical Sans-Serif Capital M
    U+1D5AD𝖭\sansNMathematical Sans-Serif Capital N
    U+1D5AE𝖮\sansOMathematical Sans-Serif Capital O
    U+1D5AF𝖯\sansPMathematical Sans-Serif Capital P
    U+1D5B0𝖰\sansQMathematical Sans-Serif Capital Q
    U+1D5B1𝖱\sansRMathematical Sans-Serif Capital R
    U+1D5B2𝖲\sansSMathematical Sans-Serif Capital S
    U+1D5B3𝖳\sansTMathematical Sans-Serif Capital T
    U+1D5B4𝖴\sansUMathematical Sans-Serif Capital U
    U+1D5B5𝖵\sansVMathematical Sans-Serif Capital V
    U+1D5B6𝖶\sansWMathematical Sans-Serif Capital W
    U+1D5B7𝖷\sansXMathematical Sans-Serif Capital X
    U+1D5B8𝖸\sansYMathematical Sans-Serif Capital Y
    U+1D5B9𝖹\sansZMathematical Sans-Serif Capital Z
    U+1D5BA𝖺\sansaMathematical Sans-Serif Small A
    U+1D5BB𝖻\sansbMathematical Sans-Serif Small B
    U+1D5BC𝖼\sanscMathematical Sans-Serif Small C
    U+1D5BD𝖽\sansdMathematical Sans-Serif Small D
    U+1D5BE𝖾\sanseMathematical Sans-Serif Small E
    U+1D5BF𝖿\sansfMathematical Sans-Serif Small F
    U+1D5C0𝗀\sansgMathematical Sans-Serif Small G
    U+1D5C1𝗁\sanshMathematical Sans-Serif Small H
    U+1D5C2𝗂\sansiMathematical Sans-Serif Small I
    U+1D5C3𝗃\sansjMathematical Sans-Serif Small J
    U+1D5C4𝗄\sanskMathematical Sans-Serif Small K
    U+1D5C5𝗅\sanslMathematical Sans-Serif Small L
    U+1D5C6𝗆\sansmMathematical Sans-Serif Small M
    U+1D5C7𝗇\sansnMathematical Sans-Serif Small N
    U+1D5C8𝗈\sansoMathematical Sans-Serif Small O
    U+1D5C9𝗉\sanspMathematical Sans-Serif Small P
    U+1D5CA𝗊\sansqMathematical Sans-Serif Small Q
    U+1D5CB𝗋\sansrMathematical Sans-Serif Small R
    U+1D5CC𝗌\sanssMathematical Sans-Serif Small S
    U+1D5CD𝗍\sanstMathematical Sans-Serif Small T
    U+1D5CE𝗎\sansuMathematical Sans-Serif Small U
    U+1D5CF𝗏\sansvMathematical Sans-Serif Small V
    U+1D5D0𝗐\sanswMathematical Sans-Serif Small W
    U+1D5D1𝗑\sansxMathematical Sans-Serif Small X
    U+1D5D2𝗒\sansyMathematical Sans-Serif Small Y
    U+1D5D3𝗓\sanszMathematical Sans-Serif Small Z
    U+1D5D4𝗔\bsansAMathematical Sans-Serif Bold Capital A
    U+1D5D5𝗕\bsansBMathematical Sans-Serif Bold Capital B
    U+1D5D6𝗖\bsansCMathematical Sans-Serif Bold Capital C
    U+1D5D7𝗗\bsansDMathematical Sans-Serif Bold Capital D
    U+1D5D8𝗘\bsansEMathematical Sans-Serif Bold Capital E
    U+1D5D9𝗙\bsansFMathematical Sans-Serif Bold Capital F
    U+1D5DA𝗚\bsansGMathematical Sans-Serif Bold Capital G
    U+1D5DB𝗛\bsansHMathematical Sans-Serif Bold Capital H
    U+1D5DC𝗜\bsansIMathematical Sans-Serif Bold Capital I
    U+1D5DD𝗝\bsansJMathematical Sans-Serif Bold Capital J
    U+1D5DE𝗞\bsansKMathematical Sans-Serif Bold Capital K
    U+1D5DF𝗟\bsansLMathematical Sans-Serif Bold Capital L
    U+1D5E0𝗠\bsansMMathematical Sans-Serif Bold Capital M
    U+1D5E1𝗡\bsansNMathematical Sans-Serif Bold Capital N
    U+1D5E2𝗢\bsansOMathematical Sans-Serif Bold Capital O
    U+1D5E3𝗣\bsansPMathematical Sans-Serif Bold Capital P
    U+1D5E4𝗤\bsansQMathematical Sans-Serif Bold Capital Q
    U+1D5E5𝗥\bsansRMathematical Sans-Serif Bold Capital R
    U+1D5E6𝗦\bsansSMathematical Sans-Serif Bold Capital S
    U+1D5E7𝗧\bsansTMathematical Sans-Serif Bold Capital T
    U+1D5E8𝗨\bsansUMathematical Sans-Serif Bold Capital U
    U+1D5E9𝗩\bsansVMathematical Sans-Serif Bold Capital V
    U+1D5EA𝗪\bsansWMathematical Sans-Serif Bold Capital W
    U+1D5EB𝗫\bsansXMathematical Sans-Serif Bold Capital X
    U+1D5EC𝗬\bsansYMathematical Sans-Serif Bold Capital Y
    U+1D5ED𝗭\bsansZMathematical Sans-Serif Bold Capital Z
    U+1D5EE𝗮\bsansaMathematical Sans-Serif Bold Small A
    U+1D5EF𝗯\bsansbMathematical Sans-Serif Bold Small B
    U+1D5F0𝗰\bsanscMathematical Sans-Serif Bold Small C
    U+1D5F1𝗱\bsansdMathematical Sans-Serif Bold Small D
    U+1D5F2𝗲\bsanseMathematical Sans-Serif Bold Small E
    U+1D5F3𝗳\bsansfMathematical Sans-Serif Bold Small F
    U+1D5F4𝗴\bsansgMathematical Sans-Serif Bold Small G
    U+1D5F5𝗵\bsanshMathematical Sans-Serif Bold Small H
    U+1D5F6𝗶\bsansiMathematical Sans-Serif Bold Small I
    U+1D5F7𝗷\bsansjMathematical Sans-Serif Bold Small J
    U+1D5F8𝗸\bsanskMathematical Sans-Serif Bold Small K
    U+1D5F9𝗹\bsanslMathematical Sans-Serif Bold Small L
    U+1D5FA𝗺\bsansmMathematical Sans-Serif Bold Small M
    U+1D5FB𝗻\bsansnMathematical Sans-Serif Bold Small N
    U+1D5FC𝗼\bsansoMathematical Sans-Serif Bold Small O
    U+1D5FD𝗽\bsanspMathematical Sans-Serif Bold Small P
    U+1D5FE𝗾\bsansqMathematical Sans-Serif Bold Small Q
    U+1D5FF𝗿\bsansrMathematical Sans-Serif Bold Small R
    U+1D600𝘀\bsanssMathematical Sans-Serif Bold Small S
    U+1D601𝘁\bsanstMathematical Sans-Serif Bold Small T
    U+1D602𝘂\bsansuMathematical Sans-Serif Bold Small U
    U+1D603𝘃\bsansvMathematical Sans-Serif Bold Small V
    U+1D604𝘄\bsanswMathematical Sans-Serif Bold Small W
    U+1D605𝘅\bsansxMathematical Sans-Serif Bold Small X
    U+1D606𝘆\bsansyMathematical Sans-Serif Bold Small Y
    U+1D607𝘇\bsanszMathematical Sans-Serif Bold Small Z
    U+1D608𝘈\isansAMathematical Sans-Serif Italic Capital A
    U+1D609𝘉\isansBMathematical Sans-Serif Italic Capital B
    U+1D60A𝘊\isansCMathematical Sans-Serif Italic Capital C
    U+1D60B𝘋\isansDMathematical Sans-Serif Italic Capital D
    U+1D60C𝘌\isansEMathematical Sans-Serif Italic Capital E
    U+1D60D𝘍\isansFMathematical Sans-Serif Italic Capital F
    U+1D60E𝘎\isansGMathematical Sans-Serif Italic Capital G
    U+1D60F𝘏\isansHMathematical Sans-Serif Italic Capital H
    U+1D610𝘐\isansIMathematical Sans-Serif Italic Capital I
    U+1D611𝘑\isansJMathematical Sans-Serif Italic Capital J
    U+1D612𝘒\isansKMathematical Sans-Serif Italic Capital K
    U+1D613𝘓\isansLMathematical Sans-Serif Italic Capital L
    U+1D614𝘔\isansMMathematical Sans-Serif Italic Capital M
    U+1D615𝘕\isansNMathematical Sans-Serif Italic Capital N
    U+1D616𝘖\isansOMathematical Sans-Serif Italic Capital O
    U+1D617𝘗\isansPMathematical Sans-Serif Italic Capital P
    U+1D618𝘘\isansQMathematical Sans-Serif Italic Capital Q
    U+1D619𝘙\isansRMathematical Sans-Serif Italic Capital R
    U+1D61A𝘚\isansSMathematical Sans-Serif Italic Capital S
    U+1D61B𝘛\isansTMathematical Sans-Serif Italic Capital T
    U+1D61C𝘜\isansUMathematical Sans-Serif Italic Capital U
    U+1D61D𝘝\isansVMathematical Sans-Serif Italic Capital V
    U+1D61E𝘞\isansWMathematical Sans-Serif Italic Capital W
    U+1D61F𝘟\isansXMathematical Sans-Serif Italic Capital X
    U+1D620𝘠\isansYMathematical Sans-Serif Italic Capital Y
    U+1D621𝘡\isansZMathematical Sans-Serif Italic Capital Z
    U+1D622𝘢\isansaMathematical Sans-Serif Italic Small A
    U+1D623𝘣\isansbMathematical Sans-Serif Italic Small B
    U+1D624𝘤\isanscMathematical Sans-Serif Italic Small C
    U+1D625𝘥\isansdMathematical Sans-Serif Italic Small D
    U+1D626𝘦\isanseMathematical Sans-Serif Italic Small E
    U+1D627𝘧\isansfMathematical Sans-Serif Italic Small F
    U+1D628𝘨\isansgMathematical Sans-Serif Italic Small G
    U+1D629𝘩\isanshMathematical Sans-Serif Italic Small H
    U+1D62A𝘪\isansiMathematical Sans-Serif Italic Small I
    U+1D62B𝘫\isansjMathematical Sans-Serif Italic Small J
    U+1D62C𝘬\isanskMathematical Sans-Serif Italic Small K
    U+1D62D𝘭\isanslMathematical Sans-Serif Italic Small L
    U+1D62E𝘮\isansmMathematical Sans-Serif Italic Small M
    U+1D62F𝘯\isansnMathematical Sans-Serif Italic Small N
    U+1D630𝘰\isansoMathematical Sans-Serif Italic Small O
    U+1D631𝘱\isanspMathematical Sans-Serif Italic Small P
    U+1D632𝘲\isansqMathematical Sans-Serif Italic Small Q
    U+1D633𝘳\isansrMathematical Sans-Serif Italic Small R
    U+1D634𝘴\isanssMathematical Sans-Serif Italic Small S
    U+1D635𝘵\isanstMathematical Sans-Serif Italic Small T
    U+1D636𝘶\isansuMathematical Sans-Serif Italic Small U
    U+1D637𝘷\isansvMathematical Sans-Serif Italic Small V
    U+1D638𝘸\isanswMathematical Sans-Serif Italic Small W
    U+1D639𝘹\isansxMathematical Sans-Serif Italic Small X
    U+1D63A𝘺\isansyMathematical Sans-Serif Italic Small Y
    U+1D63B𝘻\isanszMathematical Sans-Serif Italic Small Z
    U+1D63C𝘼\bisansAMathematical Sans-Serif Bold Italic Capital A
    U+1D63D𝘽\bisansBMathematical Sans-Serif Bold Italic Capital B
    U+1D63E𝘾\bisansCMathematical Sans-Serif Bold Italic Capital C
    U+1D63F𝘿\bisansDMathematical Sans-Serif Bold Italic Capital D
    U+1D640𝙀\bisansEMathematical Sans-Serif Bold Italic Capital E
    U+1D641𝙁\bisansFMathematical Sans-Serif Bold Italic Capital F
    U+1D642𝙂\bisansGMathematical Sans-Serif Bold Italic Capital G
    U+1D643𝙃\bisansHMathematical Sans-Serif Bold Italic Capital H
    U+1D644𝙄\bisansIMathematical Sans-Serif Bold Italic Capital I
    U+1D645𝙅\bisansJMathematical Sans-Serif Bold Italic Capital J
    U+1D646𝙆\bisansKMathematical Sans-Serif Bold Italic Capital K
    U+1D647𝙇\bisansLMathematical Sans-Serif Bold Italic Capital L
    U+1D648𝙈\bisansMMathematical Sans-Serif Bold Italic Capital M
    U+1D649𝙉\bisansNMathematical Sans-Serif Bold Italic Capital N
    U+1D64A𝙊\bisansOMathematical Sans-Serif Bold Italic Capital O
    U+1D64B𝙋\bisansPMathematical Sans-Serif Bold Italic Capital P
    U+1D64C𝙌\bisansQMathematical Sans-Serif Bold Italic Capital Q
    U+1D64D𝙍\bisansRMathematical Sans-Serif Bold Italic Capital R
    U+1D64E𝙎\bisansSMathematical Sans-Serif Bold Italic Capital S
    U+1D64F𝙏\bisansTMathematical Sans-Serif Bold Italic Capital T
    U+1D650𝙐\bisansUMathematical Sans-Serif Bold Italic Capital U
    U+1D651𝙑\bisansVMathematical Sans-Serif Bold Italic Capital V
    U+1D652𝙒\bisansWMathematical Sans-Serif Bold Italic Capital W
    U+1D653𝙓\bisansXMathematical Sans-Serif Bold Italic Capital X
    U+1D654𝙔\bisansYMathematical Sans-Serif Bold Italic Capital Y
    U+1D655𝙕\bisansZMathematical Sans-Serif Bold Italic Capital Z
    U+1D656𝙖\bisansaMathematical Sans-Serif Bold Italic Small A
    U+1D657𝙗\bisansbMathematical Sans-Serif Bold Italic Small B
    U+1D658𝙘\bisanscMathematical Sans-Serif Bold Italic Small C
    U+1D659𝙙\bisansdMathematical Sans-Serif Bold Italic Small D
    U+1D65A𝙚\bisanseMathematical Sans-Serif Bold Italic Small E
    U+1D65B𝙛\bisansfMathematical Sans-Serif Bold Italic Small F
    U+1D65C𝙜\bisansgMathematical Sans-Serif Bold Italic Small G
    U+1D65D𝙝\bisanshMathematical Sans-Serif Bold Italic Small H
    U+1D65E𝙞\bisansiMathematical Sans-Serif Bold Italic Small I
    U+1D65F𝙟\bisansjMathematical Sans-Serif Bold Italic Small J
    U+1D660𝙠\bisanskMathematical Sans-Serif Bold Italic Small K
    U+1D661𝙡\bisanslMathematical Sans-Serif Bold Italic Small L
    U+1D662𝙢\bisansmMathematical Sans-Serif Bold Italic Small M
    U+1D663𝙣\bisansnMathematical Sans-Serif Bold Italic Small N
    U+1D664𝙤\bisansoMathematical Sans-Serif Bold Italic Small O
    U+1D665𝙥\bisanspMathematical Sans-Serif Bold Italic Small P
    U+1D666𝙦\bisansqMathematical Sans-Serif Bold Italic Small Q
    U+1D667𝙧\bisansrMathematical Sans-Serif Bold Italic Small R
    U+1D668𝙨\bisanssMathematical Sans-Serif Bold Italic Small S
    U+1D669𝙩\bisanstMathematical Sans-Serif Bold Italic Small T
    U+1D66A𝙪\bisansuMathematical Sans-Serif Bold Italic Small U
    U+1D66B𝙫\bisansvMathematical Sans-Serif Bold Italic Small V
    U+1D66C𝙬\bisanswMathematical Sans-Serif Bold Italic Small W
    U+1D66D𝙭\bisansxMathematical Sans-Serif Bold Italic Small X
    U+1D66E𝙮\bisansyMathematical Sans-Serif Bold Italic Small Y
    U+1D66F𝙯\bisanszMathematical Sans-Serif Bold Italic Small Z
    U+1D670𝙰\ttAMathematical Monospace Capital A
    U+1D671𝙱\ttBMathematical Monospace Capital B
    U+1D672𝙲\ttCMathematical Monospace Capital C
    U+1D673𝙳\ttDMathematical Monospace Capital D
    U+1D674𝙴\ttEMathematical Monospace Capital E
    U+1D675𝙵\ttFMathematical Monospace Capital F
    U+1D676𝙶\ttGMathematical Monospace Capital G
    U+1D677𝙷\ttHMathematical Monospace Capital H
    U+1D678𝙸\ttIMathematical Monospace Capital I
    U+1D679𝙹\ttJMathematical Monospace Capital J
    U+1D67A𝙺\ttKMathematical Monospace Capital K
    U+1D67B𝙻\ttLMathematical Monospace Capital L
    U+1D67C𝙼\ttMMathematical Monospace Capital M
    U+1D67D𝙽\ttNMathematical Monospace Capital N
    U+1D67E𝙾\ttOMathematical Monospace Capital O
    U+1D67F𝙿\ttPMathematical Monospace Capital P
    U+1D680𝚀\ttQMathematical Monospace Capital Q
    U+1D681𝚁\ttRMathematical Monospace Capital R
    U+1D682𝚂\ttSMathematical Monospace Capital S
    U+1D683𝚃\ttTMathematical Monospace Capital T
    U+1D684𝚄\ttUMathematical Monospace Capital U
    U+1D685𝚅\ttVMathematical Monospace Capital V
    U+1D686𝚆\ttWMathematical Monospace Capital W
    U+1D687𝚇\ttXMathematical Monospace Capital X
    U+1D688𝚈\ttYMathematical Monospace Capital Y
    U+1D689𝚉\ttZMathematical Monospace Capital Z
    U+1D68A𝚊\ttaMathematical Monospace Small A
    U+1D68B𝚋\ttbMathematical Monospace Small B
    U+1D68C𝚌\ttcMathematical Monospace Small C
    U+1D68D𝚍\ttdMathematical Monospace Small D
    U+1D68E𝚎\tteMathematical Monospace Small E
    U+1D68F𝚏\ttfMathematical Monospace Small F
    U+1D690𝚐\ttgMathematical Monospace Small G
    U+1D691𝚑\tthMathematical Monospace Small H
    U+1D692𝚒\ttiMathematical Monospace Small I
    U+1D693𝚓\ttjMathematical Monospace Small J
    U+1D694𝚔\ttkMathematical Monospace Small K
    U+1D695𝚕\ttlMathematical Monospace Small L
    U+1D696𝚖\ttmMathematical Monospace Small M
    U+1D697𝚗\ttnMathematical Monospace Small N
    U+1D698𝚘\ttoMathematical Monospace Small O
    U+1D699𝚙\ttpMathematical Monospace Small P
    U+1D69A𝚚\ttqMathematical Monospace Small Q
    U+1D69B𝚛\ttrMathematical Monospace Small R
    U+1D69C𝚜\ttsMathematical Monospace Small S
    U+1D69D𝚝\tttMathematical Monospace Small T
    U+1D69E𝚞\ttuMathematical Monospace Small U
    U+1D69F𝚟\ttvMathematical Monospace Small V
    U+1D6A0𝚠\ttwMathematical Monospace Small W
    U+1D6A1𝚡\ttxMathematical Monospace Small X
    U+1D6A2𝚢\ttyMathematical Monospace Small Y
    U+1D6A3𝚣\ttzMathematical Monospace Small Z
    U+1D6A4𝚤\itimathMathematical Italic Small Dotless I
    U+1D6A5𝚥\itjmathMathematical Italic Small Dotless J
    U+1D6A8𝚨\bfAlphaMathematical Bold Capital Alpha
    U+1D6A9𝚩\bfBetaMathematical Bold Capital Beta
    U+1D6AA𝚪\bfGammaMathematical Bold Capital Gamma
    U+1D6AB𝚫\bfDeltaMathematical Bold Capital Delta
    U+1D6AC𝚬\bfEpsilonMathematical Bold Capital Epsilon
    U+1D6AD𝚭\bfZetaMathematical Bold Capital Zeta
    U+1D6AE𝚮\bfEtaMathematical Bold Capital Eta
    U+1D6AF𝚯\bfThetaMathematical Bold Capital Theta
    U+1D6B0𝚰\bfIotaMathematical Bold Capital Iota
    U+1D6B1𝚱\bfKappaMathematical Bold Capital Kappa
    U+1D6B2𝚲\bfLambdaMathematical Bold Capital Lamda
    U+1D6B3𝚳\bfMuMathematical Bold Capital Mu
    U+1D6B4𝚴\bfNuMathematical Bold Capital Nu
    U+1D6B5𝚵\bfXiMathematical Bold Capital Xi
    U+1D6B6𝚶\bfOmicronMathematical Bold Capital Omicron
    U+1D6B7𝚷\bfPiMathematical Bold Capital Pi
    U+1D6B8𝚸\bfRhoMathematical Bold Capital Rho
    U+1D6B9𝚹\bfvarThetaMathematical Bold Capital Theta Symbol
    U+1D6BA𝚺\bfSigmaMathematical Bold Capital Sigma
    U+1D6BB𝚻\bfTauMathematical Bold Capital Tau
    U+1D6BC𝚼\bfUpsilonMathematical Bold Capital Upsilon
    U+1D6BD𝚽\bfPhiMathematical Bold Capital Phi
    U+1D6BE𝚾\bfChiMathematical Bold Capital Chi
    U+1D6BF𝚿\bfPsiMathematical Bold Capital Psi
    U+1D6C0𝛀\bfOmegaMathematical Bold Capital Omega
    U+1D6C1𝛁\bfnablaMathematical Bold Nabla
    U+1D6C2𝛂\bfalphaMathematical Bold Small Alpha
    U+1D6C3𝛃\bfbetaMathematical Bold Small Beta
    U+1D6C4𝛄\bfgammaMathematical Bold Small Gamma
    U+1D6C5𝛅\bfdeltaMathematical Bold Small Delta
    U+1D6C6𝛆\bfvarepsilonMathematical Bold Small Epsilon
    U+1D6C7𝛇\bfzetaMathematical Bold Small Zeta
    U+1D6C8𝛈\bfetaMathematical Bold Small Eta
    U+1D6C9𝛉\bfthetaMathematical Bold Small Theta
    U+1D6CA𝛊\bfiotaMathematical Bold Small Iota
    U+1D6CB𝛋\bfkappaMathematical Bold Small Kappa
    U+1D6CC𝛌\bflambdaMathematical Bold Small Lamda
    U+1D6CD𝛍\bfmuMathematical Bold Small Mu
    U+1D6CE𝛎\bfnuMathematical Bold Small Nu
    U+1D6CF𝛏\bfxiMathematical Bold Small Xi
    U+1D6D0𝛐\bfomicronMathematical Bold Small Omicron
    U+1D6D1𝛑\bfpiMathematical Bold Small Pi
    U+1D6D2𝛒\bfrhoMathematical Bold Small Rho
    U+1D6D3𝛓\bfvarsigmaMathematical Bold Small Final Sigma
    U+1D6D4𝛔\bfsigmaMathematical Bold Small Sigma
    U+1D6D5𝛕\bftauMathematical Bold Small Tau
    U+1D6D6𝛖\bfupsilonMathematical Bold Small Upsilon
    U+1D6D7𝛗\bfvarphiMathematical Bold Small Phi
    U+1D6D8𝛘\bfchiMathematical Bold Small Chi
    U+1D6D9𝛙\bfpsiMathematical Bold Small Psi
    U+1D6DA𝛚\bfomegaMathematical Bold Small Omega
    U+1D6DB𝛛\bfpartialMathematical Bold Partial Differential
    U+1D6DC𝛜\bfepsilonMathematical Bold Epsilon Symbol
    U+1D6DD𝛝\bfvarthetaMathematical Bold Theta Symbol
    U+1D6DE𝛞\bfvarkappaMathematical Bold Kappa Symbol
    U+1D6DF𝛟\bfphiMathematical Bold Phi Symbol
    U+1D6E0𝛠\bfvarrhoMathematical Bold Rho Symbol
    U+1D6E1𝛡\bfvarpiMathematical Bold Pi Symbol
    U+1D6E2𝛢\itAlphaMathematical Italic Capital Alpha
    U+1D6E3𝛣\itBetaMathematical Italic Capital Beta
    U+1D6E4𝛤\itGammaMathematical Italic Capital Gamma
    U+1D6E5𝛥\itDeltaMathematical Italic Capital Delta
    U+1D6E6𝛦\itEpsilonMathematical Italic Capital Epsilon
    U+1D6E7𝛧\itZetaMathematical Italic Capital Zeta
    U+1D6E8𝛨\itEtaMathematical Italic Capital Eta
    U+1D6E9𝛩\itThetaMathematical Italic Capital Theta
    U+1D6EA𝛪\itIotaMathematical Italic Capital Iota
    U+1D6EB𝛫\itKappaMathematical Italic Capital Kappa
    U+1D6EC𝛬\itLambdaMathematical Italic Capital Lamda
    U+1D6ED𝛭\itMuMathematical Italic Capital Mu
    U+1D6EE𝛮\itNuMathematical Italic Capital Nu
    U+1D6EF𝛯\itXiMathematical Italic Capital Xi
    U+1D6F0𝛰\itOmicronMathematical Italic Capital Omicron
    U+1D6F1𝛱\itPiMathematical Italic Capital Pi
    U+1D6F2𝛲\itRhoMathematical Italic Capital Rho
    U+1D6F3𝛳\itvarThetaMathematical Italic Capital Theta Symbol
    U+1D6F4𝛴\itSigmaMathematical Italic Capital Sigma
    U+1D6F5𝛵\itTauMathematical Italic Capital Tau
    U+1D6F6𝛶\itUpsilonMathematical Italic Capital Upsilon
    U+1D6F7𝛷\itPhiMathematical Italic Capital Phi
    U+1D6F8𝛸\itChiMathematical Italic Capital Chi
    U+1D6F9𝛹\itPsiMathematical Italic Capital Psi
    U+1D6FA𝛺\itOmegaMathematical Italic Capital Omega
    U+1D6FB𝛻\itnablaMathematical Italic Nabla
    U+1D6FC𝛼\italphaMathematical Italic Small Alpha
    U+1D6FD𝛽\itbetaMathematical Italic Small Beta
    U+1D6FE𝛾\itgammaMathematical Italic Small Gamma
    U+1D6FF𝛿\itdeltaMathematical Italic Small Delta
    U+1D700𝜀\itvarepsilonMathematical Italic Small Epsilon
    U+1D701𝜁\itzetaMathematical Italic Small Zeta
    U+1D702𝜂\itetaMathematical Italic Small Eta
    U+1D703𝜃\itthetaMathematical Italic Small Theta
    U+1D704𝜄\itiotaMathematical Italic Small Iota
    U+1D705𝜅\itkappaMathematical Italic Small Kappa
    U+1D706𝜆\itlambdaMathematical Italic Small Lamda
    U+1D707𝜇\itmuMathematical Italic Small Mu
    U+1D708𝜈\itnuMathematical Italic Small Nu
    U+1D709𝜉\itxiMathematical Italic Small Xi
    U+1D70A𝜊\itomicronMathematical Italic Small Omicron
    U+1D70B𝜋\itpiMathematical Italic Small Pi
    U+1D70C𝜌\itrhoMathematical Italic Small Rho
    U+1D70D𝜍\itvarsigmaMathematical Italic Small Final Sigma
    U+1D70E𝜎\itsigmaMathematical Italic Small Sigma
    U+1D70F𝜏\ittauMathematical Italic Small Tau
    U+1D710𝜐\itupsilonMathematical Italic Small Upsilon
    U+1D711𝜑\itvarphiMathematical Italic Small Phi
    U+1D712𝜒\itchiMathematical Italic Small Chi
    U+1D713𝜓\itpsiMathematical Italic Small Psi
    U+1D714𝜔\itomegaMathematical Italic Small Omega
    U+1D715𝜕\itpartialMathematical Italic Partial Differential
    U+1D716𝜖\itepsilonMathematical Italic Epsilon Symbol
    U+1D717𝜗\itvarthetaMathematical Italic Theta Symbol
    U+1D718𝜘\itvarkappaMathematical Italic Kappa Symbol
    U+1D719𝜙\itphiMathematical Italic Phi Symbol
    U+1D71A𝜚\itvarrhoMathematical Italic Rho Symbol
    U+1D71B𝜛\itvarpiMathematical Italic Pi Symbol
    U+1D71C𝜜\biAlphaMathematical Bold Italic Capital Alpha
    U+1D71D𝜝\biBetaMathematical Bold Italic Capital Beta
    U+1D71E𝜞\biGammaMathematical Bold Italic Capital Gamma
    U+1D71F𝜟\biDeltaMathematical Bold Italic Capital Delta
    U+1D720𝜠\biEpsilonMathematical Bold Italic Capital Epsilon
    U+1D721𝜡\biZetaMathematical Bold Italic Capital Zeta
    U+1D722𝜢\biEtaMathematical Bold Italic Capital Eta
    U+1D723𝜣\biThetaMathematical Bold Italic Capital Theta
    U+1D724𝜤\biIotaMathematical Bold Italic Capital Iota
    U+1D725𝜥\biKappaMathematical Bold Italic Capital Kappa
    U+1D726𝜦\biLambdaMathematical Bold Italic Capital Lamda
    U+1D727𝜧\biMuMathematical Bold Italic Capital Mu
    U+1D728𝜨\biNuMathematical Bold Italic Capital Nu
    U+1D729𝜩\biXiMathematical Bold Italic Capital Xi
    U+1D72A𝜪\biOmicronMathematical Bold Italic Capital Omicron
    U+1D72B𝜫\biPiMathematical Bold Italic Capital Pi
    U+1D72C𝜬\biRhoMathematical Bold Italic Capital Rho
    U+1D72D𝜭\bivarThetaMathematical Bold Italic Capital Theta Symbol
    U+1D72E𝜮\biSigmaMathematical Bold Italic Capital Sigma
    U+1D72F𝜯\biTauMathematical Bold Italic Capital Tau
    U+1D730𝜰\biUpsilonMathematical Bold Italic Capital Upsilon
    U+1D731𝜱\biPhiMathematical Bold Italic Capital Phi
    U+1D732𝜲\biChiMathematical Bold Italic Capital Chi
    U+1D733𝜳\biPsiMathematical Bold Italic Capital Psi
    U+1D734𝜴\biOmegaMathematical Bold Italic Capital Omega
    U+1D735𝜵\binablaMathematical Bold Italic Nabla
    U+1D736𝜶\bialphaMathematical Bold Italic Small Alpha
    U+1D737𝜷\bibetaMathematical Bold Italic Small Beta
    U+1D738𝜸\bigammaMathematical Bold Italic Small Gamma
    U+1D739𝜹\bideltaMathematical Bold Italic Small Delta
    U+1D73A𝜺\bivarepsilonMathematical Bold Italic Small Epsilon
    U+1D73B𝜻\bizetaMathematical Bold Italic Small Zeta
    U+1D73C𝜼\bietaMathematical Bold Italic Small Eta
    U+1D73D𝜽\bithetaMathematical Bold Italic Small Theta
    U+1D73E𝜾\biiotaMathematical Bold Italic Small Iota
    U+1D73F𝜿\bikappaMathematical Bold Italic Small Kappa
    U+1D740𝝀\bilambdaMathematical Bold Italic Small Lamda
    U+1D741𝝁\bimuMathematical Bold Italic Small Mu
    U+1D742𝝂\binuMathematical Bold Italic Small Nu
    U+1D743𝝃\bixiMathematical Bold Italic Small Xi
    U+1D744𝝄\biomicronMathematical Bold Italic Small Omicron
    U+1D745𝝅\bipiMathematical Bold Italic Small Pi
    U+1D746𝝆\birhoMathematical Bold Italic Small Rho
    U+1D747𝝇\bivarsigmaMathematical Bold Italic Small Final Sigma
    U+1D748𝝈\bisigmaMathematical Bold Italic Small Sigma
    U+1D749𝝉\bitauMathematical Bold Italic Small Tau
    U+1D74A𝝊\biupsilonMathematical Bold Italic Small Upsilon
    U+1D74B𝝋\bivarphiMathematical Bold Italic Small Phi
    U+1D74C𝝌\bichiMathematical Bold Italic Small Chi
    U+1D74D𝝍\bipsiMathematical Bold Italic Small Psi
    U+1D74E𝝎\biomegaMathematical Bold Italic Small Omega
    U+1D74F𝝏\bipartialMathematical Bold Italic Partial Differential
    U+1D750𝝐\biepsilonMathematical Bold Italic Epsilon Symbol
    U+1D751𝝑\bivarthetaMathematical Bold Italic Theta Symbol
    U+1D752𝝒\bivarkappaMathematical Bold Italic Kappa Symbol
    U+1D753𝝓\biphiMathematical Bold Italic Phi Symbol
    U+1D754𝝔\bivarrhoMathematical Bold Italic Rho Symbol
    U+1D755𝝕\bivarpiMathematical Bold Italic Pi Symbol
    U+1D756𝝖\bsansAlphaMathematical Sans-Serif Bold Capital Alpha
    U+1D757𝝗\bsansBetaMathematical Sans-Serif Bold Capital Beta
    U+1D758𝝘\bsansGammaMathematical Sans-Serif Bold Capital Gamma
    U+1D759𝝙\bsansDeltaMathematical Sans-Serif Bold Capital Delta
    U+1D75A𝝚\bsansEpsilonMathematical Sans-Serif Bold Capital Epsilon
    U+1D75B𝝛\bsansZetaMathematical Sans-Serif Bold Capital Zeta
    U+1D75C𝝜\bsansEtaMathematical Sans-Serif Bold Capital Eta
    U+1D75D𝝝\bsansThetaMathematical Sans-Serif Bold Capital Theta
    U+1D75E𝝞\bsansIotaMathematical Sans-Serif Bold Capital Iota
    U+1D75F𝝟\bsansKappaMathematical Sans-Serif Bold Capital Kappa
    U+1D760𝝠\bsansLambdaMathematical Sans-Serif Bold Capital Lamda
    U+1D761𝝡\bsansMuMathematical Sans-Serif Bold Capital Mu
    U+1D762𝝢\bsansNuMathematical Sans-Serif Bold Capital Nu
    U+1D763𝝣\bsansXiMathematical Sans-Serif Bold Capital Xi
    U+1D764𝝤\bsansOmicronMathematical Sans-Serif Bold Capital Omicron
    U+1D765𝝥\bsansPiMathematical Sans-Serif Bold Capital Pi
    U+1D766𝝦\bsansRhoMathematical Sans-Serif Bold Capital Rho
    U+1D767𝝧\bsansvarThetaMathematical Sans-Serif Bold Capital Theta Symbol
    U+1D768𝝨\bsansSigmaMathematical Sans-Serif Bold Capital Sigma
    U+1D769𝝩\bsansTauMathematical Sans-Serif Bold Capital Tau
    U+1D76A𝝪\bsansUpsilonMathematical Sans-Serif Bold Capital Upsilon
    U+1D76B𝝫\bsansPhiMathematical Sans-Serif Bold Capital Phi
    U+1D76C𝝬\bsansChiMathematical Sans-Serif Bold Capital Chi
    U+1D76D𝝭\bsansPsiMathematical Sans-Serif Bold Capital Psi
    U+1D76E𝝮\bsansOmegaMathematical Sans-Serif Bold Capital Omega
    U+1D76F𝝯\bsansnablaMathematical Sans-Serif Bold Nabla
    U+1D770𝝰\bsansalphaMathematical Sans-Serif Bold Small Alpha
    U+1D771𝝱\bsansbetaMathematical Sans-Serif Bold Small Beta
    U+1D772𝝲\bsansgammaMathematical Sans-Serif Bold Small Gamma
    U+1D773𝝳\bsansdeltaMathematical Sans-Serif Bold Small Delta
    U+1D774𝝴\bsansvarepsilonMathematical Sans-Serif Bold Small Epsilon
    U+1D775𝝵\bsanszetaMathematical Sans-Serif Bold Small Zeta
    U+1D776𝝶\bsansetaMathematical Sans-Serif Bold Small Eta
    U+1D777𝝷\bsansthetaMathematical Sans-Serif Bold Small Theta
    U+1D778𝝸\bsansiotaMathematical Sans-Serif Bold Small Iota
    U+1D779𝝹\bsanskappaMathematical Sans-Serif Bold Small Kappa
    U+1D77A𝝺\bsanslambdaMathematical Sans-Serif Bold Small Lamda
    U+1D77B𝝻\bsansmuMathematical Sans-Serif Bold Small Mu
    U+1D77C𝝼\bsansnuMathematical Sans-Serif Bold Small Nu
    U+1D77D𝝽\bsansxiMathematical Sans-Serif Bold Small Xi
    U+1D77E𝝾\bsansomicronMathematical Sans-Serif Bold Small Omicron
    U+1D77F𝝿\bsanspiMathematical Sans-Serif Bold Small Pi
    U+1D780𝞀\bsansrhoMathematical Sans-Serif Bold Small Rho
    U+1D781𝞁\bsansvarsigmaMathematical Sans-Serif Bold Small Final Sigma
    U+1D782𝞂\bsanssigmaMathematical Sans-Serif Bold Small Sigma
    U+1D783𝞃\bsanstauMathematical Sans-Serif Bold Small Tau
    U+1D784𝞄\bsansupsilonMathematical Sans-Serif Bold Small Upsilon
    U+1D785𝞅\bsansvarphiMathematical Sans-Serif Bold Small Phi
    U+1D786𝞆\bsanschiMathematical Sans-Serif Bold Small Chi
    U+1D787𝞇\bsanspsiMathematical Sans-Serif Bold Small Psi
    U+1D788𝞈\bsansomegaMathematical Sans-Serif Bold Small Omega
    U+1D789𝞉\bsanspartialMathematical Sans-Serif Bold Partial Differential
    U+1D78A𝞊\bsansepsilonMathematical Sans-Serif Bold Epsilon Symbol
    U+1D78B𝞋\bsansvarthetaMathematical Sans-Serif Bold Theta Symbol
    U+1D78C𝞌\bsansvarkappaMathematical Sans-Serif Bold Kappa Symbol
    U+1D78D𝞍\bsansphiMathematical Sans-Serif Bold Phi Symbol
    U+1D78E𝞎\bsansvarrhoMathematical Sans-Serif Bold Rho Symbol
    U+1D78F𝞏\bsansvarpiMathematical Sans-Serif Bold Pi Symbol
    U+1D790𝞐\bisansAlphaMathematical Sans-Serif Bold Italic Capital Alpha
    U+1D791𝞑\bisansBetaMathematical Sans-Serif Bold Italic Capital Beta
    U+1D792𝞒\bisansGammaMathematical Sans-Serif Bold Italic Capital Gamma
    U+1D793𝞓\bisansDeltaMathematical Sans-Serif Bold Italic Capital Delta
    U+1D794𝞔\bisansEpsilonMathematical Sans-Serif Bold Italic Capital Epsilon
    U+1D795𝞕\bisansZetaMathematical Sans-Serif Bold Italic Capital Zeta
    U+1D796𝞖\bisansEtaMathematical Sans-Serif Bold Italic Capital Eta
    U+1D797𝞗\bisansThetaMathematical Sans-Serif Bold Italic Capital Theta
    U+1D798𝞘\bisansIotaMathematical Sans-Serif Bold Italic Capital Iota
    U+1D799𝞙\bisansKappaMathematical Sans-Serif Bold Italic Capital Kappa
    U+1D79A𝞚\bisansLambdaMathematical Sans-Serif Bold Italic Capital Lamda
    U+1D79B𝞛\bisansMuMathematical Sans-Serif Bold Italic Capital Mu
    U+1D79C𝞜\bisansNuMathematical Sans-Serif Bold Italic Capital Nu
    U+1D79D𝞝\bisansXiMathematical Sans-Serif Bold Italic Capital Xi
    U+1D79E𝞞\bisansOmicronMathematical Sans-Serif Bold Italic Capital Omicron
    U+1D79F𝞟\bisansPiMathematical Sans-Serif Bold Italic Capital Pi
    U+1D7A0𝞠\bisansRhoMathematical Sans-Serif Bold Italic Capital Rho
    U+1D7A1𝞡\bisansvarThetaMathematical Sans-Serif Bold Italic Capital Theta Symbol
    U+1D7A2𝞢\bisansSigmaMathematical Sans-Serif Bold Italic Capital Sigma
    U+1D7A3𝞣\bisansTauMathematical Sans-Serif Bold Italic Capital Tau
    U+1D7A4𝞤\bisansUpsilonMathematical Sans-Serif Bold Italic Capital Upsilon
    U+1D7A5𝞥\bisansPhiMathematical Sans-Serif Bold Italic Capital Phi
    U+1D7A6𝞦\bisansChiMathematical Sans-Serif Bold Italic Capital Chi
    U+1D7A7𝞧\bisansPsiMathematical Sans-Serif Bold Italic Capital Psi
    U+1D7A8𝞨\bisansOmegaMathematical Sans-Serif Bold Italic Capital Omega
    U+1D7A9𝞩\bisansnablaMathematical Sans-Serif Bold Italic Nabla
    U+1D7AA𝞪\bisansalphaMathematical Sans-Serif Bold Italic Small Alpha
    U+1D7AB𝞫\bisansbetaMathematical Sans-Serif Bold Italic Small Beta
    U+1D7AC𝞬\bisansgammaMathematical Sans-Serif Bold Italic Small Gamma
    U+1D7AD𝞭\bisansdeltaMathematical Sans-Serif Bold Italic Small Delta
    U+1D7AE𝞮\bisansvarepsilonMathematical Sans-Serif Bold Italic Small Epsilon
    U+1D7AF𝞯\bisanszetaMathematical Sans-Serif Bold Italic Small Zeta
    U+1D7B0𝞰\bisansetaMathematical Sans-Serif Bold Italic Small Eta
    U+1D7B1𝞱\bisansthetaMathematical Sans-Serif Bold Italic Small Theta
    U+1D7B2𝞲\bisansiotaMathematical Sans-Serif Bold Italic Small Iota
    U+1D7B3𝞳\bisanskappaMathematical Sans-Serif Bold Italic Small Kappa
    U+1D7B4𝞴\bisanslambdaMathematical Sans-Serif Bold Italic Small Lamda
    U+1D7B5𝞵\bisansmuMathematical Sans-Serif Bold Italic Small Mu
    U+1D7B6𝞶\bisansnuMathematical Sans-Serif Bold Italic Small Nu
    U+1D7B7𝞷\bisansxiMathematical Sans-Serif Bold Italic Small Xi
    U+1D7B8𝞸\bisansomicronMathematical Sans-Serif Bold Italic Small Omicron
    U+1D7B9𝞹\bisanspiMathematical Sans-Serif Bold Italic Small Pi
    U+1D7BA𝞺\bisansrhoMathematical Sans-Serif Bold Italic Small Rho
    U+1D7BB𝞻\bisansvarsigmaMathematical Sans-Serif Bold Italic Small Final Sigma
    U+1D7BC𝞼\bisanssigmaMathematical Sans-Serif Bold Italic Small Sigma
    U+1D7BD𝞽\bisanstauMathematical Sans-Serif Bold Italic Small Tau
    U+1D7BE𝞾\bisansupsilonMathematical Sans-Serif Bold Italic Small Upsilon
    U+1D7BF𝞿\bisansvarphiMathematical Sans-Serif Bold Italic Small Phi
    U+1D7C0𝟀\bisanschiMathematical Sans-Serif Bold Italic Small Chi
    U+1D7C1𝟁\bisanspsiMathematical Sans-Serif Bold Italic Small Psi
    U+1D7C2𝟂\bisansomegaMathematical Sans-Serif Bold Italic Small Omega
    U+1D7C3𝟃\bisanspartialMathematical Sans-Serif Bold Italic Partial Differential
    U+1D7C4𝟄\bisansepsilonMathematical Sans-Serif Bold Italic Epsilon Symbol
    U+1D7C5𝟅\bisansvarthetaMathematical Sans-Serif Bold Italic Theta Symbol
    U+1D7C6𝟆\bisansvarkappaMathematical Sans-Serif Bold Italic Kappa Symbol
    U+1D7C7𝟇\bisansphiMathematical Sans-Serif Bold Italic Phi Symbol
    U+1D7C8𝟈\bisansvarrhoMathematical Sans-Serif Bold Italic Rho Symbol
    U+1D7C9𝟉\bisansvarpiMathematical Sans-Serif Bold Italic Pi Symbol
    U+1D7CA𝟊\bfDigammaMathematical Bold Capital Digamma
    U+1D7CB𝟋\bfdigammaMathematical Bold Small Digamma
    U+1D7CE𝟎\bfzeroMathematical Bold Digit Zero
    U+1D7CF𝟏\bfoneMathematical Bold Digit One
    U+1D7D0𝟐\bftwoMathematical Bold Digit Two
    U+1D7D1𝟑\bfthreeMathematical Bold Digit Three
    U+1D7D2𝟒\bffourMathematical Bold Digit Four
    U+1D7D3𝟓\bffiveMathematical Bold Digit Five
    U+1D7D4𝟔\bfsixMathematical Bold Digit Six
    U+1D7D5𝟕\bfsevenMathematical Bold Digit Seven
    U+1D7D6𝟖\bfeightMathematical Bold Digit Eight
    U+1D7D7𝟗\bfnineMathematical Bold Digit Nine
    U+1D7D8𝟘\bbzeroMathematical Double-Struck Digit Zero
    U+1D7D9𝟙\bboneMathematical Double-Struck Digit One
    U+1D7DA𝟚\bbtwoMathematical Double-Struck Digit Two
    U+1D7DB𝟛\bbthreeMathematical Double-Struck Digit Three
    U+1D7DC𝟜\bbfourMathematical Double-Struck Digit Four
    U+1D7DD𝟝\bbfiveMathematical Double-Struck Digit Five
    U+1D7DE𝟞\bbsixMathematical Double-Struck Digit Six
    U+1D7DF𝟟\bbsevenMathematical Double-Struck Digit Seven
    U+1D7E0𝟠\bbeightMathematical Double-Struck Digit Eight
    U+1D7E1𝟡\bbnineMathematical Double-Struck Digit Nine
    U+1D7E2𝟢\sanszeroMathematical Sans-Serif Digit Zero
    U+1D7E3𝟣\sansoneMathematical Sans-Serif Digit One
    U+1D7E4𝟤\sanstwoMathematical Sans-Serif Digit Two
    U+1D7E5𝟥\sansthreeMathematical Sans-Serif Digit Three
    U+1D7E6𝟦\sansfourMathematical Sans-Serif Digit Four
    U+1D7E7𝟧\sansfiveMathematical Sans-Serif Digit Five
    U+1D7E8𝟨\sanssixMathematical Sans-Serif Digit Six
    U+1D7E9𝟩\sanssevenMathematical Sans-Serif Digit Seven
    U+1D7EA𝟪\sanseightMathematical Sans-Serif Digit Eight
    U+1D7EB𝟫\sansnineMathematical Sans-Serif Digit Nine
    U+1D7EC𝟬\bsanszeroMathematical Sans-Serif Bold Digit Zero
    U+1D7ED𝟭\bsansoneMathematical Sans-Serif Bold Digit One
    U+1D7EE𝟮\bsanstwoMathematical Sans-Serif Bold Digit Two
    U+1D7EF𝟯\bsansthreeMathematical Sans-Serif Bold Digit Three
    U+1D7F0𝟰\bsansfourMathematical Sans-Serif Bold Digit Four
    U+1D7F1𝟱\bsansfiveMathematical Sans-Serif Bold Digit Five
    U+1D7F2𝟲\bsanssixMathematical Sans-Serif Bold Digit Six
    U+1D7F3𝟳\bsanssevenMathematical Sans-Serif Bold Digit Seven
    U+1D7F4𝟴\bsanseightMathematical Sans-Serif Bold Digit Eight
    U+1D7F5𝟵\bsansnineMathematical Sans-Serif Bold Digit Nine
    U+1D7F6𝟶\ttzeroMathematical Monospace Digit Zero
    U+1D7F7𝟷\ttoneMathematical Monospace Digit One
    U+1D7F8𝟸\tttwoMathematical Monospace Digit Two
    U+1D7F9𝟹\ttthreeMathematical Monospace Digit Three
    U+1D7FA𝟺\ttfourMathematical Monospace Digit Four
    U+1D7FB𝟻\ttfiveMathematical Monospace Digit Five
    U+1D7FC𝟼\ttsixMathematical Monospace Digit Six
    U+1D7FD𝟽\ttsevenMathematical Monospace Digit Seven
    U+1D7FE𝟾\tteightMathematical Monospace Digit Eight
    U+1D7FF𝟿\ttnineMathematical Monospace Digit Nine
    U+1F004🀄\:mahjong:Mahjong Tile Red Dragon
    U+1F0CF🃏\:black_joker:Playing Card Black Joker
    U+1F170🅰\:a:Negative Squared Latin Capital Letter A
    U+1F171🅱\:b:Negative Squared Latin Capital Letter B
    U+1F17E🅾\:o2:Negative Squared Latin Capital Letter O
    U+1F17F🅿\:parking:Negative Squared Latin Capital Letter P
    U+1F18E🆎\:ab:Negative Squared Ab
    U+1F191🆑\:cl:Squared Cl
    U+1F192🆒\:cool:Squared Cool
    U+1F193🆓\:free:Squared Free
    U+1F194🆔\:id:Squared Id
    U+1F195🆕\:new:Squared New
    U+1F196🆖\:ng:Squared Ng
    U+1F197🆗\:ok:Squared Ok
    U+1F198🆘\:sos:Squared Sos
    U+1F199🆙\:up:Squared Up With Exclamation Mark
    U+1F19A🆚\:vs:Squared Vs
    U+1F201🈁\:koko:Squared Katakana Koko
    U+1F202🈂\:sa:Squared Katakana Sa
    U+1F21A🈚\:u7121:Squared Cjk Unified Ideograph-7121
    U+1F22F🈯\:u6307:Squared Cjk Unified Ideograph-6307
    U+1F232🈲\:u7981:Squared Cjk Unified Ideograph-7981
    U+1F233🈳\:u7a7a:Squared Cjk Unified Ideograph-7A7A
    U+1F234🈴\:u5408:Squared Cjk Unified Ideograph-5408
    U+1F235🈵\:u6e80:Squared Cjk Unified Ideograph-6E80
    U+1F236🈶\:u6709:Squared Cjk Unified Ideograph-6709
    U+1F237🈷\:u6708:Squared Cjk Unified Ideograph-6708
    U+1F238🈸\:u7533:Squared Cjk Unified Ideograph-7533
    U+1F239🈹\:u5272:Squared Cjk Unified Ideograph-5272
    U+1F23A🈺\:u55b6:Squared Cjk Unified Ideograph-55B6
    U+1F250🉐\:ideograph_advantage:Circled Ideograph Advantage
    U+1F251🉑\:accept:Circled Ideograph Accept
    U+1F300🌀\:cyclone:Cyclone
    U+1F301🌁\:foggy:Foggy
    U+1F302🌂\:closed_umbrella:Closed Umbrella
    U+1F303🌃\:night_with_stars:Night With Stars
    U+1F304🌄\:sunrise_over_mountains:Sunrise Over Mountains
    U+1F305🌅\:sunrise:Sunrise
    U+1F306🌆\:city_sunset:Cityscape At Dusk
    U+1F307🌇\:city_sunrise:Sunset Over Buildings
    U+1F308🌈\:rainbow:Rainbow
    U+1F309🌉\:bridge_at_night:Bridge At Night
    U+1F30A🌊\:ocean:Water Wave
    U+1F30B🌋\:volcano:Volcano
    U+1F30C🌌\:milky_way:Milky Way
    U+1F30D🌍\:earth_africa:Earth Globe Europe-Africa
    U+1F30E🌎\:earth_americas:Earth Globe Americas
    U+1F30F🌏\:earth_asia:Earth Globe Asia-Australia
    U+1F310🌐\:globe_with_meridians:Globe With Meridians
    U+1F311🌑\:new_moon:New Moon Symbol
    U+1F312🌒\:waxing_crescent_moon:Waxing Crescent Moon Symbol
    U+1F313🌓\:first_quarter_moon:First Quarter Moon Symbol
    U+1F314🌔\:moon:Waxing Gibbous Moon Symbol
    U+1F315🌕\:full_moon:Full Moon Symbol
    U+1F316🌖\:waning_gibbous_moon:Waning Gibbous Moon Symbol
    U+1F317🌗\:last_quarter_moon:Last Quarter Moon Symbol
    U+1F318🌘\:waning_crescent_moon:Waning Crescent Moon Symbol
    U+1F319🌙\:crescent_moon:Crescent Moon
    U+1F31A🌚\:new_moon_with_face:New Moon With Face
    U+1F31B🌛\:first_quarter_moon_with_face:First Quarter Moon With Face
    U+1F31C🌜\:last_quarter_moon_with_face:Last Quarter Moon With Face
    U+1F31D🌝\:full_moon_with_face:Full Moon With Face
    U+1F31E🌞\:sun_with_face:Sun With Face
    U+1F31F🌟\:star2:Glowing Star
    U+1F320🌠\:stars:Shooting Star
    U+1F32D🌭\:hotdog:Hot Dog
    U+1F32E🌮\:taco:Taco
    U+1F32F🌯\:burrito:Burrito
    U+1F330🌰\:chestnut:Chestnut
    U+1F331🌱\:seedling:Seedling
    U+1F332🌲\:evergreen_tree:Evergreen Tree
    U+1F333🌳\:deciduous_tree:Deciduous Tree
    U+1F334🌴\:palm_tree:Palm Tree
    U+1F335🌵\:cactus:Cactus
    U+1F337🌷\:tulip:Tulip
    U+1F338🌸\:cherry_blossom:Cherry Blossom
    U+1F339🌹\:rose:Rose
    U+1F33A🌺\:hibiscus:Hibiscus
    U+1F33B🌻\:sunflower:Sunflower
    U+1F33C🌼\:blossom:Blossom
    U+1F33D🌽\:corn:Ear Of Maize
    U+1F33E🌾\:ear_of_rice:Ear Of Rice
    U+1F33F🌿\:herb:Herb
    U+1F340🍀\:four_leaf_clover:Four Leaf Clover
    U+1F341🍁\:maple_leaf:Maple Leaf
    U+1F342🍂\:fallen_leaf:Fallen Leaf
    U+1F343🍃\:leaves:Leaf Fluttering In Wind
    U+1F344🍄\:mushroom:Mushroom
    U+1F345🍅\:tomato:Tomato
    U+1F346🍆\:eggplant:Aubergine
    U+1F347🍇\:grapes:Grapes
    U+1F348🍈\:melon:Melon
    U+1F349🍉\:watermelon:Watermelon
    U+1F34A🍊\:tangerine:Tangerine
    U+1F34B🍋\:lemon:Lemon
    U+1F34C🍌\:banana:Banana
    U+1F34D🍍\:pineapple:Pineapple
    U+1F34E🍎\:apple:Red Apple
    U+1F34F🍏\:green_apple:Green Apple
    U+1F350🍐\:pear:Pear
    U+1F351🍑\:peach:Peach
    U+1F352🍒\:cherries:Cherries
    U+1F353🍓\:strawberry:Strawberry
    U+1F354🍔\:hamburger:Hamburger
    U+1F355🍕\:pizza:Slice Of Pizza
    U+1F356🍖\:meat_on_bone:Meat On Bone
    U+1F357🍗\:poultry_leg:Poultry Leg
    U+1F358🍘\:rice_cracker:Rice Cracker
    U+1F359🍙\:rice_ball:Rice Ball
    U+1F35A🍚\:rice:Cooked Rice
    U+1F35B🍛\:curry:Curry And Rice
    U+1F35C🍜\:ramen:Steaming Bowl
    U+1F35D🍝\:spaghetti:Spaghetti
    U+1F35E🍞\:bread:Bread
    U+1F35F🍟\:fries:French Fries
    U+1F360🍠\:sweet_potato:Roasted Sweet Potato
    U+1F361🍡\:dango:Dango
    U+1F362🍢\:oden:Oden
    U+1F363🍣\:sushi:Sushi
    U+1F364🍤\:fried_shrimp:Fried Shrimp
    U+1F365🍥\:fish_cake:Fish Cake With Swirl Design
    U+1F366🍦\:icecream:Soft Ice Cream
    U+1F367🍧\:shaved_ice:Shaved Ice
    U+1F368🍨\:ice_cream:Ice Cream
    U+1F369🍩\:doughnut:Doughnut
    U+1F36A🍪\:cookie:Cookie
    U+1F36B🍫\:chocolate_bar:Chocolate Bar
    U+1F36C🍬\:candy:Candy
    U+1F36D🍭\:lollipop:Lollipop
    U+1F36E🍮\:custard:Custard
    U+1F36F🍯\:honey_pot:Honey Pot
    U+1F370🍰\:cake:Shortcake
    U+1F371🍱\:bento:Bento Box
    U+1F372🍲\:stew:Pot Of Food
    U+1F373🍳\:fried_egg:Cooking
    U+1F374🍴\:fork_and_knife:Fork And Knife
    U+1F375🍵\:tea:Teacup Without Handle
    U+1F376🍶\:sake:Sake Bottle And Cup
    U+1F377🍷\:wine_glass:Wine Glass
    U+1F378🍸\:cocktail:Cocktail Glass
    U+1F379🍹\:tropical_drink:Tropical Drink
    U+1F37A🍺\:beer:Beer Mug
    U+1F37B🍻\:beers:Clinking Beer Mugs
    U+1F37C🍼\:baby_bottle:Baby Bottle
    U+1F37E🍾\:champagne:Bottle With Popping Cork
    U+1F37F🍿\:popcorn:Popcorn
    U+1F380🎀\:ribbon:Ribbon
    U+1F381🎁\:gift:Wrapped Present
    U+1F382🎂\:birthday:Birthday Cake
    U+1F383🎃\:jack_o_lantern:Jack-O-Lantern
    U+1F384🎄\:christmas_tree:Christmas Tree
    U+1F385🎅\:santa:Father Christmas
    U+1F386🎆\:fireworks:Fireworks
    U+1F387🎇\:sparkler:Firework Sparkler
    U+1F388🎈\:balloon:Balloon
    U+1F389🎉\:tada:Party Popper
    U+1F38A🎊\:confetti_ball:Confetti Ball
    U+1F38B🎋\:tanabata_tree:Tanabata Tree
    U+1F38C🎌\:crossed_flags:Crossed Flags
    U+1F38D🎍\:bamboo:Pine Decoration
    U+1F38E🎎\:dolls:Japanese Dolls
    U+1F38F🎏\:flags:Carp Streamer
    U+1F390🎐\:wind_chime:Wind Chime
    U+1F391🎑\:rice_scene:Moon Viewing Ceremony
    U+1F392🎒\:school_satchel:School Satchel
    U+1F393🎓\:mortar_board:Graduation Cap
    U+1F3A0🎠\:carousel_horse:Carousel Horse
    U+1F3A1🎡\:ferris_wheel:Ferris Wheel
    U+1F3A2🎢\:roller_coaster:Roller Coaster
    U+1F3A3🎣\:fishing_pole_and_fish:Fishing Pole And Fish
    U+1F3A4🎤\:microphone:Microphone
    U+1F3A5🎥\:movie_camera:Movie Camera
    U+1F3A6🎦\:cinema:Cinema
    U+1F3A7🎧\:headphones:Headphone
    U+1F3A8🎨\:art:Artist Palette
    U+1F3A9🎩\:tophat:Top Hat
    U+1F3AA🎪\:circus_tent:Circus Tent
    U+1F3AB🎫\:ticket:Ticket
    U+1F3AC🎬\:clapper:Clapper Board
    U+1F3AD🎭\:performing_arts:Performing Arts
    U+1F3AE🎮\:video_game:Video Game
    U+1F3AF🎯\:dart:Direct Hit
    U+1F3B0🎰\:slot_machine:Slot Machine
    U+1F3B1🎱\:8ball:Billiards
    U+1F3B2🎲\:game_die:Game Die
    U+1F3B3🎳\:bowling:Bowling
    U+1F3B4🎴\:flower_playing_cards:Flower Playing Cards
    U+1F3B5🎵\:musical_note:Musical Note
    U+1F3B6🎶\:notes:Multiple Musical Notes
    U+1F3B7🎷\:saxophone:Saxophone
    U+1F3B8🎸\:guitar:Guitar
    U+1F3B9🎹\:musical_keyboard:Musical Keyboard
    U+1F3BA🎺\:trumpet:Trumpet
    U+1F3BB🎻\:violin:Violin
    U+1F3BC🎼\:musical_score:Musical Score
    U+1F3BD🎽\:running_shirt_with_sash:Running Shirt With Sash
    U+1F3BE🎾\:tennis:Tennis Racquet And Ball
    U+1F3BF🎿\:ski:Ski And Ski Boot
    U+1F3C0🏀\:basketball:Basketball And Hoop
    U+1F3C1🏁\:checkered_flag:Chequered Flag
    U+1F3C2🏂\:snowboarder:Snowboarder
    U+1F3C3🏃\:runner:Runner
    U+1F3C4🏄\:surfer:Surfer
    U+1F3C5🏅\:sports_medal:Sports Medal
    U+1F3C6🏆\:trophy:Trophy
    U+1F3C7🏇\:horse_racing:Horse Racing
    U+1F3C8🏈\:football:American Football
    U+1F3C9🏉\:rugby_football:Rugby Football
    U+1F3CA🏊\:swimmer:Swimmer
    U+1F3CF🏏\:cricket_bat_and_ball:Cricket Bat And Ball
    U+1F3D0🏐\:volleyball:Volleyball
    U+1F3D1🏑\:field_hockey_stick_and_ball:Field Hockey Stick And Ball
    U+1F3D2🏒\:ice_hockey_stick_and_puck:Ice Hockey Stick And Puck
    U+1F3D3🏓\:table_tennis_paddle_and_ball:Table Tennis Paddle And Ball
    U+1F3E0🏠\:house:House Building
    U+1F3E1🏡\:house_with_garden:House With Garden
    U+1F3E2🏢\:office:Office Building
    U+1F3E3🏣\:post_office:Japanese Post Office
    U+1F3E4🏤\:european_post_office:European Post Office
    U+1F3E5🏥\:hospital:Hospital
    U+1F3E6🏦\:bank:Bank
    U+1F3E7🏧\:atm:Automated Teller Machine
    U+1F3E8🏨\:hotel:Hotel
    U+1F3E9🏩\:love_hotel:Love Hotel
    U+1F3EA🏪\:convenience_store:Convenience Store
    U+1F3EB🏫\:school:School
    U+1F3EC🏬\:department_store:Department Store
    U+1F3ED🏭\:factory:Factory
    U+1F3EE🏮\:izakaya_lantern:Izakaya Lantern
    U+1F3EF🏯\:japanese_castle:Japanese Castle
    U+1F3F0🏰\:european_castle:European Castle
    U+1F3F4🏴\:waving_black_flag:Waving Black Flag
    U+1F3F8🏸\:badminton_racquet_and_shuttlecock:Badminton Racquet And Shuttlecock
    U+1F3F9🏹\:bow_and_arrow:Bow And Arrow
    U+1F3FA🏺\:amphora:Amphora
    U+1F3FB🏻\:skin-tone-2:Emoji Modifier Fitzpatrick Type-1-2
    U+1F3FC🏼\:skin-tone-3:Emoji Modifier Fitzpatrick Type-3
    U+1F3FD🏽\:skin-tone-4:Emoji Modifier Fitzpatrick Type-4
    U+1F3FE🏾\:skin-tone-5:Emoji Modifier Fitzpatrick Type-5
    U+1F3FF🏿\:skin-tone-6:Emoji Modifier Fitzpatrick Type-6
    U+1F400🐀\:rat:Rat
    U+1F401🐁\:mouse2:Mouse
    U+1F402🐂\:ox:Ox
    U+1F403🐃\:water_buffalo:Water Buffalo
    U+1F404🐄\:cow2:Cow
    U+1F405🐅\:tiger2:Tiger
    U+1F406🐆\:leopard:Leopard
    U+1F407🐇\:rabbit2:Rabbit
    U+1F408🐈\:cat2:Cat
    U+1F409🐉\:dragon:Dragon
    U+1F40A🐊\:crocodile:Crocodile
    U+1F40B🐋\:whale2:Whale
    U+1F40C🐌\:snail:Snail
    U+1F40D🐍\:snake:Snake
    U+1F40E🐎\:racehorse:Horse
    U+1F40F🐏\:ram:Ram
    U+1F410🐐\:goat:Goat
    U+1F411🐑\:sheep:Sheep
    U+1F412🐒\:monkey:Monkey
    U+1F413🐓\:rooster:Rooster
    U+1F414🐔\:chicken:Chicken
    U+1F415🐕\:dog2:Dog
    U+1F416🐖\:pig2:Pig
    U+1F417🐗\:boar:Boar
    U+1F418🐘\:elephant:Elephant
    U+1F419🐙\:octopus:Octopus
    U+1F41A🐚\:shell:Spiral Shell
    U+1F41B🐛\:bug:Bug
    U+1F41C🐜\:ant:Ant
    U+1F41D🐝\:bee:Honeybee
    U+1F41E🐞\:ladybug:Lady Beetle
    U+1F41F🐟\:fish:Fish
    U+1F420🐠\:tropical_fish:Tropical Fish
    U+1F421🐡\:blowfish:Blowfish
    U+1F422🐢\:turtle:Turtle
    U+1F423🐣\:hatching_chick:Hatching Chick
    U+1F424🐤\:baby_chick:Baby Chick
    U+1F425🐥\:hatched_chick:Front-Facing Baby Chick
    U+1F426🐦\:bird:Bird
    U+1F427🐧\:penguin:Penguin
    U+1F428🐨\:koala:Koala
    U+1F429🐩\:poodle:Poodle
    U+1F42A🐪\:dromedary_camel:Dromedary Camel
    U+1F42B🐫\:camel:Bactrian Camel
    U+1F42C🐬\:dolphin:Dolphin
    U+1F42D🐭\:mouse:Mouse Face
    U+1F42E🐮\:cow:Cow Face
    U+1F42F🐯\:tiger:Tiger Face
    U+1F430🐰\:rabbit:Rabbit Face
    U+1F431🐱\:cat:Cat Face
    U+1F432🐲\:dragon_face:Dragon Face
    U+1F433🐳\:whale:Spouting Whale
    U+1F434🐴\:horse:Horse Face
    U+1F435🐵\:monkey_face:Monkey Face
    U+1F436🐶\:dog:Dog Face
    U+1F437🐷\:pig:Pig Face
    U+1F438🐸\:frog:Frog Face
    U+1F439🐹\:hamster:Hamster Face
    U+1F43A🐺\:wolf:Wolf Face
    U+1F43B🐻\:bear:Bear Face
    U+1F43C🐼\:panda_face:Panda Face
    U+1F43D🐽\:pig_nose:Pig Nose
    U+1F43E🐾\:feet:Paw Prints
    U+1F440👀\:eyes:Eyes
    U+1F442👂\:ear:Ear
    U+1F443👃\:nose:Nose
    U+1F444👄\:lips:Mouth
    U+1F445👅\:tongue:Tongue
    U+1F446👆\:point_up_2:White Up Pointing Backhand Index
    U+1F447👇\:point_down:White Down Pointing Backhand Index
    U+1F448👈\:point_left:White Left Pointing Backhand Index
    U+1F449👉\:point_right:White Right Pointing Backhand Index
    U+1F44A👊\:facepunch:Fisted Hand Sign
    U+1F44B👋\:wave:Waving Hand Sign
    U+1F44C👌\:ok_hand:Ok Hand Sign
    U+1F44D👍\:+1:Thumbs Up Sign
    U+1F44E👎\:-1:Thumbs Down Sign
    U+1F44F👏\:clap:Clapping Hands Sign
    U+1F450👐\:open_hands:Open Hands Sign
    U+1F451👑\:crown:Crown
    U+1F452👒\:womans_hat:Womans Hat
    U+1F453👓\:eyeglasses:Eyeglasses
    U+1F454👔\:necktie:Necktie
    U+1F455👕\:shirt:T-Shirt
    U+1F456👖\:jeans:Jeans
    U+1F457👗\:dress:Dress
    U+1F458👘\:kimono:Kimono
    U+1F459👙\:bikini:Bikini
    U+1F45A👚\:womans_clothes:Womans Clothes
    U+1F45B👛\:purse:Purse
    U+1F45C👜\:handbag:Handbag
    U+1F45D👝\:pouch:Pouch
    U+1F45E👞\:mans_shoe:Mans Shoe
    U+1F45F👟\:athletic_shoe:Athletic Shoe
    U+1F460👠\:high_heel:High-Heeled Shoe
    U+1F461👡\:sandal:Womans Sandal
    U+1F462👢\:boot:Womans Boots
    U+1F463👣\:footprints:Footprints
    U+1F464👤\:bust_in_silhouette:Bust In Silhouette
    U+1F465👥\:busts_in_silhouette:Busts In Silhouette
    U+1F466👦\:boy:Boy
    U+1F467👧\:girl:Girl
    U+1F468👨\:man:Man
    U+1F469👩\:woman:Woman
    U+1F46A👪\:family:Family
    U+1F46B👫\:couple:, \:man_and_woman_holding_hands:Man And Woman Holding Hands
    U+1F46C👬\:two_men_holding_hands:Two Men Holding Hands
    U+1F46D👭\:two_women_holding_hands:Two Women Holding Hands
    U+1F46E👮\:cop:Police Officer
    U+1F46F👯\:dancers:Woman With Bunny Ears
    U+1F470👰\:bride_with_veil:Bride With Veil
    U+1F471👱\:person_with_blond_hair:Person With Blond Hair
    U+1F472👲\:man_with_gua_pi_mao:Man With Gua Pi Mao
    U+1F473👳\:man_with_turban:Man With Turban
    U+1F474👴\:older_man:Older Man
    U+1F475👵\:older_woman:Older Woman
    U+1F476👶\:baby:Baby
    U+1F477👷\:construction_worker:Construction Worker
    U+1F478👸\:princess:Princess
    U+1F479👹\:japanese_ogre:Japanese Ogre
    U+1F47A👺\:japanese_goblin:Japanese Goblin
    U+1F47B👻\:ghost:Ghost
    U+1F47C👼\:angel:Baby Angel
    U+1F47D👽\:alien:Extraterrestrial Alien
    U+1F47E👾\:space_invader:Alien Monster
    U+1F47F👿\:imp:Imp
    U+1F480💀\:skull:Skull
    U+1F481💁\:information_desk_person:Information Desk Person
    U+1F482💂\:guardsman:Guardsman
    U+1F483💃\:dancer:Dancer
    U+1F484💄\:lipstick:Lipstick
    U+1F485💅\:nail_care:Nail Polish
    U+1F486💆\:massage:Face Massage
    U+1F487💇\:haircut:Haircut
    U+1F488💈\:barber:Barber Pole
    U+1F489💉\:syringe:Syringe
    U+1F48A💊\:pill:Pill
    U+1F48B💋\:kiss:Kiss Mark
    U+1F48C💌\:love_letter:Love Letter
    U+1F48D💍\:ring:Ring
    U+1F48E💎\:gem:Gem Stone
    U+1F48F💏\:couplekiss:Kiss
    U+1F490💐\:bouquet:Bouquet
    U+1F491💑\:couple_with_heart:Couple With Heart
    U+1F492💒\:wedding:Wedding
    U+1F493💓\:heartbeat:Beating Heart
    U+1F494💔\:broken_heart:Broken Heart
    U+1F495💕\:two_hearts:Two Hearts
    U+1F496💖\:sparkling_heart:Sparkling Heart
    U+1F497💗\:heartpulse:Growing Heart
    U+1F498💘\:cupid:Heart With Arrow
    U+1F499💙\:blue_heart:Blue Heart
    U+1F49A💚\:green_heart:Green Heart
    U+1F49B💛\:yellow_heart:Yellow Heart
    U+1F49C💜\:purple_heart:Purple Heart
    U+1F49D💝\:gift_heart:Heart With Ribbon
    U+1F49E💞\:revolving_hearts:Revolving Hearts
    U+1F49F💟\:heart_decoration:Heart Decoration
    U+1F4A0💠\:diamond_shape_with_a_dot_inside:Diamond Shape With A Dot Inside
    U+1F4A1💡\:bulb:Electric Light Bulb
    U+1F4A2💢\:anger:Anger Symbol
    U+1F4A3💣\:bomb:Bomb
    U+1F4A4💤\:zzz:Sleeping Symbol
    U+1F4A5💥\:boom:Collision Symbol
    U+1F4A6💦\:sweat_drops:Splashing Sweat Symbol
    U+1F4A7💧\:droplet:Droplet
    U+1F4A8💨\:dash:Dash Symbol
    U+1F4A9💩\:hankey:Pile Of Poo
    U+1F4AA💪\:muscle:Flexed Biceps
    U+1F4AB💫\:dizzy:Dizzy Symbol
    U+1F4AC💬\:speech_balloon:Speech Balloon
    U+1F4AD💭\:thought_balloon:Thought Balloon
    U+1F4AE💮\:white_flower:White Flower
    U+1F4AF💯\:100:Hundred Points Symbol
    U+1F4B0💰\:moneybag:Money Bag
    U+1F4B1💱\:currency_exchange:Currency Exchange
    U+1F4B2💲\:heavy_dollar_sign:Heavy Dollar Sign
    U+1F4B3💳\:credit_card:Credit Card
    U+1F4B4💴\:yen:Banknote With Yen Sign
    U+1F4B5💵\:dollar:Banknote With Dollar Sign
    U+1F4B6💶\:euro:Banknote With Euro Sign
    U+1F4B7💷\:pound:Banknote With Pound Sign
    U+1F4B8💸\:money_with_wings:Money With Wings
    U+1F4B9💹\:chart:Chart With Upwards Trend And Yen Sign
    U+1F4BA💺\:seat:Seat
    U+1F4BB💻\:computer:Personal Computer
    U+1F4BC💼\:briefcase:Briefcase
    U+1F4BD💽\:minidisc:Minidisc
    U+1F4BE💾\:floppy_disk:Floppy Disk
    U+1F4BF💿\:cd:Optical Disc
    U+1F4C0📀\:dvd:Dvd
    U+1F4C1📁\:file_folder:File Folder
    U+1F4C2📂\:open_file_folder:Open File Folder
    U+1F4C3📃\:page_with_curl:Page With Curl
    U+1F4C4📄\:page_facing_up:Page Facing Up
    U+1F4C5📅\:date:Calendar
    U+1F4C6📆\:calendar:Tear-Off Calendar
    U+1F4C7📇\:card_index:Card Index
    U+1F4C8📈\:chart_with_upwards_trend:Chart With Upwards Trend
    U+1F4C9📉\:chart_with_downwards_trend:Chart With Downwards Trend
    U+1F4CA📊\:bar_chart:Bar Chart
    U+1F4CB📋\:clipboard:Clipboard
    U+1F4CC📌\:pushpin:Pushpin
    U+1F4CD📍\:round_pushpin:Round Pushpin
    U+1F4CE📎\:paperclip:Paperclip
    U+1F4CF📏\:straight_ruler:Straight Ruler
    U+1F4D0📐\:triangular_ruler:Triangular Ruler
    U+1F4D1📑\:bookmark_tabs:Bookmark Tabs
    U+1F4D2📒\:ledger:Ledger
    U+1F4D3📓\:notebook:Notebook
    U+1F4D4📔\:notebook_with_decorative_cover:Notebook With Decorative Cover
    U+1F4D5📕\:closed_book:Closed Book
    U+1F4D6📖\:book:Open Book
    U+1F4D7📗\:green_book:Green Book
    U+1F4D8📘\:blue_book:Blue Book
    U+1F4D9📙\:orange_book:Orange Book
    U+1F4DA📚\:books:Books
    U+1F4DB📛\:name_badge:Name Badge
    U+1F4DC📜\:scroll:Scroll
    U+1F4DD📝\:memo:Memo
    U+1F4DE📞\:telephone_receiver:Telephone Receiver
    U+1F4DF📟\:pager:Pager
    U+1F4E0📠\:fax:Fax Machine
    U+1F4E1📡\:satellite:, \:satellite_antenna:Satellite Antenna
    U+1F4E2📢\:loudspeaker:Public Address Loudspeaker
    U+1F4E3📣\:mega:Cheering Megaphone
    U+1F4E4📤\:outbox_tray:Outbox Tray
    U+1F4E5📥\:inbox_tray:Inbox Tray
    U+1F4E6📦\:package:Package
    U+1F4E7📧\:e-mail:E-Mail Symbol
    U+1F4E8📨\:incoming_envelope:Incoming Envelope
    U+1F4E9📩\:envelope_with_arrow:Envelope With Downwards Arrow Above
    U+1F4EA📪\:mailbox_closed:Closed Mailbox With Lowered Flag
    U+1F4EB📫\:mailbox:Closed Mailbox With Raised Flag
    U+1F4EC📬\:mailbox_with_mail:Open Mailbox With Raised Flag
    U+1F4ED📭\:mailbox_with_no_mail:Open Mailbox With Lowered Flag
    U+1F4EE📮\:postbox:Postbox
    U+1F4EF📯\:postal_horn:Postal Horn
    U+1F4F0📰\:newspaper:Newspaper
    U+1F4F1📱\:iphone:Mobile Phone
    U+1F4F2📲\:calling:Mobile Phone With Rightwards Arrow At Left
    U+1F4F3📳\:vibration_mode:Vibration Mode
    U+1F4F4📴\:mobile_phone_off:Mobile Phone Off
    U+1F4F5📵\:no_mobile_phones:No Mobile Phones
    U+1F4F6📶\:signal_strength:Antenna With Bars
    U+1F4F7📷\:camera:Camera
    U+1F4F8📸\:camera_with_flash:Camera With Flash
    U+1F4F9📹\:video_camera:Video Camera
    U+1F4FA📺\:tv:Television
    U+1F4FB📻\:radio:Radio
    U+1F4FC📼\:vhs:Videocassette
    U+1F4FF📿\:prayer_beads:Prayer Beads
    U+1F500🔀\:twisted_rightwards_arrows:Twisted Rightwards Arrows
    U+1F501🔁\:repeat:Clockwise Rightwards And Leftwards Open Circle Arrows
    U+1F502🔂\:repeat_one:Clockwise Rightwards And Leftwards Open Circle Arrows With Circled One Overlay
    U+1F503🔃\:arrows_clockwise:Clockwise Downwards And Upwards Open Circle Arrows
    U+1F504🔄\:arrows_counterclockwise:Anticlockwise Downwards And Upwards Open Circle Arrows
    U+1F505🔅\:low_brightness:Low Brightness Symbol
    U+1F506🔆\:high_brightness:High Brightness Symbol
    U+1F507🔇\:mute:Speaker With Cancellation Stroke
    U+1F508🔈\:speaker:Speaker
    U+1F509🔉\:sound:Speaker With One Sound Wave
    U+1F50A🔊\:loud_sound:Speaker With Three Sound Waves
    U+1F50B🔋\:battery:Battery
    U+1F50C🔌\:electric_plug:Electric Plug
    U+1F50D🔍\:mag:Left-Pointing Magnifying Glass
    U+1F50E🔎\:mag_right:Right-Pointing Magnifying Glass
    U+1F50F🔏\:lock_with_ink_pen:Lock With Ink Pen
    U+1F510🔐\:closed_lock_with_key:Closed Lock With Key
    U+1F511🔑\:key:Key
    U+1F512🔒\:lock:Lock
    U+1F513🔓\:unlock:Open Lock
    U+1F514🔔\:bell:Bell
    U+1F515🔕\:no_bell:Bell With Cancellation Stroke
    U+1F516🔖\:bookmark:Bookmark
    U+1F517🔗\:link:Link Symbol
    U+1F518🔘\:radio_button:Radio Button
    U+1F519🔙\:back:Back With Leftwards Arrow Above
    U+1F51A🔚\:end:End With Leftwards Arrow Above
    U+1F51B🔛\:on:On With Exclamation Mark With Left Right Arrow Above
    U+1F51C🔜\:soon:Soon With Rightwards Arrow Above
    U+1F51D🔝\:top:Top With Upwards Arrow Above
    U+1F51E🔞\:underage:No One Under Eighteen Symbol
    U+1F51F🔟\:keycap_ten:Keycap Ten
    U+1F520🔠\:capital_abcd:Input Symbol For Latin Capital Letters
    U+1F521🔡\:abcd:Input Symbol For Latin Small Letters
    U+1F522🔢\:1234:Input Symbol For Numbers
    U+1F523🔣\:symbols:Input Symbol For Symbols
    U+1F524🔤\:abc:Input Symbol For Latin Letters
    U+1F525🔥\:fire:Fire
    U+1F526🔦\:flashlight:Electric Torch
    U+1F527🔧\:wrench:Wrench
    U+1F528🔨\:hammer:Hammer
    U+1F529🔩\:nut_and_bolt:Nut And Bolt
    U+1F52A🔪\:hocho:Hocho
    U+1F52B🔫\:gun:Pistol
    U+1F52C🔬\:microscope:Microscope
    U+1F52D🔭\:telescope:Telescope
    U+1F52E🔮\:crystal_ball:Crystal Ball
    U+1F52F🔯\:six_pointed_star:Six Pointed Star With Middle Dot
    U+1F530🔰\:beginner:Japanese Symbol For Beginner
    U+1F531🔱\:trident:Trident Emblem
    U+1F532🔲\:black_square_button:Black Square Button
    U+1F533🔳\:white_square_button:White Square Button
    U+1F534🔴\:red_circle:Large Red Circle
    U+1F535🔵\:large_blue_circle:Large Blue Circle
    U+1F536🔶\:large_orange_diamond:Large Orange Diamond
    U+1F537🔷\:large_blue_diamond:Large Blue Diamond
    U+1F538🔸\:small_orange_diamond:Small Orange Diamond
    U+1F539🔹\:small_blue_diamond:Small Blue Diamond
    U+1F53A🔺\:small_red_triangle:Up-Pointing Red Triangle
    U+1F53B🔻\:small_red_triangle_down:Down-Pointing Red Triangle
    U+1F53C🔼\:arrow_up_small:Up-Pointing Small Red Triangle
    U+1F53D🔽\:arrow_down_small:Down-Pointing Small Red Triangle
    U+1F54B🕋\:kaaba:Kaaba
    U+1F54C🕌\:mosque:Mosque
    U+1F54D🕍\:synagogue:Synagogue
    U+1F54E🕎\:menorah_with_nine_branches:Menorah With Nine Branches
    U+1F550🕐\:clock1:Clock Face One Oclock
    U+1F551🕑\:clock2:Clock Face Two Oclock
    U+1F552🕒\:clock3:Clock Face Three Oclock
    U+1F553🕓\:clock4:Clock Face Four Oclock
    U+1F554🕔\:clock5:Clock Face Five Oclock
    U+1F555🕕\:clock6:Clock Face Six Oclock
    U+1F556🕖\:clock7:Clock Face Seven Oclock
    U+1F557🕗\:clock8:Clock Face Eight Oclock
    U+1F558🕘\:clock9:Clock Face Nine Oclock
    U+1F559🕙\:clock10:Clock Face Ten Oclock
    U+1F55A🕚\:clock11:Clock Face Eleven Oclock
    U+1F55B🕛\:clock12:Clock Face Twelve Oclock
    U+1F55C🕜\:clock130:Clock Face One-Thirty
    U+1F55D🕝\:clock230:Clock Face Two-Thirty
    U+1F55E🕞\:clock330:Clock Face Three-Thirty
    U+1F55F🕟\:clock430:Clock Face Four-Thirty
    U+1F560🕠\:clock530:Clock Face Five-Thirty
    U+1F561🕡\:clock630:Clock Face Six-Thirty
    U+1F562🕢\:clock730:Clock Face Seven-Thirty
    U+1F563🕣\:clock830:Clock Face Eight-Thirty
    U+1F564🕤\:clock930:Clock Face Nine-Thirty
    U+1F565🕥\:clock1030:Clock Face Ten-Thirty
    U+1F566🕦\:clock1130:Clock Face Eleven-Thirty
    U+1F567🕧\:clock1230:Clock Face Twelve-Thirty
    U+1F57A🕺\:man_dancing:Man Dancing
    U+1F595🖕\:middle_finger:Reversed Hand With Middle Finger Extended
    U+1F596🖖\:spock-hand:Raised Hand With Part Between Middle And Ring Fingers
    U+1F5A4🖤\:black_heart:Black Heart
    U+1F5FB🗻\:mount_fuji:Mount Fuji
    U+1F5FC🗼\:tokyo_tower:Tokyo Tower
    U+1F5FD🗽\:statue_of_liberty:Statue Of Liberty
    U+1F5FE🗾\:japan:Silhouette Of Japan
    U+1F5FF🗿\:moyai:Moyai
    U+1F600😀\:grinning:Grinning Face
    U+1F601😁\:grin:Grinning Face With Smiling Eyes
    U+1F602😂\:joy:Face With Tears Of Joy
    U+1F603😃\:smiley:Smiling Face With Open Mouth
    U+1F604😄\:smile:Smiling Face With Open Mouth And Smiling Eyes
    U+1F605😅\:sweat_smile:Smiling Face With Open Mouth And Cold Sweat
    U+1F606😆\:laughing:Smiling Face With Open Mouth And Tightly-Closed Eyes
    U+1F607😇\:innocent:Smiling Face With Halo
    U+1F608😈\:smiling_imp:Smiling Face With Horns
    U+1F609😉\:wink:Winking Face
    U+1F60A😊\:blush:Smiling Face With Smiling Eyes
    U+1F60B😋\:yum:Face Savouring Delicious Food
    U+1F60C😌\:relieved:Relieved Face
    U+1F60D😍\:heart_eyes:Smiling Face With Heart-Shaped Eyes
    U+1F60E😎\:sunglasses:Smiling Face With Sunglasses
    U+1F60F😏\:smirk:Smirking Face
    U+1F610😐\:neutral_face:Neutral Face
    U+1F611😑\:expressionless:Expressionless Face
    U+1F612😒\:unamused:Unamused Face
    U+1F613😓\:sweat:Face With Cold Sweat
    U+1F614😔\:pensive:Pensive Face
    U+1F615😕\:confused:Confused Face
    U+1F616😖\:confounded:Confounded Face
    U+1F617😗\:kissing:Kissing Face
    U+1F618😘\:kissing_heart:Face Throwing A Kiss
    U+1F619😙\:kissing_smiling_eyes:Kissing Face With Smiling Eyes
    U+1F61A😚\:kissing_closed_eyes:Kissing Face With Closed Eyes
    U+1F61B😛\:stuck_out_tongue:Face With Stuck-Out Tongue
    U+1F61C😜\:stuck_out_tongue_winking_eye:Face With Stuck-Out Tongue And Winking Eye
    U+1F61D😝\:stuck_out_tongue_closed_eyes:Face With Stuck-Out Tongue And Tightly-Closed Eyes
    U+1F61E😞\:disappointed:Disappointed Face
    U+1F61F😟\:worried:Worried Face
    U+1F620😠\:angry:Angry Face
    U+1F621😡\:rage:Pouting Face
    U+1F622😢\:cry:Crying Face
    U+1F623😣\:persevere:Persevering Face
    U+1F624😤\:triumph:Face With Look Of Triumph
    U+1F625😥\:disappointed_relieved:Disappointed But Relieved Face
    U+1F626😦\:frowning:Frowning Face With Open Mouth
    U+1F627😧\:anguished:Anguished Face
    U+1F628😨\:fearful:Fearful Face
    U+1F629😩\:weary:Weary Face
    U+1F62A😪\:sleepy:Sleepy Face
    U+1F62B😫\:tired_face:Tired Face
    U+1F62C😬\:grimacing:Grimacing Face
    U+1F62D😭\:sob:Loudly Crying Face
    U+1F62E😮\:open_mouth:Face With Open Mouth
    U+1F62F😯\:hushed:Hushed Face
    U+1F630😰\:cold_sweat:Face With Open Mouth And Cold Sweat
    U+1F631😱\:scream:Face Screaming In Fear
    U+1F632😲\:astonished:Astonished Face
    U+1F633😳\:flushed:Flushed Face
    U+1F634😴\:sleeping:Sleeping Face
    U+1F635😵\:dizzy_face:Dizzy Face
    U+1F636😶\:no_mouth:Face Without Mouth
    U+1F637😷\:mask:Face With Medical Mask
    U+1F638😸\:smile_cat:Grinning Cat Face With Smiling Eyes
    U+1F639😹\:joy_cat:Cat Face With Tears Of Joy
    U+1F63A😺\:smiley_cat:Smiling Cat Face With Open Mouth
    U+1F63B😻\:heart_eyes_cat:Smiling Cat Face With Heart-Shaped Eyes
    U+1F63C😼\:smirk_cat:Cat Face With Wry Smile
    U+1F63D😽\:kissing_cat:Kissing Cat Face With Closed Eyes
    U+1F63E😾\:pouting_cat:Pouting Cat Face
    U+1F63F😿\:crying_cat_face:Crying Cat Face
    U+1F640🙀\:scream_cat:Weary Cat Face
    U+1F641🙁\:slightly_frowning_face:Slightly Frowning Face
    U+1F642🙂\:slightly_smiling_face:Slightly Smiling Face
    U+1F643🙃\:upside_down_face:Upside-Down Face
    U+1F644🙄\:face_with_rolling_eyes:Face With Rolling Eyes
    U+1F645🙅\:no_good:Face With No Good Gesture
    U+1F646🙆\:ok_woman:Face With Ok Gesture
    U+1F647🙇\:bow:Person Bowing Deeply
    U+1F648🙈\:see_no_evil:See-No-Evil Monkey
    U+1F649🙉\:hear_no_evil:Hear-No-Evil Monkey
    U+1F64A🙊\:speak_no_evil:Speak-No-Evil Monkey
    U+1F64B🙋\:raising_hand:Happy Person Raising One Hand
    U+1F64C🙌\:raised_hands:Person Raising Both Hands In Celebration
    U+1F64D🙍\:person_frowning:Person Frowning
    U+1F64E🙎\:person_with_pouting_face:Person With Pouting Face
    U+1F64F🙏\:pray:Person With Folded Hands
    U+1F680🚀\:rocket:Rocket
    U+1F681🚁\:helicopter:Helicopter
    U+1F682🚂\:steam_locomotive:Steam Locomotive
    U+1F683🚃\:railway_car:Railway Car
    U+1F684🚄\:bullettrain_side:High-Speed Train
    U+1F685🚅\:bullettrain_front:High-Speed Train With Bullet Nose
    U+1F686🚆\:train2:Train
    U+1F687🚇\:metro:Metro
    U+1F688🚈\:light_rail:Light Rail
    U+1F689🚉\:station:Station
    U+1F68A🚊\:tram:Tram
    U+1F68B🚋\:train:Tram Car
    U+1F68C🚌\:bus:Bus
    U+1F68D🚍\:oncoming_bus:Oncoming Bus
    U+1F68E🚎\:trolleybus:Trolleybus
    U+1F68F🚏\:busstop:Bus Stop
    U+1F690🚐\:minibus:Minibus
    U+1F691🚑\:ambulance:Ambulance
    U+1F692🚒\:fire_engine:Fire Engine
    U+1F693🚓\:police_car:Police Car
    U+1F694🚔\:oncoming_police_car:Oncoming Police Car
    U+1F695🚕\:taxi:Taxi
    U+1F696🚖\:oncoming_taxi:Oncoming Taxi
    U+1F697🚗\:car:Automobile
    U+1F698🚘\:oncoming_automobile:Oncoming Automobile
    U+1F699🚙\:blue_car:Recreational Vehicle
    U+1F69A🚚\:truck:Delivery Truck
    U+1F69B🚛\:articulated_lorry:Articulated Lorry
    U+1F69C🚜\:tractor:Tractor
    U+1F69D🚝\:monorail:Monorail
    U+1F69E🚞\:mountain_railway:Mountain Railway
    U+1F69F🚟\:suspension_railway:Suspension Railway
    U+1F6A0🚠\:mountain_cableway:Mountain Cableway
    U+1F6A1🚡\:aerial_tramway:Aerial Tramway
    U+1F6A2🚢\:ship:Ship
    U+1F6A3🚣\:rowboat:Rowboat
    U+1F6A4🚤\:speedboat:Speedboat
    U+1F6A5🚥\:traffic_light:Horizontal Traffic Light
    U+1F6A6🚦\:vertical_traffic_light:Vertical Traffic Light
    U+1F6A7🚧\:construction:Construction Sign
    U+1F6A8🚨\:rotating_light:Police Cars Revolving Light
    U+1F6A9🚩\:triangular_flag_on_post:Triangular Flag On Post
    U+1F6AA🚪\:door:Door
    U+1F6AB🚫\:no_entry_sign:No Entry Sign
    U+1F6AC🚬\:smoking:Smoking Symbol
    U+1F6AD🚭\:no_smoking:No Smoking Symbol
    U+1F6AE🚮\:put_litter_in_its_place:Put Litter In Its Place Symbol
    U+1F6AF🚯\:do_not_litter:Do Not Litter Symbol
    U+1F6B0🚰\:potable_water:Potable Water Symbol
    U+1F6B1🚱\:non-potable_water:Non-Potable Water Symbol
    U+1F6B2🚲\:bike:Bicycle
    U+1F6B3🚳\:no_bicycles:No Bicycles
    U+1F6B4🚴\:bicyclist:Bicyclist
    U+1F6B5🚵\:mountain_bicyclist:Mountain Bicyclist
    U+1F6B6🚶\:walking:Pedestrian
    U+1F6B7🚷\:no_pedestrians:No Pedestrians
    U+1F6B8🚸\:children_crossing:Children Crossing
    U+1F6B9🚹\:mens:Mens Symbol
    U+1F6BA🚺\:womens:Womens Symbol
    U+1F6BB🚻\:restroom:Restroom
    U+1F6BC🚼\:baby_symbol:Baby Symbol
    U+1F6BD🚽\:toilet:Toilet
    U+1F6BE🚾\:wc:Water Closet
    U+1F6BF🚿\:shower:Shower
    U+1F6C0🛀\:bath:Bath
    U+1F6C1🛁\:bathtub:Bathtub
    U+1F6C2🛂\:passport_control:Passport Control
    U+1F6C3🛃\:customs:Customs
    U+1F6C4🛄\:baggage_claim:Baggage Claim
    U+1F6C5🛅\:left_luggage:Left Luggage
    U+1F6CC🛌\:sleeping_accommodation:Sleeping Accommodation
    U+1F6D0🛐\:place_of_worship:Place Of Worship
    U+1F6D1🛑\:octagonal_sign:Octagonal Sign
    U+1F6D2🛒\:shopping_trolley:Shopping Trolley
    U+1F6D5🛕\:hindu_temple:Hindu Temple
    U+1F6D6🛖\:hut:Hut
    U+1F6D7🛗\:elevator:Elevator
    U+1F6DC🛜\:wireless:(No Unicode name)
    U+1F6DD🛝\:playground_slide:(No Unicode name)
    U+1F6DE🛞\:wheel:(No Unicode name)
    U+1F6DF🛟\:ring_buoy:(No Unicode name)
    U+1F6EB🛫\:airplane_departure:Airplane Departure
    U+1F6EC🛬\:airplane_arriving:Airplane Arriving
    U+1F6F4🛴\:scooter:Scooter
    U+1F6F5🛵\:motor_scooter:Motor Scooter
    U+1F6F6🛶\:canoe:Canoe
    U+1F6F7🛷\:sled:Sled
    U+1F6F8🛸\:flying_saucer:Flying Saucer
    U+1F6F9🛹\:skateboard:Skateboard
    U+1F6FA🛺\:auto_rickshaw:Auto Rickshaw
    U+1F6FB🛻\:pickup_truck:Pickup Truck
    U+1F6FC🛼\:roller_skate:Roller Skate
    U+1F7E0🟠\:large_orange_circle:Large Orange Circle
    U+1F7E1🟡\:large_yellow_circle:Large Yellow Circle
    U+1F7E2🟢\:large_green_circle:Large Green Circle
    U+1F7E3🟣\:large_purple_circle:Large Purple Circle
    U+1F7E4🟤\:large_brown_circle:Large Brown Circle
    U+1F7E5🟥\:large_red_square:Large Red Square
    U+1F7E6🟦\:large_blue_square:Large Blue Square
    U+1F7E7🟧\:large_orange_square:Large Orange Square
    U+1F7E8🟨\:large_yellow_square:Large Yellow Square
    U+1F7E9🟩\:large_green_square:Large Green Square
    U+1F7EA🟪\:large_purple_square:Large Purple Square
    U+1F7EB🟫\:large_brown_square:Large Brown Square
    U+1F7F0🟰\:heavy_equals_sign:(No Unicode name)
    U+1F90C🤌\:pinched_fingers:Pinched Fingers
    U+1F90D🤍\:white_heart:White Heart
    U+1F90E🤎\:brown_heart:Brown Heart
    U+1F90F🤏\:pinching_hand:Pinching Hand
    U+1F910🤐\:zipper_mouth_face:Zipper-Mouth Face
    U+1F911🤑\:money_mouth_face:Money-Mouth Face
    U+1F912🤒\:face_with_thermometer:Face With Thermometer
    U+1F913🤓\:nerd_face:Nerd Face
    U+1F914🤔\:thinking_face:Thinking Face
    U+1F915🤕\:face_with_head_bandage:Face With Head-Bandage
    U+1F916🤖\:robot_face:Robot Face
    U+1F917🤗\:hugging_face:Hugging Face
    U+1F918🤘\:the_horns:Sign Of The Horns
    U+1F919🤙\:call_me_hand:Call Me Hand
    U+1F91A🤚\:raised_back_of_hand:Raised Back Of Hand
    U+1F91B🤛\:left-facing_fist:Left-Facing Fist
    U+1F91C🤜\:right-facing_fist:Right-Facing Fist
    U+1F91D🤝\:handshake:Handshake
    U+1F91E🤞\:crossed_fingers:Hand With Index And Middle Fingers Crossed
    U+1F91F🤟\:i_love_you_hand_sign:I Love You Hand Sign
    U+1F920🤠\:face_with_cowboy_hat:Face With Cowboy Hat
    U+1F921🤡\:clown_face:Clown Face
    U+1F922🤢\:nauseated_face:Nauseated Face
    U+1F923🤣\:rolling_on_the_floor_laughing:Rolling On The Floor Laughing
    U+1F924🤤\:drooling_face:Drooling Face
    U+1F925🤥\:lying_face:Lying Face
    U+1F926🤦\:face_palm:Face Palm
    U+1F927🤧\:sneezing_face:Sneezing Face
    U+1F928🤨\:face_with_raised_eyebrow:Face With One Eyebrow Raised
    U+1F929🤩\:star-struck:Grinning Face With Star Eyes
    U+1F92A🤪\:zany_face:Grinning Face With One Large And One Small Eye
    U+1F92B🤫\:shushing_face:Face With Finger Covering Closed Lips
    U+1F92C🤬\:face_with_symbols_on_mouth:Serious Face With Symbols Covering Mouth
    U+1F92D🤭\:face_with_hand_over_mouth:Smiling Face With Smiling Eyes And Hand Covering Mouth
    U+1F92E🤮\:face_vomiting:Face With Open Mouth Vomiting
    U+1F92F🤯\:exploding_head:Shocked Face With Exploding Head
    U+1F930🤰\:pregnant_woman:Pregnant Woman
    U+1F931🤱\:breast-feeding:Breast-Feeding
    U+1F932🤲\:palms_up_together:Palms Up Together
    U+1F933🤳\:selfie:Selfie
    U+1F934🤴\:prince:Prince
    U+1F935🤵\:person_in_tuxedo:Man In Tuxedo
    U+1F936🤶\:mrs_claus:Mother Christmas
    U+1F937🤷\:shrug:Shrug
    U+1F938🤸\:person_doing_cartwheel:Person Doing Cartwheel
    U+1F939🤹\:juggling:Juggling
    U+1F93A🤺\:fencer:Fencer
    U+1F93C🤼\:wrestlers:Wrestlers
    U+1F93D🤽\:water_polo:Water Polo
    U+1F93E🤾\:handball:Handball
    U+1F93F🤿\:diving_mask:Diving Mask
    U+1F940🥀\:wilted_flower:Wilted Flower
    U+1F941🥁\:drum_with_drumsticks:Drum With Drumsticks
    U+1F942🥂\:clinking_glasses:Clinking Glasses
    U+1F943🥃\:tumbler_glass:Tumbler Glass
    U+1F944🥄\:spoon:Spoon
    U+1F945🥅\:goal_net:Goal Net
    U+1F947🥇\:first_place_medal:First Place Medal
    U+1F948🥈\:second_place_medal:Second Place Medal
    U+1F949🥉\:third_place_medal:Third Place Medal
    U+1F94A🥊\:boxing_glove:Boxing Glove
    U+1F94B🥋\:martial_arts_uniform:Martial Arts Uniform
    U+1F94C🥌\:curling_stone:Curling Stone
    U+1F94D🥍\:lacrosse:Lacrosse Stick And Ball
    U+1F94E🥎\:softball:Softball
    U+1F94F🥏\:flying_disc:Flying Disc
    U+1F950🥐\:croissant:Croissant
    U+1F951🥑\:avocado:Avocado
    U+1F952🥒\:cucumber:Cucumber
    U+1F953🥓\:bacon:Bacon
    U+1F954🥔\:potato:Potato
    U+1F955🥕\:carrot:Carrot
    U+1F956🥖\:baguette_bread:Baguette Bread
    U+1F957🥗\:green_salad:Green Salad
    U+1F958🥘\:shallow_pan_of_food:Shallow Pan Of Food
    U+1F959🥙\:stuffed_flatbread:Stuffed Flatbread
    U+1F95A🥚\:egg:Egg
    U+1F95B🥛\:glass_of_milk:Glass Of Milk
    U+1F95C🥜\:peanuts:Peanuts
    U+1F95D🥝\:kiwifruit:Kiwifruit
    U+1F95E🥞\:pancakes:Pancakes
    U+1F95F🥟\:dumpling:Dumpling
    U+1F960🥠\:fortune_cookie:Fortune Cookie
    U+1F961🥡\:takeout_box:Takeout Box
    U+1F962🥢\:chopsticks:Chopsticks
    U+1F963🥣\:bowl_with_spoon:Bowl With Spoon
    U+1F964🥤\:cup_with_straw:Cup With Straw
    U+1F965🥥\:coconut:Coconut
    U+1F966🥦\:broccoli:Broccoli
    U+1F967🥧\:pie:Pie
    U+1F968🥨\:pretzel:Pretzel
    U+1F969🥩\:cut_of_meat:Cut Of Meat
    U+1F96A🥪\:sandwich:Sandwich
    U+1F96B🥫\:canned_food:Canned Food
    U+1F96C🥬\:leafy_green:Leafy Green
    U+1F96D🥭\:mango:Mango
    U+1F96E🥮\:moon_cake:Moon Cake
    U+1F96F🥯\:bagel:Bagel
    U+1F970🥰\:smiling_face_with_3_hearts:Smiling Face With Smiling Eyes And Three Hearts
    U+1F971🥱\:yawning_face:Yawning Face
    U+1F972🥲\:smiling_face_with_tear:Smiling Face With Tear
    U+1F973🥳\:partying_face:Face With Party Horn And Party Hat
    U+1F974🥴\:woozy_face:Face With Uneven Eyes And Wavy Mouth
    U+1F975🥵\:hot_face:Overheated Face
    U+1F976🥶\:cold_face:Freezing Face
    U+1F977🥷\:ninja:Ninja
    U+1F978🥸\:disguised_face:Disguised Face
    U+1F979🥹\:face_holding_back_tears:(No Unicode name)
    U+1F97A🥺\:pleading_face:Face With Pleading Eyes
    U+1F97B🥻\:sari:Sari
    U+1F97C🥼\:lab_coat:Lab Coat
    U+1F97D🥽\:goggles:Goggles
    U+1F97E🥾\:hiking_boot:Hiking Boot
    U+1F97F🥿\:womans_flat_shoe:Flat Shoe
    U+1F980🦀\:crab:Crab
    U+1F981🦁\:lion_face:Lion Face
    U+1F982🦂\:scorpion:Scorpion
    U+1F983🦃\:turkey:Turkey
    U+1F984🦄\:unicorn_face:Unicorn Face
    U+1F985🦅\:eagle:Eagle
    U+1F986🦆\:duck:Duck
    U+1F987🦇\:bat:Bat
    U+1F988🦈\:shark:Shark
    U+1F989🦉\:owl:Owl
    U+1F98A🦊\:fox_face:Fox Face
    U+1F98B🦋\:butterfly:Butterfly
    U+1F98C🦌\:deer:Deer
    U+1F98D🦍\:gorilla:Gorilla
    U+1F98E🦎\:lizard:Lizard
    U+1F98F🦏\:rhinoceros:Rhinoceros
    U+1F990🦐\:shrimp:Shrimp
    U+1F991🦑\:squid:Squid
    U+1F992🦒\:giraffe_face:Giraffe Face
    U+1F993🦓\:zebra_face:Zebra Face
    U+1F994🦔\:hedgehog:Hedgehog
    U+1F995🦕\:sauropod:Sauropod
    U+1F996🦖\:t-rex:T-Rex
    U+1F997🦗\:cricket:Cricket
    U+1F998🦘\:kangaroo:Kangaroo
    U+1F999🦙\:llama:Llama
    U+1F99A🦚\:peacock:Peacock
    U+1F99B🦛\:hippopotamus:Hippopotamus
    U+1F99C🦜\:parrot:Parrot
    U+1F99D🦝\:raccoon:Raccoon
    U+1F99E🦞\:lobster:Lobster
    U+1F99F🦟\:mosquito:Mosquito
    U+1F9A0🦠\:microbe:Microbe
    U+1F9A1🦡\:badger:Badger
    U+1F9A2🦢\:swan:Swan
    U+1F9A3🦣\:mammoth:Mammoth
    U+1F9A4🦤\:dodo:Dodo
    U+1F9A5🦥\:sloth:Sloth
    U+1F9A6🦦\:otter:Otter
    U+1F9A7🦧\:orangutan:Orangutan
    U+1F9A8🦨\:skunk:Skunk
    U+1F9A9🦩\:flamingo:Flamingo
    U+1F9AA🦪\:oyster:Oyster
    U+1F9AB🦫\:beaver:Beaver
    U+1F9AC🦬\:bison:Bison
    U+1F9AD🦭\:seal:Seal
    U+1F9AE🦮\:guide_dog:Guide Dog
    U+1F9AF🦯\:probing_cane:Probing Cane
    U+1F9B4🦴\:bone:Bone
    U+1F9B5🦵\:leg:Leg
    U+1F9B6🦶\:foot:Foot
    U+1F9B7🦷\:tooth:Tooth
    U+1F9B8🦸\:superhero:Superhero
    U+1F9B9🦹\:supervillain:Supervillain
    U+1F9BA🦺\:safety_vest:Safety Vest
    U+1F9BB🦻\:ear_with_hearing_aid:Ear With Hearing Aid
    U+1F9BC🦼\:motorized_wheelchair:Motorized Wheelchair
    U+1F9BD🦽\:manual_wheelchair:Manual Wheelchair
    U+1F9BE🦾\:mechanical_arm:Mechanical Arm
    U+1F9BF🦿\:mechanical_leg:Mechanical Leg
    U+1F9C0🧀\:cheese_wedge:Cheese Wedge
    U+1F9C1🧁\:cupcake:Cupcake
    U+1F9C2🧂\:salt:Salt Shaker
    U+1F9C3🧃\:beverage_box:Beverage Box
    U+1F9C4🧄\:garlic:Garlic
    U+1F9C5🧅\:onion:Onion
    U+1F9C6🧆\:falafel:Falafel
    U+1F9C7🧇\:waffle:Waffle
    U+1F9C8🧈\:butter:Butter
    U+1F9C9🧉\:mate_drink:Mate Drink
    U+1F9CA🧊\:ice_cube:Ice Cube
    U+1F9CB🧋\:bubble_tea:Bubble Tea
    U+1F9CC🧌\:troll:(No Unicode name)
    U+1F9CD🧍\:standing_person:Standing Person
    U+1F9CE🧎\:kneeling_person:Kneeling Person
    U+1F9CF🧏\:deaf_person:Deaf Person
    U+1F9D0🧐\:face_with_monocle:Face With Monocle
    U+1F9D1🧑\:adult:Adult
    U+1F9D2🧒\:child:Child
    U+1F9D3🧓\:older_adult:Older Adult
    U+1F9D4🧔\:bearded_person:Bearded Person
    U+1F9D5🧕\:person_with_headscarf:Person With Headscarf
    U+1F9D6🧖\:person_in_steamy_room:Person In Steamy Room
    U+1F9D7🧗\:person_climbing:Person Climbing
    U+1F9D8🧘\:person_in_lotus_position:Person In Lotus Position
    U+1F9D9🧙\:mage:Mage
    U+1F9DA🧚\:fairy:Fairy
    U+1F9DB🧛\:vampire:Vampire
    U+1F9DC🧜\:merperson:Merperson
    U+1F9DD🧝\:elf:Elf
    U+1F9DE🧞\:genie:Genie
    U+1F9DF🧟\:zombie:Zombie
    U+1F9E0🧠\:brain:Brain
    U+1F9E1🧡\:orange_heart:Orange Heart
    U+1F9E2🧢\:billed_cap:Billed Cap
    U+1F9E3🧣\:scarf:Scarf
    U+1F9E4🧤\:gloves:Gloves
    U+1F9E5🧥\:coat:Coat
    U+1F9E6🧦\:socks:Socks
    U+1F9E7🧧\:red_envelope:Red Gift Envelope
    U+1F9E8🧨\:firecracker:Firecracker
    U+1F9E9🧩\:jigsaw:Jigsaw Puzzle Piece
    U+1F9EA🧪\:test_tube:Test Tube
    U+1F9EB🧫\:petri_dish:Petri Dish
    U+1F9EC🧬\:dna:Dna Double Helix
    U+1F9ED🧭\:compass:Compass
    U+1F9EE🧮\:abacus:Abacus
    U+1F9EF🧯\:fire_extinguisher:Fire Extinguisher
    U+1F9F0🧰\:toolbox:Toolbox
    U+1F9F1🧱\:bricks:Brick
    U+1F9F2🧲\:magnet:Magnet
    U+1F9F3🧳\:luggage:Luggage
    U+1F9F4🧴\:lotion_bottle:Lotion Bottle
    U+1F9F5🧵\:thread:Spool Of Thread
    U+1F9F6🧶\:yarn:Ball Of Yarn
    U+1F9F7🧷\:safety_pin:Safety Pin
    U+1F9F8🧸\:teddy_bear:Teddy Bear
    U+1F9F9🧹\:broom:Broom
    U+1F9FA🧺\:basket:Basket
    U+1F9FB🧻\:roll_of_paper:Roll Of Paper
    U+1F9FC🧼\:soap:Bar Of Soap
    U+1F9FD🧽\:sponge:Sponge
    U+1F9FE🧾\:receipt:Receipt
    U+1F9FF🧿\:nazar_amulet:Nazar Amulet
    U+1FA70🩰\:ballet_shoes:Ballet Shoes
    U+1FA71🩱\:one-piece_swimsuit:One-Piece Swimsuit
    U+1FA72🩲\:briefs:Briefs
    U+1FA73🩳\:shorts:Shorts
    U+1FA74🩴\:thong_sandal:Thong Sandal
    U+1FA75🩵\:light_blue_heart:(No Unicode name)
    U+1FA76🩶\:grey_heart:(No Unicode name)
    U+1FA77🩷\:pink_heart:(No Unicode name)
    U+1FA78🩸\:drop_of_blood:Drop Of Blood
    U+1FA79🩹\:adhesive_bandage:Adhesive Bandage
    U+1FA7A🩺\:stethoscope:Stethoscope
    U+1FA7B🩻\:x-ray:(No Unicode name)
    U+1FA7C🩼\:crutch:(No Unicode name)
    U+1FA80🪀\:yo-yo:Yo-Yo
    U+1FA81🪁\:kite:Kite
    U+1FA82🪂\:parachute:Parachute
    U+1FA83🪃\:boomerang:Boomerang
    U+1FA84🪄\:magic_wand:Magic Wand
    U+1FA85🪅\:pinata:Pinata
    U+1FA86🪆\:nesting_dolls:Nesting Dolls
    U+1FA87🪇\:maracas:(No Unicode name)
    U+1FA88🪈\:flute:(No Unicode name)
    U+1FA90🪐\:ringed_planet:Ringed Planet
    U+1FA91🪑\:chair:Chair
    U+1FA92🪒\:razor:Razor
    U+1FA93🪓\:axe:Axe
    U+1FA94🪔\:diya_lamp:Diya Lamp
    U+1FA95🪕\:banjo:Banjo
    U+1FA96🪖\:military_helmet:Military Helmet
    U+1FA97🪗\:accordion:Accordion
    U+1FA98🪘\:long_drum:Long Drum
    U+1FA99🪙\:coin:Coin
    U+1FA9A🪚\:carpentry_saw:Carpentry Saw
    U+1FA9B🪛\:screwdriver:Screwdriver
    U+1FA9C🪜\:ladder:Ladder
    U+1FA9D🪝\:hook:Hook
    U+1FA9E🪞\:mirror:Mirror
    U+1FA9F🪟\:window:Window
    U+1FAA0🪠\:plunger:Plunger
    U+1FAA1🪡\:sewing_needle:Sewing Needle
    U+1FAA2🪢\:knot:Knot
    U+1FAA3🪣\:bucket:Bucket
    U+1FAA4🪤\:mouse_trap:Mouse Trap
    U+1FAA5🪥\:toothbrush:Toothbrush
    U+1FAA6🪦\:headstone:Headstone
    U+1FAA7🪧\:placard:Placard
    U+1FAA8🪨\:rock:Rock
    U+1FAA9🪩\:mirror_ball:(No Unicode name)
    U+1FAAA🪪\:identification_card:(No Unicode name)
    U+1FAAB🪫\:low_battery:(No Unicode name)
    U+1FAAC🪬\:hamsa:(No Unicode name)
    U+1FAAD🪭\:folding_hand_fan:(No Unicode name)
    U+1FAAE🪮\:hair_pick:(No Unicode name)
    U+1FAAF🪯\:khanda:(No Unicode name)
    U+1FAB0🪰\:fly:Fly
    U+1FAB1🪱\:worm:Worm
    U+1FAB2🪲\:beetle:Beetle
    U+1FAB3🪳\:cockroach:Cockroach
    U+1FAB4🪴\:potted_plant:Potted Plant
    U+1FAB5🪵\:wood:Wood
    U+1FAB6🪶\:feather:Feather
    U+1FAB7🪷\:lotus:(No Unicode name)
    U+1FAB8🪸\:coral:(No Unicode name)
    U+1FAB9🪹\:empty_nest:(No Unicode name)
    U+1FABA🪺\:nest_with_eggs:(No Unicode name)
    U+1FABB🪻\:hyacinth:(No Unicode name)
    U+1FABC🪼\:jellyfish:(No Unicode name)
    U+1FABD🪽\:wing:(No Unicode name)
    U+1FABF🪿\:goose:(No Unicode name)
    U+1FAC0🫀\:anatomical_heart:Anatomical Heart
    U+1FAC1🫁\:lungs:Lungs
    U+1FAC2🫂\:people_hugging:People Hugging
    U+1FAC3🫃\:pregnant_man:(No Unicode name)
    U+1FAC4🫄\:pregnant_person:(No Unicode name)
    U+1FAC5🫅\:person_with_crown:(No Unicode name)
    U+1FACE🫎\:moose:(No Unicode name)
    U+1FACF🫏\:donkey:(No Unicode name)
    U+1FAD0🫐\:blueberries:Blueberries
    U+1FAD1🫑\:bell_pepper:Bell Pepper
    U+1FAD2🫒\:olive:Olive
    U+1FAD3🫓\:flatbread:Flatbread
    U+1FAD4🫔\:tamale:Tamale
    U+1FAD5🫕\:fondue:Fondue
    U+1FAD6🫖\:teapot:Teapot
    U+1FAD7🫗\:pouring_liquid:(No Unicode name)
    U+1FAD8🫘\:beans:(No Unicode name)
    U+1FAD9🫙\:jar:(No Unicode name)
    U+1FADA🫚\:ginger_root:(No Unicode name)
    U+1FADB🫛\:pea_pod:(No Unicode name)
    U+1FAE0🫠\:melting_face:(No Unicode name)
    U+1FAE1🫡\:saluting_face:(No Unicode name)
    U+1FAE2🫢\:face_with_open_eyes_and_hand_over_mouth:(No Unicode name)
    U+1FAE3🫣\:face_with_peeking_eye:(No Unicode name)
    U+1FAE4🫤\:face_with_diagonal_mouth:(No Unicode name)
    U+1FAE5🫥\:dotted_line_face:(No Unicode name)
    U+1FAE6🫦\:biting_lip:(No Unicode name)
    U+1FAE7🫧\:bubbles:(No Unicode name)
    U+1FAE8🫨\:shaking_face:(No Unicode name)
    U+1FAF0🫰\:hand_with_index_finger_and_thumb_crossed:(No Unicode name)
    U+1FAF1🫱\:rightwards_hand:(No Unicode name)
    U+1FAF2🫲\:leftwards_hand:(No Unicode name)
    U+1FAF3🫳\:palm_down_hand:(No Unicode name)
    U+1FAF4🫴\:palm_up_hand:(No Unicode name)
    U+1FAF5🫵\:index_pointing_at_the_viewer:(No Unicode name)
    U+1FAF6🫶\:heart_hands:(No Unicode name)
    U+1FAF7🫷\:leftwards_pushing_hand:(No Unicode name)
    U+1FAF8🫸\:rightwards_pushing_hand:(No Unicode name)
    +

    Unicode Input

    The following table lists Unicode characters that can be entered via tab completion of LaTeX-like abbreviations in the Julia REPL (and in various other editing environments). You can also get information on how to type a symbol by entering it in the REPL help, i.e. by typing ? and then entering the symbol in the REPL (e.g., by copy-paste from somewhere you saw the symbol).

    Warning

    This table may appear to contain missing characters in the second column, or even show characters that are inconsistent with the characters as they are rendered in the Julia REPL. In these cases, users are strongly advised to check their choice of fonts in their browser and REPL environment, as there are known issues with glyphs in many fonts.

    Code point(s)Character(s)Tab completion sequence(s)Unicode name(s)
    U+000A1¡\exclamdownInverted Exclamation Mark
    U+000A3£\sterlingPound Sign
    U+000A5¥\yenYen Sign
    U+000A6¦\brokenbarBroken Bar / Broken Vertical Bar
    U+000A7§\SSection Sign
    U+000A9©\copyright, \:copyright:Copyright Sign
    U+000AAª\ordfeminineFeminine Ordinal Indicator
    U+000AB«\guillemotleftLeft-Pointing Double Angle Quotation Mark / Left Pointing Guillemet
    U+000AC¬\negNot Sign
    U+000AE®\circledR, \:registered:Registered Sign / Registered Trade Mark Sign
    U+000AF¯\highminusMacron / Spacing Macron
    U+000B0°\degreeDegree Sign
    U+000B1±\pmPlus-Minus Sign / Plus-Or-Minus Sign
    U+000B2²\^2Superscript Two / Superscript Digit Two
    U+000B3³\^3Superscript Three / Superscript Digit Three
    U+000B6\PPilcrow Sign / Paragraph Sign
    U+000B7·\cdotpMiddle Dot
    U+000B9¹\^1Superscript One / Superscript Digit One
    U+000BAº\ordmasculineMasculine Ordinal Indicator
    U+000BB»\guillemotrightRight-Pointing Double Angle Quotation Mark / Right Pointing Guillemet
    U+000BC¼\1/4Vulgar Fraction One Quarter / Fraction One Quarter
    U+000BD½\1/2Vulgar Fraction One Half / Fraction One Half
    U+000BE¾\3/4Vulgar Fraction Three Quarters / Fraction Three Quarters
    U+000BF¿\questiondownInverted Question Mark
    U+000C5Å\AALatin Capital Letter A With Ring Above / Latin Capital Letter A Ring
    U+000C6Æ\AELatin Capital Letter Ae / Latin Capital Letter A E
    U+000D0Ð\DHLatin Capital Letter Eth
    U+000D7×\timesMultiplication Sign
    U+000D8Ø\OLatin Capital Letter O With Stroke / Latin Capital Letter O Slash
    U+000DEÞ\THLatin Capital Letter Thorn
    U+000DFß\ssLatin Small Letter Sharp S
    U+000E5å\aaLatin Small Letter A With Ring Above / Latin Small Letter A Ring
    U+000E6æ\aeLatin Small Letter Ae / Latin Small Letter A E
    U+000F0ð\eth, \dhLatin Small Letter Eth
    U+000F7÷\divDivision Sign
    U+000F8ø\oLatin Small Letter O With Stroke / Latin Small Letter O Slash
    U+000FEþ\thLatin Small Letter Thorn
    U+00110Đ\DJLatin Capital Letter D With Stroke / Latin Capital Letter D Bar
    U+00111đ\djLatin Small Letter D With Stroke / Latin Small Letter D Bar
    U+00127ħ\hbarLatin Small Letter H With Stroke / Latin Small Letter H Bar
    U+00131ı\imathLatin Small Letter Dotless I
    U+00141Ł\LLatin Capital Letter L With Stroke / Latin Capital Letter L Slash
    U+00142ł\lLatin Small Letter L With Stroke / Latin Small Letter L Slash
    U+0014AŊ\NGLatin Capital Letter Eng
    U+0014Bŋ\ngLatin Small Letter Eng
    U+00152Œ\OELatin Capital Ligature Oe / Latin Capital Letter O E
    U+00153œ\oeLatin Small Ligature Oe / Latin Small Letter O E
    U+00195ƕ\hvligLatin Small Letter Hv / Latin Small Letter H V
    U+0019Eƞ\nrlegLatin Small Letter N With Long Right Leg
    U+001B5Ƶ\ZbarLatin Capital Letter Z With Stroke / Latin Capital Letter Z Bar
    U+001C2ǂ\doublepipeLatin Letter Alveolar Click / Latin Letter Pipe Double Bar
    U+00237ȷ\jmathLatin Small Letter Dotless J
    U+00250ɐ\trnaLatin Small Letter Turned A
    U+00252ɒ\trnsaLatin Small Letter Turned Alpha / Latin Small Letter Turned Script A
    U+00254ɔ\openoLatin Small Letter Open O
    U+00256ɖ\rtldLatin Small Letter D With Tail / Latin Small Letter D Retroflex Hook
    U+00259ə\schwaLatin Small Letter Schwa
    U+00263ɣ\pgammaLatin Small Letter Gamma
    U+00264ɤ\pbgamLatin Small Letter Rams Horn / Latin Small Letter Baby Gamma
    U+00265ɥ\trnhLatin Small Letter Turned H
    U+0026Cɬ\btdlLatin Small Letter L With Belt / Latin Small Letter L Belt
    U+0026Dɭ\rtllLatin Small Letter L With Retroflex Hook / Latin Small Letter L Retroflex Hook
    U+0026Fɯ\trnmLatin Small Letter Turned M
    U+00270ɰ\trnmlrLatin Small Letter Turned M With Long Leg
    U+00271ɱ\ltlmrLatin Small Letter M With Hook / Latin Small Letter M Hook
    U+00272ɲ\ltlnLatin Small Letter N With Left Hook / Latin Small Letter N Hook
    U+00273ɳ\rtlnLatin Small Letter N With Retroflex Hook / Latin Small Letter N Retroflex Hook
    U+00277ɷ\clomegLatin Small Letter Closed Omega
    U+00278ɸ\ltphiLatin Small Letter Phi
    U+00279ɹ\trnrLatin Small Letter Turned R
    U+0027Aɺ\trnrlLatin Small Letter Turned R With Long Leg
    U+0027Bɻ\rttrnrLatin Small Letter Turned R With Hook / Latin Small Letter Turned R Hook
    U+0027Cɼ\rlLatin Small Letter R With Long Leg
    U+0027Dɽ\rtlrLatin Small Letter R With Tail / Latin Small Letter R Hook
    U+0027Eɾ\fhrLatin Small Letter R With Fishhook / Latin Small Letter Fishhook R
    U+00282ʂ\rtlsLatin Small Letter S With Hook / Latin Small Letter S Hook
    U+00283ʃ\eshLatin Small Letter Esh
    U+00287ʇ\trntLatin Small Letter Turned T
    U+00288ʈ\rtltLatin Small Letter T With Retroflex Hook / Latin Small Letter T Retroflex Hook
    U+0028Aʊ\pupsilLatin Small Letter Upsilon
    U+0028Bʋ\pscrvLatin Small Letter V With Hook / Latin Small Letter Script V
    U+0028Cʌ\invvLatin Small Letter Turned V
    U+0028Dʍ\invwLatin Small Letter Turned W
    U+0028Eʎ\trnyLatin Small Letter Turned Y
    U+00290ʐ\rtlzLatin Small Letter Z With Retroflex Hook / Latin Small Letter Z Retroflex Hook
    U+00292ʒ\yoghLatin Small Letter Ezh / Latin Small Letter Yogh
    U+00294ʔ\glstLatin Letter Glottal Stop
    U+00295ʕ\reglstLatin Letter Pharyngeal Voiced Fricative / Latin Letter Reversed Glottal Stop
    U+00296ʖ\inglstLatin Letter Inverted Glottal Stop
    U+0029Eʞ\turnkLatin Small Letter Turned K
    U+002A4ʤ\dyoghLatin Small Letter Dezh Digraph / Latin Small Letter D Yogh
    U+002A7ʧ\teshLatin Small Letter Tesh Digraph / Latin Small Letter T Esh
    U+002B0ʰ\^hModifier Letter Small H
    U+002B2ʲ\^jModifier Letter Small J
    U+002B3ʳ\^rModifier Letter Small R
    U+002B7ʷ\^wModifier Letter Small W
    U+002B8ʸ\^yModifier Letter Small Y
    U+002BCʼ\raspModifier Letter Apostrophe
    U+002C8ˈ\vertsModifier Letter Vertical Line
    U+002CCˌ\vertiModifier Letter Low Vertical Line
    U+002D0ː\lmrkModifier Letter Triangular Colon
    U+002D1ˑ\hlmrkModifier Letter Half Triangular Colon
    U+002D2˒\sbrhrModifier Letter Centred Right Half Ring / Modifier Letter Centered Right Half Ring
    U+002D3˓\sblhrModifier Letter Centred Left Half Ring / Modifier Letter Centered Left Half Ring
    U+002D4˔\raisModifier Letter Up Tack
    U+002D5˕\lowModifier Letter Down Tack
    U+002D8˘\uBreve / Spacing Breve
    U+002DC˜\tildelowSmall Tilde / Spacing Tilde
    U+002E1ˡ\^lModifier Letter Small L
    U+002E2ˢ\^sModifier Letter Small S
    U+002E3ˣ\^xModifier Letter Small X
    U+002F1˱\_<Modifier Letter Low Left Arrowhead
    U+002F2˲\_>Modifier Letter Low Right Arrowhead
    U+00300 ̀ \graveCombining Grave Accent / Non-Spacing Grave
    U+00301 ́ \acuteCombining Acute Accent / Non-Spacing Acute
    U+00302 ̂ \hatCombining Circumflex Accent / Non-Spacing Circumflex
    U+00303 ̃ \tildeCombining Tilde / Non-Spacing Tilde
    U+00304 ̄ \barCombining Macron / Non-Spacing Macron
    U+00305 ̅ \overbarCombining Overline / Non-Spacing Overscore
    U+00306 ̆ \breveCombining Breve / Non-Spacing Breve
    U+00307 ̇ \dotCombining Dot Above / Non-Spacing Dot Above
    U+00308 ̈ \ddotCombining Diaeresis / Non-Spacing Diaeresis
    U+00309 ̉ \ovhookCombining Hook Above / Non-Spacing Hook Above
    U+0030A ̊ \ocircCombining Ring Above / Non-Spacing Ring Above
    U+0030B ̋ \HCombining Double Acute Accent / Non-Spacing Double Acute
    U+0030C ̌ \checkCombining Caron / Non-Spacing Hacek
    U+00310 ̐ \candraCombining Candrabindu / Non-Spacing Candrabindu
    U+00312 ̒ \oturnedcommaCombining Turned Comma Above / Non-Spacing Turned Comma Above
    U+00315 ̕ \ocommatoprightCombining Comma Above Right / Non-Spacing Comma Above Right
    U+0031A ̚ \droangCombining Left Angle Above / Non-Spacing Left Angle Above
    U+00321 ̡ \palhCombining Palatalized Hook Below / Non-Spacing Palatalized Hook Below
    U+00322 ̢ \rhCombining Retroflex Hook Below / Non-Spacing Retroflex Hook Below
    U+00327 ̧ \cCombining Cedilla / Non-Spacing Cedilla
    U+00328 ̨ \kCombining Ogonek / Non-Spacing Ogonek
    U+0032A ̪ \sbbrgCombining Bridge Below / Non-Spacing Bridge Below
    U+00330 ̰ \wideutildeCombining Tilde Below / Non-Spacing Tilde Below
    U+00332 ̲ \underbarCombining Low Line / Non-Spacing Underscore
    U+00336 ̶ \strike, \soutCombining Long Stroke Overlay / Non-Spacing Long Bar Overlay
    U+00338 ̸ \notCombining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0034D ͍ \underleftrightarrowCombining Left Right Arrow Below
    U+00391Α\AlphaGreek Capital Letter Alpha
    U+00392Β\BetaGreek Capital Letter Beta
    U+00393Γ\GammaGreek Capital Letter Gamma
    U+00394Δ\DeltaGreek Capital Letter Delta
    U+00395Ε\EpsilonGreek Capital Letter Epsilon
    U+00396Ζ\ZetaGreek Capital Letter Zeta
    U+00397Η\EtaGreek Capital Letter Eta
    U+00398Θ\ThetaGreek Capital Letter Theta
    U+00399Ι\IotaGreek Capital Letter Iota
    U+0039AΚ\KappaGreek Capital Letter Kappa
    U+0039BΛ\LambdaGreek Capital Letter Lamda / Greek Capital Letter Lambda
    U+0039CΜ\MuGreek Capital Letter Mu
    U+0039DΝ\NuGreek Capital Letter Nu
    U+0039EΞ\XiGreek Capital Letter Xi
    U+0039FΟ\OmicronGreek Capital Letter Omicron
    U+003A0Π\PiGreek Capital Letter Pi
    U+003A1Ρ\RhoGreek Capital Letter Rho
    U+003A3Σ\SigmaGreek Capital Letter Sigma
    U+003A4Τ\TauGreek Capital Letter Tau
    U+003A5Υ\UpsilonGreek Capital Letter Upsilon
    U+003A6Φ\PhiGreek Capital Letter Phi
    U+003A7Χ\ChiGreek Capital Letter Chi
    U+003A8Ψ\PsiGreek Capital Letter Psi
    U+003A9Ω\OmegaGreek Capital Letter Omega
    U+003B1α\alphaGreek Small Letter Alpha
    U+003B2β\betaGreek Small Letter Beta
    U+003B3γ\gammaGreek Small Letter Gamma
    U+003B4δ\deltaGreek Small Letter Delta
    U+003B5ε\varepsilonGreek Small Letter Epsilon
    U+003B6ζ\zetaGreek Small Letter Zeta
    U+003B7η\etaGreek Small Letter Eta
    U+003B8θ\thetaGreek Small Letter Theta
    U+003B9ι\iotaGreek Small Letter Iota
    U+003BAκ\kappaGreek Small Letter Kappa
    U+003BBλ\lambdaGreek Small Letter Lamda / Greek Small Letter Lambda
    U+003BCμ\muGreek Small Letter Mu
    U+003BDν\nuGreek Small Letter Nu
    U+003BEξ\xiGreek Small Letter Xi
    U+003BFο\omicronGreek Small Letter Omicron
    U+003C0π\piGreek Small Letter Pi
    U+003C1ρ\rhoGreek Small Letter Rho
    U+003C2ς\varsigmaGreek Small Letter Final Sigma
    U+003C3σ\sigmaGreek Small Letter Sigma
    U+003C4τ\tauGreek Small Letter Tau
    U+003C5υ\upsilonGreek Small Letter Upsilon
    U+003C6φ\varphiGreek Small Letter Phi
    U+003C7χ\chiGreek Small Letter Chi
    U+003C8ψ\psiGreek Small Letter Psi
    U+003C9ω\omegaGreek Small Letter Omega
    U+003D0ϐ\varbetaGreek Beta Symbol / Greek Small Letter Curled Beta
    U+003D1ϑ\varthetaGreek Theta Symbol / Greek Small Letter Script Theta
    U+003D5ϕ\phiGreek Phi Symbol / Greek Small Letter Script Phi
    U+003D6ϖ\varpiGreek Pi Symbol / Greek Small Letter Omega Pi
    U+003D8Ϙ\oldKoppaGreek Letter Archaic Koppa
    U+003D9ϙ\oldkoppaGreek Small Letter Archaic Koppa
    U+003DAϚ\StigmaGreek Letter Stigma / Greek Capital Letter Stigma
    U+003DBϛ\stigmaGreek Small Letter Stigma
    U+003DCϜ\DigammaGreek Letter Digamma / Greek Capital Letter Digamma
    U+003DDϝ\digammaGreek Small Letter Digamma
    U+003DEϞ\KoppaGreek Letter Koppa / Greek Capital Letter Koppa
    U+003DFϟ\koppaGreek Small Letter Koppa
    U+003E0Ϡ\SampiGreek Letter Sampi / Greek Capital Letter Sampi
    U+003E1ϡ\sampiGreek Small Letter Sampi
    U+003F0ϰ\varkappaGreek Kappa Symbol / Greek Small Letter Script Kappa
    U+003F1ϱ\varrhoGreek Rho Symbol / Greek Small Letter Tailed Rho
    U+003F4ϴ\varThetaGreek Capital Theta Symbol
    U+003F5ϵ\epsilonGreek Lunate Epsilon Symbol
    U+003F6϶\backepsilonGreek Reversed Lunate Epsilon Symbol
    U+01D2C\^AModifier Letter Capital A
    U+01D2E\^BModifier Letter Capital B
    U+01D30\^DModifier Letter Capital D
    U+01D31\^EModifier Letter Capital E
    U+01D33\^GModifier Letter Capital G
    U+01D34\^HModifier Letter Capital H
    U+01D35\^IModifier Letter Capital I
    U+01D36\^JModifier Letter Capital J
    U+01D37\^KModifier Letter Capital K
    U+01D38\^LModifier Letter Capital L
    U+01D39\^MModifier Letter Capital M
    U+01D3A\^NModifier Letter Capital N
    U+01D3C\^OModifier Letter Capital O
    U+01D3E\^PModifier Letter Capital P
    U+01D3Fᴿ\^RModifier Letter Capital R
    U+01D40\^TModifier Letter Capital T
    U+01D41\^UModifier Letter Capital U
    U+01D42\^WModifier Letter Capital W
    U+01D43\^aModifier Letter Small A
    U+01D45\^alphaModifier Letter Small Alpha
    U+01D47\^bModifier Letter Small B
    U+01D48\^dModifier Letter Small D
    U+01D49\^eModifier Letter Small E
    U+01D4B\^epsilonModifier Letter Small Open E
    U+01D4D\^gModifier Letter Small G
    U+01D4F\^kModifier Letter Small K
    U+01D50\^mModifier Letter Small M
    U+01D52\^oModifier Letter Small O
    U+01D56\^pModifier Letter Small P
    U+01D57\^tModifier Letter Small T
    U+01D58\^uModifier Letter Small U
    U+01D5B\^vModifier Letter Small V
    U+01D5D\^betaModifier Letter Small Beta
    U+01D5E\^gammaModifier Letter Small Greek Gamma
    U+01D5F\^deltaModifier Letter Small Delta
    U+01D60\^phiModifier Letter Small Greek Phi
    U+01D61\^chiModifier Letter Small Chi
    U+01D62\_iLatin Subscript Small Letter I
    U+01D63\_rLatin Subscript Small Letter R
    U+01D64\_uLatin Subscript Small Letter U
    U+01D65\_vLatin Subscript Small Letter V
    U+01D66\_betaGreek Subscript Small Letter Beta
    U+01D67\_gammaGreek Subscript Small Letter Gamma
    U+01D68\_rhoGreek Subscript Small Letter Rho
    U+01D69\_phiGreek Subscript Small Letter Phi
    U+01D6A\_chiGreek Subscript Small Letter Chi
    U+01D9C\^cModifier Letter Small C
    U+01DA0\^fModifier Letter Small F
    U+01DA5\^iotaModifier Letter Small Iota
    U+01DB2\^ltphiModifier Letter Small Phi
    U+01DBB\^zModifier Letter Small Z
    U+01DBFᶿ\^thetaModifier Letter Small Theta
    U+02002\enspaceEn Space
    U+02003\quadEm Space
    U+02005\thickspaceFour-Per-Em Space
    U+02009\thinspaceThin Space
    U+0200A\hspaceHair Space
    U+02013\endashEn Dash
    U+02014\emdashEm Dash
    U+02016\VertDouble Vertical Line / Double Vertical Bar
    U+02018\lqLeft Single Quotation Mark / Single Turned Comma Quotation Mark
    U+02019\rqRight Single Quotation Mark / Single Comma Quotation Mark
    U+0201B\reaposSingle High-Reversed-9 Quotation Mark / Single Reversed Comma Quotation Mark
    U+0201C\ldqLeft Double Quotation Mark / Double Turned Comma Quotation Mark
    U+0201D\rdqRight Double Quotation Mark / Double Comma Quotation Mark
    U+02020\daggerDagger
    U+02021\ddaggerDouble Dagger
    U+02022\bulletBullet
    U+02026\dots, \ldotsHorizontal Ellipsis
    U+02030\perthousandPer Mille Sign
    U+02031\pertenthousandPer Ten Thousand Sign
    U+02032\primePrime
    U+02033\pprimeDouble Prime
    U+02034\ppprimeTriple Prime
    U+02035\backprimeReversed Prime
    U+02036\backpprimeReversed Double Prime
    U+02037\backppprimeReversed Triple Prime
    U+02039\guilsinglleftSingle Left-Pointing Angle Quotation Mark / Left Pointing Single Guillemet
    U+0203A\guilsinglrightSingle Right-Pointing Angle Quotation Mark / Right Pointing Single Guillemet
    U+0203C\:bangbang:Double Exclamation Mark
    U+02040\tieconcatCharacter Tie
    U+02049\:interrobang:Exclamation Question Mark
    U+02057\pppprimeQuadruple Prime
    U+0205D\tricolonTricolon
    U+02060\nolinebreakWord Joiner
    U+02070\^0Superscript Zero / Superscript Digit Zero
    U+02071\^iSuperscript Latin Small Letter I
    U+02074\^4Superscript Four / Superscript Digit Four
    U+02075\^5Superscript Five / Superscript Digit Five
    U+02076\^6Superscript Six / Superscript Digit Six
    U+02077\^7Superscript Seven / Superscript Digit Seven
    U+02078\^8Superscript Eight / Superscript Digit Eight
    U+02079\^9Superscript Nine / Superscript Digit Nine
    U+0207A\^+Superscript Plus Sign
    U+0207B\^-Superscript Minus / Superscript Hyphen-Minus
    U+0207C\^=Superscript Equals Sign
    U+0207D\^(Superscript Left Parenthesis / Superscript Opening Parenthesis
    U+0207E\^)Superscript Right Parenthesis / Superscript Closing Parenthesis
    U+0207F\^nSuperscript Latin Small Letter N
    U+02080\_0Subscript Zero / Subscript Digit Zero
    U+02081\_1Subscript One / Subscript Digit One
    U+02082\_2Subscript Two / Subscript Digit Two
    U+02083\_3Subscript Three / Subscript Digit Three
    U+02084\_4Subscript Four / Subscript Digit Four
    U+02085\_5Subscript Five / Subscript Digit Five
    U+02086\_6Subscript Six / Subscript Digit Six
    U+02087\_7Subscript Seven / Subscript Digit Seven
    U+02088\_8Subscript Eight / Subscript Digit Eight
    U+02089\_9Subscript Nine / Subscript Digit Nine
    U+0208A\_+Subscript Plus Sign
    U+0208B\_-Subscript Minus / Subscript Hyphen-Minus
    U+0208C\_=Subscript Equals Sign
    U+0208D\_(Subscript Left Parenthesis / Subscript Opening Parenthesis
    U+0208E\_)Subscript Right Parenthesis / Subscript Closing Parenthesis
    U+02090\_aLatin Subscript Small Letter A
    U+02091\_eLatin Subscript Small Letter E
    U+02092\_oLatin Subscript Small Letter O
    U+02093\_xLatin Subscript Small Letter X
    U+02094\_schwaLatin Subscript Small Letter Schwa
    U+02095\_hLatin Subscript Small Letter H
    U+02096\_kLatin Subscript Small Letter K
    U+02097\_lLatin Subscript Small Letter L
    U+02098\_mLatin Subscript Small Letter M
    U+02099\_nLatin Subscript Small Letter N
    U+0209A\_pLatin Subscript Small Letter P
    U+0209B\_sLatin Subscript Small Letter S
    U+0209C\_tLatin Subscript Small Letter T
    U+020A7\pesPeseta Sign
    U+020AC\euroEuro Sign
    U+020D0 ⃐ \leftharpoonaccentCombining Left Harpoon Above / Non-Spacing Left Harpoon Above
    U+020D1 ⃑ \rightharpoonaccentCombining Right Harpoon Above / Non-Spacing Right Harpoon Above
    U+020D2 ⃒ \vertoverlayCombining Long Vertical Line Overlay / Non-Spacing Long Vertical Bar Overlay
    U+020D6 ⃖ \overleftarrowCombining Left Arrow Above / Non-Spacing Left Arrow Above
    U+020D7 ⃗ \vecCombining Right Arrow Above / Non-Spacing Right Arrow Above
    U+020DB ⃛ \dddotCombining Three Dots Above / Non-Spacing Three Dots Above
    U+020DC ⃜ \ddddotCombining Four Dots Above / Non-Spacing Four Dots Above
    U+020DD ⃝ \enclosecircleCombining Enclosing Circle / Enclosing Circle
    U+020DE ⃞ \enclosesquareCombining Enclosing Square / Enclosing Square
    U+020DF ⃟ \enclosediamondCombining Enclosing Diamond / Enclosing Diamond
    U+020E1 ⃡ \overleftrightarrowCombining Left Right Arrow Above / Non-Spacing Left Right Arrow Above
    U+020E4 ⃤ \enclosetriangleCombining Enclosing Upward Pointing Triangle
    U+020E7 ⃧ \annuityCombining Annuity Symbol
    U+020E8 ⃨ \threeunderdotCombining Triple Underdot
    U+020E9 ⃩ \widebridgeaboveCombining Wide Bridge Above
    U+020EC ⃬ \underrightharpoondownCombining Rightwards Harpoon With Barb Downwards
    U+020ED ⃭ \underleftharpoondownCombining Leftwards Harpoon With Barb Downwards
    U+020EE ⃮ \underleftarrowCombining Left Arrow Below
    U+020EF ⃯ \underrightarrowCombining Right Arrow Below
    U+020F0 ⃰ \asteraccentCombining Asterisk Above
    U+02102\bbCDouble-Struck Capital C / Double-Struck C
    U+02107\eulermascheroniEuler Constant / Eulers
    U+0210A\scrgScript Small G
    U+0210B\scrHScript Capital H / Script H
    U+0210C\frakHBlack-Letter Capital H / Black-Letter H
    U+0210D\bbHDouble-Struck Capital H / Double-Struck H
    U+0210E\ith, \planckPlanck Constant
    U+0210F\hslashPlanck Constant Over Two Pi / Planck Constant Over 2 Pi
    U+02110\scrIScript Capital I / Script I
    U+02111\Im, \frakIBlack-Letter Capital I / Black-Letter I
    U+02112\scrLScript Capital L / Script L
    U+02113\ellScript Small L
    U+02115\bbNDouble-Struck Capital N / Double-Struck N
    U+02116\numeroNumero Sign / Numero
    U+02118\wpScript Capital P / Script P
    U+02119\bbPDouble-Struck Capital P / Double-Struck P
    U+0211A\bbQDouble-Struck Capital Q / Double-Struck Q
    U+0211B\scrRScript Capital R / Script R
    U+0211C\Re, \frakRBlack-Letter Capital R / Black-Letter R
    U+0211D\bbRDouble-Struck Capital R / Double-Struck R
    U+0211E\xratPrescription Take
    U+02122\trademark, \:tm:Trade Mark Sign / Trademark
    U+02124\bbZDouble-Struck Capital Z / Double-Struck Z
    U+02126\ohmOhm Sign / Ohm
    U+02127\mhoInverted Ohm Sign / Mho
    U+02128\frakZBlack-Letter Capital Z / Black-Letter Z
    U+02129\turnediotaTurned Greek Small Letter Iota
    U+0212B\AngstromAngstrom Sign / Angstrom Unit
    U+0212C\scrBScript Capital B / Script B
    U+0212D\frakCBlack-Letter Capital C / Black-Letter C
    U+0212F\scre, \eulerScript Small E
    U+02130\scrEScript Capital E / Script E
    U+02131\scrFScript Capital F / Script F
    U+02132\FinvTurned Capital F / Turned F
    U+02133\scrMScript Capital M / Script M
    U+02134\scroScript Small O
    U+02135\alephAlef Symbol / First Transfinite Cardinal
    U+02136\bethBet Symbol / Second Transfinite Cardinal
    U+02137\gimelGimel Symbol / Third Transfinite Cardinal
    U+02138\dalethDalet Symbol / Fourth Transfinite Cardinal
    U+02139\:information_source:Information Source
    U+0213C\bbpiDouble-Struck Small Pi
    U+0213D\bbgammaDouble-Struck Small Gamma
    U+0213E\bbGammaDouble-Struck Capital Gamma
    U+0213F\bbPiDouble-Struck Capital Pi
    U+02140\bbsumDouble-Struck N-Ary Summation
    U+02141\GameTurned Sans-Serif Capital G
    U+02142\sansLturnedTurned Sans-Serif Capital L
    U+02143\sansLmirroredReversed Sans-Serif Capital L
    U+02144\YupTurned Sans-Serif Capital Y
    U+02145\bbiDDouble-Struck Italic Capital D
    U+02146\bbidDouble-Struck Italic Small D
    U+02147\bbieDouble-Struck Italic Small E
    U+02148\bbiiDouble-Struck Italic Small I
    U+02149\bbijDouble-Struck Italic Small J
    U+0214A\PropertyLineProperty Line
    U+0214B\upandTurned Ampersand
    U+02150\1/7Vulgar Fraction One Seventh
    U+02151\1/9Vulgar Fraction One Ninth
    U+02152\1/10Vulgar Fraction One Tenth
    U+02153\1/3Vulgar Fraction One Third / Fraction One Third
    U+02154\2/3Vulgar Fraction Two Thirds / Fraction Two Thirds
    U+02155\1/5Vulgar Fraction One Fifth / Fraction One Fifth
    U+02156\2/5Vulgar Fraction Two Fifths / Fraction Two Fifths
    U+02157\3/5Vulgar Fraction Three Fifths / Fraction Three Fifths
    U+02158\4/5Vulgar Fraction Four Fifths / Fraction Four Fifths
    U+02159\1/6Vulgar Fraction One Sixth / Fraction One Sixth
    U+0215A\5/6Vulgar Fraction Five Sixths / Fraction Five Sixths
    U+0215B\1/8Vulgar Fraction One Eighth / Fraction One Eighth
    U+0215C\3/8Vulgar Fraction Three Eighths / Fraction Three Eighths
    U+0215D\5/8Vulgar Fraction Five Eighths / Fraction Five Eighths
    U+0215E\7/8Vulgar Fraction Seven Eighths / Fraction Seven Eighths
    U+0215F\1/Fraction Numerator One
    U+02189\0/3Vulgar Fraction Zero Thirds
    U+02190\leftarrowLeftwards Arrow / Left Arrow
    U+02191\uparrowUpwards Arrow / Up Arrow
    U+02192\to, \rightarrowRightwards Arrow / Right Arrow
    U+02193\downarrowDownwards Arrow / Down Arrow
    U+02194\leftrightarrow, \:left_right_arrow:Left Right Arrow
    U+02195\updownarrow, \:arrow_up_down:Up Down Arrow
    U+02196\nwarrow, \:arrow_upper_left:North West Arrow / Upper Left Arrow
    U+02197\nearrow, \:arrow_upper_right:North East Arrow / Upper Right Arrow
    U+02198\searrow, \:arrow_lower_right:South East Arrow / Lower Right Arrow
    U+02199\swarrow, \:arrow_lower_left:South West Arrow / Lower Left Arrow
    U+0219A\nleftarrowLeftwards Arrow With Stroke / Left Arrow With Stroke
    U+0219B\nrightarrowRightwards Arrow With Stroke / Right Arrow With Stroke
    U+0219C\leftwavearrowLeftwards Wave Arrow / Left Wave Arrow
    U+0219D\rightwavearrowRightwards Wave Arrow / Right Wave Arrow
    U+0219E\twoheadleftarrowLeftwards Two Headed Arrow / Left Two Headed Arrow
    U+0219F\twoheaduparrowUpwards Two Headed Arrow / Up Two Headed Arrow
    U+021A0\twoheadrightarrowRightwards Two Headed Arrow / Right Two Headed Arrow
    U+021A1\twoheaddownarrowDownwards Two Headed Arrow / Down Two Headed Arrow
    U+021A2\leftarrowtailLeftwards Arrow With Tail / Left Arrow With Tail
    U+021A3\rightarrowtailRightwards Arrow With Tail / Right Arrow With Tail
    U+021A4\mapsfromLeftwards Arrow From Bar / Left Arrow From Bar
    U+021A5\mapsupUpwards Arrow From Bar / Up Arrow From Bar
    U+021A6\mapstoRightwards Arrow From Bar / Right Arrow From Bar
    U+021A7\mapsdownDownwards Arrow From Bar / Down Arrow From Bar
    U+021A8\updownarrowbarUp Down Arrow With Base
    U+021A9\hookleftarrow, \:leftwards_arrow_with_hook:Leftwards Arrow With Hook / Left Arrow With Hook
    U+021AA\hookrightarrow, \:arrow_right_hook:Rightwards Arrow With Hook / Right Arrow With Hook
    U+021AB\looparrowleftLeftwards Arrow With Loop / Left Arrow With Loop
    U+021AC\looparrowrightRightwards Arrow With Loop / Right Arrow With Loop
    U+021AD\leftrightsquigarrowLeft Right Wave Arrow
    U+021AE\nleftrightarrowLeft Right Arrow With Stroke
    U+021AF\downzigzagarrowDownwards Zigzag Arrow / Down Zigzag Arrow
    U+021B0\LshUpwards Arrow With Tip Leftwards / Up Arrow With Tip Left
    U+021B1\RshUpwards Arrow With Tip Rightwards / Up Arrow With Tip Right
    U+021B2\LdshDownwards Arrow With Tip Leftwards / Down Arrow With Tip Left
    U+021B3\RdshDownwards Arrow With Tip Rightwards / Down Arrow With Tip Right
    U+021B4\linefeedRightwards Arrow With Corner Downwards / Right Arrow With Corner Down
    U+021B5\carriagereturnDownwards Arrow With Corner Leftwards / Down Arrow With Corner Left
    U+021B6\curvearrowleftAnticlockwise Top Semicircle Arrow
    U+021B7\curvearrowrightClockwise Top Semicircle Arrow
    U+021B8\barovernorthwestarrowNorth West Arrow To Long Bar / Upper Left Arrow To Long Bar
    U+021B9\barleftarrowrightarrowbarLeftwards Arrow To Bar Over Rightwards Arrow To Bar / Left Arrow To Bar Over Right Arrow To Bar
    U+021BA\circlearrowleftAnticlockwise Open Circle Arrow
    U+021BB\circlearrowrightClockwise Open Circle Arrow
    U+021BC\leftharpoonupLeftwards Harpoon With Barb Upwards / Left Harpoon With Barb Up
    U+021BD\leftharpoondownLeftwards Harpoon With Barb Downwards / Left Harpoon With Barb Down
    U+021BE\upharpoonrightUpwards Harpoon With Barb Rightwards / Up Harpoon With Barb Right
    U+021BF\upharpoonleftUpwards Harpoon With Barb Leftwards / Up Harpoon With Barb Left
    U+021C0\rightharpoonupRightwards Harpoon With Barb Upwards / Right Harpoon With Barb Up
    U+021C1\rightharpoondownRightwards Harpoon With Barb Downwards / Right Harpoon With Barb Down
    U+021C2\downharpoonrightDownwards Harpoon With Barb Rightwards / Down Harpoon With Barb Right
    U+021C3\downharpoonleftDownwards Harpoon With Barb Leftwards / Down Harpoon With Barb Left
    U+021C4\rightleftarrowsRightwards Arrow Over Leftwards Arrow / Right Arrow Over Left Arrow
    U+021C5\dblarrowupdownUpwards Arrow Leftwards Of Downwards Arrow / Up Arrow Left Of Down Arrow
    U+021C6\leftrightarrowsLeftwards Arrow Over Rightwards Arrow / Left Arrow Over Right Arrow
    U+021C7\leftleftarrowsLeftwards Paired Arrows / Left Paired Arrows
    U+021C8\upuparrowsUpwards Paired Arrows / Up Paired Arrows
    U+021C9\rightrightarrowsRightwards Paired Arrows / Right Paired Arrows
    U+021CA\downdownarrowsDownwards Paired Arrows / Down Paired Arrows
    U+021CB\leftrightharpoonsLeftwards Harpoon Over Rightwards Harpoon / Left Harpoon Over Right Harpoon
    U+021CC\rightleftharpoonsRightwards Harpoon Over Leftwards Harpoon / Right Harpoon Over Left Harpoon
    U+021CD\nLeftarrowLeftwards Double Arrow With Stroke / Left Double Arrow With Stroke
    U+021CE\nLeftrightarrowLeft Right Double Arrow With Stroke
    U+021CF\nRightarrowRightwards Double Arrow With Stroke / Right Double Arrow With Stroke
    U+021D0\LeftarrowLeftwards Double Arrow / Left Double Arrow
    U+021D1\UparrowUpwards Double Arrow / Up Double Arrow
    U+021D2\RightarrowRightwards Double Arrow / Right Double Arrow
    U+021D3\DownarrowDownwards Double Arrow / Down Double Arrow
    U+021D4\LeftrightarrowLeft Right Double Arrow
    U+021D5\UpdownarrowUp Down Double Arrow
    U+021D6\NwarrowNorth West Double Arrow / Upper Left Double Arrow
    U+021D7\NearrowNorth East Double Arrow / Upper Right Double Arrow
    U+021D8\SearrowSouth East Double Arrow / Lower Right Double Arrow
    U+021D9\SwarrowSouth West Double Arrow / Lower Left Double Arrow
    U+021DA\LleftarrowLeftwards Triple Arrow / Left Triple Arrow
    U+021DB\RrightarrowRightwards Triple Arrow / Right Triple Arrow
    U+021DC\leftsquigarrowLeftwards Squiggle Arrow / Left Squiggle Arrow
    U+021DD\rightsquigarrowRightwards Squiggle Arrow / Right Squiggle Arrow
    U+021DE\nHuparrowUpwards Arrow With Double Stroke / Up Arrow With Double Stroke
    U+021DF\nHdownarrowDownwards Arrow With Double Stroke / Down Arrow With Double Stroke
    U+021E0\leftdasharrowLeftwards Dashed Arrow / Left Dashed Arrow
    U+021E1\updasharrowUpwards Dashed Arrow / Up Dashed Arrow
    U+021E2\rightdasharrowRightwards Dashed Arrow / Right Dashed Arrow
    U+021E3\downdasharrowDownwards Dashed Arrow / Down Dashed Arrow
    U+021E4\barleftarrowLeftwards Arrow To Bar / Left Arrow To Bar
    U+021E5\rightarrowbarRightwards Arrow To Bar / Right Arrow To Bar
    U+021E6\leftwhitearrowLeftwards White Arrow / White Left Arrow
    U+021E7\upwhitearrowUpwards White Arrow / White Up Arrow
    U+021E8\rightwhitearrowRightwards White Arrow / White Right Arrow
    U+021E9\downwhitearrowDownwards White Arrow / White Down Arrow
    U+021EA\whitearrowupfrombarUpwards White Arrow From Bar / White Up Arrow From Bar
    U+021F4\circleonrightarrowRight Arrow With Small Circle
    U+021F5\DownArrowUpArrowDownwards Arrow Leftwards Of Upwards Arrow
    U+021F6\rightthreearrowsThree Rightwards Arrows
    U+021F7\nvleftarrowLeftwards Arrow With Vertical Stroke
    U+021F8\nvrightarrowRightwards Arrow With Vertical Stroke
    U+021F9\nvleftrightarrowLeft Right Arrow With Vertical Stroke
    U+021FA\nVleftarrowLeftwards Arrow With Double Vertical Stroke
    U+021FB\nVrightarrowRightwards Arrow With Double Vertical Stroke
    U+021FC\nVleftrightarrowLeft Right Arrow With Double Vertical Stroke
    U+021FD\leftarrowtriangleLeftwards Open-Headed Arrow
    U+021FE\rightarrowtriangleRightwards Open-Headed Arrow
    U+021FF\leftrightarrowtriangleLeft Right Open-Headed Arrow
    U+02200\forallFor All
    U+02201\complementComplement
    U+02202\partialPartial Differential
    U+02203\existsThere Exists
    U+02204\nexistsThere Does Not Exist
    U+02205\varnothing, \emptysetEmpty Set
    U+02206\incrementIncrement
    U+02207\del, \nablaNabla
    U+02208\inElement Of
    U+02209\notinNot An Element Of
    U+0220A\smallinSmall Element Of
    U+0220B\niContains As Member
    U+0220C\nniDoes Not Contain As Member
    U+0220D\smallniSmall Contains As Member
    U+0220E\QEDEnd Of Proof
    U+0220F\prodN-Ary Product
    U+02210\coprodN-Ary Coproduct
    U+02211\sumN-Ary Summation
    U+02212\minusMinus Sign
    U+02213\mpMinus-Or-Plus Sign
    U+02214\dotplusDot Plus
    U+02216\setminusSet Minus
    U+02217\astAsterisk Operator
    U+02218\circRing Operator
    U+02219\vysmblkcircleBullet Operator
    U+0221A\surd, \sqrtSquare Root
    U+0221B\cbrtCube Root
    U+0221C\fourthrootFourth Root
    U+0221D\proptoProportional To
    U+0221E\inftyInfinity
    U+0221F\rightangleRight Angle
    U+02220\angleAngle
    U+02221\measuredangleMeasured Angle
    U+02222\sphericalangleSpherical Angle
    U+02223\midDivides
    U+02224\nmidDoes Not Divide
    U+02225\parallelParallel To
    U+02226\nparallelNot Parallel To
    U+02227\wedgeLogical And
    U+02228\veeLogical Or
    U+02229\capIntersection
    U+0222A\cupUnion
    U+0222B\intIntegral
    U+0222C\iintDouble Integral
    U+0222D\iiintTriple Integral
    U+0222E\ointContour Integral
    U+0222F\oiintSurface Integral
    U+02230\oiiintVolume Integral
    U+02231\clwintegralClockwise Integral
    U+02232\varointclockwiseClockwise Contour Integral
    U+02233\ointctrclockwiseAnticlockwise Contour Integral
    U+02234\thereforeTherefore
    U+02235\becauseBecause
    U+02237\ColonProportion
    U+02238\dotminusDot Minus
    U+0223A\dotsminusdotsGeometric Proportion
    U+0223B\kernelcontractionHomothetic
    U+0223C\simTilde Operator
    U+0223D\backsimReversed Tilde
    U+0223E\lazysinvInverted Lazy S
    U+0223F\sinewaveSine Wave
    U+02240\wrWreath Product
    U+02241\nsimNot Tilde
    U+02242\eqsimMinus Tilde
    U+02242 + U+00338≂̸\neqsimMinus Tilde + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02243\simeqAsymptotically Equal To
    U+02244\nsimeNot Asymptotically Equal To
    U+02245\congApproximately Equal To
    U+02246\approxnotequalApproximately But Not Actually Equal To
    U+02247\ncongNeither Approximately Nor Actually Equal To
    U+02248\approxAlmost Equal To
    U+02249\napproxNot Almost Equal To
    U+0224A\approxeqAlmost Equal Or Equal To
    U+0224B\tildetrplTriple Tilde
    U+0224C\allequalAll Equal To
    U+0224D\asympEquivalent To
    U+0224E\BumpeqGeometrically Equivalent To
    U+0224E + U+00338≎̸\nBumpeqGeometrically Equivalent To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0224F\bumpeqDifference Between
    U+0224F + U+00338≏̸\nbumpeqDifference Between + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02250\doteqApproaches The Limit
    U+02251\DoteqGeometrically Equal To
    U+02252\fallingdotseqApproximately Equal To Or The Image Of
    U+02253\risingdotseqImage Of Or Approximately Equal To
    U+02254\coloneqColon Equals / Colon Equal
    U+02255\eqcolonEquals Colon / Equal Colon
    U+02256\eqcircRing In Equal To
    U+02257\circeqRing Equal To
    U+02258\arceqCorresponds To
    U+02259\wedgeqEstimates
    U+0225A\veeeqEquiangular To
    U+0225B\starequalStar Equals
    U+0225C\triangleqDelta Equal To
    U+0225D\eqdefEqual To By Definition
    U+0225E\measeqMeasured By
    U+0225F\questeqQuestioned Equal To
    U+02260\ne, \neqNot Equal To
    U+02261\equivIdentical To
    U+02262\nequivNot Identical To
    U+02263\EquivStrictly Equivalent To
    U+02264\le, \leqLess-Than Or Equal To / Less Than Or Equal To
    U+02265\ge, \geqGreater-Than Or Equal To / Greater Than Or Equal To
    U+02266\leqqLess-Than Over Equal To / Less Than Over Equal To
    U+02267\geqqGreater-Than Over Equal To / Greater Than Over Equal To
    U+02268\lneqqLess-Than But Not Equal To / Less Than But Not Equal To
    U+02268 + U+0FE00≨︀\lvertneqqLess-Than But Not Equal To / Less Than But Not Equal To + Variation Selector-1
    U+02269\gneqqGreater-Than But Not Equal To / Greater Than But Not Equal To
    U+02269 + U+0FE00≩︀\gvertneqqGreater-Than But Not Equal To / Greater Than But Not Equal To + Variation Selector-1
    U+0226A\llMuch Less-Than / Much Less Than
    U+0226A + U+00338≪̸\NotLessLessMuch Less-Than / Much Less Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0226B\ggMuch Greater-Than / Much Greater Than
    U+0226B + U+00338≫̸\NotGreaterGreaterMuch Greater-Than / Much Greater Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0226C\betweenBetween
    U+0226D\nasympNot Equivalent To
    U+0226E\nlessNot Less-Than / Not Less Than
    U+0226F\ngtrNot Greater-Than / Not Greater Than
    U+02270\nleqNeither Less-Than Nor Equal To / Neither Less Than Nor Equal To
    U+02271\ngeqNeither Greater-Than Nor Equal To / Neither Greater Than Nor Equal To
    U+02272\lesssimLess-Than Or Equivalent To / Less Than Or Equivalent To
    U+02273\gtrsimGreater-Than Or Equivalent To / Greater Than Or Equivalent To
    U+02274\nlesssimNeither Less-Than Nor Equivalent To / Neither Less Than Nor Equivalent To
    U+02275\ngtrsimNeither Greater-Than Nor Equivalent To / Neither Greater Than Nor Equivalent To
    U+02276\lessgtrLess-Than Or Greater-Than / Less Than Or Greater Than
    U+02277\gtrlessGreater-Than Or Less-Than / Greater Than Or Less Than
    U+02278\notlessgreaterNeither Less-Than Nor Greater-Than / Neither Less Than Nor Greater Than
    U+02279\notgreaterlessNeither Greater-Than Nor Less-Than / Neither Greater Than Nor Less Than
    U+0227A\precPrecedes
    U+0227B\succSucceeds
    U+0227C\preccurlyeqPrecedes Or Equal To
    U+0227D\succcurlyeqSucceeds Or Equal To
    U+0227E\precsimPrecedes Or Equivalent To
    U+0227E + U+00338≾̸\nprecsimPrecedes Or Equivalent To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+0227F\succsimSucceeds Or Equivalent To
    U+0227F + U+00338≿̸\nsuccsimSucceeds Or Equivalent To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02280\nprecDoes Not Precede
    U+02281\nsuccDoes Not Succeed
    U+02282\subsetSubset Of
    U+02283\supsetSuperset Of
    U+02284\nsubsetNot A Subset Of
    U+02285\nsupsetNot A Superset Of
    U+02286\subseteqSubset Of Or Equal To
    U+02287\supseteqSuperset Of Or Equal To
    U+02288\nsubseteqNeither A Subset Of Nor Equal To
    U+02289\nsupseteqNeither A Superset Of Nor Equal To
    U+0228A\subsetneqSubset Of With Not Equal To / Subset Of Or Not Equal To
    U+0228A + U+0FE00⊊︀\varsubsetneqqSubset Of With Not Equal To / Subset Of Or Not Equal To + Variation Selector-1
    U+0228B\supsetneqSuperset Of With Not Equal To / Superset Of Or Not Equal To
    U+0228B + U+0FE00⊋︀\varsupsetneqSuperset Of With Not Equal To / Superset Of Or Not Equal To + Variation Selector-1
    U+0228D\cupdotMultiset Multiplication
    U+0228E\uplusMultiset Union
    U+0228F\sqsubsetSquare Image Of
    U+0228F + U+00338⊏̸\NotSquareSubsetSquare Image Of + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02290\sqsupsetSquare Original Of
    U+02290 + U+00338⊐̸\NotSquareSupersetSquare Original Of + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02291\sqsubseteqSquare Image Of Or Equal To
    U+02292\sqsupseteqSquare Original Of Or Equal To
    U+02293\sqcapSquare Cap
    U+02294\sqcupSquare Cup
    U+02295\oplusCircled Plus
    U+02296\ominusCircled Minus
    U+02297\otimesCircled Times
    U+02298\oslashCircled Division Slash
    U+02299\odotCircled Dot Operator
    U+0229A\circledcircCircled Ring Operator
    U+0229B\circledastCircled Asterisk Operator
    U+0229C\circledequalCircled Equals
    U+0229D\circleddashCircled Dash
    U+0229E\boxplusSquared Plus
    U+0229F\boxminusSquared Minus
    U+022A0\boxtimesSquared Times
    U+022A1\boxdotSquared Dot Operator
    U+022A2\vdashRight Tack
    U+022A3\dashvLeft Tack
    U+022A4\topDown Tack
    U+022A5\botUp Tack
    U+022A7\modelsModels
    U+022A8\vDashTrue
    U+022A9\VdashForces
    U+022AA\VvdashTriple Vertical Bar Right Turnstile
    U+022AB\VDashDouble Vertical Bar Double Right Turnstile
    U+022AC\nvdashDoes Not Prove
    U+022AD\nvDashNot True
    U+022AE\nVdashDoes Not Force
    U+022AF\nVDashNegated Double Vertical Bar Double Right Turnstile
    U+022B0\prurelPrecedes Under Relation
    U+022B1\scurelSucceeds Under Relation
    U+022B2\vartriangleleftNormal Subgroup Of
    U+022B3\vartrianglerightContains As Normal Subgroup
    U+022B4\trianglelefteqNormal Subgroup Of Or Equal To
    U+022B5\trianglerighteqContains As Normal Subgroup Or Equal To
    U+022B6\originalOriginal Of
    U+022B7\imageImage Of
    U+022B8\multimapMultimap
    U+022B9\hermitconjmatrixHermitian Conjugate Matrix
    U+022BA\intercalIntercalate
    U+022BB\veebar, \xorXor
    U+022BC\barwedge, \nandNand
    U+022BD\barvee, \norNor
    U+022BE\rightanglearcRight Angle With Arc
    U+022BF\varlrtriangleRight Triangle
    U+022C0\bigwedgeN-Ary Logical And
    U+022C1\bigveeN-Ary Logical Or
    U+022C2\bigcapN-Ary Intersection
    U+022C3\bigcupN-Ary Union
    U+022C4\diamondDiamond Operator
    U+022C5\cdotDot Operator
    U+022C6\starStar Operator
    U+022C7\divideontimesDivision Times
    U+022C8\bowtieBowtie
    U+022C9\ltimesLeft Normal Factor Semidirect Product
    U+022CA\rtimesRight Normal Factor Semidirect Product
    U+022CB\leftthreetimesLeft Semidirect Product
    U+022CC\rightthreetimesRight Semidirect Product
    U+022CD\backsimeqReversed Tilde Equals
    U+022CE\curlyveeCurly Logical Or
    U+022CF\curlywedgeCurly Logical And
    U+022D0\SubsetDouble Subset
    U+022D1\SupsetDouble Superset
    U+022D2\CapDouble Intersection
    U+022D3\CupDouble Union
    U+022D4\pitchforkPitchfork
    U+022D5\equalparallelEqual And Parallel To
    U+022D6\lessdotLess-Than With Dot / Less Than With Dot
    U+022D7\gtrdotGreater-Than With Dot / Greater Than With Dot
    U+022D8\verymuchlessVery Much Less-Than / Very Much Less Than
    U+022D9\gggVery Much Greater-Than / Very Much Greater Than
    U+022DA\lesseqgtrLess-Than Equal To Or Greater-Than / Less Than Equal To Or Greater Than
    U+022DB\gtreqlessGreater-Than Equal To Or Less-Than / Greater Than Equal To Or Less Than
    U+022DC\eqlessEqual To Or Less-Than / Equal To Or Less Than
    U+022DD\eqgtrEqual To Or Greater-Than / Equal To Or Greater Than
    U+022DE\curlyeqprecEqual To Or Precedes
    U+022DF\curlyeqsuccEqual To Or Succeeds
    U+022E0\npreccurlyeqDoes Not Precede Or Equal
    U+022E1\nsucccurlyeqDoes Not Succeed Or Equal
    U+022E2\nsqsubseteqNot Square Image Of Or Equal To
    U+022E3\nsqsupseteqNot Square Original Of Or Equal To
    U+022E4\sqsubsetneqSquare Image Of Or Not Equal To
    U+022E5\sqsupsetneqSquare Original Of Or Not Equal To
    U+022E6\lnsimLess-Than But Not Equivalent To / Less Than But Not Equivalent To
    U+022E7\gnsimGreater-Than But Not Equivalent To / Greater Than But Not Equivalent To
    U+022E8\precnsimPrecedes But Not Equivalent To
    U+022E9\succnsimSucceeds But Not Equivalent To
    U+022EA\ntriangleleftNot Normal Subgroup Of
    U+022EB\ntrianglerightDoes Not Contain As Normal Subgroup
    U+022EC\ntrianglelefteqNot Normal Subgroup Of Or Equal To
    U+022ED\ntrianglerighteqDoes Not Contain As Normal Subgroup Or Equal
    U+022EE\vdotsVertical Ellipsis
    U+022EF\cdotsMidline Horizontal Ellipsis
    U+022F0\adotsUp Right Diagonal Ellipsis
    U+022F1\ddotsDown Right Diagonal Ellipsis
    U+022F2\disinElement Of With Long Horizontal Stroke
    U+022F3\varisinsElement Of With Vertical Bar At End Of Horizontal Stroke
    U+022F4\isinsSmall Element Of With Vertical Bar At End Of Horizontal Stroke
    U+022F5\isindotElement Of With Dot Above
    U+022F6\varisinobarElement Of With Overbar
    U+022F7\isinobarSmall Element Of With Overbar
    U+022F8\isinvbElement Of With Underbar
    U+022F9\isinEElement Of With Two Horizontal Strokes
    U+022FA\nisdContains With Long Horizontal Stroke
    U+022FB\varnisContains With Vertical Bar At End Of Horizontal Stroke
    U+022FC\nisSmall Contains With Vertical Bar At End Of Horizontal Stroke
    U+022FD\varniobarContains With Overbar
    U+022FE\niobarSmall Contains With Overbar
    U+022FF\bagmemberZ Notation Bag Membership
    U+02300\diameterDiameter Sign
    U+02302\houseHouse
    U+02305\varbarwedgeProjective
    U+02306\vardoublebarwedgePerspective
    U+02308\lceilLeft Ceiling
    U+02309\rceilRight Ceiling
    U+0230A\lfloorLeft Floor
    U+0230B\rfloorRight Floor
    U+02310\invnotReversed Not Sign
    U+02311\sqlozengeSquare Lozenge
    U+02312\proflineArc
    U+02313\profsurfSegment
    U+02315\recorderTelephone Recorder
    U+02317\viewdataViewdata Square
    U+02319\turnednotTurned Not Sign
    U+0231A\:watch:Watch
    U+0231B\:hourglass:Hourglass
    U+0231C\ulcornerTop Left Corner
    U+0231D\urcornerTop Right Corner
    U+0231E\llcornerBottom Left Corner
    U+0231F\lrcornerBottom Right Corner
    U+02322\frownFrown
    U+02323\smileSmile
    U+0232C\varhexagonlrbondsBenzene Ring
    U+02332\conictaperConical Taper
    U+02336\topbotApl Functional Symbol I-Beam
    U+0233D\obarApl Functional Symbol Circle Stile
    U+0233F\notslashApl Functional Symbol Slash Bar
    U+02340\notbackslashApl Functional Symbol Backslash Bar
    U+02353\boxupcaretApl Functional Symbol Quad Up Caret
    U+02370\boxquestionApl Functional Symbol Quad Question
    U+02394\hexagonSoftware-Function Symbol
    U+023A3\dlcornLeft Square Bracket Lower Corner
    U+023B0\lmoustacheUpper Left Or Lower Right Curly Bracket Section
    U+023B1\rmoustacheUpper Right Or Lower Left Curly Bracket Section
    U+023B4\overbracketTop Square Bracket
    U+023B5\underbracketBottom Square Bracket
    U+023B6\bbrktbrkBottom Square Bracket Over Top Square Bracket
    U+023B7\sqrtbottomRadical Symbol Bottom
    U+023B8\lvboxlineLeft Vertical Box Line
    U+023B9\rvboxlineRight Vertical Box Line
    U+023CE\varcarriagereturnReturn Symbol
    U+023DE\overbraceTop Curly Bracket
    U+023DF\underbraceBottom Curly Bracket
    U+023E2\trapeziumWhite Trapezium
    U+023E3\benzenrBenzene Ring With Circle
    U+023E4\strnsStraightness
    U+023E5\fltnsFlatness
    U+023E6\accurrentAc Current
    U+023E7\elintersElectrical Intersection
    U+023E9\:fast_forward:Black Right-Pointing Double Triangle
    U+023EA\:rewind:Black Left-Pointing Double Triangle
    U+023EB\:arrow_double_up:Black Up-Pointing Double Triangle
    U+023EC\:arrow_double_down:Black Down-Pointing Double Triangle
    U+023F0\:alarm_clock:Alarm Clock
    U+023F3\:hourglass_flowing_sand:Hourglass With Flowing Sand
    U+02422\blanksymbolBlank Symbol / Blank
    U+02423\visiblespaceOpen Box
    U+024C2\:m:Circled Latin Capital Letter M
    U+024C8\circledSCircled Latin Capital Letter S
    U+02506\dshfncBox Drawings Light Triple Dash Vertical / Forms Light Triple Dash Vertical
    U+02519\sqfnwBox Drawings Up Light And Left Heavy / Forms Up Light And Left Heavy
    U+02571\diagupBox Drawings Light Diagonal Upper Right To Lower Left / Forms Light Diagonal Upper Right To Lower Left
    U+02572\diagdownBox Drawings Light Diagonal Upper Left To Lower Right / Forms Light Diagonal Upper Left To Lower Right
    U+02580\blockuphalfUpper Half Block
    U+02584\blocklowhalfLower Half Block
    U+02588\blockfullFull Block
    U+0258C\blocklefthalfLeft Half Block
    U+02590\blockrighthalfRight Half Block
    U+02591\blockqtrshadedLight Shade
    U+02592\blockhalfshadedMedium Shade
    U+02593\blockthreeqtrshadedDark Shade
    U+025A0\blacksquareBlack Square
    U+025A1\squareWhite Square
    U+025A2\squovalWhite Square With Rounded Corners
    U+025A3\blackinwhitesquareWhite Square Containing Black Small Square
    U+025A4\squarehfillSquare With Horizontal Fill
    U+025A5\squarevfillSquare With Vertical Fill
    U+025A6\squarehvfillSquare With Orthogonal Crosshatch Fill
    U+025A7\squarenwsefillSquare With Upper Left To Lower Right Fill
    U+025A8\squareneswfillSquare With Upper Right To Lower Left Fill
    U+025A9\squarecrossfillSquare With Diagonal Crosshatch Fill
    U+025AA\smblksquare, \:black_small_square:Black Small Square
    U+025AB\smwhtsquare, \:white_small_square:White Small Square
    U+025AC\hrectangleblackBlack Rectangle
    U+025AD\hrectangleWhite Rectangle
    U+025AE\vrectangleblackBlack Vertical Rectangle
    U+025AF\vrectoWhite Vertical Rectangle
    U+025B0\parallelogramblackBlack Parallelogram
    U+025B1\parallelogramWhite Parallelogram
    U+025B2\bigblacktriangleupBlack Up-Pointing Triangle / Black Up Pointing Triangle
    U+025B3\bigtriangleupWhite Up-Pointing Triangle / White Up Pointing Triangle
    U+025B4\blacktriangleBlack Up-Pointing Small Triangle / Black Up Pointing Small Triangle
    U+025B5\vartriangleWhite Up-Pointing Small Triangle / White Up Pointing Small Triangle
    U+025B6\blacktriangleright, \:arrow_forward:Black Right-Pointing Triangle / Black Right Pointing Triangle
    U+025B7\trianglerightWhite Right-Pointing Triangle / White Right Pointing Triangle
    U+025B8\smallblacktrianglerightBlack Right-Pointing Small Triangle / Black Right Pointing Small Triangle
    U+025B9\smalltrianglerightWhite Right-Pointing Small Triangle / White Right Pointing Small Triangle
    U+025BA\blackpointerrightBlack Right-Pointing Pointer / Black Right Pointing Pointer
    U+025BB\whitepointerrightWhite Right-Pointing Pointer / White Right Pointing Pointer
    U+025BC\bigblacktriangledownBlack Down-Pointing Triangle / Black Down Pointing Triangle
    U+025BD\bigtriangledownWhite Down-Pointing Triangle / White Down Pointing Triangle
    U+025BE\blacktriangledownBlack Down-Pointing Small Triangle / Black Down Pointing Small Triangle
    U+025BF\triangledownWhite Down-Pointing Small Triangle / White Down Pointing Small Triangle
    U+025C0\blacktriangleleft, \:arrow_backward:Black Left-Pointing Triangle / Black Left Pointing Triangle
    U+025C1\triangleleftWhite Left-Pointing Triangle / White Left Pointing Triangle
    U+025C2\smallblacktriangleleftBlack Left-Pointing Small Triangle / Black Left Pointing Small Triangle
    U+025C3\smalltriangleleftWhite Left-Pointing Small Triangle / White Left Pointing Small Triangle
    U+025C4\blackpointerleftBlack Left-Pointing Pointer / Black Left Pointing Pointer
    U+025C5\whitepointerleftWhite Left-Pointing Pointer / White Left Pointing Pointer
    U+025C6\mdlgblkdiamondBlack Diamond
    U+025C7\mdlgwhtdiamondWhite Diamond
    U+025C8\blackinwhitediamondWhite Diamond Containing Black Small Diamond
    U+025C9\fisheyeFisheye
    U+025CA\lozengeLozenge
    U+025CB\bigcircWhite Circle
    U+025CC\dottedcircleDotted Circle
    U+025CD\circlevertfillCircle With Vertical Fill
    U+025CE\bullseyeBullseye
    U+025CF\mdlgblkcircleBlack Circle
    U+025D0\cirflCircle With Left Half Black
    U+025D1\cirfrCircle With Right Half Black
    U+025D2\cirfbCircle With Lower Half Black
    U+025D3\circletophalfblackCircle With Upper Half Black
    U+025D4\circleurquadblackCircle With Upper Right Quadrant Black
    U+025D5\blackcircleulquadwhiteCircle With All But Upper Left Quadrant Black
    U+025D6\blacklefthalfcircleLeft Half Black Circle
    U+025D7\blackrighthalfcircleRight Half Black Circle
    U+025D8\rvbullInverse Bullet
    U+025D9\inversewhitecircleInverse White Circle
    U+025DA\invwhiteupperhalfcircleUpper Half Inverse White Circle
    U+025DB\invwhitelowerhalfcircleLower Half Inverse White Circle
    U+025DC\ularcUpper Left Quadrant Circular Arc
    U+025DD\urarcUpper Right Quadrant Circular Arc
    U+025DE\lrarcLower Right Quadrant Circular Arc
    U+025DF\llarcLower Left Quadrant Circular Arc
    U+025E0\topsemicircleUpper Half Circle
    U+025E1\botsemicircleLower Half Circle
    U+025E2\lrblacktriangleBlack Lower Right Triangle
    U+025E3\llblacktriangleBlack Lower Left Triangle
    U+025E4\ulblacktriangleBlack Upper Left Triangle
    U+025E5\urblacktriangleBlack Upper Right Triangle
    U+025E6\smwhtcircleWhite Bullet
    U+025E7\sqflSquare With Left Half Black
    U+025E8\sqfrSquare With Right Half Black
    U+025E9\squareulblackSquare With Upper Left Diagonal Half Black
    U+025EA\sqfseSquare With Lower Right Diagonal Half Black
    U+025EB\boxbarWhite Square With Vertical Bisecting Line
    U+025EC\trianglecdotWhite Up-Pointing Triangle With Dot / White Up Pointing Triangle With Dot
    U+025ED\triangleleftblackUp-Pointing Triangle With Left Half Black / Up Pointing Triangle With Left Half Black
    U+025EE\trianglerightblackUp-Pointing Triangle With Right Half Black / Up Pointing Triangle With Right Half Black
    U+025EF\lgwhtcircleLarge Circle
    U+025F0\squareulquadWhite Square With Upper Left Quadrant
    U+025F1\squarellquadWhite Square With Lower Left Quadrant
    U+025F2\squarelrquadWhite Square With Lower Right Quadrant
    U+025F3\squareurquadWhite Square With Upper Right Quadrant
    U+025F4\circleulquadWhite Circle With Upper Left Quadrant
    U+025F5\circlellquadWhite Circle With Lower Left Quadrant
    U+025F6\circlelrquadWhite Circle With Lower Right Quadrant
    U+025F7\circleurquadWhite Circle With Upper Right Quadrant
    U+025F8\ultriangleUpper Left Triangle
    U+025F9\urtriangleUpper Right Triangle
    U+025FA\lltriangleLower Left Triangle
    U+025FB\mdwhtsquare, \:white_medium_square:White Medium Square
    U+025FC\mdblksquare, \:black_medium_square:Black Medium Square
    U+025FD\mdsmwhtsquare, \:white_medium_small_square:White Medium Small Square
    U+025FE\mdsmblksquare, \:black_medium_small_square:Black Medium Small Square
    U+025FF\lrtriangleLower Right Triangle
    U+02600\:sunny:Black Sun With Rays
    U+02601\:cloud:Cloud
    U+02605\bigstarBlack Star
    U+02606\bigwhitestarWhite Star
    U+02609\astrosunSun
    U+0260E\:phone:Black Telephone
    U+02611\:ballot_box_with_check:Ballot Box With Check
    U+02614\:umbrella_with_rain_drops:, \:umbrella:Umbrella With Rain Drops
    U+02615\:coffee:Hot Beverage
    U+0261D\:point_up:White Up Pointing Index
    U+02621\dangerCaution Sign
    U+0263A\:relaxed:White Smiling Face
    U+0263B\blacksmileyBlack Smiling Face
    U+0263C\sunWhite Sun With Rays
    U+0263D\rightmoonFirst Quarter Moon
    U+0263E\leftmoonLast Quarter Moon
    U+0263F\mercuryMercury
    U+02640\venus, \femaleFemale Sign
    U+02642\male, \marsMale Sign
    U+02643\jupiterJupiter
    U+02644\saturnSaturn
    U+02645\uranusUranus
    U+02646\neptuneNeptune
    U+02647\plutoPluto
    U+02648\aries, \:aries:Aries
    U+02649\taurus, \:taurus:Taurus
    U+0264A\gemini, \:gemini:Gemini
    U+0264B\cancer, \:cancer:Cancer
    U+0264C\leo, \:leo:Leo
    U+0264D\virgo, \:virgo:Virgo
    U+0264E\libra, \:libra:Libra
    U+0264F\scorpio, \:scorpius:Scorpius
    U+02650\sagittarius, \:sagittarius:Sagittarius
    U+02651\capricornus, \:capricorn:Capricorn
    U+02652\aquarius, \:aquarius:Aquarius
    U+02653\pisces, \:pisces:Pisces
    U+02660\spadesuit, \:spades:Black Spade Suit
    U+02661\heartsuitWhite Heart Suit
    U+02662\diamondsuitWhite Diamond Suit
    U+02663\clubsuit, \:clubs:Black Club Suit
    U+02664\varspadesuitWhite Spade Suit
    U+02665\varheartsuit, \:hearts:Black Heart Suit
    U+02666\vardiamondsuit, \:diamonds:Black Diamond Suit
    U+02667\varclubsuitWhite Club Suit
    U+02668\:hotsprings:Hot Springs
    U+02669\quarternoteQuarter Note
    U+0266A\eighthnoteEighth Note
    U+0266B\twonotesBeamed Eighth Notes / Barred Eighth Notes
    U+0266D\flatMusic Flat Sign / Flat
    U+0266E\naturalMusic Natural Sign / Natural
    U+0266F\sharpMusic Sharp Sign / Sharp
    U+0267B\:recycle:Black Universal Recycling Symbol
    U+0267E\acidfreePermanent Paper Sign
    U+0267F\:wheelchair:Wheelchair Symbol
    U+02680\diceiDie Face-1
    U+02681\diceiiDie Face-2
    U+02682\diceiiiDie Face-3
    U+02683\diceivDie Face-4
    U+02684\dicevDie Face-5
    U+02685\diceviDie Face-6
    U+02686\circledrightdotWhite Circle With Dot Right
    U+02687\circledtwodotsWhite Circle With Two Dots
    U+02688\blackcircledrightdotBlack Circle With White Dot Right
    U+02689\blackcircledtwodotsBlack Circle With Two White Dots
    U+02693\:anchor:Anchor
    U+026A0\:warning:Warning Sign
    U+026A1\:zap:High Voltage Sign
    U+026A5\hermaphroditeMale And Female Sign
    U+026AA\mdwhtcircle, \:white_circle:Medium White Circle
    U+026AB\mdblkcircle, \:black_circle:Medium Black Circle
    U+026AC\mdsmwhtcircleMedium Small White Circle
    U+026B2\neuterNeuter
    U+026BD\:soccer:Soccer Ball
    U+026BE\:baseball:Baseball
    U+026C4\:snowman:, \:snowman_without_snow:Snowman Without Snow
    U+026C5\:partly_sunny:Sun Behind Cloud
    U+026CE\:ophiuchus:Ophiuchus
    U+026D4\:no_entry:No Entry
    U+026EA\:church:Church
    U+026F2\:fountain:Fountain
    U+026F3\:golf:Flag In Hole
    U+026F5\:boat:Sailboat
    U+026FA\:tent:Tent
    U+026FD\:fuelpump:Fuel Pump
    U+02702\:scissors:Black Scissors
    U+02705\:white_check_mark:White Heavy Check Mark
    U+02708\:airplane:Airplane
    U+02709\:email:Envelope
    U+0270A\:fist:Raised Fist
    U+0270B\:hand:Raised Hand
    U+0270C\:v:Victory Hand
    U+0270F\:pencil2:Pencil
    U+02712\:black_nib:Black Nib
    U+02713\checkmarkCheck Mark
    U+02714\:heavy_check_mark:Heavy Check Mark
    U+02716\:heavy_multiplication_x:Heavy Multiplication X
    U+02720\malteseMaltese Cross
    U+02728\:sparkles:Sparkles
    U+0272A\circledstarCircled White Star
    U+02733\:eight_spoked_asterisk:Eight Spoked Asterisk
    U+02734\:eight_pointed_black_star:Eight Pointed Black Star
    U+02736\varstarSix Pointed Black Star
    U+0273D\dingasteriskHeavy Teardrop-Spoked Asterisk
    U+02744\:snowflake:Snowflake
    U+02747\:sparkle:Sparkle
    U+0274C\:x:Cross Mark
    U+0274E\:negative_squared_cross_mark:Negative Squared Cross Mark
    U+02753\:question:Black Question Mark Ornament
    U+02754\:grey_question:White Question Mark Ornament
    U+02755\:grey_exclamation:White Exclamation Mark Ornament
    U+02757\:exclamation:Heavy Exclamation Mark Symbol
    U+02764\:heart:Heavy Black Heart
    U+02795\:heavy_plus_sign:Heavy Plus Sign
    U+02796\:heavy_minus_sign:Heavy Minus Sign
    U+02797\:heavy_division_sign:Heavy Division Sign
    U+0279B\draftingarrowDrafting Point Rightwards Arrow / Drafting Point Right Arrow
    U+027A1\:arrow_right:Black Rightwards Arrow / Black Right Arrow
    U+027B0\:curly_loop:Curly Loop
    U+027BF\:loop:Double Curly Loop
    U+027C0\threedangleThree Dimensional Angle
    U+027C1\whiteinwhitetriangleWhite Triangle Containing Small White Triangle
    U+027C2\perpPerpendicular
    U+027C7\veedotOr With Dot Inside
    U+027C8\bsolhsubReverse Solidus Preceding Subset
    U+027C9\suphsolSuperset Preceding Solidus
    U+027D1\wedgedotAnd With Dot
    U+027D2\upinElement Of Opening Upwards
    U+027D5\leftouterjoinLeft Outer Join
    U+027D6\rightouterjoinRight Outer Join
    U+027D7\fullouterjoinFull Outer Join
    U+027D8\bigbotLarge Up Tack
    U+027D9\bigtopLarge Down Tack
    U+027E6\llbracket, \openbracketleftMathematical Left White Square Bracket
    U+027E7\openbracketright, \rrbracketMathematical Right White Square Bracket
    U+027E8\langleMathematical Left Angle Bracket
    U+027E9\rangleMathematical Right Angle Bracket
    U+027F0\UUparrowUpwards Quadruple Arrow
    U+027F1\DDownarrowDownwards Quadruple Arrow
    U+027F5\longleftarrowLong Leftwards Arrow
    U+027F6\longrightarrowLong Rightwards Arrow
    U+027F7\longleftrightarrowLong Left Right Arrow
    U+027F8\impliedby, \LongleftarrowLong Leftwards Double Arrow
    U+027F9\implies, \LongrightarrowLong Rightwards Double Arrow
    U+027FA\Longleftrightarrow, \iffLong Left Right Double Arrow
    U+027FB\longmapsfromLong Leftwards Arrow From Bar
    U+027FC\longmapstoLong Rightwards Arrow From Bar
    U+027FD\LongmapsfromLong Leftwards Double Arrow From Bar
    U+027FE\LongmapstoLong Rightwards Double Arrow From Bar
    U+027FF\longrightsquigarrowLong Rightwards Squiggle Arrow
    U+02900\nvtwoheadrightarrowRightwards Two-Headed Arrow With Vertical Stroke
    U+02901\nVtwoheadrightarrowRightwards Two-Headed Arrow With Double Vertical Stroke
    U+02902\nvLeftarrowLeftwards Double Arrow With Vertical Stroke
    U+02903\nvRightarrowRightwards Double Arrow With Vertical Stroke
    U+02904\nvLeftrightarrowLeft Right Double Arrow With Vertical Stroke
    U+02905\twoheadmapstoRightwards Two-Headed Arrow From Bar
    U+02906\MapsfromLeftwards Double Arrow From Bar
    U+02907\MapstoRightwards Double Arrow From Bar
    U+02908\downarrowbarredDownwards Arrow With Horizontal Stroke
    U+02909\uparrowbarredUpwards Arrow With Horizontal Stroke
    U+0290A\UuparrowUpwards Triple Arrow
    U+0290B\DdownarrowDownwards Triple Arrow
    U+0290C\leftbkarrowLeftwards Double Dash Arrow
    U+0290D\bkarowRightwards Double Dash Arrow
    U+0290E\leftdbkarrowLeftwards Triple Dash Arrow
    U+0290F\dbkarowRightwards Triple Dash Arrow
    U+02910\drbkarrowRightwards Two-Headed Triple Dash Arrow
    U+02911\rightdotarrowRightwards Arrow With Dotted Stem
    U+02912\UpArrowBarUpwards Arrow To Bar
    U+02913\DownArrowBarDownwards Arrow To Bar
    U+02914\nvrightarrowtailRightwards Arrow With Tail With Vertical Stroke
    U+02915\nVrightarrowtailRightwards Arrow With Tail With Double Vertical Stroke
    U+02916\twoheadrightarrowtailRightwards Two-Headed Arrow With Tail
    U+02917\nvtwoheadrightarrowtailRightwards Two-Headed Arrow With Tail With Vertical Stroke
    U+02918\nVtwoheadrightarrowtailRightwards Two-Headed Arrow With Tail With Double Vertical Stroke
    U+0291D\diamondleftarrowLeftwards Arrow To Black Diamond
    U+0291E\rightarrowdiamondRightwards Arrow To Black Diamond
    U+0291F\diamondleftarrowbarLeftwards Arrow From Bar To Black Diamond
    U+02920\barrightarrowdiamondRightwards Arrow From Bar To Black Diamond
    U+02925\hksearowSouth East Arrow With Hook
    U+02926\hkswarowSouth West Arrow With Hook
    U+02927\tonaNorth West Arrow And North East Arrow
    U+02928\toeaNorth East Arrow And South East Arrow
    U+02929\tosaSouth East Arrow And South West Arrow
    U+0292A\towaSouth West Arrow And North West Arrow
    U+0292B\rdiagovfdiagRising Diagonal Crossing Falling Diagonal
    U+0292C\fdiagovrdiagFalling Diagonal Crossing Rising Diagonal
    U+0292D\seovnearrowSouth East Arrow Crossing North East Arrow
    U+0292E\neovsearrowNorth East Arrow Crossing South East Arrow
    U+0292F\fdiagovnearrowFalling Diagonal Crossing North East Arrow
    U+02930\rdiagovsearrowRising Diagonal Crossing South East Arrow
    U+02931\neovnwarrowNorth East Arrow Crossing North West Arrow
    U+02932\nwovnearrowNorth West Arrow Crossing North East Arrow
    U+02934\:arrow_heading_up:Arrow Pointing Rightwards Then Curving Upwards
    U+02935\:arrow_heading_down:Arrow Pointing Rightwards Then Curving Downwards
    U+02942\RlarrRightwards Arrow Above Short Leftwards Arrow
    U+02944\rLarrShort Rightwards Arrow Above Leftwards Arrow
    U+02945\rightarrowplusRightwards Arrow With Plus Below
    U+02946\leftarrowplusLeftwards Arrow With Plus Below
    U+02947\rarrxRightwards Arrow Through X
    U+02948\leftrightarrowcircleLeft Right Arrow Through Small Circle
    U+02949\twoheaduparrowcircleUpwards Two-Headed Arrow From Small Circle
    U+0294A\leftrightharpoonupdownLeft Barb Up Right Barb Down Harpoon
    U+0294B\leftrightharpoondownupLeft Barb Down Right Barb Up Harpoon
    U+0294C\updownharpoonrightleftUp Barb Right Down Barb Left Harpoon
    U+0294D\updownharpoonleftrightUp Barb Left Down Barb Right Harpoon
    U+0294E\LeftRightVectorLeft Barb Up Right Barb Up Harpoon
    U+0294F\RightUpDownVectorUp Barb Right Down Barb Right Harpoon
    U+02950\DownLeftRightVectorLeft Barb Down Right Barb Down Harpoon
    U+02951\LeftUpDownVectorUp Barb Left Down Barb Left Harpoon
    U+02952\LeftVectorBarLeftwards Harpoon With Barb Up To Bar
    U+02953\RightVectorBarRightwards Harpoon With Barb Up To Bar
    U+02954\RightUpVectorBarUpwards Harpoon With Barb Right To Bar
    U+02955\RightDownVectorBarDownwards Harpoon With Barb Right To Bar
    U+02956\DownLeftVectorBarLeftwards Harpoon With Barb Down To Bar
    U+02957\DownRightVectorBarRightwards Harpoon With Barb Down To Bar
    U+02958\LeftUpVectorBarUpwards Harpoon With Barb Left To Bar
    U+02959\LeftDownVectorBarDownwards Harpoon With Barb Left To Bar
    U+0295A\LeftTeeVectorLeftwards Harpoon With Barb Up From Bar
    U+0295B\RightTeeVectorRightwards Harpoon With Barb Up From Bar
    U+0295C\RightUpTeeVectorUpwards Harpoon With Barb Right From Bar
    U+0295D\RightDownTeeVectorDownwards Harpoon With Barb Right From Bar
    U+0295E\DownLeftTeeVectorLeftwards Harpoon With Barb Down From Bar
    U+0295F\DownRightTeeVectorRightwards Harpoon With Barb Down From Bar
    U+02960\LeftUpTeeVectorUpwards Harpoon With Barb Left From Bar
    U+02961\LeftDownTeeVectorDownwards Harpoon With Barb Left From Bar
    U+02962\leftharpoonsupdownLeftwards Harpoon With Barb Up Above Leftwards Harpoon With Barb Down
    U+02963\upharpoonsleftrightUpwards Harpoon With Barb Left Beside Upwards Harpoon With Barb Right
    U+02964\rightharpoonsupdownRightwards Harpoon With Barb Up Above Rightwards Harpoon With Barb Down
    U+02965\downharpoonsleftrightDownwards Harpoon With Barb Left Beside Downwards Harpoon With Barb Right
    U+02966\leftrightharpoonsupLeftwards Harpoon With Barb Up Above Rightwards Harpoon With Barb Up
    U+02967\leftrightharpoonsdownLeftwards Harpoon With Barb Down Above Rightwards Harpoon With Barb Down
    U+02968\rightleftharpoonsupRightwards Harpoon With Barb Up Above Leftwards Harpoon With Barb Up
    U+02969\rightleftharpoonsdownRightwards Harpoon With Barb Down Above Leftwards Harpoon With Barb Down
    U+0296A\leftharpoonupdashLeftwards Harpoon With Barb Up Above Long Dash
    U+0296B\dashleftharpoondownLeftwards Harpoon With Barb Down Below Long Dash
    U+0296C\rightharpoonupdashRightwards Harpoon With Barb Up Above Long Dash
    U+0296D\dashrightharpoondownRightwards Harpoon With Barb Down Below Long Dash
    U+0296E\UpEquilibriumUpwards Harpoon With Barb Left Beside Downwards Harpoon With Barb Right
    U+0296F\ReverseUpEquilibriumDownwards Harpoon With Barb Left Beside Upwards Harpoon With Barb Right
    U+02970\RoundImpliesRight Double Arrow With Rounded Head
    U+02977\leftarrowlessLeftwards Arrow Through Less-Than
    U+0297A\leftarrowsubsetLeftwards Arrow Through Subset
    U+02980\VvertTriple Vertical Bar Delimiter
    U+02986\ElroangRight White Parenthesis
    U+02999\ddfncDotted Fence
    U+0299B\measuredangleleftMeasured Angle Opening Left
    U+0299C\AngleRight Angle Variant With Square
    U+0299D\rightanglemdotMeasured Right Angle With Dot
    U+0299E\anglesAngle With S Inside
    U+0299F\angdnrAcute Angle
    U+029A0\lpargtSpherical Angle Opening Left
    U+029A1\sphericalangleupSpherical Angle Opening Up
    U+029A2\turnangleTurned Angle
    U+029A3\revangleReversed Angle
    U+029A4\angleubarAngle With Underbar
    U+029A5\revangleubarReversed Angle With Underbar
    U+029A6\wideangledownOblique Angle Opening Up
    U+029A7\wideangleupOblique Angle Opening Down
    U+029A8\measanglerutoneMeasured Angle With Open Arm Ending In Arrow Pointing Up And Right
    U+029A9\measanglelutonwMeasured Angle With Open Arm Ending In Arrow Pointing Up And Left
    U+029AA\measanglerdtoseMeasured Angle With Open Arm Ending In Arrow Pointing Down And Right
    U+029AB\measangleldtoswMeasured Angle With Open Arm Ending In Arrow Pointing Down And Left
    U+029AC\measangleurtoneMeasured Angle With Open Arm Ending In Arrow Pointing Right And Up
    U+029AD\measangleultonwMeasured Angle With Open Arm Ending In Arrow Pointing Left And Up
    U+029AE\measangledrtoseMeasured Angle With Open Arm Ending In Arrow Pointing Right And Down
    U+029AF\measangledltoswMeasured Angle With Open Arm Ending In Arrow Pointing Left And Down
    U+029B0\revemptysetReversed Empty Set
    U+029B1\emptysetobarEmpty Set With Overbar
    U+029B2\emptysetocircEmpty Set With Small Circle Above
    U+029B3\emptysetoarrEmpty Set With Right Arrow Above
    U+029B4\emptysetoarrlEmpty Set With Left Arrow Above
    U+029B7\circledparallelCircled Parallel
    U+029B8\obslashCircled Reverse Solidus
    U+029BC\odotslashdotCircled Anticlockwise-Rotated Division Sign
    U+029BE\circledwhitebulletCircled White Bullet
    U+029BF⦿\circledbulletCircled Bullet
    U+029C0\olessthanCircled Less-Than
    U+029C1\ogreaterthanCircled Greater-Than
    U+029C4\boxdiagSquared Rising Diagonal Slash
    U+029C5\boxbslashSquared Falling Diagonal Slash
    U+029C6\boxastSquared Asterisk
    U+029C7\boxcircleSquared Small Circle
    U+029CA\LapTriangle With Dot Above
    U+029CB\defasTriangle With Underbar
    U+029CF\LeftTriangleBarLeft Triangle Beside Vertical Bar
    U+029CF + U+00338⧏̸\NotLeftTriangleBarLeft Triangle Beside Vertical Bar + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+029D0\RightTriangleBarVertical Bar Beside Right Triangle
    U+029D0 + U+00338⧐̸\NotRightTriangleBarVertical Bar Beside Right Triangle + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+029DF\dualmapDouble-Ended Multimap
    U+029E1\lrtriangleeqIncreases As
    U+029E2\shuffleShuffle Product
    U+029E3\eparslEquals Sign And Slanted Parallel
    U+029E4\smeparslEquals Sign And Slanted Parallel With Tilde Above
    U+029E5\eqvparslIdentical To And Slanted Parallel
    U+029EB\blacklozengeBlack Lozenge
    U+029F4\RuleDelayedRule-Delayed
    U+029F6\dsolSolidus With Overbar
    U+029F7\rsolbarReverse Solidus With Horizontal Stroke
    U+029FA\doubleplusDouble Plus
    U+029FB\tripleplusTriple Plus
    U+02A00\bigodotN-Ary Circled Dot Operator
    U+02A01\bigoplusN-Ary Circled Plus Operator
    U+02A02\bigotimesN-Ary Circled Times Operator
    U+02A03\bigcupdotN-Ary Union Operator With Dot
    U+02A04\biguplusN-Ary Union Operator With Plus
    U+02A05\bigsqcapN-Ary Square Intersection Operator
    U+02A06\bigsqcupN-Ary Square Union Operator
    U+02A07\conjquantTwo Logical And Operator
    U+02A08\disjquantTwo Logical Or Operator
    U+02A09\bigtimesN-Ary Times Operator
    U+02A0A\modtwosumModulo Two Sum
    U+02A0B\sumintSummation With Integral
    U+02A0C\iiiintQuadruple Integral Operator
    U+02A0D\intbarFinite Part Integral
    U+02A0E\intBarIntegral With Double Stroke
    U+02A0F\clockointIntegral Average With Slash
    U+02A10\cirfnintCirculation Function
    U+02A11\awintAnticlockwise Integration
    U+02A12\rppolintLine Integration With Rectangular Path Around Pole
    U+02A13\scpolintLine Integration With Semicircular Path Around Pole
    U+02A14\npolintLine Integration Not Including The Pole
    U+02A15\pointintIntegral Around A Point Operator
    U+02A16\sqrintQuaternion Integral Operator
    U+02A18\intxIntegral With Times Sign
    U+02A19\intcapIntegral With Intersection
    U+02A1A\intcupIntegral With Union
    U+02A1B\upintIntegral With Overbar
    U+02A1C\lowintIntegral With Underbar
    U+02A1D\joinJoin
    U+02A1F\bbsemiZ Notation Schema Composition
    U+02A22\ringplusPlus Sign With Small Circle Above
    U+02A23\plushatPlus Sign With Circumflex Accent Above
    U+02A24\simplusPlus Sign With Tilde Above
    U+02A25\plusdotPlus Sign With Dot Below
    U+02A26\plussimPlus Sign With Tilde Below
    U+02A27\plussubtwoPlus Sign With Subscript Two
    U+02A28\plustrifPlus Sign With Black Triangle
    U+02A29\commaminusMinus Sign With Comma Above
    U+02A2A\minusdotMinus Sign With Dot Below
    U+02A2B\minusfdotsMinus Sign With Falling Dots
    U+02A2C\minusrdotsMinus Sign With Rising Dots
    U+02A2D\opluslhrimPlus Sign In Left Half Circle
    U+02A2E\oplusrhrimPlus Sign In Right Half Circle
    U+02A2F\TimesVector Or Cross Product
    U+02A30\dottimesMultiplication Sign With Dot Above
    U+02A31\timesbarMultiplication Sign With Underbar
    U+02A32\btimesSemidirect Product With Bottom Closed
    U+02A33\smashtimesSmash Product
    U+02A34\otimeslhrimMultiplication Sign In Left Half Circle
    U+02A35\otimesrhrimMultiplication Sign In Right Half Circle
    U+02A36\otimeshatCircled Multiplication Sign With Circumflex Accent
    U+02A37\OtimesMultiplication Sign In Double Circle
    U+02A38\odivCircled Division Sign
    U+02A39\triangleplusPlus Sign In Triangle
    U+02A3A\triangleminusMinus Sign In Triangle
    U+02A3B\triangletimesMultiplication Sign In Triangle
    U+02A3C\intprodInterior Product
    U+02A3D\intprodrRighthand Interior Product
    U+02A3F⨿\amalgAmalgamation Or Coproduct
    U+02A40\capdotIntersection With Dot
    U+02A41\uminusUnion With Minus Sign
    U+02A42\barcupUnion With Overbar
    U+02A43\barcapIntersection With Overbar
    U+02A44\capwedgeIntersection With Logical And
    U+02A45\cupveeUnion With Logical Or
    U+02A4A\twocupsUnion Beside And Joined With Union
    U+02A4B\twocapsIntersection Beside And Joined With Intersection
    U+02A4C\closedvarcupClosed Union With Serifs
    U+02A4D\closedvarcapClosed Intersection With Serifs
    U+02A4E\SqcapDouble Square Intersection
    U+02A4F\SqcupDouble Square Union
    U+02A50\closedvarcupsmashprodClosed Union With Serifs And Smash Product
    U+02A51\wedgeodotLogical And With Dot Above
    U+02A52\veeodotLogical Or With Dot Above
    U+02A53\AndDouble Logical And
    U+02A54\OrDouble Logical Or
    U+02A55\wedgeonwedgeTwo Intersecting Logical And
    U+02A56\ElOrTwo Intersecting Logical Or
    U+02A57\bigslopedveeSloping Large Or
    U+02A58\bigslopedwedgeSloping Large And
    U+02A5A\wedgemidvertLogical And With Middle Stem
    U+02A5B\veemidvertLogical Or With Middle Stem
    U+02A5C\midbarwedgeLogical And With Horizontal Dash
    U+02A5D\midbarveeLogical Or With Horizontal Dash
    U+02A5E\perspcorrespondLogical And With Double Overbar
    U+02A5F\minhatLogical And With Underbar
    U+02A60\wedgedoublebarLogical And With Double Underbar
    U+02A61\varveebarSmall Vee With Underbar
    U+02A62\doublebarveeLogical Or With Double Overbar
    U+02A63\veedoublebarLogical Or With Double Underbar
    U+02A66\eqdotEquals Sign With Dot Below
    U+02A67\dotequivIdentical With Dot Above
    U+02A6A\dotsimTilde Operator With Dot Above
    U+02A6B\simrdotsTilde Operator With Rising Dots
    U+02A6C\simminussimSimilar Minus Similar
    U+02A6D\congdotCongruent With Dot Above
    U+02A6E\asteqEquals With Asterisk
    U+02A6F\hatapproxAlmost Equal To With Circumflex Accent
    U+02A70\approxeqqApproximately Equal Or Equal To
    U+02A71\eqqplusEquals Sign Above Plus Sign
    U+02A72\pluseqqPlus Sign Above Equals Sign
    U+02A73\eqqsimEquals Sign Above Tilde Operator
    U+02A74\ColoneqDouble Colon Equal
    U+02A75\EqualTwo Consecutive Equals Signs
    U+02A76\eqeqeqThree Consecutive Equals Signs
    U+02A77\ddotseqEquals Sign With Two Dots Above And Two Dots Below
    U+02A78\equivDDEquivalent With Four Dots Above
    U+02A79\ltcirLess-Than With Circle Inside
    U+02A7A\gtcirGreater-Than With Circle Inside
    U+02A7B\ltquestLess-Than With Question Mark Above
    U+02A7C\gtquestGreater-Than With Question Mark Above
    U+02A7D\leqslantLess-Than Or Slanted Equal To
    U+02A7D + U+00338⩽̸\nleqslantLess-Than Or Slanted Equal To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02A7E\geqslantGreater-Than Or Slanted Equal To
    U+02A7E + U+00338⩾̸\ngeqslantGreater-Than Or Slanted Equal To + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02A7F⩿\lesdotLess-Than Or Slanted Equal To With Dot Inside
    U+02A80\gesdotGreater-Than Or Slanted Equal To With Dot Inside
    U+02A81\lesdotoLess-Than Or Slanted Equal To With Dot Above
    U+02A82\gesdotoGreater-Than Or Slanted Equal To With Dot Above
    U+02A83\lesdotorLess-Than Or Slanted Equal To With Dot Above Right
    U+02A84\gesdotolGreater-Than Or Slanted Equal To With Dot Above Left
    U+02A85\lessapproxLess-Than Or Approximate
    U+02A86\gtrapproxGreater-Than Or Approximate
    U+02A87\lneqLess-Than And Single-Line Not Equal To
    U+02A88\gneqGreater-Than And Single-Line Not Equal To
    U+02A89\lnapproxLess-Than And Not Approximate
    U+02A8A\gnapproxGreater-Than And Not Approximate
    U+02A8B\lesseqqgtrLess-Than Above Double-Line Equal Above Greater-Than
    U+02A8C\gtreqqlessGreater-Than Above Double-Line Equal Above Less-Than
    U+02A8D\lsimeLess-Than Above Similar Or Equal
    U+02A8E\gsimeGreater-Than Above Similar Or Equal
    U+02A8F\lsimgLess-Than Above Similar Above Greater-Than
    U+02A90\gsimlGreater-Than Above Similar Above Less-Than
    U+02A91\lgELess-Than Above Greater-Than Above Double-Line Equal
    U+02A92\glEGreater-Than Above Less-Than Above Double-Line Equal
    U+02A93\lesgesLess-Than Above Slanted Equal Above Greater-Than Above Slanted Equal
    U+02A94\geslesGreater-Than Above Slanted Equal Above Less-Than Above Slanted Equal
    U+02A95\eqslantlessSlanted Equal To Or Less-Than
    U+02A96\eqslantgtrSlanted Equal To Or Greater-Than
    U+02A97\elsdotSlanted Equal To Or Less-Than With Dot Inside
    U+02A98\egsdotSlanted Equal To Or Greater-Than With Dot Inside
    U+02A99\eqqlessDouble-Line Equal To Or Less-Than
    U+02A9A\eqqgtrDouble-Line Equal To Or Greater-Than
    U+02A9B\eqqslantlessDouble-Line Slanted Equal To Or Less-Than
    U+02A9C\eqqslantgtrDouble-Line Slanted Equal To Or Greater-Than
    U+02A9D\simlessSimilar Or Less-Than
    U+02A9E\simgtrSimilar Or Greater-Than
    U+02A9F\simlESimilar Above Less-Than Above Equals Sign
    U+02AA0\simgESimilar Above Greater-Than Above Equals Sign
    U+02AA1\NestedLessLessDouble Nested Less-Than
    U+02AA1 + U+00338⪡̸\NotNestedLessLessDouble Nested Less-Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AA2\NestedGreaterGreaterDouble Nested Greater-Than
    U+02AA2 + U+00338⪢̸\NotNestedGreaterGreaterDouble Nested Greater-Than + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AA3\partialmeetcontractionDouble Nested Less-Than With Underbar
    U+02AA4\gljGreater-Than Overlapping Less-Than
    U+02AA5\glaGreater-Than Beside Less-Than
    U+02AA6\ltccLess-Than Closed By Curve
    U+02AA7\gtccGreater-Than Closed By Curve
    U+02AA8\lesccLess-Than Closed By Curve Above Slanted Equal
    U+02AA9\gesccGreater-Than Closed By Curve Above Slanted Equal
    U+02AAA\smtSmaller Than
    U+02AAB\latLarger Than
    U+02AAC\smteSmaller Than Or Equal To
    U+02AAD\lateLarger Than Or Equal To
    U+02AAE\bumpeqqEquals Sign With Bumpy Above
    U+02AAF\preceqPrecedes Above Single-Line Equals Sign
    U+02AAF + U+00338⪯̸\npreceqPrecedes Above Single-Line Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AB0\succeqSucceeds Above Single-Line Equals Sign
    U+02AB0 + U+00338⪰̸\nsucceqSucceeds Above Single-Line Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AB1\precneqPrecedes Above Single-Line Not Equal To
    U+02AB2\succneqSucceeds Above Single-Line Not Equal To
    U+02AB3\preceqqPrecedes Above Equals Sign
    U+02AB4\succeqqSucceeds Above Equals Sign
    U+02AB5\precneqqPrecedes Above Not Equal To
    U+02AB6\succneqqSucceeds Above Not Equal To
    U+02AB7\precapproxPrecedes Above Almost Equal To
    U+02AB8\succapproxSucceeds Above Almost Equal To
    U+02AB9\precnapproxPrecedes Above Not Almost Equal To
    U+02ABA\succnapproxSucceeds Above Not Almost Equal To
    U+02ABB\PrecDouble Precedes
    U+02ABC\SuccDouble Succeeds
    U+02ABD\subsetdotSubset With Dot
    U+02ABE\supsetdotSuperset With Dot
    U+02ABF⪿\subsetplusSubset With Plus Sign Below
    U+02AC0\supsetplusSuperset With Plus Sign Below
    U+02AC1\submultSubset With Multiplication Sign Below
    U+02AC2\supmultSuperset With Multiplication Sign Below
    U+02AC3\subedotSubset Of Or Equal To With Dot Above
    U+02AC4\supedotSuperset Of Or Equal To With Dot Above
    U+02AC5\subseteqqSubset Of Above Equals Sign
    U+02AC5 + U+00338⫅̸\nsubseteqqSubset Of Above Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AC6\supseteqqSuperset Of Above Equals Sign
    U+02AC6 + U+00338⫆̸\nsupseteqqSuperset Of Above Equals Sign + Combining Long Solidus Overlay / Non-Spacing Long Slash Overlay
    U+02AC7\subsimSubset Of Above Tilde Operator
    U+02AC8\supsimSuperset Of Above Tilde Operator
    U+02AC9\subsetapproxSubset Of Above Almost Equal To
    U+02ACA\supsetapproxSuperset Of Above Almost Equal To
    U+02ACB\subsetneqqSubset Of Above Not Equal To
    U+02ACC\supsetneqqSuperset Of Above Not Equal To
    U+02ACD\lsqhookSquare Left Open Box Operator
    U+02ACE\rsqhookSquare Right Open Box Operator
    U+02ACF\csubClosed Subset
    U+02AD0\csupClosed Superset
    U+02AD1\csubeClosed Subset Or Equal To
    U+02AD2\csupeClosed Superset Or Equal To
    U+02AD3\subsupSubset Above Superset
    U+02AD4\supsubSuperset Above Subset
    U+02AD5\subsubSubset Above Subset
    U+02AD6\supsupSuperset Above Superset
    U+02AD7\suphsubSuperset Beside Subset
    U+02AD8\supdsubSuperset Beside And Joined By Dash With Subset
    U+02AD9\forkvElement Of Opening Downwards
    U+02ADB\mlcpTransversal Intersection
    U+02ADC\forksForking
    U+02ADD\forksnotNonforking
    U+02AE3\dashVDouble Vertical Bar Left Turnstile
    U+02AE4\DashvVertical Bar Double Left Turnstile
    U+02AEA\Top, \downvDashDouble Down Tack
    U+02AEB\upvDash, \Bot, \indepDouble Up Tack
    U+02AF4\interleaveTriple Vertical Bar Binary Relation
    U+02AF6\tdcolTriple Colon Operator
    U+02AF7\lllnestTriple Nested Less-Than
    U+02AF8\gggnestTriple Nested Greater-Than
    U+02AF9\leqqslantDouble-Line Slanted Less-Than Or Equal To
    U+02AFA\geqqslantDouble-Line Slanted Greater-Than Or Equal To
    U+02B05\:arrow_left:Leftwards Black Arrow
    U+02B06\:arrow_up:Upwards Black Arrow
    U+02B07\:arrow_down:Downwards Black Arrow
    U+02B12\squaretopblackSquare With Top Half Black
    U+02B13\squarebotblackSquare With Bottom Half Black
    U+02B14\squareurblackSquare With Upper Right Diagonal Half Black
    U+02B15\squarellblackSquare With Lower Left Diagonal Half Black
    U+02B16\diamondleftblackDiamond With Left Half Black
    U+02B17\diamondrightblackDiamond With Right Half Black
    U+02B18\diamondtopblackDiamond With Top Half Black
    U+02B19\diamondbotblackDiamond With Bottom Half Black
    U+02B1A\dottedsquareDotted Square
    U+02B1B\lgblksquare, \:black_large_square:Black Large Square
    U+02B1C\lgwhtsquare, \:white_large_square:White Large Square
    U+02B1D\vysmblksquareBlack Very Small Square
    U+02B1E\vysmwhtsquareWhite Very Small Square
    U+02B1F\pentagonblackBlack Pentagon
    U+02B20\pentagonWhite Pentagon
    U+02B21\varhexagonWhite Hexagon
    U+02B22\varhexagonblackBlack Hexagon
    U+02B23\hexagonblackHorizontal Black Hexagon
    U+02B24\lgblkcircleBlack Large Circle
    U+02B25\mdblkdiamondBlack Medium Diamond
    U+02B26\mdwhtdiamondWhite Medium Diamond
    U+02B27\mdblklozengeBlack Medium Lozenge
    U+02B28\mdwhtlozengeWhite Medium Lozenge
    U+02B29\smblkdiamondBlack Small Diamond
    U+02B2A\smblklozengeBlack Small Lozenge
    U+02B2B\smwhtlozengeWhite Small Lozenge
    U+02B2C\blkhorzovalBlack Horizontal Ellipse
    U+02B2D\whthorzovalWhite Horizontal Ellipse
    U+02B2E\blkvertovalBlack Vertical Ellipse
    U+02B2F\whtvertovalWhite Vertical Ellipse
    U+02B30\circleonleftarrowLeft Arrow With Small Circle
    U+02B31\leftthreearrowsThree Leftwards Arrows
    U+02B32\leftarrowonoplusLeft Arrow With Circled Plus
    U+02B33\longleftsquigarrowLong Leftwards Squiggle Arrow
    U+02B34\nvtwoheadleftarrowLeftwards Two-Headed Arrow With Vertical Stroke
    U+02B35\nVtwoheadleftarrowLeftwards Two-Headed Arrow With Double Vertical Stroke
    U+02B36\twoheadmapsfromLeftwards Two-Headed Arrow From Bar
    U+02B37\twoheadleftdbkarrowLeftwards Two-Headed Triple Dash Arrow
    U+02B38\leftdotarrowLeftwards Arrow With Dotted Stem
    U+02B39\nvleftarrowtailLeftwards Arrow With Tail With Vertical Stroke
    U+02B3A\nVleftarrowtailLeftwards Arrow With Tail With Double Vertical Stroke
    U+02B3B\twoheadleftarrowtailLeftwards Two-Headed Arrow With Tail
    U+02B3C\nvtwoheadleftarrowtailLeftwards Two-Headed Arrow With Tail With Vertical Stroke
    U+02B3D\nVtwoheadleftarrowtailLeftwards Two-Headed Arrow With Tail With Double Vertical Stroke
    U+02B3E\leftarrowxLeftwards Arrow Through X
    U+02B3F⬿\leftcurvedarrowWave Arrow Pointing Directly Left
    U+02B40\equalleftarrowEquals Sign Above Leftwards Arrow
    U+02B41\bsimilarleftarrowReverse Tilde Operator Above Leftwards Arrow
    U+02B42\leftarrowbackapproxLeftwards Arrow Above Reverse Almost Equal To
    U+02B43\rightarrowgtrRightwards Arrow Through Greater-Than
    U+02B44\rightarrowsupsetRightwards Arrow Through Superset
    U+02B45\LLeftarrowLeftwards Quadruple Arrow
    U+02B46\RRightarrowRightwards Quadruple Arrow
    U+02B47\bsimilarrightarrowReverse Tilde Operator Above Rightwards Arrow
    U+02B48\rightarrowbackapproxRightwards Arrow Above Reverse Almost Equal To
    U+02B49\similarleftarrowTilde Operator Above Leftwards Arrow
    U+02B4A\leftarrowapproxLeftwards Arrow Above Almost Equal To
    U+02B4B\leftarrowbsimilarLeftwards Arrow Above Reverse Tilde Operator
    U+02B4C\rightarrowbsimilarRightwards Arrow Above Reverse Tilde Operator
    U+02B50\medwhitestar, \:star:White Medium Star
    U+02B51\medblackstarBlack Small Star
    U+02B52\smwhitestarWhite Small Star
    U+02B53\rightpentagonblackBlack Right-Pointing Pentagon
    U+02B54\rightpentagonWhite Right-Pointing Pentagon
    U+02B55\:o:Heavy Large Circle
    U+02C7C\_jLatin Subscript Small Letter J
    U+02C7D\^VModifier Letter Capital V
    U+03012\postalmarkPostal Mark
    U+03030\:wavy_dash:Wavy Dash
    U+0303D\:part_alternation_mark:Part Alternation Mark
    U+03297\:congratulations:Circled Ideograph Congratulation
    U+03299\:secret:Circled Ideograph Secret
    U+0A71B\^uparrowModifier Letter Raised Up Arrow
    U+0A71C\^downarrowModifier Letter Raised Down Arrow
    U+0A71D\^!Modifier Letter Raised Exclamation Mark
    U+1D106𝄆\leftrepeatsignMusical Symbol Left Repeat Sign
    U+1D107𝄇\rightrepeatsignMusical Symbol Right Repeat Sign
    U+1D109𝄉\dalsegnoMusical Symbol Dal Segno
    U+1D10A𝄊\dacapoMusical Symbol Da Capo
    U+1D10B𝄋\segnoMusical Symbol Segno
    U+1D10C𝄌\codaMusical Symbol Coda
    U+1D11E𝄞\clefgMusical Symbol G Clef
    U+1D11F𝄟\clefg8vaMusical Symbol G Clef Ottava Alta
    U+1D120𝄠\clefg8vbMusical Symbol G Clef Ottava Bassa
    U+1D121𝄡\clefcMusical Symbol C Clef
    U+1D122𝄢\cleffMusical Symbol F Clef
    U+1D123𝄣\cleff8vaMusical Symbol F Clef Ottava Alta
    U+1D124𝄤\cleff8vbMusical Symbol F Clef Ottava Bassa
    U+1D12A𝄪\sharpsharpMusical Symbol Double Sharp
    U+1D12B𝄫\flatflatMusical Symbol Double Flat
    U+1D13A𝄺\restmultiMusical Symbol Multi Rest
    U+1D13B𝄻\restwholeMusical Symbol Whole Rest
    U+1D13C𝄼\resthalfMusical Symbol Half Rest
    U+1D13D𝄽\restquarterMusical Symbol Quarter Rest
    U+1D13E𝄾\rest8thMusical Symbol Eighth Rest
    U+1D13F𝄿\rest16thMusical Symbol Sixteenth Rest
    U+1D140𝅀\rest32thMusical Symbol Thirty-Second Rest
    U+1D141𝅁\rest64thMusical Symbol Sixty-Fourth Rest
    U+1D142𝅂\rest128thMusical Symbol One Hundred Twenty-Eighth Rest
    U+1D15C𝅜\notedoublewholeMusical Symbol Breve
    U+1D15D𝅝\notewholeMusical Symbol Whole Note
    U+1D15E𝅗𝅥\notehalfMusical Symbol Half Note
    U+1D15F𝅘𝅥\notequarterMusical Symbol Quarter Note
    U+1D160𝅘𝅥𝅮\note8thMusical Symbol Eighth Note
    U+1D161𝅘𝅥𝅯\note16thMusical Symbol Sixteenth Note
    U+1D162𝅘𝅥𝅰\note32thMusical Symbol Thirty-Second Note
    U+1D163𝅘𝅥𝅱\note64thMusical Symbol Sixty-Fourth Note
    U+1D164𝅘𝅥𝅲\note128thMusical Symbol One Hundred Twenty-Eighth Note
    U+1D400𝐀\bfAMathematical Bold Capital A
    U+1D401𝐁\bfBMathematical Bold Capital B
    U+1D402𝐂\bfCMathematical Bold Capital C
    U+1D403𝐃\bfDMathematical Bold Capital D
    U+1D404𝐄\bfEMathematical Bold Capital E
    U+1D405𝐅\bfFMathematical Bold Capital F
    U+1D406𝐆\bfGMathematical Bold Capital G
    U+1D407𝐇\bfHMathematical Bold Capital H
    U+1D408𝐈\bfIMathematical Bold Capital I
    U+1D409𝐉\bfJMathematical Bold Capital J
    U+1D40A𝐊\bfKMathematical Bold Capital K
    U+1D40B𝐋\bfLMathematical Bold Capital L
    U+1D40C𝐌\bfMMathematical Bold Capital M
    U+1D40D𝐍\bfNMathematical Bold Capital N
    U+1D40E𝐎\bfOMathematical Bold Capital O
    U+1D40F𝐏\bfPMathematical Bold Capital P
    U+1D410𝐐\bfQMathematical Bold Capital Q
    U+1D411𝐑\bfRMathematical Bold Capital R
    U+1D412𝐒\bfSMathematical Bold Capital S
    U+1D413𝐓\bfTMathematical Bold Capital T
    U+1D414𝐔\bfUMathematical Bold Capital U
    U+1D415𝐕\bfVMathematical Bold Capital V
    U+1D416𝐖\bfWMathematical Bold Capital W
    U+1D417𝐗\bfXMathematical Bold Capital X
    U+1D418𝐘\bfYMathematical Bold Capital Y
    U+1D419𝐙\bfZMathematical Bold Capital Z
    U+1D41A𝐚\bfaMathematical Bold Small A
    U+1D41B𝐛\bfbMathematical Bold Small B
    U+1D41C𝐜\bfcMathematical Bold Small C
    U+1D41D𝐝\bfdMathematical Bold Small D
    U+1D41E𝐞\bfeMathematical Bold Small E
    U+1D41F𝐟\bffMathematical Bold Small F
    U+1D420𝐠\bfgMathematical Bold Small G
    U+1D421𝐡\bfhMathematical Bold Small H
    U+1D422𝐢\bfiMathematical Bold Small I
    U+1D423𝐣\bfjMathematical Bold Small J
    U+1D424𝐤\bfkMathematical Bold Small K
    U+1D425𝐥\bflMathematical Bold Small L
    U+1D426𝐦\bfmMathematical Bold Small M
    U+1D427𝐧\bfnMathematical Bold Small N
    U+1D428𝐨\bfoMathematical Bold Small O
    U+1D429𝐩\bfpMathematical Bold Small P
    U+1D42A𝐪\bfqMathematical Bold Small Q
    U+1D42B𝐫\bfrMathematical Bold Small R
    U+1D42C𝐬\bfsMathematical Bold Small S
    U+1D42D𝐭\bftMathematical Bold Small T
    U+1D42E𝐮\bfuMathematical Bold Small U
    U+1D42F𝐯\bfvMathematical Bold Small V
    U+1D430𝐰\bfwMathematical Bold Small W
    U+1D431𝐱\bfxMathematical Bold Small X
    U+1D432𝐲\bfyMathematical Bold Small Y
    U+1D433𝐳\bfzMathematical Bold Small Z
    U+1D434𝐴\itAMathematical Italic Capital A
    U+1D435𝐵\itBMathematical Italic Capital B
    U+1D436𝐶\itCMathematical Italic Capital C
    U+1D437𝐷\itDMathematical Italic Capital D
    U+1D438𝐸\itEMathematical Italic Capital E
    U+1D439𝐹\itFMathematical Italic Capital F
    U+1D43A𝐺\itGMathematical Italic Capital G
    U+1D43B𝐻\itHMathematical Italic Capital H
    U+1D43C𝐼\itIMathematical Italic Capital I
    U+1D43D𝐽\itJMathematical Italic Capital J
    U+1D43E𝐾\itKMathematical Italic Capital K
    U+1D43F𝐿\itLMathematical Italic Capital L
    U+1D440𝑀\itMMathematical Italic Capital M
    U+1D441𝑁\itNMathematical Italic Capital N
    U+1D442𝑂\itOMathematical Italic Capital O
    U+1D443𝑃\itPMathematical Italic Capital P
    U+1D444𝑄\itQMathematical Italic Capital Q
    U+1D445𝑅\itRMathematical Italic Capital R
    U+1D446𝑆\itSMathematical Italic Capital S
    U+1D447𝑇\itTMathematical Italic Capital T
    U+1D448𝑈\itUMathematical Italic Capital U
    U+1D449𝑉\itVMathematical Italic Capital V
    U+1D44A𝑊\itWMathematical Italic Capital W
    U+1D44B𝑋\itXMathematical Italic Capital X
    U+1D44C𝑌\itYMathematical Italic Capital Y
    U+1D44D𝑍\itZMathematical Italic Capital Z
    U+1D44E𝑎\itaMathematical Italic Small A
    U+1D44F𝑏\itbMathematical Italic Small B
    U+1D450𝑐\itcMathematical Italic Small C
    U+1D451𝑑\itdMathematical Italic Small D
    U+1D452𝑒\iteMathematical Italic Small E
    U+1D453𝑓\itfMathematical Italic Small F
    U+1D454𝑔\itgMathematical Italic Small G
    U+1D456𝑖\itiMathematical Italic Small I
    U+1D457𝑗\itjMathematical Italic Small J
    U+1D458𝑘\itkMathematical Italic Small K
    U+1D459𝑙\itlMathematical Italic Small L
    U+1D45A𝑚\itmMathematical Italic Small M
    U+1D45B𝑛\itnMathematical Italic Small N
    U+1D45C𝑜\itoMathematical Italic Small O
    U+1D45D𝑝\itpMathematical Italic Small P
    U+1D45E𝑞\itqMathematical Italic Small Q
    U+1D45F𝑟\itrMathematical Italic Small R
    U+1D460𝑠\itsMathematical Italic Small S
    U+1D461𝑡\ittMathematical Italic Small T
    U+1D462𝑢\ituMathematical Italic Small U
    U+1D463𝑣\itvMathematical Italic Small V
    U+1D464𝑤\itwMathematical Italic Small W
    U+1D465𝑥\itxMathematical Italic Small X
    U+1D466𝑦\ityMathematical Italic Small Y
    U+1D467𝑧\itzMathematical Italic Small Z
    U+1D468𝑨\biAMathematical Bold Italic Capital A
    U+1D469𝑩\biBMathematical Bold Italic Capital B
    U+1D46A𝑪\biCMathematical Bold Italic Capital C
    U+1D46B𝑫\biDMathematical Bold Italic Capital D
    U+1D46C𝑬\biEMathematical Bold Italic Capital E
    U+1D46D𝑭\biFMathematical Bold Italic Capital F
    U+1D46E𝑮\biGMathematical Bold Italic Capital G
    U+1D46F𝑯\biHMathematical Bold Italic Capital H
    U+1D470𝑰\biIMathematical Bold Italic Capital I
    U+1D471𝑱\biJMathematical Bold Italic Capital J
    U+1D472𝑲\biKMathematical Bold Italic Capital K
    U+1D473𝑳\biLMathematical Bold Italic Capital L
    U+1D474𝑴\biMMathematical Bold Italic Capital M
    U+1D475𝑵\biNMathematical Bold Italic Capital N
    U+1D476𝑶\biOMathematical Bold Italic Capital O
    U+1D477𝑷\biPMathematical Bold Italic Capital P
    U+1D478𝑸\biQMathematical Bold Italic Capital Q
    U+1D479𝑹\biRMathematical Bold Italic Capital R
    U+1D47A𝑺\biSMathematical Bold Italic Capital S
    U+1D47B𝑻\biTMathematical Bold Italic Capital T
    U+1D47C𝑼\biUMathematical Bold Italic Capital U
    U+1D47D𝑽\biVMathematical Bold Italic Capital V
    U+1D47E𝑾\biWMathematical Bold Italic Capital W
    U+1D47F𝑿\biXMathematical Bold Italic Capital X
    U+1D480𝒀\biYMathematical Bold Italic Capital Y
    U+1D481𝒁\biZMathematical Bold Italic Capital Z
    U+1D482𝒂\biaMathematical Bold Italic Small A
    U+1D483𝒃\bibMathematical Bold Italic Small B
    U+1D484𝒄\bicMathematical Bold Italic Small C
    U+1D485𝒅\bidMathematical Bold Italic Small D
    U+1D486𝒆\bieMathematical Bold Italic Small E
    U+1D487𝒇\bifMathematical Bold Italic Small F
    U+1D488𝒈\bigMathematical Bold Italic Small G
    U+1D489𝒉\bihMathematical Bold Italic Small H
    U+1D48A𝒊\biiMathematical Bold Italic Small I
    U+1D48B𝒋\bijMathematical Bold Italic Small J
    U+1D48C𝒌\bikMathematical Bold Italic Small K
    U+1D48D𝒍\bilMathematical Bold Italic Small L
    U+1D48E𝒎\bimMathematical Bold Italic Small M
    U+1D48F𝒏\binMathematical Bold Italic Small N
    U+1D490𝒐\bioMathematical Bold Italic Small O
    U+1D491𝒑\bipMathematical Bold Italic Small P
    U+1D492𝒒\biqMathematical Bold Italic Small Q
    U+1D493𝒓\birMathematical Bold Italic Small R
    U+1D494𝒔\bisMathematical Bold Italic Small S
    U+1D495𝒕\bitMathematical Bold Italic Small T
    U+1D496𝒖\biuMathematical Bold Italic Small U
    U+1D497𝒗\bivMathematical Bold Italic Small V
    U+1D498𝒘\biwMathematical Bold Italic Small W
    U+1D499𝒙\bixMathematical Bold Italic Small X
    U+1D49A𝒚\biyMathematical Bold Italic Small Y
    U+1D49B𝒛\bizMathematical Bold Italic Small Z
    U+1D49C𝒜\scrAMathematical Script Capital A
    U+1D49E𝒞\scrCMathematical Script Capital C
    U+1D49F𝒟\scrDMathematical Script Capital D
    U+1D4A2𝒢\scrGMathematical Script Capital G
    U+1D4A5𝒥\scrJMathematical Script Capital J
    U+1D4A6𝒦\scrKMathematical Script Capital K
    U+1D4A9𝒩\scrNMathematical Script Capital N
    U+1D4AA𝒪\scrOMathematical Script Capital O
    U+1D4AB𝒫\scrPMathematical Script Capital P
    U+1D4AC𝒬\scrQMathematical Script Capital Q
    U+1D4AE𝒮\scrSMathematical Script Capital S
    U+1D4AF𝒯\scrTMathematical Script Capital T
    U+1D4B0𝒰\scrUMathematical Script Capital U
    U+1D4B1𝒱\scrVMathematical Script Capital V
    U+1D4B2𝒲\scrWMathematical Script Capital W
    U+1D4B3𝒳\scrXMathematical Script Capital X
    U+1D4B4𝒴\scrYMathematical Script Capital Y
    U+1D4B5𝒵\scrZMathematical Script Capital Z
    U+1D4B6𝒶\scraMathematical Script Small A
    U+1D4B7𝒷\scrbMathematical Script Small B
    U+1D4B8𝒸\scrcMathematical Script Small C
    U+1D4B9𝒹\scrdMathematical Script Small D
    U+1D4BB𝒻\scrfMathematical Script Small F
    U+1D4BD𝒽\scrhMathematical Script Small H
    U+1D4BE𝒾\scriMathematical Script Small I
    U+1D4BF𝒿\scrjMathematical Script Small J
    U+1D4C0𝓀\scrkMathematical Script Small K
    U+1D4C1𝓁\scrlMathematical Script Small L
    U+1D4C2𝓂\scrmMathematical Script Small M
    U+1D4C3𝓃\scrnMathematical Script Small N
    U+1D4C5𝓅\scrpMathematical Script Small P
    U+1D4C6𝓆\scrqMathematical Script Small Q
    U+1D4C7𝓇\scrrMathematical Script Small R
    U+1D4C8𝓈\scrsMathematical Script Small S
    U+1D4C9𝓉\scrtMathematical Script Small T
    U+1D4CA𝓊\scruMathematical Script Small U
    U+1D4CB𝓋\scrvMathematical Script Small V
    U+1D4CC𝓌\scrwMathematical Script Small W
    U+1D4CD𝓍\scrxMathematical Script Small X
    U+1D4CE𝓎\scryMathematical Script Small Y
    U+1D4CF𝓏\scrzMathematical Script Small Z
    U+1D4D0𝓐\bscrAMathematical Bold Script Capital A
    U+1D4D1𝓑\bscrBMathematical Bold Script Capital B
    U+1D4D2𝓒\bscrCMathematical Bold Script Capital C
    U+1D4D3𝓓\bscrDMathematical Bold Script Capital D
    U+1D4D4𝓔\bscrEMathematical Bold Script Capital E
    U+1D4D5𝓕\bscrFMathematical Bold Script Capital F
    U+1D4D6𝓖\bscrGMathematical Bold Script Capital G
    U+1D4D7𝓗\bscrHMathematical Bold Script Capital H
    U+1D4D8𝓘\bscrIMathematical Bold Script Capital I
    U+1D4D9𝓙\bscrJMathematical Bold Script Capital J
    U+1D4DA𝓚\bscrKMathematical Bold Script Capital K
    U+1D4DB𝓛\bscrLMathematical Bold Script Capital L
    U+1D4DC𝓜\bscrMMathematical Bold Script Capital M
    U+1D4DD𝓝\bscrNMathematical Bold Script Capital N
    U+1D4DE𝓞\bscrOMathematical Bold Script Capital O
    U+1D4DF𝓟\bscrPMathematical Bold Script Capital P
    U+1D4E0𝓠\bscrQMathematical Bold Script Capital Q
    U+1D4E1𝓡\bscrRMathematical Bold Script Capital R
    U+1D4E2𝓢\bscrSMathematical Bold Script Capital S
    U+1D4E3𝓣\bscrTMathematical Bold Script Capital T
    U+1D4E4𝓤\bscrUMathematical Bold Script Capital U
    U+1D4E5𝓥\bscrVMathematical Bold Script Capital V
    U+1D4E6𝓦\bscrWMathematical Bold Script Capital W
    U+1D4E7𝓧\bscrXMathematical Bold Script Capital X
    U+1D4E8𝓨\bscrYMathematical Bold Script Capital Y
    U+1D4E9𝓩\bscrZMathematical Bold Script Capital Z
    U+1D4EA𝓪\bscraMathematical Bold Script Small A
    U+1D4EB𝓫\bscrbMathematical Bold Script Small B
    U+1D4EC𝓬\bscrcMathematical Bold Script Small C
    U+1D4ED𝓭\bscrdMathematical Bold Script Small D
    U+1D4EE𝓮\bscreMathematical Bold Script Small E
    U+1D4EF𝓯\bscrfMathematical Bold Script Small F
    U+1D4F0𝓰\bscrgMathematical Bold Script Small G
    U+1D4F1𝓱\bscrhMathematical Bold Script Small H
    U+1D4F2𝓲\bscriMathematical Bold Script Small I
    U+1D4F3𝓳\bscrjMathematical Bold Script Small J
    U+1D4F4𝓴\bscrkMathematical Bold Script Small K
    U+1D4F5𝓵\bscrlMathematical Bold Script Small L
    U+1D4F6𝓶\bscrmMathematical Bold Script Small M
    U+1D4F7𝓷\bscrnMathematical Bold Script Small N
    U+1D4F8𝓸\bscroMathematical Bold Script Small O
    U+1D4F9𝓹\bscrpMathematical Bold Script Small P
    U+1D4FA𝓺\bscrqMathematical Bold Script Small Q
    U+1D4FB𝓻\bscrrMathematical Bold Script Small R
    U+1D4FC𝓼\bscrsMathematical Bold Script Small S
    U+1D4FD𝓽\bscrtMathematical Bold Script Small T
    U+1D4FE𝓾\bscruMathematical Bold Script Small U
    U+1D4FF𝓿\bscrvMathematical Bold Script Small V
    U+1D500𝔀\bscrwMathematical Bold Script Small W
    U+1D501𝔁\bscrxMathematical Bold Script Small X
    U+1D502𝔂\bscryMathematical Bold Script Small Y
    U+1D503𝔃\bscrzMathematical Bold Script Small Z
    U+1D504𝔄\frakAMathematical Fraktur Capital A
    U+1D505𝔅\frakBMathematical Fraktur Capital B
    U+1D507𝔇\frakDMathematical Fraktur Capital D
    U+1D508𝔈\frakEMathematical Fraktur Capital E
    U+1D509𝔉\frakFMathematical Fraktur Capital F
    U+1D50A𝔊\frakGMathematical Fraktur Capital G
    U+1D50D𝔍\frakJMathematical Fraktur Capital J
    U+1D50E𝔎\frakKMathematical Fraktur Capital K
    U+1D50F𝔏\frakLMathematical Fraktur Capital L
    U+1D510𝔐\frakMMathematical Fraktur Capital M
    U+1D511𝔑\frakNMathematical Fraktur Capital N
    U+1D512𝔒\frakOMathematical Fraktur Capital O
    U+1D513𝔓\frakPMathematical Fraktur Capital P
    U+1D514𝔔\frakQMathematical Fraktur Capital Q
    U+1D516𝔖\frakSMathematical Fraktur Capital S
    U+1D517𝔗\frakTMathematical Fraktur Capital T
    U+1D518𝔘\frakUMathematical Fraktur Capital U
    U+1D519𝔙\frakVMathematical Fraktur Capital V
    U+1D51A𝔚\frakWMathematical Fraktur Capital W
    U+1D51B𝔛\frakXMathematical Fraktur Capital X
    U+1D51C𝔜\frakYMathematical Fraktur Capital Y
    U+1D51E𝔞\frakaMathematical Fraktur Small A
    U+1D51F𝔟\frakbMathematical Fraktur Small B
    U+1D520𝔠\frakcMathematical Fraktur Small C
    U+1D521𝔡\frakdMathematical Fraktur Small D
    U+1D522𝔢\frakeMathematical Fraktur Small E
    U+1D523𝔣\frakfMathematical Fraktur Small F
    U+1D524𝔤\frakgMathematical Fraktur Small G
    U+1D525𝔥\frakhMathematical Fraktur Small H
    U+1D526𝔦\frakiMathematical Fraktur Small I
    U+1D527𝔧\frakjMathematical Fraktur Small J
    U+1D528𝔨\frakkMathematical Fraktur Small K
    U+1D529𝔩\fraklMathematical Fraktur Small L
    U+1D52A𝔪\frakmMathematical Fraktur Small M
    U+1D52B𝔫\fraknMathematical Fraktur Small N
    U+1D52C𝔬\frakoMathematical Fraktur Small O
    U+1D52D𝔭\frakpMathematical Fraktur Small P
    U+1D52E𝔮\frakqMathematical Fraktur Small Q
    U+1D52F𝔯\frakrMathematical Fraktur Small R
    U+1D530𝔰\fraksMathematical Fraktur Small S
    U+1D531𝔱\fraktMathematical Fraktur Small T
    U+1D532𝔲\frakuMathematical Fraktur Small U
    U+1D533𝔳\frakvMathematical Fraktur Small V
    U+1D534𝔴\frakwMathematical Fraktur Small W
    U+1D535𝔵\frakxMathematical Fraktur Small X
    U+1D536𝔶\frakyMathematical Fraktur Small Y
    U+1D537𝔷\frakzMathematical Fraktur Small Z
    U+1D538𝔸\bbAMathematical Double-Struck Capital A
    U+1D539𝔹\bbBMathematical Double-Struck Capital B
    U+1D53B𝔻\bbDMathematical Double-Struck Capital D
    U+1D53C𝔼\bbEMathematical Double-Struck Capital E
    U+1D53D𝔽\bbFMathematical Double-Struck Capital F
    U+1D53E𝔾\bbGMathematical Double-Struck Capital G
    U+1D540𝕀\bbIMathematical Double-Struck Capital I
    U+1D541𝕁\bbJMathematical Double-Struck Capital J
    U+1D542𝕂\bbKMathematical Double-Struck Capital K
    U+1D543𝕃\bbLMathematical Double-Struck Capital L
    U+1D544𝕄\bbMMathematical Double-Struck Capital M
    U+1D546𝕆\bbOMathematical Double-Struck Capital O
    U+1D54A𝕊\bbSMathematical Double-Struck Capital S
    U+1D54B𝕋\bbTMathematical Double-Struck Capital T
    U+1D54C𝕌\bbUMathematical Double-Struck Capital U
    U+1D54D𝕍\bbVMathematical Double-Struck Capital V
    U+1D54E𝕎\bbWMathematical Double-Struck Capital W
    U+1D54F𝕏\bbXMathematical Double-Struck Capital X
    U+1D550𝕐\bbYMathematical Double-Struck Capital Y
    U+1D552𝕒\bbaMathematical Double-Struck Small A
    U+1D553𝕓\bbbMathematical Double-Struck Small B
    U+1D554𝕔\bbcMathematical Double-Struck Small C
    U+1D555𝕕\bbdMathematical Double-Struck Small D
    U+1D556𝕖\bbeMathematical Double-Struck Small E
    U+1D557𝕗\bbfMathematical Double-Struck Small F
    U+1D558𝕘\bbgMathematical Double-Struck Small G
    U+1D559𝕙\bbhMathematical Double-Struck Small H
    U+1D55A𝕚\bbiMathematical Double-Struck Small I
    U+1D55B𝕛\bbjMathematical Double-Struck Small J
    U+1D55C𝕜\bbkMathematical Double-Struck Small K
    U+1D55D𝕝\bblMathematical Double-Struck Small L
    U+1D55E𝕞\bbmMathematical Double-Struck Small M
    U+1D55F𝕟\bbnMathematical Double-Struck Small N
    U+1D560𝕠\bboMathematical Double-Struck Small O
    U+1D561𝕡\bbpMathematical Double-Struck Small P
    U+1D562𝕢\bbqMathematical Double-Struck Small Q
    U+1D563𝕣\bbrMathematical Double-Struck Small R
    U+1D564𝕤\bbsMathematical Double-Struck Small S
    U+1D565𝕥\bbtMathematical Double-Struck Small T
    U+1D566𝕦\bbuMathematical Double-Struck Small U
    U+1D567𝕧\bbvMathematical Double-Struck Small V
    U+1D568𝕨\bbwMathematical Double-Struck Small W
    U+1D569𝕩\bbxMathematical Double-Struck Small X
    U+1D56A𝕪\bbyMathematical Double-Struck Small Y
    U+1D56B𝕫\bbzMathematical Double-Struck Small Z
    U+1D56C𝕬\bfrakAMathematical Bold Fraktur Capital A
    U+1D56D𝕭\bfrakBMathematical Bold Fraktur Capital B
    U+1D56E𝕮\bfrakCMathematical Bold Fraktur Capital C
    U+1D56F𝕯\bfrakDMathematical Bold Fraktur Capital D
    U+1D570𝕰\bfrakEMathematical Bold Fraktur Capital E
    U+1D571𝕱\bfrakFMathematical Bold Fraktur Capital F
    U+1D572𝕲\bfrakGMathematical Bold Fraktur Capital G
    U+1D573𝕳\bfrakHMathematical Bold Fraktur Capital H
    U+1D574𝕴\bfrakIMathematical Bold Fraktur Capital I
    U+1D575𝕵\bfrakJMathematical Bold Fraktur Capital J
    U+1D576𝕶\bfrakKMathematical Bold Fraktur Capital K
    U+1D577𝕷\bfrakLMathematical Bold Fraktur Capital L
    U+1D578𝕸\bfrakMMathematical Bold Fraktur Capital M
    U+1D579𝕹\bfrakNMathematical Bold Fraktur Capital N
    U+1D57A𝕺\bfrakOMathematical Bold Fraktur Capital O
    U+1D57B𝕻\bfrakPMathematical Bold Fraktur Capital P
    U+1D57C𝕼\bfrakQMathematical Bold Fraktur Capital Q
    U+1D57D𝕽\bfrakRMathematical Bold Fraktur Capital R
    U+1D57E𝕾\bfrakSMathematical Bold Fraktur Capital S
    U+1D57F𝕿\bfrakTMathematical Bold Fraktur Capital T
    U+1D580𝖀\bfrakUMathematical Bold Fraktur Capital U
    U+1D581𝖁\bfrakVMathematical Bold Fraktur Capital V
    U+1D582𝖂\bfrakWMathematical Bold Fraktur Capital W
    U+1D583𝖃\bfrakXMathematical Bold Fraktur Capital X
    U+1D584𝖄\bfrakYMathematical Bold Fraktur Capital Y
    U+1D585𝖅\bfrakZMathematical Bold Fraktur Capital Z
    U+1D586𝖆\bfrakaMathematical Bold Fraktur Small A
    U+1D587𝖇\bfrakbMathematical Bold Fraktur Small B
    U+1D588𝖈\bfrakcMathematical Bold Fraktur Small C
    U+1D589𝖉\bfrakdMathematical Bold Fraktur Small D
    U+1D58A𝖊\bfrakeMathematical Bold Fraktur Small E
    U+1D58B𝖋\bfrakfMathematical Bold Fraktur Small F
    U+1D58C𝖌\bfrakgMathematical Bold Fraktur Small G
    U+1D58D𝖍\bfrakhMathematical Bold Fraktur Small H
    U+1D58E𝖎\bfrakiMathematical Bold Fraktur Small I
    U+1D58F𝖏\bfrakjMathematical Bold Fraktur Small J
    U+1D590𝖐\bfrakkMathematical Bold Fraktur Small K
    U+1D591𝖑\bfraklMathematical Bold Fraktur Small L
    U+1D592𝖒\bfrakmMathematical Bold Fraktur Small M
    U+1D593𝖓\bfraknMathematical Bold Fraktur Small N
    U+1D594𝖔\bfrakoMathematical Bold Fraktur Small O
    U+1D595𝖕\bfrakpMathematical Bold Fraktur Small P
    U+1D596𝖖\bfrakqMathematical Bold Fraktur Small Q
    U+1D597𝖗\bfrakrMathematical Bold Fraktur Small R
    U+1D598𝖘\bfraksMathematical Bold Fraktur Small S
    U+1D599𝖙\bfraktMathematical Bold Fraktur Small T
    U+1D59A𝖚\bfrakuMathematical Bold Fraktur Small U
    U+1D59B𝖛\bfrakvMathematical Bold Fraktur Small V
    U+1D59C𝖜\bfrakwMathematical Bold Fraktur Small W
    U+1D59D𝖝\bfrakxMathematical Bold Fraktur Small X
    U+1D59E𝖞\bfrakyMathematical Bold Fraktur Small Y
    U+1D59F𝖟\bfrakzMathematical Bold Fraktur Small Z
    U+1D5A0𝖠\sansAMathematical Sans-Serif Capital A
    U+1D5A1𝖡\sansBMathematical Sans-Serif Capital B
    U+1D5A2𝖢\sansCMathematical Sans-Serif Capital C
    U+1D5A3𝖣\sansDMathematical Sans-Serif Capital D
    U+1D5A4𝖤\sansEMathematical Sans-Serif Capital E
    U+1D5A5𝖥\sansFMathematical Sans-Serif Capital F
    U+1D5A6𝖦\sansGMathematical Sans-Serif Capital G
    U+1D5A7𝖧\sansHMathematical Sans-Serif Capital H
    U+1D5A8𝖨\sansIMathematical Sans-Serif Capital I
    U+1D5A9𝖩\sansJMathematical Sans-Serif Capital J
    U+1D5AA𝖪\sansKMathematical Sans-Serif Capital K
    U+1D5AB𝖫\sansLMathematical Sans-Serif Capital L
    U+1D5AC𝖬\sansMMathematical Sans-Serif Capital M
    U+1D5AD𝖭\sansNMathematical Sans-Serif Capital N
    U+1D5AE𝖮\sansOMathematical Sans-Serif Capital O
    U+1D5AF𝖯\sansPMathematical Sans-Serif Capital P
    U+1D5B0𝖰\sansQMathematical Sans-Serif Capital Q
    U+1D5B1𝖱\sansRMathematical Sans-Serif Capital R
    U+1D5B2𝖲\sansSMathematical Sans-Serif Capital S
    U+1D5B3𝖳\sansTMathematical Sans-Serif Capital T
    U+1D5B4𝖴\sansUMathematical Sans-Serif Capital U
    U+1D5B5𝖵\sansVMathematical Sans-Serif Capital V
    U+1D5B6𝖶\sansWMathematical Sans-Serif Capital W
    U+1D5B7𝖷\sansXMathematical Sans-Serif Capital X
    U+1D5B8𝖸\sansYMathematical Sans-Serif Capital Y
    U+1D5B9𝖹\sansZMathematical Sans-Serif Capital Z
    U+1D5BA𝖺\sansaMathematical Sans-Serif Small A
    U+1D5BB𝖻\sansbMathematical Sans-Serif Small B
    U+1D5BC𝖼\sanscMathematical Sans-Serif Small C
    U+1D5BD𝖽\sansdMathematical Sans-Serif Small D
    U+1D5BE𝖾\sanseMathematical Sans-Serif Small E
    U+1D5BF𝖿\sansfMathematical Sans-Serif Small F
    U+1D5C0𝗀\sansgMathematical Sans-Serif Small G
    U+1D5C1𝗁\sanshMathematical Sans-Serif Small H
    U+1D5C2𝗂\sansiMathematical Sans-Serif Small I
    U+1D5C3𝗃\sansjMathematical Sans-Serif Small J
    U+1D5C4𝗄\sanskMathematical Sans-Serif Small K
    U+1D5C5𝗅\sanslMathematical Sans-Serif Small L
    U+1D5C6𝗆\sansmMathematical Sans-Serif Small M
    U+1D5C7𝗇\sansnMathematical Sans-Serif Small N
    U+1D5C8𝗈\sansoMathematical Sans-Serif Small O
    U+1D5C9𝗉\sanspMathematical Sans-Serif Small P
    U+1D5CA𝗊\sansqMathematical Sans-Serif Small Q
    U+1D5CB𝗋\sansrMathematical Sans-Serif Small R
    U+1D5CC𝗌\sanssMathematical Sans-Serif Small S
    U+1D5CD𝗍\sanstMathematical Sans-Serif Small T
    U+1D5CE𝗎\sansuMathematical Sans-Serif Small U
    U+1D5CF𝗏\sansvMathematical Sans-Serif Small V
    U+1D5D0𝗐\sanswMathematical Sans-Serif Small W
    U+1D5D1𝗑\sansxMathematical Sans-Serif Small X
    U+1D5D2𝗒\sansyMathematical Sans-Serif Small Y
    U+1D5D3𝗓\sanszMathematical Sans-Serif Small Z
    U+1D5D4𝗔\bsansAMathematical Sans-Serif Bold Capital A
    U+1D5D5𝗕\bsansBMathematical Sans-Serif Bold Capital B
    U+1D5D6𝗖\bsansCMathematical Sans-Serif Bold Capital C
    U+1D5D7𝗗\bsansDMathematical Sans-Serif Bold Capital D
    U+1D5D8𝗘\bsansEMathematical Sans-Serif Bold Capital E
    U+1D5D9𝗙\bsansFMathematical Sans-Serif Bold Capital F
    U+1D5DA𝗚\bsansGMathematical Sans-Serif Bold Capital G
    U+1D5DB𝗛\bsansHMathematical Sans-Serif Bold Capital H
    U+1D5DC𝗜\bsansIMathematical Sans-Serif Bold Capital I
    U+1D5DD𝗝\bsansJMathematical Sans-Serif Bold Capital J
    U+1D5DE𝗞\bsansKMathematical Sans-Serif Bold Capital K
    U+1D5DF𝗟\bsansLMathematical Sans-Serif Bold Capital L
    U+1D5E0𝗠\bsansMMathematical Sans-Serif Bold Capital M
    U+1D5E1𝗡\bsansNMathematical Sans-Serif Bold Capital N
    U+1D5E2𝗢\bsansOMathematical Sans-Serif Bold Capital O
    U+1D5E3𝗣\bsansPMathematical Sans-Serif Bold Capital P
    U+1D5E4𝗤\bsansQMathematical Sans-Serif Bold Capital Q
    U+1D5E5𝗥\bsansRMathematical Sans-Serif Bold Capital R
    U+1D5E6𝗦\bsansSMathematical Sans-Serif Bold Capital S
    U+1D5E7𝗧\bsansTMathematical Sans-Serif Bold Capital T
    U+1D5E8𝗨\bsansUMathematical Sans-Serif Bold Capital U
    U+1D5E9𝗩\bsansVMathematical Sans-Serif Bold Capital V
    U+1D5EA𝗪\bsansWMathematical Sans-Serif Bold Capital W
    U+1D5EB𝗫\bsansXMathematical Sans-Serif Bold Capital X
    U+1D5EC𝗬\bsansYMathematical Sans-Serif Bold Capital Y
    U+1D5ED𝗭\bsansZMathematical Sans-Serif Bold Capital Z
    U+1D5EE𝗮\bsansaMathematical Sans-Serif Bold Small A
    U+1D5EF𝗯\bsansbMathematical Sans-Serif Bold Small B
    U+1D5F0𝗰\bsanscMathematical Sans-Serif Bold Small C
    U+1D5F1𝗱\bsansdMathematical Sans-Serif Bold Small D
    U+1D5F2𝗲\bsanseMathematical Sans-Serif Bold Small E
    U+1D5F3𝗳\bsansfMathematical Sans-Serif Bold Small F
    U+1D5F4𝗴\bsansgMathematical Sans-Serif Bold Small G
    U+1D5F5𝗵\bsanshMathematical Sans-Serif Bold Small H
    U+1D5F6𝗶\bsansiMathematical Sans-Serif Bold Small I
    U+1D5F7𝗷\bsansjMathematical Sans-Serif Bold Small J
    U+1D5F8𝗸\bsanskMathematical Sans-Serif Bold Small K
    U+1D5F9𝗹\bsanslMathematical Sans-Serif Bold Small L
    U+1D5FA𝗺\bsansmMathematical Sans-Serif Bold Small M
    U+1D5FB𝗻\bsansnMathematical Sans-Serif Bold Small N
    U+1D5FC𝗼\bsansoMathematical Sans-Serif Bold Small O
    U+1D5FD𝗽\bsanspMathematical Sans-Serif Bold Small P
    U+1D5FE𝗾\bsansqMathematical Sans-Serif Bold Small Q
    U+1D5FF𝗿\bsansrMathematical Sans-Serif Bold Small R
    U+1D600𝘀\bsanssMathematical Sans-Serif Bold Small S
    U+1D601𝘁\bsanstMathematical Sans-Serif Bold Small T
    U+1D602𝘂\bsansuMathematical Sans-Serif Bold Small U
    U+1D603𝘃\bsansvMathematical Sans-Serif Bold Small V
    U+1D604𝘄\bsanswMathematical Sans-Serif Bold Small W
    U+1D605𝘅\bsansxMathematical Sans-Serif Bold Small X
    U+1D606𝘆\bsansyMathematical Sans-Serif Bold Small Y
    U+1D607𝘇\bsanszMathematical Sans-Serif Bold Small Z
    U+1D608𝘈\isansAMathematical Sans-Serif Italic Capital A
    U+1D609𝘉\isansBMathematical Sans-Serif Italic Capital B
    U+1D60A𝘊\isansCMathematical Sans-Serif Italic Capital C
    U+1D60B𝘋\isansDMathematical Sans-Serif Italic Capital D
    U+1D60C𝘌\isansEMathematical Sans-Serif Italic Capital E
    U+1D60D𝘍\isansFMathematical Sans-Serif Italic Capital F
    U+1D60E𝘎\isansGMathematical Sans-Serif Italic Capital G
    U+1D60F𝘏\isansHMathematical Sans-Serif Italic Capital H
    U+1D610𝘐\isansIMathematical Sans-Serif Italic Capital I
    U+1D611𝘑\isansJMathematical Sans-Serif Italic Capital J
    U+1D612𝘒\isansKMathematical Sans-Serif Italic Capital K
    U+1D613𝘓\isansLMathematical Sans-Serif Italic Capital L
    U+1D614𝘔\isansMMathematical Sans-Serif Italic Capital M
    U+1D615𝘕\isansNMathematical Sans-Serif Italic Capital N
    U+1D616𝘖\isansOMathematical Sans-Serif Italic Capital O
    U+1D617𝘗\isansPMathematical Sans-Serif Italic Capital P
    U+1D618𝘘\isansQMathematical Sans-Serif Italic Capital Q
    U+1D619𝘙\isansRMathematical Sans-Serif Italic Capital R
    U+1D61A𝘚\isansSMathematical Sans-Serif Italic Capital S
    U+1D61B𝘛\isansTMathematical Sans-Serif Italic Capital T
    U+1D61C𝘜\isansUMathematical Sans-Serif Italic Capital U
    U+1D61D𝘝\isansVMathematical Sans-Serif Italic Capital V
    U+1D61E𝘞\isansWMathematical Sans-Serif Italic Capital W
    U+1D61F𝘟\isansXMathematical Sans-Serif Italic Capital X
    U+1D620𝘠\isansYMathematical Sans-Serif Italic Capital Y
    U+1D621𝘡\isansZMathematical Sans-Serif Italic Capital Z
    U+1D622𝘢\isansaMathematical Sans-Serif Italic Small A
    U+1D623𝘣\isansbMathematical Sans-Serif Italic Small B
    U+1D624𝘤\isanscMathematical Sans-Serif Italic Small C
    U+1D625𝘥\isansdMathematical Sans-Serif Italic Small D
    U+1D626𝘦\isanseMathematical Sans-Serif Italic Small E
    U+1D627𝘧\isansfMathematical Sans-Serif Italic Small F
    U+1D628𝘨\isansgMathematical Sans-Serif Italic Small G
    U+1D629𝘩\isanshMathematical Sans-Serif Italic Small H
    U+1D62A𝘪\isansiMathematical Sans-Serif Italic Small I
    U+1D62B𝘫\isansjMathematical Sans-Serif Italic Small J
    U+1D62C𝘬\isanskMathematical Sans-Serif Italic Small K
    U+1D62D𝘭\isanslMathematical Sans-Serif Italic Small L
    U+1D62E𝘮\isansmMathematical Sans-Serif Italic Small M
    U+1D62F𝘯\isansnMathematical Sans-Serif Italic Small N
    U+1D630𝘰\isansoMathematical Sans-Serif Italic Small O
    U+1D631𝘱\isanspMathematical Sans-Serif Italic Small P
    U+1D632𝘲\isansqMathematical Sans-Serif Italic Small Q
    U+1D633𝘳\isansrMathematical Sans-Serif Italic Small R
    U+1D634𝘴\isanssMathematical Sans-Serif Italic Small S
    U+1D635𝘵\isanstMathematical Sans-Serif Italic Small T
    U+1D636𝘶\isansuMathematical Sans-Serif Italic Small U
    U+1D637𝘷\isansvMathematical Sans-Serif Italic Small V
    U+1D638𝘸\isanswMathematical Sans-Serif Italic Small W
    U+1D639𝘹\isansxMathematical Sans-Serif Italic Small X
    U+1D63A𝘺\isansyMathematical Sans-Serif Italic Small Y
    U+1D63B𝘻\isanszMathematical Sans-Serif Italic Small Z
    U+1D63C𝘼\bisansAMathematical Sans-Serif Bold Italic Capital A
    U+1D63D𝘽\bisansBMathematical Sans-Serif Bold Italic Capital B
    U+1D63E𝘾\bisansCMathematical Sans-Serif Bold Italic Capital C
    U+1D63F𝘿\bisansDMathematical Sans-Serif Bold Italic Capital D
    U+1D640𝙀\bisansEMathematical Sans-Serif Bold Italic Capital E
    U+1D641𝙁\bisansFMathematical Sans-Serif Bold Italic Capital F
    U+1D642𝙂\bisansGMathematical Sans-Serif Bold Italic Capital G
    U+1D643𝙃\bisansHMathematical Sans-Serif Bold Italic Capital H
    U+1D644𝙄\bisansIMathematical Sans-Serif Bold Italic Capital I
    U+1D645𝙅\bisansJMathematical Sans-Serif Bold Italic Capital J
    U+1D646𝙆\bisansKMathematical Sans-Serif Bold Italic Capital K
    U+1D647𝙇\bisansLMathematical Sans-Serif Bold Italic Capital L
    U+1D648𝙈\bisansMMathematical Sans-Serif Bold Italic Capital M
    U+1D649𝙉\bisansNMathematical Sans-Serif Bold Italic Capital N
    U+1D64A𝙊\bisansOMathematical Sans-Serif Bold Italic Capital O
    U+1D64B𝙋\bisansPMathematical Sans-Serif Bold Italic Capital P
    U+1D64C𝙌\bisansQMathematical Sans-Serif Bold Italic Capital Q
    U+1D64D𝙍\bisansRMathematical Sans-Serif Bold Italic Capital R
    U+1D64E𝙎\bisansSMathematical Sans-Serif Bold Italic Capital S
    U+1D64F𝙏\bisansTMathematical Sans-Serif Bold Italic Capital T
    U+1D650𝙐\bisansUMathematical Sans-Serif Bold Italic Capital U
    U+1D651𝙑\bisansVMathematical Sans-Serif Bold Italic Capital V
    U+1D652𝙒\bisansWMathematical Sans-Serif Bold Italic Capital W
    U+1D653𝙓\bisansXMathematical Sans-Serif Bold Italic Capital X
    U+1D654𝙔\bisansYMathematical Sans-Serif Bold Italic Capital Y
    U+1D655𝙕\bisansZMathematical Sans-Serif Bold Italic Capital Z
    U+1D656𝙖\bisansaMathematical Sans-Serif Bold Italic Small A
    U+1D657𝙗\bisansbMathematical Sans-Serif Bold Italic Small B
    U+1D658𝙘\bisanscMathematical Sans-Serif Bold Italic Small C
    U+1D659𝙙\bisansdMathematical Sans-Serif Bold Italic Small D
    U+1D65A𝙚\bisanseMathematical Sans-Serif Bold Italic Small E
    U+1D65B𝙛\bisansfMathematical Sans-Serif Bold Italic Small F
    U+1D65C𝙜\bisansgMathematical Sans-Serif Bold Italic Small G
    U+1D65D𝙝\bisanshMathematical Sans-Serif Bold Italic Small H
    U+1D65E𝙞\bisansiMathematical Sans-Serif Bold Italic Small I
    U+1D65F𝙟\bisansjMathematical Sans-Serif Bold Italic Small J
    U+1D660𝙠\bisanskMathematical Sans-Serif Bold Italic Small K
    U+1D661𝙡\bisanslMathematical Sans-Serif Bold Italic Small L
    U+1D662𝙢\bisansmMathematical Sans-Serif Bold Italic Small M
    U+1D663𝙣\bisansnMathematical Sans-Serif Bold Italic Small N
    U+1D664𝙤\bisansoMathematical Sans-Serif Bold Italic Small O
    U+1D665𝙥\bisanspMathematical Sans-Serif Bold Italic Small P
    U+1D666𝙦\bisansqMathematical Sans-Serif Bold Italic Small Q
    U+1D667𝙧\bisansrMathematical Sans-Serif Bold Italic Small R
    U+1D668𝙨\bisanssMathematical Sans-Serif Bold Italic Small S
    U+1D669𝙩\bisanstMathematical Sans-Serif Bold Italic Small T
    U+1D66A𝙪\bisansuMathematical Sans-Serif Bold Italic Small U
    U+1D66B𝙫\bisansvMathematical Sans-Serif Bold Italic Small V
    U+1D66C𝙬\bisanswMathematical Sans-Serif Bold Italic Small W
    U+1D66D𝙭\bisansxMathematical Sans-Serif Bold Italic Small X
    U+1D66E𝙮\bisansyMathematical Sans-Serif Bold Italic Small Y
    U+1D66F𝙯\bisanszMathematical Sans-Serif Bold Italic Small Z
    U+1D670𝙰\ttAMathematical Monospace Capital A
    U+1D671𝙱\ttBMathematical Monospace Capital B
    U+1D672𝙲\ttCMathematical Monospace Capital C
    U+1D673𝙳\ttDMathematical Monospace Capital D
    U+1D674𝙴\ttEMathematical Monospace Capital E
    U+1D675𝙵\ttFMathematical Monospace Capital F
    U+1D676𝙶\ttGMathematical Monospace Capital G
    U+1D677𝙷\ttHMathematical Monospace Capital H
    U+1D678𝙸\ttIMathematical Monospace Capital I
    U+1D679𝙹\ttJMathematical Monospace Capital J
    U+1D67A𝙺\ttKMathematical Monospace Capital K
    U+1D67B𝙻\ttLMathematical Monospace Capital L
    U+1D67C𝙼\ttMMathematical Monospace Capital M
    U+1D67D𝙽\ttNMathematical Monospace Capital N
    U+1D67E𝙾\ttOMathematical Monospace Capital O
    U+1D67F𝙿\ttPMathematical Monospace Capital P
    U+1D680𝚀\ttQMathematical Monospace Capital Q
    U+1D681𝚁\ttRMathematical Monospace Capital R
    U+1D682𝚂\ttSMathematical Monospace Capital S
    U+1D683𝚃\ttTMathematical Monospace Capital T
    U+1D684𝚄\ttUMathematical Monospace Capital U
    U+1D685𝚅\ttVMathematical Monospace Capital V
    U+1D686𝚆\ttWMathematical Monospace Capital W
    U+1D687𝚇\ttXMathematical Monospace Capital X
    U+1D688𝚈\ttYMathematical Monospace Capital Y
    U+1D689𝚉\ttZMathematical Monospace Capital Z
    U+1D68A𝚊\ttaMathematical Monospace Small A
    U+1D68B𝚋\ttbMathematical Monospace Small B
    U+1D68C𝚌\ttcMathematical Monospace Small C
    U+1D68D𝚍\ttdMathematical Monospace Small D
    U+1D68E𝚎\tteMathematical Monospace Small E
    U+1D68F𝚏\ttfMathematical Monospace Small F
    U+1D690𝚐\ttgMathematical Monospace Small G
    U+1D691𝚑\tthMathematical Monospace Small H
    U+1D692𝚒\ttiMathematical Monospace Small I
    U+1D693𝚓\ttjMathematical Monospace Small J
    U+1D694𝚔\ttkMathematical Monospace Small K
    U+1D695𝚕\ttlMathematical Monospace Small L
    U+1D696𝚖\ttmMathematical Monospace Small M
    U+1D697𝚗\ttnMathematical Monospace Small N
    U+1D698𝚘\ttoMathematical Monospace Small O
    U+1D699𝚙\ttpMathematical Monospace Small P
    U+1D69A𝚚\ttqMathematical Monospace Small Q
    U+1D69B𝚛\ttrMathematical Monospace Small R
    U+1D69C𝚜\ttsMathematical Monospace Small S
    U+1D69D𝚝\tttMathematical Monospace Small T
    U+1D69E𝚞\ttuMathematical Monospace Small U
    U+1D69F𝚟\ttvMathematical Monospace Small V
    U+1D6A0𝚠\ttwMathematical Monospace Small W
    U+1D6A1𝚡\ttxMathematical Monospace Small X
    U+1D6A2𝚢\ttyMathematical Monospace Small Y
    U+1D6A3𝚣\ttzMathematical Monospace Small Z
    U+1D6A4𝚤\itimathMathematical Italic Small Dotless I
    U+1D6A5𝚥\itjmathMathematical Italic Small Dotless J
    U+1D6A8𝚨\bfAlphaMathematical Bold Capital Alpha
    U+1D6A9𝚩\bfBetaMathematical Bold Capital Beta
    U+1D6AA𝚪\bfGammaMathematical Bold Capital Gamma
    U+1D6AB𝚫\bfDeltaMathematical Bold Capital Delta
    U+1D6AC𝚬\bfEpsilonMathematical Bold Capital Epsilon
    U+1D6AD𝚭\bfZetaMathematical Bold Capital Zeta
    U+1D6AE𝚮\bfEtaMathematical Bold Capital Eta
    U+1D6AF𝚯\bfThetaMathematical Bold Capital Theta
    U+1D6B0𝚰\bfIotaMathematical Bold Capital Iota
    U+1D6B1𝚱\bfKappaMathematical Bold Capital Kappa
    U+1D6B2𝚲\bfLambdaMathematical Bold Capital Lamda
    U+1D6B3𝚳\bfMuMathematical Bold Capital Mu
    U+1D6B4𝚴\bfNuMathematical Bold Capital Nu
    U+1D6B5𝚵\bfXiMathematical Bold Capital Xi
    U+1D6B6𝚶\bfOmicronMathematical Bold Capital Omicron
    U+1D6B7𝚷\bfPiMathematical Bold Capital Pi
    U+1D6B8𝚸\bfRhoMathematical Bold Capital Rho
    U+1D6B9𝚹\bfvarThetaMathematical Bold Capital Theta Symbol
    U+1D6BA𝚺\bfSigmaMathematical Bold Capital Sigma
    U+1D6BB𝚻\bfTauMathematical Bold Capital Tau
    U+1D6BC𝚼\bfUpsilonMathematical Bold Capital Upsilon
    U+1D6BD𝚽\bfPhiMathematical Bold Capital Phi
    U+1D6BE𝚾\bfChiMathematical Bold Capital Chi
    U+1D6BF𝚿\bfPsiMathematical Bold Capital Psi
    U+1D6C0𝛀\bfOmegaMathematical Bold Capital Omega
    U+1D6C1𝛁\bfnablaMathematical Bold Nabla
    U+1D6C2𝛂\bfalphaMathematical Bold Small Alpha
    U+1D6C3𝛃\bfbetaMathematical Bold Small Beta
    U+1D6C4𝛄\bfgammaMathematical Bold Small Gamma
    U+1D6C5𝛅\bfdeltaMathematical Bold Small Delta
    U+1D6C6𝛆\bfvarepsilonMathematical Bold Small Epsilon
    U+1D6C7𝛇\bfzetaMathematical Bold Small Zeta
    U+1D6C8𝛈\bfetaMathematical Bold Small Eta
    U+1D6C9𝛉\bfthetaMathematical Bold Small Theta
    U+1D6CA𝛊\bfiotaMathematical Bold Small Iota
    U+1D6CB𝛋\bfkappaMathematical Bold Small Kappa
    U+1D6CC𝛌\bflambdaMathematical Bold Small Lamda
    U+1D6CD𝛍\bfmuMathematical Bold Small Mu
    U+1D6CE𝛎\bfnuMathematical Bold Small Nu
    U+1D6CF𝛏\bfxiMathematical Bold Small Xi
    U+1D6D0𝛐\bfomicronMathematical Bold Small Omicron
    U+1D6D1𝛑\bfpiMathematical Bold Small Pi
    U+1D6D2𝛒\bfrhoMathematical Bold Small Rho
    U+1D6D3𝛓\bfvarsigmaMathematical Bold Small Final Sigma
    U+1D6D4𝛔\bfsigmaMathematical Bold Small Sigma
    U+1D6D5𝛕\bftauMathematical Bold Small Tau
    U+1D6D6𝛖\bfupsilonMathematical Bold Small Upsilon
    U+1D6D7𝛗\bfvarphiMathematical Bold Small Phi
    U+1D6D8𝛘\bfchiMathematical Bold Small Chi
    U+1D6D9𝛙\bfpsiMathematical Bold Small Psi
    U+1D6DA𝛚\bfomegaMathematical Bold Small Omega
    U+1D6DB𝛛\bfpartialMathematical Bold Partial Differential
    U+1D6DC𝛜\bfepsilonMathematical Bold Epsilon Symbol
    U+1D6DD𝛝\bfvarthetaMathematical Bold Theta Symbol
    U+1D6DE𝛞\bfvarkappaMathematical Bold Kappa Symbol
    U+1D6DF𝛟\bfphiMathematical Bold Phi Symbol
    U+1D6E0𝛠\bfvarrhoMathematical Bold Rho Symbol
    U+1D6E1𝛡\bfvarpiMathematical Bold Pi Symbol
    U+1D6E2𝛢\itAlphaMathematical Italic Capital Alpha
    U+1D6E3𝛣\itBetaMathematical Italic Capital Beta
    U+1D6E4𝛤\itGammaMathematical Italic Capital Gamma
    U+1D6E5𝛥\itDeltaMathematical Italic Capital Delta
    U+1D6E6𝛦\itEpsilonMathematical Italic Capital Epsilon
    U+1D6E7𝛧\itZetaMathematical Italic Capital Zeta
    U+1D6E8𝛨\itEtaMathematical Italic Capital Eta
    U+1D6E9𝛩\itThetaMathematical Italic Capital Theta
    U+1D6EA𝛪\itIotaMathematical Italic Capital Iota
    U+1D6EB𝛫\itKappaMathematical Italic Capital Kappa
    U+1D6EC𝛬\itLambdaMathematical Italic Capital Lamda
    U+1D6ED𝛭\itMuMathematical Italic Capital Mu
    U+1D6EE𝛮\itNuMathematical Italic Capital Nu
    U+1D6EF𝛯\itXiMathematical Italic Capital Xi
    U+1D6F0𝛰\itOmicronMathematical Italic Capital Omicron
    U+1D6F1𝛱\itPiMathematical Italic Capital Pi
    U+1D6F2𝛲\itRhoMathematical Italic Capital Rho
    U+1D6F3𝛳\itvarThetaMathematical Italic Capital Theta Symbol
    U+1D6F4𝛴\itSigmaMathematical Italic Capital Sigma
    U+1D6F5𝛵\itTauMathematical Italic Capital Tau
    U+1D6F6𝛶\itUpsilonMathematical Italic Capital Upsilon
    U+1D6F7𝛷\itPhiMathematical Italic Capital Phi
    U+1D6F8𝛸\itChiMathematical Italic Capital Chi
    U+1D6F9𝛹\itPsiMathematical Italic Capital Psi
    U+1D6FA𝛺\itOmegaMathematical Italic Capital Omega
    U+1D6FB𝛻\itnablaMathematical Italic Nabla
    U+1D6FC𝛼\italphaMathematical Italic Small Alpha
    U+1D6FD𝛽\itbetaMathematical Italic Small Beta
    U+1D6FE𝛾\itgammaMathematical Italic Small Gamma
    U+1D6FF𝛿\itdeltaMathematical Italic Small Delta
    U+1D700𝜀\itvarepsilonMathematical Italic Small Epsilon
    U+1D701𝜁\itzetaMathematical Italic Small Zeta
    U+1D702𝜂\itetaMathematical Italic Small Eta
    U+1D703𝜃\itthetaMathematical Italic Small Theta
    U+1D704𝜄\itiotaMathematical Italic Small Iota
    U+1D705𝜅\itkappaMathematical Italic Small Kappa
    U+1D706𝜆\itlambdaMathematical Italic Small Lamda
    U+1D707𝜇\itmuMathematical Italic Small Mu
    U+1D708𝜈\itnuMathematical Italic Small Nu
    U+1D709𝜉\itxiMathematical Italic Small Xi
    U+1D70A𝜊\itomicronMathematical Italic Small Omicron
    U+1D70B𝜋\itpiMathematical Italic Small Pi
    U+1D70C𝜌\itrhoMathematical Italic Small Rho
    U+1D70D𝜍\itvarsigmaMathematical Italic Small Final Sigma
    U+1D70E𝜎\itsigmaMathematical Italic Small Sigma
    U+1D70F𝜏\ittauMathematical Italic Small Tau
    U+1D710𝜐\itupsilonMathematical Italic Small Upsilon
    U+1D711𝜑\itvarphiMathematical Italic Small Phi
    U+1D712𝜒\itchiMathematical Italic Small Chi
    U+1D713𝜓\itpsiMathematical Italic Small Psi
    U+1D714𝜔\itomegaMathematical Italic Small Omega
    U+1D715𝜕\itpartialMathematical Italic Partial Differential
    U+1D716𝜖\itepsilonMathematical Italic Epsilon Symbol
    U+1D717𝜗\itvarthetaMathematical Italic Theta Symbol
    U+1D718𝜘\itvarkappaMathematical Italic Kappa Symbol
    U+1D719𝜙\itphiMathematical Italic Phi Symbol
    U+1D71A𝜚\itvarrhoMathematical Italic Rho Symbol
    U+1D71B𝜛\itvarpiMathematical Italic Pi Symbol
    U+1D71C𝜜\biAlphaMathematical Bold Italic Capital Alpha
    U+1D71D𝜝\biBetaMathematical Bold Italic Capital Beta
    U+1D71E𝜞\biGammaMathematical Bold Italic Capital Gamma
    U+1D71F𝜟\biDeltaMathematical Bold Italic Capital Delta
    U+1D720𝜠\biEpsilonMathematical Bold Italic Capital Epsilon
    U+1D721𝜡\biZetaMathematical Bold Italic Capital Zeta
    U+1D722𝜢\biEtaMathematical Bold Italic Capital Eta
    U+1D723𝜣\biThetaMathematical Bold Italic Capital Theta
    U+1D724𝜤\biIotaMathematical Bold Italic Capital Iota
    U+1D725𝜥\biKappaMathematical Bold Italic Capital Kappa
    U+1D726𝜦\biLambdaMathematical Bold Italic Capital Lamda
    U+1D727𝜧\biMuMathematical Bold Italic Capital Mu
    U+1D728𝜨\biNuMathematical Bold Italic Capital Nu
    U+1D729𝜩\biXiMathematical Bold Italic Capital Xi
    U+1D72A𝜪\biOmicronMathematical Bold Italic Capital Omicron
    U+1D72B𝜫\biPiMathematical Bold Italic Capital Pi
    U+1D72C𝜬\biRhoMathematical Bold Italic Capital Rho
    U+1D72D𝜭\bivarThetaMathematical Bold Italic Capital Theta Symbol
    U+1D72E𝜮\biSigmaMathematical Bold Italic Capital Sigma
    U+1D72F𝜯\biTauMathematical Bold Italic Capital Tau
    U+1D730𝜰\biUpsilonMathematical Bold Italic Capital Upsilon
    U+1D731𝜱\biPhiMathematical Bold Italic Capital Phi
    U+1D732𝜲\biChiMathematical Bold Italic Capital Chi
    U+1D733𝜳\biPsiMathematical Bold Italic Capital Psi
    U+1D734𝜴\biOmegaMathematical Bold Italic Capital Omega
    U+1D735𝜵\binablaMathematical Bold Italic Nabla
    U+1D736𝜶\bialphaMathematical Bold Italic Small Alpha
    U+1D737𝜷\bibetaMathematical Bold Italic Small Beta
    U+1D738𝜸\bigammaMathematical Bold Italic Small Gamma
    U+1D739𝜹\bideltaMathematical Bold Italic Small Delta
    U+1D73A𝜺\bivarepsilonMathematical Bold Italic Small Epsilon
    U+1D73B𝜻\bizetaMathematical Bold Italic Small Zeta
    U+1D73C𝜼\bietaMathematical Bold Italic Small Eta
    U+1D73D𝜽\bithetaMathematical Bold Italic Small Theta
    U+1D73E𝜾\biiotaMathematical Bold Italic Small Iota
    U+1D73F𝜿\bikappaMathematical Bold Italic Small Kappa
    U+1D740𝝀\bilambdaMathematical Bold Italic Small Lamda
    U+1D741𝝁\bimuMathematical Bold Italic Small Mu
    U+1D742𝝂\binuMathematical Bold Italic Small Nu
    U+1D743𝝃\bixiMathematical Bold Italic Small Xi
    U+1D744𝝄\biomicronMathematical Bold Italic Small Omicron
    U+1D745𝝅\bipiMathematical Bold Italic Small Pi
    U+1D746𝝆\birhoMathematical Bold Italic Small Rho
    U+1D747𝝇\bivarsigmaMathematical Bold Italic Small Final Sigma
    U+1D748𝝈\bisigmaMathematical Bold Italic Small Sigma
    U+1D749𝝉\bitauMathematical Bold Italic Small Tau
    U+1D74A𝝊\biupsilonMathematical Bold Italic Small Upsilon
    U+1D74B𝝋\bivarphiMathematical Bold Italic Small Phi
    U+1D74C𝝌\bichiMathematical Bold Italic Small Chi
    U+1D74D𝝍\bipsiMathematical Bold Italic Small Psi
    U+1D74E𝝎\biomegaMathematical Bold Italic Small Omega
    U+1D74F𝝏\bipartialMathematical Bold Italic Partial Differential
    U+1D750𝝐\biepsilonMathematical Bold Italic Epsilon Symbol
    U+1D751𝝑\bivarthetaMathematical Bold Italic Theta Symbol
    U+1D752𝝒\bivarkappaMathematical Bold Italic Kappa Symbol
    U+1D753𝝓\biphiMathematical Bold Italic Phi Symbol
    U+1D754𝝔\bivarrhoMathematical Bold Italic Rho Symbol
    U+1D755𝝕\bivarpiMathematical Bold Italic Pi Symbol
    U+1D756𝝖\bsansAlphaMathematical Sans-Serif Bold Capital Alpha
    U+1D757𝝗\bsansBetaMathematical Sans-Serif Bold Capital Beta
    U+1D758𝝘\bsansGammaMathematical Sans-Serif Bold Capital Gamma
    U+1D759𝝙\bsansDeltaMathematical Sans-Serif Bold Capital Delta
    U+1D75A𝝚\bsansEpsilonMathematical Sans-Serif Bold Capital Epsilon
    U+1D75B𝝛\bsansZetaMathematical Sans-Serif Bold Capital Zeta
    U+1D75C𝝜\bsansEtaMathematical Sans-Serif Bold Capital Eta
    U+1D75D𝝝\bsansThetaMathematical Sans-Serif Bold Capital Theta
    U+1D75E𝝞\bsansIotaMathematical Sans-Serif Bold Capital Iota
    U+1D75F𝝟\bsansKappaMathematical Sans-Serif Bold Capital Kappa
    U+1D760𝝠\bsansLambdaMathematical Sans-Serif Bold Capital Lamda
    U+1D761𝝡\bsansMuMathematical Sans-Serif Bold Capital Mu
    U+1D762𝝢\bsansNuMathematical Sans-Serif Bold Capital Nu
    U+1D763𝝣\bsansXiMathematical Sans-Serif Bold Capital Xi
    U+1D764𝝤\bsansOmicronMathematical Sans-Serif Bold Capital Omicron
    U+1D765𝝥\bsansPiMathematical Sans-Serif Bold Capital Pi
    U+1D766𝝦\bsansRhoMathematical Sans-Serif Bold Capital Rho
    U+1D767𝝧\bsansvarThetaMathematical Sans-Serif Bold Capital Theta Symbol
    U+1D768𝝨\bsansSigmaMathematical Sans-Serif Bold Capital Sigma
    U+1D769𝝩\bsansTauMathematical Sans-Serif Bold Capital Tau
    U+1D76A𝝪\bsansUpsilonMathematical Sans-Serif Bold Capital Upsilon
    U+1D76B𝝫\bsansPhiMathematical Sans-Serif Bold Capital Phi
    U+1D76C𝝬\bsansChiMathematical Sans-Serif Bold Capital Chi
    U+1D76D𝝭\bsansPsiMathematical Sans-Serif Bold Capital Psi
    U+1D76E𝝮\bsansOmegaMathematical Sans-Serif Bold Capital Omega
    U+1D76F𝝯\bsansnablaMathematical Sans-Serif Bold Nabla
    U+1D770𝝰\bsansalphaMathematical Sans-Serif Bold Small Alpha
    U+1D771𝝱\bsansbetaMathematical Sans-Serif Bold Small Beta
    U+1D772𝝲\bsansgammaMathematical Sans-Serif Bold Small Gamma
    U+1D773𝝳\bsansdeltaMathematical Sans-Serif Bold Small Delta
    U+1D774𝝴\bsansvarepsilonMathematical Sans-Serif Bold Small Epsilon
    U+1D775𝝵\bsanszetaMathematical Sans-Serif Bold Small Zeta
    U+1D776𝝶\bsansetaMathematical Sans-Serif Bold Small Eta
    U+1D777𝝷\bsansthetaMathematical Sans-Serif Bold Small Theta
    U+1D778𝝸\bsansiotaMathematical Sans-Serif Bold Small Iota
    U+1D779𝝹\bsanskappaMathematical Sans-Serif Bold Small Kappa
    U+1D77A𝝺\bsanslambdaMathematical Sans-Serif Bold Small Lamda
    U+1D77B𝝻\bsansmuMathematical Sans-Serif Bold Small Mu
    U+1D77C𝝼\bsansnuMathematical Sans-Serif Bold Small Nu
    U+1D77D𝝽\bsansxiMathematical Sans-Serif Bold Small Xi
    U+1D77E𝝾\bsansomicronMathematical Sans-Serif Bold Small Omicron
    U+1D77F𝝿\bsanspiMathematical Sans-Serif Bold Small Pi
    U+1D780𝞀\bsansrhoMathematical Sans-Serif Bold Small Rho
    U+1D781𝞁\bsansvarsigmaMathematical Sans-Serif Bold Small Final Sigma
    U+1D782𝞂\bsanssigmaMathematical Sans-Serif Bold Small Sigma
    U+1D783𝞃\bsanstauMathematical Sans-Serif Bold Small Tau
    U+1D784𝞄\bsansupsilonMathematical Sans-Serif Bold Small Upsilon
    U+1D785𝞅\bsansvarphiMathematical Sans-Serif Bold Small Phi
    U+1D786𝞆\bsanschiMathematical Sans-Serif Bold Small Chi
    U+1D787𝞇\bsanspsiMathematical Sans-Serif Bold Small Psi
    U+1D788𝞈\bsansomegaMathematical Sans-Serif Bold Small Omega
    U+1D789𝞉\bsanspartialMathematical Sans-Serif Bold Partial Differential
    U+1D78A𝞊\bsansepsilonMathematical Sans-Serif Bold Epsilon Symbol
    U+1D78B𝞋\bsansvarthetaMathematical Sans-Serif Bold Theta Symbol
    U+1D78C𝞌\bsansvarkappaMathematical Sans-Serif Bold Kappa Symbol
    U+1D78D𝞍\bsansphiMathematical Sans-Serif Bold Phi Symbol
    U+1D78E𝞎\bsansvarrhoMathematical Sans-Serif Bold Rho Symbol
    U+1D78F𝞏\bsansvarpiMathematical Sans-Serif Bold Pi Symbol
    U+1D790𝞐\bisansAlphaMathematical Sans-Serif Bold Italic Capital Alpha
    U+1D791𝞑\bisansBetaMathematical Sans-Serif Bold Italic Capital Beta
    U+1D792𝞒\bisansGammaMathematical Sans-Serif Bold Italic Capital Gamma
    U+1D793𝞓\bisansDeltaMathematical Sans-Serif Bold Italic Capital Delta
    U+1D794𝞔\bisansEpsilonMathematical Sans-Serif Bold Italic Capital Epsilon
    U+1D795𝞕\bisansZetaMathematical Sans-Serif Bold Italic Capital Zeta
    U+1D796𝞖\bisansEtaMathematical Sans-Serif Bold Italic Capital Eta
    U+1D797𝞗\bisansThetaMathematical Sans-Serif Bold Italic Capital Theta
    U+1D798𝞘\bisansIotaMathematical Sans-Serif Bold Italic Capital Iota
    U+1D799𝞙\bisansKappaMathematical Sans-Serif Bold Italic Capital Kappa
    U+1D79A𝞚\bisansLambdaMathematical Sans-Serif Bold Italic Capital Lamda
    U+1D79B𝞛\bisansMuMathematical Sans-Serif Bold Italic Capital Mu
    U+1D79C𝞜\bisansNuMathematical Sans-Serif Bold Italic Capital Nu
    U+1D79D𝞝\bisansXiMathematical Sans-Serif Bold Italic Capital Xi
    U+1D79E𝞞\bisansOmicronMathematical Sans-Serif Bold Italic Capital Omicron
    U+1D79F𝞟\bisansPiMathematical Sans-Serif Bold Italic Capital Pi
    U+1D7A0𝞠\bisansRhoMathematical Sans-Serif Bold Italic Capital Rho
    U+1D7A1𝞡\bisansvarThetaMathematical Sans-Serif Bold Italic Capital Theta Symbol
    U+1D7A2𝞢\bisansSigmaMathematical Sans-Serif Bold Italic Capital Sigma
    U+1D7A3𝞣\bisansTauMathematical Sans-Serif Bold Italic Capital Tau
    U+1D7A4𝞤\bisansUpsilonMathematical Sans-Serif Bold Italic Capital Upsilon
    U+1D7A5𝞥\bisansPhiMathematical Sans-Serif Bold Italic Capital Phi
    U+1D7A6𝞦\bisansChiMathematical Sans-Serif Bold Italic Capital Chi
    U+1D7A7𝞧\bisansPsiMathematical Sans-Serif Bold Italic Capital Psi
    U+1D7A8𝞨\bisansOmegaMathematical Sans-Serif Bold Italic Capital Omega
    U+1D7A9𝞩\bisansnablaMathematical Sans-Serif Bold Italic Nabla
    U+1D7AA𝞪\bisansalphaMathematical Sans-Serif Bold Italic Small Alpha
    U+1D7AB𝞫\bisansbetaMathematical Sans-Serif Bold Italic Small Beta
    U+1D7AC𝞬\bisansgammaMathematical Sans-Serif Bold Italic Small Gamma
    U+1D7AD𝞭\bisansdeltaMathematical Sans-Serif Bold Italic Small Delta
    U+1D7AE𝞮\bisansvarepsilonMathematical Sans-Serif Bold Italic Small Epsilon
    U+1D7AF𝞯\bisanszetaMathematical Sans-Serif Bold Italic Small Zeta
    U+1D7B0𝞰\bisansetaMathematical Sans-Serif Bold Italic Small Eta
    U+1D7B1𝞱\bisansthetaMathematical Sans-Serif Bold Italic Small Theta
    U+1D7B2𝞲\bisansiotaMathematical Sans-Serif Bold Italic Small Iota
    U+1D7B3𝞳\bisanskappaMathematical Sans-Serif Bold Italic Small Kappa
    U+1D7B4𝞴\bisanslambdaMathematical Sans-Serif Bold Italic Small Lamda
    U+1D7B5𝞵\bisansmuMathematical Sans-Serif Bold Italic Small Mu
    U+1D7B6𝞶\bisansnuMathematical Sans-Serif Bold Italic Small Nu
    U+1D7B7𝞷\bisansxiMathematical Sans-Serif Bold Italic Small Xi
    U+1D7B8𝞸\bisansomicronMathematical Sans-Serif Bold Italic Small Omicron
    U+1D7B9𝞹\bisanspiMathematical Sans-Serif Bold Italic Small Pi
    U+1D7BA𝞺\bisansrhoMathematical Sans-Serif Bold Italic Small Rho
    U+1D7BB𝞻\bisansvarsigmaMathematical Sans-Serif Bold Italic Small Final Sigma
    U+1D7BC𝞼\bisanssigmaMathematical Sans-Serif Bold Italic Small Sigma
    U+1D7BD𝞽\bisanstauMathematical Sans-Serif Bold Italic Small Tau
    U+1D7BE𝞾\bisansupsilonMathematical Sans-Serif Bold Italic Small Upsilon
    U+1D7BF𝞿\bisansvarphiMathematical Sans-Serif Bold Italic Small Phi
    U+1D7C0𝟀\bisanschiMathematical Sans-Serif Bold Italic Small Chi
    U+1D7C1𝟁\bisanspsiMathematical Sans-Serif Bold Italic Small Psi
    U+1D7C2𝟂\bisansomegaMathematical Sans-Serif Bold Italic Small Omega
    U+1D7C3𝟃\bisanspartialMathematical Sans-Serif Bold Italic Partial Differential
    U+1D7C4𝟄\bisansepsilonMathematical Sans-Serif Bold Italic Epsilon Symbol
    U+1D7C5𝟅\bisansvarthetaMathematical Sans-Serif Bold Italic Theta Symbol
    U+1D7C6𝟆\bisansvarkappaMathematical Sans-Serif Bold Italic Kappa Symbol
    U+1D7C7𝟇\bisansphiMathematical Sans-Serif Bold Italic Phi Symbol
    U+1D7C8𝟈\bisansvarrhoMathematical Sans-Serif Bold Italic Rho Symbol
    U+1D7C9𝟉\bisansvarpiMathematical Sans-Serif Bold Italic Pi Symbol
    U+1D7CA𝟊\bfDigammaMathematical Bold Capital Digamma
    U+1D7CB𝟋\bfdigammaMathematical Bold Small Digamma
    U+1D7CE𝟎\bfzeroMathematical Bold Digit Zero
    U+1D7CF𝟏\bfoneMathematical Bold Digit One
    U+1D7D0𝟐\bftwoMathematical Bold Digit Two
    U+1D7D1𝟑\bfthreeMathematical Bold Digit Three
    U+1D7D2𝟒\bffourMathematical Bold Digit Four
    U+1D7D3𝟓\bffiveMathematical Bold Digit Five
    U+1D7D4𝟔\bfsixMathematical Bold Digit Six
    U+1D7D5𝟕\bfsevenMathematical Bold Digit Seven
    U+1D7D6𝟖\bfeightMathematical Bold Digit Eight
    U+1D7D7𝟗\bfnineMathematical Bold Digit Nine
    U+1D7D8𝟘\bbzeroMathematical Double-Struck Digit Zero
    U+1D7D9𝟙\bboneMathematical Double-Struck Digit One
    U+1D7DA𝟚\bbtwoMathematical Double-Struck Digit Two
    U+1D7DB𝟛\bbthreeMathematical Double-Struck Digit Three
    U+1D7DC𝟜\bbfourMathematical Double-Struck Digit Four
    U+1D7DD𝟝\bbfiveMathematical Double-Struck Digit Five
    U+1D7DE𝟞\bbsixMathematical Double-Struck Digit Six
    U+1D7DF𝟟\bbsevenMathematical Double-Struck Digit Seven
    U+1D7E0𝟠\bbeightMathematical Double-Struck Digit Eight
    U+1D7E1𝟡\bbnineMathematical Double-Struck Digit Nine
    U+1D7E2𝟢\sanszeroMathematical Sans-Serif Digit Zero
    U+1D7E3𝟣\sansoneMathematical Sans-Serif Digit One
    U+1D7E4𝟤\sanstwoMathematical Sans-Serif Digit Two
    U+1D7E5𝟥\sansthreeMathematical Sans-Serif Digit Three
    U+1D7E6𝟦\sansfourMathematical Sans-Serif Digit Four
    U+1D7E7𝟧\sansfiveMathematical Sans-Serif Digit Five
    U+1D7E8𝟨\sanssixMathematical Sans-Serif Digit Six
    U+1D7E9𝟩\sanssevenMathematical Sans-Serif Digit Seven
    U+1D7EA𝟪\sanseightMathematical Sans-Serif Digit Eight
    U+1D7EB𝟫\sansnineMathematical Sans-Serif Digit Nine
    U+1D7EC𝟬\bsanszeroMathematical Sans-Serif Bold Digit Zero
    U+1D7ED𝟭\bsansoneMathematical Sans-Serif Bold Digit One
    U+1D7EE𝟮\bsanstwoMathematical Sans-Serif Bold Digit Two
    U+1D7EF𝟯\bsansthreeMathematical Sans-Serif Bold Digit Three
    U+1D7F0𝟰\bsansfourMathematical Sans-Serif Bold Digit Four
    U+1D7F1𝟱\bsansfiveMathematical Sans-Serif Bold Digit Five
    U+1D7F2𝟲\bsanssixMathematical Sans-Serif Bold Digit Six
    U+1D7F3𝟳\bsanssevenMathematical Sans-Serif Bold Digit Seven
    U+1D7F4𝟴\bsanseightMathematical Sans-Serif Bold Digit Eight
    U+1D7F5𝟵\bsansnineMathematical Sans-Serif Bold Digit Nine
    U+1D7F6𝟶\ttzeroMathematical Monospace Digit Zero
    U+1D7F7𝟷\ttoneMathematical Monospace Digit One
    U+1D7F8𝟸\tttwoMathematical Monospace Digit Two
    U+1D7F9𝟹\ttthreeMathematical Monospace Digit Three
    U+1D7FA𝟺\ttfourMathematical Monospace Digit Four
    U+1D7FB𝟻\ttfiveMathematical Monospace Digit Five
    U+1D7FC𝟼\ttsixMathematical Monospace Digit Six
    U+1D7FD𝟽\ttsevenMathematical Monospace Digit Seven
    U+1D7FE𝟾\tteightMathematical Monospace Digit Eight
    U+1D7FF𝟿\ttnineMathematical Monospace Digit Nine
    U+1F004🀄\:mahjong:Mahjong Tile Red Dragon
    U+1F0CF🃏\:black_joker:Playing Card Black Joker
    U+1F170🅰\:a:Negative Squared Latin Capital Letter A
    U+1F171🅱\:b:Negative Squared Latin Capital Letter B
    U+1F17E🅾\:o2:Negative Squared Latin Capital Letter O
    U+1F17F🅿\:parking:Negative Squared Latin Capital Letter P
    U+1F18E🆎\:ab:Negative Squared Ab
    U+1F191🆑\:cl:Squared Cl
    U+1F192🆒\:cool:Squared Cool
    U+1F193🆓\:free:Squared Free
    U+1F194🆔\:id:Squared Id
    U+1F195🆕\:new:Squared New
    U+1F196🆖\:ng:Squared Ng
    U+1F197🆗\:ok:Squared Ok
    U+1F198🆘\:sos:Squared Sos
    U+1F199🆙\:up:Squared Up With Exclamation Mark
    U+1F19A🆚\:vs:Squared Vs
    U+1F201🈁\:koko:Squared Katakana Koko
    U+1F202🈂\:sa:Squared Katakana Sa
    U+1F21A🈚\:u7121:Squared Cjk Unified Ideograph-7121
    U+1F22F🈯\:u6307:Squared Cjk Unified Ideograph-6307
    U+1F232🈲\:u7981:Squared Cjk Unified Ideograph-7981
    U+1F233🈳\:u7a7a:Squared Cjk Unified Ideograph-7A7A
    U+1F234🈴\:u5408:Squared Cjk Unified Ideograph-5408
    U+1F235🈵\:u6e80:Squared Cjk Unified Ideograph-6E80
    U+1F236🈶\:u6709:Squared Cjk Unified Ideograph-6709
    U+1F237🈷\:u6708:Squared Cjk Unified Ideograph-6708
    U+1F238🈸\:u7533:Squared Cjk Unified Ideograph-7533
    U+1F239🈹\:u5272:Squared Cjk Unified Ideograph-5272
    U+1F23A🈺\:u55b6:Squared Cjk Unified Ideograph-55B6
    U+1F250🉐\:ideograph_advantage:Circled Ideograph Advantage
    U+1F251🉑\:accept:Circled Ideograph Accept
    U+1F300🌀\:cyclone:Cyclone
    U+1F301🌁\:foggy:Foggy
    U+1F302🌂\:closed_umbrella:Closed Umbrella
    U+1F303🌃\:night_with_stars:Night With Stars
    U+1F304🌄\:sunrise_over_mountains:Sunrise Over Mountains
    U+1F305🌅\:sunrise:Sunrise
    U+1F306🌆\:city_sunset:Cityscape At Dusk
    U+1F307🌇\:city_sunrise:Sunset Over Buildings
    U+1F308🌈\:rainbow:Rainbow
    U+1F309🌉\:bridge_at_night:Bridge At Night
    U+1F30A🌊\:ocean:Water Wave
    U+1F30B🌋\:volcano:Volcano
    U+1F30C🌌\:milky_way:Milky Way
    U+1F30D🌍\:earth_africa:Earth Globe Europe-Africa
    U+1F30E🌎\:earth_americas:Earth Globe Americas
    U+1F30F🌏\:earth_asia:Earth Globe Asia-Australia
    U+1F310🌐\:globe_with_meridians:Globe With Meridians
    U+1F311🌑\:new_moon:New Moon Symbol
    U+1F312🌒\:waxing_crescent_moon:Waxing Crescent Moon Symbol
    U+1F313🌓\:first_quarter_moon:First Quarter Moon Symbol
    U+1F314🌔\:moon:Waxing Gibbous Moon Symbol
    U+1F315🌕\:full_moon:Full Moon Symbol
    U+1F316🌖\:waning_gibbous_moon:Waning Gibbous Moon Symbol
    U+1F317🌗\:last_quarter_moon:Last Quarter Moon Symbol
    U+1F318🌘\:waning_crescent_moon:Waning Crescent Moon Symbol
    U+1F319🌙\:crescent_moon:Crescent Moon
    U+1F31A🌚\:new_moon_with_face:New Moon With Face
    U+1F31B🌛\:first_quarter_moon_with_face:First Quarter Moon With Face
    U+1F31C🌜\:last_quarter_moon_with_face:Last Quarter Moon With Face
    U+1F31D🌝\:full_moon_with_face:Full Moon With Face
    U+1F31E🌞\:sun_with_face:Sun With Face
    U+1F31F🌟\:star2:Glowing Star
    U+1F320🌠\:stars:Shooting Star
    U+1F32D🌭\:hotdog:Hot Dog
    U+1F32E🌮\:taco:Taco
    U+1F32F🌯\:burrito:Burrito
    U+1F330🌰\:chestnut:Chestnut
    U+1F331🌱\:seedling:Seedling
    U+1F332🌲\:evergreen_tree:Evergreen Tree
    U+1F333🌳\:deciduous_tree:Deciduous Tree
    U+1F334🌴\:palm_tree:Palm Tree
    U+1F335🌵\:cactus:Cactus
    U+1F337🌷\:tulip:Tulip
    U+1F338🌸\:cherry_blossom:Cherry Blossom
    U+1F339🌹\:rose:Rose
    U+1F33A🌺\:hibiscus:Hibiscus
    U+1F33B🌻\:sunflower:Sunflower
    U+1F33C🌼\:blossom:Blossom
    U+1F33D🌽\:corn:Ear Of Maize
    U+1F33E🌾\:ear_of_rice:Ear Of Rice
    U+1F33F🌿\:herb:Herb
    U+1F340🍀\:four_leaf_clover:Four Leaf Clover
    U+1F341🍁\:maple_leaf:Maple Leaf
    U+1F342🍂\:fallen_leaf:Fallen Leaf
    U+1F343🍃\:leaves:Leaf Fluttering In Wind
    U+1F344🍄\:mushroom:Mushroom
    U+1F345🍅\:tomato:Tomato
    U+1F346🍆\:eggplant:Aubergine
    U+1F347🍇\:grapes:Grapes
    U+1F348🍈\:melon:Melon
    U+1F349🍉\:watermelon:Watermelon
    U+1F34A🍊\:tangerine:Tangerine
    U+1F34B🍋\:lemon:Lemon
    U+1F34C🍌\:banana:Banana
    U+1F34D🍍\:pineapple:Pineapple
    U+1F34E🍎\:apple:Red Apple
    U+1F34F🍏\:green_apple:Green Apple
    U+1F350🍐\:pear:Pear
    U+1F351🍑\:peach:Peach
    U+1F352🍒\:cherries:Cherries
    U+1F353🍓\:strawberry:Strawberry
    U+1F354🍔\:hamburger:Hamburger
    U+1F355🍕\:pizza:Slice Of Pizza
    U+1F356🍖\:meat_on_bone:Meat On Bone
    U+1F357🍗\:poultry_leg:Poultry Leg
    U+1F358🍘\:rice_cracker:Rice Cracker
    U+1F359🍙\:rice_ball:Rice Ball
    U+1F35A🍚\:rice:Cooked Rice
    U+1F35B🍛\:curry:Curry And Rice
    U+1F35C🍜\:ramen:Steaming Bowl
    U+1F35D🍝\:spaghetti:Spaghetti
    U+1F35E🍞\:bread:Bread
    U+1F35F🍟\:fries:French Fries
    U+1F360🍠\:sweet_potato:Roasted Sweet Potato
    U+1F361🍡\:dango:Dango
    U+1F362🍢\:oden:Oden
    U+1F363🍣\:sushi:Sushi
    U+1F364🍤\:fried_shrimp:Fried Shrimp
    U+1F365🍥\:fish_cake:Fish Cake With Swirl Design
    U+1F366🍦\:icecream:Soft Ice Cream
    U+1F367🍧\:shaved_ice:Shaved Ice
    U+1F368🍨\:ice_cream:Ice Cream
    U+1F369🍩\:doughnut:Doughnut
    U+1F36A🍪\:cookie:Cookie
    U+1F36B🍫\:chocolate_bar:Chocolate Bar
    U+1F36C🍬\:candy:Candy
    U+1F36D🍭\:lollipop:Lollipop
    U+1F36E🍮\:custard:Custard
    U+1F36F🍯\:honey_pot:Honey Pot
    U+1F370🍰\:cake:Shortcake
    U+1F371🍱\:bento:Bento Box
    U+1F372🍲\:stew:Pot Of Food
    U+1F373🍳\:fried_egg:Cooking
    U+1F374🍴\:fork_and_knife:Fork And Knife
    U+1F375🍵\:tea:Teacup Without Handle
    U+1F376🍶\:sake:Sake Bottle And Cup
    U+1F377🍷\:wine_glass:Wine Glass
    U+1F378🍸\:cocktail:Cocktail Glass
    U+1F379🍹\:tropical_drink:Tropical Drink
    U+1F37A🍺\:beer:Beer Mug
    U+1F37B🍻\:beers:Clinking Beer Mugs
    U+1F37C🍼\:baby_bottle:Baby Bottle
    U+1F37E🍾\:champagne:Bottle With Popping Cork
    U+1F37F🍿\:popcorn:Popcorn
    U+1F380🎀\:ribbon:Ribbon
    U+1F381🎁\:gift:Wrapped Present
    U+1F382🎂\:birthday:Birthday Cake
    U+1F383🎃\:jack_o_lantern:Jack-O-Lantern
    U+1F384🎄\:christmas_tree:Christmas Tree
    U+1F385🎅\:santa:Father Christmas
    U+1F386🎆\:fireworks:Fireworks
    U+1F387🎇\:sparkler:Firework Sparkler
    U+1F388🎈\:balloon:Balloon
    U+1F389🎉\:tada:Party Popper
    U+1F38A🎊\:confetti_ball:Confetti Ball
    U+1F38B🎋\:tanabata_tree:Tanabata Tree
    U+1F38C🎌\:crossed_flags:Crossed Flags
    U+1F38D🎍\:bamboo:Pine Decoration
    U+1F38E🎎\:dolls:Japanese Dolls
    U+1F38F🎏\:flags:Carp Streamer
    U+1F390🎐\:wind_chime:Wind Chime
    U+1F391🎑\:rice_scene:Moon Viewing Ceremony
    U+1F392🎒\:school_satchel:School Satchel
    U+1F393🎓\:mortar_board:Graduation Cap
    U+1F3A0🎠\:carousel_horse:Carousel Horse
    U+1F3A1🎡\:ferris_wheel:Ferris Wheel
    U+1F3A2🎢\:roller_coaster:Roller Coaster
    U+1F3A3🎣\:fishing_pole_and_fish:Fishing Pole And Fish
    U+1F3A4🎤\:microphone:Microphone
    U+1F3A5🎥\:movie_camera:Movie Camera
    U+1F3A6🎦\:cinema:Cinema
    U+1F3A7🎧\:headphones:Headphone
    U+1F3A8🎨\:art:Artist Palette
    U+1F3A9🎩\:tophat:Top Hat
    U+1F3AA🎪\:circus_tent:Circus Tent
    U+1F3AB🎫\:ticket:Ticket
    U+1F3AC🎬\:clapper:Clapper Board
    U+1F3AD🎭\:performing_arts:Performing Arts
    U+1F3AE🎮\:video_game:Video Game
    U+1F3AF🎯\:dart:Direct Hit
    U+1F3B0🎰\:slot_machine:Slot Machine
    U+1F3B1🎱\:8ball:Billiards
    U+1F3B2🎲\:game_die:Game Die
    U+1F3B3🎳\:bowling:Bowling
    U+1F3B4🎴\:flower_playing_cards:Flower Playing Cards
    U+1F3B5🎵\:musical_note:Musical Note
    U+1F3B6🎶\:notes:Multiple Musical Notes
    U+1F3B7🎷\:saxophone:Saxophone
    U+1F3B8🎸\:guitar:Guitar
    U+1F3B9🎹\:musical_keyboard:Musical Keyboard
    U+1F3BA🎺\:trumpet:Trumpet
    U+1F3BB🎻\:violin:Violin
    U+1F3BC🎼\:musical_score:Musical Score
    U+1F3BD🎽\:running_shirt_with_sash:Running Shirt With Sash
    U+1F3BE🎾\:tennis:Tennis Racquet And Ball
    U+1F3BF🎿\:ski:Ski And Ski Boot
    U+1F3C0🏀\:basketball:Basketball And Hoop
    U+1F3C1🏁\:checkered_flag:Chequered Flag
    U+1F3C2🏂\:snowboarder:Snowboarder
    U+1F3C3🏃\:runner:Runner
    U+1F3C4🏄\:surfer:Surfer
    U+1F3C5🏅\:sports_medal:Sports Medal
    U+1F3C6🏆\:trophy:Trophy
    U+1F3C7🏇\:horse_racing:Horse Racing
    U+1F3C8🏈\:football:American Football
    U+1F3C9🏉\:rugby_football:Rugby Football
    U+1F3CA🏊\:swimmer:Swimmer
    U+1F3CF🏏\:cricket_bat_and_ball:Cricket Bat And Ball
    U+1F3D0🏐\:volleyball:Volleyball
    U+1F3D1🏑\:field_hockey_stick_and_ball:Field Hockey Stick And Ball
    U+1F3D2🏒\:ice_hockey_stick_and_puck:Ice Hockey Stick And Puck
    U+1F3D3🏓\:table_tennis_paddle_and_ball:Table Tennis Paddle And Ball
    U+1F3E0🏠\:house:House Building
    U+1F3E1🏡\:house_with_garden:House With Garden
    U+1F3E2🏢\:office:Office Building
    U+1F3E3🏣\:post_office:Japanese Post Office
    U+1F3E4🏤\:european_post_office:European Post Office
    U+1F3E5🏥\:hospital:Hospital
    U+1F3E6🏦\:bank:Bank
    U+1F3E7🏧\:atm:Automated Teller Machine
    U+1F3E8🏨\:hotel:Hotel
    U+1F3E9🏩\:love_hotel:Love Hotel
    U+1F3EA🏪\:convenience_store:Convenience Store
    U+1F3EB🏫\:school:School
    U+1F3EC🏬\:department_store:Department Store
    U+1F3ED🏭\:factory:Factory
    U+1F3EE🏮\:izakaya_lantern:Izakaya Lantern
    U+1F3EF🏯\:japanese_castle:Japanese Castle
    U+1F3F0🏰\:european_castle:European Castle
    U+1F3F4🏴\:waving_black_flag:Waving Black Flag
    U+1F3F8🏸\:badminton_racquet_and_shuttlecock:Badminton Racquet And Shuttlecock
    U+1F3F9🏹\:bow_and_arrow:Bow And Arrow
    U+1F3FA🏺\:amphora:Amphora
    U+1F3FB🏻\:skin-tone-2:Emoji Modifier Fitzpatrick Type-1-2
    U+1F3FC🏼\:skin-tone-3:Emoji Modifier Fitzpatrick Type-3
    U+1F3FD🏽\:skin-tone-4:Emoji Modifier Fitzpatrick Type-4
    U+1F3FE🏾\:skin-tone-5:Emoji Modifier Fitzpatrick Type-5
    U+1F3FF🏿\:skin-tone-6:Emoji Modifier Fitzpatrick Type-6
    U+1F400🐀\:rat:Rat
    U+1F401🐁\:mouse2:Mouse
    U+1F402🐂\:ox:Ox
    U+1F403🐃\:water_buffalo:Water Buffalo
    U+1F404🐄\:cow2:Cow
    U+1F405🐅\:tiger2:Tiger
    U+1F406🐆\:leopard:Leopard
    U+1F407🐇\:rabbit2:Rabbit
    U+1F408🐈\:cat2:Cat
    U+1F409🐉\:dragon:Dragon
    U+1F40A🐊\:crocodile:Crocodile
    U+1F40B🐋\:whale2:Whale
    U+1F40C🐌\:snail:Snail
    U+1F40D🐍\:snake:Snake
    U+1F40E🐎\:racehorse:Horse
    U+1F40F🐏\:ram:Ram
    U+1F410🐐\:goat:Goat
    U+1F411🐑\:sheep:Sheep
    U+1F412🐒\:monkey:Monkey
    U+1F413🐓\:rooster:Rooster
    U+1F414🐔\:chicken:Chicken
    U+1F415🐕\:dog2:Dog
    U+1F416🐖\:pig2:Pig
    U+1F417🐗\:boar:Boar
    U+1F418🐘\:elephant:Elephant
    U+1F419🐙\:octopus:Octopus
    U+1F41A🐚\:shell:Spiral Shell
    U+1F41B🐛\:bug:Bug
    U+1F41C🐜\:ant:Ant
    U+1F41D🐝\:bee:Honeybee
    U+1F41E🐞\:ladybug:Lady Beetle
    U+1F41F🐟\:fish:Fish
    U+1F420🐠\:tropical_fish:Tropical Fish
    U+1F421🐡\:blowfish:Blowfish
    U+1F422🐢\:turtle:Turtle
    U+1F423🐣\:hatching_chick:Hatching Chick
    U+1F424🐤\:baby_chick:Baby Chick
    U+1F425🐥\:hatched_chick:Front-Facing Baby Chick
    U+1F426🐦\:bird:Bird
    U+1F427🐧\:penguin:Penguin
    U+1F428🐨\:koala:Koala
    U+1F429🐩\:poodle:Poodle
    U+1F42A🐪\:dromedary_camel:Dromedary Camel
    U+1F42B🐫\:camel:Bactrian Camel
    U+1F42C🐬\:dolphin:Dolphin
    U+1F42D🐭\:mouse:Mouse Face
    U+1F42E🐮\:cow:Cow Face
    U+1F42F🐯\:tiger:Tiger Face
    U+1F430🐰\:rabbit:Rabbit Face
    U+1F431🐱\:cat:Cat Face
    U+1F432🐲\:dragon_face:Dragon Face
    U+1F433🐳\:whale:Spouting Whale
    U+1F434🐴\:horse:Horse Face
    U+1F435🐵\:monkey_face:Monkey Face
    U+1F436🐶\:dog:Dog Face
    U+1F437🐷\:pig:Pig Face
    U+1F438🐸\:frog:Frog Face
    U+1F439🐹\:hamster:Hamster Face
    U+1F43A🐺\:wolf:Wolf Face
    U+1F43B🐻\:bear:Bear Face
    U+1F43C🐼\:panda_face:Panda Face
    U+1F43D🐽\:pig_nose:Pig Nose
    U+1F43E🐾\:feet:Paw Prints
    U+1F440👀\:eyes:Eyes
    U+1F442👂\:ear:Ear
    U+1F443👃\:nose:Nose
    U+1F444👄\:lips:Mouth
    U+1F445👅\:tongue:Tongue
    U+1F446👆\:point_up_2:White Up Pointing Backhand Index
    U+1F447👇\:point_down:White Down Pointing Backhand Index
    U+1F448👈\:point_left:White Left Pointing Backhand Index
    U+1F449👉\:point_right:White Right Pointing Backhand Index
    U+1F44A👊\:facepunch:Fisted Hand Sign
    U+1F44B👋\:wave:Waving Hand Sign
    U+1F44C👌\:ok_hand:Ok Hand Sign
    U+1F44D👍\:+1:Thumbs Up Sign
    U+1F44E👎\:-1:Thumbs Down Sign
    U+1F44F👏\:clap:Clapping Hands Sign
    U+1F450👐\:open_hands:Open Hands Sign
    U+1F451👑\:crown:Crown
    U+1F452👒\:womans_hat:Womans Hat
    U+1F453👓\:eyeglasses:Eyeglasses
    U+1F454👔\:necktie:Necktie
    U+1F455👕\:shirt:T-Shirt
    U+1F456👖\:jeans:Jeans
    U+1F457👗\:dress:Dress
    U+1F458👘\:kimono:Kimono
    U+1F459👙\:bikini:Bikini
    U+1F45A👚\:womans_clothes:Womans Clothes
    U+1F45B👛\:purse:Purse
    U+1F45C👜\:handbag:Handbag
    U+1F45D👝\:pouch:Pouch
    U+1F45E👞\:mans_shoe:Mans Shoe
    U+1F45F👟\:athletic_shoe:Athletic Shoe
    U+1F460👠\:high_heel:High-Heeled Shoe
    U+1F461👡\:sandal:Womans Sandal
    U+1F462👢\:boot:Womans Boots
    U+1F463👣\:footprints:Footprints
    U+1F464👤\:bust_in_silhouette:Bust In Silhouette
    U+1F465👥\:busts_in_silhouette:Busts In Silhouette
    U+1F466👦\:boy:Boy
    U+1F467👧\:girl:Girl
    U+1F468👨\:man:Man
    U+1F469👩\:woman:Woman
    U+1F46A👪\:family:Family
    U+1F46B👫\:couple:, \:man_and_woman_holding_hands:Man And Woman Holding Hands
    U+1F46C👬\:two_men_holding_hands:Two Men Holding Hands
    U+1F46D👭\:two_women_holding_hands:Two Women Holding Hands
    U+1F46E👮\:cop:Police Officer
    U+1F46F👯\:dancers:Woman With Bunny Ears
    U+1F470👰\:bride_with_veil:Bride With Veil
    U+1F471👱\:person_with_blond_hair:Person With Blond Hair
    U+1F472👲\:man_with_gua_pi_mao:Man With Gua Pi Mao
    U+1F473👳\:man_with_turban:Man With Turban
    U+1F474👴\:older_man:Older Man
    U+1F475👵\:older_woman:Older Woman
    U+1F476👶\:baby:Baby
    U+1F477👷\:construction_worker:Construction Worker
    U+1F478👸\:princess:Princess
    U+1F479👹\:japanese_ogre:Japanese Ogre
    U+1F47A👺\:japanese_goblin:Japanese Goblin
    U+1F47B👻\:ghost:Ghost
    U+1F47C👼\:angel:Baby Angel
    U+1F47D👽\:alien:Extraterrestrial Alien
    U+1F47E👾\:space_invader:Alien Monster
    U+1F47F👿\:imp:Imp
    U+1F480💀\:skull:Skull
    U+1F481💁\:information_desk_person:Information Desk Person
    U+1F482💂\:guardsman:Guardsman
    U+1F483💃\:dancer:Dancer
    U+1F484💄\:lipstick:Lipstick
    U+1F485💅\:nail_care:Nail Polish
    U+1F486💆\:massage:Face Massage
    U+1F487💇\:haircut:Haircut
    U+1F488💈\:barber:Barber Pole
    U+1F489💉\:syringe:Syringe
    U+1F48A💊\:pill:Pill
    U+1F48B💋\:kiss:Kiss Mark
    U+1F48C💌\:love_letter:Love Letter
    U+1F48D💍\:ring:Ring
    U+1F48E💎\:gem:Gem Stone
    U+1F48F💏\:couplekiss:Kiss
    U+1F490💐\:bouquet:Bouquet
    U+1F491💑\:couple_with_heart:Couple With Heart
    U+1F492💒\:wedding:Wedding
    U+1F493💓\:heartbeat:Beating Heart
    U+1F494💔\:broken_heart:Broken Heart
    U+1F495💕\:two_hearts:Two Hearts
    U+1F496💖\:sparkling_heart:Sparkling Heart
    U+1F497💗\:heartpulse:Growing Heart
    U+1F498💘\:cupid:Heart With Arrow
    U+1F499💙\:blue_heart:Blue Heart
    U+1F49A💚\:green_heart:Green Heart
    U+1F49B💛\:yellow_heart:Yellow Heart
    U+1F49C💜\:purple_heart:Purple Heart
    U+1F49D💝\:gift_heart:Heart With Ribbon
    U+1F49E💞\:revolving_hearts:Revolving Hearts
    U+1F49F💟\:heart_decoration:Heart Decoration
    U+1F4A0💠\:diamond_shape_with_a_dot_inside:Diamond Shape With A Dot Inside
    U+1F4A1💡\:bulb:Electric Light Bulb
    U+1F4A2💢\:anger:Anger Symbol
    U+1F4A3💣\:bomb:Bomb
    U+1F4A4💤\:zzz:Sleeping Symbol
    U+1F4A5💥\:boom:Collision Symbol
    U+1F4A6💦\:sweat_drops:Splashing Sweat Symbol
    U+1F4A7💧\:droplet:Droplet
    U+1F4A8💨\:dash:Dash Symbol
    U+1F4A9💩\:hankey:Pile Of Poo
    U+1F4AA💪\:muscle:Flexed Biceps
    U+1F4AB💫\:dizzy:Dizzy Symbol
    U+1F4AC💬\:speech_balloon:Speech Balloon
    U+1F4AD💭\:thought_balloon:Thought Balloon
    U+1F4AE💮\:white_flower:White Flower
    U+1F4AF💯\:100:Hundred Points Symbol
    U+1F4B0💰\:moneybag:Money Bag
    U+1F4B1💱\:currency_exchange:Currency Exchange
    U+1F4B2💲\:heavy_dollar_sign:Heavy Dollar Sign
    U+1F4B3💳\:credit_card:Credit Card
    U+1F4B4💴\:yen:Banknote With Yen Sign
    U+1F4B5💵\:dollar:Banknote With Dollar Sign
    U+1F4B6💶\:euro:Banknote With Euro Sign
    U+1F4B7💷\:pound:Banknote With Pound Sign
    U+1F4B8💸\:money_with_wings:Money With Wings
    U+1F4B9💹\:chart:Chart With Upwards Trend And Yen Sign
    U+1F4BA💺\:seat:Seat
    U+1F4BB💻\:computer:Personal Computer
    U+1F4BC💼\:briefcase:Briefcase
    U+1F4BD💽\:minidisc:Minidisc
    U+1F4BE💾\:floppy_disk:Floppy Disk
    U+1F4BF💿\:cd:Optical Disc
    U+1F4C0📀\:dvd:Dvd
    U+1F4C1📁\:file_folder:File Folder
    U+1F4C2📂\:open_file_folder:Open File Folder
    U+1F4C3📃\:page_with_curl:Page With Curl
    U+1F4C4📄\:page_facing_up:Page Facing Up
    U+1F4C5📅\:date:Calendar
    U+1F4C6📆\:calendar:Tear-Off Calendar
    U+1F4C7📇\:card_index:Card Index
    U+1F4C8📈\:chart_with_upwards_trend:Chart With Upwards Trend
    U+1F4C9📉\:chart_with_downwards_trend:Chart With Downwards Trend
    U+1F4CA📊\:bar_chart:Bar Chart
    U+1F4CB📋\:clipboard:Clipboard
    U+1F4CC📌\:pushpin:Pushpin
    U+1F4CD📍\:round_pushpin:Round Pushpin
    U+1F4CE📎\:paperclip:Paperclip
    U+1F4CF📏\:straight_ruler:Straight Ruler
    U+1F4D0📐\:triangular_ruler:Triangular Ruler
    U+1F4D1📑\:bookmark_tabs:Bookmark Tabs
    U+1F4D2📒\:ledger:Ledger
    U+1F4D3📓\:notebook:Notebook
    U+1F4D4📔\:notebook_with_decorative_cover:Notebook With Decorative Cover
    U+1F4D5📕\:closed_book:Closed Book
    U+1F4D6📖\:book:Open Book
    U+1F4D7📗\:green_book:Green Book
    U+1F4D8📘\:blue_book:Blue Book
    U+1F4D9📙\:orange_book:Orange Book
    U+1F4DA📚\:books:Books
    U+1F4DB📛\:name_badge:Name Badge
    U+1F4DC📜\:scroll:Scroll
    U+1F4DD📝\:memo:Memo
    U+1F4DE📞\:telephone_receiver:Telephone Receiver
    U+1F4DF📟\:pager:Pager
    U+1F4E0📠\:fax:Fax Machine
    U+1F4E1📡\:satellite:, \:satellite_antenna:Satellite Antenna
    U+1F4E2📢\:loudspeaker:Public Address Loudspeaker
    U+1F4E3📣\:mega:Cheering Megaphone
    U+1F4E4📤\:outbox_tray:Outbox Tray
    U+1F4E5📥\:inbox_tray:Inbox Tray
    U+1F4E6📦\:package:Package
    U+1F4E7📧\:e-mail:E-Mail Symbol
    U+1F4E8📨\:incoming_envelope:Incoming Envelope
    U+1F4E9📩\:envelope_with_arrow:Envelope With Downwards Arrow Above
    U+1F4EA📪\:mailbox_closed:Closed Mailbox With Lowered Flag
    U+1F4EB📫\:mailbox:Closed Mailbox With Raised Flag
    U+1F4EC📬\:mailbox_with_mail:Open Mailbox With Raised Flag
    U+1F4ED📭\:mailbox_with_no_mail:Open Mailbox With Lowered Flag
    U+1F4EE📮\:postbox:Postbox
    U+1F4EF📯\:postal_horn:Postal Horn
    U+1F4F0📰\:newspaper:Newspaper
    U+1F4F1📱\:iphone:Mobile Phone
    U+1F4F2📲\:calling:Mobile Phone With Rightwards Arrow At Left
    U+1F4F3📳\:vibration_mode:Vibration Mode
    U+1F4F4📴\:mobile_phone_off:Mobile Phone Off
    U+1F4F5📵\:no_mobile_phones:No Mobile Phones
    U+1F4F6📶\:signal_strength:Antenna With Bars
    U+1F4F7📷\:camera:Camera
    U+1F4F8📸\:camera_with_flash:Camera With Flash
    U+1F4F9📹\:video_camera:Video Camera
    U+1F4FA📺\:tv:Television
    U+1F4FB📻\:radio:Radio
    U+1F4FC📼\:vhs:Videocassette
    U+1F4FF📿\:prayer_beads:Prayer Beads
    U+1F500🔀\:twisted_rightwards_arrows:Twisted Rightwards Arrows
    U+1F501🔁\:repeat:Clockwise Rightwards And Leftwards Open Circle Arrows
    U+1F502🔂\:repeat_one:Clockwise Rightwards And Leftwards Open Circle Arrows With Circled One Overlay
    U+1F503🔃\:arrows_clockwise:Clockwise Downwards And Upwards Open Circle Arrows
    U+1F504🔄\:arrows_counterclockwise:Anticlockwise Downwards And Upwards Open Circle Arrows
    U+1F505🔅\:low_brightness:Low Brightness Symbol
    U+1F506🔆\:high_brightness:High Brightness Symbol
    U+1F507🔇\:mute:Speaker With Cancellation Stroke
    U+1F508🔈\:speaker:Speaker
    U+1F509🔉\:sound:Speaker With One Sound Wave
    U+1F50A🔊\:loud_sound:Speaker With Three Sound Waves
    U+1F50B🔋\:battery:Battery
    U+1F50C🔌\:electric_plug:Electric Plug
    U+1F50D🔍\:mag:Left-Pointing Magnifying Glass
    U+1F50E🔎\:mag_right:Right-Pointing Magnifying Glass
    U+1F50F🔏\:lock_with_ink_pen:Lock With Ink Pen
    U+1F510🔐\:closed_lock_with_key:Closed Lock With Key
    U+1F511🔑\:key:Key
    U+1F512🔒\:lock:Lock
    U+1F513🔓\:unlock:Open Lock
    U+1F514🔔\:bell:Bell
    U+1F515🔕\:no_bell:Bell With Cancellation Stroke
    U+1F516🔖\:bookmark:Bookmark
    U+1F517🔗\:link:Link Symbol
    U+1F518🔘\:radio_button:Radio Button
    U+1F519🔙\:back:Back With Leftwards Arrow Above
    U+1F51A🔚\:end:End With Leftwards Arrow Above
    U+1F51B🔛\:on:On With Exclamation Mark With Left Right Arrow Above
    U+1F51C🔜\:soon:Soon With Rightwards Arrow Above
    U+1F51D🔝\:top:Top With Upwards Arrow Above
    U+1F51E🔞\:underage:No One Under Eighteen Symbol
    U+1F51F🔟\:keycap_ten:Keycap Ten
    U+1F520🔠\:capital_abcd:Input Symbol For Latin Capital Letters
    U+1F521🔡\:abcd:Input Symbol For Latin Small Letters
    U+1F522🔢\:1234:Input Symbol For Numbers
    U+1F523🔣\:symbols:Input Symbol For Symbols
    U+1F524🔤\:abc:Input Symbol For Latin Letters
    U+1F525🔥\:fire:Fire
    U+1F526🔦\:flashlight:Electric Torch
    U+1F527🔧\:wrench:Wrench
    U+1F528🔨\:hammer:Hammer
    U+1F529🔩\:nut_and_bolt:Nut And Bolt
    U+1F52A🔪\:hocho:Hocho
    U+1F52B🔫\:gun:Pistol
    U+1F52C🔬\:microscope:Microscope
    U+1F52D🔭\:telescope:Telescope
    U+1F52E🔮\:crystal_ball:Crystal Ball
    U+1F52F🔯\:six_pointed_star:Six Pointed Star With Middle Dot
    U+1F530🔰\:beginner:Japanese Symbol For Beginner
    U+1F531🔱\:trident:Trident Emblem
    U+1F532🔲\:black_square_button:Black Square Button
    U+1F533🔳\:white_square_button:White Square Button
    U+1F534🔴\:red_circle:Large Red Circle
    U+1F535🔵\:large_blue_circle:Large Blue Circle
    U+1F536🔶\:large_orange_diamond:Large Orange Diamond
    U+1F537🔷\:large_blue_diamond:Large Blue Diamond
    U+1F538🔸\:small_orange_diamond:Small Orange Diamond
    U+1F539🔹\:small_blue_diamond:Small Blue Diamond
    U+1F53A🔺\:small_red_triangle:Up-Pointing Red Triangle
    U+1F53B🔻\:small_red_triangle_down:Down-Pointing Red Triangle
    U+1F53C🔼\:arrow_up_small:Up-Pointing Small Red Triangle
    U+1F53D🔽\:arrow_down_small:Down-Pointing Small Red Triangle
    U+1F54B🕋\:kaaba:Kaaba
    U+1F54C🕌\:mosque:Mosque
    U+1F54D🕍\:synagogue:Synagogue
    U+1F54E🕎\:menorah_with_nine_branches:Menorah With Nine Branches
    U+1F550🕐\:clock1:Clock Face One Oclock
    U+1F551🕑\:clock2:Clock Face Two Oclock
    U+1F552🕒\:clock3:Clock Face Three Oclock
    U+1F553🕓\:clock4:Clock Face Four Oclock
    U+1F554🕔\:clock5:Clock Face Five Oclock
    U+1F555🕕\:clock6:Clock Face Six Oclock
    U+1F556🕖\:clock7:Clock Face Seven Oclock
    U+1F557🕗\:clock8:Clock Face Eight Oclock
    U+1F558🕘\:clock9:Clock Face Nine Oclock
    U+1F559🕙\:clock10:Clock Face Ten Oclock
    U+1F55A🕚\:clock11:Clock Face Eleven Oclock
    U+1F55B🕛\:clock12:Clock Face Twelve Oclock
    U+1F55C🕜\:clock130:Clock Face One-Thirty
    U+1F55D🕝\:clock230:Clock Face Two-Thirty
    U+1F55E🕞\:clock330:Clock Face Three-Thirty
    U+1F55F🕟\:clock430:Clock Face Four-Thirty
    U+1F560🕠\:clock530:Clock Face Five-Thirty
    U+1F561🕡\:clock630:Clock Face Six-Thirty
    U+1F562🕢\:clock730:Clock Face Seven-Thirty
    U+1F563🕣\:clock830:Clock Face Eight-Thirty
    U+1F564🕤\:clock930:Clock Face Nine-Thirty
    U+1F565🕥\:clock1030:Clock Face Ten-Thirty
    U+1F566🕦\:clock1130:Clock Face Eleven-Thirty
    U+1F567🕧\:clock1230:Clock Face Twelve-Thirty
    U+1F57A🕺\:man_dancing:Man Dancing
    U+1F595🖕\:middle_finger:Reversed Hand With Middle Finger Extended
    U+1F596🖖\:spock-hand:Raised Hand With Part Between Middle And Ring Fingers
    U+1F5A4🖤\:black_heart:Black Heart
    U+1F5FB🗻\:mount_fuji:Mount Fuji
    U+1F5FC🗼\:tokyo_tower:Tokyo Tower
    U+1F5FD🗽\:statue_of_liberty:Statue Of Liberty
    U+1F5FE🗾\:japan:Silhouette Of Japan
    U+1F5FF🗿\:moyai:Moyai
    U+1F600😀\:grinning:Grinning Face
    U+1F601😁\:grin:Grinning Face With Smiling Eyes
    U+1F602😂\:joy:Face With Tears Of Joy
    U+1F603😃\:smiley:Smiling Face With Open Mouth
    U+1F604😄\:smile:Smiling Face With Open Mouth And Smiling Eyes
    U+1F605😅\:sweat_smile:Smiling Face With Open Mouth And Cold Sweat
    U+1F606😆\:laughing:Smiling Face With Open Mouth And Tightly-Closed Eyes
    U+1F607😇\:innocent:Smiling Face With Halo
    U+1F608😈\:smiling_imp:Smiling Face With Horns
    U+1F609😉\:wink:Winking Face
    U+1F60A😊\:blush:Smiling Face With Smiling Eyes
    U+1F60B😋\:yum:Face Savouring Delicious Food
    U+1F60C😌\:relieved:Relieved Face
    U+1F60D😍\:heart_eyes:Smiling Face With Heart-Shaped Eyes
    U+1F60E😎\:sunglasses:Smiling Face With Sunglasses
    U+1F60F😏\:smirk:Smirking Face
    U+1F610😐\:neutral_face:Neutral Face
    U+1F611😑\:expressionless:Expressionless Face
    U+1F612😒\:unamused:Unamused Face
    U+1F613😓\:sweat:Face With Cold Sweat
    U+1F614😔\:pensive:Pensive Face
    U+1F615😕\:confused:Confused Face
    U+1F616😖\:confounded:Confounded Face
    U+1F617😗\:kissing:Kissing Face
    U+1F618😘\:kissing_heart:Face Throwing A Kiss
    U+1F619😙\:kissing_smiling_eyes:Kissing Face With Smiling Eyes
    U+1F61A😚\:kissing_closed_eyes:Kissing Face With Closed Eyes
    U+1F61B😛\:stuck_out_tongue:Face With Stuck-Out Tongue
    U+1F61C😜\:stuck_out_tongue_winking_eye:Face With Stuck-Out Tongue And Winking Eye
    U+1F61D😝\:stuck_out_tongue_closed_eyes:Face With Stuck-Out Tongue And Tightly-Closed Eyes
    U+1F61E😞\:disappointed:Disappointed Face
    U+1F61F😟\:worried:Worried Face
    U+1F620😠\:angry:Angry Face
    U+1F621😡\:rage:Pouting Face
    U+1F622😢\:cry:Crying Face
    U+1F623😣\:persevere:Persevering Face
    U+1F624😤\:triumph:Face With Look Of Triumph
    U+1F625😥\:disappointed_relieved:Disappointed But Relieved Face
    U+1F626😦\:frowning:Frowning Face With Open Mouth
    U+1F627😧\:anguished:Anguished Face
    U+1F628😨\:fearful:Fearful Face
    U+1F629😩\:weary:Weary Face
    U+1F62A😪\:sleepy:Sleepy Face
    U+1F62B😫\:tired_face:Tired Face
    U+1F62C😬\:grimacing:Grimacing Face
    U+1F62D😭\:sob:Loudly Crying Face
    U+1F62E😮\:open_mouth:Face With Open Mouth
    U+1F62F😯\:hushed:Hushed Face
    U+1F630😰\:cold_sweat:Face With Open Mouth And Cold Sweat
    U+1F631😱\:scream:Face Screaming In Fear
    U+1F632😲\:astonished:Astonished Face
    U+1F633😳\:flushed:Flushed Face
    U+1F634😴\:sleeping:Sleeping Face
    U+1F635😵\:dizzy_face:Dizzy Face
    U+1F636😶\:no_mouth:Face Without Mouth
    U+1F637😷\:mask:Face With Medical Mask
    U+1F638😸\:smile_cat:Grinning Cat Face With Smiling Eyes
    U+1F639😹\:joy_cat:Cat Face With Tears Of Joy
    U+1F63A😺\:smiley_cat:Smiling Cat Face With Open Mouth
    U+1F63B😻\:heart_eyes_cat:Smiling Cat Face With Heart-Shaped Eyes
    U+1F63C😼\:smirk_cat:Cat Face With Wry Smile
    U+1F63D😽\:kissing_cat:Kissing Cat Face With Closed Eyes
    U+1F63E😾\:pouting_cat:Pouting Cat Face
    U+1F63F😿\:crying_cat_face:Crying Cat Face
    U+1F640🙀\:scream_cat:Weary Cat Face
    U+1F641🙁\:slightly_frowning_face:Slightly Frowning Face
    U+1F642🙂\:slightly_smiling_face:Slightly Smiling Face
    U+1F643🙃\:upside_down_face:Upside-Down Face
    U+1F644🙄\:face_with_rolling_eyes:Face With Rolling Eyes
    U+1F645🙅\:no_good:Face With No Good Gesture
    U+1F646🙆\:ok_woman:Face With Ok Gesture
    U+1F647🙇\:bow:Person Bowing Deeply
    U+1F648🙈\:see_no_evil:See-No-Evil Monkey
    U+1F649🙉\:hear_no_evil:Hear-No-Evil Monkey
    U+1F64A🙊\:speak_no_evil:Speak-No-Evil Monkey
    U+1F64B🙋\:raising_hand:Happy Person Raising One Hand
    U+1F64C🙌\:raised_hands:Person Raising Both Hands In Celebration
    U+1F64D🙍\:person_frowning:Person Frowning
    U+1F64E🙎\:person_with_pouting_face:Person With Pouting Face
    U+1F64F🙏\:pray:Person With Folded Hands
    U+1F680🚀\:rocket:Rocket
    U+1F681🚁\:helicopter:Helicopter
    U+1F682🚂\:steam_locomotive:Steam Locomotive
    U+1F683🚃\:railway_car:Railway Car
    U+1F684🚄\:bullettrain_side:High-Speed Train
    U+1F685🚅\:bullettrain_front:High-Speed Train With Bullet Nose
    U+1F686🚆\:train2:Train
    U+1F687🚇\:metro:Metro
    U+1F688🚈\:light_rail:Light Rail
    U+1F689🚉\:station:Station
    U+1F68A🚊\:tram:Tram
    U+1F68B🚋\:train:Tram Car
    U+1F68C🚌\:bus:Bus
    U+1F68D🚍\:oncoming_bus:Oncoming Bus
    U+1F68E🚎\:trolleybus:Trolleybus
    U+1F68F🚏\:busstop:Bus Stop
    U+1F690🚐\:minibus:Minibus
    U+1F691🚑\:ambulance:Ambulance
    U+1F692🚒\:fire_engine:Fire Engine
    U+1F693🚓\:police_car:Police Car
    U+1F694🚔\:oncoming_police_car:Oncoming Police Car
    U+1F695🚕\:taxi:Taxi
    U+1F696🚖\:oncoming_taxi:Oncoming Taxi
    U+1F697🚗\:car:Automobile
    U+1F698🚘\:oncoming_automobile:Oncoming Automobile
    U+1F699🚙\:blue_car:Recreational Vehicle
    U+1F69A🚚\:truck:Delivery Truck
    U+1F69B🚛\:articulated_lorry:Articulated Lorry
    U+1F69C🚜\:tractor:Tractor
    U+1F69D🚝\:monorail:Monorail
    U+1F69E🚞\:mountain_railway:Mountain Railway
    U+1F69F🚟\:suspension_railway:Suspension Railway
    U+1F6A0🚠\:mountain_cableway:Mountain Cableway
    U+1F6A1🚡\:aerial_tramway:Aerial Tramway
    U+1F6A2🚢\:ship:Ship
    U+1F6A3🚣\:rowboat:Rowboat
    U+1F6A4🚤\:speedboat:Speedboat
    U+1F6A5🚥\:traffic_light:Horizontal Traffic Light
    U+1F6A6🚦\:vertical_traffic_light:Vertical Traffic Light
    U+1F6A7🚧\:construction:Construction Sign
    U+1F6A8🚨\:rotating_light:Police Cars Revolving Light
    U+1F6A9🚩\:triangular_flag_on_post:Triangular Flag On Post
    U+1F6AA🚪\:door:Door
    U+1F6AB🚫\:no_entry_sign:No Entry Sign
    U+1F6AC🚬\:smoking:Smoking Symbol
    U+1F6AD🚭\:no_smoking:No Smoking Symbol
    U+1F6AE🚮\:put_litter_in_its_place:Put Litter In Its Place Symbol
    U+1F6AF🚯\:do_not_litter:Do Not Litter Symbol
    U+1F6B0🚰\:potable_water:Potable Water Symbol
    U+1F6B1🚱\:non-potable_water:Non-Potable Water Symbol
    U+1F6B2🚲\:bike:Bicycle
    U+1F6B3🚳\:no_bicycles:No Bicycles
    U+1F6B4🚴\:bicyclist:Bicyclist
    U+1F6B5🚵\:mountain_bicyclist:Mountain Bicyclist
    U+1F6B6🚶\:walking:Pedestrian
    U+1F6B7🚷\:no_pedestrians:No Pedestrians
    U+1F6B8🚸\:children_crossing:Children Crossing
    U+1F6B9🚹\:mens:Mens Symbol
    U+1F6BA🚺\:womens:Womens Symbol
    U+1F6BB🚻\:restroom:Restroom
    U+1F6BC🚼\:baby_symbol:Baby Symbol
    U+1F6BD🚽\:toilet:Toilet
    U+1F6BE🚾\:wc:Water Closet
    U+1F6BF🚿\:shower:Shower
    U+1F6C0🛀\:bath:Bath
    U+1F6C1🛁\:bathtub:Bathtub
    U+1F6C2🛂\:passport_control:Passport Control
    U+1F6C3🛃\:customs:Customs
    U+1F6C4🛄\:baggage_claim:Baggage Claim
    U+1F6C5🛅\:left_luggage:Left Luggage
    U+1F6CC🛌\:sleeping_accommodation:Sleeping Accommodation
    U+1F6D0🛐\:place_of_worship:Place Of Worship
    U+1F6D1🛑\:octagonal_sign:Octagonal Sign
    U+1F6D2🛒\:shopping_trolley:Shopping Trolley
    U+1F6D5🛕\:hindu_temple:Hindu Temple
    U+1F6D6🛖\:hut:Hut
    U+1F6D7🛗\:elevator:Elevator
    U+1F6DC🛜\:wireless:(No Unicode name)
    U+1F6DD🛝\:playground_slide:(No Unicode name)
    U+1F6DE🛞\:wheel:(No Unicode name)
    U+1F6DF🛟\:ring_buoy:(No Unicode name)
    U+1F6EB🛫\:airplane_departure:Airplane Departure
    U+1F6EC🛬\:airplane_arriving:Airplane Arriving
    U+1F6F4🛴\:scooter:Scooter
    U+1F6F5🛵\:motor_scooter:Motor Scooter
    U+1F6F6🛶\:canoe:Canoe
    U+1F6F7🛷\:sled:Sled
    U+1F6F8🛸\:flying_saucer:Flying Saucer
    U+1F6F9🛹\:skateboard:Skateboard
    U+1F6FA🛺\:auto_rickshaw:Auto Rickshaw
    U+1F6FB🛻\:pickup_truck:Pickup Truck
    U+1F6FC🛼\:roller_skate:Roller Skate
    U+1F7E0🟠\:large_orange_circle:Large Orange Circle
    U+1F7E1🟡\:large_yellow_circle:Large Yellow Circle
    U+1F7E2🟢\:large_green_circle:Large Green Circle
    U+1F7E3🟣\:large_purple_circle:Large Purple Circle
    U+1F7E4🟤\:large_brown_circle:Large Brown Circle
    U+1F7E5🟥\:large_red_square:Large Red Square
    U+1F7E6🟦\:large_blue_square:Large Blue Square
    U+1F7E7🟧\:large_orange_square:Large Orange Square
    U+1F7E8🟨\:large_yellow_square:Large Yellow Square
    U+1F7E9🟩\:large_green_square:Large Green Square
    U+1F7EA🟪\:large_purple_square:Large Purple Square
    U+1F7EB🟫\:large_brown_square:Large Brown Square
    U+1F7F0🟰\:heavy_equals_sign:(No Unicode name)
    U+1F90C🤌\:pinched_fingers:Pinched Fingers
    U+1F90D🤍\:white_heart:White Heart
    U+1F90E🤎\:brown_heart:Brown Heart
    U+1F90F🤏\:pinching_hand:Pinching Hand
    U+1F910🤐\:zipper_mouth_face:Zipper-Mouth Face
    U+1F911🤑\:money_mouth_face:Money-Mouth Face
    U+1F912🤒\:face_with_thermometer:Face With Thermometer
    U+1F913🤓\:nerd_face:Nerd Face
    U+1F914🤔\:thinking_face:Thinking Face
    U+1F915🤕\:face_with_head_bandage:Face With Head-Bandage
    U+1F916🤖\:robot_face:Robot Face
    U+1F917🤗\:hugging_face:Hugging Face
    U+1F918🤘\:the_horns:Sign Of The Horns
    U+1F919🤙\:call_me_hand:Call Me Hand
    U+1F91A🤚\:raised_back_of_hand:Raised Back Of Hand
    U+1F91B🤛\:left-facing_fist:Left-Facing Fist
    U+1F91C🤜\:right-facing_fist:Right-Facing Fist
    U+1F91D🤝\:handshake:Handshake
    U+1F91E🤞\:crossed_fingers:Hand With Index And Middle Fingers Crossed
    U+1F91F🤟\:i_love_you_hand_sign:I Love You Hand Sign
    U+1F920🤠\:face_with_cowboy_hat:Face With Cowboy Hat
    U+1F921🤡\:clown_face:Clown Face
    U+1F922🤢\:nauseated_face:Nauseated Face
    U+1F923🤣\:rolling_on_the_floor_laughing:Rolling On The Floor Laughing
    U+1F924🤤\:drooling_face:Drooling Face
    U+1F925🤥\:lying_face:Lying Face
    U+1F926🤦\:face_palm:Face Palm
    U+1F927🤧\:sneezing_face:Sneezing Face
    U+1F928🤨\:face_with_raised_eyebrow:Face With One Eyebrow Raised
    U+1F929🤩\:star-struck:Grinning Face With Star Eyes
    U+1F92A🤪\:zany_face:Grinning Face With One Large And One Small Eye
    U+1F92B🤫\:shushing_face:Face With Finger Covering Closed Lips
    U+1F92C🤬\:face_with_symbols_on_mouth:Serious Face With Symbols Covering Mouth
    U+1F92D🤭\:face_with_hand_over_mouth:Smiling Face With Smiling Eyes And Hand Covering Mouth
    U+1F92E🤮\:face_vomiting:Face With Open Mouth Vomiting
    U+1F92F🤯\:exploding_head:Shocked Face With Exploding Head
    U+1F930🤰\:pregnant_woman:Pregnant Woman
    U+1F931🤱\:breast-feeding:Breast-Feeding
    U+1F932🤲\:palms_up_together:Palms Up Together
    U+1F933🤳\:selfie:Selfie
    U+1F934🤴\:prince:Prince
    U+1F935🤵\:person_in_tuxedo:Man In Tuxedo
    U+1F936🤶\:mrs_claus:Mother Christmas
    U+1F937🤷\:shrug:Shrug
    U+1F938🤸\:person_doing_cartwheel:Person Doing Cartwheel
    U+1F939🤹\:juggling:Juggling
    U+1F93A🤺\:fencer:Fencer
    U+1F93C🤼\:wrestlers:Wrestlers
    U+1F93D🤽\:water_polo:Water Polo
    U+1F93E🤾\:handball:Handball
    U+1F93F🤿\:diving_mask:Diving Mask
    U+1F940🥀\:wilted_flower:Wilted Flower
    U+1F941🥁\:drum_with_drumsticks:Drum With Drumsticks
    U+1F942🥂\:clinking_glasses:Clinking Glasses
    U+1F943🥃\:tumbler_glass:Tumbler Glass
    U+1F944🥄\:spoon:Spoon
    U+1F945🥅\:goal_net:Goal Net
    U+1F947🥇\:first_place_medal:First Place Medal
    U+1F948🥈\:second_place_medal:Second Place Medal
    U+1F949🥉\:third_place_medal:Third Place Medal
    U+1F94A🥊\:boxing_glove:Boxing Glove
    U+1F94B🥋\:martial_arts_uniform:Martial Arts Uniform
    U+1F94C🥌\:curling_stone:Curling Stone
    U+1F94D🥍\:lacrosse:Lacrosse Stick And Ball
    U+1F94E🥎\:softball:Softball
    U+1F94F🥏\:flying_disc:Flying Disc
    U+1F950🥐\:croissant:Croissant
    U+1F951🥑\:avocado:Avocado
    U+1F952🥒\:cucumber:Cucumber
    U+1F953🥓\:bacon:Bacon
    U+1F954🥔\:potato:Potato
    U+1F955🥕\:carrot:Carrot
    U+1F956🥖\:baguette_bread:Baguette Bread
    U+1F957🥗\:green_salad:Green Salad
    U+1F958🥘\:shallow_pan_of_food:Shallow Pan Of Food
    U+1F959🥙\:stuffed_flatbread:Stuffed Flatbread
    U+1F95A🥚\:egg:Egg
    U+1F95B🥛\:glass_of_milk:Glass Of Milk
    U+1F95C🥜\:peanuts:Peanuts
    U+1F95D🥝\:kiwifruit:Kiwifruit
    U+1F95E🥞\:pancakes:Pancakes
    U+1F95F🥟\:dumpling:Dumpling
    U+1F960🥠\:fortune_cookie:Fortune Cookie
    U+1F961🥡\:takeout_box:Takeout Box
    U+1F962🥢\:chopsticks:Chopsticks
    U+1F963🥣\:bowl_with_spoon:Bowl With Spoon
    U+1F964🥤\:cup_with_straw:Cup With Straw
    U+1F965🥥\:coconut:Coconut
    U+1F966🥦\:broccoli:Broccoli
    U+1F967🥧\:pie:Pie
    U+1F968🥨\:pretzel:Pretzel
    U+1F969🥩\:cut_of_meat:Cut Of Meat
    U+1F96A🥪\:sandwich:Sandwich
    U+1F96B🥫\:canned_food:Canned Food
    U+1F96C🥬\:leafy_green:Leafy Green
    U+1F96D🥭\:mango:Mango
    U+1F96E🥮\:moon_cake:Moon Cake
    U+1F96F🥯\:bagel:Bagel
    U+1F970🥰\:smiling_face_with_3_hearts:Smiling Face With Smiling Eyes And Three Hearts
    U+1F971🥱\:yawning_face:Yawning Face
    U+1F972🥲\:smiling_face_with_tear:Smiling Face With Tear
    U+1F973🥳\:partying_face:Face With Party Horn And Party Hat
    U+1F974🥴\:woozy_face:Face With Uneven Eyes And Wavy Mouth
    U+1F975🥵\:hot_face:Overheated Face
    U+1F976🥶\:cold_face:Freezing Face
    U+1F977🥷\:ninja:Ninja
    U+1F978🥸\:disguised_face:Disguised Face
    U+1F979🥹\:face_holding_back_tears:(No Unicode name)
    U+1F97A🥺\:pleading_face:Face With Pleading Eyes
    U+1F97B🥻\:sari:Sari
    U+1F97C🥼\:lab_coat:Lab Coat
    U+1F97D🥽\:goggles:Goggles
    U+1F97E🥾\:hiking_boot:Hiking Boot
    U+1F97F🥿\:womans_flat_shoe:Flat Shoe
    U+1F980🦀\:crab:Crab
    U+1F981🦁\:lion_face:Lion Face
    U+1F982🦂\:scorpion:Scorpion
    U+1F983🦃\:turkey:Turkey
    U+1F984🦄\:unicorn_face:Unicorn Face
    U+1F985🦅\:eagle:Eagle
    U+1F986🦆\:duck:Duck
    U+1F987🦇\:bat:Bat
    U+1F988🦈\:shark:Shark
    U+1F989🦉\:owl:Owl
    U+1F98A🦊\:fox_face:Fox Face
    U+1F98B🦋\:butterfly:Butterfly
    U+1F98C🦌\:deer:Deer
    U+1F98D🦍\:gorilla:Gorilla
    U+1F98E🦎\:lizard:Lizard
    U+1F98F🦏\:rhinoceros:Rhinoceros
    U+1F990🦐\:shrimp:Shrimp
    U+1F991🦑\:squid:Squid
    U+1F992🦒\:giraffe_face:Giraffe Face
    U+1F993🦓\:zebra_face:Zebra Face
    U+1F994🦔\:hedgehog:Hedgehog
    U+1F995🦕\:sauropod:Sauropod
    U+1F996🦖\:t-rex:T-Rex
    U+1F997🦗\:cricket:Cricket
    U+1F998🦘\:kangaroo:Kangaroo
    U+1F999🦙\:llama:Llama
    U+1F99A🦚\:peacock:Peacock
    U+1F99B🦛\:hippopotamus:Hippopotamus
    U+1F99C🦜\:parrot:Parrot
    U+1F99D🦝\:raccoon:Raccoon
    U+1F99E🦞\:lobster:Lobster
    U+1F99F🦟\:mosquito:Mosquito
    U+1F9A0🦠\:microbe:Microbe
    U+1F9A1🦡\:badger:Badger
    U+1F9A2🦢\:swan:Swan
    U+1F9A3🦣\:mammoth:Mammoth
    U+1F9A4🦤\:dodo:Dodo
    U+1F9A5🦥\:sloth:Sloth
    U+1F9A6🦦\:otter:Otter
    U+1F9A7🦧\:orangutan:Orangutan
    U+1F9A8🦨\:skunk:Skunk
    U+1F9A9🦩\:flamingo:Flamingo
    U+1F9AA🦪\:oyster:Oyster
    U+1F9AB🦫\:beaver:Beaver
    U+1F9AC🦬\:bison:Bison
    U+1F9AD🦭\:seal:Seal
    U+1F9AE🦮\:guide_dog:Guide Dog
    U+1F9AF🦯\:probing_cane:Probing Cane
    U+1F9B4🦴\:bone:Bone
    U+1F9B5🦵\:leg:Leg
    U+1F9B6🦶\:foot:Foot
    U+1F9B7🦷\:tooth:Tooth
    U+1F9B8🦸\:superhero:Superhero
    U+1F9B9🦹\:supervillain:Supervillain
    U+1F9BA🦺\:safety_vest:Safety Vest
    U+1F9BB🦻\:ear_with_hearing_aid:Ear With Hearing Aid
    U+1F9BC🦼\:motorized_wheelchair:Motorized Wheelchair
    U+1F9BD🦽\:manual_wheelchair:Manual Wheelchair
    U+1F9BE🦾\:mechanical_arm:Mechanical Arm
    U+1F9BF🦿\:mechanical_leg:Mechanical Leg
    U+1F9C0🧀\:cheese_wedge:Cheese Wedge
    U+1F9C1🧁\:cupcake:Cupcake
    U+1F9C2🧂\:salt:Salt Shaker
    U+1F9C3🧃\:beverage_box:Beverage Box
    U+1F9C4🧄\:garlic:Garlic
    U+1F9C5🧅\:onion:Onion
    U+1F9C6🧆\:falafel:Falafel
    U+1F9C7🧇\:waffle:Waffle
    U+1F9C8🧈\:butter:Butter
    U+1F9C9🧉\:mate_drink:Mate Drink
    U+1F9CA🧊\:ice_cube:Ice Cube
    U+1F9CB🧋\:bubble_tea:Bubble Tea
    U+1F9CC🧌\:troll:(No Unicode name)
    U+1F9CD🧍\:standing_person:Standing Person
    U+1F9CE🧎\:kneeling_person:Kneeling Person
    U+1F9CF🧏\:deaf_person:Deaf Person
    U+1F9D0🧐\:face_with_monocle:Face With Monocle
    U+1F9D1🧑\:adult:Adult
    U+1F9D2🧒\:child:Child
    U+1F9D3🧓\:older_adult:Older Adult
    U+1F9D4🧔\:bearded_person:Bearded Person
    U+1F9D5🧕\:person_with_headscarf:Person With Headscarf
    U+1F9D6🧖\:person_in_steamy_room:Person In Steamy Room
    U+1F9D7🧗\:person_climbing:Person Climbing
    U+1F9D8🧘\:person_in_lotus_position:Person In Lotus Position
    U+1F9D9🧙\:mage:Mage
    U+1F9DA🧚\:fairy:Fairy
    U+1F9DB🧛\:vampire:Vampire
    U+1F9DC🧜\:merperson:Merperson
    U+1F9DD🧝\:elf:Elf
    U+1F9DE🧞\:genie:Genie
    U+1F9DF🧟\:zombie:Zombie
    U+1F9E0🧠\:brain:Brain
    U+1F9E1🧡\:orange_heart:Orange Heart
    U+1F9E2🧢\:billed_cap:Billed Cap
    U+1F9E3🧣\:scarf:Scarf
    U+1F9E4🧤\:gloves:Gloves
    U+1F9E5🧥\:coat:Coat
    U+1F9E6🧦\:socks:Socks
    U+1F9E7🧧\:red_envelope:Red Gift Envelope
    U+1F9E8🧨\:firecracker:Firecracker
    U+1F9E9🧩\:jigsaw:Jigsaw Puzzle Piece
    U+1F9EA🧪\:test_tube:Test Tube
    U+1F9EB🧫\:petri_dish:Petri Dish
    U+1F9EC🧬\:dna:Dna Double Helix
    U+1F9ED🧭\:compass:Compass
    U+1F9EE🧮\:abacus:Abacus
    U+1F9EF🧯\:fire_extinguisher:Fire Extinguisher
    U+1F9F0🧰\:toolbox:Toolbox
    U+1F9F1🧱\:bricks:Brick
    U+1F9F2🧲\:magnet:Magnet
    U+1F9F3🧳\:luggage:Luggage
    U+1F9F4🧴\:lotion_bottle:Lotion Bottle
    U+1F9F5🧵\:thread:Spool Of Thread
    U+1F9F6🧶\:yarn:Ball Of Yarn
    U+1F9F7🧷\:safety_pin:Safety Pin
    U+1F9F8🧸\:teddy_bear:Teddy Bear
    U+1F9F9🧹\:broom:Broom
    U+1F9FA🧺\:basket:Basket
    U+1F9FB🧻\:roll_of_paper:Roll Of Paper
    U+1F9FC🧼\:soap:Bar Of Soap
    U+1F9FD🧽\:sponge:Sponge
    U+1F9FE🧾\:receipt:Receipt
    U+1F9FF🧿\:nazar_amulet:Nazar Amulet
    U+1FA70🩰\:ballet_shoes:Ballet Shoes
    U+1FA71🩱\:one-piece_swimsuit:One-Piece Swimsuit
    U+1FA72🩲\:briefs:Briefs
    U+1FA73🩳\:shorts:Shorts
    U+1FA74🩴\:thong_sandal:Thong Sandal
    U+1FA75🩵\:light_blue_heart:(No Unicode name)
    U+1FA76🩶\:grey_heart:(No Unicode name)
    U+1FA77🩷\:pink_heart:(No Unicode name)
    U+1FA78🩸\:drop_of_blood:Drop Of Blood
    U+1FA79🩹\:adhesive_bandage:Adhesive Bandage
    U+1FA7A🩺\:stethoscope:Stethoscope
    U+1FA7B🩻\:x-ray:(No Unicode name)
    U+1FA7C🩼\:crutch:(No Unicode name)
    U+1FA80🪀\:yo-yo:Yo-Yo
    U+1FA81🪁\:kite:Kite
    U+1FA82🪂\:parachute:Parachute
    U+1FA83🪃\:boomerang:Boomerang
    U+1FA84🪄\:magic_wand:Magic Wand
    U+1FA85🪅\:pinata:Pinata
    U+1FA86🪆\:nesting_dolls:Nesting Dolls
    U+1FA87🪇\:maracas:(No Unicode name)
    U+1FA88🪈\:flute:(No Unicode name)
    U+1FA90🪐\:ringed_planet:Ringed Planet
    U+1FA91🪑\:chair:Chair
    U+1FA92🪒\:razor:Razor
    U+1FA93🪓\:axe:Axe
    U+1FA94🪔\:diya_lamp:Diya Lamp
    U+1FA95🪕\:banjo:Banjo
    U+1FA96🪖\:military_helmet:Military Helmet
    U+1FA97🪗\:accordion:Accordion
    U+1FA98🪘\:long_drum:Long Drum
    U+1FA99🪙\:coin:Coin
    U+1FA9A🪚\:carpentry_saw:Carpentry Saw
    U+1FA9B🪛\:screwdriver:Screwdriver
    U+1FA9C🪜\:ladder:Ladder
    U+1FA9D🪝\:hook:Hook
    U+1FA9E🪞\:mirror:Mirror
    U+1FA9F🪟\:window:Window
    U+1FAA0🪠\:plunger:Plunger
    U+1FAA1🪡\:sewing_needle:Sewing Needle
    U+1FAA2🪢\:knot:Knot
    U+1FAA3🪣\:bucket:Bucket
    U+1FAA4🪤\:mouse_trap:Mouse Trap
    U+1FAA5🪥\:toothbrush:Toothbrush
    U+1FAA6🪦\:headstone:Headstone
    U+1FAA7🪧\:placard:Placard
    U+1FAA8🪨\:rock:Rock
    U+1FAA9🪩\:mirror_ball:(No Unicode name)
    U+1FAAA🪪\:identification_card:(No Unicode name)
    U+1FAAB🪫\:low_battery:(No Unicode name)
    U+1FAAC🪬\:hamsa:(No Unicode name)
    U+1FAAD🪭\:folding_hand_fan:(No Unicode name)
    U+1FAAE🪮\:hair_pick:(No Unicode name)
    U+1FAAF🪯\:khanda:(No Unicode name)
    U+1FAB0🪰\:fly:Fly
    U+1FAB1🪱\:worm:Worm
    U+1FAB2🪲\:beetle:Beetle
    U+1FAB3🪳\:cockroach:Cockroach
    U+1FAB4🪴\:potted_plant:Potted Plant
    U+1FAB5🪵\:wood:Wood
    U+1FAB6🪶\:feather:Feather
    U+1FAB7🪷\:lotus:(No Unicode name)
    U+1FAB8🪸\:coral:(No Unicode name)
    U+1FAB9🪹\:empty_nest:(No Unicode name)
    U+1FABA🪺\:nest_with_eggs:(No Unicode name)
    U+1FABB🪻\:hyacinth:(No Unicode name)
    U+1FABC🪼\:jellyfish:(No Unicode name)
    U+1FABD🪽\:wing:(No Unicode name)
    U+1FABF🪿\:goose:(No Unicode name)
    U+1FAC0🫀\:anatomical_heart:Anatomical Heart
    U+1FAC1🫁\:lungs:Lungs
    U+1FAC2🫂\:people_hugging:People Hugging
    U+1FAC3🫃\:pregnant_man:(No Unicode name)
    U+1FAC4🫄\:pregnant_person:(No Unicode name)
    U+1FAC5🫅\:person_with_crown:(No Unicode name)
    U+1FACE🫎\:moose:(No Unicode name)
    U+1FACF🫏\:donkey:(No Unicode name)
    U+1FAD0🫐\:blueberries:Blueberries
    U+1FAD1🫑\:bell_pepper:Bell Pepper
    U+1FAD2🫒\:olive:Olive
    U+1FAD3🫓\:flatbread:Flatbread
    U+1FAD4🫔\:tamale:Tamale
    U+1FAD5🫕\:fondue:Fondue
    U+1FAD6🫖\:teapot:Teapot
    U+1FAD7🫗\:pouring_liquid:(No Unicode name)
    U+1FAD8🫘\:beans:(No Unicode name)
    U+1FAD9🫙\:jar:(No Unicode name)
    U+1FADA🫚\:ginger_root:(No Unicode name)
    U+1FADB🫛\:pea_pod:(No Unicode name)
    U+1FAE0🫠\:melting_face:(No Unicode name)
    U+1FAE1🫡\:saluting_face:(No Unicode name)
    U+1FAE2🫢\:face_with_open_eyes_and_hand_over_mouth:(No Unicode name)
    U+1FAE3🫣\:face_with_peeking_eye:(No Unicode name)
    U+1FAE4🫤\:face_with_diagonal_mouth:(No Unicode name)
    U+1FAE5🫥\:dotted_line_face:(No Unicode name)
    U+1FAE6🫦\:biting_lip:(No Unicode name)
    U+1FAE7🫧\:bubbles:(No Unicode name)
    U+1FAE8🫨\:shaking_face:(No Unicode name)
    U+1FAF0🫰\:hand_with_index_finger_and_thumb_crossed:(No Unicode name)
    U+1FAF1🫱\:rightwards_hand:(No Unicode name)
    U+1FAF2🫲\:leftwards_hand:(No Unicode name)
    U+1FAF3🫳\:palm_down_hand:(No Unicode name)
    U+1FAF4🫴\:palm_up_hand:(No Unicode name)
    U+1FAF5🫵\:index_pointing_at_the_viewer:(No Unicode name)
    U+1FAF6🫶\:heart_hands:(No Unicode name)
    U+1FAF7🫷\:leftwards_pushing_hand:(No Unicode name)
    U+1FAF8🫸\:rightwards_pushing_hand:(No Unicode name)
    diff --git a/en/v1.12-dev/manual/variables-and-scoping/index.html b/en/v1.12-dev/manual/variables-and-scoping/index.html index 4638293d1eb..f8aa8a8eecb 100644 --- a/en/v1.12-dev/manual/variables-and-scoping/index.html +++ b/en/v1.12-dev/manual/variables-and-scoping/index.html @@ -295,4 +295,4 @@ julia> global x::Int ERROR: cannot set type for global x. It already has a value or is already set to a different type. Stacktrace: -[...] +[...] diff --git a/en/v1.12-dev/manual/variables/index.html b/en/v1.12-dev/manual/variables/index.html index 3c926e749f8..6fb0044c8b9 100644 --- a/en/v1.12-dev/manual/variables/index.html +++ b/en/v1.12-dev/manual/variables/index.html @@ -95,4 +95,4 @@ 3-element Vector{Int64}: 42 2 - 3

    That is, a[i] = value (an alias for setindex!) mutates an existing array object in memory, accessible via either a or b. Subsequently setting a = 3.14159 does not change this array, it simply binds a to a different object; the array is still accessible via b. Another common syntax to mutate an existing object is a.field = value (an alias for setproperty!), which can be used to change a mutable struct. There is also mutation via dot assignment, for example b .= 5:7 (which mutates our array b in-place to contain [5,6,7]), as part of Julia's vectorized "dot" syntax.

    When you call a function in Julia, it behaves as if you assigned the argument values to new variable names corresponding to the function arguments, as discussed in Argument-Passing Behavior. (By convention, functions that mutate one or more of their arguments have names ending with !.)

    Stylistic Conventions

    While Julia imposes few restrictions on valid names, it has become useful to adopt the following conventions:

    For more information about stylistic conventions, see the Style Guide.

    + 3

    That is, a[i] = value (an alias for setindex!) mutates an existing array object in memory, accessible via either a or b. Subsequently setting a = 3.14159 does not change this array, it simply binds a to a different object; the array is still accessible via b. Another common syntax to mutate an existing object is a.field = value (an alias for setproperty!), which can be used to change a mutable struct. There is also mutation via dot assignment, for example b .= 5:7 (which mutates our array b in-place to contain [5,6,7]), as part of Julia's vectorized "dot" syntax.

    When you call a function in Julia, it behaves as if you assigned the argument values to new variable names corresponding to the function arguments, as discussed in Argument-Passing Behavior. (By convention, functions that mutate one or more of their arguments have names ending with !.)

    Stylistic Conventions

    While Julia imposes few restrictions on valid names, it has become useful to adopt the following conventions:

    For more information about stylistic conventions, see the Style Guide.

    diff --git a/en/v1.12-dev/manual/workflow-tips/index.html b/en/v1.12-dev/manual/workflow-tips/index.html index fdd562df75d..e0f7f5dc515 100644 --- a/en/v1.12-dev/manual/workflow-tips/index.html +++ b/en/v1.12-dev/manual/workflow-tips/index.html @@ -19,4 +19,4 @@ t("MyPkg")

    This will create a blank package, "MyPkg", in your .julia/dev directory. Note that PkgTemplates allows you to control many different options through its Template constructor.

    In step 2 below, edit MyPkg/src/MyPkg.jl to change the source code, and MyPkg/test/runtests.jl for the tests.

  • For "throw-away" projects, you can avoid any need for cleanup by doing your work in your temporary directory (e.g., /tmp).

    Navigate to your temporary directory and launch Julia, then do the following:

    pkg> generate MyPkg            # type ] to enter pkg mode
     julia> push!(LOAD_PATH, pwd())   # hit backspace to exit pkg mode

    If you restart your Julia session you'll have to re-issue that command modifying LOAD_PATH.

    In step 2 below, edit MyPkg/src/MyPkg.jl to change the source code, and create any test file of your choosing.

  • Develop your package

    Before loading any code, make sure you're running Revise: say using Revise or follow its documentation on configuring it to run automatically.

    Then navigate to the directory containing your test file (here assumed to be "runtests.jl") and do the following:

    julia> using MyPkg
     
    -julia> include("runtests.jl")

    You can iteratively modify the code in MyPkg in your editor and re-run the tests with include("runtests.jl"). You generally should not need to restart your Julia session to see the changes take effect (subject to a few limitations).

  • +julia> include("runtests.jl")

    You can iteratively modify the code in MyPkg in your editor and re-run the tests with include("runtests.jl"). You generally should not need to restart your Julia session to see the changes take effect (subject to a few limitations).

    diff --git a/en/v1.12-dev/stdlib/ArgTools/index.html b/en/v1.12-dev/stdlib/ArgTools/index.html index 03c696f1ff9..eead3d5e979 100644 --- a/en/v1.12-dev/stdlib/ArgTools/index.html +++ b/en/v1.12-dev/stdlib/ArgTools/index.html @@ -26,4 +26,4 @@ ## test using `arg` ## end ## post-test cleanup ## -end

    This method is useful if you need to specify path instead of using path name generated by tempname(). Since path is passed from outside of arg_writers, the path is not an argument to the do block in this form.

    ArgTools.@arg_testMacro
    @arg_test arg1 arg2 ... body

    The @arg_test macro is used to convert arg functions provided by arg_readers and arg_writers into actual argument values. When you write @arg_test arg body it is equivalent to arg(arg -> body).

    +end

    This method is useful if you need to specify path instead of using path name generated by tempname(). Since path is passed from outside of arg_writers, the path is not an argument to the do block in this form.

    ArgTools.@arg_testMacro
    @arg_test arg1 arg2 ... body

    The @arg_test macro is used to convert arg functions provided by arg_readers and arg_writers into actual argument values. When you write @arg_test arg body it is equivalent to arg(arg -> body).

    diff --git a/en/v1.12-dev/stdlib/Artifacts/index.html b/en/v1.12-dev/stdlib/Artifacts/index.html index 38f73f6e395..f034cb692af 100644 --- a/en/v1.12-dev/stdlib/Artifacts/index.html +++ b/en/v1.12-dev/stdlib/Artifacts/index.html @@ -9,4 +9,4 @@ platform::AbstractPlatform = HostPlatform())

    Thin wrapper around artifact_meta() to return the hash of the specified, platform- collapsed artifact. Returns nothing if no mapping can be found.

    Julia 1.3

    This function requires at least Julia 1.3.

    Artifacts.find_artifacts_tomlFunction
    find_artifacts_toml(path::String)

    Given the path to a .jl file, (such as the one returned by __source__.file in a macro context), find the (Julia)Artifacts.toml that is contained within the containing project (if it exists), otherwise return nothing.

    Julia 1.3

    This function requires at least Julia 1.3.

    Artifacts.@artifact_strMacro
    macro artifact_str(name)

    Return the on-disk path to an artifact. Automatically looks the artifact up by name in the project's (Julia)Artifacts.toml file. Throws an error on if the requested artifact is not present. If run in the REPL, searches for the toml file starting in the current directory, see find_artifacts_toml() for more.

    If the artifact is marked "lazy" and the package has using LazyArtifacts defined, the artifact will be downloaded on-demand with Pkg the first time this macro tries to compute the path. The files will then be left installed locally for later.

    If name contains a forward or backward slash, all elements after the first slash will be taken to be path names indexing into the artifact, allowing for an easy one-liner to access a single file/directory within an artifact. Example:

    ffmpeg_path = @artifact"FFMPEG/bin/ffmpeg"
    Julia 1.3

    This macro requires at least Julia 1.3.

    Julia 1.6

    Slash-indexing requires at least Julia 1.6.

    Artifacts.artifact_existsFunction
    artifact_exists(hash::SHA1; honor_overrides::Bool=true)

    Return whether or not the given artifact (identified by its sha1 git tree hash) exists on-disk. Note that it is possible that the given artifact exists in multiple locations (e.g. within multiple depots).

    Julia 1.3

    This function requires at least Julia 1.3.

    Artifacts.artifact_pathFunction
    artifact_path(hash::SHA1; honor_overrides::Bool=true)

    Given an artifact (identified by SHA1 git tree hash), return its installation path. If the artifact does not exist, returns the location it would be installed to.

    Julia 1.3

    This function requires at least Julia 1.3.

    Artifacts.select_downloadable_artifactsFunction
    select_downloadable_artifacts(artifacts_toml::String;
                                   platform = HostPlatform,
                                   include_lazy = false,
    -                              pkg_uuid = nothing)

    Return a dictionary where every entry is an artifact from the given Artifacts.toml that should be downloaded for the requested platform. Lazy artifacts are included if include_lazy is set.

    + pkg_uuid = nothing)

    Return a dictionary where every entry is an artifact from the given Artifacts.toml that should be downloaded for the requested platform. Lazy artifacts are included if include_lazy is set.

    diff --git a/en/v1.12-dev/stdlib/Base64/index.html b/en/v1.12-dev/stdlib/Base64/index.html index 3cdc3b124ec..9e6820836ff 100644 --- a/en/v1.12-dev/stdlib/Base64/index.html +++ b/en/v1.12-dev/stdlib/Base64/index.html @@ -37,4 +37,4 @@ 0x21 julia> String(b) -"Hello!"
    Base64.stringmimeFunction
    stringmime(mime, x; context=nothing)

    Return an AbstractString containing the representation of x in the requested mime type. This is similar to repr(mime, x) except that binary data is base64-encoded as an ASCII string.

    The optional keyword argument context can be set to :key=>value pair or an IO or IOContext object whose attributes are used for the I/O stream passed to show.

    +"Hello!"
    Base64.stringmimeFunction
    stringmime(mime, x; context=nothing)

    Return an AbstractString containing the representation of x in the requested mime type. This is similar to repr(mime, x) except that binary data is base64-encoded as an ASCII string.

    The optional keyword argument context can be set to :key=>value pair or an IO or IOContext object whose attributes are used for the I/O stream passed to show.

    diff --git a/en/v1.12-dev/stdlib/CRC32c/index.html b/en/v1.12-dev/stdlib/CRC32c/index.html index 03a3e01cf57..7fdba1135b2 100644 --- a/en/v1.12-dev/stdlib/CRC32c/index.html +++ b/en/v1.12-dev/stdlib/CRC32c/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    CRC32c

    Standard library module for computing the CRC-32c checksum.

    CRC32c.crc32cFunction
    crc32c(data, crc::UInt32=0x00000000)

    Compute the CRC-32c checksum of the given data, which can be an Array{UInt8}, a contiguous subarray thereof, an AbstractVector{UInt8}, or a String. Optionally, you can pass a starting crc integer to be mixed in with the checksum. The crc parameter can be used to compute a checksum on data divided into chunks: performing crc32c(data2, crc32c(data1)) is equivalent to the checksum of [data1; data2]. (Technically, a little-endian checksum is computed.)

    There is also a method crc32c(io, nb, crc) to checksum nb bytes from a stream io, or crc32c(io, crc) to checksum all the remaining bytes. Hence you can do open(crc32c, filename) to checksum an entire file, or crc32c(seekstart(buf)) to checksum an IOBuffer without calling take!.

    For a String, note that the result is specific to the UTF-8 encoding (a different checksum would be obtained from a different Unicode encoding). To checksum an a::AbstractArray of some other bitstype without padding, you can do crc32c(vec(reinterpret(UInt8,a))), but note that the result may be endian-dependent.

    CRC32c.crc32cMethod
    crc32c(io::IO, [nb::Integer,] crc::UInt32=0x00000000)

    Read up to nb bytes from io and return the CRC-32c checksum, optionally mixed with a starting crc integer. If nb is not supplied, then io will be read until the end of the stream.

    +

    CRC32c

    Standard library module for computing the CRC-32c checksum.

    CRC32c.crc32cFunction
    crc32c(data, crc::UInt32=0x00000000)

    Compute the CRC-32c checksum of the given data, which can be an Array{UInt8}, a contiguous subarray thereof, an AbstractVector{UInt8}, or a String. Optionally, you can pass a starting crc integer to be mixed in with the checksum. The crc parameter can be used to compute a checksum on data divided into chunks: performing crc32c(data2, crc32c(data1)) is equivalent to the checksum of [data1; data2]. (Technically, a little-endian checksum is computed.)

    There is also a method crc32c(io, nb, crc) to checksum nb bytes from a stream io, or crc32c(io, crc) to checksum all the remaining bytes. Hence you can do open(crc32c, filename) to checksum an entire file, or crc32c(seekstart(buf)) to checksum an IOBuffer without calling take!.

    For a String, note that the result is specific to the UTF-8 encoding (a different checksum would be obtained from a different Unicode encoding). To checksum an a::AbstractArray of some other bitstype without padding, you can do crc32c(vec(reinterpret(UInt8,a))), but note that the result may be endian-dependent.

    CRC32c.crc32cMethod
    crc32c(io::IO, [nb::Integer,] crc::UInt32=0x00000000)

    Read up to nb bytes from io and return the CRC-32c checksum, optionally mixed with a starting crc integer. If nb is not supplied, then io will be read until the end of the stream.

    diff --git a/en/v1.12-dev/stdlib/Dates/index.html b/en/v1.12-dev/stdlib/Dates/index.html index 40fa37fc9d7..58c5261e48e 100644 --- a/en/v1.12-dev/stdlib/Dates/index.html +++ b/en/v1.12-dev/stdlib/Dates/index.html @@ -520,4 +520,4 @@ "2018-08-08T12:00:43.001"
    Dates.ISODateFormatConstant
    Dates.ISODateFormat

    Describes the ISO8601 formatting for a date. This is the default value for Dates.format of a Date.

    Examples

    julia> Dates.format(Date(2018, 8, 8), ISODateFormat)
     "2018-08-08"
    Dates.ISOTimeFormatConstant
    Dates.ISOTimeFormat

    Describes the ISO8601 formatting for a time. This is the default value for Dates.format of a Time.

    Examples

    julia> Dates.format(Time(12, 0, 43, 1), ISOTimeFormat)
     "12:00:43.001"
    Dates.RFC1123FormatConstant
    Dates.RFC1123Format

    Describes the RFC1123 formatting for a date and time.

    Examples

    julia> Dates.format(DateTime(2018, 8, 8, 12, 0, 43, 1), RFC1123Format)
    -"Wed, 08 Aug 2018 12:00:43"
    +"Wed, 08 Aug 2018 12:00:43"
    diff --git a/en/v1.12-dev/stdlib/DelimitedFiles/index.html b/en/v1.12-dev/stdlib/DelimitedFiles/index.html index 4ce3ab99d90..cf18d9da8e0 100644 --- a/en/v1.12-dev/stdlib/DelimitedFiles/index.html +++ b/en/v1.12-dev/stdlib/DelimitedFiles/index.html @@ -125,4 +125,4 @@ 3 7 4 8 -julia> rm("delim_file.txt") +julia> rm("delim_file.txt") diff --git a/en/v1.12-dev/stdlib/Distributed/index.html b/en/v1.12-dev/stdlib/Distributed/index.html index 4da3a20c750..dcb02ed547a 100644 --- a/en/v1.12-dev/stdlib/Distributed/index.html +++ b/en/v1.12-dev/stdlib/Distributed/index.html @@ -70,7 +70,7 @@ 1 0 3 - 0

    Errors can also be handled by retrying failed computations. Keyword arguments retry_delays and retry_check are passed through to retry as keyword arguments delays and check respectively. If batching is specified, and an entire batch fails, all items in the batch are retried.

    Note that if both on_error and retry_delays are specified, the on_error hook is called before retrying. If on_error does not throw (or rethrow) an exception, the element will not be retried.

    Example: On errors, retry f on an element a maximum of 3 times without any delay between retries.

    pmap(f, c; retry_delays = zeros(3))

    Example: Retry f only if the exception is not of type InexactError, with exponentially increasing delays up to 3 times. Return a NaN in place for all InexactError occurrences.

    pmap(f, c; on_error = e->(isa(e, InexactError) ? NaN : rethrow()), retry_delays = ExponentialBackOff(n = 3))
    Distributed.RemoteExceptionType
    RemoteException(captured)

    Exceptions on remote computations are captured and rethrown locally. A RemoteException wraps the pid of the worker and a captured exception. A CapturedException captures the remote exception and a serializable form of the call stack when the exception was raised.

    Distributed.ProcessExitedExceptionType
    ProcessExitedException(worker_id::Int)

    After a client Julia process has exited, further attempts to reference the dead child will throw this exception.

    Distributed.FutureType
    Future(w::Int, rrid::RRID, v::Union{Some, Nothing}=nothing)

    A Future is a placeholder for a single computation of unknown termination status and time. For multiple potential computations, see RemoteChannel. See remoteref_id for identifying an AbstractRemoteRef.

    Distributed.RemoteChannelType
    RemoteChannel(pid::Integer=myid())

    Make a reference to a Channel{Any}(1) on process pid. The default pid is the current process.

    RemoteChannel(f::Function, pid::Integer=myid())

    Create references to remote channels of a specific size and type. f is a function that when executed on pid must return an implementation of an AbstractChannel.

    For example, RemoteChannel(()->Channel{Int}(10), pid), will return a reference to a channel of type Int and size 10 on pid.

    The default pid is the current process.

    Base.fetchMethod
    fetch(x::Future)

    Wait for and get the value of a Future. The fetched value is cached locally. Further calls to fetch on the same reference return the cached value. If the remote value is an exception, throws a RemoteException which captures the remote exception and backtrace.

    Base.fetchMethod
    fetch(c::RemoteChannel)

    Wait for and get a value from a RemoteChannel. Exceptions raised are the same as for a Future. Does not remove the item fetched.

    fetch(x::Any)

    Return x.

    source
    Distributed.remotecallMethod
    remotecall(f, id::Integer, args...; kwargs...) -> Future

    Call a function f asynchronously on the given arguments on the specified process. Return a Future. Keyword arguments, if any, are passed through to f.

    Distributed.remotecall_waitMethod
    remotecall_wait(f, id::Integer, args...; kwargs...)

    Perform a faster wait(remotecall(...)) in one message on the Worker specified by worker id id. Keyword arguments, if any, are passed through to f.

    See also wait and remotecall.

    Distributed.remotecall_fetchMethod
    remotecall_fetch(f, id::Integer, args...; kwargs...)

    Perform fetch(remotecall(...)) in one message. Keyword arguments, if any, are passed through to f. Any remote exceptions are captured in a RemoteException and thrown.

    See also fetch and remotecall.

    Examples

    $ julia -p 2
    + 0

    Errors can also be handled by retrying failed computations. Keyword arguments retry_delays and retry_check are passed through to retry as keyword arguments delays and check respectively. If batching is specified, and an entire batch fails, all items in the batch are retried.

    Note that if both on_error and retry_delays are specified, the on_error hook is called before retrying. If on_error does not throw (or rethrow) an exception, the element will not be retried.

    Example: On errors, retry f on an element a maximum of 3 times without any delay between retries.

    pmap(f, c; retry_delays = zeros(3))

    Example: Retry f only if the exception is not of type InexactError, with exponentially increasing delays up to 3 times. Return a NaN in place for all InexactError occurrences.

    pmap(f, c; on_error = e->(isa(e, InexactError) ? NaN : rethrow()), retry_delays = ExponentialBackOff(n = 3))
    Distributed.RemoteExceptionType
    RemoteException(captured)

    Exceptions on remote computations are captured and rethrown locally. A RemoteException wraps the pid of the worker and a captured exception. A CapturedException captures the remote exception and a serializable form of the call stack when the exception was raised.

    Distributed.ProcessExitedExceptionType
    ProcessExitedException(worker_id::Int)

    After a client Julia process has exited, further attempts to reference the dead child will throw this exception.

    Distributed.FutureType
    Future(w::Int, rrid::RRID, v::Union{Some, Nothing}=nothing)

    A Future is a placeholder for a single computation of unknown termination status and time. For multiple potential computations, see RemoteChannel. See remoteref_id for identifying an AbstractRemoteRef.

    Distributed.RemoteChannelType
    RemoteChannel(pid::Integer=myid())

    Make a reference to a Channel{Any}(1) on process pid. The default pid is the current process.

    RemoteChannel(f::Function, pid::Integer=myid())

    Create references to remote channels of a specific size and type. f is a function that when executed on pid must return an implementation of an AbstractChannel.

    For example, RemoteChannel(()->Channel{Int}(10), pid), will return a reference to a channel of type Int and size 10 on pid.

    The default pid is the current process.

    Base.fetchMethod
    fetch(x::Future)

    Wait for and get the value of a Future. The fetched value is cached locally. Further calls to fetch on the same reference return the cached value. If the remote value is an exception, throws a RemoteException which captures the remote exception and backtrace.

    Base.fetchMethod
    fetch(c::RemoteChannel)

    Wait for and get a value from a RemoteChannel. Exceptions raised are the same as for a Future. Does not remove the item fetched.

    fetch(x::Any)

    Return x.

    source
    Distributed.remotecallMethod
    remotecall(f, id::Integer, args...; kwargs...) -> Future

    Call a function f asynchronously on the given arguments on the specified process. Return a Future. Keyword arguments, if any, are passed through to f.

    Distributed.remotecall_waitMethod
    remotecall_wait(f, id::Integer, args...; kwargs...)

    Perform a faster wait(remotecall(...)) in one message on the Worker specified by worker id id. Keyword arguments, if any, are passed through to f.

    See also wait and remotecall.

    Distributed.remotecall_fetchMethod
    remotecall_fetch(f, id::Integer, args...; kwargs...)

    Perform fetch(remotecall(...)) in one message. Keyword arguments, if any, are passed through to f. Any remote exceptions are captured in a RemoteException and thrown.

    See also fetch and remotecall.

    Examples

    $ julia -p 2
     
     julia> remotecall_fetch(sqrt, 2, 4)
     2.0
    @@ -166,4 +166,4 @@
     end

    The specified range is partitioned and locally executed across all workers. In case an optional reducer function is specified, @distributed performs local reductions on each worker with a final reduction on the calling process.

    Note that without a reducer function, @distributed executes asynchronously, i.e. it spawns independent tasks on all available workers and returns immediately without waiting for completion. To wait for completion, prefix the call with @sync, like :

    @sync @distributed for var = range
         body
     end
    Distributed.@everywhereMacro
    @everywhere [procs()] expr

    Execute an expression under Main on all procs. Errors on any of the processes are collected into a CompositeException and thrown. For example:

    @everywhere bar = 1

    will define Main.bar on all current processes. Any processes added later (say with addprocs()) will not have the expression defined.

    Unlike @spawnat, @everywhere does not capture any local variables. Instead, local variables can be broadcast using interpolation:

    foo = 1
    -@everywhere bar = $foo

    The optional argument procs allows specifying a subset of all processes to have execute the expression.

    Similar to calling remotecall_eval(Main, procs, expr), but with two extra features:

    • using and import statements run on the calling process first, to ensure packages are precompiled.
    • The current source file path used by include is propagated to other processes.
    Distributed.remoteref_idFunction
    remoteref_id(r::AbstractRemoteRef) -> RRID

    Futures and RemoteChannels are identified by fields:

    • where - refers to the node where the underlying object/storage referred to by the reference actually exists.

    • whence - refers to the node the remote reference was created from. Note that this is different from the node where the underlying object referred to actually exists. For example calling RemoteChannel(2) from the master process would result in a where value of 2 and a whence value of 1.

    • id is unique across all references created from the worker specified by whence.

    Taken together, whence and id uniquely identify a reference across all workers.

    remoteref_id is a low-level API which returns a RRID object that wraps whence and id values of a remote reference.

    Distributed.channel_from_idFunction
    channel_from_id(id) -> c

    A low-level API which returns the backing AbstractChannel for an id returned by remoteref_id. The call is valid only on the node where the backing channel exists.

    Distributed.worker_id_from_socketFunction
    worker_id_from_socket(s) -> pid

    A low-level API which, given a IO connection or a Worker, returns the pid of the worker it is connected to. This is useful when writing custom serialize methods for a type, which optimizes the data written out depending on the receiving process id.

    Distributed.cluster_cookieMethod
    cluster_cookie() -> cookie

    Return the cluster cookie.

    Distributed.cluster_cookieMethod
    cluster_cookie(cookie) -> cookie

    Set the passed cookie as the cluster cookie, then returns it.

    Cluster Manager Interface

    This interface provides a mechanism to launch and manage Julia workers on different cluster environments. There are two types of managers present in Base: LocalManager, for launching additional workers on the same host, and SSHManager, for launching on remote hosts via ssh. TCP/IP sockets are used to connect and transport messages between processes. It is possible for Cluster Managers to provide a different transport.

    Distributed.ClusterManagerType
    ClusterManager

    Supertype for cluster managers, which control workers processes as a cluster. Cluster managers implement how workers can be added, removed and communicated with. SSHManager and LocalManager are subtypes of this.

    Distributed.WorkerConfigType
    WorkerConfig

    Type used by ClusterManagers to control workers added to their clusters. Some fields are used by all cluster managers to access a host:

    • io – the connection used to access the worker (a subtype of IO or Nothing)
    • host – the host address (either a String or Nothing)
    • port – the port on the host used to connect to the worker (either an Int or Nothing)

    Some are used by the cluster manager to add workers to an already-initialized host:

    • count – the number of workers to be launched on the host
    • exename – the path to the Julia executable on the host, defaults to "$(Sys.BINDIR)/julia" or "$(Sys.BINDIR)/julia-debug"
    • exeflags – flags to use when launching Julia remotely

    The userdata field is used to store information for each worker by external managers.

    Some fields are used by SSHManager and similar managers:

    • tunneltrue (use tunneling), false (do not use tunneling), or nothing (use default for the manager)
    • multiplextrue (use SSH multiplexing for tunneling) or false
    • forward – the forwarding option used for -L option of ssh
    • bind_addr – the address on the remote host to bind to
    • sshflags – flags to use in establishing the SSH connection
    • max_parallel – the maximum number of workers to connect to in parallel on the host

    Some fields are used by both LocalManagers and SSHManagers:

    • connect_at – determines whether this is a worker-to-worker or driver-to-worker setup call
    • process – the process which will be connected (usually the manager will assign this during addprocs)
    • ospid – the process ID according to the host OS, used to interrupt worker processes
    • environ – private dictionary used to store temporary information by Local/SSH managers
    • ident – worker as identified by the ClusterManager
    • connect_idents – list of worker ids the worker must connect to if using a custom topology
    • enable_threaded_blastrue, false, or nothing, whether to use threaded BLAS or not on the workers
    Distributed.launchFunction
    launch(manager::ClusterManager, params::Dict, launched::Array, launch_ntfy::Condition)

    Implemented by cluster managers. For every Julia worker launched by this function, it should append a WorkerConfig entry to launched and notify launch_ntfy. The function MUST exit once all workers, requested by manager have been launched. params is a dictionary of all keyword arguments addprocs was called with.

    Distributed.manageFunction
    manage(manager::ClusterManager, id::Integer, config::WorkerConfig. op::Symbol)

    Implemented by cluster managers. It is called on the master process, during a worker's lifetime, with appropriate op values:

    • with :register/:deregister when a worker is added / removed from the Julia worker pool.
    • with :interrupt when interrupt(workers) is called. The ClusterManager should signal the appropriate worker with an interrupt signal.
    • with :finalize for cleanup purposes.
    Base.killMethod
    kill(manager::ClusterManager, pid::Int, config::WorkerConfig)

    Implemented by cluster managers. It is called on the master process, by rmprocs. It should cause the remote worker specified by pid to exit. kill(manager::ClusterManager.....) executes a remote exit() on pid.

    Sockets.connectMethod
    connect(manager::ClusterManager, pid::Int, config::WorkerConfig) -> (instrm::IO, outstrm::IO)

    Implemented by cluster managers using custom transports. It should establish a logical connection to worker with id pid, specified by config and return a pair of IO objects. Messages from pid to current process will be read off instrm, while messages to be sent to pid will be written to outstrm. The custom transport implementation must ensure that messages are delivered and received completely and in order. connect(manager::ClusterManager.....) sets up TCP/IP socket connections in-between workers.

    Distributed.init_workerFunction
    init_worker(cookie::AbstractString, manager::ClusterManager=DefaultClusterManager())

    Called by cluster managers implementing custom transports. It initializes a newly launched process as a worker. Command line argument --worker[=<cookie>] has the effect of initializing a process as a worker using TCP/IP sockets for transport. cookie is a cluster_cookie.

    Distributed.start_workerFunction
    start_worker([out::IO=stdout], cookie::AbstractString=readline(stdin); close_stdin::Bool=true, stderr_to_stdout::Bool=true)

    start_worker is an internal function which is the default entry point for worker processes connecting via TCP/IP. It sets up the process as a Julia cluster worker.

    host:port information is written to stream out (defaults to stdout).

    The function reads the cookie from stdin if required, and listens on a free port (or if specified, the port in the --bind-to command line option) and schedules tasks to process incoming TCP connections and requests. It also (optionally) closes stdin and redirects stderr to stdout.

    It does not return.

    Distributed.process_messagesFunction
    process_messages(r_stream::IO, w_stream::IO, incoming::Bool=true)

    Called by cluster managers using custom transports. It should be called when the custom transport implementation receives the first message from a remote worker. The custom transport must manage a logical connection to the remote worker and provide two IO objects, one for incoming messages and the other for messages addressed to the remote worker. If incoming is true, the remote peer initiated the connection. Whichever of the pair initiates the connection sends the cluster cookie and its Julia version number to perform the authentication handshake.

    See also cluster_cookie.

    Distributed.default_addprocs_paramsFunction
    default_addprocs_params(mgr::ClusterManager) -> Dict{Symbol, Any}

    Implemented by cluster managers. The default keyword parameters passed when calling addprocs(mgr). The minimal set of options is available by calling default_addprocs_params()

    +@everywhere bar = $foo

    The optional argument procs allows specifying a subset of all processes to have execute the expression.

    Similar to calling remotecall_eval(Main, procs, expr), but with two extra features:

    Distributed.remoteref_idFunction
    remoteref_id(r::AbstractRemoteRef) -> RRID

    Futures and RemoteChannels are identified by fields:

    • where - refers to the node where the underlying object/storage referred to by the reference actually exists.

    • whence - refers to the node the remote reference was created from. Note that this is different from the node where the underlying object referred to actually exists. For example calling RemoteChannel(2) from the master process would result in a where value of 2 and a whence value of 1.

    • id is unique across all references created from the worker specified by whence.

    Taken together, whence and id uniquely identify a reference across all workers.

    remoteref_id is a low-level API which returns a RRID object that wraps whence and id values of a remote reference.

    Distributed.channel_from_idFunction
    channel_from_id(id) -> c

    A low-level API which returns the backing AbstractChannel for an id returned by remoteref_id. The call is valid only on the node where the backing channel exists.

    Distributed.worker_id_from_socketFunction
    worker_id_from_socket(s) -> pid

    A low-level API which, given a IO connection or a Worker, returns the pid of the worker it is connected to. This is useful when writing custom serialize methods for a type, which optimizes the data written out depending on the receiving process id.

    Distributed.cluster_cookieMethod
    cluster_cookie() -> cookie

    Return the cluster cookie.

    Distributed.cluster_cookieMethod
    cluster_cookie(cookie) -> cookie

    Set the passed cookie as the cluster cookie, then returns it.

    Cluster Manager Interface

    This interface provides a mechanism to launch and manage Julia workers on different cluster environments. There are two types of managers present in Base: LocalManager, for launching additional workers on the same host, and SSHManager, for launching on remote hosts via ssh. TCP/IP sockets are used to connect and transport messages between processes. It is possible for Cluster Managers to provide a different transport.

    Distributed.ClusterManagerType
    ClusterManager

    Supertype for cluster managers, which control workers processes as a cluster. Cluster managers implement how workers can be added, removed and communicated with. SSHManager and LocalManager are subtypes of this.

    Distributed.WorkerConfigType
    WorkerConfig

    Type used by ClusterManagers to control workers added to their clusters. Some fields are used by all cluster managers to access a host:

    • io – the connection used to access the worker (a subtype of IO or Nothing)
    • host – the host address (either a String or Nothing)
    • port – the port on the host used to connect to the worker (either an Int or Nothing)

    Some are used by the cluster manager to add workers to an already-initialized host:

    • count – the number of workers to be launched on the host
    • exename – the path to the Julia executable on the host, defaults to "$(Sys.BINDIR)/julia" or "$(Sys.BINDIR)/julia-debug"
    • exeflags – flags to use when launching Julia remotely

    The userdata field is used to store information for each worker by external managers.

    Some fields are used by SSHManager and similar managers:

    • tunneltrue (use tunneling), false (do not use tunneling), or nothing (use default for the manager)
    • multiplextrue (use SSH multiplexing for tunneling) or false
    • forward – the forwarding option used for -L option of ssh
    • bind_addr – the address on the remote host to bind to
    • sshflags – flags to use in establishing the SSH connection
    • max_parallel – the maximum number of workers to connect to in parallel on the host

    Some fields are used by both LocalManagers and SSHManagers:

    • connect_at – determines whether this is a worker-to-worker or driver-to-worker setup call
    • process – the process which will be connected (usually the manager will assign this during addprocs)
    • ospid – the process ID according to the host OS, used to interrupt worker processes
    • environ – private dictionary used to store temporary information by Local/SSH managers
    • ident – worker as identified by the ClusterManager
    • connect_idents – list of worker ids the worker must connect to if using a custom topology
    • enable_threaded_blastrue, false, or nothing, whether to use threaded BLAS or not on the workers
    Distributed.launchFunction
    launch(manager::ClusterManager, params::Dict, launched::Array, launch_ntfy::Condition)

    Implemented by cluster managers. For every Julia worker launched by this function, it should append a WorkerConfig entry to launched and notify launch_ntfy. The function MUST exit once all workers, requested by manager have been launched. params is a dictionary of all keyword arguments addprocs was called with.

    Distributed.manageFunction
    manage(manager::ClusterManager, id::Integer, config::WorkerConfig. op::Symbol)

    Implemented by cluster managers. It is called on the master process, during a worker's lifetime, with appropriate op values:

    • with :register/:deregister when a worker is added / removed from the Julia worker pool.
    • with :interrupt when interrupt(workers) is called. The ClusterManager should signal the appropriate worker with an interrupt signal.
    • with :finalize for cleanup purposes.
    Base.killMethod
    kill(manager::ClusterManager, pid::Int, config::WorkerConfig)

    Implemented by cluster managers. It is called on the master process, by rmprocs. It should cause the remote worker specified by pid to exit. kill(manager::ClusterManager.....) executes a remote exit() on pid.

    Sockets.connectMethod
    connect(manager::ClusterManager, pid::Int, config::WorkerConfig) -> (instrm::IO, outstrm::IO)

    Implemented by cluster managers using custom transports. It should establish a logical connection to worker with id pid, specified by config and return a pair of IO objects. Messages from pid to current process will be read off instrm, while messages to be sent to pid will be written to outstrm. The custom transport implementation must ensure that messages are delivered and received completely and in order. connect(manager::ClusterManager.....) sets up TCP/IP socket connections in-between workers.

    Distributed.init_workerFunction
    init_worker(cookie::AbstractString, manager::ClusterManager=DefaultClusterManager())

    Called by cluster managers implementing custom transports. It initializes a newly launched process as a worker. Command line argument --worker[=<cookie>] has the effect of initializing a process as a worker using TCP/IP sockets for transport. cookie is a cluster_cookie.

    Distributed.start_workerFunction
    start_worker([out::IO=stdout], cookie::AbstractString=readline(stdin); close_stdin::Bool=true, stderr_to_stdout::Bool=true)

    start_worker is an internal function which is the default entry point for worker processes connecting via TCP/IP. It sets up the process as a Julia cluster worker.

    host:port information is written to stream out (defaults to stdout).

    The function reads the cookie from stdin if required, and listens on a free port (or if specified, the port in the --bind-to command line option) and schedules tasks to process incoming TCP connections and requests. It also (optionally) closes stdin and redirects stderr to stdout.

    It does not return.

    Distributed.process_messagesFunction
    process_messages(r_stream::IO, w_stream::IO, incoming::Bool=true)

    Called by cluster managers using custom transports. It should be called when the custom transport implementation receives the first message from a remote worker. The custom transport must manage a logical connection to the remote worker and provide two IO objects, one for incoming messages and the other for messages addressed to the remote worker. If incoming is true, the remote peer initiated the connection. Whichever of the pair initiates the connection sends the cluster cookie and its Julia version number to perform the authentication handshake.

    See also cluster_cookie.

    Distributed.default_addprocs_paramsFunction
    default_addprocs_params(mgr::ClusterManager) -> Dict{Symbol, Any}

    Implemented by cluster managers. The default keyword parameters passed when calling addprocs(mgr). The minimal set of options is available by calling default_addprocs_params()

    diff --git a/en/v1.12-dev/stdlib/Downloads/index.html b/en/v1.12-dev/stdlib/Downloads/index.html index 37992fb927d..0809ddc13bb 100644 --- a/en/v1.12-dev/stdlib/Downloads/index.html +++ b/en/v1.12-dev/stdlib/Downloads/index.html @@ -60,4 +60,4 @@ code :: Int message :: String response :: Response -end

    RequestError is a type capturing the properties of a failed response to a request as an exception object:

    The same RequestError type is thrown by download if the request was successful but there was a protocol-level error indicated by a status code that is not in the 2xx range, in which case code will be zero and the message field will be the empty string. The request API only throws a RequestError if the libcurl error code is non-zero, in which case the included response object is likely to have a status of zero and an empty message. There are, however, situations where a curl-level error is thrown due to a protocol error, in which case both the inner and outer code and message may be of interest.

    Downloads.DownloaderType
    Downloader(; [ grace::Real = 30 ])

    Downloader objects are used to perform individual download operations. Connections, name lookups and other resources are shared within a Downloader. These connections and resources are cleaned up after a configurable grace period (default: 30 seconds) since anything was downloaded with it, or when it is garbage collected, whichever comes first. If the grace period is set to zero, all resources will be cleaned up immediately as soon as there are no more ongoing downloads in progress. If the grace period is set to Inf then resources are not cleaned up until Downloader is garbage collected.

    +end

    RequestError is a type capturing the properties of a failed response to a request as an exception object:

    The same RequestError type is thrown by download if the request was successful but there was a protocol-level error indicated by a status code that is not in the 2xx range, in which case code will be zero and the message field will be the empty string. The request API only throws a RequestError if the libcurl error code is non-zero, in which case the included response object is likely to have a status of zero and an empty message. There are, however, situations where a curl-level error is thrown due to a protocol error, in which case both the inner and outer code and message may be of interest.

    Downloads.DownloaderType
    Downloader(; [ grace::Real = 30 ])

    Downloader objects are used to perform individual download operations. Connections, name lookups and other resources are shared within a Downloader. These connections and resources are cleaned up after a configurable grace period (default: 30 seconds) since anything was downloaded with it, or when it is garbage collected, whichever comes first. If the grace period is set to zero, all resources will be cleaned up immediately as soon as there are no more ongoing downloads in progress. If the grace period is set to Inf then resources are not cleaned up until Downloader is garbage collected.

    diff --git a/en/v1.12-dev/stdlib/FileWatching/index.html b/en/v1.12-dev/stdlib/FileWatching/index.html index 1b3fe358093..617a5b07779 100644 --- a/en/v1.12-dev/stdlib/FileWatching/index.html +++ b/en/v1.12-dev/stdlib/FileWatching/index.html @@ -6,4 +6,4 @@

    File Events

    FileWatching.poll_fdFunction
    poll_fd(fd, timeout_s::Real=-1; readable=false, writable=false)

    Monitor a file descriptor fd for changes in the read or write availability, and with a timeout given by timeout_s seconds.

    The keyword arguments determine which of read and/or write status should be monitored; at least one of them must be set to true.

    The returned value is an object with boolean fields readable, writable, and timedout, giving the result of the polling.

    This is a thin wrapper over calling wait on a FDWatcher, which implements the functionality but requires the user to call close manually when finished with it, or risk serious crashes.

    FileWatching.poll_fileFunction
    poll_file(path::AbstractString, interval_s::Real=5.007, timeout_s::Real=-1) -> (previous::StatStruct, current)

    Monitor a file for changes by polling every interval_s seconds until a change occurs or timeout_s seconds have elapsed. The interval_s should be a long period; the default is 5.007 seconds.

    Returns a pair of status objects (previous, current) when a change is detected. The previous status is always a StatStruct, but it may have all of the fields zeroed (indicating the file didn't previously exist, or wasn't previously accessible).

    The current status object may be a StatStruct, an EOFError (indicating the timeout elapsed), or some other Exception subtype (if the stat operation failed: for example, if the path does not exist).

    To determine when a file was modified, compare !(current isa StatStruct && prev == current) to detect notification of changes to the mtime or inode. However, using watch_file for this operation is preferred, since it is more reliable and efficient, although in some situations it may not be available.

    This is a thin wrapper over calling wait on a PollingFileWatcher, which implements the functionality, but this function has a small race window between consecutive calls to poll_file where the file might change without being detected.

    FileWatching.watch_fileFunction
    watch_file(path::AbstractString, timeout_s::Real=-1)

    Watch file or directory path for changes until a change occurs or timeout_s seconds have elapsed. This function does not poll the file system and instead uses platform-specific functionality to receive notifications from the operating system (e.g. via inotify on Linux). See the NodeJS documentation linked below for details.

    The returned value is an object with boolean fields renamed, changed, and timedout, giving the result of watching the file.

    This behavior of this function varies slightly across platforms. See https://nodejs.org/api/fs.html#fs_caveats for more detailed information.

    This is a thin wrapper over calling wait on a FileMonitor. This function has a small race window between consecutive calls to watch_file where the file might change without being detected. To avoid this race, use

    fm = FileMonitor(path)
     wait(fm)

    directly, re-using the same fm each time you wait.

    FileWatching.watch_folderFunction
    watch_folder(path::AbstractString, timeout_s::Real=-1)

    Watch a file or directory path for changes until a change has occurred or timeout_s seconds have elapsed. This function does not poll the file system and instead uses platform-specific functionality to receive notifications from the operating system (e.g. via inotify on Linux). See the NodeJS documentation linked below for details.

    This will continuing tracking changes for path in the background until unwatch_folder is called on the same path.

    The returned value is an pair where the first field is the name of the changed file (if available) and the second field is an object with boolean fields renamed, changed, and timedout, giving the event.

    This behavior of this function varies slightly across platforms. See https://nodejs.org/api/fs.html#fs_caveats for more detailed information.

    This function is a thin wrapper over calling wait on a FolderMonitor, with added timeout support.

    FileWatching.unwatch_folderFunction
    unwatch_folder(path::AbstractString)

    Stop background tracking of changes for path. It is not recommended to do this while another task is waiting for watch_folder to return on the same path, as the result may be unpredictable.

    FileWatching.FileMonitorType
    FileMonitor(path::AbstractString)

    Watch file or directory path (which must exist) for changes until a change occurs. This function does not poll the file system and instead uses platform-specific functionality to receive notifications from the operating system (e.g. via inotify on Linux). See the NodeJS documentation linked below for details.

    fm = FileMonitor(path) acts like an auto-reset Event, so wait(fm) blocks until there has been at least one event in the file originally at the given path and then returns an object with boolean fields renamed, changed, timedout summarizing all changes that have occurred since the last call to wait returned.

    This behavior of this function varies slightly across platforms. See https://nodejs.org/api/fs.html#fs_caveats for more detailed information.

    FileWatching.FolderMonitorType
    FolderMonitor(folder::AbstractString)

    Watch a file or directory path for changes until a change has occurred. This function does not poll the file system and instead uses platform-specific functionality to receive notifications from the operating system (e.g. via inotify on Linux). See the NodeJS documentation linked below for details.

    This acts similar to a Channel, so calling take! (or wait) blocks until some change has occurred. The wait function will return a pair where the first field is the name of the changed file (if available) and the second field is an object with boolean fields renamed and changed, giving the event that occurred on it.

    This behavior of this function varies slightly across platforms. See https://nodejs.org/api/fs.html#fs_caveats for more detailed information.

    FileWatching.PollingFileWatcherType
    PollingFileWatcher(path::AbstractString, interval_s::Real=5.007)

    Monitor a file for changes by polling stat every interval_s seconds until a change occurs or timeout_s seconds have elapsed. The interval_s should be a long period; the default is 5.007 seconds. Call stat on it to get the most recent, but old, result.

    This acts like an auto-reset Event, so calling wait blocks until the stat result has changed since the previous value captured upon entry to the wait call. The wait function will return a pair of status objects (previous, current) once any stat change is detected since the previous time that wait was called. The previous status is always a StatStruct, but it may have all of the fields zeroed (indicating the file didn't previously exist, or wasn't previously accessible).

    The current status object may be a StatStruct, an EOFError (if the wait is canceled by closing this object), or some other Exception subtype (if the stat operation failed: for example, if the path is removed). Note that stat value may be outdated if the file has changed again multiple times.

    Using FileMonitor for this operation is preferred, since it is more reliable and efficient, although in some situations it may not be available.

    FileWatching.FDWatcherType
    FDWatcher(fd::Union{RawFD,WindowsRawSocket}, readable::Bool, writable::Bool)

    Monitor a file descriptor fd for changes in the read or write availability.

    The keyword arguments determine which of read and/or write status should be monitored; at least one of them must be set to true.

    The returned value is an object with boolean fields readable, writable, and timedout, giving the result of the polling.

    This acts like a level-set event, so calling wait blocks until one of those conditions is met, but then continues to return without blocking until the condition is cleared (either there is no more to read, or no more space in the write buffer, or both).

    Warning

    You must call close manually, when finished with this object, before the fd argument is closed. Failure to do so risks serious crashes.

    Pidfile

    A simple utility tool for creating advisory pidfiles (lock files).

    Primary Functions

    FileWatching.Pidfile.mkpidlockFunction
    mkpidlock([f::Function], at::String, [pid::Cint]; kwopts...)
     mkpidlock(at::String, proc::Process; kwopts...)

    Create a pidfile lock for the path "at" for the current process or the process identified by pid or proc. Can take a function to execute once locked, for usage in do blocks, after which the lock will be automatically closed. If the lock fails and wait is false, then an error is thrown.

    The lock will be released by either close, a finalizer, or shortly after proc exits. Make sure the return value is live through the end of the critical section of your program, so the finalizer does not reclaim it early.

    Optional keyword arguments:

    • mode: file access mode (modified by the process umask). Defaults to world-readable.
    • poll_interval: Specify the maximum time to between attempts (if watch_file doesn't work)
    • stale_age: Delete an existing pidfile (ignoring the lock) if it is older than this many seconds, based on its mtime. The file won't be deleted until 5x longer than this if the pid in the file appears that it may be valid. Or 25x longer if refresh is overridden to 0 to disable lock refreshing. By default this is disabled (stale_age = 0), but a typical recommended value would be about 3-5x an estimated normal completion time.
    • refresh: Keeps a lock from becoming stale by updating the mtime every interval of time that passes. By default, this is set to stale_age/2, which is the recommended value.
    • wait: If true, block until we get the lock, if false, raise error if lock fails.
    FileWatching.Pidfile.trymkpidlockFunction
    trymkpidlock([f::Function], at::String, [pid::Cint]; kwopts...)
    -trymkpidlock(at::String, proc::Process; kwopts...)

    Like mkpidlock except returns false instead of waiting if the file is already locked.

    Julia 1.10

    This function requires at least Julia 1.10.

    Base.closeMethod
    close(lock::LockMonitor)

    Release a pidfile lock.

    Helper Functions

    FileWatching.Pidfile.open_exclusiveFunction
    open_exclusive(path::String; mode, poll_interval, wait, stale_age, refresh) :: File

    Create a new a file for read-write advisory-exclusive access. If wait is false then error out if the lock files exist otherwise block until we get the lock.

    For a description of the keyword arguments, see mkpidlock.

    FileWatching.Pidfile.tryopen_exclusiveFunction
    tryopen_exclusive(path::String, mode::Integer = 0o444) :: Union{Void, File}

    Try to create a new file for read-write advisory-exclusive access, return nothing if it already exists.

    FileWatching.Pidfile.parse_pidfileFunction
    parse_pidfile(file::Union{IO, String}) => (pid, hostname, age)

    Attempt to parse our pidfile format, replaced an element with (0, "", 0.0), respectively, for any read that failed.

    FileWatching.Pidfile.stale_pidfileFunction
    stale_pidfile(path::String, stale_age::Real, refresh::Real) :: Bool

    Helper function for open_exclusive for deciding if a pidfile is stale.

    FileWatching.Pidfile.isvalidpidFunction
    isvalidpid(hostname::String, pid::Cuint) :: Bool

    Attempt to conservatively estimate whether pid is a valid process id.

    Base.Filesystem.touchMethod
    Base.touch(::Pidfile.LockMonitor)

    Update the mtime on the lock, to indicate it is still fresh.

    See also the refresh keyword in the mkpidlock constructor.

    +trymkpidlock(at::String, proc::Process; kwopts...)

    Like mkpidlock except returns false instead of waiting if the file is already locked.

    Julia 1.10

    This function requires at least Julia 1.10.

    Base.closeMethod
    close(lock::LockMonitor)

    Release a pidfile lock.

    Helper Functions

    FileWatching.Pidfile.open_exclusiveFunction
    open_exclusive(path::String; mode, poll_interval, wait, stale_age, refresh) :: File

    Create a new a file for read-write advisory-exclusive access. If wait is false then error out if the lock files exist otherwise block until we get the lock.

    For a description of the keyword arguments, see mkpidlock.

    FileWatching.Pidfile.tryopen_exclusiveFunction
    tryopen_exclusive(path::String, mode::Integer = 0o444) :: Union{Void, File}

    Try to create a new file for read-write advisory-exclusive access, return nothing if it already exists.

    FileWatching.Pidfile.write_pidfileFunction
    write_pidfile(io, pid)

    Write our pidfile format to an open IO descriptor.

    FileWatching.Pidfile.parse_pidfileFunction
    parse_pidfile(file::Union{IO, String}) => (pid, hostname, age)

    Attempt to parse our pidfile format, replaced an element with (0, "", 0.0), respectively, for any read that failed.

    FileWatching.Pidfile.stale_pidfileFunction
    stale_pidfile(path::String, stale_age::Real, refresh::Real) :: Bool

    Helper function for open_exclusive for deciding if a pidfile is stale.

    FileWatching.Pidfile.isvalidpidFunction
    isvalidpid(hostname::String, pid::Cuint) :: Bool

    Attempt to conservatively estimate whether pid is a valid process id.

    Base.Filesystem.touchMethod
    Base.touch(::Pidfile.LockMonitor)

    Update the mtime on the lock, to indicate it is still fresh.

    See also the refresh keyword in the mkpidlock constructor.

    diff --git a/en/v1.12-dev/stdlib/Future/index.html b/en/v1.12-dev/stdlib/Future/index.html index 69db5ad860d..731904d49c5 100644 --- a/en/v1.12-dev/stdlib/Future/index.html +++ b/en/v1.12-dev/stdlib/Future/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Future

    The Future module implements future behavior of already existing functions, which will replace the current version in a future release of Julia.

    Future.copy!Function
    Future.copy!(dst, src) -> dst

    Copy src into dst.

    Julia 1.1

    This function has moved to Base with Julia 1.1, consider using copy!(dst, src) instead. Future.copy! will be deprecated in the future.

    Future.randjumpFunction
    randjump(r::MersenneTwister, steps::Integer) -> MersenneTwister

    Create an initialized MersenneTwister object, whose state is moved forward (without generating numbers) from r by steps steps. One such step corresponds to the generation of two Float64 numbers. For each different value of steps, a large polynomial has to be generated internally. One is already pre-computed for steps=big(10)^20.

    +

    Future

    The Future module implements future behavior of already existing functions, which will replace the current version in a future release of Julia.

    Future.copy!Function
    Future.copy!(dst, src) -> dst

    Copy src into dst.

    Julia 1.1

    This function has moved to Base with Julia 1.1, consider using copy!(dst, src) instead. Future.copy! will be deprecated in the future.

    Future.randjumpFunction
    randjump(r::MersenneTwister, steps::Integer) -> MersenneTwister

    Create an initialized MersenneTwister object, whose state is moved forward (without generating numbers) from r by steps steps. One such step corresponds to the generation of two Float64 numbers. For each different value of steps, a large polynomial has to be generated internally. One is already pre-computed for steps=big(10)^20.

    diff --git a/en/v1.12-dev/stdlib/InteractiveUtils/index.html b/en/v1.12-dev/stdlib/InteractiveUtils/index.html index 4fd580610b6..00132a9c884 100644 --- a/en/v1.12-dev/stdlib/InteractiveUtils/index.html +++ b/en/v1.12-dev/stdlib/InteractiveUtils/index.html @@ -3,7 +3,7 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Interactive Utilities

    The InteractiveUtils module provides utilities for interactive use of Julia, such as code introspection and clipboard access. It is intended for interactive work and is loaded automatically in interactive mode.

    Base.Docs.aproposFunction
    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.

    apropos can be called from the help mode in the REPL by wrapping the query in double quotes:

    help?> "pattern"
    source
    InteractiveUtils.varinfoFunction
    varinfo(m::Module=Main, pattern::Regex=r""; all=false, imported=false, recursive=false, sortby::Symbol=:name, minsize::Int=0)

    Return a markdown table giving information about public global variables in a module, optionally restricted to those matching pattern.

    The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object.

    • all : also list non-public objects defined in the module, deprecated objects, and compiler-generated objects.
    • imported : also list objects explicitly imported from other modules.
    • recursive : recursively include objects in sub-modules, observing the same settings in each.
    • sortby : the column to sort results by. Options are :name (default), :size, and :summary.
    • minsize : only includes objects with size at least minsize bytes. Defaults to 0.

    The output of varinfo is intended for display purposes only. See also names to get an array of symbols defined in a module, which is suitable for more general manipulations.

    InteractiveUtils.versioninfoFunction
    versioninfo(io::IO=stdout; verbose::Bool=false)

    Print information about the version of Julia in use. The output is controlled with boolean keyword arguments:

    • verbose: print all additional information
    Warning

    The output of this function may contain sensitive information. Before sharing the output, please review the output and remove any data that should not be shared publicly.

    See also: VERSION.

    InteractiveUtils.methodswithFunction
    methodswith(typ[, module or function]; supertypes::Bool=false])

    Return an array of methods with an argument of type typ.

    The optional second argument restricts the search to a particular module or function (the default is all top-level modules).

    If keyword supertypes is true, also return arguments with a parent type of typ, excluding type Any.

    See also: methods.

    InteractiveUtils.subtypesFunction
    subtypes(T::DataType)

    Return a list of immediate subtypes of DataType T. Note that all currently loaded subtypes are included, including those not visible in the current module.

    See also supertype, supertypes, methodswith.

    Examples

    julia> subtypes(Integer)
    +

    Interactive Utilities

    The InteractiveUtils module provides utilities for interactive use of Julia, such as code introspection and clipboard access. It is intended for interactive work and is loaded automatically in interactive mode.

    Base.Docs.aproposFunction
    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.

    apropos can be called from the help mode in the REPL by wrapping the query in double quotes:

    help?> "pattern"
    source
    InteractiveUtils.varinfoFunction
    varinfo(m::Module=Main, pattern::Regex=r""; all=false, imported=false, recursive=false, sortby::Symbol=:name, minsize::Int=0)

    Return a markdown table giving information about public global variables in a module, optionally restricted to those matching pattern.

    The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object.

    • all : also list non-public objects defined in the module, deprecated objects, and compiler-generated objects.
    • imported : also list objects explicitly imported from other modules.
    • recursive : recursively include objects in sub-modules, observing the same settings in each.
    • sortby : the column to sort results by. Options are :name (default), :size, and :summary.
    • minsize : only includes objects with size at least minsize bytes. Defaults to 0.

    The output of varinfo is intended for display purposes only. See also names to get an array of symbols defined in a module, which is suitable for more general manipulations.

    InteractiveUtils.versioninfoFunction
    versioninfo(io::IO=stdout; verbose::Bool=false)

    Print information about the version of Julia in use. The output is controlled with boolean keyword arguments:

    • verbose: print all additional information
    Warning

    The output of this function may contain sensitive information. Before sharing the output, please review the output and remove any data that should not be shared publicly.

    See also: VERSION.

    InteractiveUtils.methodswithFunction
    methodswith(typ[, module or function]; supertypes::Bool=false])

    Return an array of methods with an argument of type typ.

    The optional second argument restricts the search to a particular module or function (the default is all top-level modules).

    If keyword supertypes is true, also return arguments with a parent type of typ, excluding type Any.

    See also: methods.

    InteractiveUtils.subtypesFunction
    subtypes(T::DataType)

    Return a list of immediate subtypes of DataType T. Note that all currently loaded subtypes are included, including those not visible in the current module.

    See also supertype, supertypes, methodswith.

    Examples

    julia> subtypes(Integer)
     3-element Vector{Any}:
      Bool
      Signed
    @@ -34,4 +34,4 @@
     #=  102.0 ms =# precompile(Tuple{typeof(Base.:(*)), Array{Float64, 2}, Array{Float64, 2}})
     2×2 Matrix{Float64}:
      0.421704  0.864841
    - 0.211262  0.444366
    Julia 1.12

    This macro requires at least Julia 1.12

    Base.@trace_dispatchMacro
    @trace_dispatch

    A macro to execute an expression and report methods that were compiled via dynamic dispatch, like the julia arg --trace-dispatch=stderr but specifically for a call.

    Julia 1.12

    This macro requires at least Julia 1.12

    InteractiveUtils.clipboardFunction
    clipboard(x)

    Send a printed form of x to the operating system clipboard ("copy").

    clipboard() -> String

    Return a string with the contents of the operating system clipboard ("paste").

    + 0.211262 0.444366
    Julia 1.12

    This macro requires at least Julia 1.12

    Base.@trace_dispatchMacro
    @trace_dispatch

    A macro to execute an expression and report methods that were compiled via dynamic dispatch, like the julia arg --trace-dispatch=stderr but specifically for a call.

    Julia 1.12

    This macro requires at least Julia 1.12

    InteractiveUtils.clipboardFunction
    clipboard(x)

    Send a printed form of x to the operating system clipboard ("copy").

    clipboard() -> String

    Return a string with the contents of the operating system clipboard ("paste").

    diff --git a/en/v1.12-dev/stdlib/JuliaSyntaxHighlighting/index.html b/en/v1.12-dev/stdlib/JuliaSyntaxHighlighting/index.html index 5d225020cef..584203d4955 100644 --- a/en/v1.12-dev/stdlib/JuliaSyntaxHighlighting/index.html +++ b/en/v1.12-dev/stdlib/JuliaSyntaxHighlighting/index.html @@ -30,4 +30,4 @@ @NamedTuple{region::UnitRange{Int64}, label::Symbol, value}((5:5, :face, :julia_number)) @NamedTuple{region::UnitRange{Int64}, label::Symbol, value}((6:6, :face, :julia_operator)) @NamedTuple{region::UnitRange{Int64}, label::Symbol, value}((7:7, :face, :julia_number)) - @NamedTuple{region::UnitRange{Int64}, label::Symbol, value}((8:8, :face, :julia_rainbow_paren_1))

    Faces

    The highlight/highlight! methods work by applying custom faces to Julia code. As part of the standard library, these faces use privileged face names, of the form julia_*. These can be re-used in other packages, and customised with faces.toml configuration.

    Unstable faces

    The particular faces used by JuliaSyntaxHighlighting are liable to change without warning in point releases. As the syntax highlighting rules are refined over time, changes should become less and less frequent though.

    The current set of faces, and their default values are as follows:

    + @NamedTuple{region::UnitRange{Int64}, label::Symbol, value}((8:8, :face, :julia_rainbow_paren_1))

    Faces

    The highlight/highlight! methods work by applying custom faces to Julia code. As part of the standard library, these faces use privileged face names, of the form julia_*. These can be re-used in other packages, and customised with faces.toml configuration.

    Unstable faces

    The particular faces used by JuliaSyntaxHighlighting are liable to change without warning in point releases. As the syntax highlighting rules are refined over time, changes should become less and less frequent though.

    The current set of faces, and their default values are as follows:

    diff --git a/en/v1.12-dev/stdlib/LazyArtifacts/index.html b/en/v1.12-dev/stdlib/LazyArtifacts/index.html index e0c4f9b4903..278e32561ec 100644 --- a/en/v1.12-dev/stdlib/LazyArtifacts/index.html +++ b/en/v1.12-dev/stdlib/LazyArtifacts/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Lazy Artifacts

    In order for a package to download artifacts lazily, LazyArtifacts must be explicitly listed as a dependency of that package.

    For further information on artifacts, see Artifacts.

    +

    Lazy Artifacts

    In order for a package to download artifacts lazily, LazyArtifacts must be explicitly listed as a dependency of that package.

    For further information on artifacts, see Artifacts.

    diff --git a/en/v1.12-dev/stdlib/LibCURL/index.html b/en/v1.12-dev/stdlib/LibCURL/index.html index e8750d9a9b5..1ccc6e0166c 100644 --- a/en/v1.12-dev/stdlib/LibCURL/index.html +++ b/en/v1.12-dev/stdlib/LibCURL/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -
    +
    diff --git a/en/v1.12-dev/stdlib/LibGit2/index.html b/en/v1.12-dev/stdlib/LibGit2/index.html index 088fb618459..c360084446e 100644 --- a/en/v1.12-dev/stdlib/LibGit2/index.html +++ b/en/v1.12-dev/stdlib/LibGit2/index.html @@ -239,4 +239,4 @@ julia> LibGit2.url(remote) "https://github.com/JuliaLang/Example.jl"
    LibGit2.versionFunction
    version() -> VersionNumber

    Return the version of libgit2 in use, as a VersionNumber.

    LibGit2.withFunction
    with(f::Function, obj)

    Resource management helper function. Applies f to obj, making sure to call close on obj after f successfully returns or throws an error. Ensures that allocated git resources are finalized as soon as they are no longer needed.

    LibGit2.with_warnFunction
    with_warn(f::Function, ::Type{T}, args...)

    Resource management helper function. Apply f to args, first constructing an instance of type T from args. Makes sure to call close on the resulting object after f successfully returns or throws an error. Ensures that allocated git resources are finalized as soon as they are no longer needed. If an error is thrown by f, a warning is shown containing the error.

    LibGit2.workdirFunction
    LibGit2.workdir(repo::GitRepo)

    Return the location of the working directory of repo. This will throw an error for bare repositories.

    Note

    This will typically be the parent directory of gitdir(repo), but can be different in some cases: e.g. if either the core.worktree configuration variable or the GIT_WORK_TREE environment variable is set.

    See also gitdir, path.

    LibGit2.GitObjectMethod
    (::Type{T})(te::GitTreeEntry) where T<:GitObject

    Get the git object to which te refers and return it as its actual type (the type entrytype would show), for instance a GitBlob or GitTag.

    Examples

    tree = LibGit2.GitTree(repo, "HEAD^{tree}")
     tree_entry = tree[1]
    -blob = LibGit2.GitBlob(tree_entry)
    LibGit2.UserPasswordCredentialType

    Credential that support only user and password parameters

    LibGit2.SSHCredentialType

    SSH credential type

    LibGit2.isfilledFunction
    isfilled(cred::AbstractCredential) -> Bool

    Verifies that a credential is ready for use in authentication.

    LibGit2.CachedCredentialsType

    Caches credential information for re-use

    LibGit2.CredentialPayloadType
    LibGit2.CredentialPayload

    Retains the state between multiple calls to the credential callback for the same URL. A CredentialPayload instance is expected to be reset! whenever it will be used with a different URL.

    LibGit2.approveFunction
    approve(payload::CredentialPayload; shred::Bool=true) -> Nothing

    Store the payload credential for re-use in a future authentication. Should only be called when authentication was successful.

    The shred keyword controls whether sensitive information in the payload credential field should be destroyed. Should only be set to false during testing.

    LibGit2.rejectFunction
    reject(payload::CredentialPayload; shred::Bool=true) -> Nothing

    Discard the payload credential from begin re-used in future authentication. Should only be called when authentication was unsuccessful.

    The shred keyword controls whether sensitive information in the payload credential field should be destroyed. Should only be set to false during testing.

    LibGit2.Consts.GIT_CONFIGType

    Priority level of a config file.

    These priority levels correspond to the natural escalation logic (from higher to lower) when searching for config entries in git.

    • CONFIG_LEVEL_DEFAULT - Open the global, XDG and system configuration files if any available.
    • CONFIG_LEVEL_PROGRAMDATA - System-wide on Windows, for compatibility with portable git
    • CONFIG_LEVEL_SYSTEM - System-wide configuration file; /etc/gitconfig on Linux systems
    • CONFIG_LEVEL_XDG - XDG compatible configuration file; typically ~/.config/git/config
    • CONFIG_LEVEL_GLOBAL - User-specific configuration file (also called Global configuration file); typically ~/.gitconfig
    • CONFIG_LEVEL_LOCAL - Repository specific configuration file; $WORK_DIR/.git/config on non-bare repos
    • CONFIG_LEVEL_WORKTREE - Worktree specific configuration file; $GIT_DIR/config.worktree
    • CONFIG_LEVEL_APP - Application specific configuration file; freely defined by applications
    • CONFIG_HIGHEST_LEVEL - Represents the highest level available config file (i.e. the most specific config file available that actually is loaded)
    +blob = LibGit2.GitBlob(tree_entry)
    LibGit2.UserPasswordCredentialType

    Credential that support only user and password parameters

    LibGit2.SSHCredentialType

    SSH credential type

    LibGit2.isfilledFunction
    isfilled(cred::AbstractCredential) -> Bool

    Verifies that a credential is ready for use in authentication.

    LibGit2.CachedCredentialsType

    Caches credential information for re-use

    LibGit2.CredentialPayloadType
    LibGit2.CredentialPayload

    Retains the state between multiple calls to the credential callback for the same URL. A CredentialPayload instance is expected to be reset! whenever it will be used with a different URL.

    LibGit2.approveFunction
    approve(payload::CredentialPayload; shred::Bool=true) -> Nothing

    Store the payload credential for re-use in a future authentication. Should only be called when authentication was successful.

    The shred keyword controls whether sensitive information in the payload credential field should be destroyed. Should only be set to false during testing.

    LibGit2.rejectFunction
    reject(payload::CredentialPayload; shred::Bool=true) -> Nothing

    Discard the payload credential from begin re-used in future authentication. Should only be called when authentication was unsuccessful.

    The shred keyword controls whether sensitive information in the payload credential field should be destroyed. Should only be set to false during testing.

    LibGit2.Consts.GIT_CONFIGType

    Priority level of a config file.

    These priority levels correspond to the natural escalation logic (from higher to lower) when searching for config entries in git.

    • CONFIG_LEVEL_DEFAULT - Open the global, XDG and system configuration files if any available.
    • CONFIG_LEVEL_PROGRAMDATA - System-wide on Windows, for compatibility with portable git
    • CONFIG_LEVEL_SYSTEM - System-wide configuration file; /etc/gitconfig on Linux systems
    • CONFIG_LEVEL_XDG - XDG compatible configuration file; typically ~/.config/git/config
    • CONFIG_LEVEL_GLOBAL - User-specific configuration file (also called Global configuration file); typically ~/.gitconfig
    • CONFIG_LEVEL_LOCAL - Repository specific configuration file; $WORK_DIR/.git/config on non-bare repos
    • CONFIG_LEVEL_WORKTREE - Worktree specific configuration file; $GIT_DIR/config.worktree
    • CONFIG_LEVEL_APP - Application specific configuration file; freely defined by applications
    • CONFIG_HIGHEST_LEVEL - Represents the highest level available config file (i.e. the most specific config file available that actually is loaded)
    diff --git a/en/v1.12-dev/stdlib/Libdl/index.html b/en/v1.12-dev/stdlib/Libdl/index.html index 31e4542f50d..40cb6b4b6c7 100644 --- a/en/v1.12-dev/stdlib/Libdl/index.html +++ b/en/v1.12-dev/stdlib/Libdl/index.html @@ -3,16 +3,16 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -
    LibdlModule

    The Libdl module in Julia provides specialized and lower-level facilities for dynamic linking with shared libraries. While Julia inherently supports linking to runtime shared libraries through the ccall intrinsic, Libdl extends this capability by offering additional, more granular control. It enables users to search for shared libraries both in memory and the filesystem, manually load them with specific runtime linker options, and look up library symbols as low-level pointers.

    Dynamic Linker

    Base.Libc.Libdl.dlopenFunction
    dlopen(libfile::AbstractString [, flags::Integer]; throw_error:Bool = true)

    Load a shared library, returning an opaque handle.

    The extension given by the constant dlext (.so, .dll, or .dylib) can be omitted from the libfile string, as it is automatically appended if needed. If libfile is not an absolute path name, then the paths in the array DL_LOAD_PATH are searched for libfile, followed by the system load path.

    The optional flags argument is a bitwise-or of zero or more of RTLD_LOCAL, RTLD_GLOBAL, RTLD_LAZY, RTLD_NOW, RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEEPBIND, and RTLD_FIRST. These are converted to the corresponding flags of the POSIX (and/or GNU libc and/or MacOS) dlopen command, if possible, or are ignored if the specified functionality is not available on the current platform. The default flags are platform specific. On MacOS the default dlopen flags are RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL while on other platforms the defaults are RTLD_LAZY|RTLD_DEEPBIND|RTLD_LOCAL. An important usage of these flags is to specify non default behavior for when the dynamic library loader binds library references to exported symbols and if the bound references are put into process local or global scope. For instance RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL allows the library's symbols to be available for usage in other shared libraries, addressing situations where there are dependencies between shared libraries.

    If the library cannot be found, this method throws an error, unless the keyword argument throw_error is set to false, in which case this method returns nothing.

    Note

    From Julia 1.6 on, this method replaces paths starting with @executable_path/ with the path to the Julia executable, allowing for relocatable relative-path loads. In Julia 1.5 and earlier, this only worked on macOS.

    source
    Base.Libc.Libdl.dlopen_eFunction
    dlopen_e(libfile::AbstractString [, flags::Integer])

    Similar to dlopen, except returns C_NULL instead of raising errors. This method is now deprecated in favor of dlopen(libfile::AbstractString [, flags::Integer]; throw_error=false).

    source
    Base.Libc.Libdl.RTLD_NOWConstant
    RTLD_DEEPBIND
    +
    LibdlModule

    The Libdl module in Julia provides specialized and lower-level facilities for dynamic linking with shared libraries. While Julia inherently supports linking to runtime shared libraries through the ccall intrinsic, Libdl extends this capability by offering additional, more granular control. It enables users to search for shared libraries both in memory and the filesystem, manually load them with specific runtime linker options, and look up library symbols as low-level pointers.

    Dynamic Linker

    Base.Libc.Libdl.dlopenFunction
    dlopen(libfile::AbstractString [, flags::Integer]; throw_error:Bool = true)

    Load a shared library, returning an opaque handle.

    The extension given by the constant dlext (.so, .dll, or .dylib) can be omitted from the libfile string, as it is automatically appended if needed. If libfile is not an absolute path name, then the paths in the array DL_LOAD_PATH are searched for libfile, followed by the system load path.

    The optional flags argument is a bitwise-or of zero or more of RTLD_LOCAL, RTLD_GLOBAL, RTLD_LAZY, RTLD_NOW, RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEEPBIND, and RTLD_FIRST. These are converted to the corresponding flags of the POSIX (and/or GNU libc and/or MacOS) dlopen command, if possible, or are ignored if the specified functionality is not available on the current platform. The default flags are platform specific. On MacOS the default dlopen flags are RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL while on other platforms the defaults are RTLD_LAZY|RTLD_DEEPBIND|RTLD_LOCAL. An important usage of these flags is to specify non default behavior for when the dynamic library loader binds library references to exported symbols and if the bound references are put into process local or global scope. For instance RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL allows the library's symbols to be available for usage in other shared libraries, addressing situations where there are dependencies between shared libraries.

    If the library cannot be found, this method throws an error, unless the keyword argument throw_error is set to false, in which case this method returns nothing.

    Note

    From Julia 1.6 on, this method replaces paths starting with @executable_path/ with the path to the Julia executable, allowing for relocatable relative-path loads. In Julia 1.5 and earlier, this only worked on macOS.

    source
    Base.Libc.Libdl.dlopen_eFunction
    dlopen_e(libfile::AbstractString [, flags::Integer])

    Similar to dlopen, except returns C_NULL instead of raising errors. This method is now deprecated in favor of dlopen(libfile::AbstractString [, flags::Integer]; throw_error=false).

    source
    Base.Libc.Libdl.RTLD_NOWConstant
    RTLD_DEEPBIND
     RTLD_FIRST
     RTLD_GLOBAL
     RTLD_LAZY
     RTLD_LOCAL
     RTLD_NODELETE
     RTLD_NOLOAD
    -RTLD_NOW

    Enum constant for dlopen. See your platform man page for details, if applicable.

    source
    Base.Libc.Libdl.dlsymFunction
    dlsym(handle, sym; throw_error::Bool = true)

    Look up a symbol from a shared library handle, return callable function pointer on success.

    If the symbol cannot be found, this method throws an error, unless the keyword argument throw_error is set to false, in which case this method returns nothing.

    source
    Base.Libc.Libdl.dlsym_eFunction
    dlsym_e(handle, sym)

    Look up a symbol from a shared library handle, silently return C_NULL on lookup failure. This method is now deprecated in favor of dlsym(handle, sym; throw_error=false).

    source
    Base.Libc.Libdl.dlcloseFunction
    dlclose(::Nothing)

    For the very common pattern usage pattern of

    try
    +RTLD_NOW

    Enum constant for dlopen. See your platform man page for details, if applicable.

    source
    Base.Libc.Libdl.dlsymFunction
    dlsym(handle, sym; throw_error::Bool = true)

    Look up a symbol from a shared library handle, return callable function pointer on success.

    If the symbol cannot be found, this method throws an error, unless the keyword argument throw_error is set to false, in which case this method returns nothing.

    source
    Base.Libc.Libdl.dlsym_eFunction
    dlsym_e(handle, sym)

    Look up a symbol from a shared library handle, silently return C_NULL on lookup failure. This method is now deprecated in favor of dlsym(handle, sym; throw_error=false).

    source
    Base.Libc.Libdl.dlcloseFunction
    dlclose(::Nothing)

    For the very common pattern usage pattern of

    try
         hdl = dlopen(library_name)
         ... do something
     finally
         dlclose(hdl)
    -end

    We define a dlclose() method that accepts a parameter of type Nothing, so that user code does not have to change its behavior for the case that library_name was not found.

    source
    dlclose(handle)

    Close shared library referenced by handle.

    source
    Base.Libc.Libdl.dlpathFunction
    dlpath(libname::Union{AbstractString, Symbol})

    Get the full path of the library libname.

    Examples

    julia> dlpath("libjulia")
    source
    dlpath(handle::Ptr{Cvoid})

    Given a library handle from dlopen, return the full path.

    source
    Base.Libc.Libdl.find_libraryFunction
    find_library(names [, locations])

    Searches for the first library in names in the paths in the locations list, DL_LOAD_PATH, or system library paths (in that order) which can successfully be dlopen'd. On success, the return value will be one of the names (potentially prefixed by one of the paths in locations). This string can be assigned to a global const and used as the library name in future ccall's. On failure, it returns the empty string.

    source
    Base.DL_LOAD_PATHConstant
    DL_LOAD_PATH

    When calling dlopen, the paths in this list will be searched first, in order, before searching the system locations for a valid library handle.

    source
    +end

    We define a dlclose() method that accepts a parameter of type Nothing, so that user code does not have to change its behavior for the case that library_name was not found.

    source
    dlclose(handle)

    Close shared library referenced by handle.

    source
    Base.Libc.Libdl.dlpathFunction
    dlpath(libname::Union{AbstractString, Symbol})

    Get the full path of the library libname.

    Examples

    julia> dlpath("libjulia")
    source
    dlpath(handle::Ptr{Cvoid})

    Given a library handle from dlopen, return the full path.

    source
    Base.Libc.Libdl.find_libraryFunction
    find_library(names [, locations])

    Searches for the first library in names in the paths in the locations list, DL_LOAD_PATH, or system library paths (in that order) which can successfully be dlopen'd. On success, the return value will be one of the names (potentially prefixed by one of the paths in locations). This string can be assigned to a global const and used as the library name in future ccall's. On failure, it returns the empty string.

    source
    Base.DL_LOAD_PATHConstant
    DL_LOAD_PATH

    When calling dlopen, the paths in this list will be searched first, in order, before searching the system locations for a valid library handle.

    source
    diff --git a/en/v1.12-dev/stdlib/LinearAlgebra/index.html b/en/v1.12-dev/stdlib/LinearAlgebra/index.html index dd0169df0f8..5df3c07a903 100644 --- a/en/v1.12-dev/stdlib/LinearAlgebra/index.html +++ b/en/v1.12-dev/stdlib/LinearAlgebra/index.html @@ -2009,7 +2009,7 @@ 1.0 1.4142135623730951 1.7320508075688772 - 2.0source
    sqrt(A::AbstractMatrix)

    If A has no negative real eigenvalues, compute the principal matrix square root of A, that is the unique matrix $X$ with eigenvalues having positive real part such that $X^2 = A$. Otherwise, a nonprincipal square root is returned.

    If A is real-symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the square root. For such matrices, eigenvalues λ that appear to be slightly negative due to roundoff errors are treated as if they were zero. More precisely, matrices with all eigenvalues ≥ -rtol*(max |λ|) are treated as semidefinite (yielding a Hermitian square root), with negative eigenvalues taken to be zero. rtol is a keyword argument to sqrt (in the Hermitian/real-symmetric case only) that defaults to machine precision scaled by size(A,1).

    Otherwise, the square root is determined by means of the Björck-Hammarling method [BH83], which computes the complex Schur form (schur) and then the complex square root of the triangular factor. If a real square root exists, then an extension of this method [H87] that computes the real Schur form and then the real square root of the quasi-triangular factor is instead used.

    Examples

    julia> A = [4 0; 0 4]
    + 2.0
    source
    sqrt(A::AbstractMatrix)

    If A has no negative real eigenvalues, compute the principal matrix square root of A, that is the unique matrix $X$ with eigenvalues having positive real part such that $X^2 = A$. Otherwise, a nonprincipal square root is returned.

    If A is real-symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the square root. For such matrices, eigenvalues λ that appear to be slightly negative due to roundoff errors are treated as if they were zero. More precisely, matrices with all eigenvalues ≥ -rtol*(max |λ|) are treated as semidefinite (yielding a Hermitian square root), with negative eigenvalues taken to be zero. rtol is a keyword argument to sqrt (in the Hermitian/real-symmetric case only) that defaults to machine precision scaled by size(A,1).

    Otherwise, the square root is determined by means of the Björck-Hammarling method [BH83], which computes the complex Schur form (schur) and then the complex square root of the triangular factor. If a real square root exists, then an extension of this method [H87] that computes the real Schur form and then the real square root of the quasi-triangular factor is instead used.

    Examples

    julia> A = [4 0; 0 4]
     2×2 Matrix{Int64}:
      4  0
      0  4
    @@ -2565,4 +2565,4 @@
     2.0
    LinearAlgebra.BLAS.iamaxFunction
    iamax(n, dx, incx)
     iamax(dx)

    Find the index of the element of dx with the maximum absolute value. n is the length of dx, and incx is the stride. If n and incx are not provided, they assume default values of n=length(dx) and incx=stride1(dx).

    Level 2 BLAS functions

    The level 2 BLAS functions were published in (Dongarra, 1988) and define matrix-vector operations.

    return a vector

    LinearAlgebra.BLAS.gemv!Function
    gemv!(tA, alpha, A, x, beta, y)

    Update the vector y as alpha*A*x + beta*y or alpha*A'x + beta*y according to tA. alpha and beta are scalars. Return the updated y.

    LinearAlgebra.BLAS.gemvMethod
    gemv(tA, alpha, A, x)

    Return alpha*A*x or alpha*A'x according to tA. alpha is a scalar.

    LinearAlgebra.BLAS.gemvMethod
    gemv(tA, A, x)

    Return A*x or A'x according to tA.

    LinearAlgebra.BLAS.gbmv!Function
    gbmv!(trans, m, kl, ku, alpha, A, x, beta, y)

    Update vector y as alpha*A*x + beta*y or alpha*A'*x + beta*y according to trans. The matrix A is a general band matrix of dimension m by size(A,2) with kl sub-diagonals and ku super-diagonals. alpha and beta are scalars. Return the updated y.

    LinearAlgebra.BLAS.gbmvFunction
    gbmv(trans, m, kl, ku, alpha, A, x)

    Return alpha*A*x or alpha*A'*x according to trans. The matrix A is a general band matrix of dimension m by size(A,2) with kl sub-diagonals and ku super-diagonals, and alpha is a scalar.

    LinearAlgebra.BLAS.hemv!Function
    hemv!(ul, alpha, A, x, beta, y)

    Update the vector y as alpha*A*x + beta*y. A is assumed to be Hermitian. Only the ul triangle of A is used. alpha and beta are scalars. Return the updated y.

    LinearAlgebra.BLAS.hemvMethod
    hemv(ul, alpha, A, x)

    Return alpha*A*x. A is assumed to be Hermitian. Only the ul triangle of A is used. alpha is a scalar.

    LinearAlgebra.BLAS.hemvMethod
    hemv(ul, A, x)

    Return A*x. A is assumed to be Hermitian. Only the ul triangle of A is used.

    LinearAlgebra.BLAS.hpmv!Function
    hpmv!(uplo, α, AP, x, β, y)

    Update vector y as α*A*x + β*y, where A is a Hermitian matrix provided in packed format AP.

    With uplo = 'U', the array AP must contain the upper triangular part of the Hermitian matrix packed sequentially, column by column, so that AP[1] contains A[1, 1], AP[2] and AP[3] contain A[1, 2] and A[2, 2] respectively, and so on.

    With uplo = 'L', the array AP must contain the lower triangular part of the Hermitian matrix packed sequentially, column by column, so that AP[1] contains A[1, 1], AP[2] and AP[3] contain A[2, 1] and A[3, 1] respectively, and so on.

    The scalar inputs α and β must be complex or real numbers.

    The array inputs x, y and AP must all be of ComplexF32 or ComplexF64 type.

    Return the updated y.

    Julia 1.5

    hpmv! requires at least Julia 1.5.

    LinearAlgebra.BLAS.symv!Function
    symv!(ul, alpha, A, x, beta, y)

    Update the vector y as alpha*A*x + beta*y. A is assumed to be symmetric. Only the ul triangle of A is used. alpha and beta are scalars. Return the updated y.

    LinearAlgebra.BLAS.symvMethod
    symv(ul, alpha, A, x)

    Return alpha*A*x. A is assumed to be symmetric. Only the ul triangle of A is used. alpha is a scalar.

    LinearAlgebra.BLAS.symvMethod
    symv(ul, A, x)

    Return A*x. A is assumed to be symmetric. Only the ul triangle of A is used.

    LinearAlgebra.BLAS.sbmv!Function
    sbmv!(uplo, k, alpha, A, x, beta, y)

    Update vector y as alpha*A*x + beta*y where A is a symmetric band matrix of order size(A,2) with k super-diagonals stored in the argument A. The storage layout for A is described the reference BLAS module, level-2 BLAS at https://www.netlib.org/lapack/explore-html/. Only the uplo triangle of A is used.

    Return the updated y.

    LinearAlgebra.BLAS.sbmvMethod
    sbmv(uplo, k, alpha, A, x)

    Return alpha*A*x where A is a symmetric band matrix of order size(A,2) with k super-diagonals stored in the argument A. Only the uplo triangle of A is used.

    LinearAlgebra.BLAS.sbmvMethod
    sbmv(uplo, k, A, x)

    Return A*x where A is a symmetric band matrix of order size(A,2) with k super-diagonals stored in the argument A. Only the uplo triangle of A is used.

    LinearAlgebra.BLAS.spmv!Function
    spmv!(uplo, α, AP, x, β, y)

    Update vector y as α*A*x + β*y, where A is a symmetric matrix provided in packed format AP.

    With uplo = 'U', the array AP must contain the upper triangular part of the symmetric matrix packed sequentially, column by column, so that AP[1] contains A[1, 1], AP[2] and AP[3] contain A[1, 2] and A[2, 2] respectively, and so on.

    With uplo = 'L', the array AP must contain the lower triangular part of the symmetric matrix packed sequentially, column by column, so that AP[1] contains A[1, 1], AP[2] and AP[3] contain A[2, 1] and A[3, 1] respectively, and so on.

    The scalar inputs α and β must be real.

    The array inputs x, y and AP must all be of Float32 or Float64 type.

    Return the updated y.

    Julia 1.5

    spmv! requires at least Julia 1.5.

    LinearAlgebra.BLAS.trmv!Function
    trmv!(ul, tA, dA, A, b)

    Return op(A)*b, where op is determined by tA. Only the ul triangle of A is used. dA determines if the diagonal values are read or are assumed to be all ones. The multiplication occurs in-place on b.

    LinearAlgebra.BLAS.trmvFunction
    trmv(ul, tA, dA, A, b)

    Return op(A)*b, where op is determined by tA. Only the ul triangle of A is used. dA determines if the diagonal values are read or are assumed to be all ones.

    LinearAlgebra.BLAS.trsv!Function
    trsv!(ul, tA, dA, A, b)

    Overwrite b with the solution to A*x = b or one of the other two variants determined by tA and ul. dA determines if the diagonal values are read or are assumed to be all ones. Return the updated b.

    LinearAlgebra.BLAS.trsvFunction
    trsv(ul, tA, dA, A, b)

    Return the solution to A*x = b or one of the other two variants determined by tA and ul. dA determines if the diagonal values are read or are assumed to be all ones.

    return a matrix

    LinearAlgebra.BLAS.ger!Function
    ger!(alpha, x, y, A)

    Rank-1 update of the matrix A with vectors x and y as alpha*x*y' + A.

    LinearAlgebra.BLAS.her!Function
    her!(uplo, alpha, x, A)

    Methods for complex arrays only. Rank-1 update of the Hermitian matrix A with vector x as alpha*x*x' + A. uplo controls which triangle of A is updated. Returns A.

    LinearAlgebra.BLAS.syr!Function
    syr!(uplo, alpha, x, A)

    Rank-1 update of the symmetric matrix A with vector x as alpha*x*transpose(x) + A. uplo controls which triangle of A is updated. Returns A.

    LinearAlgebra.BLAS.spr!Function
    spr!(uplo, α, x, AP)

    Update matrix A as A+α*x*x', where A is a symmetric matrix provided in packed format AP and x is a vector.

    With uplo = 'U', the array AP must contain the upper triangular part of the symmetric matrix packed sequentially, column by column, so that AP[1] contains A[1, 1], AP[2] and AP[3] contain A[1, 2] and A[2, 2] respectively, and so on.

    With uplo = 'L', the array AP must contain the lower triangular part of the symmetric matrix packed sequentially, column by column, so that AP[1] contains A[1, 1], AP[2] and AP[3] contain A[2, 1] and A[3, 1] respectively, and so on.

    The scalar input α must be real.

    The array inputs x and AP must all be of Float32 or Float64 type. Return the updated AP.

    Julia 1.8

    spr! requires at least Julia 1.8.

    Level 3 BLAS functions

    The level 3 BLAS functions were published in (Dongarra, 1990) and define matrix-matrix operations.

    LinearAlgebra.BLAS.gemmt!Function
    gemmt!(uplo, tA, tB, alpha, A, B, beta, C)

    Update the lower or upper triangular part specified by uplo of C as alpha*A*B + beta*C or the other variants according to tA and tB. Return the updated C.

    Julia 1.11

    gemmt! requires at least Julia 1.11.

    LinearAlgebra.BLAS.gemmtMethod
    gemmt(uplo, tA, tB, alpha, A, B)

    Return the lower or upper triangular part specified by uplo of A*B or the other three variants according to tA and tB.

    Julia 1.11

    gemmt requires at least Julia 1.11.

    LinearAlgebra.BLAS.gemmtMethod
    gemmt(uplo, tA, tB, A, B)

    Return the lower or upper triangular part specified by uplo of A*B or the other three variants according to tA and tB.

    Julia 1.11

    gemmt requires at least Julia 1.11.

    LinearAlgebra.BLAS.gemm!Function
    gemm!(tA, tB, alpha, A, B, beta, C)

    Update C as alpha*A*B + beta*C or the other three variants according to tA and tB. Return the updated C.

    LinearAlgebra.BLAS.gemmMethod
    gemm(tA, tB, alpha, A, B)

    Return alpha*A*B or the other three variants according to tA and tB.

    LinearAlgebra.BLAS.gemmMethod
    gemm(tA, tB, A, B)

    Return A*B or the other three variants according to tA and tB.

    LinearAlgebra.BLAS.symm!Function
    symm!(side, ul, alpha, A, B, beta, C)

    Update C as alpha*A*B + beta*C or alpha*B*A + beta*C according to side. A is assumed to be symmetric. Only the ul triangle of A is used. Return the updated C.

    LinearAlgebra.BLAS.symmMethod
    symm(side, ul, alpha, A, B)

    Return alpha*A*B or alpha*B*A according to side. A is assumed to be symmetric. Only the ul triangle of A is used.

    LinearAlgebra.BLAS.symmMethod
    symm(side, ul, A, B)

    Return A*B or B*A according to side. A is assumed to be symmetric. Only the ul triangle of A is used.

    LinearAlgebra.BLAS.hemm!Function
    hemm!(side, ul, alpha, A, B, beta, C)

    Update C as alpha*A*B + beta*C or alpha*B*A + beta*C according to side. A is assumed to be Hermitian. Only the ul triangle of A is used. Return the updated C.

    LinearAlgebra.BLAS.hemmMethod
    hemm(side, ul, alpha, A, B)

    Return alpha*A*B or alpha*B*A according to side. A is assumed to be Hermitian. Only the ul triangle of A is used.

    LinearAlgebra.BLAS.hemmMethod
    hemm(side, ul, A, B)

    Return A*B or B*A according to side. A is assumed to be Hermitian. Only the ul triangle of A is used.

    LinearAlgebra.BLAS.syrk!Function
    syrk!(uplo, trans, alpha, A, beta, C)

    Rank-k update of the symmetric matrix C as alpha*A*transpose(A) + beta*C or alpha*transpose(A)*A + beta*C according to trans. Only the uplo triangle of C is used. Return C.

    LinearAlgebra.BLAS.syrkFunction
    syrk(uplo, trans, alpha, A)

    Return either the upper triangle or the lower triangle of A, according to uplo, of alpha*A*transpose(A) or alpha*transpose(A)*A, according to trans.

    LinearAlgebra.BLAS.herk!Function
    herk!(uplo, trans, alpha, A, beta, C)

    Methods for complex arrays only. Rank-k update of the Hermitian matrix C as alpha*A*A' + beta*C or alpha*A'*A + beta*C according to trans. Only the uplo triangle of C is updated. Returns C.

    LinearAlgebra.BLAS.herkFunction
    herk(uplo, trans, alpha, A)

    Methods for complex arrays only. Returns the uplo triangle of alpha*A*A' or alpha*A'*A, according to trans.

    LinearAlgebra.BLAS.syr2k!Function
    syr2k!(uplo, trans, alpha, A, B, beta, C)

    Rank-2k update of the symmetric matrix C as alpha*A*transpose(B) + alpha*B*transpose(A) + beta*C or alpha*transpose(A)*B + alpha*transpose(B)*A + beta*C according to trans. Only the uplo triangle of C is used. Returns C.

    LinearAlgebra.BLAS.syr2kFunction
    syr2k(uplo, trans, alpha, A, B)

    Returns the uplo triangle of alpha*A*transpose(B) + alpha*B*transpose(A) or alpha*transpose(A)*B + alpha*transpose(B)*A, according to trans.

    syr2k(uplo, trans, A, B)

    Return the uplo triangle of A*transpose(B) + B*transpose(A) or transpose(A)*B + transpose(B)*A, according to trans.

    LinearAlgebra.BLAS.her2k!Function
    her2k!(uplo, trans, alpha, A, B, beta, C)

    Rank-2k update of the Hermitian matrix C as alpha*A*B' + alpha*B*A' + beta*C or alpha*A'*B + alpha*B'*A + beta*C according to trans. The scalar beta has to be real. Only the uplo triangle of C is used. Return C.

    LinearAlgebra.BLAS.her2kFunction
    her2k(uplo, trans, alpha, A, B)

    Return the uplo triangle of alpha*A*B' + alpha*B*A' or alpha*A'*B + alpha*B'*A, according to trans.

    her2k(uplo, trans, A, B)

    Return the uplo triangle of A*B' + B*A' or A'*B + B'*A, according to trans.

    LinearAlgebra.BLAS.trmm!Function
    trmm!(side, ul, tA, dA, alpha, A, B)

    Update B as alpha*A*B or one of the other three variants determined by side and tA. Only the ul triangle of A is used. dA determines if the diagonal values are read or are assumed to be all ones. Return the updated B.

    LinearAlgebra.BLAS.trmmFunction
    trmm(side, ul, tA, dA, alpha, A, B)

    Return alpha*A*B or one of the other three variants determined by side and tA. Only the ul triangle of A is used. dA determines if the diagonal values are read or are assumed to be all ones.

    LinearAlgebra.BLAS.trsm!Function
    trsm!(side, ul, tA, dA, alpha, A, B)

    Overwrite B with the solution to A*X = alpha*B or one of the other three variants determined by side and tA. Only the ul triangle of A is used. dA determines if the diagonal values are read or are assumed to be all ones. Returns the updated B.

    LinearAlgebra.BLAS.trsmFunction
    trsm(side, ul, tA, dA, alpha, A, B)

    Return the solution to A*X = alpha*B or one of the other three variants determined by determined by side and tA. Only the ul triangle of A is used. dA determines if the diagonal values are read or are assumed to be all ones.

    LAPACK functions

    LinearAlgebra.LAPACK provides wrappers for some of the LAPACK functions for linear algebra. Those functions that overwrite one of the input arrays have names ending in '!'.

    Usually a function has 4 methods defined, one each for Float64, Float32, ComplexF64 and ComplexF32 arrays.

    Note that the LAPACK API provided by Julia can and will change in the future. Since this API is not user-facing, there is no commitment to support/deprecate this specific set of functions in future releases.

    LinearAlgebra.LAPACKModule

    Interfaces to LAPACK subroutines.

    LinearAlgebra.LAPACK.gbtrf!Function
    gbtrf!(kl, ku, m, AB) -> (AB, ipiv)

    Compute the LU factorization of a banded matrix AB. kl is the first subdiagonal containing a nonzero band, ku is the last superdiagonal containing one, and m is the first dimension of the matrix AB. Returns the LU factorization in-place and ipiv, the vector of pivots used.

    LinearAlgebra.LAPACK.gbtrs!Function
    gbtrs!(trans, kl, ku, m, AB, ipiv, B)

    Solve the equation AB * X = B. trans determines the orientation of AB. It may be N (no transpose), T (transpose), or C (conjugate transpose). kl is the first subdiagonal containing a nonzero band, ku is the last superdiagonal containing one, and m is the first dimension of the matrix AB. ipiv is the vector of pivots returned from gbtrf!. Returns the vector or matrix X, overwriting B in-place.

    LinearAlgebra.LAPACK.gebal!Function
    gebal!(job, A) -> (ilo, ihi, scale)

    Balance the matrix A before computing its eigensystem or Schur factorization. job can be one of N (A will not be permuted or scaled), P (A will only be permuted), S (A will only be scaled), or B (A will be both permuted and scaled). Modifies A in-place and returns ilo, ihi, and scale. If permuting was turned on, A[i,j] = 0 if j > i and 1 < j < ilo or j > ihi. scale contains information about the scaling/permutations performed.

    LinearAlgebra.LAPACK.gebak!Function
    gebak!(job, side, ilo, ihi, scale, V)

    Transform the eigenvectors V of a matrix balanced using gebal! to the unscaled/unpermuted eigenvectors of the original matrix. Modifies V in-place. side can be L (left eigenvectors are transformed) or R (right eigenvectors are transformed).

    LinearAlgebra.LAPACK.gebrd!Function
    gebrd!(A) -> (A, d, e, tauq, taup)

    Reduce A in-place to bidiagonal form A = QBP'. Returns A, containing the bidiagonal matrix B; d, containing the diagonal elements of B; e, containing the off-diagonal elements of B; tauq, containing the elementary reflectors representing Q; and taup, containing the elementary reflectors representing P.

    LinearAlgebra.LAPACK.gelqf!Function
    gelqf!(A, tau)

    Compute the LQ factorization of A, A = LQ. tau contains scalars which parameterize the elementary reflectors of the factorization. tau must have length greater than or equal to the smallest dimension of A.

    Returns A and tau modified in-place.

    gelqf!(A) -> (A, tau)

    Compute the LQ factorization of A, A = LQ.

    Returns A, modified in-place, and tau, which contains scalars which parameterize the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.geqlf!Function
    geqlf!(A, tau)

    Compute the QL factorization of A, A = QL. tau contains scalars which parameterize the elementary reflectors of the factorization. tau must have length greater than or equal to the smallest dimension of A.

    Returns A and tau modified in-place.

    geqlf!(A) -> (A, tau)

    Compute the QL factorization of A, A = QL.

    Returns A, modified in-place, and tau, which contains scalars which parameterize the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.geqrf!Function
    geqrf!(A, tau)

    Compute the QR factorization of A, A = QR. tau contains scalars which parameterize the elementary reflectors of the factorization. tau must have length greater than or equal to the smallest dimension of A.

    Returns A and tau modified in-place.

    geqrf!(A) -> (A, tau)

    Compute the QR factorization of A, A = QR.

    Returns A, modified in-place, and tau, which contains scalars which parameterize the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.geqp3!Function
    geqp3!(A, [jpvt, tau]) -> (A, tau, jpvt)

    Compute the pivoted QR factorization of A, AP = QR using BLAS level 3. P is a pivoting matrix, represented by jpvt. tau stores the elementary reflectors. The arguments jpvt and tau are optional and allow for passing preallocated arrays. When passed, jpvt must have length greater than or equal to n if A is an (m x n) matrix and tau must have length greater than or equal to the smallest dimension of A. On entry, if jpvt[j] does not equal zero then the jth column of A is permuted to the front of AP.

    A, jpvt, and tau are modified in-place.

    LinearAlgebra.LAPACK.gerqf!Function
    gerqf!(A, tau)

    Compute the RQ factorization of A, A = RQ. tau contains scalars which parameterize the elementary reflectors of the factorization. tau must have length greater than or equal to the smallest dimension of A.

    Returns A and tau modified in-place.

    gerqf!(A) -> (A, tau)

    Compute the RQ factorization of A, A = RQ.

    Returns A, modified in-place, and tau, which contains scalars which parameterize the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.geqrt!Function
    geqrt!(A, T)

    Compute the blocked QR factorization of A, A = QR. T contains upper triangular block reflectors which parameterize the elementary reflectors of the factorization. The first dimension of T sets the block size and it must be between 1 and n. The second dimension of T must equal the smallest dimension of A.

    Returns A and T modified in-place.

    geqrt!(A, nb) -> (A, T)

    Compute the blocked QR factorization of A, A = QR. nb sets the block size and it must be between 1 and n, the second dimension of A.

    Returns A, modified in-place, and T, which contains upper triangular block reflectors which parameterize the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.geqrt3!Function
    geqrt3!(A, T)

    Recursively computes the blocked QR factorization of A, A = QR. T contains upper triangular block reflectors which parameterize the elementary reflectors of the factorization. The first dimension of T sets the block size and it must be between 1 and n. The second dimension of T must equal the smallest dimension of A.

    Returns A and T modified in-place.

    geqrt3!(A) -> (A, T)

    Recursively computes the blocked QR factorization of A, A = QR.

    Returns A, modified in-place, and T, which contains upper triangular block reflectors which parameterize the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.getrf!Function
    getrf!(A, ipiv) -> (A, ipiv, info)

    Compute the pivoted LU factorization of A, A = LU. ipiv contains the pivoting information and info a code which indicates success (info = 0), a singular value in U (info = i, in which case U[i,i] is singular), or an error code (info < 0).

    getrf!(A) -> (A, ipiv, info)

    Compute the pivoted LU factorization of A, A = LU.

    Returns A, modified in-place, ipiv, the pivoting information, and an info code which indicates success (info = 0), a singular value in U (info = i, in which case U[i,i] is singular), or an error code (info < 0).

    LinearAlgebra.LAPACK.tzrzf!Function
    tzrzf!(A) -> (A, tau)

    Transforms the upper trapezoidal matrix A to upper triangular form in-place. Returns A and tau, the scalar parameters for the elementary reflectors of the transformation.

    LinearAlgebra.LAPACK.ormrz!Function
    ormrz!(side, trans, A, tau, C)

    Multiplies the matrix C by Q from the transformation supplied by tzrzf!. Depending on side or trans the multiplication can be left-sided (side = L, Q*C) or right-sided (side = R, C*Q) and Q can be unmodified (trans = N), transposed (trans = T), or conjugate transposed (trans = C). Returns matrix C which is modified in-place with the result of the multiplication.

    LinearAlgebra.LAPACK.gels!Function
    gels!(trans, A, B) -> (F, B, ssr)

    Solves the linear equation A * X = B, transpose(A) * X = B, or adjoint(A) * X = B using a QR or LQ factorization. Modifies the matrix/vector B in place with the solution. A is overwritten with its QR or LQ factorization. trans may be one of N (no modification), T (transpose), or C (conjugate transpose). gels! searches for the minimum norm/least squares solution. A may be under or over determined. The solution is returned in B.

    LinearAlgebra.LAPACK.gesv!Function
    gesv!(A, B) -> (B, A, ipiv)

    Solves the linear equation A * X = B where A is a square matrix using the LU factorization of A. A is overwritten with its LU factorization and B is overwritten with the solution X. ipiv contains the pivoting information for the LU factorization of A.

    LinearAlgebra.LAPACK.getrs!Function
    getrs!(trans, A, ipiv, B)

    Solves the linear equation A * X = B, transpose(A) * X = B, or adjoint(A) * X = B for square A. Modifies the matrix/vector B in place with the solution. A is the LU factorization from getrf!, with ipiv the pivoting information. trans may be one of N (no modification), T (transpose), or C (conjugate transpose).

    LinearAlgebra.LAPACK.getri!Function
    getri!(A, ipiv)

    Computes the inverse of A, using its LU factorization found by getrf!. ipiv is the pivot information output and A contains the LU factorization of getrf!. A is overwritten with its inverse.

    LinearAlgebra.LAPACK.gesvx!Function
    gesvx!(fact, trans, A, AF, ipiv, equed, R, C, B) -> (X, equed, R, C, B, rcond, ferr, berr, work)

    Solves the linear equation A * X = B (trans = N), transpose(A) * X = B (trans = T), or adjoint(A) * X = B (trans = C) using the LU factorization of A. fact may be E, in which case A will be equilibrated and copied to AF; F, in which case AF and ipiv from a previous LU factorization are inputs; or N, in which case A will be copied to AF and then factored. If fact = F, equed may be N, meaning A has not been equilibrated; R, meaning A was multiplied by Diagonal(R) from the left; C, meaning A was multiplied by Diagonal(C) from the right; or B, meaning A was multiplied by Diagonal(R) from the left and Diagonal(C) from the right. If fact = F and equed = R or B the elements of R must all be positive. If fact = F and equed = C or B the elements of C must all be positive.

    Returns the solution X; equed, which is an output if fact is not N, and describes the equilibration that was performed; R, the row equilibration diagonal; C, the column equilibration diagonal; B, which may be overwritten with its equilibrated form Diagonal(R)*B (if trans = N and equed = R,B) or Diagonal(C)*B (if trans = T,C and equed = C,B); rcond, the reciprocal condition number of A after equilbrating; ferr, the forward error bound for each solution vector in X; berr, the forward error bound for each solution vector in X; and work, the reciprocal pivot growth factor.

    gesvx!(A, B)

    The no-equilibration, no-transpose simplification of gesvx!.

    LinearAlgebra.LAPACK.gelsd!Function
    gelsd!(A, B, rcond) -> (B, rnk)

    Computes the least norm solution of A * X = B by finding the SVD factorization of A, then dividing-and-conquering the problem. B is overwritten with the solution X. Singular values below rcond will be treated as zero. Returns the solution in B and the effective rank of A in rnk.

    LinearAlgebra.LAPACK.gelsy!Function
    gelsy!(A, B, rcond) -> (B, rnk)

    Computes the least norm solution of A * X = B by finding the full QR factorization of A, then dividing-and-conquering the problem. B is overwritten with the solution X. Singular values below rcond will be treated as zero. Returns the solution in B and the effective rank of A in rnk.

    LinearAlgebra.LAPACK.gglse!Function
    gglse!(A, c, B, d) -> (X,res)

    Solves the equation A * x = c where x is subject to the equality constraint B * x = d. Uses the formula ||c - A*x||^2 = 0 to solve. Returns X and the residual sum-of-squares.

    LinearAlgebra.LAPACK.geev!Function
    geev!(jobvl, jobvr, A) -> (W, VL, VR)

    Finds the eigensystem of A. If jobvl = N, the left eigenvectors of A aren't computed. If jobvr = N, the right eigenvectors of A aren't computed. If jobvl = V or jobvr = V, the corresponding eigenvectors are computed. Returns the eigenvalues in W, the right eigenvectors in VR, and the left eigenvectors in VL.

    LinearAlgebra.LAPACK.gesdd!Function
    gesdd!(job, A) -> (U, S, VT)

    Finds the singular value decomposition of A, A = U * S * V', using a divide and conquer approach. If job = A, all the columns of U and the rows of V' are computed. If job = N, no columns of U or rows of V' are computed. If job = O, A is overwritten with the columns of (thin) U and the rows of (thin) V'. If job = S, the columns of (thin) U and the rows of (thin) V' are computed and returned separately.

    LinearAlgebra.LAPACK.gesvd!Function
    gesvd!(jobu, jobvt, A) -> (U, S, VT)

    Finds the singular value decomposition of A, A = U * S * V'. If jobu = A, all the columns of U are computed. If jobvt = A all the rows of V' are computed. If jobu = N, no columns of U are computed. If jobvt = N no rows of V' are computed. If jobu = O, A is overwritten with the columns of (thin) U. If jobvt = O, A is overwritten with the rows of (thin) V'. If jobu = S, the columns of (thin) U are computed and returned separately. If jobvt = S the rows of (thin) V' are computed and returned separately. jobu and jobvt can't both be O.

    Returns U, S, and Vt, where S are the singular values of A.

    LinearAlgebra.LAPACK.ggsvd!Function
    ggsvd!(jobu, jobv, jobq, A, B) -> (U, V, Q, alpha, beta, k, l, R)

    Finds the generalized singular value decomposition of A and B, U'*A*Q = D1*R and V'*B*Q = D2*R. D1 has alpha on its diagonal and D2 has beta on its diagonal. If jobu = U, the orthogonal/unitary matrix U is computed. If jobv = V the orthogonal/unitary matrix V is computed. If jobq = Q, the orthogonal/unitary matrix Q is computed. If jobu, jobv or jobq is N, that matrix is not computed. This function is only available in LAPACK versions prior to 3.6.0.

    LinearAlgebra.LAPACK.ggsvd3!Function
    ggsvd3!(jobu, jobv, jobq, A, B) -> (U, V, Q, alpha, beta, k, l, R)

    Finds the generalized singular value decomposition of A and B, U'*A*Q = D1*R and V'*B*Q = D2*R. D1 has alpha on its diagonal and D2 has beta on its diagonal. If jobu = U, the orthogonal/unitary matrix U is computed. If jobv = V the orthogonal/unitary matrix V is computed. If jobq = Q, the orthogonal/unitary matrix Q is computed. If jobu, jobv, or jobq is N, that matrix is not computed. This function requires LAPACK 3.6.0.

    LinearAlgebra.LAPACK.geevx!Function
    geevx!(balanc, jobvl, jobvr, sense, A) -> (A, w, VL, VR, ilo, ihi, scale, abnrm, rconde, rcondv)

    Finds the eigensystem of A with matrix balancing. If jobvl = N, the left eigenvectors of A aren't computed. If jobvr = N, the right eigenvectors of A aren't computed. If jobvl = V or jobvr = V, the corresponding eigenvectors are computed. If balanc = N, no balancing is performed. If balanc = P, A is permuted but not scaled. If balanc = S, A is scaled but not permuted. If balanc = B, A is permuted and scaled. If sense = N, no reciprocal condition numbers are computed. If sense = E, reciprocal condition numbers are computed for the eigenvalues only. If sense = V, reciprocal condition numbers are computed for the right eigenvectors only. If sense = B, reciprocal condition numbers are computed for the right eigenvectors and the eigenvectors. If sense = E,B, the right and left eigenvectors must be computed.

    LinearAlgebra.LAPACK.ggev!Function
    ggev!(jobvl, jobvr, A, B) -> (alpha, beta, vl, vr)

    Finds the generalized eigendecomposition of A and B. If jobvl = N, the left eigenvectors aren't computed. If jobvr = N, the right eigenvectors aren't computed. If jobvl = V or jobvr = V, the corresponding eigenvectors are computed.

    LinearAlgebra.LAPACK.ggev3!Function
    ggev3!(jobvl, jobvr, A, B) -> (alpha, beta, vl, vr)

    Finds the generalized eigendecomposition of A and B using a blocked algorithm. If jobvl = N, the left eigenvectors aren't computed. If jobvr = N, the right eigenvectors aren't computed. If jobvl = V or jobvr = V, the corresponding eigenvectors are computed. This function requires LAPACK 3.6.0.

    LinearAlgebra.LAPACK.gtsv!Function
    gtsv!(dl, d, du, B)

    Solves the equation A * X = B where A is a tridiagonal matrix with dl on the subdiagonal, d on the diagonal, and du on the superdiagonal.

    Overwrites B with the solution X and returns it.

    LinearAlgebra.LAPACK.gttrf!Function
    gttrf!(dl, d, du) -> (dl, d, du, du2, ipiv)

    Finds the LU factorization of a tridiagonal matrix with dl on the subdiagonal, d on the diagonal, and du on the superdiagonal.

    Modifies dl, d, and du in-place and returns them and the second superdiagonal du2 and the pivoting vector ipiv.

    LinearAlgebra.LAPACK.gttrs!Function
    gttrs!(trans, dl, d, du, du2, ipiv, B)

    Solves the equation A * X = B (trans = N), transpose(A) * X = B (trans = T), or adjoint(A) * X = B (trans = C) using the LU factorization computed by gttrf!. B is overwritten with the solution X.

    LinearAlgebra.LAPACK.orglq!Function
    orglq!(A, tau, k = length(tau))

    Explicitly finds the matrix Q of a LQ factorization after calling gelqf! on A. Uses the output of gelqf!. A is overwritten by Q.

    LinearAlgebra.LAPACK.orgqr!Function
    orgqr!(A, tau, k = length(tau))

    Explicitly finds the matrix Q of a QR factorization after calling geqrf! on A. Uses the output of geqrf!. A is overwritten by Q.

    LinearAlgebra.LAPACK.orgql!Function
    orgql!(A, tau, k = length(tau))

    Explicitly finds the matrix Q of a QL factorization after calling geqlf! on A. Uses the output of geqlf!. A is overwritten by Q.

    LinearAlgebra.LAPACK.orgrq!Function
    orgrq!(A, tau, k = length(tau))

    Explicitly finds the matrix Q of a RQ factorization after calling gerqf! on A. Uses the output of gerqf!. A is overwritten by Q.

    LinearAlgebra.LAPACK.ormlq!Function
    ormlq!(side, trans, A, tau, C)

    Computes Q * C (trans = N), transpose(Q) * C (trans = T), adjoint(Q) * C (trans = C) for side = L or the equivalent right-sided multiplication for side = R using Q from a LQ factorization of A computed using gelqf!. C is overwritten.

    LinearAlgebra.LAPACK.ormqr!Function
    ormqr!(side, trans, A, tau, C)

    Computes Q * C (trans = N), transpose(Q) * C (trans = T), adjoint(Q) * C (trans = C) for side = L or the equivalent right-sided multiplication for side = R using Q from a QR factorization of A computed using geqrf!. C is overwritten.

    LinearAlgebra.LAPACK.ormql!Function
    ormql!(side, trans, A, tau, C)

    Computes Q * C (trans = N), transpose(Q) * C (trans = T), adjoint(Q) * C (trans = C) for side = L or the equivalent right-sided multiplication for side = R using Q from a QL factorization of A computed using geqlf!. C is overwritten.

    LinearAlgebra.LAPACK.ormrq!Function
    ormrq!(side, trans, A, tau, C)

    Computes Q * C (trans = N), transpose(Q) * C (trans = T), adjoint(Q) * C (trans = C) for side = L or the equivalent right-sided multiplication for side = R using Q from a RQ factorization of A computed using gerqf!. C is overwritten.

    LinearAlgebra.LAPACK.gemqrt!Function
    gemqrt!(side, trans, V, T, C)

    Computes Q * C (trans = N), transpose(Q) * C (trans = T), adjoint(Q) * C (trans = C) for side = L or the equivalent right-sided multiplication for side = R using Q from a QR factorization of A computed using geqrt!. C is overwritten.

    LinearAlgebra.LAPACK.posv!Function
    posv!(uplo, A, B) -> (A, B)

    Finds the solution to A * X = B where A is a symmetric or Hermitian positive definite matrix. If uplo = U the upper Cholesky decomposition of A is computed. If uplo = L the lower Cholesky decomposition of A is computed. A is overwritten by its Cholesky decomposition. B is overwritten with the solution X.

    LinearAlgebra.LAPACK.potrf!Function
    potrf!(uplo, A)

    Computes the Cholesky (upper if uplo = U, lower if uplo = L) decomposition of positive-definite matrix A. A is overwritten and returned with an info code.

    LinearAlgebra.LAPACK.potri!Function
    potri!(uplo, A)

    Computes the inverse of positive-definite matrix A after calling potrf! to find its (upper if uplo = U, lower if uplo = L) Cholesky decomposition.

    A is overwritten by its inverse and returned.

    LinearAlgebra.LAPACK.potrs!Function
    potrs!(uplo, A, B)

    Finds the solution to A * X = B where A is a symmetric or Hermitian positive definite matrix whose Cholesky decomposition was computed by potrf!. If uplo = U the upper Cholesky decomposition of A was computed. If uplo = L the lower Cholesky decomposition of A was computed. B is overwritten with the solution X.

    LinearAlgebra.LAPACK.pstrf!Function
    pstrf!(uplo, A, tol) -> (A, piv, rank, info)

    Computes the (upper if uplo = U, lower if uplo = L) pivoted Cholesky decomposition of positive-definite matrix A with a user-set tolerance tol. A is overwritten by its Cholesky decomposition.

    Returns A, the pivots piv, the rank of A, and an info code. If info = 0, the factorization succeeded. If info = i > 0, then A is indefinite or rank-deficient.

    LinearAlgebra.LAPACK.ptsv!Function
    ptsv!(D, E, B)

    Solves A * X = B for positive-definite tridiagonal A. D is the diagonal of A and E is the off-diagonal. B is overwritten with the solution X and returned.

    LinearAlgebra.LAPACK.pttrf!Function
    pttrf!(D, E)

    Computes the LDLt factorization of a positive-definite tridiagonal matrix with D as diagonal and E as off-diagonal. D and E are overwritten and returned.

    LinearAlgebra.LAPACK.pttrs!Function
    pttrs!(D, E, B)

    Solves A * X = B for positive-definite tridiagonal A with diagonal D and off-diagonal E after computing A's LDLt factorization using pttrf!. B is overwritten with the solution X.

    LinearAlgebra.LAPACK.trtri!Function
    trtri!(uplo, diag, A)

    Finds the inverse of (upper if uplo = U, lower if uplo = L) triangular matrix A. If diag = N, A has non-unit diagonal elements. If diag = U, all diagonal elements of A are one. A is overwritten with its inverse.

    LinearAlgebra.LAPACK.trtrs!Function
    trtrs!(uplo, trans, diag, A, B)

    Solves A * X = B (trans = N), transpose(A) * X = B (trans = T), or adjoint(A) * X = B (trans = C) for (upper if uplo = U, lower if uplo = L) triangular matrix A. If diag = N, A has non-unit diagonal elements. If diag = U, all diagonal elements of A are one. B is overwritten with the solution X.

    LinearAlgebra.LAPACK.trcon!Function
    trcon!(norm, uplo, diag, A)

    Finds the reciprocal condition number of (upper if uplo = U, lower if uplo = L) triangular matrix A. If diag = N, A has non-unit diagonal elements. If diag = U, all diagonal elements of A are one. If norm = I, the condition number is found in the infinity norm. If norm = O or 1, the condition number is found in the one norm.

    LinearAlgebra.LAPACK.trevc!Function
    trevc!(side, howmny, select, T, VL = similar(T), VR = similar(T))

    Finds the eigensystem of an upper triangular matrix T. If side = R, the right eigenvectors are computed. If side = L, the left eigenvectors are computed. If side = B, both sets are computed. If howmny = A, all eigenvectors are found. If howmny = B, all eigenvectors are found and backtransformed using VL and VR. If howmny = S, only the eigenvectors corresponding to the values in select are computed.

    LinearAlgebra.LAPACK.trrfs!Function
    trrfs!(uplo, trans, diag, A, B, X, Ferr, Berr) -> (Ferr, Berr)

    Estimates the error in the solution to A * X = B (trans = N), transpose(A) * X = B (trans = T), adjoint(A) * X = B (trans = C) for side = L, or the equivalent equations a right-handed side = R X * A after computing X using trtrs!. If uplo = U, A is upper triangular. If uplo = L, A is lower triangular. If diag = N, A has non-unit diagonal elements. If diag = U, all diagonal elements of A are one. Ferr and Berr are optional inputs. Ferr is the forward error and Berr is the backward error, each component-wise.

    LinearAlgebra.LAPACK.stev!Function
    stev!(job, dv, ev) -> (dv, Zmat)

    Computes the eigensystem for a symmetric tridiagonal matrix with dv as diagonal and ev as off-diagonal. If job = N only the eigenvalues are found and returned in dv. If job = V then the eigenvectors are also found and returned in Zmat.

    LinearAlgebra.LAPACK.stebz!Function
    stebz!(range, order, vl, vu, il, iu, abstol, dv, ev) -> (dv, iblock, isplit)

    Computes the eigenvalues for a symmetric tridiagonal matrix with dv as diagonal and ev as off-diagonal. If range = A, all the eigenvalues are found. If range = V, the eigenvalues in the half-open interval (vl, vu] are found. If range = I, the eigenvalues with indices between il and iu are found. If order = B, eigvalues are ordered within a block. If order = E, they are ordered across all the blocks. abstol can be set as a tolerance for convergence.

    LinearAlgebra.LAPACK.stegr!Function
    stegr!(jobz, range, dv, ev, vl, vu, il, iu) -> (w, Z)

    Computes the eigenvalues (jobz = N) or eigenvalues and eigenvectors (jobz = V) for a symmetric tridiagonal matrix with dv as diagonal and ev as off-diagonal. If range = A, all the eigenvalues are found. If range = V, the eigenvalues in the half-open interval (vl, vu] are found. If range = I, the eigenvalues with indices between il and iu are found. The eigenvalues are returned in w and the eigenvectors in Z.

    LinearAlgebra.LAPACK.stein!Function
    stein!(dv, ev_in, w_in, iblock_in, isplit_in)

    Computes the eigenvectors for a symmetric tridiagonal matrix with dv as diagonal and ev_in as off-diagonal. w_in specifies the input eigenvalues for which to find corresponding eigenvectors. iblock_in specifies the submatrices corresponding to the eigenvalues in w_in. isplit_in specifies the splitting points between the submatrix blocks.

    LinearAlgebra.LAPACK.syconv!Function
    syconv!(uplo, A, ipiv) -> (A, work)

    Converts a symmetric matrix A (which has been factorized into a triangular matrix) into two matrices L and D. If uplo = U, A is upper triangular. If uplo = L, it is lower triangular. ipiv is the pivot vector from the triangular factorization. A is overwritten by L and D.

    LinearAlgebra.LAPACK.sysv!Function
    sysv!(uplo, A, B) -> (B, A, ipiv)

    Finds the solution to A * X = B for symmetric matrix A. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored. B is overwritten by the solution X. A is overwritten by its Bunch-Kaufman factorization. ipiv contains pivoting information about the factorization.

    LinearAlgebra.LAPACK.sytrf!Function
    sytrf!(uplo, A) -> (A, ipiv, info)

    Computes the Bunch-Kaufman factorization of a symmetric matrix A. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored.

    Returns A, overwritten by the factorization, a pivot vector ipiv, and the error code info which is a non-negative integer. If info is positive the matrix is singular and the diagonal part of the factorization is exactly zero at position info.

    sytrf!(uplo, A, ipiv) -> (A, ipiv, info)

    Computes the Bunch-Kaufman factorization of a symmetric matrix A. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored.

    Returns A, overwritten by the factorization, the pivot vector ipiv, and the error code info which is a non-negative integer. If info is positive the matrix is singular and the diagonal part of the factorization is exactly zero at position info.

    LinearAlgebra.LAPACK.sytri!Function
    sytri!(uplo, A, ipiv)

    Computes the inverse of a symmetric matrix A using the results of sytrf!. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored. A is overwritten by its inverse.

    LinearAlgebra.LAPACK.sytrs!Function
    sytrs!(uplo, A, ipiv, B)

    Solves the equation A * X = B for a symmetric matrix A using the results of sytrf!. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored. B is overwritten by the solution X.

    LinearAlgebra.LAPACK.hesv!Function
    hesv!(uplo, A, B) -> (B, A, ipiv)

    Finds the solution to A * X = B for Hermitian matrix A. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored. B is overwritten by the solution X. A is overwritten by its Bunch-Kaufman factorization. ipiv contains pivoting information about the factorization.

    LinearAlgebra.LAPACK.hetrf!Function
    hetrf!(uplo, A) -> (A, ipiv, info)

    Computes the Bunch-Kaufman factorization of a Hermitian matrix A. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored.

    Returns A, overwritten by the factorization, a pivot vector ipiv, and the error code info which is a non-negative integer. If info is positive the matrix is singular and the diagonal part of the factorization is exactly zero at position info.

    hetrf!(uplo, A, ipiv) -> (A, ipiv, info)

    Computes the Bunch-Kaufman factorization of a Hermitian matrix A. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored.

    Returns A, overwritten by the factorization, the pivot vector ipiv, and the error code info which is a non-negative integer. If info is positive the matrix is singular and the diagonal part of the factorization is exactly zero at position info.

    LinearAlgebra.LAPACK.hetri!Function
    hetri!(uplo, A, ipiv)

    Computes the inverse of a Hermitian matrix A using the results of sytrf!. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored. A is overwritten by its inverse.

    LinearAlgebra.LAPACK.hetrs!Function
    hetrs!(uplo, A, ipiv, B)

    Solves the equation A * X = B for a Hermitian matrix A using the results of sytrf!. If uplo = U, the upper half of A is stored. If uplo = L, the lower half is stored. B is overwritten by the solution X.

    LinearAlgebra.LAPACK.syev!Function
    syev!(jobz, uplo, A)

    Finds the eigenvalues (jobz = N) or eigenvalues and eigenvectors (jobz = V) of a symmetric matrix A. If uplo = U, the upper triangle of A is used. If uplo = L, the lower triangle of A is used.

    LinearAlgebra.LAPACK.syevr!Function
    syevr!(jobz, range, uplo, A, vl, vu, il, iu, abstol) -> (W, Z)

    Finds the eigenvalues (jobz = N) or eigenvalues and eigenvectors (jobz = V) of a symmetric matrix A. If uplo = U, the upper triangle of A is used. If uplo = L, the lower triangle of A is used. If range = A, all the eigenvalues are found. If range = V, the eigenvalues in the half-open interval (vl, vu] are found. If range = I, the eigenvalues with indices between il and iu are found. abstol can be set as a tolerance for convergence.

    The eigenvalues are returned in W and the eigenvectors in Z.

    LinearAlgebra.LAPACK.syevd!Function
    syevd!(jobz, uplo, A)

    Finds the eigenvalues (jobz = N) or eigenvalues and eigenvectors (jobz = V) of a symmetric matrix A. If uplo = U, the upper triangle of A is used. If uplo = L, the lower triangle of A is used.

    LinearAlgebra.LAPACK.sygvd!Function
    sygvd!(itype, jobz, uplo, A, B) -> (w, A, B)

    Finds the generalized eigenvalues (jobz = N) or eigenvalues and eigenvectors (jobz = V) of a symmetric matrix A and symmetric positive-definite matrix B. If uplo = U, the upper triangles of A and B are used. If uplo = L, the lower triangles of A and B are used. If itype = 1, the problem to solve is A * x = lambda * B * x. If itype = 2, the problem to solve is A * B * x = lambda * x. If itype = 3, the problem to solve is B * A * x = lambda * x.

    LinearAlgebra.LAPACK.bdsqr!Function
    bdsqr!(uplo, d, e_, Vt, U, C) -> (d, Vt, U, C)

    Computes the singular value decomposition of a bidiagonal matrix with d on the diagonal and e_ on the off-diagonal. If uplo = U, e_ is the superdiagonal. If uplo = L, e_ is the subdiagonal. Can optionally also compute the product Q' * C.

    Returns the singular values in d, and the matrix C overwritten with Q' * C.

    LinearAlgebra.LAPACK.bdsdc!Function
    bdsdc!(uplo, compq, d, e_) -> (d, e, u, vt, q, iq)

    Computes the singular value decomposition of a bidiagonal matrix with d on the diagonal and e_ on the off-diagonal using a divide and conqueq method. If uplo = U, e_ is the superdiagonal. If uplo = L, e_ is the subdiagonal. If compq = N, only the singular values are found. If compq = I, the singular values and vectors are found. If compq = P, the singular values and vectors are found in compact form. Only works for real types.

    Returns the singular values in d, and if compq = P, the compact singular vectors in iq.

    LinearAlgebra.LAPACK.gecon!Function
    gecon!(normtype, A, anorm)

    Finds the reciprocal condition number of matrix A. If normtype = I, the condition number is found in the infinity norm. If normtype = O or 1, the condition number is found in the one norm. A must be the result of getrf! and anorm is the norm of A in the relevant norm.

    LinearAlgebra.LAPACK.gehrd!Function
    gehrd!(ilo, ihi, A) -> (A, tau)

    Converts a matrix A to Hessenberg form. If A is balanced with gebal! then ilo and ihi are the outputs of gebal!. Otherwise they should be ilo = 1 and ihi = size(A,2). tau contains the elementary reflectors of the factorization.

    LinearAlgebra.LAPACK.orghr!Function
    orghr!(ilo, ihi, A, tau)

    Explicitly finds Q, the orthogonal/unitary matrix from gehrd!. ilo, ihi, A, and tau must correspond to the input/output to gehrd!.

    LinearAlgebra.LAPACK.gees!Function
    gees!(jobvs, A) -> (A, vs, w)

    Computes the eigenvalues (jobvs = N) or the eigenvalues and Schur vectors (jobvs = V) of matrix A. A is overwritten by its Schur form.

    Returns A, vs containing the Schur vectors, and w, containing the eigenvalues.

    LinearAlgebra.LAPACK.gges!Function
    gges!(jobvsl, jobvsr, A, B) -> (A, B, alpha, beta, vsl, vsr)

    Computes the generalized eigenvalues, generalized Schur form, left Schur vectors (jobsvl = V), or right Schur vectors (jobvsr = V) of A and B.

    The generalized eigenvalues are returned in alpha and beta. The left Schur vectors are returned in vsl and the right Schur vectors are returned in vsr.

    LinearAlgebra.LAPACK.gges3!Function
    gges3!(jobvsl, jobvsr, A, B) -> (A, B, alpha, beta, vsl, vsr)

    Computes the generalized eigenvalues, generalized Schur form, left Schur vectors (jobsvl = V), or right Schur vectors (jobvsr = V) of A and B using a blocked algorithm. This function requires LAPACK 3.6.0.

    The generalized eigenvalues are returned in alpha and beta. The left Schur vectors are returned in vsl and the right Schur vectors are returned in vsr.

    LinearAlgebra.LAPACK.trexc!Function
    trexc!(compq, ifst, ilst, T, Q) -> (T, Q)
     trexc!(ifst, ilst, T, Q) -> (T, Q)

    Reorder the Schur factorization T of a matrix, such that the diagonal block of T with row index ifst is moved to row index ilst. If compq = V, the Schur vectors Q are reordered. If compq = N they are not modified. The 4-arg method calls the 5-arg method with compq = V.

    LinearAlgebra.LAPACK.trsen!Function
    trsen!(job, compq, select, T, Q) -> (T, Q, w, s, sep)
    -trsen!(select, T, Q) -> (T, Q, w, s, sep)

    Reorder the Schur factorization of a matrix and optionally finds reciprocal condition numbers. If job = N, no condition numbers are found. If job = E, only the condition number for this cluster of eigenvalues is found. If job = V, only the condition number for the invariant subspace is found. If job = B then the condition numbers for the cluster and subspace are found. If compq = V the Schur vectors Q are updated. If compq = N the Schur vectors are not modified. select determines which eigenvalues are in the cluster. The 3-arg method calls the 5-arg method with job = N and compq = V.

    Returns T, Q, reordered eigenvalues in w, the condition number of the cluster of eigenvalues s, and the condition number of the invariant subspace sep.

    LinearAlgebra.LAPACK.tgsen!Function
    tgsen!(select, S, T, Q, Z) -> (S, T, alpha, beta, Q, Z)

    Reorders the vectors of a generalized Schur decomposition. select specifies the eigenvalues in each cluster.

    LinearAlgebra.LAPACK.trsyl!Function
    trsyl!(transa, transb, A, B, C, isgn=1) -> (C, scale)

    Solves the Sylvester matrix equation A * X +/- X * B = scale*C where A and B are both quasi-upper triangular. If transa = N, A is not modified. If transa = T, A is transposed. If transa = C, A is conjugate transposed. Similarly for transb and B. If isgn = 1, the equation A * X + X * B = scale * C is solved. If isgn = -1, the equation A * X - X * B = scale * C is solved.

    Returns X (overwriting C) and scale.

    LinearAlgebra.LAPACK.hseqr!Function
    hseqr!(job, compz, ilo, ihi, H, Z) -> (H, Z, w)

    Computes all eigenvalues and (optionally) the Schur factorization of a matrix reduced to Hessenberg form. If H is balanced with gebal! then ilo and ihi are the outputs of gebal!. Otherwise they should be ilo = 1 and ihi = size(H,2). tau contains the elementary reflectors of the factorization.

    Developer Documentation

    LinearAlgebra.matprod_destFunction
    matprod_dest(A, B, T)

    Return an appropriate AbstractArray with element type T that may be used to store the result of A * B.

    Compat

    This function requires at least Julia 1.11

    LinearAlgebra.haszeroFunction
    haszero(T::Type)

    Return whether a type T has a unique zero element defined using zero(T). If a type M specializes zero(M), it may also choose to set haszero(M) to true. By default, haszero is assumed to be false, in which case the zero elements are deduced from values rather than the type.

    Note

    haszero is a conservative check that is used to dispatch to optimized paths. Extending it is optional, but encouraged.

    +trsen!(select, T, Q) -> (T, Q, w, s, sep)

    Reorder the Schur factorization of a matrix and optionally finds reciprocal condition numbers. If job = N, no condition numbers are found. If job = E, only the condition number for this cluster of eigenvalues is found. If job = V, only the condition number for the invariant subspace is found. If job = B then the condition numbers for the cluster and subspace are found. If compq = V the Schur vectors Q are updated. If compq = N the Schur vectors are not modified. select determines which eigenvalues are in the cluster. The 3-arg method calls the 5-arg method with job = N and compq = V.

    Returns T, Q, reordered eigenvalues in w, the condition number of the cluster of eigenvalues s, and the condition number of the invariant subspace sep.

    LinearAlgebra.LAPACK.tgsen!Function
    tgsen!(select, S, T, Q, Z) -> (S, T, alpha, beta, Q, Z)

    Reorders the vectors of a generalized Schur decomposition. select specifies the eigenvalues in each cluster.

    LinearAlgebra.LAPACK.trsyl!Function
    trsyl!(transa, transb, A, B, C, isgn=1) -> (C, scale)

    Solves the Sylvester matrix equation A * X +/- X * B = scale*C where A and B are both quasi-upper triangular. If transa = N, A is not modified. If transa = T, A is transposed. If transa = C, A is conjugate transposed. Similarly for transb and B. If isgn = 1, the equation A * X + X * B = scale * C is solved. If isgn = -1, the equation A * X - X * B = scale * C is solved.

    Returns X (overwriting C) and scale.

    LinearAlgebra.LAPACK.hseqr!Function
    hseqr!(job, compz, ilo, ihi, H, Z) -> (H, Z, w)

    Computes all eigenvalues and (optionally) the Schur factorization of a matrix reduced to Hessenberg form. If H is balanced with gebal! then ilo and ihi are the outputs of gebal!. Otherwise they should be ilo = 1 and ihi = size(H,2). tau contains the elementary reflectors of the factorization.

    Developer Documentation

    LinearAlgebra.matprod_destFunction
    matprod_dest(A, B, T)

    Return an appropriate AbstractArray with element type T that may be used to store the result of A * B.

    Compat

    This function requires at least Julia 1.11

    LinearAlgebra.haszeroFunction
    haszero(T::Type)

    Return whether a type T has a unique zero element defined using zero(T). If a type M specializes zero(M), it may also choose to set haszero(M) to true. By default, haszero is assumed to be false, in which case the zero elements are deduced from values rather than the type.

    Note

    haszero is a conservative check that is used to dispatch to optimized paths. Extending it is optional, but encouraged.

    diff --git a/en/v1.12-dev/stdlib/Logging/index.html b/en/v1.12-dev/stdlib/Logging/index.html index 5e84bc83152..8ac8b132a65 100644 --- a/en/v1.12-dev/stdlib/Logging/index.html +++ b/en/v1.12-dev/stdlib/Logging/index.html @@ -93,13 +93,13 @@ for i=1:10000 @info "With the default backend, you will only see (i = $i) ten times" maxlog=10 @debug "Algorithm1" i progress=i/10000 -endsource
    Logging.LogLevelType
    LogLevel(level)

    Severity/verbosity of a log record.

    The log level provides a key against which potential log records may be filtered, before any other work is done to construct the log record data structure itself.

    Examples

    julia> Logging.LogLevel(0) == Logging.Info
    -true
    source
    Logging.DebugConstant
    Debug

    Alias for LogLevel(-1000).

    Logging.InfoConstant
    Info

    Alias for LogLevel(0).

    Logging.WarnConstant
    Warn

    Alias for LogLevel(1000).

    Logging.ErrorConstant
    Error

    Alias for LogLevel(2000).

    Logging.BelowMinLevelConstant
    BelowMinLevel

    Alias for LogLevel(-1_000_001).

    Logging.AboveMaxLevelConstant
    AboveMaxLevel

    Alias for LogLevel(1_000_001).

    Processing events with AbstractLogger

    Event processing is controlled by overriding functions associated with AbstractLogger:

    Methods to implementBrief description
    Logging.handle_messageHandle a log event
    Logging.shouldlogEarly filtering of events
    Logging.min_enabled_levelLower bound for log level of accepted events
    Optional methodsDefault definitionBrief description
    Logging.catch_exceptionstrueCatch exceptions during event evaluation
    Logging.AbstractLoggerType

    A logger controls how log records are filtered and dispatched. When a log record is generated, the logger is the first piece of user configurable code which gets to inspect the record and decide what to do with it.

    source
    Logging.handle_messageFunction
    handle_message(logger, level, message, _module, group, id, file, line; key1=val1, ...)

    Log a message to logger at level. The logical location at which the message was generated is given by module _module and group; the source location by file and line. id is an arbitrary unique value (typically a Symbol) to be used as a key to identify the log statement when filtering.

    source
    Logging.shouldlogFunction
    shouldlog(logger, level, _module, group, id)

    Return true when logger accepts a message at level, generated for _module, group and with unique log identifier id.

    source
    Logging.min_enabled_levelFunction
    min_enabled_level(logger)

    Return the minimum enabled level for logger for early filtering. That is, the log level below or equal to which all messages are filtered.

    source
    Logging.catch_exceptionsFunction
    catch_exceptions(logger)

    Return true if the logger should catch exceptions which happen during log record construction. By default, messages are caught.

    By default all exceptions are caught to prevent log message generation from crashing the program. This lets users confidently toggle little-used functionality - such as debug logging - in a production system.

    If you want to use logging as an audit trail you should disable this for your logger type.

    source
    Logging.disable_loggingFunction
    disable_logging(level)

    Disable all log messages at log levels equal to or less than level. This is a global setting, intended to make debug logging extremely cheap when disabled.

    Examples

    Logging.disable_logging(Logging.Info) # Disable debug and info
    source

    Using Loggers

    Logger installation and inspection:

    Logging.global_loggerFunction
    global_logger()

    Return the global logger, used to receive messages when no specific logger exists for the current task.

    global_logger(logger)

    Set the global logger to logger, and return the previous global logger.

    source
    Logging.with_loggerFunction
    with_logger(function, logger)

    Execute function, directing all log messages to logger.

    Examples

    function test(x)
    +end
    source
    Logging.LogLevelType
    LogLevel(level)

    Severity/verbosity of a log record.

    The log level provides a key against which potential log records may be filtered, before any other work is done to construct the log record data structure itself.

    Examples

    julia> Logging.LogLevel(0) == Logging.Info
    +true
    source
    Logging.DebugConstant
    Debug

    Alias for LogLevel(-1000).

    Logging.InfoConstant
    Info

    Alias for LogLevel(0).

    Logging.WarnConstant
    Warn

    Alias for LogLevel(1000).

    Logging.ErrorConstant
    Error

    Alias for LogLevel(2000).

    Logging.BelowMinLevelConstant
    BelowMinLevel

    Alias for LogLevel(-1_000_001).

    Logging.AboveMaxLevelConstant
    AboveMaxLevel

    Alias for LogLevel(1_000_001).

    Processing events with AbstractLogger

    Event processing is controlled by overriding functions associated with AbstractLogger:

    Methods to implementBrief description
    Logging.handle_messageHandle a log event
    Logging.shouldlogEarly filtering of events
    Logging.min_enabled_levelLower bound for log level of accepted events
    Optional methodsDefault definitionBrief description
    Logging.catch_exceptionstrueCatch exceptions during event evaluation
    Logging.AbstractLoggerType

    A logger controls how log records are filtered and dispatched. When a log record is generated, the logger is the first piece of user configurable code which gets to inspect the record and decide what to do with it.

    source
    Logging.handle_messageFunction
    handle_message(logger, level, message, _module, group, id, file, line; key1=val1, ...)

    Log a message to logger at level. The logical location at which the message was generated is given by module _module and group; the source location by file and line. id is an arbitrary unique value (typically a Symbol) to be used as a key to identify the log statement when filtering.

    source
    Logging.shouldlogFunction
    shouldlog(logger, level, _module, group, id)

    Return true when logger accepts a message at level, generated for _module, group and with unique log identifier id.

    source
    Logging.min_enabled_levelFunction
    min_enabled_level(logger)

    Return the minimum enabled level for logger for early filtering. That is, the log level below or equal to which all messages are filtered.

    source
    Logging.catch_exceptionsFunction
    catch_exceptions(logger)

    Return true if the logger should catch exceptions which happen during log record construction. By default, messages are caught.

    By default all exceptions are caught to prevent log message generation from crashing the program. This lets users confidently toggle little-used functionality - such as debug logging - in a production system.

    If you want to use logging as an audit trail you should disable this for your logger type.

    source
    Logging.disable_loggingFunction
    disable_logging(level)

    Disable all log messages at log levels equal to or less than level. This is a global setting, intended to make debug logging extremely cheap when disabled.

    Examples

    Logging.disable_logging(Logging.Info) # Disable debug and info
    source

    Using Loggers

    Logger installation and inspection:

    Logging.global_loggerFunction
    global_logger()

    Return the global logger, used to receive messages when no specific logger exists for the current task.

    global_logger(logger)

    Set the global logger to logger, and return the previous global logger.

    source
    Logging.with_loggerFunction
    with_logger(function, logger)

    Execute function, directing all log messages to logger.

    Examples

    function test(x)
         @info "x = $x"
     end
     
     with_logger(logger) do
         test(1)
         test([1,2])
    -end
    source
    Logging.current_loggerFunction
    current_logger()

    Return the logger for the current task, or the global logger if none is attached to the task.

    source

    Loggers that are supplied with the system:

    Logging.NullLoggerType
    NullLogger()

    Logger which disables all messages and produces no output - the logger equivalent of /dev/null.

    source
    Base.CoreLogging.ConsoleLoggerType
    ConsoleLogger([stream,] min_level=Info; meta_formatter=default_metafmt,
    -              show_limited=true, right_justify=0)

    Logger with formatting optimized for readability in a text console, for example interactive work with the Julia REPL.

    Log levels less than min_level are filtered out.

    Message formatting can be controlled by setting keyword arguments:

    • meta_formatter is a function which takes the log event metadata (level, _module, group, id, file, line) and returns a color (as would be passed to printstyled), prefix and suffix for the log message. The default is to prefix with the log level and a suffix containing the module, file and line location.
    • show_limited limits the printing of large data structures to something which can fit on the screen by setting the :limit IOContext key during formatting.
    • right_justify is the integer column which log metadata is right justified at. The default is zero (metadata goes on its own line).
    source
    Logging.SimpleLoggerType
    SimpleLogger([stream,] min_level=Info)

    Simplistic logger for logging all messages with level greater than or equal to min_level to stream. If stream is closed then messages with log level greater or equal to Warn will be logged to stderr and below to stdout.

    source
    +endsource
    Logging.current_loggerFunction
    current_logger()

    Return the logger for the current task, or the global logger if none is attached to the task.

    source

    Loggers that are supplied with the system:

    Logging.NullLoggerType
    NullLogger()

    Logger which disables all messages and produces no output - the logger equivalent of /dev/null.

    source
    Base.CoreLogging.ConsoleLoggerType
    ConsoleLogger([stream,] min_level=Info; meta_formatter=default_metafmt,
    +              show_limited=true, right_justify=0)

    Logger with formatting optimized for readability in a text console, for example interactive work with the Julia REPL.

    Log levels less than min_level are filtered out.

    Message formatting can be controlled by setting keyword arguments:

    • meta_formatter is a function which takes the log event metadata (level, _module, group, id, file, line) and returns a color (as would be passed to printstyled), prefix and suffix for the log message. The default is to prefix with the log level and a suffix containing the module, file and line location.
    • show_limited limits the printing of large data structures to something which can fit on the screen by setting the :limit IOContext key during formatting.
    • right_justify is the integer column which log metadata is right justified at. The default is zero (metadata goes on its own line).
    source
    Logging.SimpleLoggerType
    SimpleLogger([stream,] min_level=Info)

    Simplistic logger for logging all messages with level greater than or equal to min_level to stream. If stream is closed then messages with log level greater or equal to Warn will be logged to stderr and below to stdout.

    source
    diff --git a/en/v1.12-dev/stdlib/Markdown/index.html b/en/v1.12-dev/stdlib/Markdown/index.html index 82d1230bb7c..dc12e70bbed 100644 --- a/en/v1.12-dev/stdlib/Markdown/index.html +++ b/en/v1.12-dev/stdlib/Markdown/index.html @@ -114,4 +114,4 @@ Markdown.MD
    Markdown.parseFunction
    parse(stream::IO) -> MD

    Parse the content of stream as Julia-flavored Markdown text and return the corresponding MD object.

    Markdown.parse(markdown::AbstractString) -> MD

    Parse markdown as Julia-flavored Markdown text and return the corresponding MD object.

    See also @md_str.

    Markdown.htmlFunction
    html([io::IO], md)

    Output the contents of the Markdown object md in HTML format, either writing to an (optional) io stream or returning a string.

    One can alternatively use show(io, "text/html", md) or repr("text/html", md), which differ in that they wrap the output in a <div class="markdown"> ... </div> element.

    Examples

    julia> html(md"hello _world_")
     "<p>hello <em>world</em></p>\n"
    Markdown.latexFunction
    latex([io::IO], md)

    Output the contents of the Markdown object md in LaTeX format, either writing to an (optional) io stream or returning a string.

    One can alternatively use show(io, "text/latex", md) or repr("text/latex", md).

    Examples

    julia> latex(md"hello _world_")
    -"hello \\emph{world}\n\n"
    +"hello \\emph{world}\n\n" diff --git a/en/v1.12-dev/stdlib/Mmap/index.html b/en/v1.12-dev/stdlib/Mmap/index.html index e22fd1e4f73..877cb638496 100644 --- a/en/v1.12-dev/stdlib/Mmap/index.html +++ b/en/v1.12-dev/stdlib/Mmap/index.html @@ -55,4 +55,4 @@ julia> close(io) -julia> rm("mmap.bin")

    This creates a 25-by-30000 BitArray, linked to the file associated with stream io.

    Mmap.sync!Function
    Mmap.sync!(array)

    Forces synchronization between the in-memory version of a memory-mapped Array or BitArray and the on-disk version.

    +julia> rm("mmap.bin")

    This creates a 25-by-30000 BitArray, linked to the file associated with stream io.

    Mmap.sync!Function
    Mmap.sync!(array)

    Forces synchronization between the in-memory version of a memory-mapped Array or BitArray and the on-disk version.

    diff --git a/en/v1.12-dev/stdlib/NetworkOptions/index.html b/en/v1.12-dev/stdlib/NetworkOptions/index.html index 398f4640216..5caf3ad757f 100644 --- a/en/v1.12-dev/stdlib/NetworkOptions/index.html +++ b/en/v1.12-dev/stdlib/NetworkOptions/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Network Options

    NetworkOptions.ca_rootsFunction
    ca_roots() :: Union{Nothing, String}

    The ca_roots() function tells the caller where, if anywhere, to find a file or directory of PEM-encoded certificate authority roots. By default, on systems like Windows and macOS where the built-in TLS engines know how to verify hosts using the system's built-in certificate verification mechanism, this function will return nothing. On classic UNIX systems (excluding macOS), root certificates are typically stored in a file in /etc: the common places for the current UNIX system will be searched and if one of these paths exists, it will be returned; if none of these typical root certificate paths exist, then the path to the set of root certificates that are bundled with Julia is returned.

    The default value returned by ca_roots() may be overridden by setting the JULIA_SSL_CA_ROOTS_PATH, SSL_CERT_DIR, or SSL_CERT_FILE environment variables, in which case this function will always return the value of the first of these variables that is set (whether the path exists or not). If JULIA_SSL_CA_ROOTS_PATH is set to the empty string, then the other variables are ignored (as if unset); if the other variables are set to the empty string, they behave is if they are not set.

    NetworkOptions.ca_roots_pathFunction
    ca_roots_path() :: String

    The ca_roots_path() function is similar to the ca_roots() function except that it always returns a path to a file or directory of PEM-encoded certificate authority roots. When called on a system like Windows or macOS, where system root certificates are not stored in the file system, it will currently return the path to the set of root certificates that are bundled with Julia. (In the future, this function may instead extract the root certificates from the system and save them to a file whose path would be returned.)

    If it is possible to configure a library that uses TLS to use the system certificates that is generally preferable: i.e. it is better to use ca_roots() which returns nothing to indicate that the system certs should be used. The ca_roots_path() function should only be used when configuring libraries which require a path to a file or directory for root certificates.

    The default value returned by ca_roots_path() may be overridden by setting the JULIA_SSL_CA_ROOTS_PATH, SSL_CERT_DIR, or SSL_CERT_FILE environment variables, in which case this function will always return the value of the first of these variables that is set (whether the path exists or not). If JULIA_SSL_CA_ROOTS_PATH is set to the empty string, then the other variables are ignored (as if unset); if the other variables are set to the empty string, they behave is if they are not set.

    NetworkOptions.ssh_dirFunction
    ssh_dir() :: String

    The ssh_dir() function returns the location of the directory where the ssh program keeps/looks for configuration files. By default this is ~/.ssh but this can be overridden by setting the environment variable SSH_DIR.

    NetworkOptions.ssh_key_passFunction
    ssh_key_pass() :: String

    The ssh_key_pass() function returns the value of the environment variable SSH_KEY_PASS if it is set or nothing if it is not set. In the future, this may be able to find a password by other means, such as secure system storage, so packages that need a password to decrypt an SSH private key should use this API instead of directly checking the environment variable so that they gain such capabilities automatically when they are added.

    NetworkOptions.ssh_key_nameFunction
    ssh_key_name() :: String

    The ssh_key_name() function returns the base name of key files that SSH should use for when establishing a connection. There is usually no reason that this function should be called directly and libraries should generally use the ssh_key_path and ssh_pub_key_path functions to get full paths. If the environment variable SSH_KEY_NAME is set then this function returns that; otherwise it returns id_rsa by default.

    NetworkOptions.ssh_key_pathFunction
    ssh_key_path() :: String

    The ssh_key_path() function returns the path of the SSH private key file that should be used for SSH connections. If the SSH_KEY_PATH environment variable is set then it will return that value. Otherwise it defaults to returning

    joinpath(ssh_dir(), ssh_key_name())

    This default value in turn depends on the SSH_DIR and SSH_KEY_NAME environment variables.

    NetworkOptions.ssh_pub_key_pathFunction
    ssh_pub_key_path() :: String

    The ssh_pub_key_path() function returns the path of the SSH public key file that should be used for SSH connections. If the SSH_PUB_KEY_PATH environment variable is set then it will return that value. If that isn't set but SSH_KEY_PATH is set, it will return that path with the .pub suffix appended. If neither is set, it defaults to returning

    joinpath(ssh_dir(), ssh_key_name() * ".pub")

    This default value in turn depends on the SSH_DIR and SSH_KEY_NAME environment variables.

    NetworkOptions.ssh_known_hosts_filesFunction
    ssh_known_hosts_files() :: Vector{String}

    The ssh_known_hosts_files() function returns a vector of paths of SSH known hosts files that should be used when establishing the identities of remote servers for SSH connections. By default this function returns

    [joinpath(ssh_dir(), "known_hosts"), bundled_known_hosts]

    where bundled_known_hosts is the path of a copy of a known hosts file that is bundled with this package (containing known hosts keys for github.com and gitlab.com). If the environment variable SSH_KNOWN_HOSTS_FILES is set, however, then its value is split into paths on the : character (or on ; on Windows) and this vector of paths is returned instead. If any component of this vector is empty, it is expanded to the default known hosts paths.

    Packages that use ssh_known_hosts_files() should ideally look for matching entries by comparing the host name and key types, considering the first entry in any of the files which matches to be the definitive identity of the host. If the caller cannot compare the key type (e.g. because it has been hashes) then it must approximate the above algorithm by looking for all matching entries for a host in each file: if a file has any entries for a host then one of them must match; the caller should only continue to search further known hosts files if there are no entries for the host in question in an earlier file.

    NetworkOptions.ssh_known_hosts_fileFunction
    ssh_known_hosts_file() :: String

    The ssh_known_hosts_file() function returns a single path of an SSH known hosts file that should be used when establishing the identities of remote servers for SSH connections. It returns the first path returned by ssh_known_hosts_files that actually exists. Callers who can look in more than one known hosts file should use ssh_known_hosts_files instead and look for host matches in all the files returned as described in that function's docs.

    NetworkOptions.verify_hostFunction
    verify_host(url::AbstractString, [transport::AbstractString]) :: Bool

    The verify_host function tells the caller whether the identity of a host should be verified when communicating over secure transports like TLS or SSH. The url argument may be:

    1. a proper URL staring with proto://
    2. an ssh-style bare host name or host name prefixed with user@
    3. an scp-style host as above, followed by : and a path location

    In each case the host name part is parsed out and the decision about whether to verify or not is made based solely on the host name, not anything else about the input URL. In particular, the protocol of the URL does not matter (more below).

    The transport argument indicates the kind of transport that the query is about. The currently known values are SSL/ssl (alias TLS/tls) and SSH/ssh. If the transport is omitted, the query will return true only if the host name should not be verified regardless of transport.

    The host name is matched against the host patterns in the relevant environment variables depending on whether transport is supplied and what its value is:

    • JULIA_NO_VERIFY_HOSTS — hosts that should not be verified for any transport
    • JULIA_SSL_NO_VERIFY_HOSTS — hosts that should not be verified for SSL/TLS
    • JULIA_SSH_NO_VERIFY_HOSTS — hosts that should not be verified for SSH
    • JULIA_ALWAYS_VERIFY_HOSTS — hosts that should always be verified

    The values of each of these variables is a comma-separated list of host name patterns with the following syntax — each pattern is split on . into parts and each part must one of:

    1. A literal domain name component consisting of one or more ASCII letter, digit, hyphen or underscore (technically not part of a legal host name, but sometimes used). A literal domain name component matches only itself.
    2. A **, which matches zero or more domain name components.
    3. A *, which match any one domain name component.

    When matching a host name against a pattern list in one of these variables, the host name is split on . into components and that sequence of words is matched against the pattern: a literal pattern matches exactly one host name component with that value; a * pattern matches exactly one host name component with any value; a ** pattern matches any number of host name components. For example:

    • ** matches any host name
    • **.org matches any host name in the .org top-level domain
    • example.com matches only the exact host name example.com
    • *.example.com matches api.example.com but not example.com or v1.api.example.com
    • **.example.com matches any domain under example.com, including example.com itself, api.example.com and v1.api.example.com
    +

    Network Options

    NetworkOptions.ca_rootsFunction
    ca_roots() :: Union{Nothing, String}

    The ca_roots() function tells the caller where, if anywhere, to find a file or directory of PEM-encoded certificate authority roots. By default, on systems like Windows and macOS where the built-in TLS engines know how to verify hosts using the system's built-in certificate verification mechanism, this function will return nothing. On classic UNIX systems (excluding macOS), root certificates are typically stored in a file in /etc: the common places for the current UNIX system will be searched and if one of these paths exists, it will be returned; if none of these typical root certificate paths exist, then the path to the set of root certificates that are bundled with Julia is returned.

    The default value returned by ca_roots() may be overridden by setting the JULIA_SSL_CA_ROOTS_PATH, SSL_CERT_DIR, or SSL_CERT_FILE environment variables, in which case this function will always return the value of the first of these variables that is set (whether the path exists or not). If JULIA_SSL_CA_ROOTS_PATH is set to the empty string, then the other variables are ignored (as if unset); if the other variables are set to the empty string, they behave is if they are not set.

    NetworkOptions.ca_roots_pathFunction
    ca_roots_path() :: String

    The ca_roots_path() function is similar to the ca_roots() function except that it always returns a path to a file or directory of PEM-encoded certificate authority roots. When called on a system like Windows or macOS, where system root certificates are not stored in the file system, it will currently return the path to the set of root certificates that are bundled with Julia. (In the future, this function may instead extract the root certificates from the system and save them to a file whose path would be returned.)

    If it is possible to configure a library that uses TLS to use the system certificates that is generally preferable: i.e. it is better to use ca_roots() which returns nothing to indicate that the system certs should be used. The ca_roots_path() function should only be used when configuring libraries which require a path to a file or directory for root certificates.

    The default value returned by ca_roots_path() may be overridden by setting the JULIA_SSL_CA_ROOTS_PATH, SSL_CERT_DIR, or SSL_CERT_FILE environment variables, in which case this function will always return the value of the first of these variables that is set (whether the path exists or not). If JULIA_SSL_CA_ROOTS_PATH is set to the empty string, then the other variables are ignored (as if unset); if the other variables are set to the empty string, they behave is if they are not set.

    NetworkOptions.ssh_dirFunction
    ssh_dir() :: String

    The ssh_dir() function returns the location of the directory where the ssh program keeps/looks for configuration files. By default this is ~/.ssh but this can be overridden by setting the environment variable SSH_DIR.

    NetworkOptions.ssh_key_passFunction
    ssh_key_pass() :: String

    The ssh_key_pass() function returns the value of the environment variable SSH_KEY_PASS if it is set or nothing if it is not set. In the future, this may be able to find a password by other means, such as secure system storage, so packages that need a password to decrypt an SSH private key should use this API instead of directly checking the environment variable so that they gain such capabilities automatically when they are added.

    NetworkOptions.ssh_key_nameFunction
    ssh_key_name() :: String

    The ssh_key_name() function returns the base name of key files that SSH should use for when establishing a connection. There is usually no reason that this function should be called directly and libraries should generally use the ssh_key_path and ssh_pub_key_path functions to get full paths. If the environment variable SSH_KEY_NAME is set then this function returns that; otherwise it returns id_rsa by default.

    NetworkOptions.ssh_key_pathFunction
    ssh_key_path() :: String

    The ssh_key_path() function returns the path of the SSH private key file that should be used for SSH connections. If the SSH_KEY_PATH environment variable is set then it will return that value. Otherwise it defaults to returning

    joinpath(ssh_dir(), ssh_key_name())

    This default value in turn depends on the SSH_DIR and SSH_KEY_NAME environment variables.

    NetworkOptions.ssh_pub_key_pathFunction
    ssh_pub_key_path() :: String

    The ssh_pub_key_path() function returns the path of the SSH public key file that should be used for SSH connections. If the SSH_PUB_KEY_PATH environment variable is set then it will return that value. If that isn't set but SSH_KEY_PATH is set, it will return that path with the .pub suffix appended. If neither is set, it defaults to returning

    joinpath(ssh_dir(), ssh_key_name() * ".pub")

    This default value in turn depends on the SSH_DIR and SSH_KEY_NAME environment variables.

    NetworkOptions.ssh_known_hosts_filesFunction
    ssh_known_hosts_files() :: Vector{String}

    The ssh_known_hosts_files() function returns a vector of paths of SSH known hosts files that should be used when establishing the identities of remote servers for SSH connections. By default this function returns

    [joinpath(ssh_dir(), "known_hosts"), bundled_known_hosts]

    where bundled_known_hosts is the path of a copy of a known hosts file that is bundled with this package (containing known hosts keys for github.com and gitlab.com). If the environment variable SSH_KNOWN_HOSTS_FILES is set, however, then its value is split into paths on the : character (or on ; on Windows) and this vector of paths is returned instead. If any component of this vector is empty, it is expanded to the default known hosts paths.

    Packages that use ssh_known_hosts_files() should ideally look for matching entries by comparing the host name and key types, considering the first entry in any of the files which matches to be the definitive identity of the host. If the caller cannot compare the key type (e.g. because it has been hashes) then it must approximate the above algorithm by looking for all matching entries for a host in each file: if a file has any entries for a host then one of them must match; the caller should only continue to search further known hosts files if there are no entries for the host in question in an earlier file.

    NetworkOptions.ssh_known_hosts_fileFunction
    ssh_known_hosts_file() :: String

    The ssh_known_hosts_file() function returns a single path of an SSH known hosts file that should be used when establishing the identities of remote servers for SSH connections. It returns the first path returned by ssh_known_hosts_files that actually exists. Callers who can look in more than one known hosts file should use ssh_known_hosts_files instead and look for host matches in all the files returned as described in that function's docs.

    NetworkOptions.verify_hostFunction
    verify_host(url::AbstractString, [transport::AbstractString]) :: Bool

    The verify_host function tells the caller whether the identity of a host should be verified when communicating over secure transports like TLS or SSH. The url argument may be:

    1. a proper URL staring with proto://
    2. an ssh-style bare host name or host name prefixed with user@
    3. an scp-style host as above, followed by : and a path location

    In each case the host name part is parsed out and the decision about whether to verify or not is made based solely on the host name, not anything else about the input URL. In particular, the protocol of the URL does not matter (more below).

    The transport argument indicates the kind of transport that the query is about. The currently known values are SSL/ssl (alias TLS/tls) and SSH/ssh. If the transport is omitted, the query will return true only if the host name should not be verified regardless of transport.

    The host name is matched against the host patterns in the relevant environment variables depending on whether transport is supplied and what its value is:

    • JULIA_NO_VERIFY_HOSTS — hosts that should not be verified for any transport
    • JULIA_SSL_NO_VERIFY_HOSTS — hosts that should not be verified for SSL/TLS
    • JULIA_SSH_NO_VERIFY_HOSTS — hosts that should not be verified for SSH
    • JULIA_ALWAYS_VERIFY_HOSTS — hosts that should always be verified

    The values of each of these variables is a comma-separated list of host name patterns with the following syntax — each pattern is split on . into parts and each part must one of:

    1. A literal domain name component consisting of one or more ASCII letter, digit, hyphen or underscore (technically not part of a legal host name, but sometimes used). A literal domain name component matches only itself.
    2. A **, which matches zero or more domain name components.
    3. A *, which match any one domain name component.

    When matching a host name against a pattern list in one of these variables, the host name is split on . into components and that sequence of words is matched against the pattern: a literal pattern matches exactly one host name component with that value; a * pattern matches exactly one host name component with any value; a ** pattern matches any number of host name components. For example:

    • ** matches any host name
    • **.org matches any host name in the .org top-level domain
    • example.com matches only the exact host name example.com
    • *.example.com matches api.example.com but not example.com or v1.api.example.com
    • **.example.com matches any domain under example.com, including example.com itself, api.example.com and v1.api.example.com
    diff --git a/en/v1.12-dev/stdlib/Pkg/index.html b/en/v1.12-dev/stdlib/Pkg/index.html index 84a12478060..7561a8c9cf0 100644 --- a/en/v1.12-dev/stdlib/Pkg/index.html +++ b/en/v1.12-dev/stdlib/Pkg/index.html @@ -32,4 +32,4 @@ (tutorial) pkg> status Status `~/tutorial/Project.toml` [7876af07] Example v0.5.3 - [682c06a0] JSON v0.21.3

    We can see that the tutorial environment now contains Example and JSON.

    Note

    If you have the same package (at the same version) installed in multiple environments, the package will only be downloaded and stored on the hard drive once. This makes environments very lightweight and effectively free to create. Using only the default environment with a huge number of packages in it is a common beginners mistake in Julia. Learning how to use environments effectively will improve your experience with Julia packages.

    For more information about environments, see the Working with Environments section of the documentation.

    If you are ever stuck, you can ask Pkg for help:

    (@v1.9) pkg> ?

    You should see a list of available commands along with short descriptions. You can ask for more detailed help by specifying a command:

    (@v1.9) pkg> ?develop

    This guide should help you get started with Pkg. Pkg has much more to offer in terms of powerful package management, read the full manual to learn more!

    + [682c06a0] JSON v0.21.3

    We can see that the tutorial environment now contains Example and JSON.

    Note

    If you have the same package (at the same version) installed in multiple environments, the package will only be downloaded and stored on the hard drive once. This makes environments very lightweight and effectively free to create. Using only the default environment with a huge number of packages in it is a common beginners mistake in Julia. Learning how to use environments effectively will improve your experience with Julia packages.

    For more information about environments, see the Working with Environments section of the documentation.

    If you are ever stuck, you can ask Pkg for help:

    (@v1.9) pkg> ?

    You should see a list of available commands along with short descriptions. You can ask for more detailed help by specifying a command:

    (@v1.9) pkg> ?develop

    This guide should help you get started with Pkg. Pkg has much more to offer in terms of powerful package management, read the full manual to learn more!

    diff --git a/en/v1.12-dev/stdlib/Printf/index.html b/en/v1.12-dev/stdlib/Printf/index.html index d64db37d804..6a31f7d30d1 100644 --- a/en/v1.12-dev/stdlib/Printf/index.html +++ b/en/v1.12-dev/stdlib/Printf/index.html @@ -31,4 +31,4 @@ julia> @printf "%.0f %.1f %f" 0.5 0.025 -0.0078125 0 0.0 -0.007812
    Julia 1.8

    Starting in Julia 1.8, %s (string) and %c (character) widths are computed using textwidth, which e.g. ignores zero-width characters (such as combining characters for diacritical marks) and treats certain "wide" characters (e.g. emoji) as width 2.

    Julia 1.10

    Dynamic width specifiers like %*s and %0*.*f require Julia 1.10.

    Printf.@sprintfMacro
    @sprintf("%Fmt", args...)

    Return @printf formatted output as string.

    Examples

    julia> @sprintf "this is a %s %15.1f" "test" 34.567
     "this is a test            34.6"
    Printf.FormatType
    Printf.Format(format_str)

    Create a C printf-compatible format object that can be used for formatting values.

    The input format_str can include any valid format specifier character and modifiers.

    A Format object can be passed to Printf.format(f::Format, args...) to produce a formatted string, or Printf.format(io::IO, f::Format, args...) to print the formatted string directly to io.

    For convenience, the Printf.format"..." string macro form can be used for building a Printf.Format object at macro-expansion-time.

    Julia 1.6

    Printf.Format requires Julia 1.6 or later.

    Printf.formatFunction
    Printf.format(f::Printf.Format, args...) => String
    -Printf.format(io::IO, f::Printf.Format, args...)

    Apply a printf format object f to provided args and return the formatted string (1st method), or print directly to an io object (2nd method). See @printf for more details on C printf support.

    +Printf.format(io::IO, f::Printf.Format, args...)

    Apply a printf format object f to provided args and return the formatted string (1st method), or print directly to an io object (2nd method). See @printf for more details on C printf support.

    diff --git a/en/v1.12-dev/stdlib/Profile/index.html b/en/v1.12-dev/stdlib/Profile/index.html index 295c4fc8fb1..452fd337fc1 100644 --- a/en/v1.12-dev/stdlib/Profile/index.html +++ b/en/v1.12-dev/stdlib/Profile/index.html @@ -55,4 +55,4 @@ julia> Profile.take_heap_snapshot("snapshot"; streaming=true)

    where "snapshot" is the filepath as the prefix for the generated files.

    Once the snapshot files are generated, they could be assembled offline with the following command:

    julia> using Profile
     
    -julia> Profile.HeapSnapshot.assemble_snapshot("snapshot", "snapshot.heapsnapshot")

    The resulting heap snapshot file can be uploaded to chrome devtools to be viewed. For more information, see the chrome devtools docs. An alternative for analyzing Chromium heap snapshots is with the VS Code extension ms-vscode.vscode-js-profile-flame.

    The Firefox heap snapshots are of a different format, and Firefox currently may not be used for viewing the heap snapshots generated by Julia.

    +julia> Profile.HeapSnapshot.assemble_snapshot("snapshot", "snapshot.heapsnapshot")

    The resulting heap snapshot file can be uploaded to chrome devtools to be viewed. For more information, see the chrome devtools docs. An alternative for analyzing Chromium heap snapshots is with the VS Code extension ms-vscode.vscode-js-profile-flame.

    The Firefox heap snapshots are of a different format, and Firefox currently may not be used for viewing the heap snapshots generated by Julia.

    diff --git a/en/v1.12-dev/stdlib/REPL/index.html b/en/v1.12-dev/stdlib/REPL/index.html index 3fccd144c48..dbc5dd663aa 100644 --- a/en/v1.12-dev/stdlib/REPL/index.html +++ b/en/v1.12-dev/stdlib/REPL/index.html @@ -10,8 +10,8 @@ (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | - | | |_| | | | (_| | | Version 1.12.0-DEV.1896 (2025-01-16) - _/ |\__'_|_|_|\__'_| | Commit 2dc3337626c (0 days old master) + | | |_| | | | (_| | | Version 1.12.0-DEV.1897 (2025-01-16) + _/ |\__'_|_|_|\__'_| | Commit b0ae24ffada (0 days old master) |__/ | @@ -339,7 +339,7 @@ YEP! orange NOPE grape ⧐ YEP! strawberry -↓ NOPE blueberry

    Aside from the overall charset option, for RadioMenu the configurable options are:

    MultiSelectMenu adds:

    You can create new menu types of your own. Types that are derived from TerminalMenus.ConfiguredMenu configure the menu options at construction time.

    Legacy interface

    Prior to Julia 1.6, and still supported throughout Julia 1.x, one can also configure menus by calling TerminalMenus.config().

    References

    REPL

    Base.atreplinitFunction
    atreplinit(f)

    Register a one-argument function to be called before the REPL interface is initialized in interactive sessions; this is useful to customize the interface. The argument of f is the REPL object. This function should be called from within the .julia/config/startup.jl initialization file.

    source

    TerminalMenus

    REPL.TerminalMenus.RadioMenuType
    RadioMenu

    A menu that allows a user to select a single option from a list.

    Sample Output

    julia> request(RadioMenu(options, pagesize=4))
    +↓  NOPE blueberry

    Aside from the overall charset option, for RadioMenu the configurable options are:

    • cursor::Char='>'|'→': character to use for cursor
    • up_arrow::Char='^'|'↑': character to use for up arrow
    • down_arrow::Char='v'|'↓': character to use for down arrow
    • updown_arrow::Char='I'|'↕': character to use for up/down arrow in one-line page
    • scroll_wrap::Bool=false: optionally wrap-around at the beginning/end of a menu
    • ctrl_c_interrupt::Bool=true: If false, return empty on ^C, if true throw InterruptException() on ^C

    MultiSelectMenu adds:

    • checked::String="[X]"|"✓": string to use for checked
    • unchecked::String="[ ]"|"⬚"): string to use for unchecked

    You can create new menu types of your own. Types that are derived from TerminalMenus.ConfiguredMenu configure the menu options at construction time.

    Legacy interface

    Prior to Julia 1.6, and still supported throughout Julia 1.x, one can also configure menus by calling TerminalMenus.config().

    References

    REPL

    Base.atreplinitFunction
    atreplinit(f)

    Register a one-argument function to be called before the REPL interface is initialized in interactive sessions; this is useful to customize the interface. The argument of f is the REPL object. This function should be called from within the .julia/config/startup.jl initialization file.

    source

    TerminalMenus

    REPL.TerminalMenus.RadioMenuType
    RadioMenu

    A menu that allows a user to select a single option from a list.

    Sample Output

    julia> request(RadioMenu(options, pagesize=4))
     Choose your favorite fruit:
     ^  grape
        strawberry
    @@ -359,4 +359,4 @@
     You like the following fruits:
       - orange
       - grape
    -  - peach

    Configuration

    REPL.TerminalMenus.ConfigType
    Config(; scroll_wrap=false, ctrl_c_interrupt=true, charset=:ascii, cursor::Char, up_arrow::Char, down_arrow::Char)

    Configure behavior for selection menus via keyword arguments:

    • scroll_wrap, if true, causes the menu to wrap around when scrolling above the first or below the last entry
    • ctrl_c_interrupt, if true, throws an InterruptException if the user hits Ctrl-C during menu selection. If false, TerminalMenus.request will return the default result from TerminalMenus.selected.
    • charset affects the default values for cursor, up_arrow, and down_arrow, and can be :ascii or :unicode
    • cursor is the character printed to indicate the option that will be chosen by hitting "Enter." Defaults are '>' or '→', depending on charset.
    • up_arrow is the character printed when the display does not include the first entry. Defaults are '^' or '↑', depending on charset.
    • down_arrow is the character printed when the display does not include the last entry. Defaults are 'v' or '↓', depending on charset.

    Subtypes of ConfiguredMenu will print cursor, up_arrow, and down_arrow automatically as needed, your writeline method should not print them.

    Julia 1.6

    Config is available as of Julia 1.6. On older releases use the global CONFIG.

    REPL.TerminalMenus.MultiSelectConfigType
    MultiSelectConfig(; charset=:ascii, checked::String, unchecked::String, kwargs...)

    Configure behavior for a multiple-selection menu via keyword arguments:

    • checked is the string to print when an option has been selected. Defaults are "[X]" or "✓", depending on charset.
    • unchecked is the string to print when an option has not been selected. Defaults are "[ ]" or "⬚", depending on charset.

    All other keyword arguments are as described for TerminalMenus.Config. checked and unchecked are not printed automatically, and should be printed by your writeline method.

    Julia 1.6

    MultiSelectConfig is available as of Julia 1.6. On older releases use the global CONFIG.

    REPL.TerminalMenus.configFunction
    config( <see arguments> )

    Keyword-only function to configure global menu parameters

    Arguments

    • charset::Symbol=:na: ui characters to use (:ascii or :unicode); overridden by other arguments
    • cursor::Char='>'|'→': character to use for cursor
    • up_arrow::Char='^'|'↑': character to use for up arrow
    • down_arrow::Char='v'|'↓': character to use for down arrow
    • checked::String="[X]"|"✓": string to use for checked
    • unchecked::String="[ ]"|"⬚"): string to use for unchecked
    • scroll::Symbol=:nowrap: If :wrap wrap cursor around top and bottom, if :nowrap do not wrap cursor
    • supress_output::Bool=false: Ignored legacy argument, pass suppress_output as a keyword argument to request instead.
    • ctrl_c_interrupt::Bool=true: If false, return empty on ^C, if true throw InterruptException() on ^C
    Julia 1.6

    As of Julia 1.6, config is deprecated. Use Config or MultiSelectConfig instead.

    User interaction

    REPL.TerminalMenus.requestFunction
    request(m::AbstractMenu; cursor=1)

    Display the menu and enter interactive mode. cursor indicates the item number used for the initial cursor position. cursor can be either an Int or a RefValue{Int}. The latter is useful for observation and control of the cursor position from the outside.

    Returns selected(m).

    Julia 1.6

    The cursor argument requires Julia 1.6 or later.

    request([term,] msg::AbstractString, m::AbstractMenu)

    Shorthand for println(msg); request(m).

    AbstractMenu extension interface

    Any subtype of AbstractMenu must be mutable, and must contain the fields pagesize::Int and pageoffset::Int. Any subtype must also implement the following functions:

    REPL.TerminalMenus.pickFunction
    pick(m::AbstractMenu, cursor::Int)

    Defines what happens when a user presses the Enter key while the menu is open. If true is returned, request() will exit. cursor indexes the position of the selection.

    REPL.TerminalMenus.cancelFunction
    cancel(m::AbstractMenu)

    Define what happens when a user cancels ('q' or ctrl-c) a menu. request() will always exit after calling this function.

    REPL.TerminalMenus.writelineFunction
    writeline(buf::IO, m::AbstractMenu, idx::Int, iscursor::Bool)

    Write the option at index idx to buf. iscursor, if true, indicates that this item is at the current cursor position (the one that will be selected by hitting "Enter").

    If m is a ConfiguredMenu, TerminalMenus will print the cursor indicator. Otherwise the callee is expected to handle such printing.

    Julia 1.6

    writeline requires Julia 1.6 or higher.

    On older versions of Julia, this was writeLine(buf::IO, m::AbstractMenu, idx, iscursor::Bool) and m is assumed to be unconfigured. The selection and cursor indicators can be obtained from TerminalMenus.CONFIG.

    This older function is supported on all Julia 1.x versions but will be dropped in Julia 2.0.

    It must also implement either options or numoptions:

    REPL.TerminalMenus.optionsFunction
    options(m::AbstractMenu)

    Return a list of strings to be displayed as options in the current page.

    Alternatively, implement numoptions, in which case options is not needed.

    REPL.TerminalMenus.numoptionsFunction
    numoptions(m::AbstractMenu) -> Int

    Return the number of options in menu m. Defaults to length(options(m)).

    Julia 1.6

    This function requires Julia 1.6 or later.

    If the subtype does not have a field named selected, it must also implement

    REPL.TerminalMenus.selectedFunction
    selected(m::AbstractMenu)

    Return information about the user-selected option. By default it returns m.selected.

    The following are optional but can allow additional customization:

    REPL.TerminalMenus.headerFunction
    header(m::AbstractMenu) -> String

    Return a header string to be printed above the menu. Defaults to "".

    + - peach

    Configuration

    REPL.TerminalMenus.ConfigType
    Config(; scroll_wrap=false, ctrl_c_interrupt=true, charset=:ascii, cursor::Char, up_arrow::Char, down_arrow::Char)

    Configure behavior for selection menus via keyword arguments:

    • scroll_wrap, if true, causes the menu to wrap around when scrolling above the first or below the last entry
    • ctrl_c_interrupt, if true, throws an InterruptException if the user hits Ctrl-C during menu selection. If false, TerminalMenus.request will return the default result from TerminalMenus.selected.
    • charset affects the default values for cursor, up_arrow, and down_arrow, and can be :ascii or :unicode
    • cursor is the character printed to indicate the option that will be chosen by hitting "Enter." Defaults are '>' or '→', depending on charset.
    • up_arrow is the character printed when the display does not include the first entry. Defaults are '^' or '↑', depending on charset.
    • down_arrow is the character printed when the display does not include the last entry. Defaults are 'v' or '↓', depending on charset.

    Subtypes of ConfiguredMenu will print cursor, up_arrow, and down_arrow automatically as needed, your writeline method should not print them.

    Julia 1.6

    Config is available as of Julia 1.6. On older releases use the global CONFIG.

    REPL.TerminalMenus.MultiSelectConfigType
    MultiSelectConfig(; charset=:ascii, checked::String, unchecked::String, kwargs...)

    Configure behavior for a multiple-selection menu via keyword arguments:

    • checked is the string to print when an option has been selected. Defaults are "[X]" or "✓", depending on charset.
    • unchecked is the string to print when an option has not been selected. Defaults are "[ ]" or "⬚", depending on charset.

    All other keyword arguments are as described for TerminalMenus.Config. checked and unchecked are not printed automatically, and should be printed by your writeline method.

    Julia 1.6

    MultiSelectConfig is available as of Julia 1.6. On older releases use the global CONFIG.

    REPL.TerminalMenus.configFunction
    config( <see arguments> )

    Keyword-only function to configure global menu parameters

    Arguments

    • charset::Symbol=:na: ui characters to use (:ascii or :unicode); overridden by other arguments
    • cursor::Char='>'|'→': character to use for cursor
    • up_arrow::Char='^'|'↑': character to use for up arrow
    • down_arrow::Char='v'|'↓': character to use for down arrow
    • checked::String="[X]"|"✓": string to use for checked
    • unchecked::String="[ ]"|"⬚"): string to use for unchecked
    • scroll::Symbol=:nowrap: If :wrap wrap cursor around top and bottom, if :nowrap do not wrap cursor
    • supress_output::Bool=false: Ignored legacy argument, pass suppress_output as a keyword argument to request instead.
    • ctrl_c_interrupt::Bool=true: If false, return empty on ^C, if true throw InterruptException() on ^C
    Julia 1.6

    As of Julia 1.6, config is deprecated. Use Config or MultiSelectConfig instead.

    User interaction

    REPL.TerminalMenus.requestFunction
    request(m::AbstractMenu; cursor=1)

    Display the menu and enter interactive mode. cursor indicates the item number used for the initial cursor position. cursor can be either an Int or a RefValue{Int}. The latter is useful for observation and control of the cursor position from the outside.

    Returns selected(m).

    Julia 1.6

    The cursor argument requires Julia 1.6 or later.

    request([term,] msg::AbstractString, m::AbstractMenu)

    Shorthand for println(msg); request(m).

    AbstractMenu extension interface

    Any subtype of AbstractMenu must be mutable, and must contain the fields pagesize::Int and pageoffset::Int. Any subtype must also implement the following functions:

    REPL.TerminalMenus.pickFunction
    pick(m::AbstractMenu, cursor::Int)

    Defines what happens when a user presses the Enter key while the menu is open. If true is returned, request() will exit. cursor indexes the position of the selection.

    REPL.TerminalMenus.cancelFunction
    cancel(m::AbstractMenu)

    Define what happens when a user cancels ('q' or ctrl-c) a menu. request() will always exit after calling this function.

    REPL.TerminalMenus.writelineFunction
    writeline(buf::IO, m::AbstractMenu, idx::Int, iscursor::Bool)

    Write the option at index idx to buf. iscursor, if true, indicates that this item is at the current cursor position (the one that will be selected by hitting "Enter").

    If m is a ConfiguredMenu, TerminalMenus will print the cursor indicator. Otherwise the callee is expected to handle such printing.

    Julia 1.6

    writeline requires Julia 1.6 or higher.

    On older versions of Julia, this was writeLine(buf::IO, m::AbstractMenu, idx, iscursor::Bool) and m is assumed to be unconfigured. The selection and cursor indicators can be obtained from TerminalMenus.CONFIG.

    This older function is supported on all Julia 1.x versions but will be dropped in Julia 2.0.

    It must also implement either options or numoptions:

    REPL.TerminalMenus.optionsFunction
    options(m::AbstractMenu)

    Return a list of strings to be displayed as options in the current page.

    Alternatively, implement numoptions, in which case options is not needed.

    REPL.TerminalMenus.numoptionsFunction
    numoptions(m::AbstractMenu) -> Int

    Return the number of options in menu m. Defaults to length(options(m)).

    Julia 1.6

    This function requires Julia 1.6 or later.

    If the subtype does not have a field named selected, it must also implement

    REPL.TerminalMenus.selectedFunction
    selected(m::AbstractMenu)

    Return information about the user-selected option. By default it returns m.selected.

    The following are optional but can allow additional customization:

    REPL.TerminalMenus.headerFunction
    header(m::AbstractMenu) -> String

    Return a header string to be printed above the menu. Defaults to "".

    REPL.TerminalMenus.keypressFunction
    keypress(m::AbstractMenu, i::UInt32) -> Bool

    Handle any non-standard keypress event. If true is returned, TerminalMenus.request will exit. Defaults to false.

    diff --git a/en/v1.12-dev/stdlib/Random/index.html b/en/v1.12-dev/stdlib/Random/index.html index bebdb9056f1..28451e7f355 100644 --- a/en/v1.12-dev/stdlib/Random/index.html +++ b/en/v1.12-dev/stdlib/Random/index.html @@ -260,4 +260,4 @@ SamplerSimple(die, Sampler(RNG, 1:die.nsides, r)) rand(rng::AbstractRNG, sp::SamplerSimple{Die}) = rand(rng, sp.data)

    Here, sp.data refers to the second parameter in the call to the SamplerSimple constructor (in this case equal to Sampler(rng, 1:die.nsides, r)), while the Die object can be accessed via sp[].

    Like SamplerDie, any custom sampler must be a subtype of Sampler{T} where T is the type of the generated values. Note that SamplerSimple(x, data) isa Sampler{eltype(x)}, so this constrains what the first argument to SamplerSimple can be (it's recommended to use SamplerSimple like in the Die example, where x is simply forwarded while defining a Sampler method). Similarly, SamplerTrivial(x) isa Sampler{eltype(x)}.

    Another helper type is currently available for other cases, Random.SamplerTag, but is considered as internal API, and can break at any time without proper deprecations.

    Using distinct algorithms for scalar or array generation

    In some cases, whether one wants to generate only a handful of values or a large number of values will have an impact on the choice of algorithm. This is handled with the third parameter of the Sampler constructor. Let's assume we defined two helper types for Die, say SamplerDie1 which should be used to generate only few random values, and SamplerDieMany for many values. We can use those types as follows:

    Sampler(RNG::Type{<:AbstractRNG}, die::Die, ::Val{1}) = SamplerDie1(...)
    -Sampler(RNG::Type{<:AbstractRNG}, die::Die, ::Val{Inf}) = SamplerDieMany(...)

    Of course, rand must also be defined on those types (i.e. rand(::AbstractRNG, ::SamplerDie1) and rand(::AbstractRNG, ::SamplerDieMany)). Note that, as usual, SamplerTrivial and SamplerSimple can be used if custom types are not necessary.

    Note: Sampler(rng, x) is simply a shorthand for Sampler(rng, x, Val(Inf)), and Random.Repetition is an alias for Union{Val{1}, Val{Inf}}.

    Creating new generators

    The API is not clearly defined yet, but as a rule of thumb:

    1. any rand method producing "basic" types (isbitstype integer and floating types in Base) should be defined for this specific RNG, if they are needed;
    2. other documented rand methods accepting an AbstractRNG should work out of the box, (provided the methods from 1) what are relied on are implemented), but can of course be specialized for this RNG if there is room for optimization;
    3. copy for pseudo-RNGs should return an independent copy that generates the exact same random sequence as the original from that point when called in the same way. When this is not feasible (e.g. hardware-based RNGs), copy must not be implemented.

    Concerning 1), a rand method may happen to work automatically, but it's not officially supported and may break without warnings in a subsequent release.

    To define a new rand method for an hypothetical MyRNG generator, and a value specification s (e.g. s == Int, or s == 1:10) of type S==typeof(s) or S==Type{s} if s is a type, the same two methods as we saw before must be defined:

    1. Sampler(::Type{MyRNG}, ::S, ::Repetition), which returns an object of type say SamplerS
    2. rand(rng::MyRNG, sp::SamplerS)

    It can happen that Sampler(rng::AbstractRNG, ::S, ::Repetition) is already defined in the Random module. It would then be possible to skip step 1) in practice (if one wants to specialize generation for this particular RNG type), but the corresponding SamplerS type is considered as internal detail, and may be changed without warning.

    Specializing array generation

    In some cases, for a given RNG type, generating an array of random values can be more efficient with a specialized method than by merely using the decoupling technique explained before. This is for example the case for MersenneTwister, which natively writes random values in an array.

    To implement this specialization for MyRNG and for a specification s, producing elements of type S, the following method can be defined: rand!(rng::MyRNG, a::AbstractArray{S}, ::SamplerS), where SamplerS is the type of the sampler returned by Sampler(MyRNG, s, Val(Inf)). Instead of AbstractArray, it's possible to implement the functionality only for a subtype, e.g. Array{S}. The non-mutating array method of rand will automatically call this specialization internally.

    Reproducibility

    By using an RNG parameter initialized with a given seed, you can reproduce the same pseudorandom number sequence when running your program multiple times. However, a minor release of Julia (e.g. 1.3 to 1.4) may change the sequence of pseudorandom numbers generated from a specific seed. (Even if the sequence produced by a low-level function like rand does not change, the output of higher-level functions like randsubseq may change due to algorithm updates.) Rationale: guaranteeing that pseudorandom streams never change prohibits many algorithmic improvements.

    If you need to guarantee exact reproducibility of random data, it is advisable to simply save the data (e.g. as a supplementary attachment in a scientific publication). (You can also, of course, specify a particular Julia version and package manifest, especially if you require bit reproducibility.)

    Software tests that rely on specific "random" data should also generally either save the data, embed it into the test code, or use third-party packages like StableRNGs.jl. On the other hand, tests that should pass for most random data (e.g. testing A \ (A*x) ≈ x for a random matrix A = randn(n,n)) can use an RNG with a fixed seed to ensure that simply running the test many times does not encounter a failure due to very improbable data (e.g. an extremely ill-conditioned matrix).

    The statistical distribution from which random samples are drawn is guaranteed to be the same across any minor Julia releases.

    +Sampler(RNG::Type{<:AbstractRNG}, die::Die, ::Val{Inf}) = SamplerDieMany(...)

    Of course, rand must also be defined on those types (i.e. rand(::AbstractRNG, ::SamplerDie1) and rand(::AbstractRNG, ::SamplerDieMany)). Note that, as usual, SamplerTrivial and SamplerSimple can be used if custom types are not necessary.

    Note: Sampler(rng, x) is simply a shorthand for Sampler(rng, x, Val(Inf)), and Random.Repetition is an alias for Union{Val{1}, Val{Inf}}.

    Creating new generators

    The API is not clearly defined yet, but as a rule of thumb:

    1. any rand method producing "basic" types (isbitstype integer and floating types in Base) should be defined for this specific RNG, if they are needed;
    2. other documented rand methods accepting an AbstractRNG should work out of the box, (provided the methods from 1) what are relied on are implemented), but can of course be specialized for this RNG if there is room for optimization;
    3. copy for pseudo-RNGs should return an independent copy that generates the exact same random sequence as the original from that point when called in the same way. When this is not feasible (e.g. hardware-based RNGs), copy must not be implemented.

    Concerning 1), a rand method may happen to work automatically, but it's not officially supported and may break without warnings in a subsequent release.

    To define a new rand method for an hypothetical MyRNG generator, and a value specification s (e.g. s == Int, or s == 1:10) of type S==typeof(s) or S==Type{s} if s is a type, the same two methods as we saw before must be defined:

    1. Sampler(::Type{MyRNG}, ::S, ::Repetition), which returns an object of type say SamplerS
    2. rand(rng::MyRNG, sp::SamplerS)

    It can happen that Sampler(rng::AbstractRNG, ::S, ::Repetition) is already defined in the Random module. It would then be possible to skip step 1) in practice (if one wants to specialize generation for this particular RNG type), but the corresponding SamplerS type is considered as internal detail, and may be changed without warning.

    Specializing array generation

    In some cases, for a given RNG type, generating an array of random values can be more efficient with a specialized method than by merely using the decoupling technique explained before. This is for example the case for MersenneTwister, which natively writes random values in an array.

    To implement this specialization for MyRNG and for a specification s, producing elements of type S, the following method can be defined: rand!(rng::MyRNG, a::AbstractArray{S}, ::SamplerS), where SamplerS is the type of the sampler returned by Sampler(MyRNG, s, Val(Inf)). Instead of AbstractArray, it's possible to implement the functionality only for a subtype, e.g. Array{S}. The non-mutating array method of rand will automatically call this specialization internally.

    Reproducibility

    By using an RNG parameter initialized with a given seed, you can reproduce the same pseudorandom number sequence when running your program multiple times. However, a minor release of Julia (e.g. 1.3 to 1.4) may change the sequence of pseudorandom numbers generated from a specific seed. (Even if the sequence produced by a low-level function like rand does not change, the output of higher-level functions like randsubseq may change due to algorithm updates.) Rationale: guaranteeing that pseudorandom streams never change prohibits many algorithmic improvements.

    If you need to guarantee exact reproducibility of random data, it is advisable to simply save the data (e.g. as a supplementary attachment in a scientific publication). (You can also, of course, specify a particular Julia version and package manifest, especially if you require bit reproducibility.)

    Software tests that rely on specific "random" data should also generally either save the data, embed it into the test code, or use third-party packages like StableRNGs.jl. On the other hand, tests that should pass for most random data (e.g. testing A \ (A*x) ≈ x for a random matrix A = randn(n,n)) can use an RNG with a fixed seed to ensure that simply running the test many times does not encounter a failure due to very improbable data (e.g. an extremely ill-conditioned matrix).

    The statistical distribution from which random samples are drawn is guaranteed to be the same across any minor Julia releases.

    diff --git a/en/v1.12-dev/stdlib/SHA/index.html b/en/v1.12-dev/stdlib/SHA/index.html index 58d26a9c8f3..0748fc6cc42 100644 --- a/en/v1.12-dev/stdlib/SHA/index.html +++ b/en/v1.12-dev/stdlib/SHA/index.html @@ -119,4 +119,4 @@ 0x00000000000000000000000000000094 julia> bytes2hex(digest!(ctx)) -"bc49a6f2aa29b27ee5ed1e944edd7f3d153e8a01535d98b5e24dac9a589a6248"

    All HMAC functions

    HMAC context type

    SHA.HMAC_CTXType
    HMAC_CTX(ctx::CTX, key::Vector{UInt8}) where {CTX<:SHA_CTX}

    Construct an empty HMAC_CTX context.

    SHA-1

    SHA.hmac_sha1Function
    hmac_sha1(key, data)

    Hash data using the sha1 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha1(key, io::IO)

    Hash data from io with the passed key using sha1 algorithm.

    SHA-2

    SHA.hmac_sha224Function
    hmac_sha224(key, data)

    Hash data using the sha224 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha224(key, io::IO)

    Hash data from io with the passed key using sha224 algorithm.

    SHA.hmac_sha256Function
    hmac_sha256(key, data)

    Hash data using the sha256 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha256(key, io::IO)

    Hash data from io with the passed key using sha256 algorithm.

    SHA.hmac_sha384Function
    hmac_sha384(key, data)

    Hash data using the sha384 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha384(key, io::IO)

    Hash data from io with the passed key using sha384 algorithm.

    SHA.hmac_sha512Function
    hmac_sha512(key, data)

    Hash data using the sha512 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha512(key, io::IO)

    Hash data from io with the passed key using sha512 algorithm.

    SHA.hmac_sha2_224Function
    hmac_sha2_224(key, data)

    Hash data using the sha2_224 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_224(key, io::IO)

    Hash data from io with the passed key using sha2_224 algorithm.

    SHA.hmac_sha2_256Function
    hmac_sha2_256(key, data)

    Hash data using the sha2_256 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_256(key, io::IO)

    Hash data from io with the passed key using sha2_256 algorithm.

    SHA.hmac_sha2_384Function
    hmac_sha2_384(key, data)

    Hash data using the sha2_384 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_384(key, io::IO)

    Hash data from io with the passed key using sha2_384 algorithm.

    SHA.hmac_sha2_512Function
    hmac_sha2_512(key, data)

    Hash data using the sha2_512 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_512(key, io::IO)

    Hash data from io with the passed key using sha2_512 algorithm.

    SHA-3

    SHA.hmac_sha3_224Function
    hmac_sha3_224(key, data)

    Hash data using the sha3_224 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_224(key, io::IO)

    Hash data from io with the passed key using sha3_224 algorithm.

    SHA.hmac_sha3_256Function
    hmac_sha3_256(key, data)

    Hash data using the sha3_256 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_256(key, io::IO)

    Hash data from io with the passed key using sha3_256 algorithm.

    SHA.hmac_sha3_384Function
    hmac_sha3_384(key, data)

    Hash data using the sha3_384 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_384(key, io::IO)

    Hash data from io with the passed key using sha3_384 algorithm.

    SHA.hmac_sha3_512Function
    hmac_sha3_512(key, data)

    Hash data using the sha3_512 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_512(key, io::IO)

    Hash data from io with the passed key using sha3_512 algorithm.

    +"bc49a6f2aa29b27ee5ed1e944edd7f3d153e8a01535d98b5e24dac9a589a6248"

    All HMAC functions

    HMAC context type

    SHA.HMAC_CTXType
    HMAC_CTX(ctx::CTX, key::Vector{UInt8}) where {CTX<:SHA_CTX}

    Construct an empty HMAC_CTX context.

    SHA-1

    SHA.hmac_sha1Function
    hmac_sha1(key, data)

    Hash data using the sha1 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha1(key, io::IO)

    Hash data from io with the passed key using sha1 algorithm.

    SHA-2

    SHA.hmac_sha224Function
    hmac_sha224(key, data)

    Hash data using the sha224 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha224(key, io::IO)

    Hash data from io with the passed key using sha224 algorithm.

    SHA.hmac_sha256Function
    hmac_sha256(key, data)

    Hash data using the sha256 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha256(key, io::IO)

    Hash data from io with the passed key using sha256 algorithm.

    SHA.hmac_sha384Function
    hmac_sha384(key, data)

    Hash data using the sha384 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha384(key, io::IO)

    Hash data from io with the passed key using sha384 algorithm.

    SHA.hmac_sha512Function
    hmac_sha512(key, data)

    Hash data using the sha512 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha512(key, io::IO)

    Hash data from io with the passed key using sha512 algorithm.

    SHA.hmac_sha2_224Function
    hmac_sha2_224(key, data)

    Hash data using the sha2_224 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_224(key, io::IO)

    Hash data from io with the passed key using sha2_224 algorithm.

    SHA.hmac_sha2_256Function
    hmac_sha2_256(key, data)

    Hash data using the sha2_256 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_256(key, io::IO)

    Hash data from io with the passed key using sha2_256 algorithm.

    SHA.hmac_sha2_384Function
    hmac_sha2_384(key, data)

    Hash data using the sha2_384 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_384(key, io::IO)

    Hash data from io with the passed key using sha2_384 algorithm.

    SHA.hmac_sha2_512Function
    hmac_sha2_512(key, data)

    Hash data using the sha2_512 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha2_512(key, io::IO)

    Hash data from io with the passed key using sha2_512 algorithm.

    SHA-3

    SHA.hmac_sha3_224Function
    hmac_sha3_224(key, data)

    Hash data using the sha3_224 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_224(key, io::IO)

    Hash data from io with the passed key using sha3_224 algorithm.

    SHA.hmac_sha3_256Function
    hmac_sha3_256(key, data)

    Hash data using the sha3_256 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_256(key, io::IO)

    Hash data from io with the passed key using sha3_256 algorithm.

    SHA.hmac_sha3_384Function
    hmac_sha3_384(key, data)

    Hash data using the sha3_384 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_384(key, io::IO)

    Hash data from io with the passed key using sha3_384 algorithm.

    SHA.hmac_sha3_512Function
    hmac_sha3_512(key, data)

    Hash data using the sha3_512 algorithm using the passed key. See also HMAC_CTX.

    hmac_sha3_512(key, io::IO)

    Hash data from io with the passed key using sha3_512 algorithm.

    diff --git a/en/v1.12-dev/stdlib/Serialization/index.html b/en/v1.12-dev/stdlib/Serialization/index.html index f5e50672398..99fca9562c2 100644 --- a/en/v1.12-dev/stdlib/Serialization/index.html +++ b/en/v1.12-dev/stdlib/Serialization/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash}); -

    Serialization

    Provides serialization of Julia objects.

    Serialization.serializeFunction
    serialize(stream::IO, value)

    Write an arbitrary value to a stream in an opaque format, such that it can be read back by deserialize. The read-back value will be as identical as possible to the original, but note that Ptr values are serialized as all-zero bit patterns (NULL).

    An 8-byte identifying header is written to the stream first. To avoid writing the header, construct a Serializer and use it as the first argument to serialize instead. See also Serialization.writeheader.

    The data format can change in minor (1.x) Julia releases, but files written by prior 1.x versions will remain readable. The main exception to this is when the definition of a type in an external package changes. If that occurs, it may be necessary to specify an explicit compatible version of the affected package in your environment. Renaming functions, even private functions, inside packages can also put existing files out of sync. Anonymous functions require special care: because their names are automatically generated, minor code changes can cause them to be renamed. Serializing anonymous functions should be avoided in files intended for long-term storage.

    In some cases, the word size (32- or 64-bit) of the reading and writing machines must match. In rarer cases the OS or architecture must also match, for example when using packages that contain platform-dependent code.

    serialize(filename::AbstractString, value)

    Open a file and serialize the given value to it.

    Julia 1.1

    This method is available as of Julia 1.1.

    Serialization.deserializeFunction
    deserialize(stream)

    Read a value written by serialize. deserialize assumes the binary data read from stream is correct and has been serialized by a compatible implementation of serialize. deserialize is designed for simplicity and performance, and so does not validate the data read. Malformed data can result in process termination. The caller must ensure the integrity and correctness of data read from stream.

    deserialize(filename::AbstractString)

    Open a file and deserialize its contents.

    Julia 1.1

    This method is available as of Julia 1.1.

    Serialization.writeheaderFunction
    Serialization.writeheader(s::AbstractSerializer)

    Write an identifying header to the specified serializer. The header consists of 8 bytes as follows:

    OffsetDescription
    0tag byte (0x37)
    1-2signature bytes "JL"
    3protocol version
    4bits 0-1: endianness: 0 = little, 1 = big
    4bits 2-3: platform: 0 = 32-bit, 1 = 64-bit
    5-7reserved
    +

    Serialization

    Provides serialization of Julia objects.

    Serialization.serializeFunction
    serialize(stream::IO, value)

    Write an arbitrary value to a stream in an opaque format, such that it can be read back by deserialize. The read-back value will be as identical as possible to the original, but note that Ptr values are serialized as all-zero bit patterns (NULL).

    An 8-byte identifying header is written to the stream first. To avoid writing the header, construct a Serializer and use it as the first argument to serialize instead. See also Serialization.writeheader.

    The data format can change in minor (1.x) Julia releases, but files written by prior 1.x versions will remain readable. The main exception to this is when the definition of a type in an external package changes. If that occurs, it may be necessary to specify an explicit compatible version of the affected package in your environment. Renaming functions, even private functions, inside packages can also put existing files out of sync. Anonymous functions require special care: because their names are automatically generated, minor code changes can cause them to be renamed. Serializing anonymous functions should be avoided in files intended for long-term storage.

    In some cases, the word size (32- or 64-bit) of the reading and writing machines must match. In rarer cases the OS or architecture must also match, for example when using packages that contain platform-dependent code.

    serialize(filename::AbstractString, value)

    Open a file and serialize the given value to it.

    Julia 1.1

    This method is available as of Julia 1.1.

    Serialization.deserializeFunction
    deserialize(stream)

    Read a value written by serialize. deserialize assumes the binary data read from stream is correct and has been serialized by a compatible implementation of serialize. deserialize is designed for simplicity and performance, and so does not validate the data read. Malformed data can result in process termination. The caller must ensure the integrity and correctness of data read from stream.

    deserialize(filename::AbstractString)

    Open a file and deserialize its contents.

    Julia 1.1

    This method is available as of Julia 1.1.

    Serialization.writeheaderFunction
    Serialization.writeheader(s::AbstractSerializer)

    Write an identifying header to the specified serializer. The header consists of 8 bytes as follows:

    OffsetDescription
    0tag byte (0x37)
    1-2signature bytes "JL"
    3protocol version
    4bits 0-1: endianness: 0 = little, 1 = big
    4bits 2-3: platform: 0 = 32-bit, 1 = 64-bit
    5-7reserved
    diff --git a/en/v1.12-dev/stdlib/SharedArrays/index.html b/en/v1.12-dev/stdlib/SharedArrays/index.html index 61c6001d11a..bc931f88bfc 100644 --- a/en/v1.12-dev/stdlib/SharedArrays/index.html +++ b/en/v1.12-dev/stdlib/SharedArrays/index.html @@ -5,4 +5,4 @@ gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash});

    Shared Arrays

    SharedArray represents an array, which is shared across multiple processes, on a single machine.

    SharedArrays.SharedArrayType
    SharedArray{T}(dims::NTuple; init=false, pids=Int[])
     SharedArray{T,N}(...)

    Construct a SharedArray of a bits type T and size dims across the processes specified by pids - all of which have to be on the same host. If N is specified by calling SharedArray{T,N}(dims), then N must match the length of dims.

    If pids is left unspecified, the shared array will be mapped across all processes on the current host, including the master. But, localindices and indexpids will only refer to worker processes. This facilitates work distribution code to use workers for actual computation with the master process acting as a driver.

    If an init function of the type initfn(S::SharedArray) is specified, it is called on all the participating workers.

    The shared array is valid as long as a reference to the SharedArray object exists on the node which created the mapping.

    SharedArray{T}(filename::AbstractString, dims::NTuple, [offset=0]; mode=nothing, init=false, pids=Int[])
    -SharedArray{T,N}(...)

    Construct a SharedArray backed by the file filename, with element type T (must be a bits type) and size dims, across the processes specified by pids - all of which have to be on the same host. This file is mmapped into the host memory, with the following consequences:

    • The array data must be represented in binary format (e.g., an ASCII format like CSV cannot be supported)

    • Any changes you make to the array values (e.g., A[3] = 0) will also change the values on disk

    If pids is left unspecified, the shared array will be mapped across all processes on the current host, including the master. But, localindices and indexpids will only refer to worker processes. This facilitates work distribution code to use workers for actual computation with the master process acting as a driver.

    mode must be one of "r", "r+", "w+", or "a+", and defaults to "r+" if the file specified by filename already exists, or "w+" if not. If an init function of the type initfn(S::SharedArray) is specified, it is called on all the participating workers. You cannot specify an init function if the file is not writable.

    offset allows you to skip the specified number of bytes at the beginning of the file.

    Distributed.procsMethod
    procs(S::SharedArray)

    Get the vector of processes mapping the shared array.

    SharedArrays.sdataFunction
    sdata(S::SharedArray)

    Return the actual Array object backing S.

    SharedArrays.indexpidsFunction
    indexpids(S::SharedArray)

    Return the current worker's index in the list of workers mapping the SharedArray (i.e. in the same list returned by procs(S)), or 0 if the SharedArray is not mapped locally.

    SharedArrays.localindicesFunction
    localindices(S::SharedArray)

    Return a range describing the "default" indices to be handled by the current process. This range should be interpreted in the sense of linear indexing, i.e., as a sub-range of 1:length(S). In multi-process contexts, returns an empty range in the parent process (or any process for which indexpids returns 0).

    It's worth emphasizing that localindices exists purely as a convenience, and you can partition work on the array among workers any way you wish. For a SharedArray, all indices should be equally fast for each worker process.

    +SharedArray{T,N}(...)

    Construct a SharedArray backed by the file filename, with element type T (must be a bits type) and size dims, across the processes specified by pids - all of which have to be on the same host. This file is mmapped into the host memory, with the following consequences:

    If pids is left unspecified, the shared array will be mapped across all processes on the current host, including the master. But, localindices and indexpids will only refer to worker processes. This facilitates work distribution code to use workers for actual computation with the master process acting as a driver.

    mode must be one of "r", "r+", "w+", or "a+", and defaults to "r+" if the file specified by filename already exists, or "w+" if not. If an init function of the type initfn(S::SharedArray) is specified, it is called on all the participating workers. You cannot specify an init function if the file is not writable.

    offset allows you to skip the specified number of bytes at the beginning of the file.

    SharedArrays.SharedVectorType
    SharedVector

    A one-dimensional SharedArray.

    SharedArrays.SharedMatrixType
    SharedMatrix

    A two-dimensional SharedArray.

    Distributed.procsMethod
    procs(S::SharedArray)

    Get the vector of processes mapping the shared array.

    SharedArrays.sdataFunction
    sdata(S::SharedArray)

    Return the actual Array object backing S.

    SharedArrays.indexpidsFunction
    indexpids(S::SharedArray)

    Return the current worker's index in the list of workers mapping the SharedArray (i.e. in the same list returned by procs(S)), or 0 if the SharedArray is not mapped locally.

    SharedArrays.localindicesFunction
    localindices(S::SharedArray)

    Return a range describing the "default" indices to be handled by the current process. This range should be interpreted in the sense of linear indexing, i.e., as a sub-range of 1:length(S). In multi-process contexts, returns an empty range in the parent process (or any process for which indexpids returns 0).

    It's worth emphasizing that localindices exists purely as a convenience, and you can partition work on the array among workers any way you wish. For a SharedArray, all indices should be equally fast for each worker process.

    diff --git a/en/v1.12-dev/stdlib/Sockets/index.html b/en/v1.12-dev/stdlib/Sockets/index.html index b76901758ed..3d80121b0af 100644 --- a/en/v1.12-dev/stdlib/Sockets/index.html +++ b/en/v1.12-dev/stdlib/Sockets/index.html @@ -64,4 +64,4 @@ Stacktrace: [...] nested task error: foo -[...]source
    Sockets.sendFunction
    send(socket::UDPSocket, host::IPAddr, port::Integer, msg)

    Send msg over socket to host:port.

    Sockets.recvFunction
    recv(socket::UDPSocket)

    Read a UDP packet from the specified socket, and return the bytes received. This call blocks.

    Sockets.recvfromFunction
    recvfrom(socket::UDPSocket) -> (host_port, data)

    Read a UDP packet from the specified socket, returning a tuple of (host_port, data), where host_port will be an InetAddr{IPv4} or InetAddr{IPv6}, as appropriate.

    Julia 1.3

    Prior to Julia version 1.3, the first returned value was an address (IPAddr). In version 1.3 it was changed to an InetAddr.

    Sockets.setoptFunction
    setopt(sock::UDPSocket; multicast_loop=nothing, multicast_ttl=nothing, enable_broadcast=nothing, ttl=nothing)

    Set UDP socket options.

    • multicast_loop: loopback for multicast packets (default: true).
    • multicast_ttl: TTL for multicast packets (default: nothing).
    • enable_broadcast: flag must be set to true if socket will be used for broadcast messages, or else the UDP system will return an access error (default: false).
    • ttl: Time-to-live of packets sent on the socket (default: nothing).
    Sockets.nagleFunction
    nagle(socket::Union{TCPServer, TCPSocket}, enable::Bool)

    Nagle's algorithm batches multiple small TCP packets into larger ones. This can improve throughput but worsen latency. Nagle's algorithm is enabled by default. This function sets whether Nagle's algorithm is active on a given TCP server or socket. The opposite option is called TCP_NODELAY in other languages.

    Julia 1.3

    This function requires Julia 1.3 or later.

    Sockets.quickackFunction
    quickack(socket::Union{TCPServer, TCPSocket}, enable::Bool)

    On Linux systems, the TCP_QUICKACK is disabled or enabled on socket.

    +[...]source
    Sockets.sendFunction
    send(socket::UDPSocket, host::IPAddr, port::Integer, msg)

    Send msg over socket to host:port.

    Sockets.recvFunction
    recv(socket::UDPSocket)

    Read a UDP packet from the specified socket, and return the bytes received. This call blocks.

    Sockets.recvfromFunction
    recvfrom(socket::UDPSocket) -> (host_port, data)

    Read a UDP packet from the specified socket, returning a tuple of (host_port, data), where host_port will be an InetAddr{IPv4} or InetAddr{IPv6}, as appropriate.

    Julia 1.3

    Prior to Julia version 1.3, the first returned value was an address (IPAddr). In version 1.3 it was changed to an InetAddr.

    Sockets.setoptFunction
    setopt(sock::UDPSocket; multicast_loop=nothing, multicast_ttl=nothing, enable_broadcast=nothing, ttl=nothing)

    Set UDP socket options.

    • multicast_loop: loopback for multicast packets (default: true).
    • multicast_ttl: TTL for multicast packets (default: nothing).
    • enable_broadcast: flag must be set to true if socket will be used for broadcast messages, or else the UDP system will return an access error (default: false).
    • ttl: Time-to-live of packets sent on the socket (default: nothing).
    Sockets.nagleFunction
    nagle(socket::Union{TCPServer, TCPSocket}, enable::Bool)

    Nagle's algorithm batches multiple small TCP packets into larger ones. This can improve throughput but worsen latency. Nagle's algorithm is enabled by default. This function sets whether Nagle's algorithm is active on a given TCP server or socket. The opposite option is called TCP_NODELAY in other languages.

    Julia 1.3

    This function requires Julia 1.3 or later.

    Sockets.quickackFunction
    quickack(socket::Union{TCPServer, TCPSocket}, enable::Bool)

    On Linux systems, the TCP_QUICKACK is disabled or enabled on socket.

    diff --git a/en/v1.12-dev/stdlib/SparseArrays/index.html b/en/v1.12-dev/stdlib/SparseArrays/index.html index 63a289c0032..d80a402e64d 100644 --- a/en/v1.12-dev/stdlib/SparseArrays/index.html +++ b/en/v1.12-dev/stdlib/SparseArrays/index.html @@ -267,4 +267,4 @@ [C::AbstractSparseMatrixCSC{Tv,Ti}]) where {Tv,Ti}

    Bilaterally permute A, storing result PAQ (A[p,q]) in X. Stores intermediate result (AQ)^T (transpose(A[:,q])) in optional argument C if present. Requires that none of X, A, and, if present, C alias each other; to store result PAQ back into A, use the following method lacking X:

    permute!(A::AbstractSparseMatrixCSC{Tv,Ti}, p::AbstractVector{<:Integer},
              q::AbstractVector{<:Integer}[, C::AbstractSparseMatrixCSC{Tv,Ti},
              [workcolptr::Vector{Ti}]]) where {Tv,Ti}

    X's dimensions must match those of A (size(X, 1) == size(A, 1) and size(X, 2) == size(A, 2)), and X must have enough storage to accommodate all allocated entries in A (length(rowvals(X)) >= nnz(A) and length(nonzeros(X)) >= nnz(A)). Column-permutation q's length must match A's column count (length(q) == size(A, 2)). Row-permutation p's length must match A's row count (length(p) == size(A, 1)).

    C's dimensions must match those of transpose(A) (size(C, 1) == size(A, 2) and size(C, 2) == size(A, 1)), and C must have enough storage to accommodate all allocated entries in A (length(rowvals(C)) >= nnz(A) and length(nonzeros(C)) >= nnz(A)).

    For additional (algorithmic) information, and for versions of these methods that forgo argument checking, see (unexported) parent methods unchecked_noalias_permute! and unchecked_aliasing_permute!.

    See also permute.

    SparseArrays.halfperm!Function
    halfperm!(X::AbstractSparseMatrixCSC{Tv,Ti}, A::AbstractSparseMatrixCSC{TvA,Ti},
    -          q::AbstractVector{<:Integer}, f::Function = identity) where {Tv,TvA,Ti}

    Column-permute and transpose A, simultaneously applying f to each entry of A, storing the result (f(A)Q)^T (map(f, transpose(A[:,q]))) in X.

    Element type Tv of X must match f(::TvA), where TvA is the element type of A. X's dimensions must match those of transpose(A) (size(X, 1) == size(A, 2) and size(X, 2) == size(A, 1)), and X must have enough storage to accommodate all allocated entries in A (length(rowvals(X)) >= nnz(A) and length(nonzeros(X)) >= nnz(A)). Column-permutation q's length must match A's column count (length(q) == size(A, 2)).

    This method is the parent of several methods performing transposition and permutation operations on SparseMatrixCSCs. As this method performs no argument checking, prefer the safer child methods ([c]transpose[!], permute[!]) to direct use.

    This method implements the HALFPERM algorithm described in F. Gustavson, "Two fast algorithms for sparse matrices: multiplication and permuted transposition," ACM TOMS 4(3), 250-269 (1978). The algorithm runs in O(size(A, 1), size(A, 2), nnz(A)) time and requires no space beyond that passed in.

    SparseArrays.ftranspose!Function
    ftranspose!(X::AbstractSparseMatrixCSC{Tv,Ti}, A::AbstractSparseMatrixCSC{Tv,Ti}, f::Function) where {Tv,Ti}

    Transpose A and store it in X while applying the function f to the non-zero elements. Does not remove the zeros created by f. size(X) must be equal to size(transpose(A)). No additional memory is allocated other than resizing the rowval and nzval of X, if needed.

    See halfperm!

    Noteworthy External Sparse Packages

    Several other Julia packages provide sparse matrix implementations that should be mentioned:

    1. SuiteSparseGraphBLAS.jl is a wrapper over the fast, multithreaded SuiteSparse:GraphBLAS C library. On CPU this is typically the fastest option, often significantly outperforming MKLSparse.

    2. CUDA.jl exposes the CUSPARSE library for GPU sparse matrix operations.

    3. SparseMatricesCSR.jl provides a Julia native implementation of the Compressed Sparse Rows (CSR) format.

    4. MKLSparse.jl accelerates SparseArrays sparse-dense matrix operations using Intel's MKL library.

    5. SparseArrayKit.jl available for multidimensional sparse arrays.

    6. LuxurySparse.jl provides static sparse array formats, as well as a coordinate format.

    7. ExtendableSparse.jl enables fast insertion into sparse matrices using a lazy approach to new stored indices.

    8. Finch.jl supports extensive multidimensional sparse array formats and operations through a mini tensor language and compiler, all in native Julia. Support for COO, CSF, CSR, CSC and more, as well as operations like broadcast, reduce, etc. and custom operations.

    External packages providing sparse direct solvers:

    1. KLU.jl
    2. Pardiso.jl

    External packages providing solvers for iterative solution of eigensystems and singular value decompositions:

    1. ArnoldiMethods.jl
    2. KrylovKit
    3. Arpack.jl

    External packages for working with graphs:

    1. Graphs.jl
    + q::AbstractVector{<:Integer}, f::Function = identity) where {Tv,TvA,Ti}

    Column-permute and transpose A, simultaneously applying f to each entry of A, storing the result (f(A)Q)^T (map(f, transpose(A[:,q]))) in X.

    Element type Tv of X must match f(::TvA), where TvA is the element type of A. X's dimensions must match those of transpose(A) (size(X, 1) == size(A, 2) and size(X, 2) == size(A, 1)), and X must have enough storage to accommodate all allocated entries in A (length(rowvals(X)) >= nnz(A) and length(nonzeros(X)) >= nnz(A)). Column-permutation q's length must match A's column count (length(q) == size(A, 2)).

    This method is the parent of several methods performing transposition and permutation operations on SparseMatrixCSCs. As this method performs no argument checking, prefer the safer child methods ([c]transpose[!], permute[!]) to direct use.

    This method implements the HALFPERM algorithm described in F. Gustavson, "Two fast algorithms for sparse matrices: multiplication and permuted transposition," ACM TOMS 4(3), 250-269 (1978). The algorithm runs in O(size(A, 1), size(A, 2), nnz(A)) time and requires no space beyond that passed in.

    SparseArrays.ftranspose!Function
    ftranspose!(X::AbstractSparseMatrixCSC{Tv,Ti}, A::AbstractSparseMatrixCSC{Tv,Ti}, f::Function) where {Tv,Ti}

    Transpose A and store it in X while applying the function f to the non-zero elements. Does not remove the zeros created by f. size(X) must be equal to size(transpose(A)). No additional memory is allocated other than resizing the rowval and nzval of X, if needed.

    See halfperm!

    Noteworthy External Sparse Packages

    Several other Julia packages provide sparse matrix implementations that should be mentioned:

    1. SuiteSparseGraphBLAS.jl is a wrapper over the fast, multithreaded SuiteSparse:GraphBLAS C library. On CPU this is typically the fastest option, often significantly outperforming MKLSparse.

    2. CUDA.jl exposes the CUSPARSE library for GPU sparse matrix operations.

    3. SparseMatricesCSR.jl provides a Julia native implementation of the Compressed Sparse Rows (CSR) format.

    4. MKLSparse.jl accelerates SparseArrays sparse-dense matrix operations using Intel's MKL library.

    5. SparseArrayKit.jl available for multidimensional sparse arrays.

    6. LuxurySparse.jl provides static sparse array formats, as well as a coordinate format.

    7. ExtendableSparse.jl enables fast insertion into sparse matrices using a lazy approach to new stored indices.

    8. Finch.jl supports extensive multidimensional sparse array formats and operations through a mini tensor language and compiler, all in native Julia. Support for COO, CSF, CSR, CSC and more, as well as operations like broadcast, reduce, etc. and custom operations.

    External packages providing sparse direct solvers:

    1. KLU.jl
    2. Pardiso.jl

    External packages providing solvers for iterative solution of eigensystems and singular value decompositions:

    1. ArnoldiMethods.jl
    2. KrylovKit
    3. Arpack.jl

    External packages for working with graphs:

    1. Graphs.jl
    diff --git a/en/v1.12-dev/stdlib/Statistics/index.html b/en/v1.12-dev/stdlib/Statistics/index.html index 5cedd2b79f9..4c157abd71a 100644 --- a/en/v1.12-dev/stdlib/Statistics/index.html +++ b/en/v1.12-dev/stdlib/Statistics/index.html @@ -120,4 +120,4 @@ 18.000000000000004 julia> quantile(skipmissing([1, 10, missing]), 0.5) -5.5 +5.5 diff --git a/en/v1.12-dev/stdlib/StyledStrings/index.html b/en/v1.12-dev/stdlib/StyledStrings/index.html index 72488d38792..58ecc34a9e0 100644 --- a/en/v1.12-dev/stdlib/StyledStrings/index.html +++ b/en/v1.12-dev/stdlib/StyledStrings/index.html @@ -135,4 +135,4 @@ julia> tryparse(SimpleColor, "#9558b2") SimpleColor(#9558b2) -julia> tryparse(SimpleColor, "#nocolor")
    Base.mergeMethod
    merge(initial::Face, others::Face...)

    Merge the properties of the initial face and others, with later faces taking priority.

    +julia> tryparse(SimpleColor, "#nocolor")
    Base.mergeMethod
    merge(initial::Face, others::Face...)

    Merge the properties of the initial face and others, with later faces taking priority.

    diff --git a/en/v1.12-dev/stdlib/TOML/index.html b/en/v1.12-dev/stdlib/TOML/index.html index 99fdfe10f89..0d49bf81739 100644 --- a/en/v1.12-dev/stdlib/TOML/index.html +++ b/en/v1.12-dev/stdlib/TOML/index.html @@ -79,4 +79,4 @@ parse(p::Parser, x::Union{AbstractString, IO})

    Parse the string or stream x, and return the resulting table (dictionary). Throw a ParserError upon failure.

    See also TOML.tryparse.

    TOML.parsefileFunction
    parsefile(f::AbstractString)
     parsefile(p::Parser, f::AbstractString)

    Parse file f and return the resulting table (dictionary). Throw a ParserError upon failure.

    See also TOML.tryparsefile.

    TOML.tryparseFunction
    tryparse(x::Union{AbstractString, IO})
     tryparse(p::Parser, x::Union{AbstractString, IO})

    Parse the string or stream x, and return the resulting table (dictionary). Return a ParserError upon failure.

    See also TOML.parse.

    TOML.tryparsefileFunction
    tryparsefile(f::AbstractString)
    -tryparsefile(p::Parser, f::AbstractString)

    Parse file f and return the resulting table (dictionary). Return a ParserError upon failure.

    See also TOML.parsefile.

    TOML.printFunction
    print([to_toml::Function], io::IO [=stdout], data::AbstractDict; sorted=false, by=identity, inline_tables::IdSet{<:AbstractDict})

    Write data as TOML syntax to the stream io. If the keyword argument sorted is set to true, sort tables according to the function given by the keyword argument by. If the keyword argument inline_tables is given, it should be a set of tables that should be printed "inline".

    The following data types are supported: AbstractDict, AbstractVector, AbstractString, Integer, AbstractFloat, Bool, Dates.DateTime, Dates.Time, Dates.Date. Note that the integers and floats need to be convertible to Float64 and Int64 respectively. For other data types, pass the function to_toml that takes the data types and returns a value of a supported type.

    TOML.ParserType
    Parser()

    Constructor for a TOML Parser. Note that in most cases one does not need to explicitly create a Parser but instead one directly use use TOML.parsefile or TOML.parse. Using an explicit parser will however reuse some internal data structures which can be beneficial for performance if a larger number of small files are parsed.

    TOML.ParserErrorType
    ParserError

    Type that is returned from tryparse and tryparsefile when parsing fails. It contains (among others) the following fields:

    • pos, the position in the string when the error happened
    • table, the result that so far was successfully parsed
    • type, an error type, different for different types of errors
    +tryparsefile(p::Parser, f::AbstractString)

    Parse file f and return the resulting table (dictionary). Return a ParserError upon failure.

    See also TOML.parsefile.

    TOML.printFunction
    print([to_toml::Function], io::IO [=stdout], data::AbstractDict; sorted=false, by=identity, inline_tables::IdSet{<:AbstractDict})

    Write data as TOML syntax to the stream io. If the keyword argument sorted is set to true, sort tables according to the function given by the keyword argument by. If the keyword argument inline_tables is given, it should be a set of tables that should be printed "inline".

    The following data types are supported: AbstractDict, AbstractVector, AbstractString, Integer, AbstractFloat, Bool, Dates.DateTime, Dates.Time, Dates.Date. Note that the integers and floats need to be convertible to Float64 and Int64 respectively. For other data types, pass the function to_toml that takes the data types and returns a value of a supported type.

    TOML.ParserType
    Parser()

    Constructor for a TOML Parser. Note that in most cases one does not need to explicitly create a Parser but instead one directly use use TOML.parsefile or TOML.parse. Using an explicit parser will however reuse some internal data structures which can be beneficial for performance if a larger number of small files are parsed.

    TOML.ParserErrorType
    ParserError

    Type that is returned from tryparse and tryparsefile when parsing fails. It contains (among others) the following fields:

    • pos, the position in the string when the error happened
    • table, the result that so far was successfully parsed
    • type, an error type, different for different types of errors
    diff --git a/en/v1.12-dev/stdlib/Tar/index.html b/en/v1.12-dev/stdlib/Tar/index.html index 17f2819f83e..7eea928398f 100644 --- a/en/v1.12-dev/stdlib/Tar/index.html +++ b/en/v1.12-dev/stdlib/Tar/index.html @@ -50,4 +50,4 @@ mode :: UInt16 # mode/permissions (best viewed in octal) size :: Int64 # size of record data in bytes link :: String # target path of a symlink -end

    Types are represented with the following symbols: file, hardlink, symlink, chardev, blockdev, directory, fifo, or for unknown types, the typeflag character as a symbol. Note that extract refuses to extract records types other than file, symlink and directory; list will only list other kinds of records if called with strict=false.

    The tar format includes various other metadata about records, including user and group IDs, user and group names, and timestamps. The Tar package, by design, completely ignores these. When creating tar files, these fields are always set to zero/empty. When reading tar files, these fields are ignored aside from verifying header checksums for each header record for all fields.

    +end

    Types are represented with the following symbols: file, hardlink, symlink, chardev, blockdev, directory, fifo, or for unknown types, the typeflag character as a symbol. Note that extract refuses to extract records types other than file, symlink and directory; list will only list other kinds of records if called with strict=false.

    The tar format includes various other metadata about records, including user and group IDs, user and group names, and timestamps. The Tar package, by design, completely ignores these. When creating tar files, these fields are always set to zero/empty. When reading tar files, these fields are ignored aside from verifying header checksums for each header record for all fields.

    diff --git a/en/v1.12-dev/stdlib/Test/index.html b/en/v1.12-dev/stdlib/Test/index.html index b60055588b8..d183528f79a 100644 --- a/en/v1.12-dev/stdlib/Test/index.html +++ b/en/v1.12-dev/stdlib/Test/index.html @@ -4,7 +4,7 @@ gtag('js', new Date()); gtag('config', 'UA-28835595-6', {'page_path': location.pathname + location.search + location.hash});

    Unit Testing

    Testing Base Julia

    Julia is under rapid development and has an extensive test suite to verify functionality across multiple platforms. If you build Julia from source, you can run this test suite with make test. In a binary install, you can run the test suite using Base.runtests().

    Base.runtestsFunction
    Base.runtests(tests=["all"]; ncores=ceil(Int, Sys.CPU_THREADS / 2),
    -              exit_on_error=false, revise=false, propagate_project=true, [seed])

    Run the Julia unit tests listed in tests, which can be either a string or an array of strings, using ncores processors. If exit_on_error is false, when one test fails, all remaining tests in other files will still be run; they are otherwise discarded, when exit_on_error == true. If revise is true, the Revise package is used to load any modifications to Base or to the standard libraries before running the tests. If propagate_project is true the current project is propagated to the test environment. If a seed is provided via the keyword argument, it is used to seed the global RNG in the context where the tests are run; otherwise the seed is chosen randomly.

    source

    Basic Unit Tests

    The Test module provides simple unit testing functionality. Unit testing is a way to see if your code is correct by checking that the results are what you expect. It can be helpful to ensure your code still works after you make changes, and can be used when developing as a way of specifying the behaviors your code should have when complete. You may also want to look at the documentation for adding tests to your Julia Package.

    Simple unit testing can be performed with the @test and @test_throws macros:

    Test.@testMacro
    @test ex
    +              exit_on_error=false, revise=false, propagate_project=true, [seed])

    Run the Julia unit tests listed in tests, which can be either a string or an array of strings, using ncores processors. If exit_on_error is false, when one test fails, all remaining tests in other files will still be run; they are otherwise discarded, when exit_on_error == true. If revise is true, the Revise package is used to load any modifications to Base or to the standard libraries before running the tests. If propagate_project is true the current project is propagated to the test environment. If a seed is provided via the keyword argument, it is used to seed the global RNG in the context where the tests are run; otherwise the seed is chosen randomly.

    source

    Basic Unit Tests

    The Test module provides simple unit testing functionality. Unit testing is a way to see if your code is correct by checking that the results are what you expect. It can be helpful to ensure your code still works after you make changes, and can be used when developing as a way of specifying the behaviors your code should have when complete. You may also want to look at the documentation for adding tests to your Julia Package.

    Simple unit testing can be performed with the @test and @test_throws macros:

    Test.@testMacro
    @test ex
     @test f(args...) key=val ...
     @test ex broken=true
     @test ex skip=true

    Test that the expression ex evaluates to true. If executed inside a @testset, return a Pass Result if it does, a Fail Result if it is false, and an Error Result if it could not be evaluated. If executed outside a @testset, throw an exception instead of returning Fail or Error.

    Examples

    julia> @test true
    @@ -376,4 +376,4 @@
          Testing Running tests...
     Test Summary: | Pass  Total
     Example tests |    9      9
    -     Testing Example tests passed

    And if all went correctly, you should see a similar output as above. Using Test.jl, more complicated tests can be added for packages but this should ideally point developers in the direction of how to get started with testing their own created packages.

    Code Coverage

    Code coverage tracking during tests can be enabled using the pkg> test --coverage flag (or at a lower level using the --code-coverage julia arg). This is on by default in the julia-runtest GitHub action.

    To evaluate coverage either manually inspect the .cov files that are generated beside the source files locally, or in CI use the julia-processcoverage GitHub action.

    Julia 1.11

    Since Julia 1.11, coverage is not collected during the package precompilation phase.

    + Testing Example tests passed

    And if all went correctly, you should see a similar output as above. Using Test.jl, more complicated tests can be added for packages but this should ideally point developers in the direction of how to get started with testing their own created packages.

    Code Coverage

    Code coverage tracking during tests can be enabled using the pkg> test --coverage flag (or at a lower level using the --code-coverage julia arg). This is on by default in the julia-runtest GitHub action.

    To evaluate coverage either manually inspect the .cov files that are generated beside the source files locally, or in CI use the julia-processcoverage GitHub action.

    Julia 1.11

    Since Julia 1.11, coverage is not collected during the package precompilation phase.

    diff --git a/en/v1.12-dev/stdlib/UUIDs/index.html b/en/v1.12-dev/stdlib/UUIDs/index.html index e99ca519325..5ff2a8223ec 100644 --- a/en/v1.12-dev/stdlib/UUIDs/index.html +++ b/en/v1.12-dev/stdlib/UUIDs/index.html @@ -22,4 +22,4 @@ julia> u5 = uuid5(u4, "julia") UUID("2df91e3f-da06-5362-a6fe-03772f2e14c9")
    UUIDs.uuid_versionFunction
    uuid_version(u::UUID) -> Int

    Inspects the given UUID and returns its version (see RFC 4122).

    Examples

    julia> uuid_version(uuid4())
    -4
    +4 diff --git a/en/v1.12-dev/stdlib/Unicode/index.html b/en/v1.12-dev/stdlib/Unicode/index.html index c76fe74a2c3..5fc42c5fbc8 100644 --- a/en/v1.12-dev/stdlib/Unicode/index.html +++ b/en/v1.12-dev/stdlib/Unicode/index.html @@ -59,4 +59,4 @@ 'o': ASCII/Unicode U+006F (category Ll: Letter, lowercase) 's': ASCII/Unicode U+0073 (category Ll: Letter, lowercase) 'e': ASCII/Unicode U+0065 (category Ll: Letter, lowercase) - '́': Unicode U+0301 (category Mn: Mark, nonspacing)

    This consists of the 3rd to 7th codepoints (Chars) in "exposé", because the grapheme "é" is actually two Unicode codepoints (an 'e' followed by an acute-accent combining character U+0301).

    Because finding grapheme boundaries requires iteration over the string contents, the graphemes(s, m:n) function requires time proportional to the length of the string (number of codepoints) before the end of the substring.

    Julia 1.9

    The m:n argument of graphemes requires Julia 1.9.

    + '́': Unicode U+0301 (category Mn: Mark, nonspacing)

    This consists of the 3rd to 7th codepoints (Chars) in "exposé", because the grapheme "é" is actually two Unicode codepoints (an 'e' followed by an acute-accent combining character U+0301).

    Because finding grapheme boundaries requires iteration over the string contents, the graphemes(s, m:n) function requires time proportional to the length of the string (number of codepoints) before the end of the substring.

    Julia 1.9

    The m:n argument of graphemes requires Julia 1.9.