Consider this example:

 Cases[{4, x, 5 a , 6 x}, x_.*a_ :> x]

(*{1, 1, 5, 6}*)

It is clear that the _. took 1 as a Default value.


f[x_.] := {x} dose not work and _. Default value has to be user defined first

Default[f] = 0;
f[x_.] := {x}

It is little confusing that _. takes default value in some operation and has to be user defined with default value in other operation.

Any explanations?


  • 2
    $\begingroup$ The functions Times, Plus, Power have built-in default values (1, 0, and 1, respectively). $\endgroup$
    – kglr
    Dec 29, 2014 at 0:56
  • 2
    $\begingroup$ Use DefaultValues[Times], DefaultValues[Plus] etc. to see this. Now try DefaultValues[f] before you have attached any default values to it, and you will see that f has no built-in default values. $\endgroup$
    – C. E.
    Dec 29, 2014 at 0:57
  • $\begingroup$ Ok. Thanks. It is clear now:) $\endgroup$ Dec 29, 2014 at 1:05

1 Answer 1


The answer is pretty simple and you were very close to seeing this yourself:


(* Out[9]= 1 *)

As you see, the DefaultValues for Times and Plus are already built in.

  • $\begingroup$ I was very close yes but I would never seeing it myself before your answer. Thanks :) $\endgroup$ Dec 29, 2014 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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