00:05
cartdrige has quit [Ping timeout: 260 seconds]
00:08
mooff has quit [Remote host closed the connection]
00:09
mooff has joined #ruby
00:19
mooff has quit [Remote host closed the connection]
00:20
mooff has joined #ruby
00:23
reset has joined #ruby
00:26
Thanzex32 has quit [Ping timeout: 272 seconds]
00:37
mooff has quit [Remote host closed the connection]
00:38
mooff has joined #ruby
00:44
white_magic has quit [Quit: Client closed]
00:55
mooff has quit [Read error: Connection reset by peer]
00:56
mooff has joined #ruby
01:04
<
havenwood >
FullMetalStacker: You can `grep(5)` in place of filter and `grep_v(5)` in place of reject.
01:05
<
havenwood >
>> [1, 5, 2, 5, 5, 8].grep_v(5)
01:05
mooff has quit [Remote host closed the connection]
01:06
mooff has joined #ruby
01:15
mooff has quit [Remote host closed the connection]
01:16
mooff has joined #ruby
01:32
caedmon has joined #ruby
01:33
crankharder has quit [Ping timeout: 256 seconds]
01:33
mooff has quit [Remote host closed the connection]
01:33
caedmon has quit [Remote host closed the connection]
01:36
razetime has joined #ruby
01:41
markong has quit [Ping timeout: 246 seconds]
01:48
razetime has quit [Ping timeout: 268 seconds]
01:55
caedmon has joined #ruby
02:00
caedmon has quit [Ping timeout: 268 seconds]
02:53
Averna has joined #ruby
03:03
razetime has joined #ruby
03:04
swaggboi has quit [Quit: C-x C-c]
03:05
caedmon has joined #ruby
03:09
mohadiplama has joined #ruby
03:10
mohadiplama has quit [Client Quit]
03:15
cartdrige has joined #ruby
03:20
Fridtjof has quit [Ping timeout: 264 seconds]
03:32
FullMetalStacker has quit [Remote host closed the connection]
03:33
swaggboi has joined #ruby
03:36
Fridtjof has joined #ruby
03:45
John_Ivan has quit [Read error: Connection reset by peer]
03:45
John_Ivan has joined #ruby
03:51
caedmon has quit [Ping timeout: 256 seconds]
03:53
razetime has quit [Ping timeout: 272 seconds]
03:58
Thanzex32 has joined #ruby
04:00
Sankalp has quit [Ping timeout: 252 seconds]
04:06
swaggboi has quit [Quit: C-x C-c]
04:08
Fridtjof has quit [Ping timeout: 255 seconds]
04:16
razetime has joined #ruby
04:19
dionysus69 has quit [Ping timeout: 265 seconds]
04:22
John_Ivan has quit [Read error: Connection reset by peer]
04:22
moldorcoder7 has quit [Ping timeout: 255 seconds]
04:23
John_Ivan has joined #ruby
04:27
John_Ivan has quit [Read error: Connection reset by peer]
04:27
John_Ivan has joined #ruby
04:28
John_Ivan has quit [Read error: Connection reset by peer]
04:31
swaggboi has joined #ruby
04:37
Sankalp has joined #ruby
04:40
caedmon has joined #ruby
04:41
Sankalp has quit [Ping timeout: 260 seconds]
04:45
Sankalp has joined #ruby
04:47
plantman2 has joined #ruby
04:50
Sankalp has quit [Ping timeout: 268 seconds]
04:51
Sankalp has joined #ruby
04:55
plantman2 has quit [Ping timeout: 252 seconds]
04:56
Sankalp has quit [Ping timeout: 252 seconds]
04:56
Fridtjof has joined #ruby
05:02
hrberg has quit [Ping timeout: 255 seconds]
05:11
Sankalp has joined #ruby
05:31
leah2 has quit [Ping timeout: 255 seconds]
05:42
caedmon has quit [Ping timeout: 272 seconds]
05:48
cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
05:59
finsternis has quit [Read error: Connection reset by peer]
06:18
crankharder has joined #ruby
06:25
crankharder has quit [Ping timeout: 268 seconds]
06:56
razetime has quit [Ping timeout: 272 seconds]
07:24
crankharder has joined #ruby
07:28
crankharder has quit [Ping timeout: 260 seconds]
07:36
Linux_Kerio has joined #ruby
07:40
crankharder has joined #ruby
07:41
leonthemisfit has quit [Quit: WeeChat 3.6]
07:43
tomtmym has joined #ruby
07:43
tomtmym has quit [Changing host]
07:43
tomtmym has joined #ruby
07:45
crankharder has quit [Ping timeout: 268 seconds]
07:49
Sankalp- has joined #ruby
07:49
Sankalp has quit [Ping timeout: 272 seconds]
07:49
Sankalp- is now known as Sankalp
08:19
aeris has quit [Ping timeout: 255 seconds]
08:20
aeris has joined #ruby
08:57
_ht has joined #ruby
09:02
jvalleroy has joined #ruby
09:03
apteryx has quit [Ping timeout: 256 seconds]
09:16
apteryx has joined #ruby
09:19
leah2 has joined #ruby
09:26
bastelfreak has quit [Quit: WeeChat 3.6]
09:28
bastelfreak has joined #ruby
09:54
aeris has quit [Ping timeout: 255 seconds]
09:55
aeris has joined #ruby
10:03
yxhuvud has quit [Remote host closed the connection]
10:05
yxhuvud has joined #ruby
10:08
_ht has quit [Remote host closed the connection]
10:11
_ht has joined #ruby
10:33
FullMetalStacker has joined #ruby
10:34
<
FullMetalStacker >
@havenwood does this filter also e.g. 15, 45, 55?
10:38
<
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
10:39
<
sam113101 >
FullMetalStacker: what's the problem you're facing? I haven't been following the conversation
11:41
razetime has joined #ruby
11:52
<
gr33n7007h >
probably just #select/reject with a block containing number.to_s[/5/] idk.
11:54
razetime has quit [Remote host closed the connection]
12:18
dionysus69 has joined #ruby
12:29
markong has joined #ruby
12:48
goldfish has joined #ruby
12:51
goldfish has quit [Remote host closed the connection]
12:57
goldfish has joined #ruby
13:23
moldorcoder7 has joined #ruby
13:49
dionysus69 has quit [Ping timeout: 252 seconds]
13:54
crankharder has joined #ruby
13:56
razetime has joined #ruby
13:57
razetime has quit [Client Quit]
14:18
dionysus69 has joined #ruby
15:37
Sheilong has joined #ruby
15:43
caedmon has joined #ruby
15:47
otisolsen70 has joined #ruby
15:56
caedmon has quit [Ping timeout: 272 seconds]
16:02
cartdrige has joined #ruby
16:34
ruby_newbie has joined #ruby
16:37
ruby_newbie has quit [Client Quit]
17:13
hightower2 has joined #ruby
17:21
aeris has quit [Ping timeout: 255 seconds]
17:23
aeris has joined #ruby
18:03
Pixi has quit [Ping timeout: 272 seconds]
18:04
crankharder has quit [Ping timeout: 272 seconds]
18:19
FullMetalStacker has joined #ruby
18:20
crankharder has joined #ruby
18:21
<
FullMetalStacker >
@sam113101 this was my question:
18:21
<
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 }
18:23
markong has quit [Remote host closed the connection]
18:27
crankharder has quit [Ping timeout: 272 seconds]
18:31
<
sam113101 >
"5 containing integers" is not the same as n == 5
18:32
<
sam113101 >
but I'm afraid the answer is no
18:33
Pixi has joined #ruby
18:33
<
Rounin >
Yeah hm, even the solution on the right would not be correct if it is to match that description
18:34
leonthemisfit has joined #ruby
18:35
crankharder has joined #ruby
18:36
niv has joined #ruby
18:38
dionysus69 has quit [Ping timeout: 272 seconds]
18:40
cartdrige has quit [Ping timeout: 268 seconds]
18:51
dionysus69 has joined #ruby
18:53
ur5us has joined #ruby
18:56
Linux_Kerio has quit [Ping timeout: 255 seconds]
18:57
rvalue has quit [Read error: Connection reset by peer]
18:57
cartdrige has joined #ruby
18:57
rvalue has joined #ruby
19:01
crankharder has quit [Ping timeout: 255 seconds]
19:02
dionysus69 has quit [Ping timeout: 260 seconds]
19:05
Linux_Kerio has joined #ruby
19:14
crankharder has joined #ruby
19:16
___nick___ has joined #ruby
19:25
<
adam12 >
FullMetalStacker: [1, 5, 15, 20].reject { |n| n.digits.include?(5) }
19:25
<
adam12 >
FullMetalStacker: There is no shorthand.
19:28
<
FullMetalStacker >
super guys thank you very much for the feedback and input!
19:44
___nick___ has joined #ruby
19:45
ur5us has quit [Ping timeout: 260 seconds]
19:46
Sheilong has quit []
19:46
___nick___ has quit [Client Quit]
19:48
___nick___ has joined #ruby
20:38
ur5us has joined #ruby
20:44
<
ox1eef_ >
Other option: [1, 5, 25, 35, 36].reject { (_1 % 5).zero? }
20:55
hrberg has joined #ruby
21:04
___nick___ has quit [Ping timeout: 268 seconds]
21:10
dviola has quit [Quit: WeeChat 3.7.1]
21:11
hrberg has joined #ruby
21:13
dviola has joined #ruby
21:21
cartdrige has quit [Ping timeout: 252 seconds]
21:30
plantman2 has joined #ruby
21:30
<
gr33n7007h >
is \p{Emoji} relatively new or have i completely overlooked this, all this time
21:31
<
FullMetalStacker >
hey ox1eef_ thanks!! what is the _1 ?
21:31
FullMetalStacker has quit [Remote host closed the connection]
21:33
_ht has quit [Quit: _ht]
21:35
FullMetalStacker has joined #ruby
21:36
<
gr33n7007h >
it must be new to 3.2
21:36
<
gr33n7007h >
that's very handy to have
21:38
<
gr33n7007h >
FullMetalStacker: keep in mind that will only work for integers divisible by 5, for instance, 2852 will not work.
21:38
<
FullMetalStacker >
indeed
21:43
cartdrige has joined #ruby
22:02
dviola has quit [Quit: WeeChat 3.8]
22:04
dviola has joined #ruby
22:06
crax23 has joined #ruby
22:08
cartdrige has quit [Ping timeout: 256 seconds]
22:14
hrberg has joined #ruby
22:20
crankharder has quit [Ping timeout: 268 seconds]
22:24
FullMetalStacker has joined #ruby
22:31
<
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.
22:32
<
FullMetalStacker >
:-O wow did not even know that. thank you, @ox1eef_ !!
22:33
<
ox1eef_ >
I think a lot of long-time Ruby programmers found it weird at first (myself included), but it grew on me over time.
22:33
<
FullMetalStacker >
is it new?
22:34
<
ox1eef_ >
Since 2.7, so relatively new.
22:35
<
FullMetalStacker >
i see, nice! just to make 100% sure i understand:
22:35
<
FullMetalStacker >
are the same, and _1 is the shorthand for the n, right?
22:35
<
FullMetalStacker >
.reject { (_1 % 5).zero? }
22:35
<
FullMetalStacker >
.reject { |n| (n % 5).zero? }
22:35
<
ox1eef_ >
Yep, that's correct.
22:36
<
FullMetalStacker >
so cool. learned again something super useful! thank you!
22:37
<
FullMetalStacker >
and you can do that with multiples just counting up, right?, e.g.
22:37
<
FullMetalStacker >
.reject { (_1 % _2).zero? }
22:37
<
FullMetalStacker >
.reject { |n, m| (n % m).zero? }
22:37
joast has joined #ruby
22:38
r3m has quit [Quit: WeeChat 3.8-rc1]
22:39
r3m has joined #ruby
22:39
<
ox1eef_ >
Yep, also correct.
22:40
plantman2 has quit [Ping timeout: 246 seconds]
22:40
<
FullMetalStacker >
nice!
22:46
znpy has quit [Read error: Connection reset by peer]
22:48
znpy has joined #ruby
22:51
r3m has quit [Quit: WeeChat 3.9-dev]
22:53
r3m has joined #ruby
22:56
r3m has quit [Client Quit]
22:57
r3m has joined #ruby
23:00
ruby[bot] has quit [Remote host closed the connection]
23:00
ruby[bot] has joined #ruby
23:02
tomtmym has quit [Quit: Gone.]
23:11
crankharder has joined #ruby
23:20
Linux_Kerio has quit [Quit: Konversation terminated!]
23:20
Linux_Kerio has joined #ruby
23:25
crankharder has quit [Ping timeout: 260 seconds]
23:30
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
23:35
Al2O3_ has joined #ruby
23:37
Al2O3 has joined #ruby
23:38
FullMetalStacker has joined #ruby
23:38
Al2O3 has quit [Client Quit]
23:38
<
FullMetalStacker >
how hi would you guys guess to be the ratio of people who use ruby but NOT for rails?
23:39
Al2O3_ has quit [Client Quit]
23:40
Al2O3 has joined #ruby
23:49
goldfish has quit [Ping timeout: 264 seconds]
23:57
moldorcoder7 has quit [Ping timeout: 268 seconds]
23:59
Linux_Kerio has quit [Ping timeout: 265 seconds]