<Ox0dea>
Nobody's around to phone the authorities.
<Nilium>
Off topic? Allow me to complain about how hard it is to use proportional fonts in code editors.
<Nilium>
It's really hard.
<[k->
the sudden allowance of off topic!
<Ox0dea>
Nilium: What madness overcomes you that you find yourself with such a problem?
EllisTAA has quit [Quit: EllisTAA]
<Nilium>
The desire to have nice, pretty text.
<Ox0dea>
Heathen.
<[k->
haskell will solve some of your problems!
sinkensabe has quit [Ping timeout: 240 seconds]
EllisTAA has joined #ruby
symm- has joined #ruby
<[k->
newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
Marsupermammal has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nisstyre has joined #ruby
<[k->
I'm not ready to look at this...
fenjamin has joined #ruby
nisstyre has quit [Changing host]
nisstyre has joined #ruby
fabrice31 has joined #ruby
iateadonut has quit [Quit: Leaving.]
bigmac has joined #ruby
irk has quit [Ping timeout: 255 seconds]
lkba_ has quit [Remote host closed the connection]
Thomas-0725 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
irk has joined #ruby
casadei_ has quit [Remote host closed the connection]
Thomas-0725 has joined #ruby
EllisTAA has quit [Quit: EllisTAA]
<fenjamin>
merely curious: perhaps in an exercise of DRY programming if the program understandably does what's expected, there are zero bugs, why then must methods be named consistent with the program? the method names can be gibberish, in other words
<Nilium>
Every time I look at Haskell it just convinces me that yeah, no, I'm not smart enough for this.
<fenjamin>
other than it helps others to read the program (which people can infer about how it works even if the methods are gibberish?
fabrice31 has quit [Ping timeout: 256 seconds]
celly has quit [Remote host closed the connection]
<Nilium>
fenjamin: DRY says nothing of naming, so far as I'm concerned.
<Nilium>
Not repeating yourself is just not repeating yourself.
<fenjamin>
yes I'm finding something with explicit naming conventions it can become a "who's on first" routine
<fenjamin>
*sometimes
DenSchub has quit [Read error: Connection reset by peer]
<nofxx>
there was this site, backed by ibm iirc, with some challenges that you could compile & run in a bunch of langs
DenSchub has joined #ruby
mary5030 has joined #ruby
<[k->
that's a cool way to do fizzbuzz
<Ox0dea>
We golfin'?
<Ox0dea>
fenjamin: That's what namespaces are for.
<[k->
dundundun you have triggered Ox0dea!
matcouto has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<fenjamin>
ox0dea: ::?
<fenjamin>
Ox0dea: ::?
<Ox0dea>
fenjamin: Well, yes, that's the resolution operator.
mary5030 has quit [Ping timeout: 256 seconds]
<Ox0dea>
foo.compact.join == foo*'' if foo is an array of maybe strings.
<[k->
>> ::
<ruboto>
[k- # => /tmp/execpad-a76eadcb3df8/source-a76eadcb3df8:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/401079)
<[k->
adding that to the tips and tricks section later
htmldrum has quit [Ping timeout: 265 seconds]
<[k->
# how to avoid name spacing issues
<[k->
# do it the JavaScript way
<[k->
-> {# your things here}.call()
<fenjamin>
if i understand correctly namespacing is organizationally nesting methods?
<zenspider>
*sigh* always saddens me when I see fizz buzz.
<Ox0dea>
fenjamin: Nesting anything, really.
CpuID has quit [Ping timeout: 246 seconds]
<Ox0dea>
[k-: All my non-alphanumeric sillinesses use IIFEs.
<fenjamin>
Ox0dea: you're a treasure
tubuliferous_ has quit [Ping timeout: 250 seconds]
<[k->
IIFEs?
<Ox0dea>
Immediately-invoked function expressions.
lkba has joined #ruby
<[k->
._. how would I resolve that
<Ox0dea>
Hm?
<fenjamin>
without using |x|
<[k->
IIFE isn't defined as immediately-invoked function expressions in my book
havenwood has joined #ruby
<[k->
hence, I can't resolve it
<fenjamin>
{|x| x p y} rather
riotjones has joined #ruby
<Ox0dea>
[k-: I'm not sure I follow.
lkba has quit [Remote host closed the connection]
<Ox0dea>
[k-: Did you accidentally your_book.freeze?
<[k->
I am unable to understand what you mean by IIFE when you suddenly threw it at me
<Ox0dea>
But... it's the first result.
<Ox0dea>
And you were already familiar with the concept.
<[k->
wow... indeed it is
<[k->
that's because I use jquery!
<greenride>
In the following snippet of code, how can the environment of the first block be changed such that it's variable definitions are available in the rest of the method? https://dpaste.de/MApc
<[k->
that's a cool code pasting site
<Ox0dea>
greenride: You'd have to declare inner_object outside of the block.
riotjones has quit [Ping timeout: 240 seconds]
Aswebb_ has joined #ruby
jbw_ has quit [Ping timeout: 256 seconds]
<greenride>
Ox0dea: Isn't there some way to use binding to modify the scope in which that block's code runs?
jbw_ has joined #ruby
Mon_Ouie has quit [Ping timeout: 265 seconds]
<zenspider>
greenride: *sigh* why?
<[k->
you have to eval first....
<greenride>
zenspider: I'll construct an example. One sec.
<[k->
he doesn't want to see it...
<[k->
lel
djbkd_ has quit [Remote host closed the connection]
<zenspider>
"how do I violate nice clean scoping rules? preferably... rectally?"
Aswebb_ has quit [Ping timeout: 256 seconds]
<Ox0dea>
It's fitting that your nick hashes to a shade of jade.
<greenride>
zenspider: https://dpaste.de/L0bh What if I have the following method, and I want to benchmark the time for each line in this method? If I use the Benchmark library, I have to ensure every variable defined within the block is defined outside the block. That's the problem I'm trying to avoid.
pepperbreath has joined #ruby
<zenspider>
greenride: above it you put a = b = c = d = nil
<zenspider>
done
<zenspider>
don't be clever with bindings. be explicit about what you're doing. do the simplest thing that could possibly work
<zenspider>
also, use better tools to figure out where your benchmarks are
<greenride>
zenspider: It seems strange to me that I need to identify every single variable and set it to nil as the very first line.
Aeyrix has joined #ruby
<nofxx>
expect(Foo).to be or to_not be
<nofxx>
that's the spec
afrianska has joined #ruby
<[k->
Ox0dea highly tempting!
xkickflip has joined #ruby
<[k->
this will be a great addition!
<greenride>
zenspider: Also, if my goal is to benchmark every single line in an arbitrary method; will the approach of setting all local variables to nil as the first line always work?
orbitalo has quit [Remote host closed the connection]
<zenspider>
greenride: all you're doing is declaring the variables at the top (relevant) scope.
<Ox0dea>
[k-: You might also enjoy binding_of_caller.
<[k->
greenride: there are profiling tools in Ruby
orbitalo has joined #ruby
fenjamin has quit [Quit: 离开]
<Ox0dea>
greenride: Do it dynamically! Use RubyVM::InstructionSequence.of(foo), programmatically extract each line of the method, then benchmark them while also mutating some object that holds the last return value.
<[k->
huehuehue
<Ox0dea>
greenride: It'd probably be much easier just to benchmark every single expression if you wound up taking that path, though.
<zenspider>
Radar: can we mute bad idea generators who don't prefix their bad ideas as such?
<[k->
I bet 10 bucks that Ox0dea did that before!
<Ox0dea>
Nah, Ruby's iseqs are pretty gnarly.
<[k->
there goes 10 bucks :(
<Ox0dea>
I *did* try to modify and execute one, which seems to have been doable at some point, but it's no longer kosher.
<zenspider>
you can with some fiddle code to make a C entrypoint public
<Ox0dea>
zenspider: It's commented out in trunk.
<Ox0dea>
RubyVM::InstructionSequence#load, I mean.
acke has joined #ruby
sinkensabe has joined #ruby
xkickflip has quit [Quit: xkickflip]
Thomas-0725 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
I am derping all over the place. The function is still defined, but I wonder whether its being cast to void causes it to be optimized out of the final binary.
<zenspider>
in my build I see: 0000000100171920 t _iseq_build_load_iseq
<[k->
if you want to modify code on the fly you are treating code as data!
<[k->
time for a lisp!
Channel6 has quit [Quit: Leaving]
acke has quit [Ping timeout: 246 seconds]
<Ox0dea>
zenspider: iseq_build_load_iseq() calls rb_iseq_load(), which is in the symbol table, but that calls iseq_load(), which is not.
<zenspider>
huh
<zenspider>
is for me... it seems
sinkensabe has quit [Ping timeout: 244 seconds]
<greenride>
zenspider: The problem with putting something like a = b = c = nil at the top of the method where a, b, and c are the local variables is that it can change the output.
pdxvegan has quit [Remote host closed the connection]
<Ox0dea>
greenride: Assignment is not your bottleneck, bud.
<greenride>
Ox0dea: I'm thinking/google through your suggestions.
<Ox0dea>
greenride: As evinced by zenspider's chewing me out, I was mostly fucking with you.
<[k->
cey cry weeping sounds
<zenspider>
change it how? if you have bad logic for nils, then use the right starting value
<greenride>
Ox0dea: I'm not worried about assignment being the performance bottleneck. I'm concerned about conditionals such as b = (defined? a) ? 2 : 3.
<greenride>
Ox0dea: Granted, people shouldn't write code like that, but I'm looking for a 'correct' method.
<Ox0dea>
nofxx: I would appreciate being enlightened as to the nature of my confusion.
celly has joined #ruby
<Ox0dea>
In short, in which languages, past or present, is the letter V a vowel?
phutchins has quit [Ping timeout: 244 seconds]
pwnz0r has joined #ruby
<nofxx>
Ox0dea, really not a expert here but here it goes: basically rome uses some letter from greek and add some others
<greenride>
Ox0dea: I see. You are demonstrating that lines are a bad thing to benchmark since your example shows that lines are not necessarily a unit that translates into something meaningful at the token level or the ruby virtual machine level.
toretore has quit [Quit: This computer has gone to sleep]
<nofxx>
and build the latin alphabet, and rome being rome it gets widespread
<zenspider>
greenride: I asked you "what; about; this; line?"
<Ox0dea>
greenride: That's exactly right.
<zenspider>
greenride: I also asked you "what\nabout\nthis\nline?"
<Ox0dea>
In Ruby, statements may span multiple lines, and a single line may contain multiple statement.
<Ox0dea>
greenride: If you desire to benchmark a method piecemeal, you'll need to do so at the expression level.
<nofxx>
Ox0dea, its basically our aphabet, but 'J' did not exist until some centuries ago (another history I dont recall).. they added I and U for instance
<zenspider>
half an hour ago I said "lines mean nothing"
<Ox0dea>
nofxx: Who added U?
<greenride>
Ox0dea: Fully agree.
<nofxx>
Ox0dea, rome
riotjones has quit [Ping timeout: 244 seconds]
<greenride>
zenspider: Thanks for pointing that out. I just wasn't sharp enough to get it back then.
mxrguspxrt has quit [Remote host closed the connection]
<greenride>
zenspider: Noted that you said it.
<nofxx>
Ox0dea, if not it's the same J history, was later and rome added 'I' heh need to wikipedia
<[k->
zenspider: I actually have a code snippet for that
<[k->
want to see?
<nofxx>
Ox0dea, I guess it was later cuz we see a lot of julius as you wrote, and GAIVS too for caesar
tjbiddle has joined #ruby
celly has quit [Ping timeout: 248 seconds]
<zenspider>
[k-: before I answer your question, expand on "for that"
<Ox0dea>
greenride: Sure thing. Sorry your idea turned out to be crazier than you might at first assume.
<Ox0dea>
Consider switching to a homoiconic language. :)
<zenspider>
... huh. didn't need to: /troll WhitePride
EllisTAA has joined #ruby
<zenspider>
... did the internet just go bizarro?
<zenspider>
that script is gorgeous
Pupeno has quit [Remote host closed the connection]
<Ox0dea>
It's very pretty. nofxx's mention of Cyrillic brought it to mind, since that's the alphabet they use for transliteration.
Pupeno has joined #ruby
Pupeno has quit [Changing host]
Pupeno has joined #ruby
matcouto has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<nofxx>
Ox0dea, it's rotated? or they write top to down?
<Ox0dea>
It's vertical.
<zenspider>
gah so pretty
<greenride>
[k-: Thanks for the discussion as well. That's a cool little script.
<nofxx>
Ox0dea, that's crazy... does html5 support this? vertical input fields haha
tmtwd has quit [Remote host closed the connection]
codecop has joined #ruby
<zenspider>
if it support RTL, it better support vertical
<zenspider>
or a ~billion ppl will be annoyed
<nofxx>
TTB ?
<nofxx>
wait... isn't japanese top to bottom to? AND RTL ? hehe
<Ox0dea>
nofxx: Modern Japanese is RTL, but not TTB.
<zenspider>
all of the above, depending
<Ox0dea>
Apparently so.
<Ox0dea>
I know I've had highlighting issues on pages containing Japanese text, and I also seem to vaguely recall seeing pages from a Murakami novel being written right-to-left, but LTR is obviously way more common.
<Ox0dea>
I thought for the longest that it had something to do with formality.
baweaver has quit [Remote host closed the connection]
<Ox0dea>
That won't be overly enlightening, but it demonstrates the surface view of Ruby's "thunks".
revath has quit [Quit: Leaving.]
krz has quit [Quit: WeeChat 1.0.1]
revath has joined #ruby
<[k->
totally enlightening!
<[k->
./s
<[k->
that isn't related!
joonty has quit [Quit: joonty]
<[k->
or I can't make the connection :s
krz has joined #ruby
timonv has quit [Ping timeout: 244 seconds]
<Ox0dea>
A thunk, in a nutshell, is a delayed computation.
peter_paule has joined #ruby
<Ox0dea>
Ruby's Enumerator::Lazy remembers the methods you called on its instances, but doesn't actually execute them until you force it to, at which point it's able to prune the (potentially infinite) result set down to something more concrete.
<[k->
I was confused because the example I gave didn't make use of x and y :s
<dubkoidragon>
just got home from a night out on the town
<dubkoidragon>
feeling good
<dubkoidragon>
doing some rubying now
<Ox0dea>
That last part sounds particularly Rubyrific; tell us more about that one.
<dubkoidragon>
I will be doing a quick tutorial on blocks, procs, and lambdas. I assume theyll be quite similar to pythons lamdbas, but I havent heard of procs, so will be good to know the syntax
ohaibbq has quit [Remote host closed the connection]
kraljev11 has joined #ruby
<[k->
the reason why they are grouped together is because they are mostly the same
<dubkoidragon>
ok I see, yah I know about blocks, and labdas, but no idea what this proc thign is, but I will in a couple mins
<dubkoidragon>
I'm checking out the site right now
<[k->
how do you even print the block
<DexterLB>
hmm, the first time you start the ruby interpreter it's slow (about 3-4 seconds). Every subsequent time is a lot faster - why is that?
fabrice31 has joined #ruby
<Ox0dea>
DexterLB: In a word, caching.
<dubkoidragon>
I do not know
<Ox0dea>
[k-: Blocks come into methods as Procs.
<Ox0dea>
DexterLB: You should find that that's the case for many prorams you run, at least near to boot time.
tubuliferous_ has quit [Ping timeout: 248 seconds]
<Ox0dea>
3-4 seconds is rather excessive, though.
<DexterLB>
Ox0dea: ah, you mean the standard memory caching performed by the OS?
<Ox0dea>
DexterLB: There's all sorts of caching going on, but yes, mostly that one.
rubie has joined #ruby
<dubkoidragon>
so blocks go into methods as procs
<dubkoidragon>
why
<zenspider>
DexterLB: windows?
revath has quit [Read error: Connection reset by peer]
<[k->
Ox0dea, lies
<zenspider>
3-4 seconds is super duper slow
<DexterLB>
zenspider: nope, linux
<[k->
you have to &block
<Ox0dea>
[k-: No, you don't.
<[k->
when you do that, it is converted to a proc!
<zenspider>
DexterLB: `gem list | wc -l`
revath has joined #ruby
<DexterLB>
zenspider: lol, shit.
konsolebox has quit [Quit: Leaving]
<DexterLB>
zenspider: thanks
<zenspider>
_maybe_ related... not necessarily
<zenspider>
run it, tell me the number
<DexterLB>
86
<zenspider>
that's not that high
<DexterLB>
it's a lot
<zenspider>
nah
fabrice31 has quit [Ping timeout: 248 seconds]
<zenspider>
not 3-4 seconds high
<zenspider>
unless you're running on a floppy
<Ox0dea>
[k-: Every method receives an implicit block if one isn't explicitly provided, and every method's block is accessible via Proc.new/proc when called without an explicit block; &block just lets you name the thing if you so choose.
<Ox0dea>
>> def foo; proc[1, 2] end; foo { |a, b| a + b }
<Ox0dea>
I think it's disingenuous to so thoroughly conflate the two.
<zenspider>
[k-: honestly? that's probably just some wierd historical bullshit. it's gone through so much manipulation over the years
<zenspider>
Ox0dea: I disagree
<Ox0dea>
zenspider: I can call a method with n Procs, but only one block; they are obviously not the same thing.
Blaguvest has quit [Remote host closed the connection]
<zenspider>
that isn't obvious at all. nor proof.
fantazo has joined #ruby
<Ox0dea>
Do you even LSP?
<zenspider>
one is syntactic sugar for the other. that's it.
<[k->
if you would look at <source that I am trying to remember>
fantazo has quit [Remote host closed the connection]
<zenspider>
just like: f { ... } vs f(&block) ? same thing.
<[k->
zenspider, no, &block has overhead
<[k->
it converts the block to a proc
<zenspider>
other way around in this case
Aswebb_ has quit [Ping timeout: 246 seconds]
<Ox0dea>
zenspider: When else does conversion take place between two things that are the same?
<zenspider>
dubkoidragon: the big difference between a python lambda and a ruby lambda is that in ruby there isn't the language distinction between an expression and a statement. your blocks/procs in ruby can be as complex as you want
bertro has joined #ruby
<zenspider>
in python, you can only have an expression in the lambda
revath has quit [Read error: Connection reset by peer]
<zenspider>
Ox0dea: I don't understand your question
GarethAdams has joined #ruby
<[k->
how do you search reddit
<zenspider>
poorly
<zenspider>
tho the search engine seems to have improved a bit
<Ox0dea>
[k-: Google + site:reddit.com is better than "native".
revath has joined #ruby
<zenspider>
you can now get semi-reliable searches if you limit it to the subreddit
<zenspider>
which is harder to do with google
AlexRussia has quit [Quit: WeeChat 1.3-dev]
<Ox0dea>
site:reddit.com/r/foo works fine.
thomasvm has joined #ruby
arup_r has quit [Ping timeout: 244 seconds]
leat has joined #ruby
bodgix has joined #ruby
<dubkoidragon>
what does .to_a do again
<zenspider>
calls the method to_a on an object
<[k->
I'm pretty bad at remembering
<zenspider>
[k-: me too! we're so alike
<[k->
usually to_a converts the object to an array
<zenspider>
dubkoidragon: aka, depends on what object it is called on
The_Phoenix has quit [Read error: Connection reset by peer]
<[k->
zenspider, by alike, you mean you write ugly code too? :)!
<dubkoidragon>
oh I thought it would be an answer simple like to_sym changes it to a sybol
<dubkoidragon>
\but i see its not
<Ox0dea>
dubkoidragon: It is.
<dubkoidragon>
ok so whats it do again
<zenspider>
.to_sym calls to_sym on an object. depends on what object
AlexRussia has joined #ruby
Yiota has joined #ruby
leat4 has quit [Ping timeout: 264 seconds]
<jhass>
well, to_sym is a method too, I could do class Foo; def to_sym; "I'm a teapot"; end; end and nobody would stop me
ndrei has quit [Ping timeout: 260 seconds]
<Ox0dea>
dubkoidragon: This is the price paid for ill-conceived questions.
<Ox0dea>
We all thought you were trying to learn Ruby.
<dubkoidragon>
i meant with the ird thing
<jhass>
irb
<jhass>
try it
<dubkoidragon>
ok
<zenspider>
[k-: yup. some syntax has overhead. your point?
thomasvm_ has joined #ruby
statu has quit [Ping timeout: 255 seconds]
<Ox0dea>
> syntax overhead
<dubkoidragon>
irb(main):001:0
<dubkoidragon>
thats whati t says
<jhass>
great
<jhass>
now (1..100).to_a
<zenspider>
start with 2 + 3
revath has quit [Read error: Connection reset by peer]
<[k->
it's not only syntax overhead
<[k->
read the whole thing
thomasvm_ has quit [Read error: Connection reset by peer]
<[k->
there's a second paet
<[k->
part*
<zenspider>
I've _implemented_ this
<dubkoidragon>
it counted to a hundred
revath has joined #ruby
<Ox0dea>
dubkoidragon: Well, there it is! to_a counts to a hundred.
<dubkoidragon>
yeah
<dubkoidragon>
that was awsome
<dubkoidragon>
that actually explained it good, then you can call a proc on that
thomasvm has quit [Ping timeout: 246 seconds]
<zenspider>
I'm surprised it's still as bad as it is... I thought 1.9+ did a lot of improvement to blocks/procs
lolmaus has quit [Ping timeout: 244 seconds]
<dubkoidragon>
ok so next question i guess what is this irb thing i went into
<zenspider>
dubkoidragon: you're not calling a proc on anything... you're sending the message select and passing it a block/proc to filter
<dubkoidragon>
oh
<Ox0dea>
Which... calls the Proc for every element in the collection.
lolmaus has joined #ruby
<dubkoidragon>
ok cool
joonty has joined #ruby
<dubkoidragon>
whats the irb menu for?
leat has quit [Remote host closed the connection]
leat has joined #ruby
<[k->
lel, there it is! to_a counts to a hundred
krz has quit [Ping timeout: 240 seconds]
<Ox0dea>
dubkoidragon: irb is pronounced like "herb"; the irb menu is to be consulted when you're unsure which spices go best with a given dish.
<zenspider>
[k-: look at the numbers for jruby, only 1.3x. speed differences are just implementation details.
tobacco_joe has joined #ruby
<dubkoidragon>
ok cool, and how can I get back out of it and into my ruby folder
<[k->
the implementation differs, so they aren't the same!
<zenspider>
exit or ... maybe cntrl d
<zenspider>
I dunno about cmd
<Ox0dea>
Ctrl-Z.
<[k->
exit, quit, etc
Mon_Ouie has joined #ruby
<[k->
irb has those methods defined
<[k->
exit is a Kernel method tho
<zenspider>
etc?
<dubkoidragon>
exit works
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<[k->
etc is obviously not a method!
<zenspider>
nothing is obvious with ruby
<Ox0dea>
zenspider: Thread.main.kill?
<zenspider>
dunno why irb defined quit
<zenspider>
hah. they define their own exit and quit
<[k->
because quit is what other repls do?
<zenspider>
and... oddly... irb_quit
<[k->
in Haskell, :quit
arup_r has joined #ruby
<[k->
in vim, :quit
<[k->
etc
Yiota has joined #ruby
<zenspider>
vim != repl. besides :q :P
codecop has quit [Remote host closed the connection]
nini1294 has quit [Ping timeout: 240 seconds]
postmodern has joined #ruby
<zenspider>
and python? needs the parens.. hah
<zenspider>
I always just close stdin w/ ^d
<zenspider>
>>> quit
<zenspider>
Use quit() or Ctrl-D (i.e. EOF) to exit
<ruboto>
zenspider # => /tmp/execpad-ea983eb34158/source-ea983eb34158:2: syntax error, unexpected '>' ...check link for more (https://eval.in/401131)
joonty has quit [Quit: joonty]
<zenspider>
oops. sorry ruboto
<Ox0dea>
I did the same damned thing recently.
<zenspider>
maybe ruboto should know that if there are 3 chevrons it should eval in python
jamesaxl|2 is now known as jamesaxl
<zenspider>
what could go wrong?
<Ox0dea>
apeiros: ^
nofxx has quit [Ping timeout: 240 seconds]
<[k->
syntax errors?
<Ox0dea>
And then maybe two leading semicola for Scheme evaluation.
<[k->
and a lambda for haskell
<[k->
I need to add a lambda to my keyboard first, of course
<jhass>
why not brainfuck for three >>> and interpret them as part of the program already?
lolmaus has quit [Read error: Connection reset by peer]
lolmaus has joined #ruby
revath has quit [Quit: Leaving.]
acke has quit [Remote host closed the connection]
<Ox0dea>
[k-: Ctrl-g for Greek.
revath has joined #ruby
spider-mario has joined #ruby
_ixti_ has joined #ruby
<[k->
Ctrl does not exist on my keyboard :(
nini1294 has joined #ruby
leat has quit [Remote host closed the connection]
leat has joined #ruby
troulouliou_div2 has joined #ruby
krz has joined #ruby
lkba has joined #ruby
tkuchiki has joined #ruby
krz has quit [Read error: Connection reset by peer]
zz_Outlastsheep is now known as Outlastsheep
fantazo has joined #ruby
<zenspider>
gotta stop using typewriters
lessless has joined #ruby
tkuchiki has quit [Ping timeout: 265 seconds]
revath has quit [Ping timeout: 244 seconds]
ruurd has joined #ruby
<[k->
I do not use a typewriter!
troulouliou_div2 has quit [Ping timeout: 244 seconds]
<Ox0dea>
[k-: Your MacBook's keyboard really doesn't have a Ctrl key?
<[k->
I'm on my phone!
<Ox0dea>
Oh, right. :/
Musashi007 has quit [Quit: Musashi007]
Silox| has joined #ruby
troulouliou_div2 has joined #ruby
benlovell has joined #ruby
<Silox|>
Are there any gems providing numpy array support to ruby?
<[k->
when I see numpy and Ruby in the same sentence I feel sad
<[k->
is shevy here?
zacstewart has joined #ruby
krz has joined #ruby
kfpratt has quit [Remote host closed the connection]
<Silox|>
[k-: I tried to look for alternatives but there just don't seem decent (and non-experimental) packages out there
<Silox|>
there's NArray which is still experimental, and then you have ScuRuby's nmatrix which relies on BLAS/LAPACK
<arup_r>
shevy, Hi
<arup_r>
Aww! all are calling shevy
<[k->
pretty much why I feel sad
benlovell has quit [Ping timeout: 264 seconds]
<Silox|>
I'm thinking about putting up a Python Flask API to communicate between my ruby "front end" and the Python processing backend now :c
<Ox0dea>
:C
Aym_C has joined #ruby
<[k->
Ox0dea, quick, do something!
<Ox0dea>
But Silox| is considering doing the right thing. :/
jbw_ has joined #ruby
<[k->
at least still rubying
<zenspider>
I don't think narray is considered experimental
pandaant has joined #ruby
jbw__ has quit [Ping timeout: 255 seconds]
<zenspider>
but I wouldn't say it makes up for numpy
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Silox|>
Can NArrays get passed through FFI to a C library though?
Alayde has quit [Read error: Connection reset by peer]
Alayde has joined #ruby
zacstewart has quit [Remote host closed the connection]
pandaant has quit [Remote host closed the connection]
Mekkis has quit [Max SendQ exceeded]
Mekkis has joined #ruby
troulouliou_div2 has quit [Quit: Leaving]
bruno- has joined #ruby
_blizzy_ has joined #ruby
bruno- is now known as Guest62155
<dubkoidragon>
hey guys, my head's really hurting. I'm going to go get some sleep, but tommorrow I will be on again for sure, learning classes. Thanks for your help today, it was very helpful. good night :)
Musashi007 has joined #ruby
quimrstorres has joined #ruby
celly has joined #ruby
<[k->
he doesn't drink water!
<[k->
You need to give him your wonderful advice, Ox0dea!
Yiota has joined #ruby
nini1294 has quit [Ping timeout: 260 seconds]
Guest62155 has quit [Ping timeout: 252 seconds]
Yiota has quit [Client Quit]
bodgix has quit [Read error: Connection reset by peer]
statu has joined #ruby
<statu>
hi!
bodgix has joined #ruby
<[k->
hello
<statu>
I am looking for a gem to access to a API server that returns some JSON data. Any suggestion?
_blizzy_ has quit [Read error: Connection reset by peer]
lolmaus has quit [Quit: Konversation terminated!]
<[k->
JSON
celly has quit [Ping timeout: 248 seconds]
<Silox|>
statu: Don't look into 1 solution, use something like HTTParty to do the requests and as [k- said, use JSON to translate the content of the response body
ruurd has quit [Quit: ZZZzzz…]
bodgix has quit [Client Quit]
<statu>
Silox|: [k- thanks you!! I am very new (1 day xD) in ruby and I don't know the ecosystem yet
<Silox|>
xD
_blizzy_ has joined #ruby
Yiota has joined #ruby
<arup_r>
Ox0dea, my Php to Ruby integration is finished successfully..:)
<Ox0dea>
arup_r: Oh?!
<Ox0dea>
Well done.
<arup_r>
thanks to you guys also
Yiota has quit [Client Quit]
<[k->
Ox0dea: (I am very new in Ruby) in ruby
<[k->
no quotes!
tkuchiki has joined #ruby
<Ox0dea>
That's syntactically valid Scheme and Ruby. :)
<Ox0dea>
Ah, shit, it's not, because `in`.
<[k->
in Ruby pls
<Ox0dea>
>> def method_missing(*) end; Ruby = "<3"; (I am very new to Ruby)
<Silox|>
I just realised that I don't actually need super fast serialisation of my array data... I'll just go with Marshal and FFI and see how fast it is
htmldrum has quit [Ping timeout: 246 seconds]
mandarinkin has quit [Ping timeout: 246 seconds]
acke has joined #ruby
jbw__ has joined #ruby
bruno-_ has joined #ruby
jbw_ has quit [Ping timeout: 256 seconds]
astrobunny has quit [Read error: Connection reset by peer]
<Ox0dea>
I finally got to use the two-argument form of Hash#fetch_values.
bodgix has joined #ruby
pandaant has joined #ruby
bodzio is now known as bodgix_wrk
bodgix is now known as bodzio
<[k-_>
i know what is atheme .__.
segfalt has joined #ruby
jbw_ has joined #ruby
djbkd_ has joined #ruby
bodzio has quit [Quit: Leaving.]
bodgix has joined #ruby
railsraider has joined #ruby
bodgix has quit [Client Quit]
jbw__ has quit [Ping timeout: 264 seconds]
bodgix_wrk has left #ruby [#ruby]
carlosoliveira has quit [Quit: Connection closed for inactivity]
allcentury has joined #ruby
bodgix has joined #ruby
acke has joined #ruby
kidoz has joined #ruby
dimasg has joined #ruby
bodgix is now known as bodzio
jbw__ has joined #ruby
dtcristo has joined #ruby
jbw_ has quit [Ping timeout: 246 seconds]
mistermocha has joined #ruby
Aym_C has quit [Remote host closed the connection]
hahuang65 has quit [Quit: WeeChat 1.2]
acke has quit [Ping timeout: 244 seconds]
lxsameer has quit [Remote host closed the connection]
dfockler has joined #ruby
lxsameer has joined #ruby
peter_paule has quit [Ping timeout: 244 seconds]
_blizzy_ has joined #ruby
ruurd has quit [Ping timeout: 265 seconds]
DEA7TH_ has joined #ruby
ruurd has joined #ruby
dfockler has quit [Ping timeout: 252 seconds]
lxsameer has quit [Remote host closed the connection]
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
_blizzy_ has quit [Read error: Connection reset by peer]
FernandoBasso has joined #ruby
_blizzy_ has joined #ruby
matcouto has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Node1 has joined #ruby
<Node1>
Hi
Node1 is now known as l0oky
dorei has joined #ruby
<l0oky>
>> puts "test string".parameterize
<ruboto>
l0oky # => undefined method `parameterize' for "test string":String (NoMethodError) ...check link for more (https://eval.in/401154)
celly has joined #ruby
<Ox0dea>
l0oky: Maybe #rubyonrails' bot includes ActiveSupport::Inflector.
<l0oky>
Ox0dea: Yeah I thought so. Thanks for the heads up.
<[k-_>
why are you doing it here :(
<Ox0dea>
[k-_: pry is expensive these days.
celly has quit [Ping timeout: 248 seconds]
_blizzy_ has quit [Read error: Connection reset by peer]
<Ox0dea>
Given that some people "half-use" it, we can assume the number of users must be fractional. Thus, if nobody used pry, at its current cost of 0, total expenses would be:
<mikecmpbll>
basically wanna be able to have a list of elements, and for a user to pass in an element and i want to iterate over every other element starting with the one they pass in, so [1,2,3,4] with 3 would iterate [3,4,1,2].
<mikecmpbll>
i could hack something up but wondering if i was missing something elegant :0
sarkyniin has joined #ruby
jdeen has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
dtcristo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sarkyniin has quit [Client Quit]
<[k-_>
Array#rotate
<mikecmpbll>
an array that would iterate circularly forever would be the simplest because i can just break when i meet the same element :)
<mikecmpbll>
ooh.
sarkyniin has joined #ruby
<[k-_>
yw
<mikecmpbll>
that's the ticket
<mikecmpbll>
cheers [k-_ !
serivich has joined #ruby
mxrguspxrt has joined #ruby
havenwood has joined #ruby
<mikecmpbll>
>> a = [1,2,3,4]; a.rotate(a.index(3))
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<[k-_>
i must ping shevy about this
<[k-_>
he will be happy
bruno- has joined #ruby
<shevy>
wat
kfpratt has joined #ruby
<[k-_>
i contributed to ruby!
<shevy>
well that is just documentation
<shevy>
you improved the documentation by 0.00000000241%
<[k-_>
you didnt contribute to ruby >.>
<ddv>
aww
yqt has quit [Ping timeout: 256 seconds]
rubie has quit [Ping timeout: 265 seconds]
Tristan-Speccy has quit [Ping timeout: 248 seconds]
<[k-_>
>> 0.00000000241%
<ruboto>
[k-_ # => /tmp/execpad-39d104817ce9/source-39d104817ce9:3: syntax error, unexpected keyword_rescue ...check link for more (https://eval.in/401178)
Marsupermammal has quit [Remote host closed the connection]
<[k->
Ruby is dying is nonsense
<kj>
intially twitter used ruby but got converted into scala somewhat is going with git i think
Channel6 has joined #ruby
<fenjamin>
i have an output of a .csv file into one array, need nested into 4 elements
htmldrum has joined #ruby
<Ox0dea>
fenjamin: Could you clarify?
veduardo has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
weemsledeux has joined #ruby
<[k->
?wordcrime
<ruboto>
I don't know anything about wordcrime
Spami has joined #ruby
<fenjamin>
pastie takes a .csv file and returns an array from a row however i need that array nested into 4 elements. [[a,b,c,d],[e,f,g,h],[i,j,k,l],[m,n,o,p]]
tmtwd has joined #ruby
<fenjamin>
rather 4 elements per nested array into however many arrays as the dataset.
<[k->
fenjamin: you need to work more on your phrasing :s
htmldrum has quit [Ping timeout: 256 seconds]
htmldrum has joined #ruby
<fenjamin>
among problem solving abilities.
<fenjamin>
which are correlated quite possibly.
sinkensabe has quit [Remote host closed the connection]
<fenjamin>
is it understandable? i have [a,b,c,d,e,f,g,...z] need [[a,b,c,d],[e,f,g,h],[i,j,k,l]. . etc]
<[k->
(I need to have a collection of [arrays of 4 elements] created when I read data from a CSV file)
<[k->
examples are always nice
<shevy>
hmm there was a method for that .... was it zip ? hmm or group_by ...
ruurd has quit [Read error: Connection reset by peer]
dimasg has quit [Ping timeout: 260 seconds]
DoubleMalt has quit [Remote host closed the connection]
<[k->
fenjamin: can you show us what the CSV looks like?
<FenrirReturns>
fenjamin: your_array.each_slice(4).to_a should do what you're describing, since Array includes Enumerable and each_slice takes an argument and returned an Enumerable, and that provides to_a
<[k->
I never knew what that method was for ;)
<pontiki>
i find it profitable to keep reviewing Enumerable. so many methods...
spider-mario has quit [Read error: Connection reset by peer]
<Ox0dea>
[k-: I was just showing off another of Enumerable's lesser-known methods.
<FenrirReturns>
@fenjamin that's becuase you're putting the object in the array, not to_s or whatever it is you really want.
GitGud has quit [Client Quit]
htmldrum has quit [Ping timeout: 244 seconds]
<pontiki>
#zip is fun, too; i was looking at a chunk of code and was like !OMG! i can use zip here!! (was an each_with_index then using index for another collection)
rubie has quit [Remote host closed the connection]
<Ox0dea>
Also, #grep takes an optional block to apply to the results:
centrx has quit [Remote host closed the connection]
centrx has joined #ruby
jpfuentes2 has joined #ruby
tsvenson has quit [Ping timeout: 244 seconds]
chipotle has joined #ruby
kj has quit [Quit: Page closed]
<shevy>
long live firefox! \o/
jack_rabbit has quit [Ping timeout: 248 seconds]
<arup_r>
shevy, I am done.. but got another.. :(
<shevy>
more php? you are a poor person
celly has joined #ruby
<arup_r>
o^o ........ hummmmmmm
<shevy>
the only rewrites I have to do are from my old code... which is more than enough torture as is
<[k->
reject their demands
<shevy>
the more code, the harder it gets to manage it :(
<[k->
i bet shevy uses 1.8.7
<arup_r>
I can't reject... :/ I have to
<arup_r>
but after converting it to Ruby the code looks like `gal`.. really.. :)
tsvenson has joined #ruby
<[k->
get a php dev in
<[k->
and tell him to write Ruby
<[k->
you will have done him and the world a favor
toretore has joined #ruby
chouhoulis has joined #ruby
fantazo has quit [Quit: Verlassend]
lele is now known as Guest24
ne1l has joined #ruby
celly has quit []
CloCkWeRX1 has quit [Quit: Leaving.]
<[k->
I expect by 2016 that the number of users would have increased by 1%
chouhoulis has quit [Ping timeout: 250 seconds]
<[k->
I call this the k's law
arup_r has quit [Quit: Leaving]
lavros has quit [Quit: leaving]
<shevy>
[k- I see that you have not been long on #ruby as otherwise you would know that I am on ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
arup_r has joined #ruby
<[k->
lies, you definitely only write legacy Ruby
tsvenson has quit [Ping timeout: 244 seconds]
<Ox0dea>
shevy: Still?!
<[k->
how many users do we have now
Casty has joined #ruby
<shevy>
what do you mean with still
<[k->
Ox0dea is on 2.3
<Ox0dea>
[k-: 2**10-1
<shevy>
that is not an official ruby
<[k->
I mean #ruby
<shevy>
ftp://ftp.ruby-lang.org/pub/ruby/
pothibo has joined #ruby
<[k->
obviously Ox0dea has means to access 2.3
<Ox0dea>
As does everyone else?
<shevy>
totally useless
dgutierrez1287 has joined #ruby
<Ox0dea>
shevy: Then why do you follow the ChangeLog?
<Ox0dea>
What do you stand to gain?
<[k->
useless?
<shevy>
to have a look at what is upcoming
<[k->
yeah, he follows it a lot
<Ox0dea>
shevy: But why not wait until you can actually use it?
<shevy>
to then digest xxxxx information when I can digest x information before?
DEA7TH_ has joined #ruby
<[k->
he pings me every time he looks at it :/
<shevy>
[k- no worries! no more pings for you in regards to the changelog
DEA7TH_ has quit [Read error: Connection reset by peer]
<[k->
I don't read the changelog, I don't know how to
mxrguspxrt has joined #ruby
DEA7TH_ has joined #ruby
Violentr has quit [Ping timeout: 244 seconds]
tsvenson has joined #ruby
dgutierrez1287 has quit [Ping timeout: 264 seconds]
niemcu has joined #ruby
<arup_r>
how you guys declared default value for Hash, I don't like my approach.. :/
<Ox0dea>
arup_r: What do you think is bad about it?
mistermocha has joined #ruby
<pontiki>
i think that's perfectly fine
<Ox0dea>
The only sane alternative would be foo = Hash.new('bar'), followed by a bunch of foo['x'] = 'y', which is hardly an improvement.
drewvanstone has quit [Ping timeout: 248 seconds]
<arup_r>
it seems like.. I'm doing something twice.. I went with Hash.new { } syntax.. but with that also I need to do twice.. I am thinking if I can do it in a single definition..
tobacco_joe has quit []
arooni-mobile has quit [Ping timeout: 248 seconds]
<pontiki>
you're not repeating your self, if that's your concern
<arup_r>
as you guys support .. I will go with my code.. I was just curious to see if any improvement is possible
sinkensabe has joined #ruby
<Ox0dea>
arup_r: You can get quite fancy with Hash.new, but not when your data is completely static.
<arup_r>
Yes.. I have static data
mistermocha has quit [Remote host closed the connection]
<Ox0dea>
arup_r: No sense in complicating things, then.
<freezevee>
Ox0dea: I am creating a lookup table with bytes and arrays with the amount of [0,1] bits
<Ox0dea>
freezevee: That looks pretty involved for such a simple operation. :/
tubuliferous_ has quit [Ping timeout: 248 seconds]
<freezevee>
I tried to create some kind of "lookup table" in order to speed things up
pocketprotector has joined #ruby
bubbys has quit [Ping timeout: 250 seconds]
<freezevee>
so I don't have to count the bits
<freezevee>
each time
htmldrum has joined #ruby
bubbys has joined #ruby
gamename has quit []
<freezevee>
so If I read 23 123 11 234 22 111 from the file, then I call hblt[23] and automatically I get the array of counted '1's and '0'
<freezevee>
I have to do this as an exercise so please, don't give me a solution
<Ox0dea>
freezevee: Why an array and not just how many 1s there are?
codecop has joined #ruby
codecop_ has joined #ruby
<freezevee>
but I'd appreaciate If you tell me what I am doing wrong
<freezevee>
Ox0dea: because I want the '0's also
<Ox0dea>
freezevee: Well, you should strive to make your lookup table as simple (and thus fast) as possible.
<freezevee>
I think it's called population count
<Ox0dea>
Yes, that's right.
<Ox0dea>
But you can get the numeber of 0s simply by subtracting the number of 1s from the total number of characters * 8, right at the end.
<Ox0dea>
You get the number of 0s "for free".
<Ox0dea>
Do you see what I mean?
<freezevee>
Ox0dea: that's what I am doing
<freezevee>
actually in that case I should count the number of bytes
<freezevee>
hmmm
hectortrope has quit [Remote host closed the connection]
Rickmasta has joined #ruby
<freezevee>
Right now I have an image with Size: 4409.817Kb
<Ox0dea>
freezevee: You also get that "for free" via `file.stat.size`. :)
<freezevee>
so it's 4409817 kilobytes = 35278536
<freezevee>
35278536 bits
<Ox0dea>
Why these specifics?
<freezevee>
so If I get the '1's = 18211764 you say I could just substract them to get the '0's
<freezevee>
sorry for the specific information
zenguy_pc has quit [Read error: Connection reset by peer]
<Ox0dea>
No worries; I see now why you went there.
Aswebb_ has quit [Read error: Connection reset by peer]
<Ox0dea>
If you've got a bunch of bits, which can only be 0 or 1, and you know how many are 1, subtraction gets you how many are 0.
<freezevee>
I see
zenguy_pc has joined #ruby
<Ox0dea>
Given that you know how many bits you had to start with, of course, which you can easily obtain.
arooni-mobile has joined #ruby
axl_ has joined #ruby
<freezevee>
do you think it's going to get less time ?
zenguy_pc has quit [Read error: Connection reset by peer]
<freezevee>
so I don't need a lookup table ?
<freezevee>
I didn't think about it
axl_ has quit [Client Quit]
zenguy_pc has joined #ruby
axl_ has joined #ruby
axl_ has left #ruby [#ruby]
<Ox0dea>
freezevee: A lookup table from {0=>0, 1=>1, 2=>1, 3=>2, 4=>1, ...} would certainly gain you some speed over doing to_s(2).count('1') on every single byte, absolutely.
<freezevee>
I see
<freezevee>
let me check it
workmad3 has quit [Ping timeout: 256 seconds]
zenguy_pc has quit [Read error: Connection reset by peer]
EllisTAA has joined #ruby
zenguy_pc has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Pupeno has joined #ruby
zenguy_pc has quit [Read error: Connection reset by peer]
zenguy_pc has joined #ruby
Aswebb_ has joined #ruby
bruno- has joined #ruby
zenguy_pc has quit [Read error: Connection reset by peer]
valetudo has quit [Read error: Connection reset by peer]
phroa has joined #ruby
mike___1234 has quit [Ping timeout: 256 seconds]
<freezevee>
Ox0dea: I believe I did it
<freezevee>
Ox0dea: 0m0.723s !!!!
<freezevee>
but I somehow must find out If it's right
<freezevee>
the number of bits in total
<Ox0dea>
freezevee: Not bad.
<Ox0dea>
freezevee: Well, you know the file's size in bytes, don't you?
<freezevee>
I love it
<freezevee>
yeah
<Ox0dea>
And how many bits in a byte?
<freezevee>
usually 8 lol
<Ox0dea>
Well, it's not the 1970s anymore. :P
Pupeno has quit [Ping timeout: 244 seconds]
<freezevee>
you mean to just multiply and double check with the size in bytes ?
athos_diddy has quit []
<Ox0dea>
freezevee: You want to verify that your answer is correct, yes?
<freezevee>
Ox0dea: would you write tests for a function like that ?
<freezevee>
Ox0dea: is there any meaning in it ?
devbug has joined #ruby
Tritone has quit [Remote host closed the connection]
<Ox0dea>
freezevee: Well, I was going to suggest using either `od` or `xxd` to validate your results, but the former doesn't print binary and the latter doesn't print binary without also outputting address columns. :/
<Ox0dea>
freezevee: I mean, you want to know you've written a correct method, don't you?
<freezevee>
of course
<Ox0dea>
At the very least, test it on simple inputs whose answers you know to be correct (even if that means hand validation).
<freezevee>
like ?
<Ox0dea>
freezevee: The string "abc"?
Yiota has joined #ruby
<freezevee>
Ox0dea: should I write a test with RSpec for that case ?
<Ox0dea>
freezevee: Maybe take this opportunity to explore the space a bit and find the one you like best.
<Ox0dea>
test/unit, minitest, and rspec are all nice and not in their own ways.
<Ox0dea>
freezevee: If you were asking whether you should write a spec to verify that your code works for something as simple as "abc", then definitely yes.
<Ox0dea>
"Fail early" so you can get back to fixing things ASAP.
<freezevee>
I mean it's pretty simple, does it make sense to write a test ?
radialneon has joined #ruby
<Ox0dea>
Yes, it makes sense to write a test.
<Ox0dea>
If only to get into the habit of the thing.
<freezevee>
and test what? it's a simple function that takes files as attributes
<Ox0dea>
Test that it's correct...
bruno- has quit [Ping timeout: 255 seconds]
<freezevee>
ok I see
Yiota has quit [Client Quit]
<Ox0dea>
You want to be able to prove that your code does what you say/think it does.
mike___1234 has quit [Ping timeout: 260 seconds]
<Ox0dea>
Even, and indeed especially after you've made some minor improvement which you think couldn't possibly affect the result.
jenrzzz has joined #ruby
Volsus has joined #ruby
htmldrum has quit [Ping timeout: 244 seconds]
arooni-mobile has quit [Ping timeout: 248 seconds]
NeverDie has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
spider-mario has joined #ruby
peter_paule has quit [Ping timeout: 248 seconds]
jpfuentes2 has joined #ruby
<freezevee>
Ox0dea: it's pretty awesome
<Ox0dea>
freezevee: Shall we compare answers?
<freezevee>
it does 0m0.758s for a file 110Mb
lorn has joined #ruby
<freezevee>
I can't believe it
gamename has joined #ruby
mike___1234 has joined #ruby
einarj has quit [Remote host closed the connection]
timonv has joined #ruby
<phroa>
Hey there. I'm writing a script that at one point executes `./configure --with-some-options'. Problem being, the options I pass appear to be ignored. Here's what I've tried and what breaks: https://gist.github.com/anonymous/51144060a5dba330f2a5
<phroa>
as far as I know, that's correct syntax/usage. Any other details that would be helpful?
Silox| has quit [Quit: Connection closed for inactivity]
shinnya has quit [Ping timeout: 250 seconds]
<Ox0dea>
phroa: You're on the right track with `system *command`.
<Ox0dea>
phroa: Rename "command" to "options". :)
yqt has joined #ruby
Carnage\ has joined #ruby
revath has quit [Ping timeout: 244 seconds]
<phroa>
would it seriously work, or is that just better variable naming? :P
<Ox0dea>
phroa: No, there's one last piece to the puzzle before it would work as you'd like.
j4cknewt has quit [Remote host closed the connection]
<Ox0dea>
phroa: Erm, wait; I might be derping.
icebourg has joined #ruby
<Ox0dea>
phroa: Yeah, either of your approaches really ought to work. :/
<Ox0dea>
Are you sure you're not generating syntax errors in your interpolations?
<phroa>
I'm totally stumped. I copy the generated command and run it in a shell and it works :/
<cubicool>
Hey guys, I need some advice. In python, I'm used to calling methods and specifying the argument name explicitly: foo(1, 2, x=10). I can't do anything like this in Ruby directly, unless there's something I don't know. I want to define initialize() methods that accept many different methods of invocation, so I use the technique of passing it a single (args={}) argument.
<jhass>
?guys cubicool
<ruboto>
cubicool, we're not all guys - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
<cubicool>
However, the code for testing this Hash (the size, type of the arguments, etc.) is getting really, really tedious. is this common enough that there may be a library to help?
<ElSif>
yes, there are no kw args in ruby
<Ox0dea>
>> def foo(x:, y:); x + y; end; foo(y = 17, x = 25) # cubicool
<ruboto>
Ox0dea # => wrong number of arguments (2 for 0) (ArgumentError) ...check link for more (https://eval.in/401256)
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
cubicool: so since Ruby 2.0 you can use keyword args, since 2.1 you can use required ones
<Ox0dea>
ElSif: Please don't do that.
howdoi has quit [Quit: Connection closed for inactivity]
<ElSif>
lol what??
<centrx>
jhass, Yes we are: guy, n. - A person of grotesque appearance, esp. with reference to dress; a ‘fright’.
yosafbridge has joined #ruby
<cubicool>
Wow, nice. The job I'm at currently, however (I'm learning Ruby "as-I-go" there) is stuck on 1.9.3.
<Ox0dea>
ElSif: Spew misinformation?
<jhass>
?guys2 centrx
<ruboto>
centrx, it doesn’t matter if it’s "normal"/gender neutral to say "guys" in your idiolect. "You guys" to refer to a mixed group is erasure. All we ask from you is to be a decent channel member and respect that. If you want to further discuss this, join #ruby-offtopic.
<cubicool>
Thanks for the information. :)
<cubicool>
Maybe I can get them to upgrade.
<shevy>
cubicool you could try to use a hash if you are on 1.9.x
<centrx>
?ugly
<ruboto>
I don't know anything about ugly
<ElSif>
ok ill keep my 'you could have googled that' jokes to myself
<Ox0dea>
cubicool: Even on 1.9, you can use a final Hash argument to emulate keyword arguments.
<cubicool>
shevy: That is how I'm doing it now, I just have tons of conditional code and it doesn't have that Ruby beauty.
jpfuentes2 has joined #ruby
<Ox0dea>
It's not perfect, but it sufficed for a long time.
<cubicool>
Ox0dea: I use that too, actually.
niemcu has quit [Ping timeout: 250 seconds]
<shevy>
yeah, I end up having to do lots of hash-query checking when I use hash-as-keywords
<jhass>
cubicool: well, Ruby 1.9 is EOL (no official security updates anymore) and Ruby 2.0 is set to EOL February 2016, so there are more serious reasons to upgrade ;)
<Ox0dea>
cubicool: Well, 1.9.3 is "dead" since February, so yo should be...
<Ox0dea>
phroa: You don't have write-access to the directory you're trying to build in.
<jhass>
I wonder if they don't get resolved
l0oky has quit [Ping timeout: 264 seconds]
<ElSif>
sounds like a permissions error yea
<phroa>
jhass: well, I can copy the exact command and run it in a shell, so that isn't happening
<jhass>
phroa: yeah, in your shell
<jhass>
I'm saying Ruby/the shell ruby invokes might not
<phroa>
not sure how I wouldn't have write access - this script downloads and unzips the source tarball...
<phroa>
let me run some permissions checks
<ElSif>
coul the permissions on the tarballed files be strange? what args are you using to untar?
<jhass>
phroa: try resolving them by hand (or with File.expand_path if you need to do it programmatically)
pwnz0r has joined #ruby
<phroa>
jhass: er, actually; would the fact that `%x[echo command > foo]' generates a file named foo be proof enough? because I tried that earlier and it worked.
<phroa>
by worked I mean the file was written, script still failed :(
_blizzy_ has quit [Read error: Connection reset by peer]
<phroa>
jhass: that ruby has write permission to the directory
Tritone has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fabrice31 has quit [Ping timeout: 256 seconds]
<jhass>
I never claimed it hasn't, Ox0dea did
<phroa>
wait, it was Ox0de...yeah
<phroa>
whoops :P
<jhass>
I claimed it fails to resolve the /../ in the path
<jhass>
*paths, even
_blizzy_ has joined #ruby
centrx has quit [Quit: Shutting down, Please wait...]
therealfibonacci has quit [Quit: Leaving.]
dont-panic has joined #ruby
Tritone has quit [Ping timeout: 248 seconds]
<phroa>
jhass: late reply, but `puts %x[ls #{bin_path}/../]' works
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<ElSif>
and you are just running this script with 'ruby blah.rb' not any special command line magic?
<jhass>
still
<jhass>
try resolving them
mistermocha has joined #ruby
<phroa>
I'm unsure what you mean by 'resolve' if the `ls' wasn't it
<phroa>
ElSif: ./script.rb with a shebang, but I could use `ruby` if you like
<ElSif>
no thats fine
<jhass>
phroa: change the paths so that they don't contain any /../ if you pass them to configure
leat has quit [Remote host closed the connection]
leat has joined #ruby
freezevee has quit [Ping timeout: 264 seconds]
Casty has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
krz has quit [Quit: WeeChat 1.0.1]
<ElSif>
you could try adding -p to your tar args
<phroa>
jhass: removed ../, fails
<jhass>
mh
<jhass>
how about explicitly calling the shell in which "it works"?
<phroa>
just kidding, had more ../s than I thought
<phroa>
let me remove those and try that
<jhass>
system "/bin/bash -c '#{command.join(" ")}'"
mistermocha has quit [Remote host closed the connection]
yfeldblum has joined #ruby
krz has joined #ruby
radialneon has quit [Ping timeout: 260 seconds]
kies^ has quit [Ping timeout: 256 seconds]
radialneon has joined #ruby
<ElSif>
phroa: have you compile things on this system with this user manually?
<phroa>
ElSif: yes, again, I can take the output of `puts command' and run that myself.
<ElSif>
ah, i though you had only done a 1 file test, nvm
<ElSif>
did you try jhass last suggestion?
<phroa>
I'm removing the ..s in the paths
<phroa>
then I will, yes
<jhass>
yeah, try without the .. first
krz has quit [Client Quit]
ragingcake has joined #ruby
arup_r has quit [Quit: Leaving]
freezevee has joined #ruby
TheHodge has joined #ruby
Violentr has quit [Ping timeout: 240 seconds]
havenwood has joined #ruby
Ox0dea has quit [Ping timeout: 255 seconds]
choppington has joined #ruby
futilegames has joined #ruby
peter_paule has joined #ruby
idiocrash has quit []
choppington has quit [Ping timeout: 240 seconds]
eggoez has quit [Ping timeout: 252 seconds]
Musashi007 has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
maletor has joined #ruby
<phroa>
jhass: no dice with `system "/usr/local/bin/zsh -c '#{command.join(" ")}'"' but I added a /usr/bin/env -i before it and it worked. thanks so much for getting me halfway there <3
<phroa>
I'll have to look in to what borked the environment, but I'll save that for another day
<jhass>
strange nonetheless
pdxvegan_ has joined #ruby
<phroa>
toodle-oo
phroa has left #ruby ["WeeChat 1.3-dev"]
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
eggoez has joined #ruby
FernandoBasso has joined #ruby
ragingcake has quit [Quit: ragingcake]
ragingcake has joined #ruby
<ElSif>
something with a non-interactive versus interactive shell difference??
<ElSif>
yea that would be quite rare if it was the case
gemmy has joined #ruby
<ElSif>
for just running a local script anyways
acl_ has quit [Quit: Page closed]
ragingcake has quit [Client Quit]
cubicool has quit [Quit: Leaving.]
DEA7TH_ has quit [Quit: DEA7TH_]
ragingcake has joined #ruby
Mendenhall has quit [Ping timeout: 248 seconds]
AlphaAtom has joined #ruby
dgutierrez1287 has joined #ruby
Contigi has quit [Quit: Leaving]
Aym_C has joined #ruby
tubuliferous_ has joined #ruby
Casty has joined #ruby
pdxvegan_ has quit [Read error: Connection reset by peer]
Aym_C has quit [Client Quit]
NeverDie has quit [Read error: Connection reset by peer]
<shevy>
long live ruby \o/
dgutierrez1287 has quit [Ping timeout: 244 seconds]
NeverDie has joined #ruby
Muhannad has joined #ruby
ruby-lang619 has joined #ruby
<ruby-lang619>
hallo
<ruby-lang619>
wow
Bloodshot has joined #ruby
<jhass>
hello
<ruby-lang619>
anybody here?
<jhass>
well, you are
<ruby-lang619>
fine
<wasamasa>
if only you are there, did the tree fall down?
<shevy>
ruby-lang619 were you not here yesterday as wel
tubuliferous_ has quit [Ping timeout: 264 seconds]
Casty has quit [Ping timeout: 244 seconds]
ruby-lang619 has quit [Client Quit]
<jhass>
oO
icebourg has quit []
<jhass>
what did we do :/
Yiota has joined #ruby
Yiota has quit [Client Quit]
<wasamasa>
the tree fell down
radialneon has quit [Ping timeout: 248 seconds]
eGGsha has joined #ruby
ph8 has joined #ruby
aryaching has quit [Ping timeout: 264 seconds]
Channel6 has quit [Quit: Leaving]
LiquidInsect has quit [Read error: Connection reset by peer]
hololeap has joined #ruby
sinkensabe has joined #ruby
ndrei has quit [Ping timeout: 244 seconds]
symm-_ has joined #ruby
symm- has quit [Ping timeout: 244 seconds]
eggoez has quit [Ping timeout: 256 seconds]
niemcu has joined #ruby
ndrei has joined #ruby
peter_paule has quit [Ping timeout: 252 seconds]
freezevee has quit [Remote host closed the connection]
Sypheren has quit [Ping timeout: 255 seconds]
sinkensabe has quit [Ping timeout: 246 seconds]
orbitalo has joined #ruby
Sypheren has joined #ruby
<shevy>
yeah :)
<shevy>
he was using webchat so that is to be expected
edenc has joined #ruby
sharpmachine has joined #ruby
Muhannad has quit [Ping timeout: 256 seconds]
ndrei has quit [Ping timeout: 256 seconds]
codecop_ has quit [Remote host closed the connection]
codecop has quit [Remote host closed the connection]
FernandoBasso has quit [Quit: May the force be with you.]
ndrei has joined #ruby
dom__ has joined #ruby
mhib has quit [Remote host closed the connection]
radialneon has joined #ruby
DLSteve has quit [Quit: Leaving]
cjk101010 has joined #ruby
radialneon has quit [Read error: Connection reset by peer]
Yiota has joined #ruby
ragingcake has quit [Quit: ragingcake]
zenguy_pc has joined #ruby
bertro has quit [Read error: Connection reset by peer]
ragingcake has joined #ruby
ljarvis has quit [Quit: Lost terminal]
maletor has quit [Quit: Computer has gone to sleep.]
lkba_ has quit [Remote host closed the connection]
ragingcake has quit [Client Quit]
zenguy_pc has quit [Read error: Connection reset by peer]
pwnz0r has quit [Remote host closed the connection]
<nofxx>
I mean: "your gem was rejected, foo-bar-baz must require
<nofxx>
foo/bar/baz*
<nofxx>
feels too much apple store? heh
pwnz0r has joined #ruby
ndrei has quit [Ping timeout: 265 seconds]
Jackneill has quit [Remote host closed the connection]
peelback has quit []
s00pcan has joined #ruby
peelback has joined #ruby
finisherr has joined #ruby
cpg has joined #ruby
DEA7TH_ has joined #ruby
<nofxx>
worst was this bug I faced: gem is 'foo-bar', I: require 'foo/bar' strange errors happen... author wants you to r equire 'foo_bar' and my way required some part of it =/
ragingcake has joined #ruby
<nofxx>
To be clear: not require errors, that would caught my attention, it required fine, just worked misteriously
acke has quit [Remote host closed the connection]
<nofxx>
my way == correct way btw
pwnz0r has quit [Ping timeout: 248 seconds]
bruno- has quit [Ping timeout: 264 seconds]
<nofxx>
hmm... now need to hear the song, sid vicious or sinatra?
<ruboto>
ruurd # => undefined local variable or method `bar' for main:Object (NameError) ...check link for more (https://eval.in/401288)
benlovell has quit [Ping timeout: 265 seconds]
jimmychimms has joined #ruby
tubuliferous_ has quit [Ping timeout: 244 seconds]
ruurd has quit [Quit: Bye]
<jesterfraud>
Is there a version of ||= that only triggers on nils (instead of falses)?
<weaksauce>
jesterfraud you can use fetch for hashes
<jimmychimms>
hi - can someone help? I'm trying to capitalize every word in a sentence greater than 3 letters long - following code capitalizes each word, but how do i modify it so it only capitalizes words with 3 characters or more? str.split.each{|i| i.capitalize!}.join(' ')}
darithorn has joined #ruby
<jesterfraud>
weaksauce: that helps
<jesterfraud>
thanks
<weaksauce>
though if the value is actually nil it won't override the nil value jesterfraud only if it's not been assigned anything to that key