New answers tagged tips
-1
votes
Shortest C code to display argv in-order
C (gcc), 37 bytes
main(c,v)int*v;{for(;*v;)puts(*v++);}
1
vote
Tips for golfing in Retina
Actualising a transliteration pattern in Retina 0.8.2
In Retina 1, it's easy to produce the contents of a transliteration pattern, here the 64 characters used by MIME Base-64:
...
8
votes
Accepted
Shortest C code to display argv in-order
C (gcc), 37 bytes
main(c,v)int*v;{for(;*v;)puts(*v++);}
Try it online!
When using 32-bit, you can use int to store a pointer ...
3
votes
Tips for Golfing in Vyxal 3
Compress Strings and Numbers
Like Vyxal 2 before it, Vyxal 3 has dictionary string compression and base-based compression. However, in Vyxal 3, dictionary strings use Jelly's sss and base-based ...
1
vote
Tips for golfing in sed
Use back references
Most people know that you can mark some parts of your regex with \(\) and later refer to it as \1 (or ...
2
votes
Tips for Golfing in Vyxal
Use string interpolation
Apparently automatic string interpolation (Π) has been incorporated into Vyxal from v2.13.3 onwards.
When used inside a string, ...
1
vote
Tips for golfing in Haskell
Avoid Data.List
The function are nice, but imports are costly. If you only need a single function, there are shorter alternatives:
...
0
votes
Is there a shortest code to format string
PowerShell, 46 bytes
"($($a[0..2])) $($a[3..5])-$($a[6..9])"-join''
Try it online!
The output is a little weird, if someone can suggest a fix to that it ...
4
votes
Accepted
Is there a shortest code to format string
Python 3, 35 bytes
print(f"({s:.3}) {s[3:6]}-{s[6:]}")
Try it online!
Uses the solution from the question but saves three bytes:
removes a redundant <...
1
vote
Is there a shortest code to format string
Python, 36 bytes
slightly improved version of your f-string (see also Jonathan Allan's comment), wrapped in a function
...
1
vote
Tips for golfing in Bash
Compress long runs of decimal digits using alternate base representation
bash's arithmetic context supports numbers in arbitrary alternate bases more compactly that ...
Top 50 recent answers are included
Related Tags
tips × 370code-golf × 319
python × 61
javascript × 29
c × 16
basic × 10
math × 8
haskell × 8
array × 8
php × 7
restricted-source × 6
assembly × 6
golfscript × 6
number × 5
c++ × 5
c# × 5
lisp × 5
pyth × 5
ruby × 5
powershell × 5
kolmogorov-complexity × 4
binary × 4
java × 4
machine-code × 4
cjam × 4