RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
greenbigfrog has quit [Read error: Connection reset by peer]
<oprypin> bew, relyks, instead of that you can just use 'p'
<oprypin> (p [1,2,3]).sum
<oprypin> puts and pp might work the same way but i don't remember
hightower4 has joined #crystal-lang
<hightower4> Hey, how can I split a string "a:b" on ":" but keep ":" in the results? I.e. I want the split to result in ["a", ":", "b"], rather than in ["a", "b"]. (Something similar to what splitting on word boundaries would do (using \b), but I need it for a few select characters, not everything that \b would match
<hightower4> Ah, seems like look-behind would work, e.g. (?<=\:)
<oprypin> do you really want them there? you know that every 2nd item is :
<oprypin> use that fact in the consumer code
<hightower4> oprypin, yes but I've simplified the example
<oprypin> ok. but you need both lookahead and lookbehind
<FromGitter> <straight-shoota> `"a:b".split(/(?<=:)|(?=:)/)`
<oprypin> Python has a nice way to keep separator
<oprypin> re.split("(:)", "a:b")
<oprypin> the capturing group makes the difference
<hightower4> oprypin, yeah, was just about to say that, it appears the same trick works in Crystal too
<oprypin> no way
cremes has quit [Quit: cremes]
<FromGitter> <straight-shoota> oh nice
<FromGitter> <straight-shoota> `"a:b".split(/(:)/)`
<hightower4> yep
<hightower4> pretty awesome
<oprypin> that should be documented
relyks has quit [Ping timeout: 248 seconds]
greenbigfrog has joined #crystal-lang
eperez has quit [Ping timeout: 255 seconds]
eperez has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
cremes has joined #crystal-lang
<hightower4> Remind me please, what is alternative way of specifying double quotes? %Q{} or something?
snsei has joined #crystal-lang
<hightower4> Oh just %{} it seems
pleiosaur has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
cremes has quit [Quit: cremes]
<FromGitter> <asterite> hightower4: there's also String#partition (but works with one separator, maybe that's what you wanted, thought)
cremes has joined #crystal-lang
<hightower4> asterite: thanks, multiple matches are required in this case
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
raz has quit [Quit: *fump*]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 264 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 256 seconds]
eperez has joined #crystal-lang
rohitpaulk has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
<FromGitter> <codenoid> morning all
eperez has joined #crystal-lang
<FromGitter> <fridgerator> evening ;)
<FromGitter> <codenoid> haha timezone ^^
rohitpaulk has quit [Ping timeout: 252 seconds]
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
eperez has quit [Ping timeout: 264 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 264 seconds]
eperez has joined #crystal-lang
faustinoaq has quit [Remote host closed the connection]
faustinoaq has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
hightower has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
hightower4 has quit [Ping timeout: 255 seconds]
eperez has quit [Ping timeout: 268 seconds]
eperez has joined #crystal-lang
relyks has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
raz has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
return0e has joined #crystal-lang
<hightower> is there a 'case' syntax for matching if term is present in array?
eperez has quit [Ping timeout: 264 seconds]
eperez has joined #crystal-lang
<hightower> Is "string".lchop.rchop faster/better than "string"[1..-2] ?
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
<FromGitter> <bew> No
<FromGitter> <bew> The first will make 2 string and some search, the second will make 1 string, no search involved
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
rohitpaulk has quit [Ping timeout: 264 seconds]
handicraftsman has quit [Remote host closed the connection]
faustinoaq has joined #crystal-lang
eperez has quit [Ping timeout: 264 seconds]
eperez has joined #crystal-lang
faustinoaq has quit [Ping timeout: 248 seconds]
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
ioauthorize has joined #crystal-lang
<ioauthorize> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ LRH IS LIVE NOW!! TODAYS EDITION SLIMER GETS FUCKED IN VEGAS!! https://www.youtube.com/user/l0de/live CALL 315-505-4666 mvyofidjc: ilovezfs_ yopp pabs ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
ioauthorize has quit [Remote host closed the connection]
<FromGitter> <codenoid> oh fuck
<FromGitter> <codenoid> somebody in IRC
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
woodruffw has quit [Excess Flood]
eperez has quit [Ping timeout: 252 seconds]
woodruffw has joined #crystal-lang
woodruffw has quit [Changing host]
woodruffw has joined #crystal-lang
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
jnyw has quit [Ping timeout: 260 seconds]
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
illyohs has quit [Ping timeout: 240 seconds]
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
eperez has quit [Ping timeout: 268 seconds]
eperez has joined #crystal-lang
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> RX14
<FromGitter> <bararchy> Spam alert
eperez has quit [Ping timeout: 248 seconds]
rohitpaulk has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
ashirase has quit [Ping timeout: 255 seconds]
jnyw has joined #crystal-lang
ashirase has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 255 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 246 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 256 seconds]
eperez has joined #crystal-lang
relyks has quit [Quit: relyks]
eperez has quit [Ping timeout: 263 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 264 seconds]
eperez has joined #crystal-lang
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
rohitpaulk has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
rohitpaulk has quit [Ping timeout: 268 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
jnyw has quit [Quit: WeeChat 2.0.1]
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
snsei has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
eperez has quit [Ping timeout: 255 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
alex`` has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
snsei has joined #crystal-lang
fnux has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
fnux has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 268 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
rohitpaulk has joined #crystal-lang
eperez has quit [Ping timeout: 246 seconds]
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
eperez has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
eperez has quit [Ping timeout: 256 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 252 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
hightower2 has quit [Ping timeout: 276 seconds]
hightower2 has joined #crystal-lang
eperez has quit [Ping timeout: 246 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
<Groogy> Good morning! o/
<FromGitter> <codenoid> good night Groogy ~
<Groogy> haha lol
rohitpaulk has quit [Ping timeout: 246 seconds]
eperez has quit [Ping timeout: 260 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
<hightower> mm, do I see it right that spec/ is now by default placed in src/? Why?
<hightower> hm, no, all good
<crystal-gh> [crystal] RX14 closed pull request #5065: Add assert macro (master...feature/assert) https://git.io/vdZwY
rohitpaulk has quit [Ping timeout: 240 seconds]
<hightower> Is there a 'case' syntax which allows me to match if 'case' value is part of some array? Like case my_word; when array.includes_it
eperez has joined #crystal-lang
<Groogy> don't think so?
<Groogy> why wouldn't you just do if array.includes? my_word
<Groogy> ?
dragonkh has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
<hightower> Because this is just one of the cases. I have a whole list of 'whens'
<hightower> And if I would need to alternate between ifs and cases, and make sure that if some if or when was matched, further processing would stop (just like a single case..end list of statements would do)
<hightower> s/And if/And/
<Groogy> you mean like if/elsif/else/end?
<Groogy> you could also just put the things you want to match against iwth an array and then cross check the arrays
<Groogy> make it more procedural
<Groogy> You also have some nifty operators like ~ to get the difference between two arrays etc.
<Groogy> Eh I mean &
<Groogy> & will get you the intersection of two arrays
<Groogy> meaning you get only the elements that match in both
<hightower> Groogy, I mean, I can write case str; when "X", "Y", "Z", but apparently can't write case str; when some_array
<Groogy> yeah because case str will be matching str with "X", "Y", "Z"
<Groogy> as if you were writing an if/elsif etc.
<Groogy> Either way what are you trying to compare?
<Groogy> because when some_array doesn't really make sense since it would be the same as just checking some_array.includes? str
<hightower> Yes I agree with you, but I said I'd prefer the case..end method because then I can have a long list of 'when's, rather than having to do some if-elses, then some case-ends, then some if-elses etc.
<Groogy> yeah but all of those cases have the same data type right?
<Groogy> put it into a data structure and loop over it and then delegate to functions what to do
<Groogy> it's gona be way prettier anyway
<crystal-gh> [crystal] RX14 opened pull request #5553: Simplify Crystal::System interface by adding File.stat? and lstat? (master...feature/file-stat-cleanup) https://git.io/vNkPU
<hightower> I'll just convert the whole thing to if-elses
<Groogy> avoid primitive obsession ;D
<Groogy> eh no? It would be a loop where you delegate to an object what to do
<Groogy> or a struct
<Groogy> "Here's the data, do something with it" and it decides if it fits for it or not
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
DTZUZO has joined #crystal-lang
eperez has quit [Ping timeout: 256 seconds]
<FromGitter> <bew> Looks like he's doing some other posts on Crystal: https://emanuelpeg.blogspot.fr/search/label/Crystal?m=1
<Groogy> why are there pics of girls on the posts though? :confused:
<FromGitter> <bew> No idea ˆˆ
rohitpaulk has quit [Ping timeout: 248 seconds]
<lvmbdv> might be an SEO thing
<lvmbdv> and that blog might be stealing post text from other geniune posts
<lvmbdv> ^ long shot
<lvmbdv> or just poor aesthetics
DTZUZO has quit [Ping timeout: 265 seconds]
<Groogy> or 13 years old? ¯\(°_o)/¯
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 248 seconds]
faustinoaq_ has joined #crystal-lang
<faustinoaq_> or just a java developer with a busy job :)
faustinoaq_ has quit [Client Quit]
rohitpaulk has joined #crystal-lang
cbass has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
eperez has joined #crystal-lang
ashirase has quit [Ping timeout: 248 seconds]
tilpner has quit [Read error: Connection reset by peer]
tilpner has joined #crystal-lang
ashirase has joined #crystal-lang
Groogy has quit [Quit: WeeChat 2.0]
eperez has quit [Ping timeout: 265 seconds]
<lvmbdv> sorry if this is asked a lot here, are there any more documentation on recursive types (aliases)?
DTZUZO has joined #crystal-lang
dragonkh has joined #crystal-lang
DTZUZO has quit [Ping timeout: 260 seconds]
alex`` has quit [Ping timeout: 252 seconds]
alex`` has joined #crystal-lang
jdnoodle has quit [Quit: leaving]
A124 has quit [Ping timeout: 255 seconds]
eperez has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Ping timeout: 264 seconds]
Ven`` has joined #crystal-lang
A124 has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9]
Ven`` has quit [Ping timeout: 276 seconds]
Ven`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
Ven`` has quit [Ping timeout: 265 seconds]
Ven`` has joined #crystal-lang
fellow has joined #crystal-lang
snsei has joined #crystal-lang
<fellow> with #sort you can sort arrays by the alphabet. So im sure theres some Const in crystal which is having the alphabet which is used by #sort. wheres this const?
<RX14> fellow, there's no such array
<RX14> ASCII defines that the way characters are represented as numbers is already ordered by the alphabet
<fellow> oooh..
<RX14> so if you order by numerical order you order by lexical order too
fellow has quit [Quit: Page closed]
<FromGitter> <bew> are you sure that what you meant?
<RX14> yes
<RX14> a component, i.e. what you get if you split by /, is a file
<RX14> if you have a file /a/b/c, then c is a file
<RX14> therefore if you have /a/b/c/d then c is a file, and it is a component
sz0 has joined #crystal-lang
<RX14> and you get ENOTDIR
<FromGitter> <bew> aaah ok I get it, ty!
<RX14> it's basically borrowed from how it says it in the manpage
<RX14> ENOTDIR
<RX14> A component of the path prefix of pathname is not a directory.
<FromGitter> <bew> makes sense
cbass has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
Ven`` has quit [Ping timeout: 248 seconds]
asterite_ has joined #crystal-lang
eperez has quit [Ping timeout: 260 seconds]
hmans has quit [*.net *.split]
byteflame has quit [*.net *.split]
asterite has quit [*.net *.split]
asterite_ is now known as asterite
Ven`` has joined #crystal-lang
<dragonkh> can I do a multiline string in crystal?
yopp has quit [Ping timeout: 240 seconds]
<dragonkh> do I just use the normal double quotes but put multilines
<FromGitter> <bew> and just below, Heredoc
<dragonkh> ah yeah cool I see thanks
snsei has joined #crystal-lang
<dragonkh> heredoc looks more readable
<FromGitter> <bew> yeah it's very handy
yopp has joined #crystal-lang
<ua> guys, quick question
<ua> why 't' == "t" gives me false ?
<FromGitter> <bew> because `'t'` is a Char, and `"t"` is a String
<FromGitter> <bew> these are different types, and represent sth different
<ua> mkay
<ua> havent read the docs
<FromGitter> <bew> you should ^^
<ua> just assumed its all String
rohitpaulk has joined #crystal-lang
<ua> ok thanks
snsei has quit [Ping timeout: 265 seconds]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eperez has joined #crystal-lang
byteflame has joined #crystal-lang
hmans has joined #crystal-lang
eperez has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
<lvmbdv> crystal is so damn comfy
<lvmbdv> thank you all
<lvmbdv> just squeezed some experimentation before bed time
<lvmbdv> good night~
<ua> yeah its awesome, i dont even feel bad about betraying ruby
<ua> cheating on?
<ua> xD
<FromGitter> <bew> Why does this compiles? `Pointer(Int32).null.as(Array(Bool))` I would expect the `.as` to say that I can't cast `Pointer(Int32)` to `Array(Bool)`
<FromGitter> <bew> note: `Int32` & `Array(Bool)` are randomly choosen types
<oprypin> bew, Pointer.as is a special case that does no checking
<oprypin> it's needed for low level operations
<oprypin> see also: Box
<FromGitter> <bew> oh ok, but now we have `.unsafe_as` I think that `Pointer#as` should be normal, and if really needed, `unsafe_as` should be used
eperez has quit [Ping timeout: 265 seconds]
eperez has joined #crystal-lang
eperez has quit [Ping timeout: 240 seconds]
eperez has joined #crystal-lang
<FromGitter> <bew> well no, nvm (`unsafe_as` is itself a method, implemented using this unchecked `as` on pointer)
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
eperez has quit [Ping timeout: 268 seconds]
eperez has joined #crystal-lang
<RX14> close to getting file_spec running on windows :)
jnyw has joined #crystal-lang