havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview1: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
hightower3 has quit [Read error: Connection reset by peer]
hightower3 has joined #ruby
Perflosopher has quit [Quit: Ping timeout (120 seconds)]
Perflosopher has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
konsolebox has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
konsolebox has joined #ruby
dviola has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<johnjaye> I probably don't want to know the answer
<johnjaye> but why is << overloaded to append to an array?
<johnjaye> as in x=[], x<<4 => x = [4]
<adam12> It's called the shovel operator and it does that for a bunch of different objects, not just Arrays.
<johnjaye> ok
<adam12> I'm not sure why, but it's just a protocol of some sort that was developed early on
<adam12> Why do you ask?
<johnjaye> well. it's obviously the same as bitshifting
<leftylink> just like how you `std::cout << ...` in other language
<johnjaye> yes it looks similarly awkward in c++
<johnjaye> so basically anything that is similar to a list or dictionary type can be 'shoveled'?
<adam12> Arrays, Strings, Sets, and some IO objects for sure.
<leftylink> that wouldn't make sense. how would you specify what to put in a hash with <<? you can't
<leftylink> pandabot: rb {}.respond_to?(:<<)
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
konsolebox has quit [Ping timeout: 248 seconds]
MarvelousWololo has quit [Remote host closed the connection]
MarvelousWololo has joined #ruby
<ox1eef_> h << [:foo, "bar"]
<ox1eef_> It does not work of course but within the realm of impossible.
grenierm has joined #ruby
brokkoli_orig has joined #ruby
brokkoli_origin has quit [Ping timeout: 260 seconds]
<johnjaye> i wonder how many project euler problems can be solved in one line of ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<johnjaye> ox1eef_: do you mind if I ping you
<johnjaye> some people get angry at that sort of thing
<sam113101> you can write everything in a single line
<sam113101> this ain't python
<johnjaye> i don't understand what the answer is saying or why it works. it is ( fib(n-1) + fib(n-2) 0
<johnjaye> er ). and the person asking was using arrays and combining them with +
<ox1eef_> Nope does not bother me but not much free time, and almost bed time.
<johnjaye> ok. i already solved the project euler thingie myself using a while loop
<johnjaye> but i don't understand the () syntax there
<johnjaye> is it making a hash or something. and why would that not cause a stackoverflow but the array combining does
<ox1eef_> The surrounding parenthesis are unneccessary but basically, even (((puts("hi")))) is valid.
<johnjaye> hrm. so if it's all using arrays why doesn't it stack overflow
<johnjaye> unless it does
<ox1eef_> Are we looking at the same code ? I don't see arrays but recursion.
<johnjaye> i thought it was recursively making an array
<johnjaye> as in it returns [0] or [1]
<johnjaye> then starts building it up with +
<johnjaye> hrm
<ox1eef_> The third or so answer ? I don't believe that's more straight forward. The recursing examples are typical and easier to understand.
<ox1eef_> Stick with the top answers. The rest is a bunch of bullshit.
<johnjaye> is it just the return statement that makes it work?
<ox1eef_> You gotta tell me what code you're working with. There's at least 5 variations in that post. The top answer is the typical solution for that problem.
<johnjaye> i'm looking at the top post
<johnjaye> but i don't see why it gives a SystemStackError
Vonter has quit [Ping timeout: 246 seconds]
<ox1eef_> Because it will eventually reach 0 or 1.
<ox1eef_> And then fall into the return.
<johnjaye> hmm. so the first version will start computing fibonacci of -1, -2, etc forever?
<ox1eef_> Right, does not handle negative numbers.
<johnjaye> hmm. so it would work if it was [n] if n < 2 or something like this
<johnjaye> let me see
<johnjaye> hmm that still gives a stack error. so i guess ruby simply ignores the value since there is no return keyword
<ox1eef_> The return statement stops the execution of the method, so it won't enter into another recursion.
<ox1eef_> Without the return, you'd go back into recursion, and into negative digits, then overflow the stack.
<johnjaye> ah and the return is not needed since implicitly ruby will return the last line of the statement
<johnjaye> makes sense
<ox1eef_> Right only explicit when you want a hard exit from a method, or for guards.
Linux_Kerio has joined #ruby
konsolebox has joined #ruby
mark22k has quit [Quit: The Lounge - https://thelounge.chat]
mark22k has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
johnjaye has quit [Ping timeout: 246 seconds]
johnjaye has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
konsolebox has quit [Ping timeout: 248 seconds]
jvalleroy has joined #ruby
konsolebox has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
patrick- has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
Linux_Kerio has quit [Ping timeout: 256 seconds]
patrick- has joined #ruby
gr33n7007h has quit [Quit: WeeChat 4.0.2]
victori has quit [Ping timeout: 245 seconds]
gr33n7007h has joined #ruby
jess has quit []
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
konsolebox has quit [Ping timeout: 246 seconds]
_ht has joined #ruby
konsolebox has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
graaff has quit [Quit: Leaving]
graaff has joined #ruby
shokohsc510 has quit [Ping timeout: 248 seconds]
shokohsc5109 has joined #ruby
shokohsc5109 is now known as shokohsc510
konsolebox has quit [Quit: Leaving]
gr33n7007h has quit [Ping timeout: 246 seconds]
graywolf has joined #ruby
grenierm has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
A_Noodle is now known as A_Dragon
<leftylink> you nkow what
<leftylink> it's not the worst idea in the world
<leftylink> lets make it happen huh?
<leftylink> pandabot rb using(Module.new { refine(Hash) { def <<((k, v)) self[k] = v; self end } }); {} << %i(foo bar)
<pandabot> {:foo=>:bar} - https://carc.in/#/r/fm53
<leftylink> great.
Bish has quit [Ping timeout: 256 seconds]
<leftylink> I believe this has made it chainable as well
<leftylink> pandabot rb using(Module.new { refine(Hash) { def <<((k, v)) self[k] = v; self end } }); {} << %i(foo bar) << %i(baz quuz)
<pandabot> {:foo=>:bar, :baz=>:quuz} - https://carc.in/#/r/fm54
<leftylink> I spelled quux wrong. I apologise
Bish has joined #ruby
Sankalp has joined #ruby
Starfoxxes has quit [Ping timeout: 244 seconds]
Sankalp has quit [Ping timeout: 245 seconds]
Sankalp has joined #ruby
MarvelousWololo has quit [Ping timeout: 260 seconds]
konsolebox has joined #ruby
jmjl has quit [Quit: ~nyaa]
jmjl has joined #ruby
Linux_Kerio has joined #ruby
brokkoli_orig has quit [Ping timeout: 256 seconds]
brokkoli_origin has joined #ruby
lucartc has joined #ruby
lucartc has quit [Client Quit]
lucartc has joined #ruby
lucartc has quit [Remote host closed the connection]
lucartc has joined #ruby
dviola has quit [Quit: WeeChat 4.0.2]
lucartc has quit [Quit: Leaving]
Vonter has joined #ruby
ua_ has quit [Ping timeout: 260 seconds]
shokohsc510 has quit [Ping timeout: 250 seconds]
patrick- has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
shokohsc510 has joined #ruby
egality has joined #ruby
patrick- has joined #ruby
patrick- has quit [Ping timeout: 246 seconds]
patrick- has joined #ruby
Bish has quit [Ping timeout: 245 seconds]
Bish has joined #ruby
patrick is now known as Guest2801
Guest2801 has quit [Killed (iridium.libera.chat (Nickname regained by services))]
patrick- is now known as patrick
patrick_ has joined #ruby
ua_ has joined #ruby
Bish has quit [Ping timeout: 250 seconds]
Bish has joined #ruby
willfish has joined #ruby
konsolebox has quit [Quit: Leaving]
willfish has quit [Ping timeout: 256 seconds]
<johnjaye> when was asciidoc changed to ruby?
<johnjaye> i think it must be awhile ago. the python asciidoc is totally bugged for me on msys
kaivai has quit [Ping timeout: 245 seconds]
reset has joined #ruby
kaivai has joined #ruby
<adam12> johnjaye: asciidoctor is a rewrite of the Python Asciidoc by separate people, IIRC
Vonter has quit [Read error: Connection reset by peer]
tuxcrafter has joined #ruby
Linux_Kerio has quit [Ping timeout: 260 seconds]
patrick has quit [Excess Flood]
patrick_ is now known as patrick
patrick- has joined #ruby
Linux_Kerio has joined #ruby
Bish has quit [Remote host closed the connection]
graywolf has quit [Ping timeout: 256 seconds]
graywolf has joined #ruby
Bish has joined #ruby
willfish has joined #ruby
dviola has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
<johnjaye> oh so they're like technically separate programs
janusx has joined #ruby
janusx has quit [Remote host closed the connection]
graywolf has quit [Ping timeout: 246 seconds]
victori has joined #ruby
shokohsc5105 has joined #ruby
shokohsc510 has quit [Ping timeout: 244 seconds]
shokohsc5105 is now known as shokohsc510
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #ruby
tomtmym has quit [Quit: Gone.]
MarvelousWololo has joined #ruby
_ht has quit [Quit: _ht]
brw has quit [Read error: Connection reset by peer]
brw9 has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Linux_Kerio has quit [Ping timeout: 252 seconds]
<adam12> johnjaye: Yep. And I think they've diverged a bit, too.
<willfish> has any rubyist here tried go?
<adam12> willfish: Sure. It's "ok" from my POV.
<willfish> have you used it in earnest or is this side projects and the like? I'm debating investing in learning it to improve my market options
<adam12> I've shipped a bunch of servers and some CLI tools.
<willfish> oh okay, that's in earnest
<adam12> I don't reach for it first anymore, normally doing it in Ruby first.
<willfish> I must admit I do love ruby
<adam12> Last year I rewrote a daemon I wrote in Go into Ruby, because I spent ~ 3 days trying to work around a gomodules issue with no resolve. In another 3 days I had a better tested and more functional version in Ruby.
<adam12> It will probably include your job opportunities. Or Rust, but Rust is a bigger beast to slay.
<willfish> yeah, that's pretty awesome
<adam12> Almost every project I am on involves a small Go portion to some degree. Usually remote agents performing some sort of action.
<adam12> s/include/improve. I can't type tonight, apparently.
<willfish> interesting
<willfish> I'm going to commit to learning it properly and start building some experience in it
<adam12> Two cloud platforms that involve a small Go binary for RPC actions (check load, etc). One of those I reverted back to Ruby (as mentioned above). And I wrote a restaurant order-ahead platform that used a Go microservice to spool to the kitchen printer when new orders came in.
<willfish> It feels like a decent tool to have in my repertoire
<adam12> It's a shame that Crystal didn't become more popular in this space. I can write Crystal without blinking because of it's proximity to Ruby.
<willfish> nice :)
<adam12> bbl. putting kids to bed.
<willfish> Yeah, I loved the idea of crystal
<willfish> I should go to bed. It was my daughters first birthday today and I am totally pooped
<willfish> Its 11.44 at night here
reset has quit [Quit: reset]
graywolf has joined #ruby
willfish has quit [Ping timeout: 248 seconds]
graywolf has quit [Ping timeout: 250 seconds]
xuochi has joined #ruby
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
John_Ivan has joined #ruby