havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.0, 3.1.3, 3.0.5, 2.7.7: 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/
cartdrige has quit [Ping timeout: 260 seconds]
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
reset has joined #ruby
Thanzex32 has quit [Ping timeout: 272 seconds]
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
white_magic has quit [Quit: Client closed]
mooff has quit [Read error: Connection reset by peer]
mooff has joined #ruby
<havenwood> FullMetalStacker: You can `grep(5)` in place of filter and `grep_v(5)` in place of reject.
<havenwood> >> [1, 5, 2, 5, 5, 8].grep_v(5)
<ruby[bot]> havenwood: # => [1, 2, 8] (https://carc.in/#/r/eedh)
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
caedmon has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
mooff has quit [Remote host closed the connection]
caedmon has quit [Remote host closed the connection]
razetime has joined #ruby
markong has quit [Ping timeout: 246 seconds]
razetime has quit [Ping timeout: 268 seconds]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 268 seconds]
Averna has joined #ruby
razetime has joined #ruby
swaggboi has quit [Quit: C-x C-c]
caedmon has joined #ruby
mohadiplama has joined #ruby
mohadiplama has quit [Client Quit]
cartdrige has joined #ruby
Fridtjof has quit [Ping timeout: 264 seconds]
FullMetalStacker has quit [Remote host closed the connection]
swaggboi has joined #ruby
Fridtjof has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
caedmon has quit [Ping timeout: 256 seconds]
razetime has quit [Ping timeout: 272 seconds]
Thanzex32 has joined #ruby
Sankalp has quit [Ping timeout: 252 seconds]
swaggboi has quit [Quit: C-x C-c]
Fridtjof has quit [Ping timeout: 255 seconds]
razetime has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
John_Ivan has quit [Read error: Connection reset by peer]
moldorcoder7 has quit [Ping timeout: 255 seconds]
John_Ivan has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
swaggboi has joined #ruby
Sankalp has joined #ruby
caedmon has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #ruby
plantman2 has joined #ruby
Sankalp has quit [Ping timeout: 268 seconds]
Sankalp has joined #ruby
plantman2 has quit [Ping timeout: 252 seconds]
Sankalp has quit [Ping timeout: 252 seconds]
Fridtjof has joined #ruby
hrberg has quit [Ping timeout: 255 seconds]
Sankalp has joined #ruby
leah2 has quit [Ping timeout: 255 seconds]
caedmon has quit [Ping timeout: 272 seconds]
cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
finsternis has quit [Read error: Connection reset by peer]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
razetime has quit [Ping timeout: 272 seconds]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
Linux_Kerio has joined #ruby
crankharder has joined #ruby
leonthemisfit has quit [Quit: WeeChat 3.6]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 272 seconds]
Sankalp- is now known as Sankalp
aeris has quit [Ping timeout: 255 seconds]
aeris has joined #ruby
_ht has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
apteryx has quit [Ping timeout: 256 seconds]
apteryx has joined #ruby
leah2 has joined #ruby
bastelfreak has quit [Quit: WeeChat 3.6]
bastelfreak has joined #ruby
aeris has quit [Ping timeout: 255 seconds]
aeris has joined #ruby
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #ruby
_ht has quit [Remote host closed the connection]
_ht has joined #ruby
FullMetalStacker has joined #ruby
<FullMetalStacker> @havenwood does this filter also e.g. 15, 45, 55?
<FullMetalStacker> just tried it out, it does not. sorry, just re-read my question and realized that i hadnt made it clear enough. i need all integers filtered that contain e.g. a 5, so also 45 or 55 or 20500 should be filtered
<sam113101> FullMetalStacker: what's the problem you're facing? I haven't been following the conversation
FullMetalStacker has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
razetime has joined #ruby
<gr33n7007h> probably just #select/reject with a block containing number.to_s[/5/] idk.
razetime has quit [Remote host closed the connection]
dionysus69 has joined #ruby
markong has joined #ruby
goldfish has joined #ruby
goldfish has quit [Remote host closed the connection]
goldfish has joined #ruby
moldorcoder7 has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
crankharder has joined #ruby
razetime has joined #ruby
razetime has quit [Client Quit]
dionysus69 has joined #ruby
Sheilong has joined #ruby
caedmon has joined #ruby
otisolsen70 has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
cartdrige has joined #ruby
ruby_newbie has joined #ruby
ruby_newbie has quit [Client Quit]
hightower2 has joined #ruby
aeris has quit [Ping timeout: 255 seconds]
aeris has joined #ruby
Pixi has quit [Ping timeout: 272 seconds]
crankharder has quit [Ping timeout: 272 seconds]
niv has quit [Quit: Powered by LunarBNC: https://LunarBNC.net]
FullMetalStacker has joined #ruby
crankharder has joined #ruby
<FullMetalStacker> @sam113101 this was my question:
<FullMetalStacker> Does anyone know if select & reject have a shorthand? I have tried out over 5 alternatives that i could come up with or chatgpt suggested but none would work. i am searching for something like .reject(&:5) to reject all 5 containing integers (5, 35, 55, etc.) instead of .reject { |n| n == 5 }
markong has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 272 seconds]
<sam113101> "5 containing integers" is not the same as n == 5
<sam113101> but I'm afraid the answer is no
Pixi has joined #ruby
<Rounin> Yeah hm, even the solution on the right would not be correct if it is to match that description
leonthemisfit has joined #ruby
crankharder has joined #ruby
niv has joined #ruby
dionysus69 has quit [Ping timeout: 272 seconds]
cartdrige has quit [Ping timeout: 268 seconds]
dionysus69 has joined #ruby
ur5us has joined #ruby
Linux_Kerio has quit [Ping timeout: 255 seconds]
rvalue has quit [Read error: Connection reset by peer]
cartdrige has joined #ruby
rvalue has joined #ruby
crankharder has quit [Ping timeout: 255 seconds]
dionysus69 has quit [Ping timeout: 260 seconds]
Linux_Kerio has joined #ruby
crankharder has joined #ruby
___nick___ has joined #ruby
<adam12> FullMetalStacker: [1, 5, 15, 20].reject { |n| n.digits.include?(5) }
<adam12> FullMetalStacker: There is no shorthand.
<FullMetalStacker> super guys thank you very much for the feedback and input!
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
Sheilong has quit []
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
ur5us has joined #ruby
<ox1eef_> Other option: [1, 5, 25, 35, 36].reject { (_1 % 5).zero? }
hrberg has joined #ruby
___nick___ has quit [Ping timeout: 268 seconds]
dviola has quit [Quit: WeeChat 3.7.1]
hrberg has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
hrberg has joined #ruby
dviola has joined #ruby
cartdrige has quit [Ping timeout: 252 seconds]
plantman2 has joined #ruby
<gr33n7007h> is \p{Emoji} relatively new or have i completely overlooked this, all this time
<FullMetalStacker> hey ox1eef_ thanks!! what is the _1 ?
FullMetalStacker has quit [Remote host closed the connection]
_ht has quit [Quit: _ht]
FullMetalStacker has joined #ruby
<gr33n7007h> it must be new to 3.2
<gr33n7007h> that's very handy to have
<gr33n7007h> FullMetalStacker: keep in mind that will only work for integers divisible by 5, for instance, 2852 will not work.
<FullMetalStacker> indeed
<gr33n7007h> 👍
FullMetalStacker has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
cartdrige has joined #ruby
dviola has quit [Quit: WeeChat 3.8]
dviola has joined #ruby
crax23 has joined #ruby
hrberg has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
cartdrige has quit [Ping timeout: 256 seconds]
hrberg has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
FullMetalStacker has joined #ruby
<ox1eef_> When you create a block, Ruby can implicitly make the parameters available as _X, where X is the number of the parameter. It is a shorthand to avoid defining all of the parameters explicitly, and especially useful when doing quick prototypes.
<FullMetalStacker> :-O wow did not even know that. thank you, @ox1eef_ !!
<ox1eef_> I think a lot of long-time Ruby programmers found it weird at first (myself included), but it grew on me over time.
<FullMetalStacker> is it new?
<ox1eef_> Since 2.7, so relatively new.
<FullMetalStacker> i see, nice! just to make 100% sure i understand:
<FullMetalStacker> are the same, and _1 is the shorthand for the n, right?
<FullMetalStacker> .reject { (_1 % 5).zero? }
<FullMetalStacker> .reject { |n| (n % 5).zero? }
<ox1eef_> Yep, that's correct.
<FullMetalStacker> so cool. learned again something super useful! thank you!
<ox1eef_> +1
<FullMetalStacker> and you can do that with multiples just counting up, right?, e.g.
<FullMetalStacker> .reject { (_1 % _2).zero? }
<FullMetalStacker> .reject { |n, m| (n % m).zero? }
joast has joined #ruby
r3m has quit [Quit: WeeChat 3.8-rc1]
r3m has joined #ruby
<ox1eef_> Yep, also correct.
plantman2 has quit [Ping timeout: 246 seconds]
<FullMetalStacker> nice!
znpy has quit [Read error: Connection reset by peer]
znpy has joined #ruby
r3m has quit [Quit: WeeChat 3.9-dev]
r3m has joined #ruby
r3m has quit [Client Quit]
r3m has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
tomtmym has quit [Quit: Gone.]
crankharder has joined #ruby
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
FullMetalStacker has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
Al2O3_ has joined #ruby
Al2O3 has joined #ruby
FullMetalStacker has joined #ruby
Al2O3 has quit [Client Quit]
<FullMetalStacker> how hi would you guys guess to be the ratio of people who use ruby but NOT for rails?
Al2O3_ has quit [Client Quit]
Al2O3 has joined #ruby
goldfish has quit [Ping timeout: 264 seconds]
moldorcoder7 has quit [Ping timeout: 268 seconds]
Linux_Kerio has quit [Ping timeout: 265 seconds]