I would like to set
evenFunction[f_][a_, b_, c_, ...] = f[Abs[a], Abs[b], Abs[c], ...]
I have come up with two ways to do this so far.
Use pure functions
evenFunction = Function[{f}, f[Sequence @@ Abs[{##}]] &]
Use pattern matching
evenFunction[f_][x__] := f[Sequence @@ (Abs[{x}])]
What is bothering me is that, in both cases, I first have to turn the arguments into a list, and then back to a sequence. Is there a way without this?
evenFunction[f_][x__] := f @@ Abs[{x}]
is a bit simpler. $\endgroup$ – Szabolcs Oct 2 '15 at 15:52evenFunction[f_][a__] := ReleaseHold@Map[Abs, Hold@f@a, {2}]
. I don't think there's any reason why you would do this instead though. $\endgroup$ – march Oct 2 '15 at 17:12