RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.3 | 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
snsei has quit [Remote host closed the connection]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kulelu88 has quit [Quit: Leaving]
willl has quit [Quit: Connection closed for inactivity]
snsei has joined #crystal-lang
soveran has joined #crystal-lang
snsei has quit [Ping timeout: 244 seconds]
soveran has quit [Ping timeout: 265 seconds]
coderobe has quit [Quit: Ping timeout (120 seconds)]
bjz has joined #crystal-lang
g3funk is now known as braidn
bjz has quit [Ping timeout: 265 seconds]
bjz has joined #crystal-lang
Philpax has quit [Ping timeout: 265 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
bjz has joined #crystal-lang
jeromegn has quit [Ping timeout: 252 seconds]
ponga has joined #crystal-lang
jeromegn has joined #crystal-lang
pawnbox has joined #crystal-lang
mark_66 has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 265 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
x0f has quit [Ping timeout: 264 seconds]
x0f has joined #crystal-lang
eizua has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
sandelius has joined #crystal-lang
pduncan has quit [Ping timeout: 272 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 272 seconds]
pawnbox has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
x0f has quit [Ping timeout: 265 seconds]
x0f has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
x0f has quit [Ping timeout: 248 seconds]
mgarciaisaia has joined #crystal-lang
x0f has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <paulcsmith> I checked out the docs for Capturing blocks, but I'm not sure if/how I can use it to do what I'm trying to do. Is something like this possible? https://gist.github.com/paulcsmith/8eb041acd4efab838d196e7943a76570
LastWhisper____ has joined #crystal-lang
Renich has joined #crystal-lang
soveran has quit [Remote host closed the connection]
matp_ is now known as matp
coderobe has joined #crystal-lang
pawnbox has quit [*.net *.split]
ponga has quit [*.net *.split]
onethirtyfive has quit [*.net *.split]
pawnbox has joined #crystal-lang
onethirtyfive has joined #crystal-lang
<FromGitter> <raydf> Hi @paulcsmith , what are you trying to do?
ponga has joined #crystal-lang
<FromGitter> <raydf> i believe you could do this ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57f513ab8b26e33e7d2c7a75]
<FromGitter> <sdogruyol> @paulcsmith you can do that
<FromGitter> <sdogruyol> but you need to explicity specify the type of env like `env : HTTP::Server::Context`
<FromGitter> <paulcsmith> @sdogruyol Thanks for the tip! I'm going to give that a try :)
Renich has quit [Ping timeout: 244 seconds]
<FromGitter> <raydf> @sdogruyol, are there any planning on adding splats to the filters, something like this? ⏎ ```before_all "/test/", "/json_test/", "/test3" do |env|``` [https://gitter.im/crystal-lang/crystal?at=57f51a923c59573f6f0e9136]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Renich has joined #crystal-lang
<FromGitter> <raydf> or ⏎ ```before_all ["/test", "/json_test", ...] do |env|``` [https://gitter.im/crystal-lang/crystal?at=57f51ba38b26e33e7d2ca35f]
<FromGitter> <johnjansen> a macro perhaps?
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<FromGitter> <raydf> @johnjansen , the before filters are already generated by macros. ⏎ https://github.com/sdogruyol/kemal/blob/master/src/kemal/middleware/filters.cr
<FromGitter> <paulcsmith> I tried capturing this `print_it_out`method as a proc but it says `Syntax error in :3: unexpected token: &`. So obviously the syntax is wrong. Does anyone know how to capture a method as a Proc? Is that even possible? https://gist.github.com/paulcsmith/ca45307e1715af68b23c1c14a8feaa27
<FromGitter> <sdogruyol> @raydf havent thought about that
mark_66 has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> @paulcsmith you should not declare that as method
<FromGitter> <paulcsmith> Ah ok so what I was trying to do is not possible
<FromGitter> <sdogruyol> ```SomeProc = -> |env : HTTP::Server::Context| { puts "doing something" } ⏎ &SomeProc``` [https://gitter.im/crystal-lang/crystal?at=57f51f29d45d7f0f52659a1d]
<FromGitter> <paulcsmith> Gotcha. Ok so I have to explicitly return a Proc. I thought maybe there would be a way to make a method into a Proc somehow :)
<FromGitter> <paulcsmith> That's ok though, this will work fine
<FromGitter> <johnjansen> @raydf NOTE TO SELF: always check the source before commenting ;-) …
<FromGitter> <paulcsmith> Thanks for the help @sdogruyol
<FromGitter> <paulcsmith> Ah ok I figured it out! In case anyone is interested you can use `->` to capture a method as a block: https://gist.github.com/paulcsmith/fb393124797a9d49f469f0d81c1dd54f
<FromGitter> <paulcsmith> This is obviously useless in this example, but I'm just playing around with how Crystal handles blocks/procs :)
<FromGitter> <johnjansen> anyone know how to enforce the type of items in a splat i.e. `def blah(*paths # <= must be strings`
pawnbox has quit [Ping timeout: 272 seconds]
pawnbox has joined #crystal-lang
<FromGitter> <sdogruyol> @johnjansen there you go https://carc.in/#/r/1bd7
Renich has quit [Ping timeout: 272 seconds]
Renich has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Read error: Connection reset by peer]
x0f has quit [Ping timeout: 252 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
sandelius has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
soveran has quit [Ping timeout: 264 seconds]
eizua has quit [Quit: Leaving]
optikfluffel has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
optikfluffel has quit [Client Quit]
optikfluffel has joined #crystal-lang
scottj has joined #crystal-lang
Renich has quit [Quit: leaving]
<FromGitter> <johnjansen> ahh stoopid me … ;-) cheers @sdogruyol
x0f has joined #crystal-lang
<FromGitter> <sdogruyol> @johnjansen :)
A124 has quit [Quit: '']
optikfluffel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
onethirtyfive has joined #crystal-lang
A124 has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 252 seconds]
kulelu88 has joined #crystal-lang
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
optikfluffel has joined #crystal-lang
optikfluffel has quit [Client Quit]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Client Quit]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPnKt
<crystal-gh> crystal/master 919818e Ary Borenszweig: Expose LLVM atomic operations to Crystal, and add Atomic(T) struct....
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
onethirtyfive has joined #crystal-lang
<travis-ci> crystal-lang/crystal#919818e (master - Expose LLVM atomic operations to Crystal, and add Atomic(T) struct.): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/165349513
onethirtyfive has quit [Ping timeout: 264 seconds]
<Yxhuvud> asterite: you are adding CAS, will we get memory fences as well?
fryguy9 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
optikfluffel has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
<FromGitter> <asterite> but we will use those in the runtime, one shouldn't need to use these low-level primitives
pawnbox has joined #crystal-lang
<FromGitter> <sonic182> Hi! I've a little issue that maybe you can give the answer quickly
pawnbox has quit [Ping timeout: 244 seconds]
<FromGitter> <sonic182> in ./problems/tsp/solutions/lib/ga/cromosome.cr:87: undefined method '[]=' for String ⏎ ⏎ @cromosome[i] = "1" ⏎ how do I replace a character from a string? [https://gitter.im/crystal-lang/crystal?at=57f5738e8b26e33e7d2e155e]
<FromGitter> <sonic182> (with single quotes the same thing)
<FromGitter> <jwoertink> new_string = old_string.gsub(/whatever/, "1")
<FromGitter> <jwoertink> single quotes is for a character
<FromGitter> <sonic182> omg with regex I've to change a single character from a position of string? o.O
<FromGitter> <jwoertink> There's other overloads for gsub, so you don't have to use regex
<FromGitter> <jwoertink> like `"hello".gsub("e", "a")`
<FromGitter> <jwoertink> @sonic182 https://crystal-lang.org/api/0.19.3/String.html
<FromGitter> <sonic182> im working with bits representeds on a string "000111010100101" I just want to change from a position X if it's 0 -> 1 or it's 1 -> 0
<FromGitter> <sonic182> Im reading the api
<FromGitter> <sonic182> but I haven't found anything simple to do this simple task
soveran has joined #crystal-lang
<FromGitter> <sonic182> just convert all the string to array of chars, do the change and build the string from that array, but's that's crazy
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> you want the `sub` method
<FromGitter> <jwoertink> ```b = "000111010100101" ⏎ ⏎ b2 = b.sub(2, "A") ⏎ ⏎ puts b2``` [https://gitter.im/crystal-lang/crystal?at=57f575be43b5aeb0099de3eb]
<FromGitter> <jwoertink> https://crystal-lang.org/api/0.19.3/String.html#sub%28index%3AInt%2Creplacement%3AString%29-instance-method
<FromGitter> <sonic182> Thanks! that's it :)
<FromGitter> <jwoertink> no problem :)
<FromGitter> <sonic182> but it should be more eficient, in this case is generating other string in memory that's unnecesary
<FromGitter> <jwoertink> I think strings in Crystal are immutable
<FromGitter> <sonic182> "A String represents an immutable sequence of UTF-8 characters."
<FromGitter> <sonic182> Oh yes, the top of string docs says that e.e
<FromGitter> <sonic182> xD
optikfluffel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
fryguy9 has quit [Ping timeout: 256 seconds]
snsei has joined #crystal-lang
optikfluffel has joined #crystal-lang
pawnbox has quit [Ping timeout: 265 seconds]
ruby_ 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]
soveran has quit [Remote host closed the connection]
optikfluffel has quit [Quit: Textual IRC Client: www.textualapp.com]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]