From Default for Code Golf: Program, Function or Snippet?, it is clear that the default for is to allow program and function answers.

For function-only answers, it may be advantageous for answers to include a complete test program that calls the function for some examples, so that it is easy for users unfamiliar with the given language to verify the answer.

Should we require this?


3 Answers 3


A test program is helpful, but not required. The usefulness of an answer drives the vote score. This should be incentive enough for users to include a test program.


What should be required, in my opinion, is what the function which solves the problem is called. Since an answer may define many functions, this should be clarified.

This is especially important in languages such as Pyth, where a named function may be defined without using the name anywhere in the program.


A test program should be required. Functions are useless to users unfamiliar with the language of the given answer.

  • 3
    \$\begingroup\$ But even a test program is useless, if I can't figure out how to install the language and compile the program. Should every answer have to provide full installation and compilation instructions for every operation system? \$\endgroup\$
    – Ypnypn
    Commented Mar 25, 2015 at 14:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .