00:04
MsInput has joined #ruby
00:19
hwpplayer1 has quit [Remote host closed the connection]
01:03
troojg has joined #ruby
01:41
STASIdownunder has quit [Remote host closed the connection]
01:44
MsInput has quit [Quit: WeeChat 4.6.0]
02:03
fercell has joined #ruby
02:14
rvalue has quit [Read error: Connection reset by peer]
02:14
rvalue has joined #ruby
02:33
troojg has quit [Remote host closed the connection]
02:36
Linux_Kerio has joined #ruby
02:47
cappy has quit [Quit: Leaving]
02:51
donofrio has quit [Remote host closed the connection]
05:06
grenierm has joined #ruby
05:40
jmcantrell has quit [Ping timeout: 252 seconds]
05:40
jmcantrell_ is now known as jmcantrell
05:42
__jmcantrell__ has joined #ruby
06:09
__jmcantrell__ has quit [Quit: WeeChat 4.6.1]
06:52
hwpplayer1 has joined #ruby
07:06
hwpplayer1 has quit [Remote host closed the connection]
07:07
rvalue- has joined #ruby
07:08
rvalue has quit [Ping timeout: 248 seconds]
07:14
rvalue- is now known as rvalue
07:39
STASIdownunder has joined #ruby
07:42
andy-turner has joined #ruby
07:43
fantazo has joined #ruby
07:43
andy-turner has quit [Remote host closed the connection]
07:55
STASIdownunder has quit [Ping timeout: 276 seconds]
08:59
<
nakilon >
nice, works as planned
09:05
R2 has joined #ruby
09:06
R2robot has quit [Ping timeout: 276 seconds]
09:07
<
nakilon >
I mean... not the exact... it's the thing that I call infinitely, but I need to get the caller info somehow
09:11
<
nakilon >
but if I bind to :line it will generate too much data
09:20
<
nakilon >
:line does not add a clue
09:20
R2 has quit [Ping timeout: 248 seconds]
09:20
R2robot has joined #ruby
09:42
<
nakilon >
solved, "#{cut.call caller_locations[1].path}:#{caller_locations[1].lineno} > #{tp.callee_id}"
09:42
<
nakilon >
(don't mind cut.call -- it's doing the .delete_prefix)
10:09
schne1der has joined #ruby
10:36
<
o0x1eef >
Coola boola!
11:02
jmjl has quit [Remote host closed the connection]
11:02
jmjl has joined #ruby
11:03
dviola has joined #ruby
11:09
STASIdownunder has joined #ruby
11:15
<
o0x1eef >
I agree with havenwood though, for benchmark-type stuff Process.clock_gettime is usually the better option than Time.now
11:17
STASIdownunder has quit [Read error: Connection reset by peer]
11:18
OverCoder is now known as inhehe
11:49
grenierm has quit [Ping timeout: 240 seconds]
11:57
lpapp has joined #ruby
11:59
<
lpapp >
hi, how to sort a set in ruby?
12:00
<
lpapp >
set.to_a.sort?
12:00
<
wbooze >
require 'set'
12:00
<
wbooze >
s = Set.new([11, 12, 3, 2, 4, 5, 89, 1])
12:00
<
wbooze >
sorted_s = SortedSet.new(s)
12:00
<
wbooze >
puts sorted_s.to_a # Output: [1, 2, 3, 4, 5, 11, 12, 89]
12:00
<
wbooze >
or convert it to an array
12:01
<
wbooze >
sorted_array = s.to_a.sort
12:01
<
wbooze >
puts sorted_array # Output: [1, 2, 3, 4, 5, 11, 12, 89]
12:01
<
lpapp >
thanks, is there a recommended online ruby interpreter?
12:02
<
lpapp >
to test code.
12:02
<
lpapp >
and then run it with required 'set', etc.
12:02
<
lpapp >
my colleague authored some code like foo = Set.new.sort
12:02
<
lpapp >
I wonder what foo would be in this case.
12:02
<
lpapp >
Set.new.sort looks weird
12:03
<
lpapp >
after migrating to Ruby, he changed from foo = SortedSet.new to foo = Sort.new.sort
12:03
<
lpapp >
but that does not look like a valid conversion to me.
12:03
<
lpapp >
But I am new to ruby
12:03
<
lpapp >
I am trying to debug a problem in a code that I inherited.
12:04
<
wbooze >
In Ruby, a Set does not maintain order, but you can sort it using SortedSet from the set library
12:05
<
wbooze >
aah ok, so we have a builtin ruby interpreter
12:05
<
lpapp >
I thought SortedSet was removed in Ruby 3?
12:05
<
o0x1eef >
Yep for simple stuff
12:05
<
wbooze >
oh hmmm, removed ?
12:06
<
lpapp >
Yeah, so I am wondering why my colleague moved foo = SortedSet.new to foo Set.new.sort
12:06
<
lpapp >
foo = Set.new.sort
12:06
<
wbooze >
not in stdlib anymore ok
12:06
<
wbooze >
but in sorted_set gem
12:08
<
lpapp >
yeah, but how would I sort this out with the stdlib
12:08
<
lpapp >
without an extra gem
12:08
<
lpapp >
s = Set.new | s << ... | and then s.to_a.sort?
12:08
<
wbooze >
that's maybe what your colleague showed you or tried to
12:10
<
o0x1eef >
In case you didn't know the standard library is distributed as gems and that also includes the 'set' gem:
https://stdgems.org
12:11
<
wbooze >
heh, that's so confusing
12:13
<
lpapp >
can I also use .map on an array or just set?
12:13
<
lpapp >
foo.map { | f | ... }
12:13
<
wbooze >
default/bundled/library and the stdgems is just a combination all of those
12:13
<
lpapp >
was just wondering if I could do foo.to_a.sort.map
12:15
<
o0x1eef >
I think the plus is that we can update bundled gems without waiting for a Ruby release, so their development can continue independent of language releases and development. It also puts the stdlib on an equal footing with the rest of the ecosystem, although, I always default to the stdlib.
12:15
<
o0x1eef >
>> [1,2,3].map { _1 * 2 }
12:40
<
lpapp >
apparently, Sort.new.sort creates an array.
12:48
STASIdownunder has joined #ruby
12:52
otisolsen70 has joined #ruby
13:07
gemmaro_ has quit [Ping timeout: 268 seconds]
13:08
GreenResponse has joined #ruby
13:11
020AA65J9 has joined #ruby
13:40
STASIdownunder has quit [Read error: Connection reset by peer]
13:41
STASIdownunder has joined #ruby
14:06
erdem has joined #ruby
14:08
<
leah2 >
how do i display the unpack help in ri?
14:17
mange has quit [Quit: Zzz...]
14:20
trillion_exabyte has quit [Ping timeout: 252 seconds]
14:20
user71 has joined #ruby
14:22
trillion_exabyte has joined #ruby
14:34
donofrio has joined #ruby
14:41
<
adam12 >
leah2: You're looking for the expressions?
14:42
<
adam12 >
It auto expands for me.
14:42
<
adam12 >
But funny enough, I can't see how you can get it any other way. I think you used to be able to cheat with `ri rdoc:packed_data`
14:44
<
leah2 >
that used to work but not in ruby 3.3.7
14:47
<
adam12 >
Does yours not auto-expand?
14:47
<
leah2 >
never did afaiu
14:47
<
adam12 >
ri 6.13.1 is what I am running.
14:47
<
leah2 >
idk, it's included in 3.3.7 i guess
14:50
<
adam12 >
ri ruby:packed_data
14:50
<
adam12 >
I forgot it's `rubya and not `rdoc`.
14:51
<
leah2 >
couldnt find that in my shell history, weird
14:52
<
leah2 >
meanwhile i read perldoc :D
14:54
<
adam12 >
perldoc feels way better
14:54
<
adam12 >
At least I can ask it about global variables.
15:05
donofrio has quit [Ping timeout: 248 seconds]
15:14
__jmcantrell__ has joined #ruby
15:14
jmcantrell has quit [Killed (erbium.libera.chat (Nickname regained by services))]
15:14
__jmcantrell__ is now known as jmcantrell
15:15
jmcantrell_ has joined #ruby
15:15
donofrio has joined #ruby
15:31
lpapp has left #ruby [#ruby]
15:51
donofrio has quit [Ping timeout: 260 seconds]
15:54
blacknova has joined #ruby
15:56
donofrio has joined #ruby
15:59
reset has joined #ruby
16:12
donofrio has quit [Ping timeout: 272 seconds]
16:50
fantazo has quit [Quit: Lost terminal]
17:10
otisolsen70 has quit [Quit: Leaving]
17:39
rvalue has quit [Read error: Connection reset by peer]
17:39
rvalue has joined #ruby
17:42
mweckbecker has quit [Quit: leaving]
17:44
mweckbecker has joined #ruby
17:51
ih8u has quit [Ping timeout: 265 seconds]
17:53
ih8u has joined #ruby
18:13
blacknova has quit [Quit: Connection closed for inactivity]
18:42
hwpplayer1 has joined #ruby
18:43
hwpplayer1 has quit [Remote host closed the connection]
18:55
Linux_Kerio has quit [Ping timeout: 248 seconds]
19:26
schne1der has quit [Ping timeout: 252 seconds]
19:33
___nick___ has joined #ruby
19:40
nirvdrum741 has joined #ruby
20:03
user71 has quit [Quit: Leaving]
20:04
___nick___ has quit [Ping timeout: 252 seconds]
20:10
jhass has quit [Remote host closed the connection]
20:10
jhass has joined #ruby
20:11
cappy has joined #ruby
20:11
jhass has quit [Remote host closed the connection]
20:13
jhass has joined #ruby
20:18
GreenResponse has quit [Quit: Leaving]
20:21
<
o0x1eef >
Nice adam12 !
20:27
schne1der has joined #ruby
20:29
<
adam12 >
o0x1eef: Thanks!
20:45
hwpplayer1 has joined #ruby
20:47
hwpplayer1 has quit [Remote host closed the connection]
20:51
hwpplayer1 has joined #ruby
20:53
STASIdownunder has quit [Read error: Connection reset by peer]
20:54
STASIdownunder has joined #ruby
20:54
cappy has quit [Quit: Leaving]
21:00
hwpplayer1 has quit [Remote host closed the connection]
21:41
schne1der has quit [Ping timeout: 245 seconds]
22:00
ruby[bot] has quit [Remote host closed the connection]
22:00
ruby[bot] has joined #ruby
22:05
eddof13 has joined #ruby
22:07
eddof13 has quit [Client Quit]
22:27
ollysmith_ has quit [Ping timeout: 276 seconds]
22:34
ollysmith has joined #ruby
22:52
ollysmith has joined #ruby
22:56
hwpplayer1 has joined #ruby
22:56
hwpplayer1 has quit [Remote host closed the connection]
23:29
msv has quit [Remote host closed the connection]
23:59
eddof13 has joined #ruby