Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions base/refpointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ converted to a native pointer to the data it references.

There is no invalid (NULL) `Ref` in Julia, but a `C_NULL` instance of `Ptr` can be passed to
a `ccall` Ref argument.

# Use in broadcasting

Broadcasting with `Ref(x)` treats `x` as a scalar:
```jldoctest
julia> isa.(Ref([1,2,3]), [Array, Dict, Int])
3-element BitArray{1}:
1
0
0
```
"""
Ref

Expand Down
12 changes: 11 additions & 1 deletion doc/src/manual/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ julia> convert.(Float32, [1, 2])
1.0
2.0

julia> ceil.((UInt8,), [1.2 3.4; 5.6 6.7])
julia> ceil.(UInt8, [1.2 3.4; 5.6 6.7])
2×2 Array{UInt8,2}:
0x02 0x04
0x06 0x07
Expand All @@ -945,6 +945,16 @@ julia> string.(1:3, ". ", ["First", "Second", "Third"])
"3. Third"
```

Sometimes, you have a non-scalar object like an array that you wish to treat as a scalar in a particular
broadcast expression. This is best done by wrapping that item in a [`Tuple`](@ref)
```jldoctest
julia> ([1, 2, 3], [4, 5, 6]) .+ ([1, 2, 3],)
([2, 4, 6], [5, 7, 9])

julia> ([1, 2, 3], [4, 5, 6]) .+ tuple([1, 2, 3])
([2, 4, 6], [5, 7, 9])
```

## Implementation

The base array type in Julia is the abstract type [`AbstractArray{T,N}`](@ref). It is parameterized by
Expand Down