Reference

DerivableInterfaces.ConcatenateModule
module Concatenate

Alternative implementation for Base.cat through cat(!).

This is mostly a copy of the Base implementation, with the main difference being that the destination is chosen based on all inputs instead of just the first.

Additionally, we have an intermediate representation in terms of a Concatenated object, reminiscent of how Broadcast works.

The various entry points for specializing behavior are:

  • Destination selection can be achieved through

    Base.similar(concat::Concatenated{Interface}, ::Type{T}, axes) where {Interface}

  • Custom implementations:

    Base.copy(concat::Concatenated{Interface}) # custom implementation of cat Base.copyto!(dest, concat::Concatenated{Interface}) # custom implementation of cat! based on interface Base.copyto!(dest, concat::Concatenated{Nothing}) # custom implementation of cat! based on typeof(dest)

source