@@ -1212,41 +1212,54 @@ used to implement specialized methods.
12121212< (x) = Fix2 (< , x)
12131213
12141214"""
1215- Splat (f)
1215+ splat (f)
12161216
12171217Equivalent to
12181218```julia
12191219 my_splat(f) = args->f(args...)
12201220```
12211221i.e. given a function returns a new function that takes one argument and splats
1222- its argument into the original function. This is useful as an adaptor to pass
1223- a multi-argument function in a context that expects a single argument, but
1224- passes a tuple as that single argument. Additionally has pretty printing.
1225-
1226- !!! compat "Julia 1.9"
1227- This function was introduced in Julia 1.9, replacing `Base.splat(f)`.
1222+ it into the original function. This is useful as an adaptor to pass a
1223+ multi-argument function in a context that expects a single argument, but passes
1224+ a tuple as that single argument.
12281225
12291226# Example usage:
12301227```jldoctest
1231- julia> map(Base.Splat (+), zip(1:3,4:6))
1228+ julia> map(splat (+), zip(1:3,4:6))
123212293-element Vector{Int64}:
12331230 5
12341231 7
12351232 9
12361233
1237- julia> my_add = Base.Splat (+)
1238- Splat (+)
1234+ julia> my_add = splat (+)
1235+ splat (+)
12391236
12401237julia> my_add((1,2,3))
124112386
12421239```
12431240"""
1241+ splat (f) = Splat (f)
1242+
1243+ """
1244+ Base.Splat{F} <: Function
1245+
1246+ Represents a splatted function. That is
1247+ ```julia
1248+ Base.Splat(f)(args) === f(args...)
1249+ ```
1250+ The preferred way to construct an instance of `Base.Splat` is to use the [`splat`](@ref) function.
1251+
1252+ !!! compat "Julia 1.9"
1253+ Splat requires at least Julia 1.9. In earlier versions `splat` returns an anonymous function instead.
1254+
1255+ See also [`splat`](@ref).
1256+ """
12441257struct Splat{F} <: Function
12451258 f:: F
12461259 Splat (f) = new {Core.Typeof(f)} (f)
12471260end
12481261(s:: Splat )(args) = s. f (args... )
1249- print (io:: IO , s:: Splat ) = print (io, " Splat (" , s. f, ' )' )
1262+ print (io:: IO , s:: Splat ) = print (io, " splat (" , s. f, ' )' )
12501263show (io:: IO , s:: Splat ) = print (io, s)
12511264
12521265# # in and related operators
0 commit comments