Skip to content

Commit

Permalink
use @BioTurboNick's cool splatting trick
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Jan 28, 2021
1 parent feeb198 commit c13569a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1793,10 +1793,9 @@ typed_hcat(T::Type, A::AbstractArray...) = cat_t(T, A...; dims=Val(2))

# 2d horizontal and vertical concatenation

tuple_cat(t) = foldl((x, y) -> (x..., y...), t; init=())
# these are produced in lowering if splatting occurs inside hvcat
hvcat_rows(rows::Tuple...) = hvcat(map(length, rows), tuple_cat(rows)...)
typed_hvcat_rows(T::Type, rows::Tuple...) = typed_hvcat(T, map(length, rows), tuple_cat(rows)...)
hvcat_rows(rows::Tuple...) = hvcat(map(length, rows), (rows...)...)
typed_hvcat_rows(T::Type, rows::Tuple...) = typed_hvcat(T, map(length, rows), (rows...)...)

function hvcat(nbc::Integer, as...)
# nbc = # of block columns
Expand Down

0 comments on commit c13569a

Please sign in to comment.