1
$\begingroup$

This question already has an answer here:

Is it better to use pure Function assigned to symbols as their OwnValues vs function defined by patterns as symbol's DownValues.

Which one is faster and are there any exceptions?

$\endgroup$

marked as duplicate by xzczd, halirutan Jun 14 '18 at 2:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    $\begingroup$ Pure functions are often a bit faster, but defining functions by patterns as DownValues is more flexible. For example, this allows for overloading of functions and in combination with TagSetDelayed, you an implement your own "classes" (in the sense of object oriented programming). $\endgroup$ – Henrik Schumacher Jun 13 '18 at 22:23
  • 2
    $\begingroup$ there is no better or worse, they have different use cases, Henriks comment only mentions some of the differences. I'm quite confident that you can find exceptions to the speed question as well :-) $\endgroup$ – Albert Retey Jun 13 '18 at 23:04
  • 1
    $\begingroup$ I also believe your question is completely answered by the one that @xzczd linked. $\endgroup$ – halirutan Jun 14 '18 at 2:13

Browse other questions tagged or ask your own question.