Default
[f]Default
[f, k]Default
[f, k, n] Assign values to Default
to specify default values.
Default[f] = 1
f[x_.] := x ^ 2
f[]
Default values are stored in DefaultValues
:
DefaultValues[f]
You can use patterns for k and n:
Default[h, k_, n_] := {k, n}
Note that the position of a parameter is relative to the pattern, not the matching expression:
h[] /. h[___, ___, x_., y_., ___] -> {x, y}