Skip to content

Commit

Permalink
Add doctest example for fill! (#19422)
Browse files Browse the repository at this point in the history
* Add doctest example for fill!

* Add more doctests
  • Loading branch information
kshyatt authored and tkelman committed Dec 25, 2016
1 parent 55b1230 commit 4793e88
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ systemerror
Fill array `A` with the value `x`. If `x` is an object reference, all elements will refer to
the same object. `fill!(A, Foo())` will return `A` filled with the result of evaluating
`Foo()` once.
```jldoctest
julia> A = zeros(2,3)
2×3 Array{Float64,2}:
0.0 0.0 0.0
0.0 0.0 0.0
julia> fill!(A, 2.)
2×3 Array{Float64,2}:
2.0 2.0 2.0
2.0 2.0 2.0
julia> a = [1, 1, 1]; A = fill!(Vector{Vector{Int}}(3), a); a[1] = 2; A
3-element Array{Array{Int64,1},1}:
[2,1,1]
[2,1,1]
[2,1,1]
julia> x = 0; f() = (global x += 1; x); fill!(Vector{Int}(3), f())
1
1
1
```
"""
fill!

Expand Down

2 comments on commit 4793e88

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - no performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.