WLJS LogoWLJS Notebook

SetAttributes

SetAttributes[symbol, attr] adds attr to the list of attributes of the symbol.

Examples

Make a function listable:

f[x_] := x^2;
SetAttributes[f, Listable]
f[{1, 2, 3}]
(* {1, 4, 9} *)

Set multiple attributes:

SetAttributes[g, {Flat, Orderless}]

Make a function hold its arguments:

SetAttributes[h, HoldAll]

Please visit the official Wolfram Language Reference for more details.

On this page