Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

16
  • $\begingroup$ Impressive! Thank you Leonid. Can I accept more than 1 answer? Yours truly deserves it. (PS. you typed two f4). $\endgroup$ Commented Jun 19, 2012 at 15:43
  • $\begingroup$ @Jane T. You can only accept one answer, and generally it is a good idea to wait a little bit before accepting any, so that people are motivated to write alternative answers. You can also unaccept an already accepted answer and accept another one if you like it better (please not that this is just generaly FYI, not an advice for this particular case). As for f4, this is intentional. In case you did not know, Mathematica functions can have more than one definition at the same time, and the one to be used is the one whose pattern will first match. $\endgroup$ Commented Jun 19, 2012 at 15:47
  • $\begingroup$ @Leonid Shifrin Excellent :) Perhaps the 3rd element of the result might reflect Length@Options@f ? $\endgroup$ Commented Jun 19, 2012 at 15:47
  • $\begingroup$ @image_doctor Thanks :). " Perhaps the 3rd element of the result might reflect Length@Options@f" - I don't think this is really necessary, but it could be a possibility (although Options might not be defined at the time when definitions are considered, although this is admittedly a rather contrived situation). $\endgroup$ Commented Jun 19, 2012 at 15:49
  • $\begingroup$ @LeonidShifrin Perhaps counting options should be an option to countArgs ;) I think Options returns an empty list if the options for f aren't defined. Which I guess could be interpreted as logically correct from one viewpoint. $\endgroup$ Commented Jun 19, 2012 at 15:54