43
\$\begingroup\$

One of the things many (new?) users forget to specify in challenges is whether the answers should provide a full program or a function (or even just a snippet). For most such things, we have defaults in the tag wiki (like scoring by bytes), but not for this.

The conclusion in chat was that such a default would be useful, so let's vote on what it should be.

See here for the follow-up poll on input/output methods.

\$\endgroup\$
  • 2
    \$\begingroup\$ I have not added an answer which excludes full programs as the default, because there might be languages where that isn't even possible. \$\endgroup\$ – Martin Ender Oct 29 '14 at 20:23
  • \$\begingroup\$ Supposing functions are allowed, should functions that accept an argument and print the result of a calculation to stdout, or functions that read from argv and return a value be allowed? \$\endgroup\$ – feersum Oct 29 '14 at 20:25
  • \$\begingroup\$ @feersum I think we should worry about I/O defaults after coming to a consensus on this, because the cross product of all possible options doesn't seem manageable. \$\endgroup\$ – Martin Ender Oct 29 '14 at 20:28
  • 3
    \$\begingroup\$ I think it would be nice if all the code could be run by people who don't know the language. That is it could be a complete piece of source code. \$\endgroup\$ – user9206 Jan 21 '15 at 14:54
87
\$\begingroup\$

The default should be "programs or functions"

This includes function-like constructs, including J's verbs and GolfScript's and CJam's blocks.

\$\endgroup\$
  • \$\begingroup\$ Would functions be allowed to print rather than return the output? \$\endgroup\$ – xnor Oct 29 '14 at 20:25
  • \$\begingroup\$ @xnor I think we should worry about I/O defaults after coming to a consensus on this, because the cross product of all possible options doesn't seem manageable. \$\endgroup\$ – Martin Ender Oct 29 '14 at 20:27
  • \$\begingroup\$ This excludes some languages, such as J. \$\endgroup\$ – Peter Taylor Oct 30 '14 at 8:08
  • \$\begingroup\$ @PeterTaylor Doesn't J have functions? \$\endgroup\$ – Martin Ender Oct 30 '14 at 8:13
  • \$\begingroup\$ J is weird. It's the reason that I always include "named verb" in my list of acceptable submission styles. (And "named block" for GolfScript, although in GS it's nearly always shorter to write a program). \$\endgroup\$ – Peter Taylor Oct 30 '14 at 8:24
  • \$\begingroup\$ This still leaves one question open: Does the functions/blocks/verbs have to be named? \$\endgroup\$ – Dennis Oct 30 '14 at 18:02
  • 2
    \$\begingroup\$ @Dennis Not unless the OP requires them to be named. \$\endgroup\$ – Martin Ender Oct 30 '14 at 18:04
  • \$\begingroup\$ Function bodies? Or complete function declarations with function main()-like boilerplate? \$\endgroup\$ – user16402 Nov 1 '14 at 20:32
  • 1
    \$\begingroup\$ @professorfish Complete functions. Function bodies would be "snippets" (see this answer). \$\endgroup\$ – Martin Ender Nov 1 '14 at 20:34
  • 2
    \$\begingroup\$ This seems to be the correct default, because the general rule is that whatever is left unspecified gets interpreted in the way most advantageous to the answerer. On the other hand, those who intend "program or function" in their questions often absentmindedly write "your program" which then implies that a program is required, when they should write "your code." \$\endgroup\$ – Level River St Nov 10 '14 at 13:45
  • \$\begingroup\$ me downvote, there are programs without functions and the definition of function can be diffent. the startup is part of the language, if you keep that part out, you can skip every part. \$\endgroup\$ – 12431234123412341234123 May 5 '17 at 8:29
45
\$\begingroup\$

Restricting to just programs requires explicitly specifying "full program" rather than just "program"

If the question requests a program, this can still be answered with a function. This allows for the fact that many people state "program" without thinking, not intending to exclude functions.

For questions that wish to exclude functions, this should be stated explicitly, for example: "full program", "complete program" or "program, not function".

\$\endgroup\$
  • 6
    \$\begingroup\$ This is an especially good idea for challenges by newer users who aren't familiar with our customs/defaults. \$\endgroup\$ – Alex A. Sep 8 '15 at 16:57
-2
\$\begingroup\$

A set of different "defaults"

I think many questions require one of a few different ways, some require...

  1. ... a full program that accepts input and prints output throu standard I/O
  2. ... files as input/output (e.g. Images)
  3. ... only functions (or similar constructs)
  4. ... snippets, where input/output is stored in a variable (or similar construct)

This is of course just a rough draft, but you get the idea. My suggestion is making a definition for each of these in order that everyone writing challenges only has to declare which of those apply, instead of writing a whole novel on what is allowed and what is not.

\$\endgroup\$
  • 3
    \$\begingroup\$ We have a separate question for which I/O methods should be allowed. \$\endgroup\$ – Martin Ender Sep 8 '15 at 10:30
  • 1
    \$\begingroup\$ Having the defaults we already do (separately) means that the question already doesn't need to spend time on defining them. Only those things which are non-standard need be mentioned. \$\endgroup\$ – trichoplax Sep 8 '15 at 17:30
-4
\$\begingroup\$

We don't need a default

Every question has to specify this.

\$\endgroup\$
  • 1
    \$\begingroup\$ This has my downvote. \$\endgroup\$ – Martin Ender Oct 29 '14 at 20:24
  • 6
    \$\begingroup\$ +1 Questions which don't have it should be closed as "Unclear what you're asking". \$\endgroup\$ – Peter Taylor Oct 29 '14 at 21:34
  • \$\begingroup\$ @PeterTaylor plenty of good existing questions would have been under that ruling, I'm afraid. \$\endgroup\$ – John Dvorak Nov 3 '14 at 7:03
  • 2
    \$\begingroup\$ @JanDvorak, sorry, I'm using old terminology. I should say "put on hold" and clarified. \$\endgroup\$ – Peter Taylor Nov 3 '14 at 9:31
-6
\$\begingroup\$

The default should be "programs only"

\$\endgroup\$
  • 8
    \$\begingroup\$ This has my downvote. \$\endgroup\$ – Martin Ender Oct 29 '14 at 20:24
  • 1
    \$\begingroup\$ mine too. significant disadvantage for languages that have a large overhead (huge trivial program) \$\endgroup\$ – Titus Jul 7 '16 at 7:41
-17
\$\begingroup\$

The default should be "programs, functions or snippets"

By "snippets" I mean just a piece of code which expects the input to be stored in a hardcoded variable and stores the output in another hardcoded variable, or prints it.

\$\endgroup\$
  • \$\begingroup\$ The question is which one of these \$\endgroup\$ – Redwolf Programs Apr 19 '18 at 13:56

You must log in to answer this question.

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