Is there a way to SetAttributes to a function defined like this:


Something like SetAttrubutes[fun[t_],Listable]?

  • 1
    $\begingroup$ Only symbols, not indexed symbols can have attributes $\endgroup$ Jan 14, 2022 at 9:01

1 Answer 1


You 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.


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