Can you give me half?
Challenge idea taken from: Eliseo D'Annunzio
Task
Provide code that evaluates to 0.5 numerically, i.e. the output must be recognized by your chosen language as a numeric value (Number, float, double, etc), not as a string.
The catch, the characters 0 through to 9 cannot be used.
One example that fits the brief would be the following:
((++[[]][[~~""]]<<++[[]][[~~""]]))**((--[[]][[~~""]]))
which works out to 0.5 in JavaScript.
Scoring
This is a code challenge, where scoring is done in terms of number of unique characters used in the submission. Ties are broken by lowest bytecount.
dc, 3 unique bytes, 138 bytes …
3y ago
[C (gcc)], 8 7 unique c …
2y ago
Ruby, 7 unique, 12 bytes `$ …
3y ago
Embed ESCR, 6 unique character …
3y ago
[Python 3], 5 unique bytes, 28 …
2y ago
Clojure - 15 characters total, …
3y ago
Perl, 3 distinct, 12 bytes …
3y ago
J, 4 3 distinct, 6 bytes `` …
3y ago
[Python 3], 7 distinct charact …
3y ago
Lua 5.4, 3 unique characters …
2y ago
J, 4 unique, 4 char ``` -: …
2y ago
[Julia 1.0], 16 bytes …
3y ago
Ruby, 10 distinct, 35 chars ` …
3y ago
Raku (also Perl polyglot), 5 u …
3y ago
Scala, 15 bytes ```scala '#' …
3y ago
Japt, 1 byte ½ Test …
3y ago
Javascript, 5 Distinct charact …
3y ago
JS, 15 bytes `!![]/(-[]-[]) …
3y ago
[Extended] Dyalog APL, 4 bytes …
1y ago
Golfscript, 8 6 bytes, 5 uniqu …
2y ago
Vyxal, 1 byte ``` . ``` Tr …
2y ago
Fig, 2 unique, 2 total ``` H …
2y ago
MATL, 3 distinct, 3 total ``` …
2y ago
23 answers
[Extended] Dyalog APL, 4 bytes*
*10 bytes, 4 unique
'÷'÷⍥≢'÷÷'
This computes the length of the string '÷'
divided by the length of the string '÷÷'
Alternate solution (extended only) (6 unique, 6 bytes)
⊢÷+⍨×∞
This computes
\[ \left(\lambda x.\frac{x}{x+x}\right) \mathrm{sign}\infty \]0 comment threads
Fig, 2 unique, 2 total
H!
Halves the negation of the empty string when no input is given.
0 comment threads
- ← Previous
- 1
- 2
- Next →
2 comment threads