<mange>
Is there an easy way to split an array using a predicate, without losing anything? Like (1..10).to_a.split { it % 4 == 0 } but producing [[1, 2, 3], [4, 5, 6, 7], [8, 9, 10]]?
<mange>
I typed the question, but then did some more reading and came up with (1..10).to_a.chunk_while { |before, after| after % 4 != 0 }.to_a, which is fine, but slightly wordier than I'd like.
flurp has joined #ruby
cappy has joined #ruby
joako_ has quit [Quit: quit]
joako has joined #ruby
sleetdrop has quit [Quit: ZNC 1.8.2+deb2ubuntu0.1 - https://znc.in]
sleetdrop has joined #ruby
jmcantrell has joined #ruby
The_Camel has joined #ruby
FetidToot has quit [Ping timeout: 252 seconds]
ih8u2 has joined #ruby
ih8u has quit [Ping timeout: 276 seconds]
ih8u2 is now known as ih8u
brokkoli_origin has quit [Ping timeout: 252 seconds]
<mange>
Oh ho ho! That's perfect. Thank you very much!
<gr33n7007h>
np
Vonter_ has joined #ruby
Vonter has quit [Ping timeout: 240 seconds]
Vonter_ has quit [Ping timeout: 276 seconds]
Vonter has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
fantazo has quit [Quit: Lost terminal]
schne1der has joined #ruby
flurp has joined #ruby
Vonter has quit [Ping timeout: 276 seconds]
msv has quit [Quit: Leaving]
msv has joined #ruby
dionysus69 has joined #ruby
<tsujp>
I know there are caveats with Ractors at the moment (which appear to be vastly improved in upcoming 3.5) but I am really tempted to use them for (relatively) simple parallel execution of shell commands for a big speedup
<tsujp>
threads are nice but thread won't ever go multicore is my understanding, it's only single core concurrency whereas ractors will go multicore (right)
<havenwood>
tsujp: It looks like Matz wants to go straight to Ruby 4.0 this Christmas.
<havenwood>
tsujp: Yup, pretty much. The GVL prevents many but not all parallel cores for threads. The GVL is released for I/O, etc, and can be released by C-ext.
<leah2>
havenwood: he tweeted that on april 1st :>