220
votes
How can we help users who are put off by the use of golfing languages?
Stop upvoting trivial solutions
It's easy to imagine why a new user would be frustrated when the highest-voted answer is a 3-byte solution in a golfing language with a built-in that nearly solves the ...
146
votes
Default for Code Golf: Input/Output methods
Functions may output via their return value(s)
Community wiki
127
votes
126
votes
Default for Code Golf: Input/Output methods
Functions may take input via function arguments
Community wiki
123
votes
Interpretation of Truthy/Falsey
Consider the following pseudocode:
if (x) {
print "x is truthy";
}
else {
print "x is falsy";
}
If it results in a runtime or a compile-time error then <...
119
votes
102
votes
Default for Code Golf: Input/Output methods
Programs may take input via GUI prompts
(This is for languages, for which this is the closest alternative to STDIN, like JavaScript's prompt(), Mathematica's ...
Community wiki
97
votes
Default for Code Golf: Input/Output methods
Programs may output by displaying it on screen.
This makes it possible to use languages like Vim script that can't print output directly to stdout.
Example from this challenge:
...
96
votes
Accepted
Default for Code Golf: Program, Function or Snippet?
The default should be "programs or functions"
This includes function-like constructs, including J's verbs and GolfScript's and CJam's blocks.
Community wiki
90
votes
Default for Code Golf: Input/Output methods
Programs may output using their exit code...
Exit codes are basically a return value for programs. If functions can output using their return values, it makes sense that programs should be able to do ...
84
votes
Default for Code Golf: Input/Output methods
Programs may take input via command-line arguments
Community wiki
81
votes
Default for Code Golf: Input/Output methods
Functions may take multiple arguments via currying
For some functional programming languages like Haskell this is actually necessary, because only single-argument functions exist and functions with ...
Community wiki
76
votes
Default for Code Golf: Input/Output methods
The contents of the tape post-execution may be used as a Turing machine's output
68
votes
Default for Code Golf: Input/Output methods
Functions may output via the same methods as full programs
(This depends on how the poll goes, but could be any subset of STDOUT, STDERR and file.)
Community wiki
64
votes
60
votes
Default for Code Golf: Input/Output methods
Functions may output by modifying their arguments or writing to out arguments
Here, "out arguments" refers to arguments that are passed in by reference, so that modifying the value inside the ...
Community wiki
58
votes
How can we help users who are put off by the use of golfing languages?
What SE could do for us...
One of the most popular suggestions from "We're not a Q&A site, but what should be done about it?" is to add software support for answer metadata (mainly scores and ...
57
votes
Default for Code Golf: Input/Output methods
For stack-based languages, function's input may be pushed to the stack before calling
Stack-based languages may assume that the input for their function is automatically pushed to the stack.
54
votes
53
votes
Default for Code Golf: Input/Output methods
Functions may take input via the same methods as full programs
(This depends on how the poll goes, but could be any subset of STDIN, ARGV and file.)
Community wiki
52
votes
Default for Code Golf: Input/Output methods
Programs may combine two or more input methods
For example, if the inputs are a string and an int, a function that takes a string as an argument and an int from STDIN would be valid.
The input ...
Community wiki
50
votes
Default for Code Golf: Program, Function or Snippet?
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 ...
49
votes
Default for Code Golf: Input/Output methods
Input for Turing machines may be written to the tape pre-execution
The read-write head should start on the leftmost cell of the portion of the tape containing the input.
49
votes
Accepted
Should answers have to handle invalid inputs?
No, invalid inputs may result in undefined behavior
Requiring input validation only adds extraneous code to the answer and takes away from the challenge.
48
votes
Default for Code Golf: Input/Output methods
Where applicable, Turing machines supporting multiple halt states may also output via their halt state
This is essentially equivalent to programs outputting via their exit code.
42
votes
Interpretation of Truthy/Falsey
Truthy/Falsey should be taken as strictly defined in the given language. For example, in javascript, the following are always falsey:
undefined
null
NaN
0
""
false
And other values are always ...
42
votes
Default for Code Golf: Input/Output methods
Programs may take input as the value of the last expression
Using something like TI-84 BASIC's Ans, which is a variable that stores the value of the last ...
41
votes
Default for Code Golf: Input/Output methods
SQL submissions may take input from a named table
which is probably not good enough. But I don't know a better way.
39
votes
Interpretation of Truthy/Falsey
Some languages have ambiguity in what is considered truthy/falsey. For example in c, zero vs non-zero is always FALSE vs TRUE from the point of view of conditional operators. But many standard APIs, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
code-golf × 230discussion × 222
policy × 36
answers × 36
scoring × 35
rules × 20
defaults × 8
faq × 6
support × 5
feature-request × 5
status-declined × 5
asking-questions × 4
languages × 4
code-challenge × 4
statistics × 4
characters × 4
tags × 3
specific-question × 3
closed-questions × 3
output × 3
accepted-answer × 3
handicap × 3
reposting × 2
java × 2
advent-of-code × 2