ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
gordea has quit [Quit: gordea]
renich has quit [Quit: Leaving]
notzmv has quit [Remote host closed the connection]
notzmv has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 268 seconds]
Sankalp has quit [Ping timeout: 265 seconds]
Sankalp has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
skandal has joined #crystal-lang
<skandal> Hello :)
ur5us has joined #crystal-lang
<FromGitter> <naqvis> yo
hightower3 has quit [Ping timeout: 268 seconds]
ur5us has quit [Ping timeout: 255 seconds]
hightower2 has joined #crystal-lang
jmdaemon has quit [Ping timeout: 264 seconds]
hightower2 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
taupiqueur has joined #crystal-lang
<FromGitter> <djberg96> Is there a handy way to guard against `Enumerable::EmptyError` where you're not sure if the result will be empty or not?
<FromGitter> <Blacksmoke16> got some example code?
<FromGitter> <djberg96> e.g. `found = Dir[program].first` will bomb if `Dir[program]` is empty, but in this case `program` is a user-provided value
<FromGitter> <Blacksmoke16> can you use `.first?` and do something if it returns `nil`
<FromGitter> <djberg96> oh, didn't know such a method existed or that the semantics differed
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/Enumerable.html#first?:T|Nil-instance-method
<FromGitter> <djberg96> well, first and first? both have the same documentation.
<FromGitter> <Blacksmoke16> no they dont
<FromGitter> <Blacksmoke16> very similar, but definately different
<FromGitter> <Blacksmoke16> thats just the summary, go to the actual detailed docs
<FromGitter> <djberg96> oh! thanks!
hightower2 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
hightower2 has quit [Read error: Connection reset by peer]
<FromGitter> <azurelmao> Is there a way to round a float up to some decimal places? Like if I have 0.9999999999 I want it to be rounded to 1, but 0.34002 should still be 0.34002
<FromGitter> <Blacksmoke16> `.round 5` would do it i think
<FromGitter> <moe:busyloop.net> you can also pass it a mode to tell it what type of rounding you want: https://crystal-lang.org/api/1.6.2/Number/RoundingMode.html
<FromGitter> <moe:busyloop.net> (but for what you asked, blacksmokes `round(5)` should indeed be enough)
<FromGitter> <moe:busyloop.net> actually... reading it again, now i think we both misunderstood the question 🤔
<FromGitter> <moe:busyloop.net> seems like a weird requirement. what would you want 0.51000 to round to?
taupiqueur has quit [Quit: WeeChat 3.7.1]
_ht has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
<FromGitter> <azurelmao> I want it to work like normal math, you round *to* a decimal place
<FromGitter> <azurelmao> eg. round to the 6th decimal place
<FromGitter> <azurelmao> 1) 510001 => 0.510001
<FromGitter> <azurelmao> 1) 5100011 => 0.510001
<FromGitter> <azurelmao> 1) 5100015 => 0.510002
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=63850020a34b5112115027ef]
<FromGitter> <azurelmao> Yes, thank you. So it was .round
<FromGitter> <azurelmao> btw how do you guys do this fancy formatting?
<FromGitter> <azurelmao> does gitter support markdown?
<FromGitter> <Blacksmoke16> three backticks, return
ur5us has joined #crystal-lang
sagax has joined #crystal-lang
_ht has quit [Quit: _ht]
<FromGitter> <christopherzimmerman> Not sure what version of Crystal it was added in, but very happy to see variadic generics supported now. Are there any plans (or am I missing additional info about how they are supposed to work) to support variadic numeric arguments? I'm working on compile-time bounds checks for `Tensor`'s and was hoping the latter in this example would work: https://play.crystal-lang.org/#/r/e5fc
<FromGitter> <Blacksmoke16> id vote just a forgotten context?
taupiqueur has joined #crystal-lang