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 user‭

68 posts
71%
+3 −0
Challenges Obligatory Quine Challenge

Scala 3, 80 bytes @main def m={val s="@main def m={val s=%c%s%1$c;printf(s,34,s)}";printf(s,34,s)} Try it in Scastie! The printf replaces %c and %1$c in string s with the quote character (34 i...

posted 3y ago by user‭

Answer
71%
+3 −0
Challenges Make my number a set

Haskell, 51 31 bytes Saved 20 bytes thanks to Hakerh400! data S=S[S] f i=S$map f[0..i-1] Try it online! S is a recursive data structure, because sets of varying element types can't be repr...

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

Answer
71%
+3 −0
Challenges Backspace an array

Scala, 45 bytes _./:(Seq[Int]())((a,x)=>a:+x dropRight-x*2+2) Try it in Scastie! I couldn't find a way to use underscores in the inner function :(. Explanation on its way. _ //The inp...

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

Answer
71%
+3 −0
66%
+2 −0
Challenges Can you give me half?

Scala, 15 bytes '#'.toFloat/'F' Try it in Scastie! Characters in Scala kinda get casted to integers. This is usually annoying, but it's useful when golfing. # is 35 and F is 70, and the .toFlo...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Cumulative Counts

APL (Dyalog Unicode), 11 7 bytes (SBCS) Razetime and rak1507 came up with 7 byte equivalents of my original dfn (this one's rak1507's). See their solutions below. +/¨⊢=,\ Try it online! +/¨...

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

Answer
66%
+2 −0
Challenges Keyword golfing

Scala 3, 553 bytes package a import E.Z as Z import E.* sealed trait T open class Y{export E.Z as Q} enum E[+A]derives CanEqual: case Z end E private abstract final class X extends AnyRef...

posted 3y ago by user‭

Answer
66%
+2 −0
Sandbox Create a finite projective plane of order $n$

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

Article code-golf math
66%
+2 −0
Challenges Find the IP address class

Vyxal, 24 bytes \.€hEb:L8-0wẋf$J0ḟkA5Ẏ$i Try it Online! This is absolutely abysmal but whatever. A lot of bytes are taken up by trying to pad the list with zeroes (ẋ was buggy or something so ...

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

Answer
66%
+2 −0
Q&A Tips for golfing in Java

Abuse anonymous classes Warning: This only works in very specific circumstances, and I've never actually needed it. Instead of defining a method outside of your method, you can make an instance o...

posted 3y ago by user‭

Answer
66%
+2 −0
Q&A Tips for golfing in Java

Abuse the C-like array syntax If you ever have to declare two variables, one of type X and the other of type X[], instead of two statements, you can declare them together using this atrocious synt...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Weave Strings Together

Scala, 60 bytes _.map(_ map "".+).reduce(_.zipAll(_,"","")map(_+_)).mkString Try it in Scastie! First, _.map(_ map "".+) turns every string into a list of strings containing a single character...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges It's Hip to be Square

Python 3, 46 bytes Saved 8 bytes thanks to Shaggy! lambda n:[n-i*i or exit(1)for i in range(1+n)] Try it online! Python 3.8 (pre-release), 50 54 52 bytes Fixed a silly mistake thanks to Sh...

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

Answer
66%
+2 −0
Challenges Generalized Sort

Scala, 64 bytes c=>_.sortBy(x=>c.map(_(x)))(math.Ordering.Implicits.seqOrdering) Try it in Scastie! A rather crude answer, but I'll come back later to golf it. It's rather simple, though...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Compute the determinant

Scala, 130 125 bytes Saved 5 bytes by returning 1 like Hakerh400's great answer def f(m:Seq[Seq[Double]]):Double=if(m.size<1)1 else(m.indices:\.0){(i,a)=>m(0)(i)*f(m.tail.map(r=>r.take(i...

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

Answer
66%
+2 −0
Challenges In The Jailhouse Now

Scala, 90 89 88 bytes Saved 2 bytes thanks to Shaggy n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x<n)"╠╬╣"else"╚╩╝";s(0)+(""+s(1))*(n-3)+s(2)} Try it in Scastie! I feel like there'...

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

Answer
66%
+2 −0
Challenges Evaluate a single variable polynomial equation

Python 3, 46 bytes f=lambda p,x,a=0:p and f(p[1:],x,a*x+p[0])or a Try it online! Takes input reversed.

posted 3y ago by user‭

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

Scala, 242 bytes _=>99 to(1,-1)map{b=>s"${w(b)} on the wall, ${w(b)}. \n${if(b>1)"Take one down and pass it around"else "Go to the store and buy some more"}, ${w((b+97)%99+1)} on the w...

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

Answer
66%
+2 −0
Challenges Gamer Meme Creator

Scala, 98 83 bytes Saved 15 bytes thanks to Shaggy! a=>t=>{val w=a.map(_.size).max (" "*(w-t.size>>1)+t)+:a:+" "*(w/2-5)+"BOTTOM TEXT"} Try it online! a is the ASCII art, t is th...

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

Answer
66%
+2 −0
Challenges Guess the language! (Robbers' Thread)

Cracks Mark Giraffe's answer: Forth (gforth) .( Cops and Robbers) Try it online!

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

Answer
66%
+2 −0
Challenges Diagonalized alphabet

APL (Dyalog Unicode), 31 bytes ⎕←↑(14↑(2⌷x),⍨⌽)¨,\1⌷x←⍉13 2⍴⎕A Try it online! Lot worse than the BQN answer. ⎕←↑(14↑(2⌷x),⍨⌽)¨,\1⌷x←⍉13 2⍴⎕A ⎕A ⍝ String of up...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Evaluation order of an APL n-train

Haskell, 52 48 45 42 bytes Caught mistake thanks to rak1507 Saved 3 bytes thanks to Hakerh400 f n=n:g[n-1,n-2..1] g(b:c:t)=c:b:g t g t=t Try it online! g takes the rest of the trains. -...

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

Answer
66%
+2 −0
Challenges Length of a Sumac Sequence

Scala, 83 bytes x=>x.init#::Stream.iterate(x)(x=>x++(x,x.tail).zipped.map(_-_))indexWhere(_.last<1) Try it online! Takes input as a list of two numbers. The fact that the length can...

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

Answer
66%
+2 −0
Challenges Truthify an array

Scala 3, 68 bytes _.zipWithIndex.flatMap(_.zipWithIndex.filter(_._1)map(_._2)map _.->) Try it in Scastie! Takes a List[List[Boolean]], returns a List[(Int, Int)]. This abuses underscores a ...

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

Answer
66%
+2 −0
Challenges Beaver Code Decryption

APL(Dyalog Unicode), 34 29 bytes SBCS Saved 5 bytes thanks to Razetime! {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵} Try it on APLgolf! {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵} { } ...

posted 3y ago by user‭  ·  edited 3y ago by Shaggy‭

Answer