Namely, while

Thread @ f[{a, b}, {x, y}]


{f[a, x], f[b, y]}

the InverseThread (if it existed) should reverse the process that

InverseThread @ {f[a, x], f[b, y]}


f[{a, b}, {x, y}] 
  • 17
    $\begingroup$ Thread[{f[a, x], f[b, y]}, f]. $\endgroup$
    – Szabolcs
    Nov 1, 2016 at 9:13

1 Answer 1


Let's make this a little more challenging:

invThread[body : _[h_[___] ..]] :=
  Replace[Thread[body, h], _[x_ ..] :> x, {1}]

f[{a, b}, {x, y}, z];
% // Thread
% // invThread
{f[a, x, z], f[b, y, z]}

f[{a, b}, {x, y}, z]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.