travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1665 (master - c923614 : Ary Borenszweig): The build was broken.
travis-ci has left #crystal-lang [#crystal-lang]
waj has joined #crystal-lang
waj1 has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1666 (master - c257156 : Ary Borenszweig): The build was fixed.
travis-ci has left #crystal-lang [#crystal-lang]
whomp has joined #crystal-lang
<whomp> this project sounds awesome
<waj1> Thanks! :)
<waj1> did you try the compiler already?
<whomp> waj1, not yet, just looked at the premise and the benchmarks
<whomp> it would add some cred to do the computer language benchmark game benchmarks
waj1 has quit [Quit: Leaving.]
e_dub has quit [Quit: ZZZzzz…]
waj has joined #crystal-lang
<waj> we actually have one of the examples extracted from those benchmarks: https://github.com/manastech/crystal/blob/master/samples/nbodies.cr
<waj> I just compared the nbodies example in my machine and Crystal's take 7.5 seconds while the C++ #8 takes 4.2 seconds
<waj> Not bad considering that the C++ version makes explicit calls to MMX instructions ;)
<waj> Not MMX… SSE2'
<jhass> mmh, can we steal slash's yada-yada operator? https://github.com/slash-lang/web/blob/master/pages/home.md#features :P
<waj> don't you prefer to use "abstract" and have compile time errors?
<jhass> I prefer mixins over inheritance but that's another story
<jhass> and all I'm getting at is that it would be funny construct for code examples. if foo; ...; else do_bar(); end;
<jhass> ;)
<jhass> abstract is "I never intend to implement this, you should". yada-yada is "I will implement this later/I have no idea what to place here but there should be something there"
<waj> I see
<jhass> so any yada-yada could just abort the compiler
<waj> Yup, it looks funny :)
Rylee has quit [Max SendQ exceeded]
Rylee has joined #crystal-lang
waj has quit [Quit: Leaving.]
whomp has quit [Ping timeout: 258 seconds]
waj has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
dts has quit [Read error: Connection reset by peer]
dts has joined #crystal-lang
dts has quit [Ping timeout: 240 seconds]
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1667 (master - c07e738 : Juan Wajnerman): The build passed.
travis-ci has left #crystal-lang [#crystal-lang]
shama has joined #crystal-lang
dts has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 250 seconds]
<jnoah> a couple things about strings (and arrays). can strings be treated like character arrays and given arrays, can they be sliced like arrays in python? e.g. my_string[1:] would result in all, but the first character of my_string
<jnoah> my_string = "bob"; print my_string[1:] # ob
<jnoah> if not, how would one do something similar?
asterite has joined #crystal-lang
asterite has quit [Remote host closed the connection]
asterite has joined #crystal-lang
asterite1 has joined #crystal-lang
<waj> a String is represented in memory as UTF-8
<waj> you can iterate chars in a String using "each_char" for example
<jnoah> but you cannot index into a string?
<jnoah> or slice a string?
<waj> yes
<waj> just like in Ruby
<waj> mystring[1..-1]
<jnoah> ah, alright. thanks :)
* jnoah is not very familiar with ruby
<jnoah> just went through the codecademy stuff today. my language of choice is python :/
<waj> in Ruby (and Crystal) mystring[1..-1] would return "ob" for your example
<waj> and mystring[1..-2] would return just "o"
asterite has quit [Ping timeout: 244 seconds]
<jnoah> awesome, thanks! yeah, i just wrote up a test.cr to try it out
<jnoah> worked like a charm
<waj> I need to get some sleep. Thank you for joining us! ;)
dts has quit [Read error: Connection reset by peer]
waj has quit [Quit: Leaving.]
asterite1 has quit [Quit: Leaving.]
dts has joined #crystal-lang
<jnoah> what is all the .crystal/[...]/test.cr/ stuff?
dts has quit [Read error: Connection reset by peer]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
e_dub has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 245 seconds]
<jnoah> how does one pass arguments to crystal scripts?
<jnoah> scratch that. also, O_O i just found the browser option for crystal. that is exciting
<jnoah> ohey, can crystal not read files yet?
<jnoah> nvm, ruby calls it readlines while crystal calls it read_lines
<jnoah> I understand why the write fails, but the File.each_line part is failing... http://pastebin.com/xXsP1yDY - what am I doing wrong there?
<jnoah> http://pastebin.com/5DTxWx2D ^ with debug output
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 265 seconds]
dts has joined #crystal-lang
dts has quit [Read error: Connection reset by peer]
b_lumenkraft has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 265 seconds]
CrystalIRC has joined #crystal-lang
<CrystalIRC> Hello, this is from a crystal application!
<jnoah> yes!
<jnoah> it works :D
<jnoah> I'm starting a *very* basic IRCClient lib
<jnoah> hoping to have it heavily based off twisted's IRC
CrystalIRC has quit [Remote host closed the connection]
whomp has joined #crystal-lang
dts has joined #crystal-lang
whomp has quit [Ping timeout: 265 seconds]
e_dub has quit [Quit: ZZZzzz…]
MrSamuel has joined #crystal-lang
<MrSamuel> hi
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 265 seconds]
kostya has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1668 (master - d575094 : Ary Borenszweig): The build passed.
travis-ci has left #crystal-lang [#crystal-lang]
kostya has quit [Remote host closed the connection]
asterite has joined #crystal-lang
<asterite> jnoah: wow, one moment you had issues with File.read_lines, the other you sent a message to this channel from a program :-P
<asterite> The error you got, “undefined constant T (did you mean ‘C’?)”… it’s very confusing, it should say something like “Array is generic”. We’ll improve it
asterite has quit [Client Quit]
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 240 seconds]
kostya has joined #crystal-lang
e_dub has joined #crystal-lang
e_dub has quit [Client Quit]
mverzilli has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 264 seconds]
e_dub has joined #crystal-lang
e_dub has quit [Read error: Connection reset by peer]
e_dub has joined #crystal-lang
e_dub has quit [Quit: ZZZzzz…]
bcardiff has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1669 (master - 5a99c4d : Ary Borenszweig): The build was broken.
travis-ci has left #crystal-lang [#crystal-lang]
b_lumenkraft has quit [Quit: b_lumenkraft]
b_lumenkraft has joined #crystal-lang
e_dub has joined #crystal-lang
e_dub has quit [Client Quit]
mverzilli has quit [Quit: mverzilli]
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1669 (master - 5a99c4d : Ary Borenszweig): The build has errored.
travis-ci has left #crystal-lang [#crystal-lang]
e_dub has joined #crystal-lang
whomp has joined #crystal-lang
xiy has joined #crystal-lang
kostya has quit [Quit: Leaving]
bcardiff has quit [Quit: Leaving.]
<xiy> ahoy o/ - anyone know how I can inherit from a generic type? (Foo < Array(T))
e_dub has quit [Quit: ZZZzzz…]
<jhass> are on latest master?
e_dub has joined #crystal-lang
bcardiff has joined #crystal-lang
<whomp> you guys should post about this project on /r/ruby
<whomp> then maybe spark some conversation in #ruby :)
<xiy> ah thanks @jhass :)
waj has joined #crystal-lang
<jnoah> i still don't get how to use read_lines. :/ it doesn't follow the same conventions as Ruby.
<jhass> jnoah: #read_lines retuns an Array(String), there's a #each_line that yields
<jnoah> yeah, i tried that too which was giving me some issues as well
<jhass> it's hard to help you if you stay that vague
<jnoah> haha, sorry. i'm on my phone atm and can't get logs.
<jnoah> i can a bit later
<jnoah> (and was going to)
<jhass> great :)
xiy has quit [Ping timeout: 256 seconds]
b_lumenkraft has quit [Quit: b_lumenkraft]
e_dub has quit [Quit: ZZZzzz…]
<jnoah> jhass: it looks like each_line takes a file name. should it be used like File.each_line(filename) {...} ?
<jnoah> or does a file object need to be instantiated first?
<jhass> both should work
<jhass> File.each_line(filename) is a shortcut to File.open(filename) do |file| file.each_line end
shama has joined #crystal-lang
b_lumenkraft has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1670 (master - 98eed7b : Ary Borenszweig): The build passed.
travis-ci has left #crystal-lang [#crystal-lang]
e_dub has joined #crystal-lang
<jnoah> it looks like String#scan is returning a MatchData object rather than an array
<jhass> Yes, that's an intended change
<jnoah> http://pastebin.com/dgWc1aUt works minus the MatchData bit
<jnoah> jhass: oh? alright. what's the reasoning behind that?
<jhass> I don't remember the details, something about the type interference/being statically typed
<jhass> and for that example regexp is a bit overkill IMO
<jhass> you can just line[0, line_length]
<jhass> Also always use the block form of File.open, so you don't forget to close it
mverzilli has joined #crystal-lang
Meows has joined #crystal-lang
e_dub has quit [Quit: ZZZzzz…]
<jnoah> jhass: does the in_file not get automatically closed?
<jhass> it probably will when the GC frees the object, but it's bad practice to rely on that
<jhass> it's not an issue in such short lived programs
<jhass> but in long running ones, if you fail to loose all references, you'll not only leak memory but also FDs
<jhass> and on most distributions you can only have 1024 of those at the same time
<jhass> by default
<jnoah> ok. i figured it would close since each_line does the opening for you
<jhass> I'm talking about out_file
<jnoah> ah, i remembered to close it!. :) but yeah, i know what you mean
<jhass> oh, I didn't notice you used .new instead of .open, sorry for confusing you there
e_dub has joined #crystal-lang
Meows has quit [Client Quit]
<jnoah> jhass: in ruby/crystal what exactly is 'self'? codecademy didn't go over that
<jhass> what other languages do you know?
<jnoah> python
<jnoah> javascript
<jnoah> haskell
<jnoah> those are my main ones anyway
asterite has joined #crystal-lang
<jhass> same thing as in python then, it's just implicitly there
<jhass> basically in python everything is a function and method get their object as parameter, in ruby/crystal everything is a method instead
<jnoah> ah, alright
<jnoah> huh, getter instead of attr_reader. that's easier
<asterite> jnoah: how did you find out that you had to use a generic array from the “undefined constant T” error?
e_dub has quit [Quit: ZZZzzz…]
e_dub has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
rpag has quit [Ping timeout: 240 seconds]
bcardiff has joined #crystal-lang
mverzilli has quit [Quit: mverzilli]
mverzilli has joined #crystal-lang
dts is now known as WillBot
WillBot is now known as dts
e_dub has quit [Quit: ZZZzzz…]
mverzilli has quit [Quit: mverzilli]
dts has quit [Read error: Connection reset by peer]
whomp has quit [Ping timeout: 255 seconds]
b_lumenkraft has quit [Quit: b_lumenkraft]
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
whomp has joined #crystal-lang
<jnoah> i think that Error message is just plain wrong. I'm pretty sure the error was coming from line 7 of that
<jnoah> specifically "ine.scan(/.length/).each"
<asterite> It’s actually in Array.new
<jnoah> should have been "scan(/.#{length}/).each"
<asterite> The problem is that we define new like this: def self.new; Array(T).allocate; … end
<asterite> so that’s why it doesn’t find T, but that is buried in the compiler… I’ll improve the error message somehow
<jnoah> lol - looking at that, there are quite a few syntax errors as well
<jnoah> #18 should not have 'for'
<asterite> Oh, right
<jnoah> #19 is syntactically correct, but won't work. I wanted 'puts' not 'write'
<jnoah> anyway, i rewrote it from scratch for a few reasons
e_dub has joined #crystal-lang
<asterite> It really amazes me that you came here knowing python but not ruby… you might be the first one :)
<jnoah> i've played a bit with chef, and really needed to learn ruby to chef better. so i figured why not :)
e_dub has quit [Read error: Connection reset by peer]
e_dub has joined #crystal-lang
mverzilli has joined #crystal-lang
<asterite> :)
bcardiff has quit [Quit: Leaving.]
asterite has quit [Quit: asterite]
asterite has joined #crystal-lang
dts has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1671 (master - e2de39a : Ary Borenszweig): The build was broken.
travis-ci has left #crystal-lang [#crystal-lang]
whomp has quit [Ping timeout: 258 seconds]
<jnoah> asterite: what is an it/end block for?
<jhass> it's a test
<jhass> for the testsuite
<jhass> it is just a method that takes a block
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1671 (master - e2de39a : Ary Borenszweig): The build was broken.
travis-ci has left #crystal-lang [#crystal-lang]
whomp has joined #crystal-lang
asterite has quit [Quit: asterite]
waj has quit [Quit: Leaving.]