Talk:Code Golf: Code Golf

From Rosetta Code

Does the description mean that the program is not to contain quotation marks, or just that the emitted string should not contain them? Thebigh (talk) 19:52, 9 December 2021 (UTC)

Well, I assumed that it must mean that the program should not contain any quotation marks (single or double) and, moreover, should end with an 'f'. Otherwise it would be as trivial (in Wren) as:
System.write("Code Golf")


Of course, it will still be trivial in some languages anyway (cf. Raku) though there are may others where it's difficult to avoid quotation marks when dealing with string or character literals. --PureFox (talk) 20:04, 9 December 2021 (UTC)
That's what I figured; either the task is basically just "Hello World", or it locks out languages where output requires quotation marks. I am not super enthusiastic about either alternative. Thebigh (talk) 20:08, 9 December 2021 (UTC)

Draft Revision

I would like to propose revising the task description along the following lines:

Preamble: The "Code Golf:" prefix is intended for tasks in which a metric of "code size" other than code length is the focus.

To contrast the difference, this particular page asks authors to contrast a simple measure of code length with a syntax-oriented metric of size that conforms to the following principle:

  • if E and F are functionally equivalent programs, and if E can be

obtained from F by decreasing its length (e.g. by shortening identifiers or removing white space or punctuation), then E and F have the same "code size".


Consider the class of programs, G, that emit the nine characters in the string "Code Golf", and define H as the instances of G that do not themselves contain string or character literals.

(1) Specify a metric for measuring program length (e.g. bytes or codepoints) and show a shortest instance of G using that metric.

(2) Using the same metric as in (1), show a shortest instance of H.

(3) Show a shortest instance of G in the sense that no further reduction by changing identifiers or removing characters is possible.

(4) Same as (3) but for H.

Extra points:

a) give some informative details about the run-time space requirements of the shortest intance of G given in (1). Alternatively, for languages such as C, show the size of the stand-alone executable produced by one particular compiler on one particular platform.

b) give or reference a script or program for measuring code size in accordance with the principle (*) above.

--- Please comment, or should I just post the revision so that others may improve it? Peak (talk)

The task as currently defined was surprisingly fun as an intellectual excercise --Tigerofdarkness (talk) 18:06, 10 December 2021 (UTC).