Is there a function that inverts splat, in Base, the standard libraries, or a package? As in
f((x, y)) = x + y # function takes tuples
g(xs...) = f(xs) # let's unsplat manually
unsplat(f) = (xs...,) -> f(xs) # unsplat with a closure
Note that I am not asking about implementing this, just whether there is a named implementation somewhere.
I don’t know of one with the same format as splat, but f ∘ tuple or Base.Fix2(∘, tuple) will achieve this:
julia> (sort ∘ tuple)(4,3,1,2)
(1, 2, 3, 4)
julia> Base.Fix2(∘, tuple)(sort)(4,3,1,2)
(1, 2, 3, 4)
Sukera
August 12, 2026, 3:06pm
3
splat is actually a struct ! The following should do, and can be done as a PR:
unsplat(s::Base.Splat) = s.f
Sukera:
The following should do
Just to clarify: I meant a semantic inverse, not undoing something that was created by splat. Ie it should work on generic f(::Tuple) functions, as in the MWE.
Sukera
August 12, 2026, 4:04pm
5
Ah, I missed that detail. I believe what you’re asking for is the iterated form of uncurry, but in Julia this doesn’t really make sense without knowing what it is that you’re uncurrying. I don’t think that we generally have this in the ecosystem or in Base, since we don’t have arrow types. See also
https://stackoverflow.com/questions/15993186/what-does-uncurry-do
One could combine the above two suggestions and define:
unsplat(f) = f ∘ tuple
unsplat(s::Base.Splat) = s.f
(which could arguably go in Base as a PR).
opened 03:13PM - 13 Aug 26 UTC
speculative
good first issue
As discussed in [this discourse thread](https://discourse.julialang.org/t/does-b… ase-splat-have-an-inverse/138772) by @tpapp, it might be nice to have an `unsplat` function that is the semantic inverse of `splat` (it takes a function of a tuple and turns it into a function of separate arguments).
Implementation could be as simple as:
```jl
import Base: Splat, splat
"""
unsplat(f)
Given a function `f(t)` that takes a single tuple `t` of parameters, return a function `g = unsplat(f)`
that behaves similar to `g(args...) = f(args)`; that is, `unsplat(f)` accepts
the arguments as separate parameters and bundles them together into a tuple for `f`.
This function is the inverse of [`splat`](@ref).
"""
unsplat(f) = f ∘ tuple
# make splat and unsplat literal inverses of one another
unsplat(s::Splat) = s.f
splat(f::ComposedFunction{<:Any,typeof(tuple)}) = f.outer
```