1
$\begingroup$

Suppose that I have the function f[a][x_]:= x^2 and I want to save it in a .m file, then if I do Save["/path/",{x,f[a]}] doesn't work.

My first question is why it doesn't work and the second is what is actually the first argument of the f, i.e. the [a].

$\endgroup$
5
$\begingroup$

You need to use symbols or lists of symbols as the second argument of Save. So for:

f[a][x_] := x^2

you would use:

Save["test.m", f]

Check:

Import["test.m", "String"]

"f[a][x_] := x^2 "

$\endgroup$

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