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

32 posts
81%
+7 −0
Challenges Reverse an ASCII string

Ahead, 3 bytes SW@ S Slurp entire input to stack W Write entire stack @ End Try it online!

posted 4y ago by snail_‭

Answer
80%
+6 −0
Challenges Is it a near-anagram?

Two words are anagrams of each other if the letters of one can be reordered to spell the other; e.g. ADOBE and ABODE are anagrams. An alternate way of describing it is that both words contain the s...

5 answers  ·  posted 3y ago by snail_‭  ·  edited 3y ago by General Sebast1an‭

Question code-golf string
75%
+4 −0
Challenges Evaluate a single variable polynomial equation

Ruby, 38 bytes Simple map and sum over the coefficients. No TIO link, this uses numbered lambda parameters which require Ruby 2.7. ->l,x{l.each_with_index.sum{_1*x**_2}}

posted 4y ago by snail_‭

Answer
75%
+4 −0
Challenges Golf golf challenge

Ruby, 110 106 bytes Fixed capitalization and refactored for -4. ->p,s{d=s-p s<2&&"Hole in one"||%w[Albatross Eagle Birdie Par Bogey Double Triple][d+3]+(d>1?" bogey":"")} Att...

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

Answer
75%
+4 −0
Challenges Gamer Meme Creator

Ruby, 67 65 bytes -2 from Razetime ->s,a{[s.center(l=a.map(&:size).max),*a,"BOTTOM TEXT".center(l)]} Takes the art and outputs as a list of lines. Try it online!

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

Answer
75%
+4 −0
Meta Answering challenges with languages newer than the challenge

Somewhere Else, there was a long-standing rule that to answer a challenge, you couldn't use languages, language versions, or features that were created or introduced after the challenge was posted....

2 answers  ·  posted 3y ago by snail_‭  ·  last activity 3y ago by user‭

Question discussion
75%
+4 −0
Challenges It's Hip to be Square

Ruby, 16 bytes ->n{n**0.5%1==0} Try it online!

posted 3y ago by snail_‭

Answer
71%
+3 −0
Challenges Make my value binary

Ahead, 20 bytes I>:2%r vn:/2\< >}KO@ Control flow goes like this: # orange path: init I # read number # green path: main loop > # go east (start of loop) : # dup inpu...

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

Answer
71%
+3 −0
Challenges Repeat the characters

Ruby, 34 29 bytes ->s,n{s.chars.map{_1*n}*""} Try it online!

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

Answer
71%
+3 −0
Challenges Roll n fair dice

Ruby, 28 bytes ->n,m{(1..n).sum{rand(m)+1}} Try it online!

posted 3y ago by snail_‭  ·  edited 2y ago by snail_‭

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

If you have any tips for golfing in Ruby, share them as answers to this post.

1 answer  ·  posted 3y ago by snail_‭  ·  last activity 3y ago by snail_‭

Question code-golf tips
66%
+2 −0
Challenges Output 256 in many different ways

Ruby, 7 solutions 256 4**4 -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-...

posted 3y ago by snail_‭

Answer
66%
+2 −0
Challenges Make my number a set

Ruby, 27 bytes ->n{x=[];n.times{x<<x*1};x} ->n{ } # lambda taking n x=[]; # set x to empty array n.times{ }; # repeat...

posted 3y ago by snail_‭

Answer
66%
+2 −0
Challenges My house is destroyed! Can you make me one?

jq --raw-output, 32 bytes jq is the language of the month, apparently. Here it is! Not sure if the --raw-output flag really matters, someone let me know. "#"*.+(" #"+" "*(.-2)+"#")*(.-1) Try ...

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

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

Ruby, 15 bytes ->a{a.all?a[0]} ->a{ } # lambda taking array `a` a.all? # do all items in the array match... a[0] # ...the first? Try it online!

posted 3y ago by snail_‭

Answer
66%
+2 −0
Sandbox Is it a near-anagram? [FINALIZED]

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

66%
+2 −0
Challenges Repeat the characters

jq, 32 27 bytes -5 bytes (thank you Razetime) .n as$n|.s/""|map(.*$n)|add Try it online!

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

Answer
66%
+2 −0
Challenges Weave Strings Together

Ruby, 51 bytes ->a{(0..a.map(&:size).max).map{|n|a.map{_1[n]}}*""} ->a{ } # lambda taking array `a` (0..a.map(&:size).max) ...

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

Answer
66%
+2 −0
Challenges Tile pyramids on top of each other!

Ruby, 43 bytes ->n{(1..n).map{|i|" "*(n-i)+?/*i+?\\*i}*$/} ->n{ } # lambda (1..n).map{|i| } # map over 1 to n ...

posted 4y ago by snail_‭

Answer
66%
+2 −0
Challenges Operation "Find The Operator"

Ruby, 58 bytes Simple eval solution. Using ** for exponentiation. ->a,b,c{%w[+ - * / % **].select{eval("#{a}#{_1}#{b}")==c}} Attempt This Online!

posted 3y ago by snail_‭

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

Omitting parens on function calls You can omit parentheses on function calls in many cases. foo(bar,baz) foo bar,baz This is even true if a function call doesn't have any parameters. (This is...

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

Answer
60%
+1 −0
Challenges A number adder, not a death adder

Ahead, 10 bytes IO"@O+I"W@ This prints N1I+0@. Try it online!

posted 3y ago by snail_‭

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

Ruby, 33 bytes Recursive lambda solution. c=->n{n<2?0:1+c[n%2<1?n/2:n*3+1]} c=->n{ } # c = lambda taking `n` n<2? : # if n...

posted 3y ago by snail_‭

Answer
60%
+1 −0
Challenges A number adder, not a death adder

Ruby, 28 bytes puts"puts #{gets}+gets.to_i" puts"puts # print P2, which prints #{gets} # P1's input value, interpolated +gets.to_i" ...

posted 3y ago by snail_‭

Answer
60%
+1 −0
Challenges Create a range grid

BQN (CBQN), 10 bytes Anonymous function that takes m on the left and n on the right. {𝕨‿𝕩⥊↕𝕨×𝕩} ↕𝕨×𝕩 # list of range [0,m*n) 𝕨‿𝕩⥊ # reshape list to m*n Try it here!

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

Answer