9
votes
Map key with value as standard
Python 3, 52 bytes
lambda x:dict(i.split(')')for i in x[1:].split('('))
Try it online!
8
votes
8
votes
Accepted
Map key with value as standard
Vyxal, 64 46 bitsv2, 8 5.75 bytes
\(/Ḣ\)/
Try it Online!
Bitstring:
0110100010010100000101101101001111001010010100
Returns a ...
8
votes
Map key with value as standard
Ruby, 42 31 25 bytes
->s{Hash[*s.scan(/\w+/)]}
Try it online!
Thanks @Dingus for -11 bytes and forcing me to do more research on hashes.
7
votes
5
votes
Accepted
Create a cactus from words
Vyxal, 152 bitsv2, 19 bytes
ƛḣ$øA‹$ḣṘ"$꘍;⁽ṘẆnṘ:"j§
Try it Online!
Bitstring:
...
5
votes
Swifty Argument Labels
Haskell, 40 bytes
f""="_"
f x=x
a#b=unwords$f a:[f b|a/=b]
Try it online! I borrowed the test suite from totallyhuman.
5
votes
Map key with value as standard
05AB1E, 8 bytes
¦'(¡')δ¡
Try it online or verify all test cases.
Explanation:
...
5
votes
Map key with value as standard
Haskell, 64 60 bytes
-4 bytes thanks to Wheat Wizard.
g=span(>'*')
f""=[]
f(_:s)|(a,_:b)<-g s,(c,d)<-g b=(a,c):f d
Try it online!
Invalid (but ...
5
votes
Rockstar Poetic Number Literals!
JavaScript (ES6), 68 bytes
s=>+s.replace(/(?<!\..*)(\.)|\w+|(.)/g,(a,b,c)=>c?"":b||a.length%10)
Try it online!
5
votes
Rockstar Poetic Number Literals!
JavaScript (Node.js), 61 bytes
s=>+s.replace(/\w+|./g,a=>a+d<1?d=a:a>'?'?a.length%10:"",d=1)
Try it online!
-2B from tsh
You can assume the ...
4
votes
4
votes
Create a cactus from words
Uiua, 40 38 36 bytes
⇌⍉⬚@ (⊂⇌∩(⊂+@a⇡26≡⊂:⊟°⊂:¤↯:@ -@a°⊂))
Try it
38 → 36 bytes thanks to Joao-3 :)
Explanation
⬚@ (…)
Uiua won’...
4
votes
Map key with value as standard
JavaScript (V8), 56 bytes
x=>x.replace(/.(.*?)\)([^(]*)/g,(_,a,b)=>s[a]=b,s={})&&s
Try it online!
4
votes
Remove filler words from a string
QuadR i≡, 80 78 bytes
−2 thanks to inspiration from Neil's Retina answer.
...
3
votes
XOR two strings
R, 136 bytes
\(a,b){'!'=nchar;'?'=utf8ToInt;if((!a)<!b){j=a;a=b;b=j};s=?a;names(s)=?b;n=names(s);n[is.na(n)]=0;intToUtf8(bitwXor(s,as.numeric(n)),T)}
Attempt ...
3
votes
3
votes
Create a cactus from words
J, 62 bytes
0|.@|:(,~|.)&((u:97+i.26)&([,](,"1(,@{.,:}.)@}.)~' '#~(i.{.)))
Attempt This Online!
Probably more bytes to shave off here but not seeing ...
3
votes
Accepted
3
votes
Swifty Argument Labels
Python, 41 bytes
lambda a,b:(a!=b)*f"{a or'_'} "+(b or"_")
Attempt This Online!
3
votes
Map key with value as standard
APL+WIN, 23 bytes
Prompts for string.
((+\m∊'()')⊂m←⎕)~¨⊂'()'
Try it online! Thanks to Dyalog Classic
3
votes
3
votes
Map key with value as standard
Uiua SBCS, 14 13 bytes
↯∞_2⊜□¬∊,"()"
Try it!
-1 thanks to RomanPro100
...
3
votes
3
votes
Map key with value as standard
Jelly, 8 bytes
ṣ”(Ḋṣ€”)
Try It Online!
Returns output as a list of key-value pairs.
Explanation
...
3
votes
3
votes
Rockstar Poetic Number Literals!
Retina 0.8.2, 66 bytes
((\.)|.)*?(?=\w)(\w{10})*(\w*)
$2$.4
1>`\.
^0+\B|\.?0*(?<=\..*)$
Try it online! Link includes test cases. Explanation: Skips over ...
2
votes
Do X without Y
Uiua, 33 31 bytes
+@ ×+1++∩>86,55.⌊×92∵⋅⚂.↥⇌.⊞=.⇡
Try it
Look ma, no y!
See also RomanPro100's solution which does the same ...
2
votes
2
votes
Fill in the Minesweeper clues
Jelly, 100 bytes
495Bs3
ḣ1ẎL+2
L+2Ɗ×Ç©x@0s®+⁸ṙ-1$ṙ-1$€
¹3Ƥz0$€z0$3Ƥ€Ẏ×€⁹F+/$€
3Ŀç
ḣ1ẎLƲs@ç
”*ḷṛ?"
6ŀ1£ðç"⁹
Ỵ=”*ç{
ÇY
So this absurdly long solution is ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
string × 2237code-golf × 2100
ascii-art × 212
decision-problem × 143
kolmogorov-complexity × 125
parsing × 119
number × 103
code-challenge × 71
natural-language × 64
random × 61
math × 59
balanced-string × 59
array × 55
restricted-source × 48
grid × 45
subsequence × 41
alphabet × 39
sequence × 38
arithmetic × 38
sorting × 38
permutations × 37
source-layout × 36
date × 34
counting × 32
palindrome × 31