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 radarekā€­

Type On... Excerpt Status Date
Edit Post #285631 Initial revision over 2 years ago
Answer A: Evens or Odds - you know this one
Ruby, 13 bytes According to the rules, programs should read from STDIN and output to the STDOUT. This is my solution: ```ruby p gets.toi&1 ``` Try this online!
(more)
over 2 years ago
Edit Post #285630 Initial revision over 2 years ago
Answer A: Weave Strings Together
Ruby, 48 45 bytes ```ruby ->w{([p].w''=/$/).zip(w.map(&:chars))''} ``` Try this online! It could be improved to 32 bytes, if every string is represented as an array of characters: ```ruby ->w{([p].w''=/$/).zip(w)''} ``` Attempt This Online!
(more)
over 2 years ago
Edit Post #285629 Initial revision over 2 years ago
Answer A: Are All Elements Equal?
Ruby, 14 bytes ```ruby ->{1|[]in[]} ``` Alternative solution: ```ruby ->a{!(a|a)[1]} ``` Try this online! Couple of other solutions I developed: ```ruby ->a{!a.uniq[1]} # 15 bytes ->{!(1|[])[1]} # 15 bytes ->a{(a|a).one?} # 15 bytes ```
(more)
over 2 years ago
Edit Post #285618 Post edited:
over 2 years ago
Edit Post #285623 Post edited:
over 2 years ago
Edit Post #285623 Post edited:
over 2 years ago
Edit Post #285623 Initial revision over 2 years ago
Answer A: Make my number a set
Ruby, 23 bytes ```ruby ->n,x{eval'xn{eval'$<<$1;'n} ``` Try this online!
(more)
over 2 years ago
Edit Post #285622 Initial revision over 2 years ago
Answer A: Coat of Many Colours
Ruby, 101 79 76 72 bytes This challenge was one of the funniest I have ever solved! 72 bytes solution (I show the solution as a Ruby string - because binary data is filtered out) ```ruby "->l{l.sortby{'d\v\x162\x82\r\x1D\nJ\"\x01T\x0E?\x8B.\x11\x05\x06G(\fM\x00 HyI'.index''<<1[2,4].sum%145}...
(more)
over 2 years ago
Edit Post #285621 Initial revision over 2 years ago
Answer A: Repeat the characters
Ruby, 23 bytes ```ruby ->{1.gsub /./,'\0'2} ``` Try this online!
(more)
over 2 years ago
Edit Post #285618 Initial revision over 2 years ago
Answer A: Write a Deadfish Interpreter
Ruby, 70 67 66 bytes ```ruby ->c{a=0;c.bytes{|b|a,=[b<106?a+b/3-34:b<112?p(a):aa,0]-[-1,256]}} ``` Test this online!
(more)
over 2 years ago
Edit Post #285611 Post edited:
over 2 years ago
Edit Post #285611 Post edited:
over 2 years ago
Edit Post #285611 Post edited:
over 2 years ago
Edit Post #285611 Initial revision over 2 years ago
Answer A: Small integer swapping
Ruby, 24 bytes ```ruby gets=/ /;puts$`,$'2+$` ``` Try this online!
(more)
over 2 years ago
Edit Post #285610 Initial revision over 2 years ago
Answer A: Word Count Tool
Ruby, 48 bytes ```ruby ->a{[a.split,b=a.chars-[$/],b-[' ']].map &:size} ``` Try this online!
(more)
over 2 years ago
Edit Post #285606 Post edited:
over 2 years ago
Edit Post #285606 Post edited:
over 2 years ago
Edit Post #285606 Initial revision over 2 years ago
Answer A: Digit Sum Integer Sequence (working title)
Ruby, 36 bytes Infinite version: ```ruby n=1;0while n+=p(n).digits.minmax.sum ``` Try this online! (program is interrupted after it reaches the 128KiB limit of output)
(more)
over 2 years ago
Edit Post #285605 Initial revision over 2 years ago
Answer A: Diagonalized alphabet
Ruby, 52 51 bytes 13.times{puts:YWUSQOMKIGECABDFHJLNPRTVXZ[12-1,14]} Attempt This Online!
(more)
over 2 years ago
Edit Post #285597 Initial revision over 2 years ago
Answer A: Word Set Square
Ruby, 70 bytes ```ruby ->s{s+=s.reverse;s[..-2].gsub(/./){t=$&+' '$.+$/;t[-2]=$&;$.+=1;t}+s} ``` Try this online!
(more)
over 2 years ago
Edit Post #285592 Post edited:
over 2 years ago
Comment Post #283012 According to the description, input is a given as a string, not a array of strings (lines) as your solution is implemented.
(more)
over 2 years ago
Edit Post #285592 Post edited:
over 2 years ago
Edit Post #285593 Initial revision over 2 years ago
Answer A: Multiply complex numbers.
Ruby, 25 bytes ```ruby ->e{e.toce[/ ./].toc} ``` Try this online!
(more)
over 2 years ago
Edit Post #285592 Post edited:
over 2 years ago
Edit Post #285592 Initial revision over 2 years ago
Answer A: Cumulative Counts
Ruby, 31 bytes ```ruby ->a{a.map{$[1]=1.+$[1]||0}} ``` Try this online! `$` is a global variable, so calling this lambda multiple times (in a single process) would give wrong result. A 32 bytes version that does not rely on a global state: ```ruby ->a,c{a.map{c[1]=1.+c[1]||0}} ``` ...
(more)
over 2 years ago
Edit Post #285588 Initial revision over 2 years ago
Answer A: Bytes to Segfault
Ruby, 14 bytes ```ruby `kill -11 #$$` ``` Try this online!
(more)
over 2 years ago
Edit Post #285519 Initial revision over 2 years ago
Answer A: Generalized Sort
Ruby, 25 bytes Credits goes to @Shaggy and his JavaScript solution. ```ruby ->a,l{l.map{a.sort! &1}} ``` Try this online! The other solution which not mutate original array
(more)
over 2 years ago
Edit Post #285512 Initial revision over 2 years ago
Answer A: Reduce over the range [1..n]
Ruby, 22 bytes ```ruby ->{(1..2).reduce &1} ``` Try this online! Without using `reduce` (28 bytes): ```ruby f=->g,n{n<2?n:g[n,f[g,n-1]]} ``` Try this online!
(more)
over 2 years ago
Comment Post #283278 Also, the solution you provided does not follow problem description. The code does not reduce 1..n (n is a parameter).
(more)
over 2 years ago
Comment Post #283278 I don't think that first code is correct. If you want to pass proc/lambda as a block to `reduce` method, then `&` is needed. ```ruby ->{_2.reduce(&_1)} ``` To make it shorter, `()` can be omitted: ```ruby ->{_2.reduce &_1} ``` [Try this online](https://ato.pxeger.com/run?1=m72kqDSpcsH...
(more)
over 2 years ago
Edit Post #285507 Post edited:
over 2 years ago
Edit Post #285507 Initial revision over 2 years ago