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]
<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
<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>
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}"
<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]
<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']
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|>
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
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]
<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
<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]
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?