Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Posts by Hakerh400‭

59 posts
66%
+2 −0
Challenges Run-length encode a byte sequence

JavaScript (Node.js), 146 bytes f=(a,c=n=~(b=d=[],e=x=>x&&(c>191|d>2?b.push(d+192,c):b.push(...d+n?[c,c]:[c]),c=n,d=0)))=>(a.map(b=>c^n?c=(e(d>62|b-c),d++,b):(c=b,d=1))...

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Find good coalitions

Haskell, 141 bytes import Control.Monad f a=map(map fst)$filter(\c->let{g=map snd;e=sum(g a)`div`2;f=g c;d=sum f}in d>e&&all((<=e).(d-))f)$filterM(pure[1<0..])a Try it ...

posted 2y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Encode and decode floating point integers

Haskell, 219 194 bytes h!n=x n?(a?c$d>n&&(even a?f(<)$f(==)))$h where(a,b)=e!!(c-1);(c,d)=dropWhile((<n).snd)e!!0;f g=g(n*2)$b+d x n=m?(2^(e-1)*(m+32))$e<1where(e,m)=divMod ...

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Reverse your quine

JavaScript (Node.js), 60 bytes f=a=>console.log(`)(f;${[...f+``].reverse``.join``}=f`);f() Try it online!

posted 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Reverse your quine

Haskell, 78 bytes main=putStr$reverse$a++show a where a="main=putStr$reverse$a++show a where a=" Try it online!

posted 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges The Ludic Numbers

Haskell, 51 49 bytes -2 bytes thanks to Wheat Wizard 1:g[2..] g(a:b)=a:g[d|(c,d)<-zip[1..]b,c`mod`a>0] Try it online!

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Collatz conjecture; Count the tries to reach $1$

Haskell, 43 39 bytes f 1=0 f n=1+f([div n 2,n*3+1]!!mod n 2) Try it online!

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Decode periodic decimal fractions

Haskell, 352 bytes f a=let{(d,e)=y$filter(>'-')a;f=drop 1e;g=0!h;h=fst n;i=scanr(:)[]h;(j,k)=elem '.'f%(1!head(filter(\a->a>[]&&elem(a++a)i)i++[[last$'0':h]]));(l,m)=(read('0':d...

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Abbreviate everything

Haskell, 139 138 bytes import Data.Char f(a:b)|d a=toUpper a:f(dropWhile(\a->e a"-'"||d a)b)|e a":;"=a:c|e a".?!"=' ':c|0<1=c where c=f b;d=isLetter;e=elem f a=a Try it online!

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
60%
+1 −0
Sandbox Play dominoes using strings

posted 2y ago by Hakerh400‭

Article code-golf list
50%
+0 −0
Challenges Expand a polynomial

Haskell, 45 bytes foldl(\a b->zipWith((-).(*b))(0:a)$a++[0])[1] Try it online! Uses the "highest power first" convention. Sometimes multiplies the polynomial by $(-1)$.

posted 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Repeat the characters

Haskell, 18 bytes (.replicate).(>>=) Try it online!

posted 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Digit Sum Integer Sequence (working title)

Haskell, 56 bytes f a=a:f(a+g(read.pure<$>show a)) g a=minimum a+maximum a Try it online!

posted 2y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges "Hello, {name}!"

Haskell, 43 35 bytes main=interact$("Hello, "++).(++"!") Try it online!

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Stairs? Stairs! Stairs.

Haskell, 78 bytes (!)0.(*2) i!n|i<n=(drop 3$(n-i)#' '++"_/"++i#'#'):(i+2)!n|0<1=[] (#)=replicate Try it online!

posted 2y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges When The Ternary Is Balance

Haskell, 78 77 bytes (g[0]!) g a=mapM(\_->[-1..1])a++g(0:a) (a:b)!c|foldl1((+).(*3))a==c=a|0<1=b!c Try it online!

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
60%
+1 −0
Challenges Generalized Sort

Haskell, 29 bytes import Data.List foldr sortBy Try it online!

posted 2y ago by Hakerh400‭

Answer
60%
+1 −0
Challenges Make my value binary

Haskell, 29 bytes import Text.Printf printf"%b" Try it online! Without builtins: Haskell, 37 bytes f n|n<2=[n]|0<1=f(div n 2)++[rem n 2] Try it online!

posted 2y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Compute the determinant

Haskell, 75 73 bytes -2 bytes thanks to @user f[]=1 f(x:y)=foldr(-)0$zipWith(\i->(*f[take i r++drop(i+1)r|r<-y]))[0..]x Try it online!

posted 2y ago by Hakerh400‭  ·  edited 2y ago by Hakerh400‭

Answer
60%
+1 −0
Challenges Multiply two strings

Haskell, 25 bytes f a=(>>= \c->map(min c)a) Try it online!

posted 2y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Are All Elements Equal?

brainfuck, 40 bytes Outputs ÿ if all elements are equal, and \x00 byte otherwise. ->,>,[[-<->>+<]<[-<[-]>]>>[-<<+>>]<,]<<. Try it online! ...

posted 3y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Are All Elements Equal?

Haskell, 16 bytes f(a:b)=all(==a)b Try it online!

posted 3y ago by Hakerh400‭

Answer
71%
+3 −0
Challenges Reduce over the range [1..n]

Haskell, 18 bytes n!g=foldl1 g[1..n] Try it online!

posted 3y ago by Hakerh400‭

Answer
50%
+0 −0
Challenges Guess the language! (Cops' Thread)

???, 268 bytes !(115,114,101,98,98,111,82,32,100,110,97,32,115,112,111,67)0|2.~(0,0). 1|0|5.~#.~(0,1).~(0,2)0|4.~#.*(2,0,~(0,5),~(0,2)).~(0,1)-{0|5.~#.~(0,0 ,~(0,1))(0,0,~(0,1)).~#.~(0,~(0,0,2))...

posted 3y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges 99 Shortened Bottles of Beer

Haskell, 221 215 bytes f=a 99 (#)=(++) a n=d n#", "#c".\n"n#b(n-1) b 0="Go to the store and buy some more, "#d 99#"." b n="Take one down and pass it around, "#d n#".\n\n"#a n c m n=show n#"...

posted 3y ago by Hakerh400‭  ·  edited 3y ago by Hakerh400‭

Answer