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
teardown has quit [Write error: Connection reset by peer]
teardown has joined #crystal-lang
<FromGitter> <jrei:matrix.org> @asterite: `&:` is an expression and `&.`not?
<FromGitter> <jrei:matrix.org> could we even say that Crystal is a syntax sugar over LLVM IR?
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 272 seconds]
_whitelogger has joined #crystal-lang
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
chachasmooth has quit [Ping timeout: 240 seconds]
chachasmooth has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
chachasmooth has quit [Ping timeout: 260 seconds]
chachasmooth has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <acook> So there's a couple ways to compare the contents of arrays while ignoring their order, like `array1.to_set == array2.to_set` and `(array1 | array2).size == [array1.size, array2.size].max`, these are fine enough for spec matching. For actual live code, writing an algorithm to do array contents matching would probably be nice to do, but is there another way? I haven't noticed a built in method that does this.
<FromGitter> <Daniel-Worrall> `(a1.to_set - a2).empty?` should be performant. Hashes the first array, and compares against each element, then checks the size. There could be some minor performance increases like shortcircuiting if the set is larger than the remaining elements, but I don't see this as stdlib scope imo
<FromGitter> <Daniel-Worrall> It really depends on what sort of array comparison you're looking for. Maybe you're looking for the elements that are different in each, maybe you want their positions, maybe how often it occurs, maybe a strict true/false. There are many approaches, and each would be a different method
_whitelogger has joined #crystal-lang
<FromGitter> <acook> I think an `Array#diff` method would be handy. Probably have a little collection of such methods for different use cases, like you mention.
<FromGitter> <acook> I could make a shard for that functionality.
<FromGitter> <Daniel-Worrall> Personally, I see it being delegated to a shard
<FromGitter> <acook> Makes sense to me. Looking at crystalshards.xyz I don't see a mention of array or enumerable extensions.
<FromGitter> <acook> So it looks like a fresh one could be spun up
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter> <pammacdotnet> Hi, ⏎ I'm trying to use the concurrency model to perform long calculations in Crystal. Let's say I have a big computing function call "interp" that could be called in parallel by varying a specific parameter. This function usually takes several seconds to complete in modern x64 hardware. I want to be able to execute this code in parallel as many times as a I please. How would you do it? I can't seem to
<FromGitter> ... spawn several instances of this function and see them being called in a parallel way. ⏎ Maybe I'm understanding the concurrent model in the wrong way and I apologise beforehand. ⏎ Thanks for your tips! [https://gitter.im/crystal-lang/crystal?at=6028ecb89337c51bc686afa1]
_ht has quit [Read error: Connection reset by peer]
_ht has joined #crystal-lang
<yxhuvud> jrei: In ruby, &: is not a thing. When doing `map &:meth` what actually happens is that the &-operator is applied to the `:meth` symbol. It also works with anything that implements `#to_proc`
<yxhuvud> Symbol#to_proc was actually added to the language in rails before it was a standard feature.
<FromGitter> <oprypin:matrix.org> @pammacdotnet: crystal has 1 thread by default; cpu-bound computations can't run in parallel. please look up the
<FromGitter> <oprypin:matrix.org> `preview_mt` flag
<FromGitter> <oprypin:matrix.org> or there's always this workaround https://gist.github.com/oprypin/00953b336673719dba25
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter> <acook> @Daniel-Worrall Here's my entry into the burgeoning field of collection helper function shards, feel free to toss out more ideas: https://github.com/acook/enumerous
<FromGitter> <acook> I also included a port of my `find_and_map` gem from Ruby. All like 5 lines of it.
<FromGitter> <acook> It's got tests, CI, and fancy badges so you know it's legit.
DeBot has quit [Quit: Crystal IRC]
asterite has quit [Quit: Bye]
straight-shoota has quit [Quit: ZNC 1.8.2 - https://znc.in]
jhass has quit [Quit: Bye]
DeBot has joined #crystal-lang
asterite has joined #crystal-lang
straight-shoota has joined #crystal-lang
jhass has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> @acook: may i ask, how did you end up choosing circleci
<FromGitter> <oprypin:matrix.org> also like... *a customized AGPL* is basically saying "to any onlookers, just f*** right off, dont use my lib"
<FromGitter> <jrei:matrix.org> Monkey patching the stdlib is also no thay great 😕
postmodern has quit [Quit: Leaving]
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Max SendQ exceeded]
HumanG33k has joined #crystal-lang
sz0 has joined #crystal-lang
sagax has joined #crystal-lang
zorp has joined #crystal-lang
<sorcus> https://github.com/crystal-lang/crystal/issues/7777 - still not working even for "File.tempfile -> new_path" X-)
<sorcus> But, `File.copy & File.delete` works fine. Happy crystalling :-D
<FromGitter> <rukkiddo> is there any examples for mysql stored procedures with cyrstal?
<FromGitter> <rukkiddo> i used db.exec myproc
<FromGitter> <rukkiddo> PROCEDURE myproc can't return a result set in the given context
<FromGitter> <rukkiddo> but when I call same proc in any other language it works fine
<FromGitter> <rukkiddo> > PROCEDURE myproc can't return a result set in the given context ⏎ ⏎ i mean this is the error
<FromGitter> <Blacksmoke16> might just not be supported? :shrug:
<FromGitter> <Blacksmoke16> yea its not
<FromGitter> <rukkiddo> oh, and that issue is from 2018
<sorcus> rukkiddo: you can be first, who resolve this ;-) :-D
<FromGitter> <rukkiddo> thanks for the encouragement lol
<FromGitter> <acook> > also like... *a customized AGPL* is basically saying "to any onlookers, just f*** right off, dont use my lib" ⏎ ⏎ It's the same exception used by Java. It's used by literally thousands of companies without a problem. (except Oracle starting problems where there aren't any of course)
<FromGitter> <acook> > Monkey patching the stdlib is also no that great 😕 ⏎ ⏎ The coreext is optional. How would you go about it?
_ht has quit [Remote host closed the connection]
<FromGitter> <acook> @oprypin:matrix.org CircleCI is one of the CI's that has native Crystal support with docs and such. The longevity of Travis came into question after their acquisition.
<FromGitter> <636f7374> IO::Memory.write_bytes IO::ByteFormat::BigEndian triggers Invalid memory access #10396
<DeBot> https://github.com/crystal-lang/crystal/issues/10396 (IO::Memory.write_bytes IO::ByteFormat::BigEndian triggers Invalid memory access)
<FromGitter> <636f7374> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=602995eb9337c51bc68847bc]
<FromGitter> <636f7374> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60299601a8c6a778480ce648]
<FromGitter> <636f7374> problem solved.
<FromGitter> <jrei:matrix.org> @ghost~602995886da037398461fe8c: https://github.com/j8r/crystalizer may be useful for you
<FromGitter> <jrei:matrix.org> You can have an object, then serialize/deserialize from/to bytes
<FromGitter> <Blacksmoke16> Oof, deleted his account
<FromGitter> <jrei:matrix.org> @acook: having a dedicate type, like `CustomArray{"one", 2}`
<FromGitter> <oprypin:matrix.org> @Blacksmoke16: who deleted which account
<FromGitter> <Blacksmoke16> That guy that posted about his slice issue being solved
<FromGitter> <oprypin:matrix.org> @Blacksmoke16: thats just how the account is named. if thats what you mean
<FromGitter> <Blacksmoke16> His name didn't use to be "Ghost"
<FromGitter> <Blacksmoke16> That's what it becomes when an account is deleted
postmodern has joined #crystal-lang
<FromGitter> <acook> @jrei:matrix.org Good idea. Added custom type: https://github.com/acook/enumerous#erray-custom-array-type
<FromGitter> <jrei:matrix.org> @acook: great!
<FromGitter> <jrei:matrix.org> there are other computation libs doing the same thing to
<FromGitter> <jrei:matrix.org> (for the custom type)
<FromGitter> <jrei:matrix.org> hum https://carc.in/#/r/af75 🤔
<FromGitter> <jrei:matrix.org> got it; comes from crystal/src/compiler/crystal/syntax/parser.cr:3523
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): lol thats quite funny
<FromGitter> <jrei:matrix.org> 👍️
<FromGitter> <jrei:matrix.org> better for the issue
<FromGitter> <jrei:matrix.org> don't ask me how I found this haha
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): you crossed the threshold of "1k" issues
<FromGitter> <jrei:matrix.org> yupee. This comes back and forth
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): btw would have been better to end the link with `#L3518-L3519`
<FromGitter> <jrei:matrix.org> how can i do that
<FromGitter> <jrei:matrix.org> ha ok manually with the url
<FromGitter> <jrei:matrix.org> there is no convenient way like when reviewing PRs
<FromGitter> <Blacksmoke16> you can click, shift click the line numbers
<FromGitter> <acook> @jrei:matrix.org I've been doing some experiments with Erray and going through the source code of Array. Unfortunately Array hard codes "Array" an awful lot. I might need to load and preprocess array.cr to replace all the references to Array, heh.
<FromGitter> <acook> A whole lot of calls to `Array(T).new`. Is there a way to do something like `self.class(T).new`?
<FromGitter> <acook> Ideally in macro-land. Though I suspect the Crystal maintainers would not be open to rewriting Array to be more safely subclassable.
<FromGitter> <jrei:matrix.org> you could include `Indexable`