New answers tagged

-1 votes

Shortest C code to display argv in-order

C (gcc), 37 bytes main(c,v)int*v;{for(;*v;)puts(*v++);}
kriti kumari's user avatar
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: ...
Neil's user avatar
  • 165k
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 ...
l4m2's user avatar
  • 20.3k
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 ...
lyxal's user avatar
  • 32.6k
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 ...
Philippos's user avatar
  • 1,440
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, ...
math scat's user avatar
  • 8,467
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: ...
corvus_192's user avatar
  • 4,889
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 ...
I.T Delinquent's user avatar
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 <...
Jonathan Allan's user avatar
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 ...
ShadowRanger's user avatar

Top 50 recent answers are included