Questions tagged [tips]

For questions asking for tips on golfing in a specific language, doing well in certain challenge tag, or improving a particular piece of code.

Filter by
Sorted by
Tagged with
4 votes
2 answers
702 views

Shortest C code to display argv in-order

I recently tried to produce the shortest C code possible to display all its command line arguments (which are stored in argv). I ended with a relatively small piece of code, and I was wondering if ...
11 votes
6 answers
561 views

Tips for golfing in Retina

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

Tips for Golfing in Vyxal 3

The reason for this question is because I made a deadlineless bounty and I need a tips question to link in the bounty Vyxal 3 is the third major version of the Vyxal golfing language. As it is ...
22 votes
24 answers
2k views

Tips for golfing in sed

What general tips do you have for golfing in sed? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to sed (e.g. "remove comments" is not ...
18 votes
16 answers
1k views

Tips for Golfing in Vyxal

Vyxal is a golfing language that has 500+ different commands (achieved through overloads), and is a known beater of Jelly, 05AB1E and most golfing languages. Henceforth, it seems like a good idea to ...
88 votes
58 answers
17k 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 ...
4 votes
3 answers
369 views

Is there a shortest code to format string

Code Golf Challenge Given a string of 10 characters: 'abcdefghij' I want to format it in this pattern and print it in the console in a minimum number of characters: ...
70 votes
43 answers
11k 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 ...
28 votes
16 answers
3k 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 ...
6 votes
0 answers
241 views

Shortest CSS selector to select ALL html elements, without using asterisk *

What is the shortest selector (by character count) to select ALL html elements on a web page, without using asterisk (*)? Some examples are the following: ...
11 votes
7 answers
4k views

How can I shorten a C code that repeatedly outputs a number?

I wrote a code that separates the numbers from 1 to 9999 by comma void p(n){printf("%d,",n);if(n<9999){p(n+1);}}main(){p(1);} Is there a way to make ...
10 votes
12 answers
2k views

Tips for golfing in TypeScript's type system

What general tips do you have for golfing in TypeScript's type system? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to TypeScript's ...
22 votes
10 answers
1k views

Tips for golfing in Prolog

What general tips do you have for golfing in Prolog? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Prolog (e.g. one letter ...
52 votes
26 answers
14k 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 ...
2 votes
2 answers
204 views

Binary expansion and partition numbers [closed]

Not sure if it's correct to ask such a question on this site, but let's try. Let a(n) be a sequence of positive integer such that a(1) = 1. To reproduce the sequence a(n) through itself, use the ...
326 votes
177 answers
138k views

Tips for golfing in Python

What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is ...
17 votes
4 answers
6k views

Is there a shorter way to get user input in python?

This is not a challenge. I'm wondering if it's at all possible to get user input into two separate variables in python (2 or 3) with less than 19 bytes. These are all the shortest I can get: ...
173 votes
97 answers
67k views

Tips for golfing in JavaScript

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

Tips for radiation hardening

The aim of this post is to gather all the tips that can often be applied to radiation-hardening challenges. Please only post answers which can apply to a large number of languages, and one tip per ...
6 votes
1 answer
394 views

Further golfing this C# code from Scramble words while preserving their outlines

I'll start off by saying I checked and checked again that this question should be on topic. I will also clearly state that this is a tips question about further golfing a certain set of code not a ...
-2 votes
1 answer
84 views

PHP+C polyglot solution to mixed types

Some built-in functions in PHP return mixed types, like file_get_contents that returns both string or ...
5 votes
1 answer
281 views

Tips for Golfing the Lambda Calculus & Friends

This includes tips for all related derivatives, as coding in these langs often primarily consists of writing the function in the lambda calculus and then compiling it down at the end. Among others, ...
8 votes
10 answers
421 views

Tips for golfing in Pascal

What general tips do you have for golfing code in Pascal? I know this is a tricky language very few people use this but I would like to know any tips from the professionals out there :) I'm looking ...
41 votes
40 answers
10k 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 ...
1 vote
1 answer
167 views

Shorten this recursive even fibonacci implementation [closed]

I have the following Haskell code to generate the the values of the Fibonacci sequence which are even as an infinite list: ...
22 votes
15 answers
2k views

Tips for Code Golfing in Desmos

Desmos is mainly used as an online graphing calculator, but its graphical and mathematical functionalities can also be applied in certain coding challenges. I know not that many people use Desmos on ...
28 votes
11 answers
3k 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 ...
20 votes
18 answers
733 views

Tips for golfing in Factor

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

Tips for Golfing in Go

What general tips do you have for golfing in Go? I'm new to Code Golfing and looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Go. Please ...
2 votes
0 answers
84 views

Tips for golfing in Thue

Anyone got tips for golfing in Thue. One tip per answer, and no tips aplicable to all languages (like remove comments)
4 votes
4 answers
205 views

Tips for golfing in (,) in-paren-comma

What tips do you have for golfing in (,)? I've found that there are so many ways to make code shorter, and I want more ways. I doubt there even are any tips for (,) that are applicable in the majority ...
13 votes
4 answers
2k views

Tips for improving your score in fastest code challenges

Fastest code is a scoring method on this site where the goal is to write code that is as fast as possible. From the tag wiki: The winner of a fastest-code challenge is determined by the runtime ...
162 votes
61 answers
38k views

Tips for golfing in C

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

Tips for golfing in TI-BASIC

What general tips do you have for golfing in TI-BASIC for the TI-83/84+ series calculators? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat ...
62 votes
30 answers
19k views

Tips for golfing in C++

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

Tips for golfing in Arturo

Arturo is a bytecode-compiled/interpreted, garbage-collected general-purpose language filling a role similar to JavaScript, Python and Ruby. It is centered around the concept of blocks, which hold ...
12 votes
2 answers
991 views

Can Bitshift Variations in C Minor be compressed down to less than 185 characters?

Bitshift Variations in C Minor by Robert Miles is a Code Golf music piece written in C (with some additional bash commands). It was originally presented in a 2016 Computerphile video Code Golf & ...
9 votes
5 answers
543 views

Shortest way to convert the result of a test to a string output (e.g. true or false) in bash

I'm trying to shorten a bash solution to a Code Golf challenge, which requires an output of true or false. I've managed to ...
-2 votes
1 answer
440 views

What is the ABSOLOUTE shortest way to write this code?

So I got kinda bored and was wondering if it was possible to make this code shorter without modifying anything except a file named coin.py... ...
49 votes
35 answers
8k views

Tips for golfing in x86/x64 machine code

I noticed that there's no such question, so here it is: Do you have general tips for golfing in x86/x64 machine code? If the tip only applies to a certain environment or calling convention, please ...
51 votes
17 answers
10k views

Tips for Regex Golf

Similar to our threads for language-specific golfing tips: what are general tricks to shorten regular expressions? I can see three uses of regex when it comes to golfing: classic regex golf ("here ...
3 votes
6 answers
891 views

Tips for golfing in Thunno 2

Thunno 2 is a stack-based golfing language with around 400 commands (achieved through overloads) created by me, The Thonnu. It seems like a good idea to share some tips for golfing in Thunno 2. Please,...
11 votes
10 answers
518 views

Tips for golfing in PARI/GP

PARI/GP is a free computer algebra system. It is designed for (algebraic) number theory, not golfing, but that's part of the attraction. Unsurprisingly, it fares best at mathematical tasks; its ...
75 votes
59 answers
20k views

Tips for code-golfing in C#

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

Tips for golfing in K

K is a programming language in the APL family designed by Arthur Whitney. While the official interpreter is closed-source and commercial, a trial version with a workspace limit of 32 bits of ...
18 votes
10 answers
990 views

Tips for golfing in Pip

Pip is an imperative golfing language with infix operators. It also borrows some features from functional and array programming. What general tips do you have for golfing in Pip? I'm looking for ...
52 votes
43 answers
7k 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 ...
16 votes
13 answers
2k 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 ...
46 votes
15 answers
3k views

Tips for Creating/Maintaining a Golfing Language

Creating a golfing language can be hard. Let's help budding golfing language creators out and provide some helpful tips on how to create one. I'm looking for tips on: The design process ...
13 votes
5 answers
530 views

Tips for golfing in Scratch

Scratch is a visual programming language. For the sake of counting bytes, Scratch is usually written in scratchblocks2 syntax. Post tips that specifically apply to Scratch or scratchblocks2.

1
2 3 4 5
8