Is there a way to SetAttributes
to a function defined like this:
fun[t_][x_,y_]
Something like SetAttrubutes[fun[t_],Listable]
?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityYou could make fun[t]
return a pure Function
and make that one Listable
like this:
fun[t_] := Function[{x, y}, DoSomething[x, y, t], Listable];
Here is a simple example:
X = Range[5];
Y = Range[5];
fun[t][X, Y]
{DoSomething[1, 1, t], DoSomething[2, 2, t], DoSomething[3, 3, t], DoSomething[4, 4, t], DoSomething[5, 5, t]}
However, I believe to remember that there was some performance issue with pure functions with Listable
attribute (at least in some version of Mathematica). It's been a while ago. Maybe this issue has been fixed already.