apeiros changed the topic of #ruby-lang to: Ruby 2.2.1; 2.1.5; 2.0.0-p643: https://ruby-lang.org || Paste code on https://gist.github.com
ledestin has joined #ruby-lang
fade2000 has joined #ruby-lang
havenn has joined #ruby-lang
lytol has quit [Remote host closed the connection]
momomomomo_ has joined #ruby-lang
My_Hearing has joined #ruby-lang
_djbkd has quit [Remote host closed the connection]
momomomomo has quit [Ping timeout: 264 seconds]
momomomomo_ is now known as momomomomo
Mon_Ouie has quit [Ping timeout: 265 seconds]
havenwood has quit [Ping timeout: 272 seconds]
|jemc| has quit [Ping timeout: 255 seconds]
tris has joined #ruby-lang
Averna has joined #ruby-lang
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gwendall has quit [Remote host closed the connection]
gwendall_ has joined #ruby-lang
Kareesh has quit [Remote host closed the connection]
tris has quit [Ping timeout: 256 seconds]
momomomomo has quit [Quit: momomomomo]
tris has joined #ruby-lang
sgambino has quit [Remote host closed the connection]
JamesDH has joined #ruby-lang
mattyohe has quit [Quit: Connection closed for inactivity]
Musashi007 has quit [Quit: Musashi007]
apeiros_ has quit [Remote host closed the connection]
apeiros_ has joined #ruby-lang
ghostpl_ has joined #ruby-lang
railsz has joined #ruby-lang
Musashi007 has joined #ruby-lang
gwendall_ has quit [Remote host closed the connection]
gwendall has joined #ruby-lang
ledestin has quit [Read error: Connection reset by peer]
Asher has joined #ruby-lang
<fade2000> Is it possible to obtain the values of a method's default arguments from outside the method without resorting to parsing #source_location or using Rubinius?
stardiviner has joined #ruby-lang
<darix> fade2000: uh why?
tenderlove has quit [Quit: Leaving...]
ghostpl_ has quit [Ping timeout: 264 seconds]
Musashi007 has quit [Quit: Musashi007]
shinnya has quit [Ping timeout: 272 seconds]
<fade2000> darix: Nothing responsible, obviously.
robbyoconnor has quit [Ping timeout: 255 seconds]
Musashi007 has joined #ruby-lang
_djbkd has joined #ruby-lang
railsz has quit [Quit: Page closed]
Almotasim has joined #ruby-lang
_djbkd has quit [Remote host closed the connection]
_djbkd has joined #ruby-lang
amclain has joined #ruby-lang
Almotasim has quit [Ping timeout: 252 seconds]
stardiviner has quit [Remote host closed the connection]
JamesDH has quit [Read error: Connection reset by peer]
JamesDH has joined #ruby-lang
bruno- has quit [Ping timeout: 255 seconds]
JamesDH has quit [Read error: Connection reset by peer]
JamesDH has joined #ruby-lang
hendranata_ has joined #ruby-lang
JamesDH has quit [Read error: Connection reset by peer]
JamesDH has joined #ruby-lang
JamesDH_ has joined #ruby-lang
JamesDH has quit [Read error: Connection reset by peer]
stardiviner has joined #ruby-lang
JamesDH_ has quit [Client Quit]
Musashi007 has quit [Quit: Musashi007]
|jemc| has joined #ruby-lang
tvon has quit [Quit: leaving]
tvon has joined #ruby-lang
Respek has quit [Quit: Textual IRC Client: www.textualapp.com]
kfpratt has quit [Remote host closed the connection]
Asher has quit [Quit: Leaving.]
Musashi007 has joined #ruby-lang
kfpratt has joined #ruby-lang
hahuang65_ has joined #ruby-lang
markholmes has joined #ruby-lang
kfpratt has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
Asher has joined #ruby-lang
Musashi007 has quit [Quit: Musashi007]
<jhass> fade2000: no, that's because they're determined on method call actually iirc
Musashi007 has joined #ruby-lang
<jhass> >> class Foo; attr_accessor :a; def foo(a=@a); a; end; end; f = Foo.new; x = f.foo; f.a = :a; [x, f.foo]
<eval-in_> jhass => [nil, :a] (https://eval.in/298451)
<jhass> fade2000: ^ see?
<fade2000> jhass: Yes, I suppose that makes sense. I wonder how this behavior plays with #alias_method.
AlxAltea has joined #ruby-lang
_djbkd has quit [Remote host closed the connection]
zdennis has quit [Quit: zdennis]
<fade2000> It "feels" like it should be possible to duplicate a method and simply modify it to immediately return #local_variables and their evaluation, but I can't quite get there.
AlexAltea has quit [Ping timeout: 252 seconds]
<jhass> mmh, no I don't think it's possible, you can get hold of a copy of it, assign a new method that accepts anything to the old name and call your old copy passing on the args, but not really associate a new method body to an existing signature
zdennis has joined #ruby-lang
jgpawletko has quit [Quit: jgpawletko]
apeiros has quit [Read error: Connection reset by peer]
apeiros has joined #ruby-lang
Asher has quit [Quit: Leaving.]
caseydriscoll has quit [Remote host closed the connection]
centrx has quit [Quit: Shutting down, Please wait...]
ledestin has joined #ruby-lang
martinbmadsen has quit [Ping timeout: 245 seconds]
ghostpl_ has joined #ruby-lang
unreal_ has joined #ruby-lang
cb__ has joined #ruby-lang
cb__ has quit [Changing host]
cb__ has joined #ruby-lang
unreal has quit [Ping timeout: 252 seconds]
cb__ has quit [Remote host closed the connection]
cb_ has joined #ruby-lang
cb_ has joined #ruby-lang
ghostpl_ has quit [Ping timeout: 250 seconds]
Musashi007 has quit [Quit: Musashi007]
j4cknewt has quit [Remote host closed the connection]
perry has quit [Remote host closed the connection]
perryh has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
<fade2000> jhass: Still around?
<jhass> ask the channel, if somebody with an answer is around you'll get a response
<fade2000> Fair enough.
<fade2000> RubyVM::InstructionSequence#of(Method).to_a seems like a suitable alternative to parsing Method#source_location, only the documentation is quite sparse.
<fade2000> That is, for determining the values of a method's default arguments.
octodoodle has joined #ruby-lang
<fade2000> The information is plainly there, only the path from the labels in the "params" Hash into the array of bytecode seems strange.
ruby-lang674 has joined #ruby-lang
<ruby-lang674> Anyone recommend a GUI library for ruby?
amystephen has quit [Quit: amystephen]
mkosaki_ has quit [Quit: Leaving...]
<fade2000> >> def foo x, y = String, z = [Numeric]; end; RubyVM::InstructionSequence.of(method(:foo)).to_a
<eval-in_> fade2000 => ["YARVInstructionSequence/SimpleDataFormat", 2, 2, 1, {:arg_size=>3, :local_size=>4, :stack_max=>1}, "foo", "/tmp/execpad-782494638b7d/source-782494638b7d", "/tmp/execpad-782494638b7d/source-782494638b ... (https://eval.in/298483)
<fade2000> The labels in the params Hash seem to point to just after the relevant default argument has been encountered, and I'm not sure what to make of that.
ruby-lang674 has quit [Quit: Page closed]
nathanstitt has quit [Quit: I growing sleepy]
vozcelik has quit [Ping timeout: 246 seconds]
sc00t has joined #ruby-lang
houhoulis has joined #ruby-lang
charliesome has quit [Quit: zzz]
gwendall has quit [Remote host closed the connection]
Forgetful_Lion has joined #ruby-lang
charliesome has joined #ruby-lang
cornerman has quit [Read error: Connection reset by peer]
cornerman has joined #ruby-lang
hahuang65_ has quit [Quit: Connection closed for inactivity]
elephants has joined #ruby-lang
elephants has left #ruby-lang [#ruby-lang]
bruno- has joined #ruby-lang
cb_ has quit [Remote host closed the connection]
cb_ has joined #ruby-lang
cb_ has quit [Changing host]
cb_ has joined #ruby-lang
martinbmadsen has joined #ruby-lang
charliesome has quit [Quit: zzz]
djbkd has quit [Quit: Leaving...]
bruno- has quit [Ping timeout: 264 seconds]
zdennis has quit [Quit: zdennis]
djbkd has joined #ruby-lang
charliesome has joined #ruby-lang
kyb3r_ has joined #ruby-lang
hahuang61 has joined #ruby-lang
hahuang61 has quit [Ping timeout: 272 seconds]
ghostpl_ has joined #ruby-lang
ghostpl_ has quit [Ping timeout: 264 seconds]
lytol has joined #ruby-lang
dellavg_ has joined #ruby-lang
gwendall has joined #ruby-lang
gix has quit [Ping timeout: 250 seconds]
cb_ has quit [Remote host closed the connection]
symm- has quit [Quit: Leaving...]
gwendall has quit [Ping timeout: 272 seconds]
gix has joined #ruby-lang
cb__ has joined #ruby-lang
fujimura has joined #ruby-lang
j4cknewt has joined #ruby-lang
j4cknewt has quit [Remote host closed the connection]
markholmes is now known as markisonfire
tris has quit [Quit: Leaving]
Iskarlar has joined #ruby-lang
x44x45x41x4E has joined #ruby-lang
tris has joined #ruby-lang
Musashi007 has joined #ruby-lang
havenn has quit [Remote host closed the connection]
cb__ has quit [Remote host closed the connection]
tkuchiki has quit [Ping timeout: 256 seconds]
havenwood has joined #ruby-lang
sc00t has quit [Ping timeout: 264 seconds]
|jemc| has quit [Ping timeout: 244 seconds]
fujimura has quit [Ping timeout: 250 seconds]
dellavg_ has quit [Ping timeout: 264 seconds]
bruno- has joined #ruby-lang
robbyoconnor has joined #ruby-lang
j4cknewt has joined #ruby-lang
tkuchiki has joined #ruby-lang
Almotasim has joined #ruby-lang
bruno- has quit [Ping timeout: 265 seconds]
tkuchiki_ has joined #ruby-lang
hahuang61 has joined #ruby-lang
sc00t has joined #ruby-lang
tkuchik__ has joined #ruby-lang
tkuchiki has quit [Read error: Connection reset by peer]
boadie has joined #ruby-lang
Almotasim has quit [Ping timeout: 245 seconds]
tkuchiki_ has quit [Ping timeout: 264 seconds]
boadie has quit [Ping timeout: 256 seconds]
lytol has quit [Remote host closed the connection]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gwendall has joined #ruby-lang
lytol has joined #ruby-lang
hahuang61 has quit [Ping timeout: 252 seconds]
ghostpl_ has joined #ruby-lang
lytol has quit [Remote host closed the connection]
ghostpl_ has quit [Ping timeout: 245 seconds]
Rephiax has joined #ruby-lang
mikegman_ has joined #ruby-lang
Musashi007 has quit [Quit: Musashi007]
markisonfire has quit [Quit: So it goes.]
yfeldblum has quit [Remote host closed the connection]
octodoodle has quit [Ping timeout: 252 seconds]
x44x45x41x4E has quit [Ping timeout: 250 seconds]
JohnBat26 has joined #ruby-lang
Averna has quit [Quit: Leaving.]
My_Hearing is now known as Mon_Ouie
red_horned_rihno has joined #ruby-lang
mikegman_ has quit [Quit: Page closed]
Rephiax has quit []
Rephiax has joined #ruby-lang
charliesome has quit [Quit: zzz]
cb__ has joined #ruby-lang
cb__ has joined #ruby-lang
Bwild has quit [Remote host closed the connection]
cb__ has quit [Ping timeout: 252 seconds]
Almotasim has joined #ruby-lang
cb_ has joined #ruby-lang
cb_ has joined #ruby-lang
octodoodle has joined #ruby-lang
Rephiax has quit []
Rephiax has joined #ruby-lang
amclain has quit [Quit: Leaving]
j4cknewt has quit [Remote host closed the connection]
unreal_ has quit [Ping timeout: 264 seconds]
unreal has joined #ruby-lang
caseydriscoll has joined #ruby-lang
houhoulis has quit []
caseydriscoll has quit [Ping timeout: 265 seconds]
gix has quit [Ping timeout: 246 seconds]
houhoulis has joined #ruby-lang
caseydriscoll has joined #ruby-lang
gix has joined #ruby-lang
ghostpl_ has joined #ruby-lang
piotrj has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 250 seconds]
ayonkhan has joined #ruby-lang
ghostpl_ has quit [Ping timeout: 256 seconds]
caseydriscoll has quit [Ping timeout: 256 seconds]
j4cknewt has joined #ruby-lang
ruby-lang391 has joined #ruby-lang
<ruby-lang391> hi
relix has joined #ruby-lang
<ruby-lang391> is anyone here
<havenwood> hi
<ruby-lang391> hi
<ruby-lang391> i have a question about ruby if anyone can answer
postmodern has quit [Quit: Leaving]
<havenwood> ruby-lang391: what's the question?
<ruby-lang391> I'm wondering if there is a way to use a value in a variable as part of a path, if i'm phrasing that correctly
<havenwood> ruby-lang391: what would an example of that look like? i don't follow yet.
<fade2000> ruby-lang391: A path is essentially just a string, and Ruby's string interpolation mechanisms are very good.
<havenwood> >> File.join '/', 'usr', 'local'
<eval-in_> havenwood => "/usr/local" (https://eval.in/298549)
auzty has joined #ruby-lang
<havenwood> ruby-lang391: Maybe say more what you're meaning to do or show some psuedo-code.
<ruby-lang391> err, I'm not sure if I'm phrasing this right, but a method for this gem I'm using requires err a path I think, in the form of "//Root/ElementName"
<fade2000> ruby-lang391: That's an XPath.
<ruby-lang391> Aye, but I guess I'm asking if I can substitute a variable instead of say ElementName
apeiros_ has quit [Remote host closed the connection]
<fade2000> >> element = "body"; "//Root/#{element}"
<eval-in_> fade2000 => "//Root/body" (https://eval.in/298550)
apeiros_ has joined #ruby-lang
<ruby-lang391> aaaaahhhh thank you, I couldn't figure out the syntax
<ruby-lang391> thank you so much again
<fade2000> ruby-lang391: No worries. For reference, you can place any valid Ruby expression with the #{}.
postmodern has joined #ruby-lang
<fade2000> *within
<ruby-lang391> :D much appreciated yet again
piotrj has quit [Remote host closed the connection]
martinbmadsen has quit [Ping timeout: 264 seconds]
futilegames has joined #ruby-lang
matp has quit [Excess Flood]
strixd has joined #ruby-lang
j4cknewt has quit [Remote host closed the connection]
lytol has joined #ruby-lang
solars has joined #ruby-lang
futilegames has quit [Ping timeout: 252 seconds]
futilegames has joined #ruby-lang
Iskarlar has joined #ruby-lang
ghostpl_ has joined #ruby-lang
solars has quit [Quit: WeeChat 0.4.2]
ghostpl_ has quit [Ping timeout: 245 seconds]
solars has joined #ruby-lang
x44x45x41x4E has joined #ruby-lang
Rephiax has quit [Read error: Connection reset by peer]
kyb3r_ has quit [Read error: Connection reset by peer]
Rephiax has joined #ruby-lang
futilegames has quit [Ping timeout: 245 seconds]
futilegames has joined #ruby-lang
debnathshoham has joined #ruby-lang
Rephiax_ has joined #ruby-lang
martinbmadsen has joined #ruby-lang
Rephiax has quit [Ping timeout: 246 seconds]
yfeldblum has joined #ruby-lang
piotrj has joined #ruby-lang
yfeldblu_ has joined #ruby-lang
gwendall has quit [Remote host closed the connection]
Rephiax has joined #ruby-lang
gwendall has joined #ruby-lang
bruno- has joined #ruby-lang
gwendall_ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 240 seconds]
Rephiax_ has quit [Ping timeout: 256 seconds]
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gwendall has quit [Ping timeout: 272 seconds]
bruno- has quit [Ping timeout: 246 seconds]
cb_ has quit [Remote host closed the connection]
fusillicode1 has joined #ruby-lang
hahuang61 has joined #ruby-lang
marr has joined #ruby-lang
fusillicode has quit [Ping timeout: 264 seconds]
Vivex has quit [Read error: Connection reset by peer]
hahuang61 has quit [Ping timeout: 256 seconds]
stardiviner has quit [Ping timeout: 255 seconds]
houhoulis has quit [Remote host closed the connection]
Thecrazylumberja has quit [Quit: Leaving]
gwendall_ has quit [Remote host closed the connection]
gwendall has joined #ruby-lang
elia has joined #ruby-lang
ghostpl_ has joined #ruby-lang
auzty has quit [Ping timeout: 272 seconds]
gwendall has quit [Ping timeout: 272 seconds]
stardiviner has joined #ruby-lang
<yorickpeterse> morning children
<ndrst> good morning papa yorickpeterse
<fade2000> I can't deny the juvenile nature of my current attempt to add "real" method overloading to Ruby.
<fade2000> I keep having to remind myself why it isn't odd that nobody seems to have pursued it very far.
ghostpl_ has quit [Remote host closed the connection]
kapil___ has joined #ruby-lang
ghostpl_ has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
workmad3 has joined #ruby-lang
ghostpl_ has joined #ruby-lang
matp has joined #ruby-lang
stardiviner has quit [Quit: Weird in coding now, or make love, only two things push me away from IRC.]
Rephiax_ has joined #ruby-lang
Rephiax has quit [Ping timeout: 256 seconds]
stardiviner has joined #ruby-lang
lele|w has quit [Ping timeout: 272 seconds]
cb__ has joined #ruby-lang
<maloik> nice post yorickpeterse
lele|w has joined #ruby-lang
<maloik> not too much hate and complaining
<maloik> slightly surprised
<maloik> :P
guillaume-rb has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
Mon_Ouie has joined #ruby-lang
piotrj has quit []
<yorickpeterse> HN is going nuts though
<yorickpeterse> apparently real developers concat SQL string fragments
<maloik> yep, noticed that comment thread
<maloik> I personally haven't found any way to write queries that I like
<maloik> arel is kind of verbose and messy, squeel is hardly great
<yorickpeterse> Arel is annoying
<yorickpeterse> we had an app use it for all its serious internet queries
<yorickpeterse> moved that to Sequel too
<workmad3> maloik: do what the rest of us do then... find the way you dislike the least :P
<maloik> I am :)
<maloik> we use squeel in our primary app, tried arel in a sideproject
<maloik> I need to look at Sequel next
ghostpl_ has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
hendranata_ has quit [Quit: Leaving]
x44x45x41x4E is now known as [Away]x44x45x41x
[Away]x44x45x41x has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<maloik> yorickpeterse: are you skipping AR completely and going with sequel model? or are you using a hybrid approach somehow
reprazent has joined #ruby-lang
<maloik> (haven't really looked into it at all, other than these past 2 minutes)
ghostpl_ has quit [Remote host closed the connection]
<yorickpeterse> Our rails apps still use AR
<yorickpeterse> Everything else uses Sequel
<yorickpeterse> both Sequel::Model and the underlying query DSL
ghostpl_ has joined #ruby-lang
<maloik> so that means they probably use arel as well?
<maloik> (the rails apps)
ghostpl_ has quit [Remote host closed the connection]
<yorickpeterse> Not directly
<yorickpeterse> The Rails apps are fairly dumb, they don't really run any queries AR can't handle
x44x45x41x4E has joined #ruby-lang
x44x45x41x4E is now known as [Away]x44x45x41x
[Away]x44x45x41x is now known as x44x45x41x4E
<workmad3> yeah, ActiveRecord is in an annoying situation... its own query API (which uses Arel under the hood) is reasonably succinct for simple queries, but it's pretty limited and ends up in SQL fragments quite quickly... using Arel directly fills in the gaps but is massively more verbose and ugly
<maloik> yep
ruby-lang391 has quit [Ping timeout: 246 seconds]
arBmind has joined #ruby-lang
gwendall has joined #ruby-lang
stan has joined #ruby-lang
arBmind has quit [Ping timeout: 264 seconds]
gwendall has quit [Ping timeout: 272 seconds]
terbangventures has joined #ruby-lang
TerbangVentures_ has joined #ruby-lang
_elia has joined #ruby-lang
caseydriscoll has joined #ruby-lang
<terbangventures> Anyone interested in a new ruby gig? We're looking for a full time rubyist with a salary range from Rp. 12J - 24J. Contact me at brendan@terbang.com for further details.
TerbangVentures_ has quit [Client Quit]
symm- has joined #ruby-lang
elia has quit [Ping timeout: 244 seconds]
terbangventures has quit [Ping timeout: 246 seconds]
charliesome has joined #ruby-lang
caseydriscoll has quit [Ping timeout: 252 seconds]
caseydriscoll has joined #ruby-lang
chills42 has joined #ruby-lang
ghostpl_ has joined #ruby-lang
robbyoconnor has quit [Ping timeout: 245 seconds]
georgeous has joined #ruby-lang
gwendall has joined #ruby-lang
georgeous has quit [Client Quit]
georgeous has joined #ruby-lang
georgeous has quit [Client Quit]
georgeous has joined #ruby-lang
ghostpl_ has quit [Read error: Connection reset by peer]
ghostpl_ has joined #ruby-lang
x44x45x41x4E has quit [Remote host closed the connection]
x44x45x41x4E has joined #ruby-lang
chills42 has quit [Remote host closed the connection]
chills42 has joined #ruby-lang
intinig has joined #ruby-lang
tkuchik__ has quit [Ping timeout: 245 seconds]
yfeldblu_ has quit [Ping timeout: 265 seconds]
boadie has joined #ruby-lang
bruno- has joined #ruby-lang
boadie has quit [Ping timeout: 256 seconds]
bruno- has quit [Ping timeout: 256 seconds]
ldnunes has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
ghostpl_ has joined #ruby-lang
guillaume-rb has quit [Quit: guillaume-rb]
b_hoffman has joined #ruby-lang
guillaume-rb has joined #ruby-lang
jgpawletko has joined #ruby-lang
dmr8 has joined #ruby-lang
jgpawletko has quit [Client Quit]
j4cknewt has joined #ruby-lang
fujimura has joined #ruby-lang
sc00t_ has joined #ruby-lang
sc00t has quit [Ping timeout: 244 seconds]
iamninja has quit [Read error: Connection reset by peer]
iamninja has joined #ruby-lang
x44x45x41x4E has quit [Quit: Textual IRC Client: www.textualapp.com]
chinmay_dd has joined #ruby-lang
ayonkhan has quit [Quit: (null)]
fujimura has quit [Remote host closed the connection]
chinmay_dd has quit [Remote host closed the connection]
ruby-lang406 has joined #ruby-lang
ruby-lang406 is now known as Ono-Sendai
<Ono-Sendai> I'm getting a 'NameError: uninitialized constant Socket::INET' error on windows, any idea why that would happen?
kapil___ has quit [Quit: Connection closed for inactivity]
<jhass> Ono-Sendai: because that constant doesn't exist
<jhass> did you mean AF_INET ?
<Ono-Sendai> maybe. Am going of the documentation here: http://ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/Socket.html
<Ono-Sendai> Guess the documentation is wrong
<jhass> 19>> Socket::INET
<eval-in_> jhass => uninitialized constant Socket (NameError) ... (https://eval.in/298674)
<jhass> 19>> require "socket"; Socket::INET
<eval-in_> jhass => uninitialized constant Socket::INET (NameError) ... (https://eval.in/298676)
MXfive has joined #ruby-lang
<jhass> mh, yeah
<jhass> Ono-Sendai: http://ruby-doc.org/stdlib-2.2.1/libdoc/socket/rdoc/Socket.html it's fixed in the latest docs
<jhass> don't use 1.9 anymore, it's EOL
ghostpl_ has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
ghostpl_ has joined #ruby-lang
itsraining has joined #ruby-lang
ecnalyr has joined #ruby-lang
itsraining has quit [Client Quit]
charliesome has quit [Quit: zzz]
MXfive has quit [Quit: Textual IRC Client: www.textualapp.com]
chills42 has quit [Remote host closed the connection]
chills42 has joined #ruby-lang
cb__ has quit [Remote host closed the connection]
JohnBat26 has quit [Ping timeout: 250 seconds]
caseydriscoll has quit [Remote host closed the connection]
amystephen has joined #ruby-lang
sarkyniin has joined #ruby-lang
sgambino has joined #ruby-lang
malconis has joined #ruby-lang
joast has quit [Ping timeout: 244 seconds]
lektrik has joined #ruby-lang
dmr8 has quit [Quit: Leaving]
b_hoffman has quit [Quit: b_hoffman]
bruno- has joined #ruby-lang
tsou has joined #ruby-lang
boadie has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
b_hoffman has joined #ruby-lang
tkuchiki has joined #ruby-lang
stamina has joined #ruby-lang
boadie has quit [Ping timeout: 252 seconds]
boadie has joined #ruby-lang
boadie has quit [Remote host closed the connection]
boadie has joined #ruby-lang
Almotasim has quit [Remote host closed the connection]
shinnya has joined #ruby-lang
joast has joined #ruby-lang
georgeous has quit [Remote host closed the connection]
georgeous has joined #ruby-lang
Rephiax has joined #ruby-lang
j4cknewt has quit [Remote host closed the connection]
j4cknewt has joined #ruby-lang
j4cknewt has quit [Client Quit]
lele|w has quit [Ping timeout: 272 seconds]
boadie has quit [Ping timeout: 256 seconds]
Vivex has joined #ruby-lang
lele|w has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
georgeous has quit [Ping timeout: 250 seconds]
stardiviner has quit [Remote host closed the connection]
Rephiax_ has quit [Ping timeout: 240 seconds]
tkuchiki has joined #ruby-lang
Almotasim has joined #ruby-lang
charliesome has joined #ruby-lang
<headius> yorickpeterse: I spent some time this weekend on oga perf
tkuchiki has quit [Ping timeout: 250 seconds]
<headius> biggest win seems to be getting rid of the array of args passed back out to the generated parser
<headius> I was going to try to get the method bodies to generate with the right number of args
<headius> var0, var1 rather than requiring an array
Forgetful_Lion has quit [Remote host closed the connection]
apt-get_ has joined #ruby-lang
sarkyniin has quit [Ping timeout: 244 seconds]
<headius> that array was by far the heaviest-hit allocation, and I think we can eliminate it
tsou has quit [Ping timeout: 256 seconds]
Rephiax__ has joined #ruby-lang
Miphix has joined #ruby-lang
zdennis has joined #ruby-lang
enebo has joined #ruby-lang
futilegames_ has joined #ruby-lang
<yorickpeterse> headius: that doesn't work for MRI
Rephiax has quit [Ping timeout: 246 seconds]
<yorickpeterse> well, that actually doesn't work for all I think
<headius> why wouldn't it?
<yorickpeterse> since it would require specifying literal argument numbers in the C/Java code
futilegames has quit [Ping timeout: 245 seconds]
futilegames_ is now known as futilegames
<yorickpeterse> e.g. in C rb_funcall uses varargs
<yorickpeterse> So you have to do something like
<yorickpeterse> rb_funcall(self, rb_intern("..."), 2, arg1, arg2)
<yorickpeterse> Since argument counts can be variable that doesn't work, so I have to resort to doing this:
charliesome has quit [Quit: zzz]
<yorickpeterse> rb_funcall(self, rb_intern("send"), 1, array_of_ruby_args)
<headius> you're saying there's no way to just call a method with a C array of args?
fujimura has joined #ruby-lang
<yorickpeterse> not that I know of
<yorickpeterse> I know JRuby has it, which is what I already use
<headius> you allocate an array for JRuby too
tsou has joined #ruby-lang
georgeous has joined #ruby-lang
tsou has left #ruby-lang [#ruby-lang]
<yorickpeterse> eh wait, are we talking about Oga or ruby-ll?
<headius> ruby-ll
<yorickpeterse> Ah
<yorickpeterse> Ah yes
<yorickpeterse> I use IRubyObject[]
octodoodle has quit [Quit: Textual IRC Client: www.textualapp.com]
<yorickpeterse> But that's not an actual Ruby Array right?
<yorickpeterse> That's just a Java Array of IRubyObject instances
<headius> am I on the wrong branch? I see RubyArray action_args = self.runtime.newArray();
<yorickpeterse> oh derp
<yorickpeterse> I see it
<yorickpeterse> Yeah I just noticed that
<yorickpeterse> heh
<yorickpeterse> hm, I wonder why I did that
<headius> my first pass moved the array creation into Ruby as var*
<headius> oddly enough that was 15% faster than creating it blind
<yorickpeterse> So yeah, I think https://github.com/YorickPeterse/ruby-ll/blob/master/ext/java/org/libll/Driver.java#L195 can just be another IRubyObject[]
<headius> i.e. the native code just dispatches however many args and lets the Ruby side arrayify it
<headius> so then the next step was getting the generated bodies to receive the right number of args
<headius> to eliminate all (or most) allocation dispatching from native to ruby
caseydriscoll has joined #ruby-lang
<yorickpeterse> well, it's basically a "feature" for them to have a single "val" argument
<headius> it's an expensive feature :-)
setanta_ has joined #ruby-lang
<yorickpeterse> well yeah, but the alternative would either be to use "arg1", "arg2", etc _or_ use named captures
<yorickpeterse> The latter is not available yet
<yorickpeterse> and syntax wise I'm not sure yet on how to add it
<yorickpeterse> I'm not much of a fan of what Bison does ($$1, $$2, etc)
<headius> I understand...but this array was the lions share of allocation for the benchmarks
<headius> also some optional args you initialize to empty hash
<yorickpeterse> I know, I just can't think of any sane alternative from the top of my head
<headius> hmm
<yorickpeterse> keyword args would be an option, but then it would be 2.0+, plus you'd have to give everything in your grammar a named capture
<headius> I did try to reuse the array object but there were weird side effects
<yorickpeterse> euh, the one used for arguments?
<headius> yes
<yorickpeterse> You can only re-use it if you call Array#clear after every callback
<headius> of course, that's what I did
<yorickpeterse> since the callback itself doesn't clear it
<yorickpeterse> ah
<yorickpeterse> An option would be to use placeholders and then behind the scenes "link" that to the physical arguments
<yorickpeterse> but then you get stuff like $$1, $$2, etc
<yorickpeterse> which is just as ugly as arg1, arg2, arg3, ...
<headius> var[0] isn't much different than var1
<yorickpeterse> No, but it does allow you to do something like....
<yorickpeterse> (the splat)
<yorickpeterse> hm wait, separate args would still allow that
<headius> yeah, that's just *var3
<headius> val3 whatever
momomomomo has joined #ruby-lang
caseydriscoll has quit [Remote host closed the connection]
<yorickpeterse> thinking of it, splitting it into separate arguments at least in Ruby (and in the code generator) is the easy part
<yorickpeterse> I just wonder if MRI allows rb_funcall to take a C array
<headius> if nothing else you could build a va_list yourself
<headius> but there must be a way to call with an array somewhere
zdennis has quit [Quit: zdennis]
chills42 has quit [Remote host closed the connection]
<headius> rb_funcallv?
<headius> VALUE rb_funcallv(VALUE, ID, int, const VALUE*);
<headius> seems good
JohnBat26 has joined #ruby-lang
<yorickpeterse> hmmm
<headius> that's funcall2, unsure which is official
<yorickpeterse> heh
<yorickpeterse> I'll pop open a ticket, otherwise I'll forget
<headius> what this will enable in JRuby, at least, is overloaded calling that doesn't allocate for < 3 args
<headius> <=
<headius> so you'll get dispatch back to Ruby with no alloc overhead...should help a lot
kfpratt has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
sc00t_ has quit [Ping timeout: 256 seconds]
nathanstitt has joined #ruby-lang
caseydriscoll has joined #ruby-lang
Rephiax has joined #ruby-lang
<headius> nice
<headius> I will include an alloc profile with top ten or so items
<yorickpeterse> Probably I'll just bump to 2.0 if this works out, I doubt compiling val[0] to arg1 is going to be anything but confusing
<yorickpeterse> (or arg0, heh)
Rephiax__ has quit [Ping timeout: 245 seconds]
<headius> yeah, and I you don't really have many dependent parsers out there, do you?
<yorickpeterse> No, just my own stuff atm
<yorickpeterse> and there I can just to a find/replace
whippythellama has joined #ruby-lang
Rephiax has quit []
<headius> yorickpeterse: the lock you allocate shows up as #10 in this aloc profile, btw
<yorickpeterse> How much time does that relate to?
<headius> that's really hard to determine, but during the short time I profiled the parser bench it allocated >100k of them
jo__ has joined #ruby-lang
<headius> a very partial run of the 10k xml bench
<yorickpeterse> Well yeah, it occurs for every Text instance
<headius> er, 10MB
<yorickpeterse> but if it's only 0,000001s of the total time it's not really worth the effort of finding a suitable alterantive
<yorickpeterse> * alternative
<headius> the time it takes is going to vary greatly on GC load, memory pipeline, memory subsystem, OS, hardware
<yorickpeterse> I'm all for nuking it, I'd love to, but I can't think of any thread-safe alternative
<yorickpeterse> other than saying "lol just don't share this between threads"
<headius> I'm still not clear why my example wasn't threadsafe
<yorickpeterse> (which is actually also a valid answer btw, I just need to document it)
<yorickpeterse> headius: so say you have this: https://gist.github.com/YorickPeterse/66904256e0266ab63d00
<yorickpeterse> (if I'm following you correctly)
<headius> sure
<yorickpeterse> If thread 1 writes, thread 2 reads, thread 2 might end up returning nil
<headius> you'd want to write it correctly
<headius> :-)
<yorickpeterse> Granted, I'm very tempted to just say "don't share Text instances between threads"
<yorickpeterse> since other structures don't allow that either anyway
<headius> if !@text && raw = @raw
<headius> bit more logic to avoid double reading the var
<headius> but basically that
havenwood has joined #ruby-lang
<headius> I can come up with the full body if you like
<yorickpeterse> No, I think I'll go with the option of "not my problem" and tell people not to share it between threads
<headius> that sounds good to me too
mattyohe has joined #ruby-lang
<yorickpeterse> stuff such as XML::NodeSet isn't thread-safe either
<yorickpeterse> and that's used everywhere
<headius> we can make it safer if you have a concern, but it most definitelty does NOT need a lock to do it
georgeous has quit [Remote host closed the connection]
<yorickpeterse> ideally it would all be atomic without requiring any locking, but then I might as well order myself an actual unicorn
georgeous has joined #ruby-lang
jgpawletko has joined #ruby-lang
georgeous has quit [Ping timeout: 264 seconds]
chills42 has joined #ruby-lang
cmckni3_ has quit [Quit: Textual IRC Client: www.textualapp.com]
banister has joined #ruby-lang
<headius> yorickpeterse: why does it need to be atomic?
<headius> I mean, sure, ideally...but it doesn't really need it
<headius> and if you wanted it to be atomic you could...but atomic doesn't mean it wouldn't decode more than once
<yorickpeterse> headius: atomic as in: "Yes you can share and modify documents/elements between threads"
<headius> hmm, atomic means "in one CPU operation" to me
<yorickpeterse> euh, I always confuse them
<yorickpeterse> thread-safe, lets keep it at that
<headius> sure
<headius> I'm willing to help make it thread-safe but I don't see that you need either locks OR atomic operations to do it here
red_horned_rihno has quit [Ping timeout: 250 seconds]
<momomomomo> atomic operations require locking
<momomomomo> for most of our discussion purposes, at least
<headius> momomomomo: atomic operations do not require locking
<headius> all modern CPUs have atomic operations at hardware level
<momomomomo> headius: “for most of our discussion purposes, at least"
<yorickpeterse> momomomomo: a CAS operation is atomic, doesn't require locking as far as I know
<momomomomo> that guy’s not going to write a compare-and-swap
<headius> I disagree :-) they're completly different things
<headius> and there's Ruby APIs that provide CAS
<headius> that's what you'd use here
<momomomomo> yes by all means, go down to that low level if you’d like
<momomomomo> or, just use a simple mutex
<bougyman> /2/3
<headius> momomomomo: a mutex is much heavier than cas
<headius> and will become a bottleneck under concurrent load
<momomomomo> headius: what I’m getting to is YAGNI
<yorickpeterse> momomomomo: and this is why we can't have nice things
<momomomomo> yorickpeterse: YAGNI my friend
<headius> what I'm getting to is that you ARE going to need it
<momomomomo> eh, in many situations, you’ll find that you won’t
<headius> most of the time when we get a concurrency bottleneck reported to us it's due to using a lock where an atomic operation will do
<momomomomo> right, but for a small script, like reading a couple things on threads, is it necessary to start there?
<headius> this is not for a small script
<momomomomo> didn’t read that way to me, so my mistake
<headius> in any case atomic operations and locks are orthogonal
<momomomomo> well a lock can be used to implement atomic operations
<momomomomo> or to have atomicity
<headius> and vice versa
lektrik has quit [Ping timeout: 255 seconds]
<momomomomo> headius: I'm willing to help make it thread-safe but I don't see that you need either locks OR atomic operations to do it here
<momomomomo> that was a quote
<momomomomo> from you, a page up
<headius> so?
<headius> two different tools for improving thread safety
<headius> there's also queues, sempahores, futures, promises
<headius> just listing them doesn't make them equivalent
<headius> I'm not sure what we're actually arguing about at this point
<momomomomo> nothing, I’m just muddying the waters now; locks are something that can be used to create an atomic operation - it’s not an OR
<momomomomo> but yes.. carry on - my apologies for just shitting on that conversation
<headius> no problem, good to clarify things
<headius> and yes, I'd just use a mutex in a small script :-)
lektrik has joined #ruby-lang
georgeous has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
momomomomo has joined #ruby-lang
momomomomo has quit [Client Quit]
fusillicode1 has quit [Quit: Leaving.]
fusillicode has joined #ruby-lang
chinmay_dd has joined #ruby-lang
havenn has joined #ruby-lang
havenwood has quit [Ping timeout: 264 seconds]
arBmind has joined #ruby-lang
nertzy has joined #ruby-lang
Almotasim has quit []
georgeous has quit [Read error: Connection reset by peer]
georgeou_ has joined #ruby-lang
lytol has quit [Ping timeout: 265 seconds]
<yorickpeterse> Engrish check: is "for a decrease of X" actually valid queen's English?
<yorickpeterse> having doubts, it sounds broken
|jemc| has joined #ruby-lang
<workmad3> yorickpeterse: I think it depends on 'X', but I can't think of a case where it doesn't sound a bit stilted... maybe 'to decrease X' or 'for a decrease in X'
fusillicode1 has joined #ruby-lang
<yorickpeterse> well, something like "for a decrease of the rating"
* yorickpeterse is counting 4 nested describe's here
<yorickpeterse> :D
<yorickpeterse> I'll just go with "for a reduction ..."
<workmad3> for a rating decrease or for a rating reduction would both work there
fusillicode has quit [Ping timeout: 256 seconds]
<yorickpeterse> " ReportsDaemon::GroupMethods#gei_for_month_difference with previous and current GEI data for an increase returns the difference as a positive Float"
<yorickpeterse> dat description
<headius> yorickpeterse: in English that would be considered a passive phrase, less clear than a direct one
<yorickpeterse> hm
<headius> well maybe
<headius> yeah the phrasing in that specdoc seems fine
<workmad3> yeah, seems fine for a specdoc
toretore has quit [Quit: This computer has gone to sleep]
<yorickpeterse> seems a few years of writing specs for Ruby at least taught me to write semi decent spec descriptions :P
shinnya has quit [Ping timeout: 265 seconds]
<workmad3> yorickpeterse: personally, I read each nested context as a heading, rather than assembling the full path into a single sentence
<workmad3> yorickpeterse: kinda like how the '-fd' formatter prints them out :)
<yorickpeterse> oh yeah, I read them as both basically
<yorickpeterse> but I try to write them in a way that it makes sense when reading the whole description
chills42 has quit [Remote host closed the connection]
<yorickpeterse> Hm, I now have some code here that thinks going from 0 to 50 is an increase of 0%
<yorickpeterse> but going from 50 to 0 is a decrease of 100%
<yorickpeterse> makes sense
gwendall has quit [Remote host closed the connection]
arBmind1 has joined #ruby-lang
arBmind has quit [Ping timeout: 264 seconds]
chills42 has joined #ruby-lang
Ono-Sendai has quit [Ping timeout: 246 seconds]
lele|w has quit [Ping timeout: 272 seconds]
lele|w has joined #ruby-lang
the_real_intinig has joined #ruby-lang
intinig has quit [Read error: Connection reset by peer]
solars has quit [Ping timeout: 272 seconds]
georgeou_ has quit [Remote host closed the connection]
linoespinoza has joined #ruby-lang
georgeous has joined #ruby-lang
<yorickpeterse> omg
gwendall has joined #ruby-lang
<yorickpeterse> I actually have a use case for monads
<yorickpeterse> well, the Option/Maybe monad to be exact
<yorickpeterse> e.g. for stuff like some_array[0]['some_hash_key']
<yorickpeterse> some_array.get(0) { |val| val['some_hash_key'] }.or_else(0)
* yorickpeterse runs while the OO vs functional discussion starts
georgeous has quit [Read error: No route to host]
<yorickpeterse> the alternative would be some_array[0] ? some_array[0]['some_hash_key'] : 0
georgeous has joined #ruby-lang
chills42 has quit [Remote host closed the connection]
allolex____ has quit [Ping timeout: 265 seconds]
AckZ has quit [Ping timeout: 265 seconds]
bb010g has quit [Ping timeout: 265 seconds]
ramblinpeck_ has quit [Ping timeout: 265 seconds]
mjc_ has quit [Ping timeout: 265 seconds]
djinni`_ has quit [Ping timeout: 265 seconds]
mistym has quit [Ping timeout: 265 seconds]
NameNotFound has quit [Ping timeout: 265 seconds]
faye_pdx has quit [Ping timeout: 265 seconds]
adambeynon has quit [Ping timeout: 265 seconds]
dlackty__ has quit [Ping timeout: 265 seconds]
NameNotFound has joined #ruby-lang
djinni` has joined #ruby-lang
gwendall has quit [Read error: Connection reset by peer]
gwendall has joined #ruby-lang
faye_pdx has joined #ruby-lang
hahuang61 has joined #ruby-lang
linoespinoza has quit [Quit: Textual IRC Client: www.textualapp.com]
mistym has joined #ruby-lang
ecnalyr has quit [Ping timeout: 244 seconds]
adambeynon has joined #ruby-lang
georgeous has quit []
bb010g has joined #ruby-lang
allolex____ has joined #ruby-lang
ramblinpeck_ has joined #ruby-lang
gwendall has quit [Read error: Connection reset by peer]
dlackty__ has joined #ruby-lang
gwendall_ has joined #ruby-lang
mjc_ has joined #ruby-lang
gwendall has joined #ruby-lang
AckZ has joined #ruby-lang
hahuang61 has quit [Ping timeout: 272 seconds]
fusillicode1 has quit [Quit: Leaving.]
fusillicode1 has joined #ruby-lang
<headius> yorickpeterse: Groovy has a feature where you can chain calls that might return null, and the first to do so just causes the whole expression to be null
<headius> I hate it personally, but it would work here
<|jemc|> Myco has a "void" immediate value that is distinct from nil/null and it behaves this same way
<headius> some_array.get(0)?.get(0)
<|jemc|> ha, that's very close to the myco syntax :)
<|jemc|> some_array.get(0).?get(0)
<darix> wasnt there a .try or so in activesupport/rails for this?
gwendall_ has quit [Ping timeout: 272 seconds]
<headius> yeah I think so
<|jemc|> myco also has a '??' logical operator that evaluates the right hand side if the left hand side is nil
<headius> you could always just do some_array[0][0] rescue 0 :-D
<headius> if you want hard a slap across the face, that is
<|jemc|> some_array.get(0).?get(0) ?? some_default_value
<|jemc|> err - if the left hand side is void, I mean
<headius> |jemc|: that's the "elvis operator" in groovy
<headius> foo.bar ?: baz
chills42 has joined #ruby-lang
<headius> |jemc|: what is void versus nil/null?
<|jemc|> headius: void always behaves this way of 'consuming' method calls to no effect
<yorickpeterse> meh, in case of Ruby you can just patch NilClass#method_missing to always return another nil
<yorickpeterse> but then probably everything explodes
<|jemc|> that is, any method sent to void (other than a few core methods) will return void, with no side effects
<headius> yorickpeterse: I hate that for the same reason I hate "try" and ?.
<headius> it leads to even more propgation of nulls
tvon_ has joined #ruby-lang
<headius> and far away from the original code
<yorickpeterse> well yeah, ActiveSupport's try is painful
<|jemc|> so that your chain with "aborts" can be longer, but with distinct points of possible abortion
<yorickpeterse> x.try(:y).try(:z).try(:pain)
<|jemc|> foo.bar.?baz.x.?y.z
<yorickpeterse> that's equally ugly
<|jemc|> if the baz call fails, the entire right hand side is ignored, but if the baz call succeeds, the x call must also succeed or you throw an exception
<yorickpeterse> in fact, it looks like somebody tried to use Vim for the first time
<headius> |jemc|: so it's basically nil with all messages returning nil, no?
tvon_ has quit [Client Quit]
<|jemc|> headius: yeah, but it's other purpose is for implementing the ternary choice operator as two binary operations
<|jemc|> cond &? value_when_truthy ?? value_when_falsey
<|jemc|> but this only works right if you know that value_when_truthy can never return void
lytol has joined #ruby-lang
lele|w has quit [Ping timeout: 272 seconds]
<|jemc|> so in practice, you must always end a 'voidable' chain with a default value using '??'
<|jemc|> foo.bar.?baz.x.?y.z ?? default_value
<headius> |jemc|: ok
<headius> that addresses part of my concern
<headius> seems like a dreadful idea to leave that last void/null to just fall off the expression
<|jemc|> basically, I see it as a nicer way than peppering my code with respond_to? checks all over the place
lele|w has joined #ruby-lang
<|jemc|> yeah, dreadful indeed
tohsig has joined #ruby-lang
cornerma1 has joined #ruby-lang
<|jemc|> the 'all-consuming' void/null is a scary thing, but if used responsibly I think it can make some nicely readable branching cases
ecnalyr has joined #ruby-lang
<headius> I will reserve judgment :-)
<headius> I can understand the utility of it
<|jemc|> which is indeed your right :)
cornerman has quit [Ping timeout: 255 seconds]
cornerma1 is now known as cornerman
<yorickpeterse> darn it, all these monad gems go full on functional on your face
lytol has quit [Ping timeout: 244 seconds]
sc00t has joined #ruby-lang
piotrj has joined #ruby-lang
<yorickpeterse> https://eval.in/298766 there we go
<yorickpeterse> am I now part of the cool (functional (programming)) club?
<yorickpeterse> granted I don't really need to muck with Object for this
<darix> yorickpeterse: make a gem out of it!
<yorickpeterse> prrft, not another one
strixd has quit [Quit: 500]
<yorickpeterse> also first need to spar with my colleagues about the syntax
<yorickpeterse> because I'm not sure how much they'll hate me for this
<darix> yorickpeterse: if they only hate you for this, you are golden. ;)
<yorickpeterse> pretty sure they hate me for a lot more
lytol has joined #ruby-lang
wallerdev has joined #ruby-lang
matp has quit [Remote host closed the connection]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
piotrj has quit [Remote host closed the connection]
<yorickpeterse> https://eval.in/298773 hihi, now I might be taking it a bit too far
gwendall has quit [Remote host closed the connection]
guillaume-rb has quit [Quit: guillaume-rb]
gwendall has joined #ruby-lang
ruby-lang987 has joined #ruby-lang
<ruby-lang987> Hello, I have this in ruby :time => row['sent_dt'], my question is.. is there a way you can apply a date format to that in the same line ?
matp has joined #ruby-lang
_djbkd has joined #ruby-lang
cb__ has joined #ruby-lang
cb__ has joined #ruby-lang
smoitra has joined #ruby-lang
the_real_intinig has quit [Read error: Connection reset by peer]
intinig has joined #ruby-lang
AugustoCesar has joined #ruby-lang
<smoitra> Hello I am willing to participate in gsoc 2015 I have visited the ideas page and I am interested in working in bundler
<pipework> There's a #bundler channel I believe.
_elia has quit [Quit: Computer has gone to sleep.]
rippa has joined #ruby-lang
elia has joined #ruby-lang
elia has quit [Client Quit]
ruby-lang987 has quit [Ping timeout: 246 seconds]
tcopeland has joined #ruby-lang
tcopeland has quit [Client Quit]
Voker57 has joined #ruby-lang
apt-get_ has quit [Ping timeout: 250 seconds]
lytol has quit [Remote host closed the connection]
lytol has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
dzejrou has joined #ruby-lang
jefus has quit [Quit: WeeChat 1.1.1]
arBmind1 has quit [Quit: Leaving.]
waxjar has joined #ruby-lang
b_hoffman has quit [Quit: b_hoffman]
jefus has joined #ruby-lang
toretore has joined #ruby-lang
stamina has quit [Remote host closed the connection]
havenn has quit [Remote host closed the connection]
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
ecnalyr has quit [Quit: Macbook has gone to sleep. . .]
stan has quit [Ping timeout: 256 seconds]
smoitra has quit [Ping timeout: 252 seconds]
smoitra has joined #ruby-lang
debnathshoham has quit [Quit: Connection closed for inactivity]
fujimura has quit [Ping timeout: 256 seconds]
smoitra has quit [Quit: Leaving]
cb__ has quit [Remote host closed the connection]
rapofran has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
workmad3 has quit [Ping timeout: 252 seconds]
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
arBmind has joined #ruby-lang
sc00t has quit [Ping timeout: 264 seconds]
sarkyniin has joined #ruby-lang
joaomdmoura has joined #ruby-lang
fujimura has quit [Ping timeout: 256 seconds]
intinig has quit [Remote host closed the connection]
ItSANgo has quit [Quit: Leaving...]
lytol has quit [Remote host closed the connection]
kadoppe has quit [Ping timeout: 255 seconds]
kadoppe has joined #ruby-lang
fujimura has joined #ruby-lang
tenderlove has joined #ruby-lang
fusillicode1 has quit [Quit: Leaving.]
arBmind has quit [Read error: Connection reset by peer]
fusillicode has joined #ruby-lang
hahuang61 has joined #ruby-lang
arBmind has joined #ruby-lang
relix has joined #ruby-lang
dzejrou has quit [Read error: Connection reset by peer]
elia has joined #ruby-lang
Rayford has joined #ruby-lang
dellavg_ has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
ghostpl_ has joined #ruby-lang
Sgeo_ has joined #ruby-lang
caseydriscoll has quit [Remote host closed the connection]
fujimura has quit [Ping timeout: 256 seconds]
Sgeo has quit [Ping timeout: 240 seconds]
Rayford has quit [Quit: Rayford]
chills42 has quit [Remote host closed the connection]
nwhirschfeld has quit [Ping timeout: 252 seconds]
fujimura has joined #ruby-lang
chills42 has joined #ruby-lang
nwhirschfeld has joined #ruby-lang
yfeldblum has joined #ruby-lang
Guest60 has joined #ruby-lang
postmodern has quit [Quit: Leaving]
Liothen has joined #ruby-lang
guillaume-rb has joined #ruby-lang
dzejrou has joined #ruby-lang
tvon has quit [Quit: leaving]
lytol has joined #ruby-lang
chinmay_dd has quit [Quit: Leaving]
jmrepetti has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
cb_ has joined #ruby-lang
cb_ has joined #ruby-lang
tvon has joined #ruby-lang
_djbkd has quit [Remote host closed the connection]
gwendall has quit [Remote host closed the connection]
_djbkd has joined #ruby-lang
joaomdmoura has quit [Remote host closed the connection]
b_hoffman has joined #ruby-lang
postmodern has joined #ruby-lang
chills42 has quit [Remote host closed the connection]
chills42 has joined #ruby-lang
rapofran has left #ruby-lang [#ruby-lang]
Sgeo has joined #ruby-lang
wallerdev has joined #ruby-lang
Sgeo__ has joined #ruby-lang
Sgeo_ has quit [Ping timeout: 244 seconds]
Rephiax has joined #ruby-lang
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
Sgeo has quit [Ping timeout: 244 seconds]
chills42 has quit [Remote host closed the connection]
skade has joined #ruby-lang
b_hoffman has quit [Quit: b_hoffman]
relix has quit [Quit: Textual IRC Client: www.textualapp.com]
Rephiax has quit [Ping timeout: 244 seconds]
piotrj has joined #ruby-lang
caseydriscoll has joined #ruby-lang
iliketurtles has joined #ruby-lang
Torrieri has quit [Quit: Be back later ...]
HakN99 has joined #ruby-lang
Sgeo has joined #ruby-lang
unreal_ has joined #ruby-lang
joaomdmoura has joined #ruby-lang
Sgeo__ has quit [Ping timeout: 244 seconds]
monochromaticzeb has joined #ruby-lang
dzejrou has quit [Ping timeout: 250 seconds]
unreal has quit [Ping timeout: 272 seconds]
<monochromaticzeb> hello
HakN99 has quit [Quit: Peace!]
nwhirschfeld has quit [Remote host closed the connection]
<monochromaticzeb> I am trying to "require 'pry'", but I get : `require': cannot load such file -- pry
<monochromaticzeb> if i do the same with irb, it requires it
<monochromaticzeb> what is the problem here?
nwhirschfeld has joined #ruby-lang
havenwood has joined #ruby-lang
<monochromaticzeb> anyone?
<fade2000> monochromaticzeb: Do you, erm, have pry installed?
<monochromaticzeb> gem install pry, says gem installed
<monochromaticzeb> it is inside a docker container
<monochromaticzeb> as root
b_hoffman has joined #ruby-lang
<fade2000> Then it's certainly the case that your path setup has somehow gone wonky.
sgambino has quit [Remote host closed the connection]
DCameronMauch has joined #ruby-lang
<DCameronMauch> hello
<DCameronMauch> got a question
<DCameronMauch> is there a way to do array.select, but batching X elements at a time?
<DCameronMauch> like each_slice
<DCameronMauch> which by the way seems to always return nil
gwendall has joined #ruby-lang
<Senjai> of course it returns nil
<Senjai> >> (1..100).each {|x|}
<eval-in_> Senjai => 1..100 (https://eval.in/298833)
<Senjai> Or at least I thought it would
wallerdev has quit [Quit: wallerdev]
<DCameronMauch> (1..100).each{|x| x} return 1..100
wallerdev has joined #ruby-lang
<Senjai> You shouldn't have to worry about the return value
<Senjai> its not map
<DCameronMauch> but I actually need the return value
<Senjai> a = (1..100)
<Senjai> a.each { do things}
<Senjai> a
<Senjai> ^
<DCameronMauch> a doesn't change
<Senjai> correct
<Senjai> it doesnt change with each_slice either
<DCameronMauch> the point is, I am trying to do the same thing as each_slice, but with select, like a select_slice
<DCameronMauch> I want to filter out elements of an array, based on some logic, but batched
gwendall has quit [Ping timeout: 246 seconds]
<Senjai> >> b = []; (1..100).each_slice(2) { |slice| b << slice }
<eval-in_> Senjai => nil (https://eval.in/298834)
<Senjai> >> b = []; (1..100).each_slice(2) { |slice| b << slice }; b
<eval-in_> Senjai => [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], ... (https://eval.in/298835)
monochromaticzeb has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<Senjai> DCameronMauch: ^
<DCameronMauch> I was hoping to do it in a more functional style, but yeah, I guess that will work
<Senjai> You dont want to be modifying the original array
<Senjai> Just copy it
<Senjai> unless theres a reason you have to mutate it
<DCameronMauch> no
<DCameronMauch> this is part of a chain of functional methods - I didn't want to have to use a variable in the middle
<DCameronMauch> but like I said, can't think of another way
<Senjai> >> (1..100).combination(2)
<eval-in_> Senjai => undefined method `combination' for 1..100:Range (NoMethodError) ... (https://eval.in/298837)
<Senjai> >> (1..100).to_a.combination(2)
<eval-in_> Senjai => #<Enumerator: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ... (https://eval.in/298839)
<Senjai> >> (1..100).to_a.combination(2).to_a
<eval-in_> Senjai => [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [1, 24], [ ... (https://eval.in/298840)
<Senjai> DCameronMauch: ^
<Senjai> Derp
<Senjai> nvm
<Senjai> >> (1..100).each_slice(2).to_a
<eval-in_> Senjai => [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20], [21, 22], [23, 24], [25, 26], [27, 28], [29, 30], [31, 32], [33, 34], [35, 36], [37, 38], [39, 40], [41, 42], ... (https://eval.in/298841)
<Senjai> DCameronMauch: ^
<DCameronMauch> oh, wow, didn't know that was a thing
<Senjai> >> (1..100).each_slice(2)
<eval-in_> Senjai => #<Enumerator: 1..100:each_slice(2)> (https://eval.in/298843)
<Senjai> If you call each or any enumerable method
<Senjai> you get back an Enumerator class
<Senjai> Which has its own methods
<eam> is anyone familiar with the incremental gc in 2.2? I'm trying to better understand when the gc will interrupt user code and vice versa
<DCameronMauch> yeah, that works - thanks!
DCameronMauch has quit [Quit: Leaving...]
akkad has quit [Excess Flood]
<Senjai> eam: It will interrupt whenever it pleases
<Senjai> You can force it with GC.start
<Senjai> but dont try to plan around it
<Senjai> it's a lost cause
<eam> well so, I'm pretty sure I have a case of IO objects invoking a double close, one from #close and one from the finalizer
<eam> trying to track down this bug
<eam> it only occurs in 2.2
_djbkd has quit [Remote host closed the connection]
akkad has joined #ruby-lang
<|jemc|> eam: undefine your finalizer as part of your #close
<eam> the second close runs concurrently (one thread) and ends up closing the fd allocated to a new IO object
<Senjai> ^
<Senjai> The GC can close it
<eam> |jemc|: I shouldn't have to do that though, right?
<eam> if the gc may call a second close on any IO object that's a bug
<Senjai> code?
Guest60 has quit [Quit: Textual IRC Client: www.textualapp.com]
_djbkd has joined #ruby-lang
<eam> so, here's the problem - it exhibits in a huge rspec that takes about 5 minutes to run, which I can't share
<|jemc|> eam: ah, I didn't get that when you said 'IO object' you were meaning 'instance of IO'
<eam> |jemc|: yes sorry
<|jemc|> not your fault - just misread ir
<|jemc|> *it
<eam> I'm assuming it's a race, and I have some percentage chance of hitting it when the GC runs in this particular code block
<eam> the actual code is pretty simple: File.open { regex it for something}
aayush has joined #ruby-lang
<Senjai> eam: If you cant show your code, we cant help you
<Senjai> Go hire someone :)
<eam> one thread - and with strace I can very clearly see a close(15); open()=15; close(15);
AugustoCesar has quit [Remote host closed the connection]
<eam> Senjai: sorry, I'm not asking for help - I want to fix ruby
<Senjai> eam: 99.9% sure the problem isn't ruby
<|jemc|> eam: try rbx :)
<eam> the workaround is super easy -- but this is a bug and I'm trying to learn about the gc here
<|jemc|> eam: we want to fix ruby too :)
<eam> a double close should be impossible, yes?
<eam> save tricky stuff like #fileno which I'm not doing
<Senjai> I
<Senjai> I'm not going to try to guess at your problem
<Senjai> because I cant see the code
<Senjai> Which is fine
<Senjai> but It's a waste of time for me to try to probe you about information you cant give me
<eam> sure, so I have an abstract question about GC granularity
<Senjai> Write a regression spec
<Senjai> test it
aayush has quit [Client Quit]
<eam> specifically I'm wondering about rb_postponed_job_flush()
<eam> and how jobs are queued and processed from it
<eam> that appears to be where the error stems from
Sgeo_ has joined #ruby-lang
<eam> Senjai: I have that
* Senjai shrugs
<eam> and I can definitively fix this by running 2.1.5
<Senjai> Write code that reproduces the error
<Senjai> and submit a bug report
<Senjai> And then we can help you
<eam> well, I don't have a simplified case yet
<Senjai> That'd be step 1
<|jemc|> eam: for fun, you can try setting $DEBUG = true in ruby
<eam> well, step 0 is going to be understanding the gc interaction so I can write the code
<|jemc|> to see if you can see exceptions raised from within finalizers
<eam> |jemc|: what I did was instrument fptr_finalize() and grab the stack with backtrace()
<eam> so I have a pretty clear idea of what ruby is doing
<eam> I can share that if it'd help
<Senjai> eam: You could also attach gdb and watch what ruby does
<|jemc|> I'm not too familiar with the MRI C internals - I try to stay away from them by using rbx :)
Sgeo has quit [Ping timeout: 244 seconds]
<|jemc|> my thought was that you could see if there is an "IOError: closed stream" happening in the finalizer
<eam> Senjai: did that too. The two sequential close() calls on the same fd are from rb_io_close() then rb_io_fptr_finalize() by way of rb_postponed_job_flush()
<Senjai> *shrug*
RobertBi_ has joined #ruby-lang
<Senjai> I'm going to say the same thing, I cant really infer anything, until I see how this is happening
lapide_viridi has joined #ruby-lang
<eam> I was hoping to understand rb_postponed_job_flush(), since it appears a finalizer is going into there then running later -- after an open() has re-used the descriptor
<eam> or perhaps #close itself is being preempted by the gc
<|jemc|> eam: are you using any C exts here?
<eam> I'm almost sure of it, though none are being invoked where this fails
setanta_ has quit [Quit: Leaving]
<eam> about 139 gems in this project
<eam> it's a very old/huge rails project
<|jemc|> well, unless your C exts are misbehaving in some way, it definitely sounds like an MRI bug (based on your description)
<eam> kinda hoping for some guidance in pulling apart the internals. in the meantime I'm RTFS'ing but :)
<Senjai> eam: Have you looked at a diff between ruby versions
<Senjai> if you know one works and one doesn't
<eam> yeah, at a high level using rvm I see the problem occurs in 2.2 -- and I know the incremental gc went in at that time
b_hoffman has quit [Quit: b_hoffman]
cb_ has quit [Remote host closed the connection]
<Senjai> How are you handling your IO in ruby
<Senjai> See, we always just get back to this
<Senjai> You shouldn't need an ensure
<Senjai> or the like
<eam> ok so, I can share the block it blows up in: https://gist.github.com/eam/fcf1af5f902ef4856e0b
<Senjai> in ruby
<eam> but, running this block in isolation in a loop doesn't appear to trigger the bug
<yorickpeterse> Hm, I just had a wonderful idea: transpile Ruby source code into the corresponding MRI C extension or JRuby Java extension code
relix has joined #ruby-lang
<yorickpeterse> so you can write your native extension in Ruby :D
<headius> that was one goal of Mirah
<Senjai> eam: consider anything like https://gist.github.com/eam/fcf1af5f902ef4856e0b
<headius> a Ruby-like language that compiled to something native and static
<Senjai> yorickpeterse: lolol
<yorickpeterse> headius: oh?
<Senjai> sounds fun
<eam> Senjai: yeah I can work around it pretty easily
<yorickpeterse> well, in this case it would basically be coffeescript
<eam> File.read() is fine, for example
<Senjai> eam: I would do something along those lines
<headius> Mirah was once called "the Coffeescript of Java"
<yorickpeterse> I can actually see this being useful for my own stuff
<yorickpeterse> heh
<eam> Senjai: I did -- my project isn't stuck
<eam> I'm trying to fix the underlying error now :)
<headius> it's very hard to turn idiomatic Ruby code into any statically-typed code
<Senjai> ^
<yorickpeterse> oh, it would be a strict subset
<yorickpeterse> e.g. you wouldn't be able to go around compiling ActiveSupport into C
<yorickpeterse> although mapping Ruby source code to MRI source code isn't super hard
<yorickpeterse> (just a lot to map)
piotrj has quit [Remote host closed the connection]
<|jemc|> yorickpeterse: if you just map your ruby to corresponding MRI CAPI calls, you may not get a big performance edge though
<headius> ahh sure, if you just wanted the equivalent C/Java that wouldn't be hard
<headius> that could actually just be a new backend for our existing compiler
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Volsus has joined #ruby-lang
<yorickpeterse> |jemc|: well not entirely, you would have the option to use native types
<yorickpeterse> e.g. `int[]` would translate to `int[]` in both C and Java
<yorickpeterse> (and not a VALUE in MRI)
<yorickpeterse> but `x = []` would basically be `VALUE x = rb_ary_new();` and `RubyArray x = runtime.newArray()` or w/e it was on JRuby
amystephe has joined #ruby-lang
ldnunes has quit [Quit: Leaving]
<yorickpeterse> although I'd have to pop in some custom stuff so you could, for example, use kvec for dynamic arrays on C and ArrayList on Java
<yorickpeterse> but either way, it's just an idea
<yorickpeterse> first I have to fix 128310923 other Gems
<|jemc|> yorickpeterse: yeah, there's a lot of interesting work to be done with using an anything-goes language like ruby to compile to a stricter language - I'm working on some C and BEAM code generation stuff in Myco
<|jemc|> it's a field that really interests me
Asher has joined #ruby-lang
piotrj has joined #ruby-lang
<yorickpeterse> I'm crazy enough that I'll probably do it at some point
<yorickpeterse> depends on how much longer I can stand writing stuff in C and Java at the same time
caseydriscoll has quit [Remote host closed the connection]
amystephen has quit [Ping timeout: 252 seconds]
<|jemc|> in my opinion the nifty direction to go is not using a ruby-like language to generate an MRI CAPI C-ext, but using a ruby-like language to generate standalone C libs plus FFI bindings plus FFI binding wrappers that let you seamlessly use those compiled objects in the host language
<|jemc|> with "FFI binding wrappers" meaning objects that make hide the C calls and let you work in an OO way at the high level
lektrik has quit [Quit: Leaving]
<headius> |jemc|: that also exists already
<headius> wmeissner wrote a possible C API replacement that basically just used plain C and FFI
<headius> he ported a couple simple exts to it as a proof of concept
cb__ has joined #ruby-lang
cb__ has joined #ruby-lang
<yorickpeterse> well ideally we could just write Ruby and have it be fast enough across all platforms, but that will be a while
<Senjai> moar power
<headius> hopefully no more than another year :-)
<|jemc|> headius: cool to know about, but my scope is a little more broad I think - and I want it to be a first-class part of Myco
<headius> |jemc|: having explicit native support as a first-class part would be nice
lapide_viridi has quit [Quit: Leaving]
<|jemc|> ideally, my goal is that you could port individual classes to the C-like subset one-by-one as needed
<|jemc|> with the idea being that you still prototype with the full anything-goes language feature set, and gradually add constraints (and corresponding optimizations) as needed
<|jemc|> that's the kind of development workflow I want to move toward
dagda1 has joined #ruby-lang
<headius> |jemc|: I've played with gradual typing a bit in Mirah, but only in the way that C#'s dynamic type works
<headius> but you can mix dynamic and static and dial that knob either way if you so desire
Sgeo has joined #ruby-lang
cb__ has quit [Ping timeout: 246 seconds]
gwendall has joined #ruby-lang
cb_ has joined #ruby-lang
cb_ has quit [Changing host]
cb_ has joined #ruby-lang
Sgeo_ has quit [Ping timeout: 244 seconds]
jmrepetti has quit [Remote host closed the connection]
lytol has quit [Remote host closed the connection]
Respek has joined #ruby-lang
<|jemc|> yeah, I think that having your language be able to adapt and adjustably and gradually constrain as your code matures is "the way forward" if we don't want to give up our productivity-oriented languages
mikecmpbll has joined #ruby-lang
<|jemc|> I personally like the saying "make it work, make it right, then make it fast"; languages like Ruby have a lower ceiling for how 'right' or how 'fast' you can get, but languages like Rust basically make you do all three at once from the start
piotrj has quit [Ping timeout: 244 seconds]
<|jemc|> my needs from a language when I'm just starting a project are radically different from when I'm working with a mature, API-fixed, stable code base - and the language I use should have facilities for helping me at each stage of that process
unreal has joined #ruby-lang
piotrj has joined #ruby-lang
unreal_ has quit [Ping timeout: 256 seconds]
_djbkd has quit [Remote host closed the connection]
sarkyniin has quit [Remote host closed the connection]
<headius> |jemc|: I'll have to take a look at myco a bit more
_djbkd has joined #ruby-lang
<headius> too bad it's not available on JVM though :-\
|jemc| has quit [Quit: WeeChat 1.1.1]
atmosfeer has joined #ruby-lang
piotrj has quit [Remote host closed the connection]
<atmosfeer> Hey. I'm a Danish dude doing an intensive ruby course in Paris, and I've come across a problem about recursive methods I just can't wrap my head around. Does anybody want to help?
joaomdmoura has quit [Remote host closed the connection]
_djbkd has quit [Remote host closed the connection]
skade has quit [Quit: Textual IRC Client: www.textualapp.com]
_djbkd has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
|jemc| has joined #ruby-lang
piotrj has joined #ruby-lang
<|jemc|> headius: after I've stabilized some of the core stuff I'd be willing to take a look at what would be necessary for JVM support
<|jemc|> at this immature, experimental phase though, generating two different kinds of bytecode would just slow me down :)
<|jemc|> also, I'm using some non-bytecode rubinius-specific features I would need to find analogs for
guillaume-rb has quit [Quit: guillaume-rb]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cb_ has quit [Remote host closed the connection]
<|jemc|> anyway, I'm hoping to write some docs soon - after I finish replacing the kpeg-generated parser with my pegleromyces-generated one
piotrj has quit [Remote host closed the connection]
<apeiros_> atmosfeer: your chances for somebody to help you increase significantly by asking an actual question
<|jemc|> I just converted all the *.rb files related to the AST to *.my files this week, and removed the dependency on rubinius-ast
guillaume-rb has joined #ruby-lang
guillaume-rb has quit [Client Quit]
<|jemc|> so lots of fun bootstrapping stuff going on :)
<headius> |jemc|: I'm curious what those features are
<headius> I suppose you are depending on rbx internal classes
<|jemc|> yeah, a lot of it is stuff like Rubinius::VariableScope and Rubinius::ConstantScope
<headius> ahh right
<|jemc|> to introspect about various stuff not accessible from plain ruby
<atmosfeer> Alright. So I need to write a recursive method with arguments (min, max) to find the sum of all integers between them including min and max. I can't find good documentation on how to write recursive method. How do I do this? This is my day 3 of coding so I might sound retarded.
<headius> atmosfeer: it's just a method that calls itself
iliketurtles has quit [Quit: zzzzz…..]
<|jemc|> atmosfeer: is this a homework thing or is there some other reason it explicitly needs to be recursive?
<atmosfeer> <|jemc|> hw thing
<|jemc|> ah okay; because you can do what you described without using real recursion
rbowlby has joined #ruby-lang
<atmosfeer> Sure, I would know how to do that no problem
<|jemc|> so, as headius said, it can be a method that calls itself, or it can also be a proc/lambda that calls itself
whippythellama has quit [Quit: whippythellama]
riotjones has joined #ruby-lang
<atmosfeer> Yes but how do I return the sum from the method without declaring a sum variable inside?
<|jemc|> the biggest thing to worry about is thinking about your terminating condition: how does it know when to not call itself and return some other value?
<Senjai> atmosfeer: If you're using recursion, the argument being passed into the function is your sum variable
<Senjai> atmosfeer: But it sounds like you should probably be looking at a range
<Senjai> Wont give you the answer though xD
enebo has quit [Quit: enebo]
<atmosfeer> Can I paste code in here or is it going to be horrible?
<apeiros_> atmosfeer: gist.github.com
riotjon__ has quit [Ping timeout: 265 seconds]
<atmosfeer> Sure, that's fine. I just want advice not the answer...
<atmosfeer> Here's what I got so far, I think I have a way to terminate the loop, I'm just not sure how to add the numbers up before I go into the next loop
crdpink has quit [Quit: q term]
<atmosfeer> It's supposed to return - 1 if min > max
<|jemc|> atmosfeer: typically how this is done, is your summing is part of your return expression
<apeiros_> atmosfeer: what's the sum of all integers between min and max when min == max?
<|jemc|> atmosfeer: ie, you return `(something) + recursive_call(something, something)`
havenwood has quit [Remote host closed the connection]
<|jemc|> except in your terminating condition, where you return some number that can be added to as the stack unwinds
crdpink has joined #ruby-lang
<|jemc|> it's also worth noting that unless your ruby implementation supports tail call optimization (TCO), this is a dangerous way to perform this task because if min and max are far enough apart, you will run out of available stack as the stack grows
malconis has quit [Remote host closed the connection]
[H]unt3r has joined #ruby-lang
<atmosfeer> Hmmm so the sum is part of the return line?
<|jemc|> atmosfeer: usually
symm- has quit [Ping timeout: 255 seconds]
<atmosfeer> This is just to learn how recursion works, the values it is tested at is (1..100)
<|jemc|> sure, I get it, but while you're learning, a little extra knowledge is nice :)
havenwood has joined #ruby-lang
<|jemc|> but if you think about it, because your toplevel call must return the sum, all 'inner' calls must also be returning sums
symm- has joined #ruby-lang
<atmosfeer> OK, so basically I need 3 return lines
<atmosfeer> One if min > max
<atmosfeer> One if min == max
Torrieri has joined #ruby-lang
<Senjai> I love it when people SAY they're asking HW questions, and dont want people to just solve it for them
<Senjai> #faithrestoredinhumanity
Torrieri has quit [Client Quit]
<atmosfeer> Oh dude I've been doing this for 14.5 hours today, I'm not about to let some strangers run with all the glory
<|jemc|> as apeiros_ was hinting at, you need to make sure you get your return value right when min == max
<|jemc|> your terminating case
iliketurtles has joined #ruby-lang
Torrieri has joined #ruby-lang
Torrieri has quit [Changing host]
Torrieri has joined #ruby-lang
<Senjai> I dont think you want to return nil if min == max
<atmosfeer> No, which is what it's doing now
<Senjai> What is the sum of all integers between 5 and 5?
<atmosfeer> 10
<Senjai> No
<Senjai> There are no integers between 5 and 5
<Senjai> so the sum is zero
<atmosfeer> 0?
<apeiros_> Senjai: no
<atmosfeer> Ah ok, sure
<Senjai> apeiros_: ?
<apeiros_> unless his thingy is exclusive
futilegames has quit [Quit: futilegames]
<apeiros_> 5..5 is the set {5}
<Senjai> Fair
<Senjai> Right
<Senjai> If your set is exclusive
<Senjai> I had assumed it was
<Senjai> because of the use of the word between
<apeiros_> yeah, english (and german) is not specific about "between"
<Senjai> e.g. 5...5
<atmosfeer> So, min and max are part of the sum, so (5,5) should give me 10 I think
<Senjai> Right
<apeiros_> no
<apeiros_> 5
<atmosfeer> (5,6) 11 and (5,7) 18
Torrieri has quit [Ping timeout: 265 seconds]
<Senjai> If the min and max are the same
<Senjai> the sum should be 5
<Senjai> If it's inclusive
Rephiax has joined #ruby-lang
<atmosfeer> OK
<Senjai> return min if min == max
<Senjai> for example
<Senjai> The last part that comes after is the trickiest part for you
<Senjai> let me know if you need help understanding it
<atmosfeer> but the way I see it, the only two values that are carried over each time are min and max, and I can't mess with those two except by increments of 1 to get closer to the terminating condition
<atmosfeer> Or is the return value of each instance of the method a third variable that I fail to see how I will make increment?
lytol has joined #ruby-lang
<Senjai> atmosfeer: What should you be returning from this function?
<Senjai> Each time you call it, your re calling it with max as max -1
<atmosfeer> a number, the total sum
<atmosfeer> Yes, so I should add max to the return each time
<atmosfeer> but I can't return += max can I?
<Senjai> :)
<Senjai> think about it
<Senjai> for sum_recursion(5,7)
<Senjai> max is 7
<Senjai> it is called next time with 5,6
<Senjai> max is 6
<Senjai> You want to add 6 to 7 to keep track of the sum
<atmosfeer> yes
<Senjai> As you go along
<Senjai> How do you do that?
<atmosfeer> See that's where I really, really want a 3rd variable
<Senjai> Thinking too hard
<Senjai> I'm going to tell you what it is
<Senjai> and you're going to laugh for it being so easy
<fade2000> Senjai: Don't.
<fade2000> You don't fully understand the problem yourself.
<Senjai> Okay then
<atmosfeer> I'm sorry, it's quarter to midnight my ruby day started at 9AM
<Senjai> fade2000: ?
<fade2000> Senjai: It should be called next time with (6, 6), not (5, 6).
<Senjai> fade2000: No
<fade2000> You want to perform twice as many computations for... giggles?
<Senjai> What?
<Senjai> fade2000: see pm
jmrepetti has joined #ruby-lang
<atmosfeer> I don't care about optimisation, right now I just need to understand recursion on a basic level
Rephiax__ has joined #ruby-lang
<Senjai> atmosfeer: for sum_recursion(5,7) you want to return 7 + 6 + 5 right? Assuming you're decrementing max instead of incrementing min
<atmosfeer> Yes
<Senjai> So right now you're jkust returning sum_recursion(min, max-1)
<Senjai> What's missing?
<Senjai> At that time, you're just going to be returning 5
<atmosfeer> I'm missing the current max stored somewhere
<atmosfeer> that I'll pile on to each time the method goes through an instance
<apeiros_> stored in max, not somewhere ;-)
<atmosfeer> But if I add max to max, then the method will never end, no?
<apeiros_> no, you don't add max to max
<apeiros_> you add it to the rest of your sum
<Senjai> ^
<apeiros_> 23:44 Senjai: So right now you're jkust returning sum_recursion(min, max-1)
<apeiros_> 23:45 atmosfeer: I'm missing the current max
<apeiros_> so right, add it
<apeiros_> sum(min,max) == sum(min,max-1) + max
Rephiax has quit [Ping timeout: 272 seconds]
jmrepetti has quit [Ping timeout: 240 seconds]
<atmosfeer> It looks so simple...
<Senjai> atmosfeer: Told ya you'd cry at how simple it is xD
<apeiros_> it is. but like many problems, only once you understood it.
<Senjai> It's just a different way of thinking about things
<Senjai> you'll get used to it
<Senjai> >> (1..100).inject(:+)
<eval-in_> Senjai => 5050 (https://eval.in/298864)
<atmosfeer> Do you often use recursive methods in real world situations?
<Senjai> atmosfeer: ^ You have things like that in ruby too
<Senjai> Yes
<apeiros_> Senjai: actually use gauss, not inject ;-)
<Senjai> All the time for performance critical applications
<Senjai> apeiros_: gauss?
<atmosfeer> This is a little advanced for me, I'm on day 3 of learning it
<Senjai> recursion is also great for when you never know when you have to stop
<apeiros_> Senjai: sum(1..N) == N*(N+1)/2
<apeiros_> from which follows, that sum(min..max) == max*(max+1)/2 - min*(min+1)/2
<apeiros_> no iterations required, hence O(1)
<Senjai> apeiros_: <3
<Senjai> apeiros_: I'm light on my math unfortunately
<Senjai> Self taught :/
<atmosfeer> Well, thank you so much. I think I'll draw it out tomorrow and talk to my teacher about it. I'm really excited about this class.
dellavg_ has quit [Ping timeout: 264 seconds]
rsl has quit [Ping timeout: 264 seconds]
<Senjai> Good luck
<Senjai> Best way to learn is to just write programs
<fade2000> atmosfeer: For the sake of edification, are you able to spot where Senjai's recursive solution can be trivially optimized?
<atmosfeer> I could go min +1 as well?
<apeiros_> oh, actually my formula excludes min.
<Senjai> atmosfeer: :)
<fade2000> atmosfeer: Well done.
<atmosfeer> Or does that fuck it up?
<apeiros_> should have been (max*(max+1)-min*(min-1))/2
<Senjai> atmosfeer: Does it matter in which order you sum things in order to sum a collection?
<apeiros_> i.e. min-1 instead of +1
<atmosfeer> No, of course not
<Senjai> So then it wouldn't mess things up
<apeiros_> atmosfeer: min+1 in the recursion would work too
<Senjai> :P
jmrepetti has joined #ruby-lang
<apeiros_> just changes how you have to implement it
<atmosfeer> OK, well it's a bit of a mindfuck for day 3, that whole recursion thing
<Senjai> The only case you'd have to be careful is 6,7, where if you dont check, will become 7,6 next iteration
<atmosfeer> Yeah, I thought about the streams crossing
<atmosfeer> Ghostbusters taught me it was a bad thing
<fade2000> atmosfeer: Wording it that way seems to indicate you might be ready to learn about transducers.
RobertBi_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<atmosfeer> Those sound cool
fusillicode has quit [Quit: Leaving.]
<atmosfeer> Well, I'm gonna go to bed. Thanks guys. Godspeed to you all
ghostpl_ has quit [Remote host closed the connection]
Rephiax__ has quit []
iliketurtles has quit [Quit: zzzzz…..]
atmosfeer has quit [Ping timeout: 246 seconds]
iliketurtles has joined #ruby-lang
Volsus has quit [Ping timeout: 256 seconds]
nathanstitt has quit [Quit: I growing sleepy]
relix has joined #ruby-lang
lytol has quit [Remote host closed the connection]
piotrj has joined #ruby-lang
centrx has joined #ruby-lang
piotrj has quit [Ping timeout: 246 seconds]
lytol has joined #ruby-lang
Olipro_ has quit [Ping timeout: 256 seconds]
lytol has quit [Ping timeout: 245 seconds]
elia has quit [Quit: Computer has gone to sleep.]
iliketurtles has quit [Quit: zzzzz…..]
jmrepetti has quit [Remote host closed the connection]
Voker57 has quit [Ping timeout: 252 seconds]
Pugsley has quit [K-Lined]
Pugsley has joined #ruby-lang
iliketurtles has joined #ruby-lang
lytol has joined #ruby-lang
lytol has quit [Remote host closed the connection]
wallerdev has quit [Quit: wallerdev]
wallerdev has joined #ruby-lang
mikecmpbll has quit [Quit: ciao.]