ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.4 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
onethirtyfive has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 260 seconds]
eizua has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
pawnbox has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
pawnbox has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
mrslowly has joined #crystal-lang
<mrslowly> is there a way to instantiate a 2D array in Crystal?
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 248 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
mrslowly has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
<willl> > Array(Array(Int32)).new
<willl> oops I forgot how to do debot
pawnbox_ has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
bjz has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter> <raydf> @mrslowly, using an array of named tuples if you now the "columns" structure, may be more useful. ⏎ a = [] of NamedTuple(col1: String, col2: Int32) ⏎ a << {col1: "test", col2: 1} ⏎ https://play.crystal-lang.org/#/r/1bkm [https://gitter.im/crystal-lang/crystal?at=57f9c7e168f560d80cecbd52]
<FromGitter> <raydf> For instantiation in code: ⏎ ⏎ a = [] of Array(Int32) ⏎ a << [1,2,3] ⏎ pp ahttps://play.crystal-lang.org/#/r/1bkm [https://gitter.im/crystal-lang/crystal?at=57f9c84b84f1db061494af35]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
<FromGitter> <raydf> Typo* now should be know the "columns" :)
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
bjz has quit [Ping timeout: 248 seconds]
bjz has joined #crystal-lang
eizua has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
onethirtyfive has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden opened pull request #3397: Fix: allow i486 and i586 for target machine ABI (master...fix-i486-i586-targets) https://git.io/vPBsm
onethirtyfive has quit [Ping timeout: 240 seconds]
<BlaXpirit> wtf is going on here https://carc.in/#/r/1bky
<BlaXpirit> 1000000 times I increment one of the indices in an array
<FromGitter> <benoist> overflow?
<BlaXpirit> and then the sum of the array is 1007381
<BlaXpirit> well I don't think it is overflow
<FromGitter> <benoist> oh right I see what you mean ;)
<BlaXpirit> but do you see what's wrong? :o
<FromGitter> <benoist> I’m trying to figure it out :)
<BlaXpirit> i got it. it calls yield twice per go
<FromGitter> <benoist> yep :)
<BlaXpirit> bug
<BlaXpirit> >> def f; p rand(); end; [0][0] = 0
<DeBot> BlaXpirit: # => 0 - https://carc.in/#/r/1bl2
<BlaXpirit> uh wait what
<BlaXpirit> >> def f; p 0; end; [0][f] = 7
<DeBot> BlaXpirit: 0 - more at https://carc.in/#/r/1bl3
<BlaXpirit> this one prints once, ok
<FromGitter> <benoist> this works
<FromGitter> <benoist> https://carc.in/#/r/1bl7
<BlaXpirit> doesnt need yield, it's all about +=
<FromGitter> <benoist> which is logical
<BlaXpirit> benoist, yes, thanks. i just moved on to full-on reproduce mode :)
soveran has quit [Remote host closed the connection]
<FromGitter> <benoist> bucket[yield] = bucket[yield] + 1
<BlaXpirit> yes but i think this should not happen. you type += after all
<FromGitter> <benoist> thats just syntactic sugar
<FromGitter> <benoist> same in ruby i believe
<BlaXpirit> no
<BlaXpirit> it should be t = yield; bucket[t] = bucket[t] + 1
<BlaXpirit> and ruby executes the subexpression once like that and gives correct result
<FromGitter> <benoist> Ah yes correct
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
eizua has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
Ven_ has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> @RX14 i'm using https://github.com/crystal-lang/crystal/pull/3395 and still the memory consumption is the same
<RX14> what's the code?
<RX14> do you pass the request?
<RX14> because the version that takes the request obviously uses the old body object wich is a string
<FromGitter> <sdogruyol> well i've just updated the syntax to work
<FromGitter> <sdogruyol> nothing else
<FromGitter> <sdogruyol> @RX14 so the multipart parser needs to be updated for consuming the IO
<RX14> well you just need to do it manually
<RX14> this is what you used, right?
<FromGitter> <sdogruyol> yep
<FromGitter> <sdogruyol> i've updated this to be HTTP::Server::Request
<RX14> you just need to do that but use body_io
<RX14> because request.body buffers the whole thing into memory
<FromGitter> <sdogruyol> yeah
<FromGitter> <sdogruyol> let me see
<FromGitter> <sdogruyol> Wow, the memory stay at 1.1 MB or so
soveran has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> Unfortunately the response time got 4x slower
<FromGitter> <sdogruyol> 6s to 24s
<RX14> hmm
<FromGitter> <sdogruyol> i've commented on the issue
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter> <alex-lairan> Hi guy's ! I have a string like this: "qwerty" and I want to cut this in 3 parts: ["qw", "er", "ty"], how can I do that with a sexy method? :3
<FromGitter> <alex-lairan> I've try to extracts each with length/2 and get the 1,2, then the 3, 4, then the 5, 6, but it take a long amount of lines for nothings
<FromGitter> <alex-lairan> (and it's a bit ugly ^^=
<Yxhvd> >> "qwerty".split(/../)
<DeBot> Yxhvd: # => ["", "", "", ""] - https://carc.in/#/r/1bm8
<FromGitter> <alex-lairan> This don't give me what i've expected ^^ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57fa42cca7c618cd26f7bf3e]
<go|dfish> you'd want .scan() not .split()
<FromGitter> <alex-lairan> woaw ! thank you !
<FromGitter> <alex-lairan> :)
<RX14> >> "qwerty".chars.each_slice(2).join
<DeBot> RX14: # => "['q', 'w']['e', 'r']['t', 'y']" - https://carc.in/#/r/1bma
<RX14> >> "qwerty".chars.each_slice(2).sum("")
<DeBot> RX14: in /usr/lib/crystal/enumerable.cr:886: no overload matches 'String#+' with type Array(Char) - https://carc.in/#/r/1bmb
<RX14> >> "qwerty".chars.each_slice(2).each(&.sum)
<DeBot> RX14: in /usr/lib/crystal/enumerable.cr:846: undefined method 'zero' for Char:Class - https://carc.in/#/r/1bmc
<RX14> >> "qwerty".chars.each_slice(2).each(&.join)
<DeBot> RX14: # => nil - https://carc.in/#/r/1bmd
<RX14> >> "qwerty".chars.each_slice(2).map(&.join)
<DeBot> RX14: # => Iterator::Map(Iterator::Slice(Indexable::ItemIterator(Array(Char), Char), Char, Int32), Array(Char), String)(@iterator=Iterator::Slice(Indexable::ItemIterator(Array(Char), Char), Char, Int32)(@iterator=#<Indexable::ItemIterator(Array(Char), Char):0x89aafe0 @array=['q', 'w', 'e', 'r', 't', 'y'], @index=0>, @n=2), @func=#<Proc(Array(Char), Strin ... - https://carc.in/#/r/1bme
<RX14> >> "qwerty".chars.each_slice(2).map(&.join).to_a
<DeBot> RX14: # => ["qw", "er", "ty"] - https://carc.in/#/r/1bmf
<RX14> there you go
<FromGitter> <alex-lairan> ^^
<FromGitter> <alex-lairan> thank you too ! :)
<RX14> regex is quite slow
<RX14> so try not to use that
<FromGitter> <alex-lairan> Okay ! :)
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
<FromGitter> <alex-lairan> Thank you all ! :) ⏎ ```r, g, b = "#fe00ff"[1..-1].chars.each_slice(2).map(&.join).to_a.each { |i| i.to_i(16) }``` [https://gitter.im/crystal-lang/crystal?at=57fa453684f1db061495ed83]
bjz has joined #crystal-lang
Ven_ has joined #crystal-lang
<RX14> honestly with that I would just have used r = [1..2].to_i(16) etc
<RX14> if you've got a known amount
<FromGitter> <alex-lairan> Oh ok ;)
<RX14> >> "#fe00ff"[1, 2].to_i(16)
<DeBot> RX14: # => 254 - https://carc.in/#/r/1bmg
<RX14> >> "#fe00ff"[3, 2].to_i(16)
<DeBot> RX14: # => 0 - https://carc.in/#/r/1bmh
<RX14> >> "#fe00ff"[5, 2].to_i(16)
<DeBot> RX14: # => 255 - https://carc.in/#/r/1bmi
<RX14> like so
<FromGitter> <alex-lairan> It's like my first idea
soveran has quit [Ping timeout: 260 seconds]
<RX14> it'll also perform better because there's no intermediates or iterators
<FromGitter> <alex-lairan> Okay, I understand
<FromGitter> <alex-lairan> What do you think about ⏎ ``` ⏎ def initialize(hex : String) ⏎ reg = /#([a-f0-9]{3}){1,2}\b/ ⏎ raise Crolor::Exceptions::InvalidFormat.new unless reg.match(hex) ... [https://gitter.im/crystal-lang/crystal?at=57fa46340aa72e3c5be8e0d2]
Philpax has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> @alex-lairan that's pretty
<RX14> why UInt8.new?
<RX14> "ff".to_i8(16)
<RX14> >> "ff".to_i8(16)
<DeBot> RX14: invalid Int8: ff (ArgumentError) - https://carc.in/#/r/1bmn
<RX14> >> "ff".to_u8(16)
<DeBot> RX14: # => 255 - https://carc.in/#/r/1bmo
<RX14> there
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPBRp
<crystal-gh> crystal/master 6c5fb5a Ary Borenszweig: Optimizaion: define read_byte for IO::Sized and HTTP::Content
<FromGitter> <alex-lairan> :+1:
<RX14> as a UInt8, and does proper overflow checking
<RX14> as you can see when I accidentallly used a Signed int
<FromGitter> <alex-lairan> Thank you guy's for the help !
<RX14> @sdogruyol added an updated IO.copy with a UInt8[8192] for you to try and test the speed
<FromGitter> <sdogruyol> @RX14 actually i aint doing any IO.copy
<RX14> how are you doing it then?
<FromGitter> <sdogruyol> i mean i'm just checking the parse time
<FromGitter> <sdogruyol> this test doesnt include writing to a file
<RX14> oh so it's using the internal copy
<RX14> well, discord
<RX14> discard*
<FromGitter> <sdogruyol> :)
<FromGitter> <sdogruyol> well now it's pretty much good enough
<RX14> which is uses 1024 byte buffer
<RX14> lets change that and see what happens
<FromGitter> <sdogruyol> yeah, i'm curious about a 4K one
<RX14> L1 cache on the i486 itself was 8k
<RX14> so 8 or 16k should be perfectly fine buffer sizes
<FromGitter> <sdogruyol> agree
<FromGitter> <sdogruyol> it's great that there's nearly no memory leak with this
<RX14> I think i'll make a PR to rename MemoryIO to IO::memory
<RX14> because it doesn't make sense with IO::Delimited and the likes
<FromGitter> <sdogruyol> Hmm
<FromGitter> <sdogruyol> it really makes sense
<travis-ci> crystal-lang/crystal#6c5fb5a (master - Optimizaion: define read_byte for IO::Sized and HTTP::Content): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/166204118
<RX14> maybe I should rename FormData::PullParser to FormData::Parser too, or rename Multipart::Parser to Multipart::PullParser
<FromGitter> <sdogruyol> meanwhile i'm really curious how come is 5x times at this multipart stuff
<FromGitter> <sdogruyol> how come Go*
<FromGitter> <sdogruyol> need to check their buffer size
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RX14> i don't really know
<RX14> I think they might be more efficient than IO::Delimited by reading chunks and checking them all at once
<FromGitter> <sdogruyol> well i think your multipart and Ary's this patch is pretty good enough to get us to 1.0
<RX14> or they might use booyer-moore string search
<FromGitter> <sdogruyol> after 1.0 we can make it faster for sure
<RX14> @sdogruyol try multipart.cr master
<FromGitter> <sdogruyol> ok
Ven__ has joined #crystal-lang
Ven_ has quit [Read error: Connection reset by peer]
<FromGitter> <sdogruyol> well it's just around %1 -2 faster or not
pawnbox has quit [Remote host closed the connection]
Ven__ has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
Ven_ has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
<RX14> hmm
<RX14> oh well
<RX14> I've fixed one bug since I've gotten rid of PointerIO
<RX14> which is a good sign it shouldn't exist
<FromGitter> <sdogruyol> bug?
<RX14> possible buffer overflow in the stdlib
<FromGitter> <sdogruyol> hmm
<RX14> pointers are evil
<FromGitter> <sdogruyol> hehe
circ-user-Ak9Lm has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
<RX14> aother bug
<FromGitter> <sdogruyol> you mean in STD?
<RX14> yes
<RX14> string formatting
<crystal-gh> [crystal] RX14 opened pull request #3400: Delete PointerIO (master...delete-pointerio) https://git.io/vPBzA
circ-user-Ak9Lm has left #crystal-lang [#crystal-lang]
<FromGitter> <sdogruyol> Didn't know about PointerIO, havent needed havent used
<crystal-gh> [crystal] RX14 opened pull request #3401: Rename MemoryIO to IO::Memory (master...rename-memoryio) https://git.io/vPBgc
<RX14> there we go
<crystal-gh> [crystal] BlaXpirit opened pull request #3402: Rework the Random module (master...limitless-random) https://git.io/vPBg7
<BlaXpirit> there we go
<RX14> yay we're all PRing today
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
Ven_ has quit [Ping timeout: 268 seconds]
Ven_ has joined #crystal-lang
<RX14> there's no easy way to have one IO write to multiple places is there?
<RX14> If I wrote a class that could do that, what should it be called?
<RX14> IO::MultiWritier?
<RX14> it would be useful in logger to write to STDOUT and a file
<Yxhvd> (. tee .))
onethirtyfive has joined #crystal-lang
snsei has joined #crystal-lang
<RX14> eh
<RX14> tee isn't really a descriptive name though is it
<Yxhvd> neither is Array#grep
onethirtyfive has quit [Ping timeout: 268 seconds]
snsei has quit [Ping timeout: 248 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] kostya opened pull request #3403: Base64#urlsafe_encode now works as in ruby, fixed #3394 (master...base64_fix) https://git.io/vPBaw
matp has quit [Max SendQ exceeded]
matp has joined #crystal-lang
x0f has joined #crystal-lang
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] RX14 opened pull request #3404: Add IO::MultiWriter (master...feature/IO-MultiWriter) https://git.io/vPBre
onionhammer1 has quit [Ping timeout: 268 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 248 seconds]
onionhammer1 has joined #crystal-lang
Ven_ has joined #crystal-lang
<crystal-gh> [crystal] kostya opened pull request #3405: add more GC.stats (master...gc_stats) https://git.io/vPB6i
<FromGitter> <sdogruyol> LOL
<FromGitter> <sdogruyol> guess today's the Crystal PR day :P
Ven_ has quit [Read error: Connection reset by peer]
Ven_ has joined #crystal-lang
Ven_ has quit [Read error: Connection reset by peer]
Ven_ has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Ven_ has quit [Read error: Connection reset by peer]
Ven_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #3400: Delete PointerIO (master...delete-pointerio) https://git.io/vPBzA
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPBX1
<crystal-gh> crystal/master 007c791 Julien Portalier: Fix: allow i486 and i586 for target machine ABI
pawnbox has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPB13
<crystal-gh> crystal/master 0c93b1b Konstantin Makarchev: add GC.stats
eizua has quit [Quit: Leaving]
A124 has quit [Quit: '']
soveran has quit [Ping timeout: 244 seconds]
onethirtyfive has joined #crystal-lang
A124 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#42c4405 (master - Remove PointerIO): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/166259485
onethirtyfive has quit [Ping timeout: 260 seconds]
kulelu88 has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<travis-ci> crystal-lang/crystal#007c791 (master - Fix: allow i486 and i586 for target machine ABI): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/166259715
<crystal-gh> [crystal] asterite opened pull request #3406: [WIP] Support http server request streaming (single HTTP::Request) (master...feature/http_server_request_stream_2) https://git.io/vPBMU
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#0c93b1b (master - add GC.stats): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/166261097
A124 has quit [Quit: '']
bjz has joined #crystal-lang
A124 has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPBMF
<crystal-gh> crystal/master 2da5008 O_o: Base64#urlsafe_encode now works as in ruby, fixed #3394 (#3403)
Ven_ has quit [Ping timeout: 244 seconds]
<Papierkorb> Huh, there's no IO#eof? ?
Ven_ has joined #crystal-lang
<travis-ci> crystal-lang/crystal#2da5008 (master - Base64#urlsafe_encode now works as in ruby, fixed #3394 (#3403)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/166268757
<DeBot> https://github.com/crystal-lang/crystal/issues/3394 (Base64#urlsafe_encode why padding false by default?) | https://github.com/crystal-lang/crystal/pull/3403 (Base64#urlsafe_encode now works as in ruby, fixed #3394)
Ven_ has quit [Ping timeout: 250 seconds]
Ven_ has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
g3funk is now known as braidn
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 248 seconds]
_whitelogger has joined #crystal-lang
mrslowly has joined #crystal-lang
<mrslowly> How can I require a github repo branch as a dependency? When I do reponame#branch it errors
<mrslowly> oh ok, didn't realize it was its own repo. thanks!