Skip to content

Commit

Permalink
Use vcat in append of vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Aug 22, 2019
1 parent 823fce1 commit c4d6170
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/NoBang/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ _append(xs, ys) = append!(copy(xs), ys)
_append(xs, ys::Tuple) = push(xs, ys...)
_append(xs, ys::Pairs{Symbol, <:Any, <:Any, <:NamedTuple}) = push(xs, ys...)

append(xs::AbstractVector, ys::AbstractVector) = vcat(xs, ys)

append(xs::ImmutableContainer, ys) = push(xs, ys...)

append(xs::AbstractString, ys::AbstractString) = string(xs, ys)
Expand Down
2 changes: 2 additions & 0 deletions test/test_append.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ include("preamble.jl")
@test append!!(ImmutableDict(:a=>1), ImmutableDict(:b=>2)) ==
ImmutableDict(ImmutableDict(:a=>1), :b=>2)
@test append!!("a", "b") === "ab"
@test append!!(SVector(0), [1])::Vector == [0, 1]
@test append!!([0], SVector(1))::Vector == [0, 1]
end

end # module

0 comments on commit c4d6170

Please sign in to comment.