ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.32.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
<raz> it's uncanny. every freakin' day i discover a new awesomeness in crystal-land. shard gem of today (pun intended): webmock.
<FromGitter> <randiaz95> Hmm.. What does stubbing mean? I googled and it says that it is for testing client requests somehow...
<FromGitter> <Blacksmoke16> You make a request but it doesn't actually make a request. It just returns your stub
<FromGitter> <randiaz95> yep, that is why it's confusing.. It reminds me of my girlfriend.
<FromGitter> <randiaz95> its an x but its not really an x
<FromGitter> <randiaz95> Does it just store a cached old response?
<FromGitter> <randiaz95> so that you don't have to request it every time?
<FromGitter> <randiaz95> oh nevermind
<FromGitter> <randiaz95> I figured it out
<FromGitter> <Blacksmoke16> Yes
<FromGitter> <randiaz95> This is great for big teams working on microservices.
<FromGitter> <randiaz95> so that you don't have to wait on other team's deliverables to code new stuff.
<raz> not only for big teams, all kinds of http client tests become much easier that way :)
Nicolab has quit [Quit: Leaving.]
duane has quit [Ping timeout: 265 seconds]
<FromGitter> <Daniel-Worrall> I was actually thinking about stubbing last week. How can I stub methods?
<FromGitter> <Daniel-Worrall> Is there a good post about good spec handling in crystal
<FromGitter> <randiaz95> Well, I was reading it from https://github.com/bblimke/webmock
<FromGitter> <randiaz95> there was also the mana github
<FromGitter> <randiaz95> webmoc
<FromGitter> <randiaz95> The first one is in ruby
<FromGitter> <randiaz95> manastech is the main company behind Crystal lang
<FromGitter> <randiaz95> They are uber cool
ht__ has joined #crystal-lang
ht_ has quit [Ping timeout: 246 seconds]
ht__ is now known as ht_
dwdv has quit [Ping timeout: 258 seconds]
<FromGitter> <Daniel-Worrall> https://github.com/waterlink/mocks.cr
<FromGitter> <Daniel-Worrall> I'll check this out later
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #crystal-lang
<FromGitter> <randiaz95> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0976330fd3413f4c77aeb7]
<FromGitter> <randiaz95> I wonder if this is a good way to find the hidden type of a string without having deeply nested code.
<FromGitter> <Blacksmoke16> pretty sure you could use a cases
<FromGitter> <randiaz95> I have more than one regex though...
<FromGitter> <randiaz95> unnecessary dtype local variable
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e09773004a1900497d2c0e1]
<FromGitter> <randiaz95> due to me watching Disney plus
<FromGitter> <Blacksmoke16> something like that
<FromGitter> <randiaz95> I don't think that would work..
<FromGitter> <Blacksmoke16> why wouldn't it?
<FromGitter> <randiaz95> lol unless Crystal does regex magic like that..
<FromGitter> <Blacksmoke16> uses case equality `===`
<FromGitter> <randiaz95> right, isn't it == not ===?
<FromGitter> <Blacksmoke16> no `===`
<FromGitter> <Blacksmoke16> is case equality
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Regex.html#===(other:String)-instance-method
<FromGitter> <randiaz95> ooo
<FromGitter> <randiaz95> Praise Jesus
<FromGitter> <randiaz95> baby Jesus for xmas
<FromGitter> <randiaz95> Very neat....
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
<FromGitter> <watzon> I'd avoid using regex there if you could though, especially if it's user input. You could also attempt type conversions inside of a `begin/rescue` block.
<FromGitter> <watzon> Pretty sure that would be more preformant
<FromGitter> <watzon> Not quite as concise though
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e097a3cfd580457e7946e13]
<FromGitter> <Blacksmoke16> prob would do it
<FromGitter> <watzon> Oh yeah, I forgot you could do that
<FromGitter> <watzon> Case is pretty nice. Sometimes I wish it was a little better for pattern matching, but it is a lot more powerful than a lot of languages
<FromGitter> <watzon> Ruby actually just added some new pattern matching functionality to case
ur5us has quit [Ping timeout: 260 seconds]
<FromGitter> <randiaz95> Sorry to be ungrateful, but I wanted to note that any int also returns Decimal after testing
<FromGitter> <randiaz95> so you must check for "." instance inside also
<FromGitter> <randiaz95> When I ran: ``` ⏎ ⏎ ```It didn't fix it lol.. so I may sleep on this``` [https://gitter.im/crystal-lang/crystal?at=5e098802d5a7f357e6a4545c]
<FromGitter> <randiaz95> comma means or not and, I would need to find an example in the docs where I can run 2 methods with and
<FromGitter> <watzon> Well the `includes?(".")` is probably unnecessary
<FromGitter> <randiaz95> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0988b7833c373f4d7cd5fb]
<FromGitter> <randiaz95> I included the includes? method because everything was showing as float.
<FromGitter> <randiaz95> for example getType("5") or getType("2")
<FromGitter> <watzon> You just need to order it right. Check for `.to_i64?` first
<FromGitter> <randiaz95> I wish I could check includes one instance.
<FromGitter> <randiaz95> ah..
<FromGitter> <randiaz95> brilliant!
<FromGitter> <watzon> You can also nest case statements btw
<FromGitter> <watzon> Not necessary in this case, but it can help
<FromGitter> <randiaz95> ^ Trying to avoid too many nests because my brain is too dumb to handle it.
<FromGitter> <randiaz95> Thank you for the advice though I will use nested case if its all I got.
<FromGitter> <randiaz95> I found & inside case in the docs: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e098b056ff7ae03fc6dc47f]
<FromGitter> <randiaz95> need to put {value1, value1} though
<FromGitter> <watzon> Oh interesting. I actually didn't know it could do that.
<FromGitter> <randiaz95> sure, and use underscore if you aren't using 2 methods.
<FromGitter> <watzon> Actually it kinda makes sense though, you're basically pattern matching on a tuple.
<FromGitter> <randiaz95> like: `when {.even?, _}
<FromGitter> <watzon> Yeah the underscore can be used in blocks and such too
<FromGitter> <watzon> Saves you from having to define a variable you're never going to use
<FromGitter> <randiaz95> yep, *Coming from go lol I know I should not have variables I won't use
<FromGitter> <randiaz95> hey @watzon
<FromGitter> <watzon> Yeah?
<FromGitter> <randiaz95> Is there any way to do Array.each do |x| end but instead of just getting the element x, also get the index
<FromGitter> <randiaz95> essentially a parallel to for index, value in enumerate(array) in python
<FromGitter> <watzon> `each_with_index`?
<FromGitter> <watzon> There's also `map_with_index`
<FromGitter> <randiaz95> right, so when I looked at the api for each_with_index, its parameters are the indexes itself
<FromGitter> <randiaz95> not to run through entire array
<FromGitter> <randiaz95> nvm
<FromGitter> <randiaz95> I probably confused it with another method
<FromGitter> <watzon> I'm confused. With `each_with_index` it's basically the same as `each`, but it also supplies the index as a second property.
<FromGitter> <randiaz95> yep,
<FromGitter> <randiaz95> I saw each_index first... not each with index
<FromGitter> <watzon> Ahhh ok haha
<FromGitter> <watzon> Yeah `each_with_index` should be exactly what you want
<FromGitter> <randiaz95> Lol, god bless me
ur5us has joined #crystal-lang
<FromGitter> <stnluu_twitter> > has anyone ever written a macro, that wraps around a block of other macros? like: ⏎ > ``` ⏎ > my_big_macro param1, param2, do ⏎ > sub_macro p1, p2 ⏎ > sub_macro p3, p4 ... [https://gitter.im/crystal-lang/crystal?at=5e09954207a1a67d1d805552]
<FromGitter> <watzon> Are you having an issue making it work?
<FromGitter> <stnluu_twitter> i dont have a lot of experience with macros, so just not sure how/what i can do to support that
<FromGitter> <stnluu_twitter> i guess a more specific question is, can i call "yield" from within a macro to "paste" those sub macros in?
<FromGitter> <stnluu_twitter> doesn't look like i can
<FromGitter> <stnluu_twitter> https://play.crystal-lang.org/#/r/8b2l
<FromGitter> <firejox> @stnluu_twitter use `{{ yield }}`
<FromGitter> <randiaz95> 1) o
<FromGitter> <randiaz95> no output on ur example
<FromGitter> <randiaz95> how would you access the member variable from the sub macro though?
<FromGitter> <stnluu_twitter> oh cool! that worked. thanks @firejox
<FromGitter> <stnluu_twitter> https://play.crystal-lang.org/#/r/8b2v
<FromGitter> <randiaz95> ok back to focus with Lofi https://www.youtube.com/watch?v=TO7AFr1xgjs
<FromGitter> <randiaz95> lofi is going hard tonight
<FromGitter> <randiaz95> Guys, do objects get destroyed on method end? or randomly on gc's optimal time?
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
ht_ has quit [Ping timeout: 246 seconds]
ht_ has joined #crystal-lang
yukai has quit [Ping timeout: 265 seconds]
Nicolab has joined #crystal-lang
<FromGitter> <grkek> > Using lofi as a background noise wile coding
<FromGitter> <grkek> > not using pale deep noise
<FromGitter> <grkek> You should try this: https://www.youtube.com/watch?v=ArwcHjmsw3A the title is pretty stupid but the noise is really helpful
<FromGitter> <grkek> Just try not to mix it with anything else
<FromGitter> <Nicolab> Hello, ⏎ ⏎ If anyone want to do a little bit of mentoring on Exercism (https://exercism.io/my/tracks/crystal). We are two waiting in the queue
<FromGitter> <grkek> @Nicolab what do we have to do again ?
<FromGitter> <Nicolab> The principle is to correct the steps. Quickly don't consume too much time
<FromGitter> <Nicolab> The first exercises are simple when you know Crystal, it helps people who discover a language (Crystal in this case)
dirtwash has joined #crystal-lang
<dirtwash> morinng folks
<FromGitter> <Nicolab> I just saw that there is a practice mode (without mentor). I will correct myself by looking at other people's solutions :)
<FromGitter> <Nicolab> :D
dwdv has joined #crystal-lang
dirtwash has left #crystal-lang ["WeeChat 1.9.1"]
Vexatoast has joined #crystal-lang
Vexatos has quit [Ping timeout: 268 seconds]
alex`` has quit [Quit: WeeChat 2.7]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
alex has joined #crystal-lang
alexherbo2 has joined #crystal-lang
sagax has quit [Quit: Konversation terminated!]
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
<FromGitter> <grkek> @veelenga can you review this PR ?
<FromGitter> <j8r> he has certainly already received a notification
<FromGitter> <j8r> wait at least a few days
<FromGitter> <grkek> no problem just wanted to make sure :)
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
Nicolab has quit [Quit: Leaving.]
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> you'll need to wait the 30 days ^
Nicolab has joined #crystal-lang
<FromGitter> <straight-shoota> > There is a practice mode (without mentor). I will correct myself by looking at other people's solutions :) ⏎ ⏎ This can certainly help, but you need to be careful with that. I noticed that a lot of published solutions are far from ideal. So you might just happen to learn something that's not worth learning it.
<FromGitter> <marynowac> how to set zip compression method to store for a code like below? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0a0b542d574c7d1ee124a2]
<FromGitter> <Nicolab> @straight-shoota Indeed!
<FromGitter> <straight-shoota> Unfortunately, having many stars is not an indicator for a quality solution either. For example: From the top rated solutions for the hello world exercise, only two define the method in a module.
hightower4 has joined #crystal-lang
<FromGitter> <straight-shoota> @marynowac Instead of `zip.add`, just to `File.open("file1") { |file| IO.copy(file, zip) }`
<FromGitter> <j8r> @straight-shoota maybe, but if (s)he looks at enough solutions, it will likely be good for learning, because we will naturally compare them
<FromGitter> <j8r> And thinking which options are better, and why
<FromGitter> <straight-shoota> Of course. For that very reason I do not advise against looking at other solutions. But you should do that with care and open eyes.
<FromGitter> <straight-shoota> Also, as per my previous comment, it seems to be very often that many solutions have similar issues. Even top rated ones. Or maybe especially top rated ones?
<FromGitter> <j8r> perhaps that's often the same set of people?
<FromGitter> <j8r> (I don't know)
<FromGitter> <bew> @straight-shoota did you do the exercism React ?
dwdv has quit [Ping timeout: 240 seconds]
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
<FromGitter> <marynowac> @straight-shoota `File.open("file1") { |file| IO.copy(file, zip) }` returns ⏎ Error: private method 'write' called for Zip::Writer @marynowac ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0a13bcd31dba03fdccfd3f]
<FromGitter> <Nicolab> @straight-shoota Ok thanks. I try to compare and see the differences of the solutions (by looking, docs etc). Not perfect but I will keep my eyes open :)
<FromGitter> <Nicolab> by the way, thank you @bew for your review
<FromGitter> <bew> (;
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
<FromGitter> <randiaz95> Guys... Radio waves don't get deflected, Gamma waves don't get deflected but light waves, which are in the middle of the spectrum do get deflected....
<FromGitter> <randiaz95> Life is wild..
<FromGitter> <randiaz95> If it wasn't for this fact, we wouldn't have non-radioactive wifi lol
dwdv has joined #crystal-lang
<Yxhuvud> Eh, ever heard of RADAR? Radio waves definitely get reflected.
<Yxhuvud> And if you ever has been to the dentist you have been subject to the reflections of high energy rays too.
<FromGitter> <randiaz95> Well, we don't necessarily use radio, but a middle ground between radio and microwaves
<FromGitter> <randiaz95> and sure, it gets deflected after 3rd floor lol
sagax has joined #crystal-lang
alex has quit [Quit: WeeChat 2.7]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <straight-shoota> @bew I started with React, but didn't finish it. I think I hit some compiler error but didn't get around analyzing it
<FromGitter> <straight-shoota> @marynowac Oh, sry I confused the zip API.
<FromGitter> <bew> https://forum.crystal-lang.org/ is down?
<FromGitter> <absolutejam_gitlab> super slow for me
<FromGitter> <straight-shoota> This should do it: ⏎ ⏎ ```File.open("file1") { |file| zip.add "file1", file }``` [https://gitter.im/crystal-lang/crystal?at=5e0a1e5dd31dba03fdcd45f6]
<FromGitter> <straight-shoota> Yeah, forum seems to have some issues. @bcardiff
<FromGitter> <marynowac> @straight-shoota that works, but… files are still compressted. i'd like to *store* files instead of deflate them.
<FromGitter> <ImAHopelessDev_gitlab> seems they went up just for me
<FromGitter> <ImAHopelessDev_gitlab> thanks, discourse!
<FromGitter> <straight-shoota> @marynowac Not sure what you mean
<FromGitter> <straight-shoota> What do you want to achieve?
gangstacat has quit [Quit: Ĝis!]
gangstacat has joined #crystal-lang
Nicolab has quit [Ping timeout: 260 seconds]
Nicolab has joined #crystal-lang
Human_G33k has quit [Ping timeout: 260 seconds]
<FromGitter> <marynowac> i got huge set of large files (600 mb - 5 gb) and that files are already compressed. i have to create zip archives contain 4-10 files each. so i don't want to waste time for another compression and just store files inside archive.
<FromGitter> <marynowac> doc says: NOTE only compression methods 0 (STORED) and 8 (DEFLATED) are supported. so i wanna use method 0, but don't know how to set it.
<FromGitter> <Blacksmoke16> looks like you have to use https://crystal-lang.org/api/master/Zip/Writer.html#add(entry:Entry,&)-instance-method that overload
<FromGitter> <Blacksmoke16> where you can call `compression_method=` on the `entry`
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <marynowac> could you show a sample code? i wouldn't like to complain, but the documentation is very sparse here.
<FromGitter> <Blacksmoke16> PRs welcomed :p
<FromGitter> <Blacksmoke16> once we figure it out ha
<FromGitter> <Blacksmoke16> prob something like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0a439bd5a7f357e6a90f0a]
<FromGitter> <Blacksmoke16> something like that maybe
<FromGitter> <marynowac> i'm a simple user of programming languages. and i learning yet. so without docs and google i can do nothing :)
Nicolab has quit [Ping timeout: 258 seconds]
<FromGitter> <marynowac> got error: Entry CRC32 mistmacth (0 given but was 3312212232) ⏎ ⏎ my code is: ⏎ ⏎ ```entry.uncompressed_size # => 0 ⏎ entry.crc32 # => 0``` ... [https://gitter.im/crystal-lang/crystal?at=5e0a4a458ba16b107cf5f2df]
<FromGitter> <marynowac> but if PR are welcomed i'm able to create PR and fix a typo in the error message: mistmacth :))
<FromGitter> <wontruefree> I just wanted to let people know we are hosing a meetup on the state of AI in Crystal this Thursday chicagocrystal.org/events/clzwlrybccbdb/
<FromGitter> <wontruefree> hahaha
<FromGitter> <wontruefree> I love Chicago
<FromGitter> <wontruefree> also you can remote in
<FromGitter> <wontruefree> we make it as remote friendly as we can
<FromGitter> <wontruefree> the speaker is also remote
<FromGitter> <wontruefree> If you are interested in how the night goes here is our last meetup https://youtu.be/5rpZOtcCHtk
<FromGitter> <randiaz95> :o
<FromGitter> <randiaz95> Im so lonely here in Miami
<FromGitter> <wontruefree> thank you @asterite again for you talk it was really cool
<FromGitter> <randiaz95> no one codes lol
<FromGitter> <wontruefree> hahaha
<FromGitter> <wontruefree> Well if you are ever in Chicago let me know
<FromGitter> <wontruefree> so do you mostly do remote work?
<FromGitter> <Blacksmoke16> @marynowac welp, yea sorry im out of ideas
HumanG33k has joined #crystal-lang
<FromGitter> <r00ster91> Hello. When should I use `same_thread: true` for a `spawn`? Should I use it for rather small and less important things that should better not take up a new thread?
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
Nicolab has joined #crystal-lang
<FromGitter> <grkek> @Blacksmoke16 I think I finally implemented the threading properly and bumped the rps from 30k to 56959
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <grkek> on a single instance
<FromGitter> <grkek> 1142131 requests in 20.05s
<FromGitter> <Blacksmoke16> nice one, what all did you have to do?
<FromGitter> <grkek> spawn do
<FromGitter> <grkek> end
<FromGitter> <grkek> :D
<FromGitter> <grkek> that's it
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Blacksmoke16> where did you put that?
<FromGitter> <grkek> w8 ill show
<FromGitter> <grkek> put the context call in a fiber and used a channel to send over the content
<FromGitter> <Blacksmoke16> where is the spawn call tho?
<FromGitter> <grkek> I haven't put it up on the github
<FromGitter> <Blacksmoke16> ah
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0a56300fd3413f4c7d6519]
<FromGitter> <grkek> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e0a564cb4ed68096e03efcd]
<FromGitter> <grkek> there it is
<FromGitter> <grkek> it is implemented pretty stupidly but it works ?
<FromGitter> <grkek> also If I run another instance of the same application it doesn't bump up the rps
<FromGitter> <grkek> do you know the cause of it ?
<FromGitter> <Blacksmoke16> i dont fully understand how this helped in the first place?
<FromGitter> <Blacksmoke16> each request is executed in a fiber already (assuming you're using `HTTP::Server`)
<FromGitter> <Blacksmoke16> so even if the handler was taking a while it would already switch to another request while waiting for this one to be processed
<FromGitter> <grkek> I am using HTTP::Handler
<FromGitter> <Blacksmoke16> right, but you're also using the server https://github.com/grkek/grip/blob/master/src/grip.cr#L45
<FromGitter> <grkek> I am literally using the same as Kemal yeah
<FromGitter> <grkek> I don't really know how this helped
<FromGitter> <grkek> let me remove the spawn and try that way
<FromGitter> <grkek> okay bumping up the workers is making it worse again
<FromGitter> <Blacksmoke16> should use the same amount of works as you have cores
<FromGitter> <grkek> its perfect at 4
<FromGitter> <grkek> reached 60k now
<FromGitter> <grkek> let me remove the spawn function
<FromGitter> <grkek> Okay so if I test the same setup on a different machine
<FromGitter> <grkek> with more cores
<FromGitter> <grkek> I might reach 100k rps right ?
<FromGitter> <grkek> that is a win
<FromGitter> <grkek> HMMM
<FromGitter> <Blacksmoke16> possibly?
<FromGitter> <grkek> let me test without the spawn's
<FromGitter> <Blacksmoke16> the more workers the more overhead there is, see some of the examples in https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html
<FromGitter> <grkek> what the hell it went up even more
<FromGitter> <grkek> its now at 70k
<FromGitter> <grkek> what is going on
<FromGitter> <grkek> Currently at 70466 requests/sec
<FromGitter> <Blacksmoke16> nice one
<FromGitter> <Blacksmoke16> performance isnt everything tho
<FromGitter> <grkek> I just like the numbers :D
<FromGitter> <grkek> makes me feel happy that I haven't ruined the framework
<FromGitter> <grkek> It might be because of the -D preview_mt flag ?
<FromGitter> <Blacksmoke16> that is what turns on multithreading yes, is experimental atm
<FromGitter> <grkek> Yup it went down to 40k again
<FromGitter> <Blacksmoke16> id suggest reading that blog post i linked
<FromGitter> <grkek> Will do for sure, thank you
<FromGitter> <Blacksmoke16> gives some good info/background on how it works (and why its able to handle more requests)
Nicolab has quit [Quit: Leaving.]
ur5us has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<FromGitter> <halfdan> I'm trying to port a library over from Ruby. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ What does Colorize::ObjectExtensions do here? [https://gitter.im/crystal-lang/crystal?at=5e0a7d8ceac8d1511e867621]
<FromGitter> <halfdan> FWIW I don't expect this to work - I've yet to look at the signature of Hash in Crystal, it's just the error that confuses me
<FromGitter> <halfdan> Seems to work with `->(hash : Hash(String, Int32), key : String) { hash[key] = key.size }`
yukai has joined #crystal-lang
<FromGitter> <randiaz95> Hi guys!!!
<FromGitter> <randiaz95> Is there any way to use the .select! method on an array without modifying self?
<FromGitter> <halfdan> Use select without the bang
<FromGitter> <randiaz95> Bang bang
<FromGitter> <randiaz95> Thank you!!!
<FromGitter> <randiaz95> it worked.
<FromGitter> <halfdan> This follows Ruby's pattern. Bang methods modify self, without they return a copy
<FromGitter> <randiaz95> Wow, that is perfect information lol I wanted to learn more about ! ? in crystal and ruby
<FromGitter> <randiaz95> I come from Java/Python origins
<FromGitter> <randiaz95> That is great syntax though man now that I know how to use it.
<FromGitter> <randiaz95> kind of like a shotgun though. If you don't know how to use it; you can do some nasty bugs lol...
<FromGitter> <halfdan> methods ending with a question mark (in Ruby) usually return a boolean or can be evaluated to a boolean
<FromGitter> <randiaz95> Right, I know that about ruby. It doesn't necessarily apply in Crystal though; it may or may not be true.
Nicolab has joined #crystal-lang
<FromGitter> <Daniel-Worrall> It is true for the stdlib and anyone correctly writing crystal shards. A method with a question mark suffix should only return a boolean.
<FromGitter> <Blacksmoke16> Or nil
<FromGitter> <j8r> yes, more likely