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
75%
+4 −0
Challenges Find n Niven Numbers

Scala, 52 bytes Stream.from(1).filter(x=>x%(x+"":\0)(_+_-48)<1).take Try it in Scastie! Woo, 3 deprecation warnings! (okay, one of them could be fixed but I like to live dangerously) St...

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

Answer
60%
+1 −0
Challenges From the smallest seed

Zsh, 61 bytes n=2;s=s=%q\;printf\ n=\$n\$n\\\;\$s\ \$s;printf n=$n$n\;$s $s Attempt This Online! A trivial modification of this quine: s=s=%q\;printf\ \$s\ \$s;printf $s $s. n goes from 2 to 22 ...

posted 2y ago by user‭

Answer
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 2y 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 2y ago by user‭

Answer
71%
+3 −0
Challenges Determine whether an integer is square-free

Scala, 41 bytes x=>2 to x forall(d=>x%d+math.sqrt(d)%1>0) Try it online! Pretty straightforward

posted 2y ago by user‭

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

posted 2y ago by user‭  ·  edited 2y 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 2y ago by user‭  ·  edited 2y ago by user‭

Answer
60%
+1 −0
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 2y 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 2y ago by user‭

Answer
75%
+4 −0
Meta Reactions on Code Golf Codidact

I think "Dangerous" could perhaps stay on. "Outdated" would probably be better off replaced with "Invalid" or something of that sort. I don't think we need "Works for me" or an analog of it at all:...

posted 2y 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 2y ago by user‭

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

Scala, 50 bytes Stream.iterate(_)(x=>Seq(x/2,3*x+1)(x%2))indexOf 1 Try it in Scastie!

posted 2y 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 2y ago by user‭  ·  edited 2y 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 2y ago by user‭

Answer
71%
+3 −0
Challenges Compute the determinant

Python 3.8 (pre-release), 106 95 bytes Saved 11 bytes thanks to Peter Taylor! f=lambda m:sum((-1)**i*x*f([r[:i]+r[i+1:]for r in m[1:]])for i,x in enumerate(m[0]))if m else 1 Try it online! ...

posted 2y ago by user‭  ·  edited 2y 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 2y ago by user‭  ·  edited 2y ago by user‭

Answer
60%
+1 −0
Challenges Multiply two strings

Scala, 25 bytes a=>_.flatMap(a map _.min) Try it in Scastie! Pretty trivial solution, but here's a bad explanation anyway: //a is the first string a =>_.flatMap(a map _.min) //b is th...

posted 2y ago by user‭  ·  edited 2y 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 2y ago by user‭  ·  edited 2y 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 2y ago by user‭

Answer
60%
+1 −0
Challenges Small integer swapping

Python 3.8 (pre-release), 39 bytes print(x:=input(),y:=input()) print(y,x) Try it online!

posted 2y ago by user‭

Answer
77%
+5 −0
Challenges Coat of Many Colours

Scala, 119 bytes Saved 26 bytes after porting Moshi's solution! _ sortBy("y gree br sc bla oc pe rub ol v f li go ch m cre c s ro a l ru g pu w p o b"split " "indexWhere _.startsWith) Original...

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

Answer
60%
+1 −0
Challenges Are All Elements Equal?

Trivial answers Husk, 1 byte E Try it online!

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

Answer
81%
+7 −0
Challenges Reduce over the range [1..n]

Task I often need to find the factorial of a number or the sum of all numbers up to a number when cheating on math tests. To help me with this, your task is to write $F$, a generalized version of ...

14 answers  ·  posted 2y ago by user‭  ·  last activity 1y ago by gifti‭

60%
+1 −0
Challenges "Hello, World!"

Scala, 42 bytes object>extends App{print("Hello, World!")} Attempt This Online!

posted 2y ago by user‭

Answer