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
60%
+1 −0
Q&A Tips for golfing in Scala

Making a function with val can be shorter than with a def If you're pattern matching, you can use Scala's special syntax and omit match when assigning an anonymous function to a val. As you can se...

posted 3y 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
60%
+1 −0
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 3y 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 3y ago by user‭  ·  edited 3y 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 3y ago by user‭

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

Trivial answers Husk, 1 byte E Try it online!

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

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

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

posted 3y ago by user‭

Answer
60%
+1 −0
Challenges Evaluate a single variable polynomial equation

Scala, 18 bytes x=>_.:\(.0)(_+_*x) Try it online! Not too complicated. Takes the list of coefficients and folds from the right, multiplying the accumulator by x each time and adding the nex...

posted 3y ago by user‭

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

Verbosity, 512 bytes, cracked by Moshi Include<Integer> Include<MetaFunctions> Include<Output> Include<String> Integer:DefineVariable<IntegerOne; 1> Output:Def...

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

Answer
60%
+1 −0
Challenges Create a Sudoku

APL (Dyalog Unicode), 22 bytes ⎕←∘.((1+⍳9)⌽⍨⊣+3×⊢)⍨⍳3 Try it online! Requires zero-indexing. ⎕←∘.((1+⍳9)⌽⍨⊣+3×⊢)⍨⍳3 ⍳3 ⍝ Make the range [0, 2] (row and cols of 3×3 box...

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

Answer
60%
+1 −0
Challenges Backspace an array

JavaScript (Node.js), 41 40 bytes Saved 1 byte thanks to Shaggy x=>x.map(e=>e?a.push(e):a.pop(),a=[])&&a Try it online! x => //x is the input x.map(e=> //For every...

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

Answer
60%
+1 −0
Challenges Really Cool Numbers

APL (Dyalog Unicode), 30 29 bytes Saved 1 byte thanks to Razetime (could've saved 1 more with a tradfn, but I didn't feel like it) {∧/(0=1|+/÷≢)¨1↓¨g¨(g←∪⊢∨⍳)⍵} Try it online! This answer w...

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

Answer
60%
+1 −0
Challenges Cumulative Counts

Scala 3, 50 44 bytes ? => ?.indices zip?map(?take _+1 count _.==) Try it in Scastie! This is an annoying, stupid approach. The more elegant one using inits was much longer (x=>x.inits.to...

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

Answer
60%
+1 −0
Challenges Solve Goldbach's Conjecture

APL (Dyalog Unicode), 32 bytes (SBCS) {⊃(⊢(/⍨)⍵=+/¨),∘.,⍨(⊢~∘.×)⍨1↓⍳⍵} Try it online! {⊃(⊢(/⍨)⍵=+/¨),∘.,⍨(⊢~∘.×)⍨1↓⍳⍵} ⍳⍵ ⍝ Range from 1 to n ...

posted 3y ago by user‭

Answer
60%
+1 −0
Q&A Tips for golfing in Scala

What general tips do you have for golfing in Scala? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala (e.g. "remove comments" i...

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

Question code-golf tips
50%
+0 −0
Challenges Bytes to Segfault

Rust, 47 bytes fn main(){unsafe{print!("{}",*(0 as*mut i8));}} Try it online!

posted 3y ago by user‭

Answer
50%
+0 −0
Meta Leaderboards are live

Libraries are removed when "merge variants" is on. For example, this answer written in C (clang) uses a library called BMPL, so its header is C (clang) + BMPL. While there's nothing wrong with usin...

posted 3y ago by user‭

Answer