Is there a way to do this with Mathematica shorthand notation?
You could use the operator form of Map instead:
SecondFn @ Map[FirstFn] @ {2, 3, 5}
SecondFn[{FirstFn[2], FirstFn[3], FirstFn[5]}]
or
comp = SecondFn @* Map[FirstFn];
comp @ {2, 3, 5}
SecondFn[{FirstFn[2], FirstFn[3], FirstFn[5]}]
FirstFn /@ a // SecondFn
SecondFn[{FirstFn[2], FirstFn[8], FirstFn[5]}]
A solution using only prefix notation is
List /* f @@ g /@ {x,y,z}
(* Out: f[{g[x],g[y],g[z]}] *)
Edit. A slightly nicer version (cf the order of the functions) uses Composition
(@*
) instead of the above RightComposition
(/*
):
f @* List @@ g /@ {x,y,z}
(* Out: f[{g[x],g[y],g[z]}] *)
This is still less elegant than the (rightfully) accepted answer, but it has the benefit of allowing one to use any function rather than just List
.