6
$\begingroup$

I've known of the single dot form of Optional for a while, but never had occasion to actually use it:

enter image description here

Are there any good examples of use cases for it other than in relation to Default?

$\endgroup$
  • $\begingroup$ Searching for Default Optional turns up 105 questions and answers, some of which may be relevant. $\endgroup$ – bbgodfrey Aug 31 '16 at 3:48
  • $\begingroup$ @bbgodfrey most of those which speak of : not . $\endgroup$ – M.R. Aug 31 '16 at 4:11
  • 3
    $\begingroup$ x+x^2 /. x^n_. :> n - this is probably quite common usage. Yet tough to find _. by search engine :-/ $\endgroup$ – Kuba Aug 31 '16 at 5:44
  • 2
    $\begingroup$ Two more examples: {2 x, a x, x} /. n_. x :> n & {2 + x, a + x, x} /. n_. + x :> n. $\endgroup$ – Karsten 7. Aug 31 '16 at 7:03
  • 1
    $\begingroup$ Wolfram Language Tutorial: Optional and Default Arguments $\endgroup$ – Karsten 7. Aug 31 '16 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.