Tips for either golfing or programming challenges. In most current cases it is for helpful tips and tricks how one could golf more effectively with a particular language.

learn more… | top users | synonyms (1)

8
votes
1answer
164 views

Golfscript Diagonal Array

Is there a way in Golfscript to bring all of the diagonals of an array into a single array? For example, for the array [[1 2 3][4 5 6][7 8 9]] return [[7][4 8][1 5 9][2 6][3]] (not necessarily ...
6
votes
5answers
413 views

Tips for golfing in Applescript

What tips do you have for golfing in Applescript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Applescript (e.g. "remove comments" ...
11
votes
3answers
162 views

Tips for Golfing in ECMAScript 6

This is similar to other "Tips for golfing in <...>" but specifically targeting the ECMAScript 6 features in JavaScript. JavaScript inherently is a very verbose language, function(){}, .forEach(), ...
2
votes
0answers
85 views

Tips for golfing in OCaml

Inspired from the assortment of other 'Tips for golfing in language xyz'. As usual, please only suggest tips that are specific to OCaml and not programming in general. One tip per answer please.
0
votes
0answers
325 views

Is this the shortest possible Java quine? [duplicate]

Long ago, I found a Java quine online which uses a number of very clever tricks of the Java language (you can compile this at the command line, but it will not compile in most compilers--for obvious ...
12
votes
12answers
8k views

Smallest python script to print even numbers 0 to 100

I'm work on a problem which I set myself for fun, which is to create a python script which prints the even numbers from 0 to 100. The challenge is to make the script as small as possible. This is what ...
8
votes
1answer
457 views

Palindromic prime

I'm solving task, where: Input: A number as an integer. Output: The closest greater palindromic prime as an integer. I would appreciate hints how to make my solution shorter. Or directions if ...
6
votes
4answers
804 views

Tips for Golfing in T-SQL?

What general tips do you have for golfing in T-SQL? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to T-SQL. Please post one tip per ...
2
votes
3answers
613 views

Check If Two or More Variables Are All Equal to Zero in JavaScript

What is the shortest way to check if two or more variables are equal to 0 in JavaScript? I'm curious to know if there's something shorter than if(!x&&!y&&!z){...}.
12
votes
6answers
439 views

Alias Member Functions in Python

In Python, one can save bytes by aliasing functions that are used repeatedly. For example: r=range a=r(100) b=r(200) c=r(300) However, when the functions are member functions together, I don't know ...
5
votes
2answers
194 views

Tips for golfing in Processing

Does anyone have any code-golf tips for golfing in Processing? It is a graphical extension of java, and is somewhat difficult to golf.
2
votes
8answers
237 views

Tips for golfing in LiveScript

What general tips do you have for golfing in LiveScript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to LiveScript (e.g. "remove ...
7
votes
0answers
507 views

X greater than 3 with at least 2 difference between X and Y

I am trying to golf down some C++. Is it possible to make this condition shorter? X > 3 & X - Y > 1 (Apart from removing whitespace, of course.) So, X is at least 4 but X >= Y + 2. X ...
6
votes
3answers
294 views

Tips for golfing in Julia

What general tips do you have for golfing in Julia? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Julia (e.g. "remove comments" is ...
10
votes
4answers
390 views

Tips for golfing in Lua

What general tips do you have for golfing in Lua? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Lua (e.g. "remove comments" is not ...
0
votes
0answers
178 views

Visual Studio settings for C# code golfing

Which setting in Visual Studio do you recommend to get the best experience for code-golf? Advanced: how to best apply these settings only temporarily (because I should also do some work with Visual ...
3
votes
2answers
221 views

Tips for golfing ASCII art

I think the ASCII art questions on Code Golf are fun to do but personally I think it can be pretty hard. Especially when the question is tagged as code-golf. I wonder if anyone here might have some ...
3
votes
2answers
225 views

Tips for Golfing in Batch

Windows Batch (CMD) is probably the least suitable language for code golfing. Avoid newline characters. If you're looking for the shortest code in bytes, as opposed to characters, you will want to ...
4
votes
1answer
167 views

Tips for golfing in Delphi

Codegolfing is incredibly fun to do, trying to solve the given problem is one thing but the real challenge is getting your code as short as possible. Some languages are perfect for golfing because of ...
2
votes
0answers
123 views

Tips for golfing in Io

What general tips do you have for golfing in Io? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Io (e.g. "remove comments" is not an ...
17
votes
9answers
683 views

Tips for golfing in Haskell

What general tips do you have for golfing in Haskell? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Haskell. Please post only one ...
3
votes
2answers
139 views

Tips for golfing in Perl 6

What general tips do you have for golfing in Perl 6? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Perl 6 (e.g. "remove comments" is ...
10
votes
1answer
260 views

Tips for golfing in APL

I started one code golf challenge recently and it seems like the winner is GolfScript (surprise, surprise!). What's interesting is that there was another very strong competitor that had all chances to ...
13
votes
23answers
842 views

An improved version of GolfScript

I am planning to write an improved GolfScript for even shorter programs that can do more things. This is not a challenge; it is a request for feedback and tips on what I should do. (see tags) I'm not ...
3
votes
1answer
227 views

Tips for golfing in F#

What general tips do you have for golfing in F#? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to F# (e.g. "remove comments" is not an ...
3
votes
8answers
184 views

Tips for golfing in Befunge 98

What general tips do you have for golfing in Befunge 98? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Befunge 98 (e.g. "remove ...
2
votes
3answers
206 views

Doing shorter comparisons in PowerShell

One of the annoying bits about PowerShell, which helps amplify its disadvantage against other languages in code-golf, is that there are no symbolic comparison or logical operators. A comparison that ...
7
votes
10answers
482 views

Tips for golfing in Bash

What general tips do you have for golfing in Bash? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Bash (e.g. "remove comments" is not ...
2
votes
2answers
254 views

Tips for golfing in AWK

What general tips do you have for golfing in AWK? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to AWK. Please post one tip per answer. ...
3
votes
2answers
167 views

Tips for golfing in VBScript

What general tips do you have for golfing in VBScript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to VBScript. Please post one tip ...
4
votes
0answers
129 views

Tips for golfing in Octave

What general tips do you have for golfing in Octave? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Octave (e.g. "remove comments" is ...
3
votes
2answers
252 views

Tips for golfing in MATLAB

What general tips do you have for golfing in MATLAB? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to MATLAB (e.g. "remove comments" is ...
7
votes
2answers
531 views

Tips for golfing in Brainf**k

What general tips do you have for golfing in Brainf**k? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Brainf**k (e.g. "remove ...
11
votes
7answers
656 views

Tips for golfing in Mathematica

What general tips do you have for golfing in Mathematica? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Mathematica (e.g. "remove ...
4
votes
4answers
281 views

Tips for golfing in Tcl

What general tips do you have for golfing in Tcl? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Tcl (e.g. "remove comments" is not ...
1
vote
1answer
212 views

Code Golfing in high school computer science club? [closed]

This is not a code golf challenge. So, at my high school, we're starting a new computer science club, and personally I'd like it to be more than just writing Java stuff (AP Comp Sci curriculum). How ...
11
votes
8answers
446 views

Tips for golfing in Postscript?

As one of the less popular languages, it's difficult to find literature on the avant garde of postscript hackery. So what discoveries have the golfers here made to exploit the stack model (or other ...
4
votes
5answers
449 views

Language idea for golfing purposes

This question is probably not on-topic. If a moderator feels that it should be that way, turn this question into community wiki please. In order to raise the score of (my) code-golf submissions, I ...
25
votes
16answers
3k views

Tips for golfing in Java

Are there any useful shortcuts that can be used in Java? As shown below, import already adds at least 17 characters to a program. import java.io.*; I understand that the simple solution would ...
10
votes
3answers
536 views

Tips for golfing in J

GolfScript gets its own way far too often and I feel that a repository of handy hints for golfing in J might help in the fight against the evil empire. What tips do you have for making this already ...
5
votes
2answers
489 views

PHP Codegolf: Reading/writing files and the CLI

I have been participating in a number of PHP codegolf challenges recently and some of the techniques that are used to read data from a file such as fopen() and fread() or file_get_contents() really ...
18
votes
16answers
2k views

Tips for golfing in <all languages>

The aim of this post is to gather all the golfing tips that can be easily applied to <all languages> rather than a specific one. Only post answers that its logic can be applied to the majority ...
21
votes
14answers
2k views

Tips for golfing in GolfScript

What, this post doesn't exist yet? Of course, GolfScript is made for golfing, so you might think that no specific tips are really needed. But to make full use of GolfScript's features, you need to ...
5
votes
11answers
717 views

Tips for golfing in VBA

Similar to this, this, and this question... What general tips do you have for golfing in VBA? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat ...
20
votes
12answers
2k views

Tips for golfing in Perl?

What general tips do you have for golfing in Perl? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Perl (e.g. "remove comments" is not ...
17
votes
3answers
436 views

Tips for golfing in R?

I'm looking for tips for golfing in the R statistical language. R is perhaps an unconventional choice for Golf. However, it does certain things very compactly (sequences, randomness, vectors, and ...
10
votes
9answers
515 views

Tips for golfing in Scala

What general tips do you have for golfing in Scala? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala (e.g. "remove comments" is ...
11
votes
8answers
1k views

Tips for golfing in PHP

What general tips do you have for golfing in PHP? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PHP (e.g. "remove comments" is not ...
7
votes
3answers
348 views

Tips For Golfing In Groovy

As I have seen many questions asking tips for golfing in their interested language, I decided to ask for my favorite language: Groovy. People can give some tips and tricks that will be used in golfing ...
5
votes
2answers
289 views

Tips for golfing in Clojure

What are your tips for code golfing using Clojure? The aim of this question is to collect a list of techniques that are specific to Clojure and can be used in general code-golfing problems.