havenwood changed the topic of #ruby to: Ruby 3.4.5, 3.3.8, 3.5.0-preview1 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
livoreno has joined #ruby
markong has quit [Ping timeout: 276 seconds]
brokkoli_origin has quit [Ping timeout: 252 seconds]
brokkoli_origin has joined #ruby
pastelowl has quit [Ping timeout: 252 seconds]
pastelowl has joined #ruby
TomyWork has quit [Ping timeout: 252 seconds]
livoreno has quit [Quit: Connection closed for inactivity]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
sleetdrop has quit [Quit: ZNC 1.8.2+deb2ubuntu0.1 - https://znc.in]
sleetdrop has joined #ruby
_whitelogger has joined #ruby
pastelowl has quit [Quit: WeeChat 4.6.3]
_whitelogger has joined #ruby
oznek has quit [Quit: Leaving]
joako has quit [Quit: quit]
joako has joined #ruby
jmcantrell has quit [Ping timeout: 252 seconds]
Vonter has quit [Ping timeout: 276 seconds]
Vonter has joined #ruby
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
schne1der has joined #ruby
ih8u2 has joined #ruby
ih8u has quit [Read error: Connection reset by peer]
ih8u has joined #ruby
ih8u2 has quit [Ping timeout: 272 seconds]
cappy has quit [Quit: Leaving]
<sphex_> Really wish there was a Set#sample method...
calwig has joined #ruby
victori has quit [Read error: Connection reset by peer]
victori has joined #ruby
donofrio2 has joined #ruby
donofrio has quit [Ping timeout: 272 seconds]
victori- has joined #ruby
victori has quit [Ping timeout: 260 seconds]
inline has joined #ruby
grenierm has joined #ruby
victori- has quit [Excess Flood]
victori has joined #ruby
fantazo has joined #ruby
fantazo has quit [Changing host]
fantazo has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 265 seconds]
TomyWork has joined #ruby
rvalue- is now known as rvalue
otisolsen70 has joined #ruby
victori has quit [Read error: Connection reset by peer]
victori has joined #ruby
nakilon has quit [Ping timeout: 248 seconds]
nakilon has joined #ruby
grenierm has quit [Quit: Client closed]
nakilon has quit [Ping timeout: 248 seconds]
<havenwood> sphex_: At least it's easy to implement.
<havenwood> class Set def sample(n = 1) = @hash.keys.sample(n) end
<havenwood> I agree it seems like a reasonable method to add.
calwig has quit [Quit: The world is my country, and to do good is my religion.]
markong has joined #ruby
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
otisolsen70 has quit [Quit: Leaving]
markong has quit [Ping timeout: 252 seconds]
user71 has joined #ruby
graywolf has joined #ruby
fantazo has quit [Quit: Lost terminal]
Tempesta has quit [Quit: See ya!]
markong has joined #ruby
inline has quit [Read error: Connection reset by peer]
chkhd` has quit [Quit: zzzZZZzzz]
chkhd has joined #ruby
inline has joined #ruby
<sphex_> havenwood: well, AFAIK Hash#keys is O(n), so might as well use Set#to_a there. and then it would still work with the new Set implementation in C...
sleetdro- has joined #ruby
sleetdrop has quit [Ping timeout: 265 seconds]
TomyWork has quit [Remote host closed the connection]
pastelowl has joined #ruby
markong has quit [Ping timeout: 248 seconds]
cappy has joined #ruby
olspookishmagus has quit [Server closed connection]
olspookishmagus has joined #ruby
sarna has quit [Ping timeout: 276 seconds]
sarna has joined #ruby
dannyAAM has quit [Quit: Will be back soon!]
dannyAAM has joined #ruby
<havenwood> sphex_: Moving away from the Ruby implementation, a Set#sample makes more sense — assuming you're avoiding duplicating an Array.
<havenwood> At the moment in stable Ruby the #to_a is just a single cheap method call to @hash.keys anyways.
<havenwood> I haven't looked at the core implementation closely yet to see how you're implement #sample, but makes sense. It makes sense to sample from a set, I think.
schne1der has quit [Quit: schne1der]
graywolf has quit [Quit: WeeChat 4.6.3]
pastelowl has quit [Quit: WeeChat 4.6.3]
jmcantrell has joined #ruby
pastelowl has joined #ruby
<sphex_> havenwood: yeah considering that sets are supposed to be unordered, I guess you're not supposed to try to access only the first or last or n'th element... but a random one, why not.
asio_ has quit [Server closed connection]
asio has joined #ruby
nakilon has joined #ruby
oznek has joined #ruby
oznek has quit [Client Quit]
FetidToot0 has quit [Read error: Connection reset by peer]
user71 has quit [Quit: Leaving]
FetidToot has joined #ruby
OverCoder has quit [Server closed connection]
OverCoder has joined #ruby
lucerne has quit [Server closed connection]
lucerne has joined #ruby
cappy has quit [Quit: Leaving]
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Guest8600 has left #ruby [WeeChat 4.6.3]
dviola has joined #ruby
joast has joined #ruby