<watzon>
Does anyone know of something like IO::ByteFormat for Ruby? All I've managed to find is bitpack, but it hasn't been touched in 11 years.
<watzon>
All of the gems that deal with binary seem to be more declarative
sz0 has quit [Quit: Connection closed for inactivity]
hendursaga has joined #crystal-lang
<hendursaga>
Hello all! I finally got around to checking Crystal out, and so far it looks good! I loved Ruby's syntax and idioms, but didn't like its speed, or lack thereof.
<FromGitter>
<Blacksmoke16> good to hear!
<hendursaga>
The biggest thing that worries me is the lack of parallelism - but I suppose that might be added on sometime down the road?
<hendursaga>
State of REPL? I suppose it'd be hard like in Rust..
<FromGitter>
<Blacksmoke16> there are some projects like https://github.com/crystal-community/icr. But IMO it's just as easy to have a `test.cr` file that you can mess with
<FromGitter>
<Blacksmoke16> or even setup `nodemon` to watch it and recompile automatically
aquijoule__ has joined #crystal-lang
aquijoule_ has quit [Ping timeout: 265 seconds]
chachasmooth has quit [Ping timeout: 264 seconds]
chachasmooth has joined #crystal-lang
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #crystal-lang
sz0 has joined #crystal-lang
_whitelogger has joined #crystal-lang
_ht has joined #crystal-lang
postmodern has joined #crystal-lang
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
aquijoule__ has quit [Ping timeout: 240 seconds]
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 268 seconds]
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<HertzDevil> so i got general pattern matching almost working with macros (good enough to define the matching semantics)
<FromGitter>
<HertzDevil> time to write a full spec
<FromGitter>
<alexherbo2> how create a named tuple from an array of values?
postmodern has quit [Quit: Leaving]
<FromGitter>
<asterite> @HertzDevil Wow, nice! What does "general pattern matching" mean in Crystal?
<FromGitter>
<HertzDevil> i want something similar to ruby 3's (single-statement) `=>` or `in` operator and i'm sure some others want it too
<FromGitter>
<HertzDevil> if we have it, we could also extend case expressions in terms of such an operator
<FromGitter>
<HertzDevil> (ruby had it backwards and defined the single-statement `in` in terms of a case expression)
<FromGitter>
<HertzDevil> will be gathering some initial thoughts on the forum before making an issue
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
<FromGitter>
<mohsinhijazee> Hello community. Is it possible to dynamically load a file and evaluate it? Like crystal eval but from within the program (somewhere there there's no crystal installation)?
deavmi has joined #crystal-lang
<straight-shoota>
You can compile the compiler into your program use it to build the eval file and execute that program
<straight-shoota>
at runtime
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<asterite> @HertzDevil is the pattern matching you are doing type safe?
<FromGitter>
<jrei:matrix.org> We will see whag fits the best ;)
<FromGitter>
<Blacksmoke16> yea id just use a record
<FromGitter>
<Blacksmoke16> can even do like `private record ...` if you dont want to expose it
<FromGitter>
<alexherbo2> I noticed a bug in the option parser, for named command
<FromGitter>
<alexherbo2> I have a `kcr shell` command, handling the `shell` command. when I run `kcr fzf shell`, it is recognized as `kcr shell`
<FromGitter>
<alexherbo2> it should not recognize `shell`, because there is `fzf` before
teardown has quit [Ping timeout: 268 seconds]
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU__ has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 256 seconds]
<FromGitter>
<jrei:matrix.org> perhaps you better off using a library
<FromGitter>
<jrei:matrix.org> OptionParser is nice for littles CLIs, less for bigger ones
<FromGitter>
<erdnaxeli:cervoi.se> yes
<FromGitter>
<jrei:matrix.org> if you like NamedTuples and descriptive over imperative, you may like https://github.com/j8r/clicr
DTZUZU__ is now known as DTZUZU
<FromGitter>
<kingsleyh> does anyone know if adding uniq to an array is likely to cause performance issues? I added one to an array and it gets hit 1000's of times per second but now the CPU is double what it was and that seems to be one of the only things I changed that sticks out to me
<FromGitter>
<Blacksmoke16> i mean it would need to create a new array and iterate it fully so prob would have an impact, also depending on the size of the array
<FromGitter>
<jrei:matrix.org> uniq or uniq!?
<FromGitter>
<jrei:matrix.org> also consider using a Set
<FromGitter>
<kingsleyh> uniq
<FromGitter>
<kingsleyh> I think a Set is a fantastic idea!!!
<FromGitter>
<kingsleyh> could my CPU go up by adding uniq to an array?
<FromGitter>
<kingsleyh> or is that unlikely and it must be something else?
<FromGitter>
<jrei:matrix.org> That's good then using Set
<FromGitter>
<oprypin:matrix.org> sure
<FromGitter>
<oprypin:matrix.org> it could go up
<FromGitter>
<kingsleyh> I'm re-implementing it and will benchmark it
<FromGitter>
<jrei:matrix.org> a Set is created anyway, better using one first
<FromGitter>
<jrei:matrix.org> it is a good change, even if this is not the cause,
chachasmooth_ has joined #crystal-lang
chachasmooth has quit [Ping timeout: 260 seconds]
<FromGitter>
<asterite> @kingsleyh how big is the array you are calling `uniq` on?
<FromGitter>
<asterite> I ask because if it's a small array (less than 17 elements) it deletes things in place, otherwise it needs to create a Hash with all the values and then get the uniq keys, which can be pretty expensive
<FromGitter>
<Blacksmoke16> could prob just grab it from the GH release
<FromGitter>
<jrei:matrix.org> sure, but slower
<FromGitter>
<jrei:matrix.org> I'll use docker if it was not available
<FromGitter>
<jrei:matrix.org> but I want max perf because it is going to be very very long
teardown has joined #crystal-lang
<FromGitter>
<jrei:matrix.org> oprypin (https://matrix.to/#/@oprypin:matrix.org): you started a bisect too, we'll see which one is the fastest haha
<FromGitter>
<jrei:matrix.org> You'll probably be faster than me, I have a Ryzen 5 1600 AF. Even putting the governor to performance does not change much
<FromGitter>
<jrei:matrix.org> it is still good to do it both, I do with LLVM 11 and you 10
<FromGitter>
<oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): wait i thought crystal 0.35.1 doesnt support llvm 11
<FromGitter>
<oprypin:matrix.org> thats why i got llvm 10 seeing the error
<FromGitter>
<jrei:matrix.org> ...oops yes
<FromGitter>
<jrei:matrix.org> true, true
<FromGitter>
<jrei:matrix.org> doing it back with `export LLVM_CONFIG=/usr/bin/llvm-config-10`
<FromGitter>
<kingsleyh> if there are 2 shards with the same name - and the same require "shard" - is it possible to use them both at the same time?
<FromGitter>
<kingsleyh> can you alias one of the requires ?
<FromGitter>
<Blacksmoke16> possibly, assuming none of the methods/type names conflict
<FromGitter>
<Blacksmoke16> no
<FromGitter>
<kingsleyh> well the require is the same so that is a problem lol
<FromGitter>
<jrei:matrix.org> no point of having the same name
<FromGitter>
<jrei:matrix.org> define different ones in shard.yml
<FromGitter>
<kingsleyh> yeah just two of the shards have the same name
<FromGitter>
<kingsleyh> how do you require them tho?
<FromGitter>
<Blacksmoke16> id vote try and get one of them to change their name