<rasterick_>
leitz, i am building a program, configure created a 'rakefile' instead of a 'makefile'
desperek has quit [Quit: xoxo]
<rasterick_>
so to compile i need to run the 'rakefile' .. docs say just type rake
hahuang65 has quit [Client Quit]
white_lilies has joined #ruby
<rasterick_>
but i get errors: line 3: syntax error near unexpected token `'ALRM'' line 3: ` if Signal.list.key?('ALRM')'
<rasterick_>
i am lost as how to fix this
<leitz>
How much ruby do you know?
<rasterick_>
how much Ruby ? well, i installed it last night ... so very much a newbie
<rasterick_>
google has been no help either *sigh* so i went here for help
<leitz>
Ruby code isn't usually "compiled", more run. It is interepreted as it goes.
<leitz>
So, if you write "my_code.rb" that is just "puts 'hello'" you run it with ruby my_code.rb
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
white_lilies has quit [Ping timeout: 256 seconds]
<rasterick_>
all i am finding on google is how to write Ruby code ... your code looks nice btw
<leitz>
Thanks! Don't look at it as the best way to code, but I enjoy it.
<rasterick_>
as long as you enjoy, that is the main thing i think
<leitz>
Are you trying to use rake to compile?
<leitz>
Is your code on github or a gist?
<rasterick_>
no, i took source code to build a program, configured it ... it produced a 'rakefile' to make the compiler (GCC) to compile the code
safetypin has quit [Quit: ZZZzzz…]
<rasterick_>
i am using a released tarball, but the snapshot does the same ... it is designed to produce a rakefile
<leitz>
Okay, I'm not sure I understand what that code is trying to do. Unless you're just using a rake file vice a makefile. Which is not something i'd understand.
<rasterick_>
i have never used a rakefile b4 .. all my past compiles produce a 'Makefile' .. just type 'make' and it compiles the prog
<rasterick_>
that github is really cool, i never used it b4
schneide_ has quit [Ping timeout: 256 seconds]
<leitz>
Yup.
cdg_ has quit [Ping timeout: 248 seconds]
<leitz>
Okay, maybe a "make clean" and restart the configure? Line 3-11 seem indented, like there's something before it missing.
<leitz>
That, however, is just a wild guess. The "key?" is looking to see if there's an 'ALRM' in the list generated by Signal. So, what's generating the Signal?
<leitz>
Or more to the point, why aren't the smart folks saying anything?
white_lilies has joined #ruby
cdg has quit [Ping timeout: 276 seconds]
<rasterick_>
ohmy, that has been a problem, impossible to 'make clean' without a 'makefile' and only a 'Rakefile' but i can do this: reconfigure the program
<rasterick_>
this will make a NEW 'Rakefile'
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rasterick_>
gimme a few moments to do this
<rasterick_>
you are very keen! i did mess with the first few lines of that code, was going to re.configure anyway
<rasterick_>
well, that is why i did not mention the name of the prog ... it is rather comprehensive: libmatroska is one of about 8 libs that you must build BEFORE you configure
<leitz>
Happy to help, BTW. I get a lot of help here myself.
drewmcmillan has joined #ruby
<rasterick>
what does that snippet do ?
govg has quit [Ping timeout: 260 seconds]
<mcr1>
leitz, so hostname rather than host.
dinfuehr has quit [Ping timeout: 240 seconds]
<leitz>
It says that the syntax error isn't in your Signal.list.key? bit.
dinfuehr has joined #ruby
<rasterick>
can you translate that to english for me please ?
govg has joined #ruby
<leitz>
Sure. Your error was "syntax error". I ran the code straight in Ruby's interactive interpreter; irb. No syntax error. So my guess is that something else is trying to parse your rakefile and isn't Ruby.
<leitz>
Make sense?
<leitz>
If you're on Linux, try: which rake
<rasterick>
yes, makes very much sense
<rasterick>
well, get ready for a clear confusion ... here goes
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rasterick>
i am on windows 7 64bit , running a 32bit linux bash shell, that compiles with GCC 7.2
<leitz>
:)
<rasterick>
and Ruby and rake are running INSIDE that bash console
bigblind has quit [Ping timeout: 268 seconds]
<leitz>
In theory. That error makes me think something else is off.
<rasterick>
maybe that is the prob? should i be running ruby from a CMD prompt ? but then it could not access the GCC compiler
<rasterick>
what do you think is off ?? ... listening
sameerynho has quit [Ping timeout: 256 seconds]
govg has quit [Ping timeout: 264 seconds]
govg has joined #ruby
<rasterick>
the only preprocessors that i know of that i have are g++ and bison
<leitz>
If you run rake then it should be the ruby tool. In the directory with the rakefile you should be able to just run "rake".
CPngN has quit [Quit: The system is going down for reboot NOW!]
<leitz>
The 32 vs 64 bit version thing bothers me less than the syntax error. We've shown that the syntax is fine.
<rasterick>
i think i installed the Ruby 64bit version
<rasterick>
but that is a good experiment .. i will install Ruby in the same tree as the program and run rake from the '.root dir
<rasterick>
if that does not work i will try the 32bit ver of Ruby
<leitz>
Can you install ruby via the bash shell? I don't know windows, but the issue seems to be you're not acutally using ruby/rake.
govg has quit [Ping timeout: 240 seconds]
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz>
That, and it's about my nappy time so I'm making less sense as I go.
<rasterick>
yep, the 64bit Ruby is what i installed
<rasterick>
oh !! you were VERY helpful and knowledgeable about this leitz ! Thank You! so very much!
npgm has quit [Quit: Connection closed for inactivity]
<rasterick>
at lease i have some ideas how to approach this problem now .. thank you again
drewmcmillan has joined #ruby
<leitz>
Wish I could have helped more. The test is just run "rake" in the directory with the rakefile.
<rasterick>
and enjoy your nap ;)
<leitz>
All 8 hours of it. Enjoy!
xcesariox has joined #ruby
leitz has quit [Quit: Nappy time]
<rasterick>
8pm here, im just getting started :> imma niteowl
<rasterick>
lemme go try these experiments ... bbl
white_lilies has joined #ruby
rasterick has quit [Ping timeout: 260 seconds]
white_lilies has quit [Ping timeout: 248 seconds]
orbyt_ has joined #ruby
xcesariox has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aguestuser has quit [Remote host closed the connection]
xcesariox has joined #ruby
aguestuser has joined #ruby
alfiemax has joined #ruby
xcesariox has quit [Client Quit]
alfiemax has quit [Ping timeout: 264 seconds]
marmorkreb has joined #ruby
xcesariox has joined #ruby
mtkd has quit [Ping timeout: 256 seconds]
mtkd has joined #ruby
jameser has joined #ruby
MzrE has joined #ruby
arkinor has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
Somethings going on. What are +@ and -@ ?
<dminuoso>
Ohh unary nevermind.
arkinor has joined #ruby
x77686d has joined #ruby
arkinor has quit [Read error: Connection timed out]
orbyt_ has joined #ruby
<dminuoso>
Especially this is cool: [i ** 2 / 3 | i <- [3,6..100], :even?]
tpendragon has quit [Remote host closed the connection]
giraffe has quit [Remote host closed the connection]
cschneid has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
konsolebox has quit [Ping timeout: 256 seconds]
konsolebox has joined #ruby
guardianx has quit []
za1b1tsu has joined #ruby
cschneid has quit [Ping timeout: 256 seconds]
white_lilies has joined #ruby
konsolebox has quit [Ping timeout: 248 seconds]
_main_ has joined #ruby
oetjenj has joined #ruby
konsolebox has joined #ruby
white_lilies has quit [Ping timeout: 240 seconds]
guille-moe has quit [Ping timeout: 255 seconds]
__main__ has quit [Ping timeout: 240 seconds]
_main_ is now known as __main__
ramfjord has joined #ruby
oetjenj has quit [Client Quit]
<apeiros>
andkerosine… that nick sounds familiar
phate408 has joined #ruby
claudiuinberlin has joined #ruby
justinfaler has quit [Quit: justinfaler]
xuyuheng_ has joined #ruby
__main__ has quit [Read error: Connection reset by peer]
ramfjord has quit [Ping timeout: 255 seconds]
xuyuheng has quit [Ping timeout: 240 seconds]
traxnov has joined #ruby
__main__ has joined #ruby
TomyLobo has quit [Ping timeout: 276 seconds]
vondruch has joined #ruby
traxnov has quit [Client Quit]
mtkd has quit [Ping timeout: 256 seconds]
schneide_ has joined #ruby
reber has joined #ruby
mtkd has joined #ruby
Dimik has quit [Ping timeout: 256 seconds]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guille-moe has joined #ruby
aupadhye has joined #ruby
x77686d has quit [Quit: x77686d]
za1b1tsu has quit [Remote host closed the connection]
atchoum has quit [Ping timeout: 256 seconds]
sylario has joined #ruby
x77686d has joined #ruby
agent_white has joined #ruby
<terens>
hello
tvw has joined #ruby
devil_tux has joined #ruby
xuyuheng_ has quit [Read error: Connection reset by peer]
KeyJoo has joined #ruby
guille-moe has quit [Ping timeout: 248 seconds]
Mike11 has joined #ruby
white_lilies has joined #ruby
xuyuheng_ has joined #ruby
zapata has quit [Read error: Connection reset by peer]
zapata has joined #ruby
white_lilies has quit [Ping timeout: 252 seconds]
n13z has quit [Remote host closed the connection]
guille-moe has joined #ruby
maum has quit [Remote host closed the connection]
bijan_ has joined #ruby
mikecmpbll has joined #ruby
zigzig has quit [Remote host closed the connection]
zigzig has joined #ruby
n13z has joined #ruby
Skarlso has joined #ruby
bijan__ has joined #ruby
yitsushi has joined #ruby
TomyWork has joined #ruby
bijan__ has quit [Client Quit]
x77686d has quit [Quit: x77686d]
x77686d has joined #ruby
x77686d has quit [Client Quit]
bijan__ has joined #ruby
m4rCsi has quit [Quit: No Ping reply in 180 seconds.]
m4rCsi has joined #ruby
conta1 has joined #ruby
livcd has quit [Changing host]
livcd has joined #ruby
ramfjord has joined #ruby
anisha has joined #ruby
guille-moe has quit [Ping timeout: 265 seconds]
ramfjord has quit [Ping timeout: 248 seconds]
<terens>
hi
_main_ has joined #ruby
oetjenj has joined #ruby
__main__ has quit [Ping timeout: 276 seconds]
_main_ is now known as __main__
white_lilies has joined #ruby
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
__main__ has quit [Read error: Connection reset by peer]
white_lilies has quit [Ping timeout: 248 seconds]
__main__ has joined #ruby
<terens>
Suppose I have a class called Client. This class can be instantiated. Also It will create instances for some XYService classes. Now lets suppose I have a generic MessageHandler class.When a MessageHandler will process a message how can it find the instance of services in client?
<dminuoso>
terens: Look into reactor pattern, like with em.
<terens>
I use EM but I dont get how it would help
<terens>
My problem is more like "dependecy injection"
iron_houzi has left #ruby ["WeeChat 2.0.1"]
<dminuoso>
terens: No my point is: The pattern itself, not the gem.
<dminuoso>
terens: You could simply maintain a registry in your dispatcher.
<dminuoso>
terens: It's not exactly the dispatchers job to "be able and find all services", it's rather the consumers job to register any desired handlers.
<terens>
Yeah handlers is ok. But lets say I have a handler XYMessageHandler... So this handler should call XYService instance. My problem is how it is better to get this instance from Client class.
guille-moe has joined #ruby
tomphp has joined #ruby
phate408 has quit [Remote host closed the connection]
marr has joined #ruby
Serpent7776 has joined #ruby
white_lilies has joined #ruby
jaruga has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Cavallari has joined #ruby
white_lilies has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Ping timeout: 256 seconds]
x77686d has joined #ruby
za1b1tsu has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guille-moe has quit [Ping timeout: 256 seconds]
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
r3dc0d3r has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Junaos has quit [Ping timeout: 240 seconds]
ldnunes has joined #ruby
Junaos has joined #ruby
guille-moe has joined #ruby
mtkd has quit [Ping timeout: 264 seconds]
mtkd has joined #ruby
Junaos has quit [Ping timeout: 265 seconds]
jaruga has quit [Quit: jaruga]
ramfjord has joined #ruby
Junaos has joined #ruby
heftig has quit [Remote host closed the connection]
jaruga_ has joined #ruby
heftig has joined #ruby
white_lilies has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
bijan__ is now known as bijan_awaaaay
bijan_ has quit [Remote host closed the connection]
bijan_awaaaay has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
white_lilies has quit [Ping timeout: 240 seconds]
cdg has joined #ruby
xuyuheng_ has quit [Ping timeout: 256 seconds]
cdg has quit [Ping timeout: 252 seconds]
anisha has quit [Quit: This computer has gone to sleep]
mikecmpbll has joined #ruby
AJA4350 has joined #ruby
im0nde has joined #ruby
milardovich has joined #ruby
<soahccc>
I already thought that it might not work but is it "right" that constants defined in an instance_eval vanish into nothingness?
white_lilies has joined #ruby
<soahccc>
ups, rather class_eval, `self::CONSTANT = value` works though smh
Cavallari has quit [Quit: Cavallari]
white_lilies has quit [Ping timeout: 256 seconds]
jamesaxl has joined #ruby
<dminuoso>
soahccc: Can you give a concrete code example?
<soahccc>
dminuoso: I get that constants are lexically scoped but after the class eval the non-self:: constants are just gone, not in Module.constants anymore
white_lilies has quit [Ping timeout: 268 seconds]
<dminuoso>
soahccc: Can you make a working testcase?
<dminuoso>
There's some stray constant Tcomp in there. I'd like to understand what you are doing
<dminuoso>
soahccc: Because my minimal testcase for "setting constants in class_eval" works just fine:https://eval.in/952858
<soahccc>
yeah but Module.constants always shows a list of top level constants, no?
<dminuoso>
soahccc: No.
<dminuoso>
soahccc: It shows the constants available from the current nesting.
<dminuoso>
Whereas Module.nesting shows the current nesting.
<soahccc>
Alright, I mean I have to use self:: anyway I suppose but I was curious as to where those constants ended up since it wasn't on self context
<soahccc>
thanks :)
<dminuoso>
soahccc: constants are basically class instance variables if you want.
<soahccc>
yeah but this lexical scope lookup thing is confusing sometimes
marmorkr_ has quit [Remote host closed the connection]
<dminuoso>
There's no "top level constants" so to speak
<dminuoso>
In truth ::Foo is just shorthand for ::Object::Foo
desperek has joined #ruby
conta1 has quit [Quit: conta1]
<soahccc>
yeah now that I think about it. But what I meant is that even though code get's eval'd somewhere, constant lookup is not relative to that context but where it was defined, e.g. the lookup scope is defined by where the code is written
<soahccc>
and the quirk with constant lookup and "shorthand class/module notation" aka class Foo::Bar::Baz
<dminuoso>
soahccc: I dont follow.
white_lilies has joined #ruby
justinweiss has quit []
justinweiss has joined #ruby
<dminuoso>
soahccc: Do you mean const lookup when you explicitly name constants?
avdi has quit []
avdi has joined #ruby
<soahccc>
dminuoso: if you define a nested class or module in one line with the double colons the lookup/nesting is different as if you write them in multiple lines without the colons, you know what I mean? :D
thinkpad has quit [Quit: lawl]
<dminuoso>
soahccc: Yes.
<dminuoso>
?nesting
<ruby[bot]>
dminuoso: I don't know anything about nesting
<dminuoso>
Mmm. We have a factoid for this.
<dminuoso>
soahccc: const lookup is a non-intuitive
<dminuoso>
soahccc: and its not about where the code is defined
<dminuoso>
soahccc: nesting is essentially a stack that is modified according to ruby code
<dminuoso>
it doesn't relate to what a class _is_, but its a context of the current execution
<dminuoso>
asm>> class Foo; puts 1; end
<ruby[bot]>
dminuoso: I have disassembled your code, the result is at https://eval.in/952911
white_lilies has quit [Ping timeout: 248 seconds]
<dminuoso>
soahccc: defining a class causes :Foo to be pushed to nesting, leaving :Foo pops it.
<dminuoso>
same goes with `class << foo` (there the singleton class gets pushed)
<dminuoso>
soahccc: and for class_eval the receiver is pushed
<dminuoso>
but only if you specify a string arugment
thinkpad has joined #ruby
<soahccc>
I guess that's the gotcha with my evals :)
apparition has joined #ruby
thinkpad has quit [Client Quit]
<soahccc>
Btw I'm trying to evaluate if I'm capable of writing a sortof transcompile from and with ruby... Guess I'm missing a grade for that
<dminuoso>
soahccc: So basically instance/class_eval with blocks _dont_ push nesting.
<dminuoso>
and thats what trips you up
gr33n7007h has joined #ruby
gr33n7007h is now known as al2o3-cr
<soahccc>
and what about `class Foo::Bar` vs `class Foo; class Bar` and nesting?
<dminuoso>
soahccc: It might be easier to compile straight to YARV
jameser has joined #ruby
<dminuoso>
soahccc: Like I said: Each time a "class is opened" that class is pushed to nesting.
<apeiros>
soahccc: they differ in how a constant is searched
<apeiros>
Module.nesting can be used to inspect the "search path" for constants
<dminuoso>
soahccc: the first pushes "Foo::Bar", the second pushes "Foo", and when it opens Bar it pushes "Bar"
<apeiros>
be aware though that it, similarly to e.g. __LINE__, depends on the location it's being called
<dminuoso>
Not exactly location
schaary has quit []
<soahccc>
I see, i find that kindof annoying at times to be honest, so much indentation just for that
<dminuoso>
more like it depends on how you end up in the line of code
adambeynon has quit []
schaary has joined #ruby
adambeynon has joined #ruby
<dminuoso>
soahccc: Just fully qualify constant names.
<dminuoso>
class Foo::Bar; puts ::Foo::M; end
<dminuoso>
This is fine
<soahccc>
dminuoso: and I was hoping to get away with a DSL but starting with keywords I'm kinda screwed already
al2o3-cr has quit [Client Quit]
<soahccc>
yeah I know but do you really do that? fully address every class everytime?
<apeiros>
dminuoso: if by "how you end up" you mean "callstack", then I disagree. Module.nesting depends on lexical locality.
<apeiros>
nesting is precisely [a.singleton_class], which is where you lexically are at
zautomata has joined #ruby
zautomata has quit [Changing host]
zautomata has joined #ruby
goatish has joined #ruby
<dminuoso>
apeiros: `a` being some dynamic value
<dminuoso>
this is kind of the definition of dynamic scope
<dminuoso>
`a` could even be any valid ruby expression
<apeiros>
ok, I guess we have a terminology issue here.
trautwein has quit [Quit: ZNC 1.6.5 - http://znc.in]
<dminuoso>
lexical scope means if you can resolve bindings or whatever based on lexical context, i.e. it can happen during compilation
<dminuoso>
kind of how variables are lexically resolved in ruby
<apeiros>
point is: you can't create a nesting (other than string eval, which makes some sense since that's the same, or at least immitating, how literal code is interpreted)
<apeiros>
the way your code is written matters, not how you invoke it. it's not the callstack which matters.
<dminuoso>
yes you can.
<apeiros>
I don't have any better terms to explain what I mean
<apeiros>
other than string eval?
<dminuoso>
class << a; class << b; class << c; /* execute code with your arbitrary fun nesting */ end; end; end;
<dminuoso>
Albeit, whether this is sensible is a different question entirely
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
yes, you're using syntax there. not callstack.
<dminuoso>
asm>> class << a; end
<ruby[bot]>
dminuoso: I have disassembled your code, the result is at https://eval.in/952971
<dminuoso>
apeiros: `class` is not just syntax, it compiles into `defineclass`, which is callstack.
RougeR has quit [Ping timeout: 240 seconds]
<apeiros>
*sob*
<apeiros>
which is *not reachable from ruby*
<dminuoso>
mmm
<dminuoso>
apeiros: I suppose you could just gen yarv ops? :P
<schneide_>
Hey guys, how can I check if I'm inside a ruby project and get the main project path
Papierkorb has left #ruby ["Konversation terminated!"]
<schneide_>
I'm thinking into searching for Gemfile backwards in every directory
<schneide_>
and if found one to return the patch where it's found
<schneide_>
but I'm new to ruby and don't know how to implement that
<apeiros>
what defines whether you're inside "a ruby project"?
<apeiros>
and what is "I"? the currently evaluated file? the working directory? something else?
bijan__ has joined #ruby
bijan__ is now known as bijan_awaaaay
bijan_awaaaay is now known as bijan__
<schneide_>
well as I said, the presence of Gemfile, if found in parents directories then return that one path
<apeiros>
ok. and the second part? parent directory of what?
<apeiros>
working directory?
<schneide_>
for example if I'm running the script from /home/me/project/ruby/lib/scripts/ and Gemfile lives in /home/me/project/ruby/Gemfile then the function should return /home/me/project/ruby
micalexander has quit []
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brendan- has joined #ruby
micalexander has joined #ruby
r3my has quit []
<schneide_>
it should recursively check every directory: /home/me/project/ruby/lib/scripts/, /home/me/project/ruby/lib/, /home/me/project/ruby/, /home/me/project/, /home/me/, /home/, / and raise something if no Gemfile found
<apeiros>
I'll repeat: every directory *relative to what*?
r3my has joined #ruby
<schneide_>
to the $(pwd)
<apeiros>
you can run /home/me/project/ruby/lib/scripts/foo from /
<apeiros>
Dir.getwd + File.dirname will help you. Pathname might have useful methods too.
bigblind has joined #ruby
ecuanaso has joined #ruby
ptr4ce has quit [Remote host closed the connection]
<schneide_>
hm ok
<schneide_>
is there a better terminal for ruby than irb?
<schneide_>
I use IPython when working with python and it's powerful
<schneide_>
is there something similar for ruby?
<apeiros>
I don't know ipython. but pry is generally regarded as the better irb
<dminuoso>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<dminuoso>
See. It's better.
<schneide_>
oh, thank you
<schneide_>
I had it installed already :D
<mikecmpbll>
i know style guides are just guides blah blah blah, but when i come across something that is discouraged, it makes me wonder if there's a better way to do it. i have a case statement with an empty `when` clause, e.g. https://gist.github.com/mikecmpbll/ca1a60c6621a2b7ef9b8b32a4bd3cc89
<mikecmpbll>
however, with the else clause the empty when clause becomes important.
dionysus69 has quit [Ping timeout: 265 seconds]
<mikecmpbll>
one of the causes in my when is genuinely a 'no-op' case..
<mikecmpbll>
cases*
ltt has joined #ruby
<apeiros>
mikecmpbll: there's IMO value in exhaustive listing of options. I really like how rust even enforces this.
<apeiros>
so noop when is IMO not just fine, but even good
<mikecmpbll>
i think i agree.
ferox_hacker has joined #ruby
<dminuoso>
mikecmpbll: I would argue it to be required.
<mikecmpbll>
:O ok i'll turn that cop off.
<apeiros>
as for alternatives: in case of only 3 options like in your example, if/elsif
<dminuoso>
mikecmpbll: Personally I view it from a totality point of view.
<dminuoso>
mikecmpbll: Code needs to be clear that its total.
schneide_ has quit [Remote host closed the connection]
<dminuoso>
Hiding empty when clauses hides bugs.
<mikecmpbll>
👍🏼
<apeiros>
i.e. if x == "foo" elsif x != "bar"; end
<dminuoso>
mikecmpbll: Good languages require either mathematical proof of totality, or at least produce a runtime crash if all patterns are exhausted.
<dminuoso>
apeiros: What does Rust do?
<apeiros>
but that's not exhaustive, and as a reader of such code I always wonder "is there intentionally no else, or is that a bug?"
apparition has quit [Quit: Bye]
safetypin has joined #ruby
<dminuoso>
mikecmpbll: For consistency I would do something like `when foo then nil` though
<apeiros>
mikecmpbll: I go as far as having a Kernel#unreachable in my code and doing `case …; else unreachable; end`
bijan_ has joined #ruby
<dminuoso>
Kernel#unreachable?
<apeiros>
noops I just leave a comment, as in your example: `when "foo"; # noop`
<dminuoso>
&ri Kernel#unreachable
<`derpy>
No results
<soahccc>
I have this mostly in iterations and I then to `when x then next`
<dminuoso>
You sir monkey patch Kernel?
* dminuoso
slaps apeiros
<apeiros>
of course
terens has quit [Ping timeout: 276 seconds]
<dminuoso>
Good lad.
woodruffw has quit [Ping timeout: 265 seconds]
phate408 has joined #ruby
<dminuoso>
apeiros: Yeah things become saner if you think of case/pattern matching as a kind of `mapping` rather than a big `if/elseif construct. Rust seems to enforce this nicely.
<dminuoso>
apeiros: Curious how good pattern matching works in Rust.
Psybur has joined #ruby
Psybur has joined #ruby
Psybur has quit [Changing host]
<apeiros>
dminuoso: so far pretty well. but I'm a very early beginner still.
<dminuoso>
apeiros: If Rust had HKTs, I'd rewrite my kernel in Rust immediately.
<dminuoso>
Today.
<apeiros>
your kernel?
<apeiros>
and what's HKT?
<dminuoso>
higher kinded types
ltt has quit [Ping timeout: 276 seconds]
woodruffw has joined #ruby
woodruffw has joined #ruby
woodruffw has quit [Changing host]
<dminuoso>
Yeah, the C++ kernel I wrote over a year ago
<apeiros>
we're sooo far OT I can't even tell :D
CrazyEddy has quit [Ping timeout: 248 seconds]
johnny56 has quit [Ping timeout: 256 seconds]
johnny56_ has joined #ruby
krawchyk has joined #ruby
white_lilies has quit [Ping timeout: 268 seconds]
kapil___ has joined #ruby
bijan_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
so_so_fresh has quit [Remote host closed the connection]
yohji has joined #ruby
t0m has quit [Quit: leaving]
pombreda has quit [Quit: Leaving]
<zleap>
hi
<zleap>
i am working through codecademy ruby course if I use
<zleap>
my_array.each { |num| puts num unless num % 2 !=0 }
<zleap>
so an array of 1,2,3,4 up to 10, I then use the above expression to pick out even numbers is the !=0 equal to zero on the remainder or not = to zero
ldnunes has joined #ruby
marmorkreb has joined #ruby
jottr has joined #ruby
<apeiros>
zleap: `unless` = `if not`, and `!= 0` means `is not equal to zero`
Serpent7776 has quit [Quit: Leaving]
darkhanb has joined #ruby
<zleap>
ok
jobewan has joined #ruby
<zleap>
so modulus is about the remainder in a division
<apeiros>
yes
<zleap>
so in this case if the remainder is not zero then print the numbers
<zleap>
2,4,6,8,10
<apeiros>
you have double negation there
<zleap>
ok
<apeiros>
if the remainder is not not equal to zero
<zleap>
ok
<zleap>
the code is
<zleap>
my_array.each { |num| puts num unless num % 2 !=0 }
<apeiros>
and yes, that's stupid, use `if num % 2 == 0` instead. much more readable.
<zleap>
yeah
x77686d has joined #ruby
<zleap>
my_array.each { |num| puts num unless num % 2 ==0 }
<apeiros>
because "reminder is not not equal" is "remainder is equal"
<zleap>
prints odd numbers
<zleap>
1,3,5,7,9
marmorkreb has quit [Ping timeout: 260 seconds]
<apeiros>
also newer rubies have .even? and .odd?
<apeiros>
so `puts num if num.even?`
<zleap>
ok
<zleap>
so what the origianl code said was if there is no remainder print the number
<zleap>
just in a way that was confusing
white_lilies has joined #ruby
<zleap>
thanks for that, i'll be back shortly
<apeiros>
mathematicians wouldn't like that phrasing ;-o
<apeiros>
(zero is not nothing)
<apeiros>
but yes, that's what the original code said.
<zleap>
thanks
<zleap>
back shortly, i'll get the hang of this stuff soon
<zleap>
so if using .odd i can have if num.odd print num
<zleap>
else
<apeiros>
not `odd`, `odd?`
<soahccc>
Anyone ever used net-scp? Is it any faster than net-sftp?
<apeiros>
and yes, you can use that in the condition instead of % 2 == 0
RubyTester00 has quit [Ping timeout: 256 seconds]
goatish has quit [Quit: bye]
gr33n7007h has joined #ruby
gr33n7007h is now known as al2o3-cr
n0m4d1c has joined #ruby
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Slyda1 has joined #ruby
zleap has quit [Ping timeout: 252 seconds]
zleap has joined #ruby
zleap has joined #ruby
zleap has quit [Changing host]
sanscoeur has joined #ruby
<soahccc>
Meh, net-scp is indeed way faster but still CPU bound... any idea on how to find out where the bottleneck is? I assume somewhere in net-ssh
jrafanie has joined #ruby
<soahccc>
Or an alternative plan for fast and secure data transfer? Already thought about exposing the files via https, don't really want to shell out in the script
sanscoeur has quit [Read error: Connection reset by peer]
alex`` has quit [Quit: WeeChat 2.0.1]
sanscoeur has joined #ruby
oo_func has joined #ruby
<za1b1tsu>
Hello, anybody using mongodb ruby driver? Do you need to do batch size it wont load all the data at once?
alfiemax has quit [Remote host closed the connection]
terens has joined #ruby
yohji has quit [Remote host closed the connection]
ldnunes has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
ldnunes has joined #ruby
schneide_ has joined #ruby
ptr4ce has joined #ruby
nowhereman_ has joined #ruby
white_lilies has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 240 seconds]
danguita has joined #ruby
xcyclist has quit [Ping timeout: 260 seconds]
schneide_ has quit [Ping timeout: 260 seconds]
alfiemax has joined #ruby
za1b1tsu has quit [Quit: Leaving]
schneide_ has joined #ruby
chouhoulis has joined #ruby
<dminuoso>
18:35 apeiros | mathematicians wouldn't like that phrasing ;-o
<dminuoso>
Id say given the context, these two statements are extensionally equivalent.
guest2 has joined #ruby
alfiemax has quit [Ping timeout: 265 seconds]
ptr4ce has quit [Read error: Connection reset by peer]
<dminuoso>
>> 1.step.lazy.select(&:odd?).take(10)
<ruby[bot]>
dminuoso: # => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:select>:take(10)> ...check link for more (https://eval.in/953260)
<dminuoso>
take that against 1.step(by: 2).lazy.take(10)
<havenwood>
Alchemists use Stream a lot more than I see Rubyists use Lazy Enumerators though.
<havenwood>
dminuoso: mm
<dminuoso>
Alchemists is the term for elixir programmers?
<havenwood>
yerp
nowhereman_ has quit [Remote host closed the connection]
nowhereman_ has joined #ruby
raynold has joined #ruby
<havenwood>
dminuoso: A bunch of the Elixir core team use emacs, and the most popular Elixir plugin is Alchemy.
drewmcmillan has joined #ruby
white_lilies has joined #ruby
cagomez has quit [Remote host closed the connection]
<dminuoso>
19:28 havenwood | Alchemists use Stream a lot more than I see Rubyists use Lazy Enumerators though.
<dminuoso>
Most Rubyists dont know much about FP so..
<havenwood>
aye
<dminuoso>
havenwood: Btw I finally grasped why I hate transducers.
cagomez has joined #ruby
<havenwood>
dminuoso: why?
<dminuoso>
Transducers merely exist because the execution model of Ruby is so bad, that you cant expect loop fusion to happen on its own.
<dminuoso>
So you kind of need to holds Ruby's hand.
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
oo_func has quit [Ping timeout: 276 seconds]
<dminuoso>
Also lack of currying and compose..
RubyTester00 has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
white_lilies has quit [Ping timeout: 248 seconds]
<dminuoso>
havenwood: I mean if you could do `sum * map(double) * filter(odd)` and expect this to be fused into a single loop, then I think that's tons more readable.
larcara has joined #ruby
white_lilies has joined #ruby
larcara has quit [Client Quit]
guille-moe has quit [Ping timeout: 240 seconds]
xuyuheng_ has joined #ruby
white_lilies has quit [Ping timeout: 248 seconds]
claudiuinberlin has joined #ruby
sameerynho has joined #ruby
xuyuheng_ has quit [Ping timeout: 268 seconds]
rippa has quit [Ping timeout: 248 seconds]
flak has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
nogic has joined #ruby
oo_func has joined #ruby
jottr has quit [Ping timeout: 260 seconds]
Slyda1 has quit [Ping timeout: 276 seconds]
bigblind has joined #ruby
chouhoulis has quit [Ping timeout: 248 seconds]
rrutkowski has joined #ruby
Dimik has joined #ruby
chouhoulis has joined #ruby
rrutkowski has quit [Remote host closed the connection]
alex`` has joined #ruby
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
white_lilies has joined #ruby
mtkd has quit [Ping timeout: 260 seconds]
rrutkowski has joined #ruby
c0mrad3 has quit [Quit: Connection closed for inactivity]
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
c0ncealed has quit [Remote host closed the connection]
mtkd has joined #ruby
minimalism has quit [Ping timeout: 248 seconds]
c0ncealed has joined #ruby
eckhardt has joined #ruby
bijan_ has joined #ruby
white_lilies has quit [Ping timeout: 252 seconds]
dinfuehr has quit [Ping timeout: 260 seconds]
cadillac_ has quit [Read error: Connection reset by peer]
dinfuehr has joined #ruby
chouhoulis has quit [Remote host closed the connection]
cadillac_ has quit [Read error: Connection reset by peer]
lytol has joined #ruby
ogres has joined #ruby
white_lilies has joined #ruby
jaruga_ has joined #ruby
Rapture has joined #ruby
nogic has quit [Ping timeout: 276 seconds]
schneide_ has quit [Remote host closed the connection]
white_lilies has quit [Ping timeout: 256 seconds]
marmorkreb has joined #ruby
dionysus69 has joined #ruby
cadillac_ has joined #ruby
schneide_ has joined #ruby
amatas_ has quit [Quit: amatas_]
marmorkreb has quit [Ping timeout: 240 seconds]
darkhanb_ has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
darkhanb has quit [Ping timeout: 260 seconds]
stormpack_ has quit [Quit: Leaving]
jottr has joined #ruby
ziadoz has quit [Quit: Bye!]
ziadoz has joined #ruby
cadillac_ has joined #ruby
ziadoz has quit [Client Quit]
alfiemax has quit [Remote host closed the connection]
ziadoz has joined #ruby
schneide_ has quit [Remote host closed the connection]
cadillac_ has quit [Read error: Connection reset by peer]
bigblind has quit [Ping timeout: 255 seconds]
white_lilies has joined #ruby
ramfjord has joined #ruby
nowhereman_ has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
darkhanb has joined #ruby
ziadoz has quit [Quit: Bye!]
bijan_ has quit [Quit: System has gone to sleep. ZZZzzz…]
darkhanb_ has quit [Ping timeout: 240 seconds]
cthulchu has joined #ruby
bigblind has joined #ruby
dionysus69 has quit [Ping timeout: 248 seconds]
cadillac_ has joined #ruby
ali_g has joined #ruby
cthulchu_ has quit [Ping timeout: 248 seconds]
vutral|kali has quit [Ping timeout: 255 seconds]
tcopeland has quit [Quit: tcopeland]
white_lilies has quit [Ping timeout: 240 seconds]
jottr has quit [Ping timeout: 240 seconds]
biberu has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
n0m4d1c has quit [Remote host closed the connection]
vutral|kali has joined #ruby
vutral|kali has quit [Changing host]
vutral|kali has joined #ruby
<ali_g>
hello all! not sure if proper channel but i'm using jekyll. I'm trying to put a list of items in 3 different divs. It shouldn't be so difficult but I'm printing a single concatenated line with all the items of the list and don't understand why. Can anybody help? here's the gist: https://gist.github.com/ponentesincausa/760b687acbd76c35665f4b87466a4b7f
jaruga_ has quit [Quit: jaruga_]
cadillac_ has quit [Read error: Connection reset by peer]
ams__ has quit [Quit: Connection closed for inactivity]
alfiemax has joined #ruby
marxarelli is now known as marxarelli|afk
Toggi3 has joined #ruby
leitz has joined #ruby
jobewan has quit [Ping timeout: 255 seconds]
cadillac_ has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
cadillac_ has joined #ruby
pastorinni has quit [Read error: Connection reset by peer]
pastorinni has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rasterick>
only 5 lines but nicer to see all on one page instead of here
alex`` has quit [Ping timeout: 256 seconds]
ahrs has quit [Ping timeout: 252 seconds]
<baweaver>
>> M = -> *a { -> b { a.each_with_index.all? { |e, i| e === b[i] || e == :* }}}; case ['Bob', 25]; when M[/^B/, :*] then 'B name!' else 'Not B!' end
<leitz>
Yeah, baweaver and apeiros are my external "genius Ruby brains".
<rasterick>
the situation is: building a prog, the config gives me a Rakefile instead of a Makefile ... i cannot seem to get Ruby rake or drake to compile the prog ... any help is appreciated
xuyuheng_ has joined #ruby
<leitz>
he's using bash on Winderz.
<leitz>
Not seeing the rakefile in there.
<baweaver>
What's the actual script?
sundhell_away is now known as sundhell
<rasterick>
the rakefile is in the root dir .. that is a subdir with the .rb files
jeffreylevesque has quit [Ping timeout: 260 seconds]
<rasterick>
what is actual script ?? i do not understand the question
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xuyuheng_ has quit [Ping timeout: 256 seconds]
<leitz>
rasterick, keep in mind they haven't read your set up and the error.
<mattwc>
I might just be blind, but does anyone know where the documentation for socket.gets is?
<baweaver>
mattwc: I'd bank on it using IO somehow
<apeiros>
using smybols as identifiers is fine. it also does not mean that the caller knows anything about how it's internally stored. all it knows is how the stat is identified.
<apeiros>
and you're correct. the *how* it is stored is none of the caller's business
<apeiros>
leitz: that looks correct. also IMO you should prefer a struct over a hash.
pastorinni has joined #ruby
<apeiros>
you can access the values just the same too
<leitz>
And I can mostly understand it. Tried the struct, it was beyond my ability to use well.
<apeiros>
i.e. `stat = :int; upp[stat]` will work just fine with upp being a Struct
synthroid has quit []
<apeiros>
and it'll properly complain if you make typos, i.e. `upp[:innt]` will raise
rrutkowski has quit [Quit: rrutkowski]
rrutkowski has joined #ruby
<apeiros>
(and it's a good first stop before making it a proper class, which should be your end goal)
jxf has quit []
axsuul has joined #ruby
mendel has quit []
jxf has joined #ruby
mendel has joined #ruby
<leitz>
Prefer upp to be simple, it's a part of Character class.
pastorinni has quit [Remote host closed the connection]
cdg has quit [Remote host closed the connection]
pastorinni has joined #ruby
<leitz>
Current use case is that a task will pass in the chacracter and the stat that would modify the roll, and the method would return the modifier.
cdg has joined #ruby
chouhoul_ has joined #ruby
cardoni has quit []
cardoni has joined #ruby
Vapez has quit [Remote host closed the connection]
<apeiros>
leitz: simple can take different forms. IMO a struct is far simpler than a hash.
minimalism has joined #ruby
<apeiros>
the other aspects of simple will become more visible when you make upp a full class and don't have to distribute knowledge about how it works, and instead can organize it within said class.
chouhoulis has quit [Ping timeout: 248 seconds]
Tony-St4rk has quit []
Tony-St4rk has joined #ruby
<leitz>
apeiros, I'm trying to figure out how to show old code on Github. The upp was a struct and I was having issues with needing to define methods inside and outside of the struct to do the same thing.
John_Ivan has quit [Quit: Leaving]
<leitz>
Never fear, I have plenty of challenges lined up for the group, mentally planning my first "large app".
John_Ivan has joined #ruby
John_Ivan has joined #ruby
John_Ivan has quit [Changing host]
<rasterick>
... dons his coding gloves ...
zautomata has quit [Ping timeout: 252 seconds]
John_Ivan has quit [Remote host closed the connection]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chouhoul_ has quit [Remote host closed the connection]
John_Ivan has joined #ruby
John_Ivan has joined #ruby
John_Ivan has quit [Changing host]
chouhoulis has joined #ruby
Toggi3 has quit [Ping timeout: 268 seconds]
alfiemax has joined #ruby
kireevco has quit []
nogic has quit [Ping timeout: 265 seconds]
<leitz>
Philosophical question: "How much magic to include?"
rwb has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oo_func>
What kind of magic are you talking about?
<leitz>
If you rank Ruby skill on a 1-10, I may be growing into a 2. There's a lot of 0's and 1's who don't yet know the fun of Ruby so I try to encourage.
<rasterick>
i think i am at the -0 level right now
<leitz>
rasterick, a Ruby method returns the last result. In other languages that might be "return 3". Which works in Ruby, but you don't have to.
<leitz>
Hey, I have about three months of experience gained over the last couple years.
<apeiros>
leitz: any sufficiently analyzed magic is indistuingishable from science
nadir has joined #ruby
<rasterick>
... offers lietz his top hat, wand, and white rabbie for the magic show
<apeiros>
but regarding code - it depends on the audience. if you're the sole developer, that audience is your future you.
<rasterick>
the pretty female assistant stays with me tho *grin*
<leitz>
Yeah, that's why I use {} vice "do...end"
<apeiros>
i.e., include as much magic as you think you can understand one month, three months, 6 months, one year from now.
<apeiros>
s/vice/versus/
<apeiros>
hm
<leitz>
vice can also mean versus.
<apeiros>
though that makes little sense too in that phrase?
alfiemax has joined #ruby
<leitz>
Sorry, though, it's an older English'ism.
<leitz>
I'm older and Americanism'd.
<apeiros>
o0
<leitz>
If rasterick gets the pretty female assistant I get to keep a vice or two.
<apeiros>
you're thinking of vice versa, I think
* leitz
pities those who have to learn English...
<leitz>
"This thing, vice that thing" == "This thing, versus that thing."
<apeiros>
but I don't speak english natively, much less old english, so maybe I'm wrong.
<leitz>
English has its good points. "Follow the Rules of English" isn't one of them.
Ishido has quit [Read error: Connection reset by peer]
axsuul has quit [Ping timeout: 248 seconds]
<rasterick>
.... gets the lexicon ready ...
eckhardt has joined #ruby
ecuanaso has joined #ruby
nowhereman_ has joined #ruby
<leitz>
rasterick, don't worry. I have tried to learn other human languages. Because of that I try to keep my English direct and clear.
boxrick has quit []
flak has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
marmorkreb has joined #ruby
nowhere_man has joined #ruby
* leitz
has heard American college students with native English worse than aperios'...
boxrick has joined #ruby
<apeiros>
thanks, I guess?
jabreity has quit []
jabreity has joined #ruby
<leitz>
You are welcome. Your English is very good.
<leitz>
In the entire time I have known you I have seen less than half a dozen phrases that made me think you were not a native speaker.
<leitz>
Most American college students wouldn't get "vice" either.
<s1detracking>
if i learn ruby do i get a pretty female assistant
nowhereman_ has quit [Ping timeout: 248 seconds]
<s1detracking>
HEEEEEEEEEEEEES A REEEEEEEEEEEEEEEEEEL nowhere_man
<leitz>
s1detracking, maybe. At the old Linux World they had models in BSD Demon suits.
<s1detracking>
hot
<leitz>
Long ago.
marmorkreb has quit [Ping timeout: 265 seconds]
<qyliss>
I’m native Scottish English and have never heard “vice”
<s1detracking>
any linux expos nowadays?
amirite has quit [Ping timeout: 260 seconds]
andersh has quit []
andersh has joined #ruby
clemens3 has quit [Ping timeout: 248 seconds]
<leitz>
qyliss, I'm an introvert with a speech impediment. As a kid I read a lot of older books. Much easier on the ego.
<apeiros>
division by zero in float domain is treated as if it was a limes, and hence results in ±∞
peteretep has quit []
<rasterick>
ah, thank you apeiros
xuyuheng_ has joined #ruby
<apeiros>
there are a couple of other operations which result in NaN
peteretep has joined #ruby
<apeiros>
though IMO a language like ruby should rather raise :-|
<rasterick>
... gets the NAN lexicon out ...
n0m4d1c has quit [Remote host closed the connection]
ogres has quit [Quit: Connection closed for inactivity]
cagomez has joined #ruby
<rasterick>
... wades thru all the prime numbers ...
<apeiros>
that'll take a while
<rasterick>
Indeed!
<rasterick>
remember friends in past wrote linux script that would find prime numbers ... runs for months!, never ends
<apeiros>
oh, then they wrote it well, means they implemented it in a way to exceed native integer representation (or terrible, because after months it wouldn't reach those limits)
<rasterick>
btw, leitz, Ruby works in windows cmd prompt for me just as well
<apeiros>
or they used ruby or a language similarly natively being able to go beyond 64bit ints :D
<rasterick>
prob so, these were some very intelligent linux geeks from SoCal
<rasterick>
as best i remember it was a linux script , sorta like a prog i guess
alfiemax has joined #ruby
<apeiros>
well, a linux script can be in about any language ;-)
xuyuheng_ has quit [Ping timeout: 260 seconds]
<rasterick>
oh, ok. they would for fun write smaller scripts to do tasks , eg.. parse a dir and sort by size,date, etc.
reber has quit [Remote host closed the connection]
<rasterick>
these were command line scripts , too long ago to remember actual chars
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]