# [Punctuation](#man-punctuation)
Extended documentation for mathematical symbols & functions is [here](../math/#math-ops).
| symbol                                                    | meaning                                                                                |
|:----------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`                                                       | the at-sign marks a [macro](../../manual/metaprogramming/#man-macros) invocation; optionally followed by an argument list                                                                                |
| [`!`](../math/#Base.:!)                                   | 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](../../manual/strings/#string-interpolation) and [expression](../../manual/metaprogramming/#man-expression-interpolation) interpolation                                                                |
| [`%`](../math/#Base.rem)                                  | the percent symbol is the remainder operator                                                                                |
| [`^`](../math/#Base.:%5E-Tuple%7BNumber,%20Number%7D)     | the caret is the exponentiation operator                                                                                |
| [`&`](../math/#Base.:&)                                   | single ampersand is bitwise and                                                                                |
| [`&&`](../math/#&&)                                       | double ampersands is short-circuiting boolean and                                                                                |
| [`|`](../math/#Base.:%7C)                                 | single pipe character is bitwise or                                                                                |
| [`||`](../math/#%7C%7C)                                   | double pipe characters is short-circuiting boolean or                                                                                |
| [`⊻`](../math/#Base.xor)                                  | the unicode xor character is bitwise exclusive or                                                                                |
| [`~`](../math/#Base.:~)                                   | the tilde is an operator for bitwise not                                                                                |
| `'`                                                       | a trailing apostrophe is the [`adjoint`](../../stdlib/LinearAlgebra/#Base.adjoint) (that is, the complex transpose) operator Aᴴ                                                                                |
| [`*`](../math/#Base.:*-Tuple%7BAny,%20Vararg%7BAny%7D%7D) | the asterisk is used for multiplication, including matrix multiplication and [string concatenation](../../manual/strings/#man-concatenation)                                                                                |
| [`/`](../math/#Base.:/)                                   | forward slash divides the argument on its left by the one on its right                                                                                |
| [`\`](../math/#Base.:\\-Tuple%7BAny,%20Any%7D)            | 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`](../base/#Core.Tuple)                                                                                |
| `(a,...)`                                                 | parentheses with comma-separated arguments constructs a tuple containing its arguments                                                                                |
| `(a=1,...)`                                               | parentheses with comma-separated assignments constructs a [`NamedTuple`](../base/#Core.NamedTuple)                                                                                |
| `(x;y)`                                                   | parentheses can also be used to group one or more semicolon separated expressions                                                                                |
| `a[]`                                                     | [array indexing](../../manual/arrays/#man-array-indexing) (calling [`getindex`](../collections/#Base.getindex) or [`setindex!`](../collections/#Base.setindex!))                                                                           |
| `[,]`                                                     | [vector literal constructor](../../manual/arrays/#man-array-literals) (calling [`vect`](../arrays/#Base.vect))                                                                                |
| `[;]`                                                     | [vertical concatenation](../../manual/arrays/#man-array-concatenation) (calling [`vcat`](../arrays/#Base.vcat) or [`hvcat`](../arrays/#Base.hvcat))                                                                                |
| `[    ]`                                                  | with space-separated expressions, [horizontal concatenation](../../manual/strings/#man-concatenation) (calling [`hcat`](../arrays/#Base.hcat) or [`hvcat`](../arrays/#Base.hvcat))                                                         |
| `T{ }`                                                    | curly braces following a type list that type's [parameters](../../manual/types/#Parametric-Types)                                                                                |
| `{}`                                                      | curly braces can also be used to group multiple [`where`](../base/#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`](../strings/#Core.String-Tuple%7BAbstractString%7D) literals                                                                                |
| `""" """`                                                 | three double-quote characters delimits string literals that may contain `"` and ignore leading indentation                                                                                |
| `' '`                                                     | the single-quote character delimits [`Char`](../strings/#Core.Char) (that is, character) literals                                                                                |
| `` ` ` ``                                                 | the backtick character delimits [external process](../../manual/running-external-programs/#Running-External-Programs) ([`Cmd`](../base/#Base.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.b`                                                     | single periods access named fields in objects/modules (calling [`getproperty`](../base/#Base.getproperty) or [`setproperty!`](../base/#Base.setproperty!))                                                                                |
| `f.()`                                                    | periods may also prefix parentheses (like `f.(...)`) or infix operators (like `.+`) to perform the function element-wise (calling [`broadcast`](../arrays/#Base.Broadcast.broadcast))                                                      |
| `a:b`                                                     | colons ([`:`](../math/#Base.::)) used as a binary infix operator construct a range from `a` to `b` (inclusive) with fixed step size `1`                                                                                |
| `a:s:b`                                                   | colons ([`:`](../math/#Base.::)) used as a ternary infix operator construct a range from `a` to `b` (inclusive) with step size `s`                                                                                |
| `:`                                                       | when used by themselves, [`Colon`](../arrays/#Base.Colon)s represent all indices within a dimension, frequently combined with [indexing](../../manual/arrays/#man-array-indexing)                                                          |
| `::`                                                      | double-colons represent a type annotation or [`typeassert`](../base/#Core.typeassert), depending on context, frequently used when declaring function arguments                                                                             |
| `:( )`                                                    | quoted expression                                                                                |
| `:a`                                                      | [`Symbol`](../base/#Core.Symbol) a                                                                                |
| [`<:`](../base/#Core.:%3C:)                               | subtype operator                                                                                |
| [`>:`](../base/#Base.:%3E:)                               | supertype operator (reverse of subtype operator)                                                                                |
| `=`                                                       | single equals sign is [assignment](../../manual/variables/#man-variables)                                                                                |
| [`==`](../math/#Base.:==)                                 | double equals sign is value equality comparison                                                                                |
| [`===`](../base/#Core.:===)                               | triple equals sign is programmatically identical equality comparison                                                                                |
| [`=>`](../collections/#Core.Pair)                         | right arrow using an equals sign defines a [`Pair`](../collections/#Core.Pair) typically used to populate [dictionaries](../collections/#Dictionaries)                                                                                |
| `->`                                                      | right arrow using a hyphen defines an [anonymous function](../../manual/functions/#man-anonymous-functions) on a single line                                                                                |
| [`|>`](../base/#Base.:%7C%3E)                             | pipe operator passes output from the left argument to input of the right argument, usually a [function](../../manual/functions/#Function-composition-and-piping)                                                                           |
| `∘`                                                       | function composition operator (typed with \\circ{tab}) combines two functions as though they are a single larger [function](../../manual/functions/#Function-composition-and-piping)                                                       |
| `_`                                                       | underscores may be assigned values which will not be saved, often used to ignore [multiple return values](../../manual/functions/#destructuring-assignment) or create repetitive [comprehensions](../../manual/arrays/#man-comprehensions) |


# [Punctuation](#man-punctuation)
------------------------------------------------------------------------


# Sorting and Related Functions · The Julia Language
Source: https://docs.julialang.org/en/v1/base/sort/


# [Sorting and Related Functions](#Sorting-and-Related-Functions)
Julia has an extensive, flexible API for sorting and interacting with already-sorted arrays of values. By default, Julia picks reasonable algorithms and sorts in ascending order:
```julia-repl
julia> sort([2,3,1])
3-element Vector{Int64}:
 1
 2
 3
```
You can sort in reverse order as well:
```julia-repl
julia> sort([2,3,1], rev=true)
3-element Vector{Int64}:
 3
 2
 1
```
`sort` constructs a sorted copy leaving its input unchanged. Use the "bang" version of the sort function to mutate an existing array:
```julia-repl
julia> a = [2,3,1];

julia> sort!(a);

julia> a
3-element Vector{Int64}:
 1
 2
 3
```
Instead of directly sorting an array, you can compute a permutation of the array's indices that puts the array into sorted order:
```julia-repl
julia> v = randn(5)
5-element Array{Float64,1}:
  0.297288
  0.382396
 -0.597634
 -0.0104452
 -0.839027

julia> p = sortperm(v)
5-element Array{Int64,1}:
 5
 3
 4
 1
 2

julia> v[p]
5-element Array{Float64,1}:
 -0.839027
 -0.597634
 -0.0104452
  0.297288
  0.382396
```
Arrays can be sorted according to an arbitrary transformation of their values:
```julia-repl
julia> sort(v, by=abs)
5-element Array{Float64,1}:
 -0.0104452
  0.297288
  0.382396
 -0.597634
 -0.839027
```
Or in reverse order by a transformation:
```julia-repl
julia> sort(v, by=abs, rev=true)
5-element Array{Float64,1}:
 -0.839027
 -0.597634
  0.382396
  0.297288
 -0.0104452
```
If needed, the sorting algorithm can be chosen:


# [Sorting and Related Functions](#Sorting-and-Related-Functions)
```julia-repl
julia> sort(v, alg=InsertionSort)
5-element Array{Float64,1}:
 -0.839027
 -0.597634
 -0.0104452
  0.297288
  0.382396
```
All the sorting and order related functions rely on a "less than" relation defining a [strict weak order](https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings) on the values to be manipulated. The `isless` function is invoked by default, but the relation can be specified via the `lt` keyword, a function that takes two array elements and returns `true` if and only if the first argument is "less than" the second. See [`sort!`](#Base.sort!) and [Alternate Orderings](#Alternate-Orderings) for more information.


## [Sorting Functions](#Sorting-Functions)
```julia
sort!(v; alg::Algorithm=defalg(v), lt=isless, by=identity, rev::Bool=false, order::Ordering=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](#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`](#Base.Order.Forward) or [`Base.Order.Reverse`](#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](#Alternate-Orderings).
Relations between two elements are defined as follows (with "less" and "greater" exchanged when `rev=true`):
-   `x` is less than `y` if `lt(by(x), by(y))` (or `Base.Order.lt(order, by(x), by(y))`) yields true.
-   `x` is greater than `y` if `y` is less than `x`.


## [Sorting Functions](#Sorting-Functions)
-   `x` and `y` are equivalent if neither is less than the other ("incomparable" is sometimes used as a synonym for "equivalent").
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
-   irreflexive: `lt(x, x)` always yields `false`,
-   asymmetric: if `lt(x, y)` yields `true` then `lt(y, x)` yields `false`,
-   transitive: `lt(x, y) && lt(y, z)` implies `lt(x, z)`,
-   transitive in equivalence: `!lt(x, y) && !lt(y, x)` and `!lt(y, z) && !lt(z, y)` together imply `!lt(x, z) && !lt(z, x)`. In words: if `x` and `y` are equivalent and `y` and `z` are equivalent then `x` and `z` must be equivalent.
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`](#Base.sort), [`sortperm`](#Base.sortperm), [`sortslices`](#Base.sortslices), [`partialsort!`](#Base.Sort.partialsort!), [`partialsortperm`](#Base.Sort.partialsortperm), [`issorted`](#Base.issorted), [`searchsorted`](#Base.Sort.searchsorted), [`insorted`](#Base.Sort.insorted), [`Base.Order.ord`](#Base.Order.ord).
**Examples**


## [Sorting Functions](#Sorting-Functions)
```julia-repl
julia> v = [3, 1, 2]; sort!(v); v
3-element Vector{Int64}:
 1
 2
 3

julia> v = [3, 1, 2]; sort!(v, rev = true); v
3-element Vector{Int64}:
 3
 2
 1

julia> v = [(1, "c"), (3, "a"), (2, "b")]; sort!(v, by = x -> x[1]); v
3-element Vector{Tuple{Int64, String}}:
 (1, "c")
 (2, "b")
 (3, "a")

julia> v = [(1, "c"), (3, "a"), (2, "b")]; sort!(v, by = x -> x[2]); v
3-element Vector{Tuple{Int64, String}}:
 (3, "a")
 (2, "b")
 (1, "c")

julia> sort(0:3, by=x->x-2, order=Base.Order.By(abs)) # same as sort(0:3, by=abs(x->x-2))
4-element Vector{Int64}:
 2
 1
 3
 0

julia> sort([2, NaN, 1, NaN, 3]) # correct sort with default lt=isless
5-element Vector{Float64}:
   1.0
   2.0
   3.0
 NaN
 NaN

julia> sort([2, NaN, 1, NaN, 3], lt=<) # wrong sort due to invalid lt. This behavior is undefined.
5-element Vector{Float64}:
   2.0
 NaN
   1.0
 NaN
   3.0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1585-L1686)
```julia
sort!(A; dims::Integer, alg::Algorithm=defalg(A), lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
```
Sort the multidimensional array `A` along dimension `dims`. See the one-dimensional version of [`sort!`](#Base.sort!) for a description of possible keyword arguments.
To sort slices of an array, refer to [`sortslices`](#Base.sortslices).
This function requires at least Julia 1.1.
**Examples**


## [Sorting Functions](#Sorting-Functions)
```julia-repl
julia> A = [4 3; 1 2]
2×2 Matrix{Int64}:
 4  3
 1  2

julia> sort!(A, dims = 1); A
2×2 Matrix{Int64}:
 1  2
 4  3

julia> sort!(A, dims = 2); A
2×2 Matrix{Int64}:
 1  2
 3  4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L2059-L2088)
```julia
sort(v; alg::Algorithm=defalg(v), lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
```
Variant of [`sort!`](#Base.sort!) that returns a sorted copy of `v` leaving `v` itself unmodified.
**Examples**
```julia-repl
julia> v = [3, 1, 2];

julia> sort(v)
3-element Vector{Int64}:
 1
 2
 3

julia> v
3-element Vector{Int64}:
 3
 1
 2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1698-L1719)
```julia
sort(A; dims::Integer, alg::Algorithm=defalg(A), lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
```
Sort a multidimensional array `A` along the given dimension. See [`sort!`](#Base.sort!) for a description of possible keyword arguments.
To sort slices of an array, refer to [`sortslices`](#Base.sortslices).
**Examples**
```julia-repl
julia> A = [4 3; 1 2]
2×2 Matrix{Int64}:
 4  3
 1  2

julia> sort(A, dims = 1)
2×2 Matrix{Int64}:
 1  2
 4  3

julia> sort(A, dims = 2)
2×2 Matrix{Int64}:
 3  4
 1  2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1987-L2013)


## [Sorting Functions](#Sorting-Functions)
```julia
sortperm(A; alg::Algorithm=DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Ordering=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!`](#Base.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!`](#Base.Sort.sortperm!), [`partialsortperm`](#Base.Sort.partialsortperm), [`invperm`](../arrays/#Base.invperm), [`indexin`](../collections/#Base.indexin). To sort slices of an array, refer to [`sortslices`](#Base.sortslices).
The method accepting `dims` requires at least Julia 1.9.
**Examples**
```julia-repl
julia> v = [3, 1, 2];

julia> p = sortperm(v)
3-element Vector{Int64}:
 2
 3
 1

julia> v[p]
3-element Vector{Int64}:
 1
 2
 3

julia> A = [8 7; 5 6]
2×2 Matrix{Int64}:
 8  7
 5  6

julia> sortperm(A, dims = 1)
2×2 Matrix{Int64}:
 2  4
 1  3

julia> sortperm(A, dims = 2)
2×2 Matrix{Int64}:
 3  1
 2  4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1821-L1867)
```julia
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:


## [Sorting Functions](#Sorting-Functions)
-   *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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L799-L813)
```julia
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`](#Base.Sort.QuickSort).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L2278-L2295)
```julia
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`](#Base.Sort.MergeSort).


## [Sorting Functions](#Sorting-Functions)
-   *good performance* for large collections.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L2262-L2275)
```julia
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`](#Base.Sort.MergeSort).
Note that `PartialQuickSort(k)` does not necessarily sort the whole array. For example,
```julia-repl
julia> x = rand(100);

julia> k = 50:100;

julia> s1 = sort(x; alg=QuickSort);

julia> s2 = sort(x; alg=PartialQuickSort(k));

julia> map(issorted, (s1, s2))
(true, false)

julia> map(x->issorted(x[k]), (s1, s2))
(true, true)

julia> s1[k] == s2[k]
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L2223-L2257)
```julia
sortperm!(ix, A; alg::Algorithm=DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward, [dims::Integer])
```
Like [`sortperm`](#Base.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)`.


## [Sorting Functions](#Sorting-Functions)
Behavior can be unexpected when any mutated argument shares memory with any other argument.
The method accepting `dims` requires at least Julia 1.9.
**Examples**
```julia-repl
julia> v = [3, 1, 2]; p = zeros(Int, 3);

julia> sortperm!(p, v); p
3-element Vector{Int64}:
 2
 3
 1

julia> v[p]
3-element Vector{Int64}:
 1
 2
 3

julia> A = [8 7; 5 6]; p = zeros(Int,2, 2);

julia> sortperm!(p, A; dims=1); p
2×2 Matrix{Int64}:
 2  4
 1  3

julia> sortperm!(p, A; dims=2); p
2×2 Matrix{Int64}:
 3  1
 2  4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1899-L1938)
```julia
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!`](#Base.sort!).
**Examples**


## [Sorting Functions](#Sorting-Functions)
```julia-repl
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
  9  -2  8

julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1, lt=(x,y)->isless(x[2],y[2]))
3×3 Matrix{Int64}:
  9  -2  8
  7   3  5
 -1   6  4

julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1, rev=true)
3×3 Matrix{Int64}:
  9  -2  8
  7   3  5
 -1   6  4

julia> sortslices([7 3 5; 6 -1 -4; 9 -2 8], dims=2) # Sort columns
3×3 Matrix{Int64}:
  3   5  7
 -1  -4  6
 -2   8  9

julia> sortslices([7 3 5; 6 -1 -4; 9 -2 8], dims=2, alg=InsertionSort, lt=(x,y)->isless(x[2],y[2]))
3×3 Matrix{Int64}:
  5   3  7
 -4  -1  6
  8  -2  9

julia> sortslices([7 3 5; 6 -1 -4; 9 -2 8], dims=2, rev=true)
3×3 Matrix{Int64}:
 7   5   3
 6  -4  -1
 9   8  -2
```
**Higher dimensions**
`sortslices` extends naturally to higher dimensions. E.g., if `A` is a a 2x2x2 array, `sortslices(A, dims=3)` will sort slices within the 3rd dimension, passing the 2x2 slices `A[:, :, 1]` and `A[:, :, 2]` to the comparison function. Note that while there is no default order on higher-dimensional slices, you may use the `by` or `lt` keyword argument to specify such an order.


## [Sorting Functions](#Sorting-Functions)
If `dims` is a tuple, the order of the dimensions in `dims` is relevant and specifies the linear order of the slices. E.g., if `A` is three dimensional and `dims` is `(1, 2)`, the orderings of the first two dimensions are re-arranged such that the slices (of the remaining third dimension) are sorted. If `dims` is `(2, 1)` instead, the same slices will be taken, but the result order will be row-major instead.
**Higher dimensional examples**
```julia
julia> A = [4 3; 2 1 ;;; 'A' 'B'; 'C' 'D']
2×2×2 Array{Any, 3}:
[:, :, 1] =
 4  3
 2  1

[:, :, 2] =
 'A'  'B'
 'C'  'D'

julia> sortslices(A, dims=(1,2))
2×2×2 Array{Any, 3}:
[:, :, 1] =
 1  3
 2  4

[:, :, 2] =
 'D'  'B'
 'C'  'A'

julia> sortslices(A, dims=(2,1))
2×2×2 Array{Any, 3}:
[:, :, 1] =
 1  2
 3  4

[:, :, 2] =
 'D'  'C'
 'B'  'A'

julia> sortslices(reshape([5; 4; 3; 2; 1], (1,1,5)), dims=3, by=x->x[1,1])
1×1×5 Array{Int64, 3}:
[:, :, 1] =
 1

[:, :, 2] =
 2

[:, :, 3] =
 3

[:, :, 4] =
 4

[:, :, 5] =
 5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/multidimensional.jl#L1812-L1928)


## [Order-Related Functions](#Order-Related-Functions)
```julia
issorted(v, lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)
```
Test whether a collection is in sorted order. The keywords modify what order is considered sorted, as described in the [`sort!`](#Base.sort!) documentation.
**Examples**
```julia-repl
julia> issorted([1, 2, 3])
true

julia> issorted([(1, "b"), (2, "a")], by = x -> x[1])
true

julia> issorted([(1, "b"), (2, "a")], by = x -> x[2])
false

julia> issorted([(1, "b"), (2, "a")], by = x -> x[2], rev=true)
true

julia> issorted([1, 2, -2, 3], by=abs)
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L64-L87)
```julia
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!`](#Base.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`](#Base.Sort.searchsortedfirst), [`sort!`](#Base.sort!), [`insorted`](#Base.Sort.insorted), [`findall`](../arrays/#Base.findall-Tuple%7BAny%7D).
**Examples**


## [Order-Related Functions](#Order-Related-Functions)
```julia-repl
julia> searchsorted([1, 2, 4, 5, 5, 7], 4) # single match
3:3

julia> searchsorted([1, 2, 4, 5, 5, 7], 5) # multiple matches
4:5

julia> searchsorted([1, 2, 4, 5, 5, 7], 3) # no match, insert in the middle
3:2

julia> searchsorted([1, 2, 4, 5, 5, 7], 9) # no match, insert at end
7:6

julia> searchsorted([1, 2, 4, 5, 5, 7], 0) # no match, insert at start
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L308-L343)
```julia
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!`](#Base.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`](#Base.Sort.searchsortedlast), [`searchsorted`](#Base.Sort.searchsorted), [`findfirst`](../arrays/#Base.findfirst-Tuple%7BAny%7D).
**Examples**


## [Order-Related Functions](#Order-Related-Functions)
```julia-repl
julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 4) # single match
3

julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 5) # multiple matches
4

julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 3) # no match, insert in the middle
3

julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 9) # no match, insert at end
7

julia> searchsortedfirst([1, 2, 4, 5, 5, 7], 0) # no match, insert at start
1

julia> searchsortedfirst([1=>"one", 2=>"two", 4=>"four"], 3=>"three", by=first) # compare the keys of the pairs
3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L345-L382)
```julia
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!`](#Base.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**


## [Order-Related Functions](#Order-Related-Functions)
```julia-repl
julia> searchsortedlast([1, 2, 4, 5, 5, 7], 4) # single match
3

julia> searchsortedlast([1, 2, 4, 5, 5, 7], 5) # multiple matches
5

julia> searchsortedlast([1, 2, 4, 5, 5, 7], 3) # no match, insert in the middle
2

julia> searchsortedlast([1, 2, 4, 5, 5, 7], 9) # no match, insert at end
6

julia> searchsortedlast([1, 2, 4, 5, 5, 7], 0) # no match, insert at start
0

julia> searchsortedlast([1=>"one", 2=>"two", 4=>"four"], 3=>"three", by=first) # compare the keys of the pairs
2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L384-L419)
```julia
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!`](#Base.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`](../collections/#Base.in).
**Examples**


## [Order-Related Functions](#Order-Related-Functions)
```julia-repl
julia> insorted(4, [1, 2, 4, 5, 5, 7]) # single match
true

julia> insorted(5, [1, 2, 4, 5, 5, 7]) # multiple matches
true

julia> insorted(3, [1, 2, 4, 5, 5, 7]) # no match
false

julia> insorted(9, [1, 2, 4, 5, 5, 7]) # no match
false

julia> insorted(0, [1, 2, 4, 5, 5, 7]) # no match
false

julia> insorted(2=>"TWO", [1=>"one", 2=>"two", 4=>"four"], by=first) # compare the keys of the pairs
true
```
`insorted` was added in Julia 1.6.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L421-L458)
```julia
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!`](#Base.sort!).
**Examples**
```julia-repl
julia> a = [1, 2, 4, 3, 4]
5-element Vector{Int64}:
 1
 2
 4
 3
 4

julia> partialsort!(a, 4)
4

julia> a
5-element Vector{Int64}:
 1
 2
 3
 4
 4

julia> a = [1, 2, 4, 3, 4]
5-element Vector{Int64}:
 1
 2
 4
 3
 4

julia> partialsort!(a, 4, rev=true)
2

julia> a
5-element Vector{Int64}:
 4
 4
 3
 2
 1
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L108-L160)


## [Order-Related Functions](#Order-Related-Functions)
```julia
partialsort(v, k, by=identity, lt=isless, rev=false)
```
Variant of [`partialsort!`](#Base.Sort.partialsort!) that copies `v` before partially sorting it, thereby returning the same thing as `partialsort!` but leaving `v` unmodified.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L165-L170)
```julia
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-repl
julia> v = [3, 1, 2, 1];

julia> v[partialsortperm(v, 1)]
1

julia> p = partialsortperm(v, 1:3)
3-element view(::Vector{Int64}, 1:3) with eltype Int64:
 2
 4
 3

julia> v[p]
3-element Vector{Int64}:
 1
 1
 2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1724-L1754)
```julia
partialsortperm!(ix, v, k; by=identity, lt=isless, rev=false)
```
Like [`partialsortperm`](#Base.Sort.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`.


## [Order-Related Functions](#Order-Related-Functions)
`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
```julia
partialsortperm!(ix, v, k);
v[ix[k]] == partialsort(v, k)
```
The return value is the `k`th element of `ix` if `k` is an integer, or view into `ix` if `k` is a range.
Behavior can be unexpected when any mutated argument shares memory with any other argument.
**Examples**
```julia-repl
julia> v = [3, 1, 2, 1];

julia> ix = Vector{Int}(undef, 4);

julia> partialsortperm!(ix, v, 1)
2

julia> ix = [1:4;];

julia> partialsortperm!(ix, v, 2:3)
2-element view(::Vector{Int64}, 2:3) with eltype Int64:
 4
 3
```
```julia
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sort.jl#L1758-L1797)


## [Sorting Algorithms](#Sorting-Algorithms)
There are currently four sorting algorithms publicly available in base Julia:
-   [`InsertionSort`](#Base.Sort.InsertionSort)
-   [`QuickSort`](#Base.Sort.QuickSort)
-   [`PartialQuickSort(k)`](#Base.Sort.PartialQuickSort)
-   [`MergeSort`](#Base.Sort.MergeSort)
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](https://github.com/JuliaStrings/InlineStrings.jl/blob/v1.3.2/src/InlineStrings.jl#L903) defines the following method:
```julia
Base.Sort.defalg(::AbstractArray{<:Union{SmallInlineStrings, Missing}}) = InlineStringSort
```
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](#Alternate-Orderings)
By default, `sort`, `searchsorted`, and related functions use [`isless`](../base/#Base.isless) to compare two elements in order to determine which should come first. The [`Base.Order.Ordering`](#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`](#Base.Order.lt) function, which works as a generalization of `isless`. This function's behavior on custom `Ordering`s must satisfy all the conditions of a [strict weak order](https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings). See [`sort!`](#Base.sort!) for details and examples of valid and invalid `lt` functions.
```julia
Base.Order.Ordering
```
Abstract type which represents a strict weak order on some set of elements. See [`sort!`](#Base.sort!) for more.
Use [`Base.Order.lt`](#Base.Order.lt) to compare two elements according to the ordering.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L21-L28)
```julia
lt(o::Ordering, a, b) -> Bool
```
Test whether `a` is less than `b` according to the ordering `o`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L113-L117)
```julia
ord(lt, by, rev::Union{Bool, Nothing}, order::Ordering=Forward)
```


## [Alternate Orderings](#Alternate-Orderings)
Construct an [`Ordering`](#Base.Order.Ordering) object from the same arguments used by [`sort!`](#Base.sort!). Elements are first transformed by the function `by` (which may be [`identity`](../base/#Base.identity)) and are then compared according to either the function `lt` or an existing ordering `order`. `lt` should be [`isless`](../base/#Base.isless) or a function that obeys the same rules as the `lt` parameter of [`sort!`](#Base.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`](#Base.Order.Forward) or [`Base.Order.Reverse`](#Base.Order.Reverse) is not permitted, otherwise all options are independent and can be used together in all possible combinations.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L139-L154)
```julia
Base.Order.Forward
```
Default ordering according to [`isless`](../base/#Base.isless).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L60-L64)
```julia
ReverseOrdering(fwd::Ordering=Forward)
```
A wrapper which reverses an ordering.
For a given `Ordering` `o`, the following holds for all `a`, `b`:
```julia
lt(ReverseOrdering(o), a, b) == lt(o, b, a)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L33-L41)
```julia
Base.Order.Reverse
```
Reverse ordering according to [`isless`](../base/#Base.isless).


## [Alternate Orderings](#Alternate-Orderings)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L67-L71)
```julia
By(by, order::Ordering=Forward)
```
`Ordering` which applies `order` to elements after they have been transformed by the function `by`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L74-L79)
```julia
Lt(lt)
```
`Ordering` that calls `lt(a, b)` to compare elements. `lt` must obey the same rules as the `lt` parameter of [`sort!`](#Base.sort!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L88-L93)
```julia
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ordering.jl#L98-L104)
------------------------------------------------------------------------


# Iteration utilities · The Julia Language
Source: https://docs.julialang.org/en/v1/base/iterators/


# [Iteration utilities](#Iteration-utilities)
```julia
Stateful(itr)
```
There are several different ways to think about this iterator wrapper:
1.  It provides a mutable wrapper around an iterator and its iteration state.
2.  It turns an iterator-like abstraction into a `Channel`-like abstraction.
3.  It's an iterator that mutates to become its own rest iterator whenever an item is produced.
`Stateful` provides the regular iterator interface. Like other mutable iterators (e.g. [`Base.Channel`](../parallel/#Base.Channel)), if iteration is stopped early (e.g. by a [`break`](../base/#break) in a [`for`](../base/#for) loop), iteration can be resumed from the same spot by continuing to iterate over the same iterator object (in contrast, an immutable iterator would restart from the beginning).
**Examples**
```julia-repl
julia> a = Iterators.Stateful("abcdef");

julia> isempty(a)
false

julia> popfirst!(a)
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)

julia> collect(Iterators.take(a, 3))
3-element Vector{Char}:
 '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)

julia> collect(a)
2-element Vector{Char}:
 'e': ASCII/Unicode U+0065 (category Ll: Letter, lowercase)
 'f': ASCII/Unicode U+0066 (category Ll: Letter, lowercase)

julia> Iterators.reset!(a); popfirst!(a)
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)

julia> Iterators.reset!(a, "hello"); popfirst!(a)
'h': ASCII/Unicode U+0068 (category Ll: Letter, lowercase)
```


# [Iteration utilities](#Iteration-utilities)
```julia-repl
julia> a = Iterators.Stateful([1,1,1,2,3,4]);

julia> for x in a; x == 1 || break; end

julia> peek(a)
3

julia> sum(a) # Sum the remaining elements
7
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1388-L1445)
```julia
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.
`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.
`zip()` with no arguments yields an infinite iterator of empty tuples.
See also: [`enumerate`](#Base.Iterators.enumerate), [`Base.splat`](../base/#Base.splat).
**Examples**
```julia-repl
julia> a = 1:5
1:5

julia> b = ["e","d","b","c","a"]
5-element Vector{String}:
 "e"
 "d"
 "b"
 "c"
 "a"

julia> c = zip(a,b)
zip(1:5, ["e", "d", "b", "c", "a"])

julia> length(c)
5

julia> first(c)
(1, "e")
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L335-L373)
```julia
enumerate(iter)
```
An iterator that yields `(i, x)` where `i` is a counter starting at 1, and `x` is the `i`th 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.


# [Iteration utilities](#Iteration-utilities)
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-repl
julia> a = ["a", "b", "c"];

julia> for (index, value) in enumerate(a)
           println("$index $value")
       end
1 a
2 b
3 c

julia> str = "naïve";

julia> for (i, val) in enumerate(str)
           print("i = ", i, ", val = ", val, ", ")
           try @show(str[i]) catch e println(e) end
       end
i = 1, val = n, str[i] = 'n'
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L163-L199)
```julia
rest(iter, state)
```
An iterator that yields the same elements as `iter`, but starting at the given `state`.
See also: [`Iterators.drop`](#Base.Iterators.drop), [`Iterators.peel`](#Base.Iterators.peel), [`Base.rest`](../collections/#Base.rest).
**Examples**
```julia-repl
julia> collect(Iterators.rest([1,2,3,4], 2))
3-element Vector{Int64}:
 2
 3
 4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L636-L651)
```julia
countfrom(start=1, step=1)
```
An iterator that counts forever, starting at `start` and incrementing by `step`.
**Examples**


# [Iteration utilities](#Iteration-utilities)
```julia-repl
julia> for v in Iterators.countfrom(5, 2)
           v > 10 && break
           println(v)
       end
5
7
9
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L704-L719)
```julia
take(iter, n)
```
An iterator that generates at most the first `n` elements of `iter`.
See also: [`drop`](#Base.Iterators.drop), [`peel`](#Base.Iterators.peel), [`first`](../collections/#Base.first), [`Base.take!`](../io-network/#Base.take!-Tuple%7BBase.GenericIOBuffer%7D).
**Examples**
```julia-repl
julia> a = 1:2:11
1:2:11

julia> collect(a)
6-element Vector{Int64}:
  1
  3
  5
  7
  9
 11

julia> collect(Iterators.take(a,3))
3-element Vector{Int64}:
 1
 3
 5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L743-L770)
```julia
takewhile(pred, iter)
```
An iterator that generates element from `iter` as long as predicate `pred` is true, afterwards, drops every element.
This function requires at least Julia 1.4.
**Examples**
```julia-repl
julia> s = collect(1:5)
5-element Vector{Int64}:
 1
 2
 3
 4
 5

julia> collect(Iterators.takewhile(<(3),s))
2-element Vector{Int64}:
 1
 2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L858-L883)
```julia
drop(iter, n)
```
An iterator that generates all but the first `n` elements of `iter`.
**Examples**


# [Iteration utilities](#Iteration-utilities)
```julia-repl
julia> a = 1:2:11
1:2:11

julia> collect(a)
6-element Vector{Int64}:
  1
  3
  5
  7
  9
 11

julia> collect(Iterators.drop(a,4))
2-element Vector{Int64}:
  9
 11
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L802-L826)
```julia
dropwhile(pred, iter)
```
An iterator that drops element from `iter` as long as predicate `pred` is true, afterwards, returns every element.
This function requires at least Julia 1.4.
**Examples**
```julia-repl
julia> s = collect(1:5)
5-element Vector{Int64}:
 1
 2
 3
 4
 5

julia> collect(Iterators.dropwhile(<(3),s))
3-element Vector{Int64}:
 3
 4
 5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L905-L931)
```julia
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`](../arrays/#Base.repeat)`(vector, n)`, while [`Iterators.repeated`](#Base.Iterators.repeated)`(iter, n)` is the lazy [`Base.fill`](../arrays/#Base.fill)`(item, n)`.
The method `cycle(iter, n)` was added in Julia 1.11.
**Examples**


# [Iteration utilities](#Iteration-utilities)
```julia-repl
julia> for (i, v) in enumerate(Iterators.cycle("hello"))
           print(v)
           i > 10 && break
       end
hellohelloh

julia> foreach(print, Iterators.cycle(['j', 'u', 'l', 'i', 'a'], 3))
juliajuliajulia

julia> repeat([1,2,3], 4) == collect(Iterators.cycle([1,2,3], 4))
true

julia> fill([1,2,3], 4) == collect(Iterators.repeated([1,2,3], 4))
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L955-L985)
```julia
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`](../arrays/#Base.fill), and compare [`Iterators.cycle`](#Base.Iterators.cycle).
**Examples**
```julia-repl
julia> a = Iterators.repeated([1 2], 4);

julia> collect(a)
4-element Vector{Matrix{Int64}}:
 [1 2]
 [1 2]
 [1 2]
 [1 2]

julia> ans == fill([1 2], 4)
true

julia> Iterators.cycle([1 2], 4) |> collect |> println
[1, 2, 1, 2, 1, 2, 1, 2]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1012-L1037)
```julia
product(iters...)
```
Return an iterator over the product of several iterators. Each generated element is a tuple whose `i`th element comes from the `i`th argument iterator. The first iterator changes the fastest.
See also: [`zip`](#Base.Iterators.zip), [`Iterators.flatten`](#Base.Iterators.flatten).
**Examples**


# [Iteration utilities](#Iteration-utilities)
```julia-repl
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1055-L1074)
```julia
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-repl
julia> collect(Iterators.flatten((1:2, 8:9)))
4-element Vector{Int64}:
 1
 2
 8
 9

julia> [(x,y) for x in 0:1 for y in 'a':'c']  # collects generators involving Iterators.flatten
6-element Vector{Tuple{Int64, Char}}:
 (0, 'a')
 (0, 'b')
 (0, 'c')
 (1, 'a')
 (1, 'b')
 (1, 'c')
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1189-L1214)
```julia
Iterators.flatmap(f, iterators...)
```
Equivalent to `flatten(map(f, iterators...))`.
See also [`Iterators.flatten`](#Base.Iterators.flatten), [`Iterators.map`](#Base.Iterators.map).
This function was added in Julia 1.9.
**Examples**


# [Iteration utilities](#Iteration-utilities)
```julia-repl
julia> Iterators.flatmap(n -> -n:2:n, 1:3) |> collect
9-element Vector{Int64}:
 -1
  1
 -2
  0
  2
 -3
 -1
  1
  3

julia> stack(n -> -n:2:n, 1:3)
ERROR: DimensionMismatch: stack expects uniform slices, got axes(x) == (1:3,) while first had (1:2,)
[...]

julia> Iterators.flatmap(n -> (-n, 10n), 1:2) |> collect
4-element Vector{Int64}:
 -1
 10
 -2
 20

julia> ans == vec(stack(n -> (-n, 10n), 1:2))
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1265-L1303)
```julia
partition(collection, n)
```
Iterate over a collection `n` elements at a time.
**Examples**
```julia-repl
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1307-L1320)
```julia
Iterators.map(f, iterators...)
```
Create a lazy mapping. This is another syntax for writing `(f(args...) for args in zip(iterators...))`.
This function requires at least Julia 1.6.
**Examples**
```julia-repl
julia> collect(Iterators.map(x -> x^2, 1:3))
3-element Vector{Int64}:
 1
 4
 9
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L44-L61)
```julia
Iterators.filter(flt, itr)
```


# [Iteration utilities](#Iteration-utilities)
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.
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`](../collections/#Base.filter) for an eager implementation of filtering for arrays.
**Examples**
```julia-repl
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)
1
3
5

julia> [x for x in [1, 2, 3, 4, 5] if isodd(x)]  # collects a generator over Iterators.filter
3-element Vector{Int64}:
 1
 3
 5
```


# [Iteration utilities](#Iteration-utilities)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L502-L542)
```julia
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`](../arrays/#Base.accumulate).
Keyword argument `init` is added in Julia 1.5.
**Examples**
```julia-repl
julia> a = Iterators.accumulate(+, [1,2,3,4]);

julia> foreach(println, a)
1
3
6
10

julia> b = Iterators.accumulate(/, (2, 5, 2, 5); init = 100);

julia> collect(b)
4-element Vector{Float64}:
 50.0
 10.0
  5.0
  1.0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L571-L602)
```julia
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`](../arrays/#Base.reverse-Tuple%7BAbstractVector%7D) for an eager implementation.
(By default, this returns an `Iterators.Reverse` object wrapping `itr`, which is iterable if the corresponding [`iterate`](../collections/#Base.iterate) methods are defined, but some `itr` types may implement more specialized `Iterators.reverse` behaviors.)


# [Iteration utilities](#Iteration-utilities)
Not all iterator types `T` support reverse-order iteration. If `T` doesn't, then iterating over `Iterators.reverse(itr::T)` will throw a [`MethodError`](../base/#Core.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-repl
julia> foreach(println, Iterators.reverse(1:5))
5
4
3
2
1
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L90-L119)
```julia
only(x)
```
Return the one and only element of collection `x`, or throw an [`ArgumentError`](../base/#Core.ArgumentError) if the collection has zero or multiple elements.
See also [`first`](../collections/#Base.first), [`last`](../collections/#Base.last).
This method requires at least Julia 1.4.
**Examples**
```julia-repl
julia> only(["a"])
"a"

julia> only("a")
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)

julia> only(())
ERROR: ArgumentError: Tuple contains 0 elements, must contain exactly 1 element
Stacktrace:
[...]

julia> only(('a', 'b'))
ERROR: ArgumentError: Tuple contains 2 elements, must contain exactly 1 element
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L1515-L1544)
```julia
peel(iter)
```
Returns the first element and an iterator over the remaining elements.


# [Iteration utilities](#Iteration-utilities)
If the iterator is empty return `nothing` (like `iterate`).
Prior versions throw a BoundsError if the iterator is empty.
See also: [`Iterators.drop`](#Base.Iterators.drop), [`Iterators.take`](#Base.Iterators.take).
**Examples**
```julia-repl
julia> (a, rest) = Iterators.peel("abc");

julia> a
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)

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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L656-L680)
------------------------------------------------------------------------


# Reflection and introspection · The Julia Language
Source: https://docs.julialang.org/en/v1/base/reflection/


# [Reflection and introspection](#Reflection-and-introspection)
Julia provides a variety of runtime reflection capabilities.


## [Module bindings](#Module-bindings)
The public names for a `Module` are available using [`names(m::Module)`](../base/#Base.names), which will return an array of [`Symbol`](../base/#Core.Symbol) elements representing the public bindings. `names(m::Module, all = true)` returns symbols for all bindings in `m`, regardless of public status.


## [DataType fields](#DataType-fields)
The names of `DataType` fields may be interrogated using [`fieldnames`](../base/#Base.fieldnames). For example, given the following type, `fieldnames(Point)` returns a tuple of [`Symbol`](../base/#Core.Symbol)s representing the field names:
```julia-repl
julia> struct Point
           x::Int
           y
       end

julia> fieldnames(Point)
(:x, :y)
```
The type of each field in a `Point` object is stored in the `types` field of the `Point` variable itself:
```julia-repl
julia> Point.types
svec(Int64, Any)
```
While `x` is annotated as an `Int`, `y` was unannotated in the type definition, therefore `y` defaults to the `Any` type.
Types are themselves represented as a structure called `DataType`:
```julia-repl
julia> typeof(Point)
DataType
```
Note that `fieldnames(DataType)` gives the names for each field of `DataType` itself, and one of these fields is the `types` field observed in the example above.


## [Subtypes](#Subtypes)
The *direct* subtypes of any `DataType` may be listed using [`subtypes`](../../stdlib/InteractiveUtils/#InteractiveUtils.subtypes). For example, the abstract `DataType` [`AbstractFloat`](../numbers/#Core.AbstractFloat) has four (concrete) subtypes:
```julia-repl
julia> InteractiveUtils.subtypes(AbstractFloat)
5-element Vector{Any}:
 BigFloat
 Core.BFloat16
 Float16
 Float32
 Float64
```
Any abstract subtype will also be included in this list, but further subtypes thereof will not; recursive application of [`subtypes`](../../stdlib/InteractiveUtils/#InteractiveUtils.subtypes) may be used to inspect the full type tree.
Note that [`subtypes`](../../stdlib/InteractiveUtils/#InteractiveUtils.subtypes) is located inside [`InteractiveUtils`](../../stdlib/InteractiveUtils/#man-interactive-utils) but is automatically exported when using the REPL.


## [DataType layout](#DataType-layout)
The internal representation of a `DataType` is critically important when interfacing with C code and several functions are available to inspect these details. [`isbitstype(T::DataType)`](../base/#Base.isbitstype) returns true if `T` is stored with C-compatible alignment. [`fieldoffset(T::DataType, i::Integer)`](../base/#Base.fieldoffset) returns the (byte) offset for field *i* relative to the start of the type.


## [Function methods](#Function-methods)
The methods of any generic function may be listed using [`methods`](../base/#Base.methods). The method dispatch table may be searched for methods accepting a given type using [`methodswith`](../../stdlib/InteractiveUtils/#InteractiveUtils.methodswith).


## [Expansion and lowering](#Expansion-and-lowering)
As discussed in the [Metaprogramming](../../manual/metaprogramming/#Metaprogramming) section, the [`macroexpand`](../base/#Base.macroexpand) function gives the unquoted and interpolated expression ([`Expr`](../base/#Core.Expr)) form for a given macro. To use `macroexpand`, `quote` the expression block itself (otherwise, the macro will be evaluated and the result will be passed instead!). For example:
```julia-repl
julia> InteractiveUtils.macroexpand(@__MODULE__, :(@edit println("")) )
:(InteractiveUtils.edit(println, (Base.typesof)("")))
```
The functions `Base.Meta.show_sexpr` and [`dump`](../io-network/#Base.dump) are used to display S-expr style views and depth-nested detail views for any expression.
Finally, the [`Meta.lower`](../base/#Base.Meta.lower) function gives the `lowered` form of any expression and is of particular interest for understanding how language constructs map to primitive operations such as assignments, branches, and calls:
```julia-repl
julia> Meta.lower(@__MODULE__, :( [1+2, sin(0.5)] ))
:($(Expr(:thunk, CodeInfo(
    @ none within `top-level scope`
1 ─ %1 = 1 + 2
│   %2 = sin(0.5)
│   %3 = Base.vect(%1, %2)
└──      return %3
))))
```


## [Intermediate and compiled representations](#Intermediate-and-compiled-representations)
Inspecting the lowered form for functions requires selection of the specific method to display, because generic functions may have many methods with different type signatures. For this purpose, method-specific code-lowering is available using [`code_lowered`](../base/#Base.code_lowered), and the type-inferred form is available using [`code_typed`](../base/#Base.code_typed). [`code_warntype`](../../stdlib/InteractiveUtils/#InteractiveUtils.code_warntype) adds highlighting to the output of [`code_typed`](../base/#Base.code_typed).
Closer to the machine, the LLVM intermediate representation of a function may be printed using by [`code_llvm`](../../stdlib/InteractiveUtils/#InteractiveUtils.code_llvm), and finally the compiled machine code is available using [`code_native`](../../stdlib/InteractiveUtils/#InteractiveUtils.code_native) (this will trigger JIT compilation/code generation for any function which has not previously been called).
For convenience, there are macro versions of the above functions which take standard function calls and expand argument types automatically:
```julia-repl
julia> @code_llvm +(1,1)
;  @ int.jl:87 within `+`
; Function Attrs: sspstrong uwtable
define i64 @"julia_+_476"(i64 signext %0, i64 signext %1) #0 {
top:
  %2 = add i64 %1, %0
  ret i64 %2
}
```


## [Intermediate and compiled representations](#Intermediate-and-compiled-representations)
For more information see [`@code_lowered`](../../stdlib/InteractiveUtils/#InteractiveUtils.@code_lowered), [`@code_typed`](../../stdlib/InteractiveUtils/#InteractiveUtils.@code_typed), [`@code_warntype`](../../stdlib/InteractiveUtils/#InteractiveUtils.@code_warntype), [`@code_llvm`](../../stdlib/InteractiveUtils/#InteractiveUtils.@code_llvm), and [`@code_native`](../../stdlib/InteractiveUtils/#InteractiveUtils.@code_native).


### [Printing of debug information](#Printing-of-debug-information)
The aforementioned functions and macros take the keyword argument `debuginfo` that controls the level debug information printed.
```julia-repl
julia> InteractiveUtils.@code_typed debuginfo=:source +(1,1)
CodeInfo(
    @ int.jl:87 within `+`
1 ─ %1 = 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`.
------------------------------------------------------------------------


# C Interface · The Julia Language
Source: https://docs.julialang.org/en/v1/base/c/


# [C Interface](#C-Interface)
```julia
@ccall library.function_name(argvalue1::argtype1, ...)::returntype
@ccall function_name(argvalue1::argtype1, ...)::returntype
@ccall $function_pointer(argvalue1::argtype1, ...)::returntype
```
Call a function in a C-exported shared library, specified by `library.function_name`, where `library` is a string constant or literal. The library may be omitted, in which case the `function_name` 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`.
Each `argvalue` to `@ccall` is converted to the corresponding `argtype`, by automatic insertion of calls to `unsafe_convert(argtype, cconvert(argtype, argvalue))`. (See also the documentation for [`unsafe_convert`](#Base.unsafe_convert) and [`cconvert`](#Base.cconvert) for further details.) In most cases, this simply results in a call to `convert(argtype, argvalue)`.
**Examples**
```julia
@ccall strlen(s::Cstring)::Csize_t
```
This calls the C standard library function:
```julia
size_t strlen(char *)
```
with a Julia variable named `s`. See also `ccall`.
Varargs are supported with the following convention:
```julia
@ccall printf("%s = %d"::Cstring ; "foo"::Cstring, foo::Cint)::Cint
```
The semicolon is used to separate required arguments (of which there must be at least one) from variadic arguments.
Example using an external library:


# [C Interface](#C-Interface)
```julia
# C signature of g_uri_escape_string:
# 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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L360-L407)
```julia
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.


# [C Interface](#C-Interface)
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`](#Base.unsafe_convert) and [`cconvert`](#Base.cconvert) for further details.) In most cases, this simply results in a call to `convert(argtype, argvalue)`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1304-L1322)
```julia
cglobal((symbol, library) [, type=Cvoid])
```
Obtain a pointer to a global variable in a C-exported shared library, specified exactly as in [`ccall`](#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`](#Base.unsafe_load) or [`unsafe_store!`](#Base.unsafe_store!), respectively.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L7-L16)
```julia
@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.


# [C Interface](#C-Interface)
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](../../manual/calling-c-and-fortran-code/#Calling-C-and-Fortran-Code).
**Examples**
```julia-repl
julia> function foo(x::Int, y::Int)
           return x + y
       end

julia> @cfunction(foo, Int, (Int, Int))
Ptr{Cvoid} @0x000000001b82fcd0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L38-L63)
```julia
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`](#Base.@cfunction).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L19-L28)
```julia
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, ...)`.


# [C Interface](#C-Interface)
In cases where [`convert`](../base/#Base.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`](#Base.cconvert)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L34-L54)
```julia
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`](../base/#Base.convert), `cconvert` may return an object of a type different from `T`, which however is suitable for [`unsafe_convert`](#Base.unsafe_convert) to handle. The result of this function should be kept valid (for the GC) until the result of [`unsafe_convert`](#Base.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.


# [C Interface](#C-Interface)
Neither `convert` nor `cconvert` should take a Julia object and turn it into a `Ptr`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L671-L684)
```julia
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 `i`th 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.
The `order` argument is available as of Julia 1.10.
See also: [`atomic`](../multi-threading/#atomic)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L133-L152)
```julia
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 `i`th 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.


# [C Interface](#C-Interface)
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 that the types are compatible.
The `order` argument is available as of Julia 1.10.
See also: [`atomic`](../multi-threading/#atomic)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L159-L178)
```julia
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:
```julia
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.
This function requires at least Julia 1.10.
See also: [`modifyproperty!`](../base/#Base.modifyproperty!), [`atomic`](../multi-threading/#atomic)


# [C Interface](#C-Interface)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L186-L208)
```julia
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:
```julia
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.
This function requires at least Julia 1.10.
See also: [`replaceproperty!`](../base/#Base.replaceproperty!), [`atomic`](../multi-threading/#atomic)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L213-L237)
```julia
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:


# [C Interface](#C-Interface)
```julia
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.
This function requires at least Julia 1.10.
See also: [`swapproperty!`](../base/#Base.swapproperty!), [`atomic`](../multi-threading/#atomic)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L247-L267)
```julia
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/array.jl#L255-L264)
```julia
unsafe_copyto!(dest::Array, do, src::Array, so, N)
```
Copy `N` elements from a source array to a destination, starting at the linear index `so` in the source and `do` in the destination (1-indexed).


# [C Interface](#C-Interface)
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/array.jl#L272-L281)
```julia
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:
|  `tM` | Destination           | Source                         |
|------:|:----------------------|:-------------------------------|
| `'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!`](../../stdlib/LinearAlgebra/#LinearAlgebra.copy_transpose!) and [`copy_adjoint!`](../../stdlib/LinearAlgebra/#LinearAlgebra.copy_adjoint!).
```julia
copyto!(dest::AbstractMatrix, src::UniformScaling)
```
Copies a [`UniformScaling`](../../stdlib/LinearAlgebra/#LinearAlgebra.UniformScaling) onto a matrix.


# [C Interface](#C-Interface)
In Julia 1.0 this method only supported a square destination matrix. Julia 1.1. added support for a rectangular matrix.
```julia
copyto!(dest, do, src, so, N)
```
Copy `N` elements from collection `src` starting at the linear index `so`, to array `dest` starting at the index `do`. Return `dest`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/array.jl#L288-L293)
```julia
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!`](../arrays/#Base.copy!), [`copy`](../base/#Base.copy).
Behavior can be unexpected when any mutated argument shares memory with any other argument.
**Examples**
```julia-repl
julia> x = [1., 0., 3., 0., 5.];

julia> y = zeros(7);

julia> copyto!(y, x);

julia> y
7-element Vector{Float64}:
 1.0
 0.0
 3.0
 0.0
 5.0
 0.0
 0.0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/abstractarray.jl#L1024-L1053)
```julia
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**


# [C Interface](#C-Interface)
```julia-repl
julia> A = zeros(5, 5);

julia> B = [1 2; 3 4];

julia> Ainds = CartesianIndices((2:3, 2:3));

julia> Binds = CartesianIndices(B);

julia> copyto!(A, Ainds, B, Binds)
5×5 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0
 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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/multidimensional.jl#L1177-L1201)
```julia
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`](../base/#Base.GC.@preserve) macro should be used to protect the `array` argument from garbage collection within a given block of code.
Calling [`Ref(array[, index])`](#Core.Ref) is generally preferable to this function as it guarantees validity.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/strings/cstring.jl#L41-L52)
```julia
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.


# [C Interface](#C-Interface)
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`](#Base.unsafe_load) and [`unsafe_store!`](#Base.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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L93-L107)
```julia
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`](#Base.unsafe_pointer_to_objref).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L289-L300)
```julia
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`](#Base.pointer_from_objref).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L278-L286)


# [C Interface](#C-Interface)
```julia
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:
```julia
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L148-L164)
```julia
reenable_sigint(f::Function)
```
Re-enable Ctrl-C handler during execution of a function. Temporarily reverses the effect of [`disable_sigint`](#Base.disable_sigint).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L173-L178)
```julia
exit_on_sigint(on::Bool)
```
Set `exit_on_sigint` flag of the julia runtime. If `false`, Ctrl-C (SIGINT) is capturable as [`InterruptException`](../base/#Core.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`](../base/#Base.atexit). This is the default behavior in Julia script run without `-i` option.
Function `exit_on_sigint` requires at least Julia 1.5.


# [C Interface](#C-Interface)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L187-L201)
```julia
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L169-L174)
```julia
windowserror(sysfunc[, code::UInt32=Libc.GetLastError()])
windowserror(sysfunc, iftrue::Bool)
```
Like [`systemerror`](#Base.systemerror), but for Windows API functions that use [`GetLastError`](../libc/#Base.Libc.GetLastError) to return an error code instead of setting [`errno`](../libc/#Base.Libc.errno).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L183-L189)
```julia
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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/pointer.jl#L3-L8)
```julia
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 `[]`.


# [C Interface](#C-Interface)
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)`](#Base.isassigned-Tuple%7BBase.RefValue%7D). 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`.


# [C Interface](#C-Interface)
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-repl
julia> r = Ref(5) # Create a Ref with an initial value
Base.RefValue{Int64}(5)

julia> r[] # Getting a value from a Ref
5

julia> r[] = 7 # Storing a new value in a Ref
7

julia> r # The Ref now contains 7
Base.RefValue{Int64}(7)

julia> isa.(Ref([1,2,3]), [Array, Dict, Int]) # Treat reference values as scalar during broadcasting
3-element BitVector:
 1
 0
 0

julia> Ref{Function}()  # Undefined reference to a non-bitstype, Function
Base.RefValue{Function}(#undef)

julia> try
           Ref{Function}()[] # Dereferencing an undefined reference will result in an error
       catch e
           println(e)
       end
UndefRefError()

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](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/refpointer.jl#L3-L78)
```julia
isassigned(ref::RefValue) -> Bool
```
Test whether the given [`Ref`](#Core.Ref) is associated with a value. This is always true for a [`Ref`](#Core.Ref) of a bitstype object. Return `false` if the reference is undefined.
**Examples**


# [C Interface](#C-Interface)
```julia-repl
julia> ref = Ref{Function}()
Base.RefValue{Function}(#undef)

julia> isassigned(ref)
false

julia> ref[] = (foobar(x) = x)
foobar (generic function with 1 method)

julia> isassigned(ref)
true

julia> isassigned(Ref{Int}())
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/refvalue.jl#L11-L35)
```julia
Cchar
```
Equivalent to the native `char` c-type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L86-L90)
```julia
Cuchar
```
Equivalent to the native `unsigned char` c-type ([`UInt8`](../numbers/#Core.UInt8)).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L6-L10)
```julia
Cshort
```
Equivalent to the native `signed short` c-type ([`Int16`](../numbers/#Core.Int16)).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L14-L18)
```julia
Cstring
```
A C-style string composed of the native character type [`Cchar`](#Base.Cchar)s. `Cstring`s are NUL-terminated. For C-style strings composed of the native wide character type, see [`Cwstring`](#Base.Cwstring). For more information about string interoperability with C, see the [manual](../../manual/calling-c-and-fortran-code/#man-bits-types).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/strings/cstring.jl#L18-L27)
```julia
Cushort
```
Equivalent to the native `unsigned short` c-type ([`UInt16`](../numbers/#Core.UInt16)).


# [C Interface](#C-Interface)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L22-L26)
```julia
Cint
```
Equivalent to the native `signed int` c-type ([`Int32`](../numbers/#Core.Int32)).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L30-L34)
```julia
Cuint
```
Equivalent to the native `unsigned int` c-type ([`UInt32`](../numbers/#Core.UInt32)).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L38-L42)
```julia
Clong
```
Equivalent to the native `signed long` c-type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L104-L108)
```julia
Culong
```
Equivalent to the native `unsigned long` c-type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/c.jl#L111-L115)
```julia
Clonglong
```
Equivalent to the native `signed long long` c-type ([`Int64`](../numbers/#Core.Int64)).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L86-L90)
```julia
Culonglong
```
Equivalent to the native `unsigned long long` c-type ([`UInt64`](../numbers/#Core.UInt64)).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ctypes.jl#L94-L98)
```julia
Cintmax_t
```
Equivalent to the native `intmax_t` c-type ([`Int64`](../numbers/#Core.Int64)).