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 »

Activity for snail_‭

Type On... Excerpt Status Date
Answer A: Create a range grid
BQN (CBQN), 10 bytes Anonymous function that takes `m` on the left and `n` on the right. ```bqn {𝕨‿𝕩β₯Šβ†•π•¨Γ—𝕩} ↕𝕨×𝕩 # list of range 0,mn) 𝕨‿𝕩β₯Š # reshape list to mn ``` [Try it here!
(more)
about 2 years ago
Answer A: Evaluate a single variable polynomial equation
BQN, 13 bytes ```bqn {+Β΄(𝕨⋆↕≠𝕩)×𝕩} { } # fn +Β΄ # sum reduce (𝕨⋆↕≠𝕩) # x^i for each term ×𝕩 # times each coefficient ``` Try it
(more)
over 2 years ago
Answer A: A number adder, not a death adder
Ruby, 28 bytes ```ruby puts"puts #{gets}+gets.toi" puts"puts # print P2, which prints #{gets} # P1's input value, interpolated +gets.toi" # plus P2's input value ``` For instance, if the input to P1 is 10, then P2 is ```ruby put...
(more)
over 2 years ago
Answer A: Operation "Find The Operator"
Ruby, 58 bytes Simple eval solution. Using `` for exponentiation. -&gt;a,b,c{%w[+ - / % ].select{eval(&quot;#{a}#{1}#{b}&quot;)==c}} Attempt This Online!
(more)
over 2 years ago
Answer A: Golf golf challenge
Ruby, 110 106 bytes Fixed capitalization and refactored for -4. ```ruby ->p,s{d=s-p s1?" bogey":"")} ``` Attempt This Online!
(more)
over 2 years ago
Answer A: Weave Strings Together
[Ruby], 51 bytes ```ruby ->a{(0..a.map(&:size).max).map{|n|a.map{1[n]}}""} ->a{ } # lambda taking array `a` (0..a.map(&:size).max) # range of 0..length of longest string .map{|n| ...
(more)
over 2 years ago
Answer A: Collatz conjecture; Count the tries to reach $1$
[Ruby], 33 bytes Recursive lambda solution. ```ruby c=->n{nn{ } # c = lambda taking `n` n<2? : # if n < 2... 0 # return 0... 1+c[ ] # else return 1 + collatz count for... ...
(more)
over 2 years ago
Answer A: Repeat the characters
[jq], 32 27 bytes -5 bytes (thank you Razetime) .n as$n|.s/""|map(.$n)|add Try it online!
(more)
over 2 years ago
Answer A: Repeat the characters
[Ruby], 34 29 bytes ```ruby ->s,n{s.chars.map{1n}""} ``` Try it online!
(more)
over 2 years ago
Answer A: Are All Elements Equal?
[Ruby], 15 bytes ```ruby ->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!
(more)
over 2 years ago
Answer A: A number adder, not a death adder
[Ahead], 10 bytes IO"@O+I"W@ This prints `N1I+0@`. Try it online!
(more)
over 2 years ago
Answer A: 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. ```js "#".+(" #"+" "(.-2)+"#")(.-1) ``` Try it online!
(more)
over 2 years ago
Answer A: Tips for golfing in Ruby
Omitting parens on function calls You can omit parentheses on function calls in many cases. ```ruby foo(bar,baz) foo bar,baz ``` This is even true if a function call doesn't have any parameters. (This is because all function calls and property accesses are just methods, by the way.) ```ruby p...
(more)
over 2 years ago
Answer A: Golf a FRACTRAN interpreter
[Ruby], 51 50 bytes -1 from Razetime ```ruby ->p,n{while i=p.find{(1n).tof%1==0} n=i end n} ``` Try it online!
(more)
over 2 years ago
Answer A: Make my value binary
[Ahead], 20 bytes ```ahead I>:2%r vn:/2\}KO@ ``` Control flow goes like this: Ahead program flow diagram ``` orange path: init I # read number green path: main loop > # go east (start of loop) : # dup input 2% # take mod 2 (get lowest bit) r # go south, then east (enter th...
(more)
over 2 years ago
Answer A: Make my value binary
[Ruby], 11 bytes ```ruby ->n{"%b"%n} ``` Simple string formatting. Try it online!
(more)
over 2 years ago
Answer A: Output 256 in many different ways
[Ruby], 7 solutions ```ruby 256 44 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------0 1...
(more)
over 2 years ago
Answer A: Make $2 + 2 = 5$
[Ruby], 23 bytes ```ruby ->a,b{a==2&&b==2?5:a+b} ``` Try it online!
(more)
over 2 years ago
Question Tips for golfing in Ruby
If you have any tips for golfing in [Ruby], share them as answers to this post.
(more)
over 2 years ago
Answer A: Roll n fair dice
[Ruby], 28 bytes ->n,m{(1..n).sum{rand(m)+1}} Try it online!
(more)
over 2 years ago
Answer A: In The Jailhouse Now
[Ruby], 53 bytes ```ruby ->n{n-=3;?β•”+?╦n+?β•—,[?β• +?╬n+?β•£,?β•š+?β•©n+?╝]} ``` Try it online!
(more)
over 2 years ago
Answer A: It's Hip to be Square
[Ruby], 16 bytes ```ruby ->n{n0.5%1==0} ``` Try it online!
(more)
over 2 years ago
Question 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. If you did, the answer would have to be flagged as "non-competing." After some time, the rule was seemi...
(more)
almost 3 years ago
Answer A: Gamer Meme Creator
[Ruby], 67 65 bytes -2 from Razetime ```ruby ->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!
(more)
almost 3 years ago
Answer A: Cumulative Counts
[Ruby], 36 bytes ```ruby ->a{i=-1;a.map{a[0..i+=1].count 1}} ``` Try it online! The code in the TIO link is 2 bytes longer because `n` block parameter names are not supported on TIO's Ruby instance yet. It will work the same, however. The code is: ```ruby ->a{i=-1;a.map{a[0..i+=1].count ...
(more)
almost 3 years ago
Answer A: Make my number a set
[Ruby], 27 bytes ```ruby ->n{x=[];n.times{xn{ } # lambda taking n x=[]; # set x to empty array n.times{ }; # repeat n times x<<x1 # append x with a copy of itself x # return x...
(more)
almost 3 years ago
Answer A: Evens or Odds - you know this one
[Ruby], 8 bytes ```ruby ->n{n%2} ``` Generic mod-in-a-lambda solution. Alternately, for 2.7+: ```ruby ->{1%2} ``` Try it online!
(more)
almost 3 years ago
Question 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 same count of each letter. If you were to make a table: ADOBE ABODE ----- ----- A: 1 ...
(more)
about 3 years ago
Article Is it a near-anagram? [FINALIZED]
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 same count of each letter. If you were to make a table: ADOBE ABODE ----- ----- A: 1 ...
(more)
about 3 years ago
Answer A: 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 " "(n-i)+?/i+?\\i # spaces plus / plus \ ...
(more)
over 3 years ago
Answer A: 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. ```ruby ->l,x{l.eachwithindex.sum{1x2}} ```
(more)
over 3 years ago
Answer A: Reverse an ASCII string
[Ahead], 3 bytes SW@ S Slurp entire input to stack W Write entire stack @ End Try it online!
(more)
over 3 years ago