havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 3.3.0-preview1: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
perrierjouet has quit [Quit: WeeChat 3.8]
perrierjouet has joined #ruby
moldorcoder7 has quit [Ping timeout: 245 seconds]
Munto has joined #ruby
markong has quit [Ping timeout: 250 seconds]
gh0st6 has joined #ruby
desnudopenguino has quit [Quit: desnudopenguino]
MalusVulgaris has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 264 seconds]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 264 seconds]
caedmon has joined #ruby
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 250 seconds]
Sankalp- is now known as Sankalp
caedmon has quit [Quit: caedmon]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 246 seconds]
caedmon has joined #ruby
c10l4 has joined #ruby
caedmon has quit [Quit: caedmon]
caedmon has joined #ruby
c10l has quit [Ping timeout: 250 seconds]
c10l4 is now known as c10l
caedmon has quit [Ping timeout: 250 seconds]
Munto has quit [Quit: Leaving]
caedmon has joined #ruby
sam113101 has quit [Server closed connection]
sam113101 has joined #ruby
caedmon has quit [Ping timeout: 250 seconds]
newton has quit [Server closed connection]
newton has joined #ruby
friendlypunk has joined #ruby
qxz2 has quit [Ping timeout: 252 seconds]
Linux_Kerio has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 264 seconds]
Linux_Kerio has quit [Ping timeout: 250 seconds]
moldorcoder7 has joined #ruby
donofrio has joined #ruby
jhass has quit [Ping timeout: 245 seconds]
jhass has joined #ruby
jhass has quit [Ping timeout: 246 seconds]
jhass has joined #ruby
dTeaguela has joined #ruby
dalan03822 has joined #ruby
dalan0382 has quit [Read error: Connection reset by peer]
dalan03822 is now known as dalan0382
Linux_Kerio has joined #ruby
duderonomy has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
roadie has joined #ruby
Huckleberry777 has quit [Quit: Huckleberry777]
Sankalp has quit [Ping timeout: 264 seconds]
Huckleberry777 has joined #ruby
Sankalp has joined #ruby
MalusVulgaris has quit [Ping timeout: 245 seconds]
keypresser86 has quit []
dTeaguela is now known as CrazyEddy
crespire has joined #ruby
crespire1 has quit [Ping timeout: 246 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
joast has quit [Ping timeout: 240 seconds]
xanadu[m] has joined #ruby
caucus has joined #ruby
joast has joined #ruby
gh0st6 has quit [Quit: Connection closed for inactivity]
_ht has joined #ruby
caucus has quit [Ping timeout: 245 seconds]
idiocrash has joined #ruby
roshanavand has joined #ruby
brokkoli_origin has quit [Ping timeout: 250 seconds]
brokkoli_origin has joined #ruby
Linux_Kerio has quit [Ping timeout: 250 seconds]
Sankalp has quit [Ping timeout: 250 seconds]
roshanavand has quit [Ping timeout: 250 seconds]
moldorcoder7 has quit [Ping timeout: 250 seconds]
roshanavand has joined #ruby
Sankalp has joined #ruby
xanadu[m] has quit [Server closed connection]
Sankalp has quit [Ping timeout: 264 seconds]
peder has joined #ruby
infinityfye has joined #ruby
Sankalp has joined #ruby
CalculusCats has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
TheCatCollective has joined #ruby
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 250 seconds]
dviola has quit [Ping timeout: 246 seconds]
roshanavand_ has quit [Ping timeout: 264 seconds]
roshanavand_ has joined #ruby
Perflosopher has quit [Ping timeout: 240 seconds]
desnudopenguino has joined #ruby
Perflosopher has joined #ruby
roadie has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.92)]
TheCatCollective is now known as CalculusCats
tomtmym has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
Guest11 has joined #ruby
Guest11 has quit [Client Quit]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 245 seconds]
desnudopenguino1 is now known as desnudopenguino
con3 has quit [Server closed connection]
roshanavand_ has quit [Ping timeout: 245 seconds]
CalculusCats is now known as TheCatCollective
con3 has joined #ruby
crespire has quit [Remote host closed the connection]
crespire has joined #ruby
roshanavand_ has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 264 seconds]
caedmon has joined #ruby
xanadu[m] has joined #ruby
caedmon has quit [Ping timeout: 250 seconds]
keypresser86 has joined #ruby
roadie has joined #ruby
juuh42dias has quit [Server closed connection]
juuh42dias has joined #ruby
Linux_Kerio has joined #ruby
roshanavand_ has quit [Ping timeout: 245 seconds]
keypresser86 has quit [Ping timeout: 246 seconds]
petru has quit [Server closed connection]
petru has joined #ruby
roshanavand_ has joined #ruby
hsiktas[m] has quit [Server closed connection]
dviola has quit [Remote host closed the connection]
dviola has joined #ruby
roshanavand_ has quit [Ping timeout: 264 seconds]
<isene> I could need some intelligence; `a = [[1,2,"a,b,c",3],[4,5,"a,d,e",6],[7,8,"d,f,g",9],[1,4,"b,c,h",9]]` and `b = ["a","c"]` . I want to return only those elements of `a` (`a[2]`) that matches the elements of `b`. I.e. the first record ([1,2,"a,b,c",3],[4,5,"a,d,e",6]) is a match, but the third record ([7,8,"d,f,g",9]) is not a match. The full match would be;
<isene> [[1,2,"a,b,c",3],[4,5,"a,d,e",6],[1,4,"b,c,h",9]]) How?
___nick___ has joined #ruby
moldorcoder7 has joined #ruby
weyhmueller_ has quit [Read error: Connection reset by peer]
weyhmueller has joined #ruby
jumpy has joined #ruby
<leftylink> "only those elements of `a` that match some condition" is Enumerable#select any day of the week (AKA Enumerable#filter)
<leftylink> and in this case, the condition here can be expressed in a few ways. 1) Enumerable#any? and Array#include?
hightower2 has quit [Ping timeout: 246 seconds]
<leftylink> 2) Array#& (or Array#intersection) and Array#empty?
<leftylink> 3) Array#intersect?
<leftylink> oh but it needs to handle partial string matches, so 2) and 3) are right out the window
<leftylink> it has to be 1) but actually it becomes an Enumerable#any? containing an Enumerable#any? containing a String#include?
chalet87 has joined #ruby
jumpy has quit [Ping timeout: 250 seconds]
Liothen_ is now known as Lioithen
Lioithen is now known as Liothen
<leftylink> I apologise for initially giving wrong solutions as I had initially missed the details of the "is a match" condition
<leftylink> solutions 2) and 3) however might still be considered though, by splitting the strings inside each element of `a`. whether that split is done 1) ahead of time and stored or 2) only temporarily, during the select will depend on other constraints.
<isene> I was thinking a.map! as I would want to modify `a` to include only those that matches any elemnt of `b`...
<leftylink> that's a select! then, not a map!
<isene> OK. But this is a nesting thingie and I'm not quite sure how to nest this...
stereo35 has joined #ruby
chalet87 has quit [Ping timeout: 246 seconds]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
<isene> Got it!
___nick___ has quit [Client Quit]
<isene> `a.select!{|i| (i[2].split(",") & b).any? }`
___nick___ has joined #ruby
stereo35 has quit [Ping timeout: 240 seconds]
<leftylink> yes if you hadn't gotten it what I would have said would be
<leftylink> pandabot: bs step by step
m_antis has quit [Server closed connection]
<leftylink> very relevant in this situation, figure out the small parts of the required operation step by step and put them together
m_antis has joined #ruby
___nick___ has quit [Ping timeout: 250 seconds]
Al2O3_ has quit [Ping timeout: 245 seconds]
Al2O3 has quit [Ping timeout: 240 seconds]
dviola has quit [Quit: WeeChat 3.8]
infinityfye has quit [Quit: Leaving]
_ht has quit [Quit: _ht]
Al2O3 has joined #ruby
Sankalp has quit [Ping timeout: 264 seconds]
rdsm has quit [Server closed connection]
rdsm has joined #ruby
acosta has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 252 seconds]
desnudopenguino1 is now known as desnudopenguino
acosta has quit [Quit: The Lounge - https://thelounge.chat]
Sankalp has joined #ruby
duderonomy has joined #ruby
acosta has joined #ruby
tomtmym has quit [Quit: Gone.]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
desnudopenguino1 has joined #ruby
acosta has quit [Remote host closed the connection]
desnudopenguino has quit [Ping timeout: 240 seconds]
desnudopenguino1 is now known as desnudopenguino
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 240 seconds]
desnudopenguino1 is now known as desnudopenguino
acosta has joined #ruby
roadie has joined #ruby
Linux_Kerio has quit [Ping timeout: 264 seconds]
roadie has quit [Ping timeout: 240 seconds]
keypresser86 has joined #ruby
hightower2 has joined #ruby
roadie has joined #ruby
TheCatCollective has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
roadie has quit [Ping timeout: 240 seconds]
Munto has joined #ruby
TheCatCollective has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 240 seconds]