ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
teardown has quit [Write error: Connection reset by peer]
teardown has joined #crystal-lang
<FromGitter> <> @asterite: `&:` is an expression and `&.`not?
<FromGitter> <> 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 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! []
_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> <> @pammacdotnet: crystal has 1 thread by default; cpu-bound computations can't run in parallel. please look up the
<FromGitter> <> `preview_mt` flag
<FromGitter> <> or there's always this workaround
_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:
<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 -]
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> <> @acook: may i ask, how did you end up choosing circleci
<FromGitter> <> also like... *a customized AGPL* is basically saying "to any onlookers, just f*** right off, dont use my lib"
<FromGitter> <> 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> - 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> 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> (IO::Memory.write_bytes IO::ByteFormat::BigEndian triggers Invalid memory access)
<FromGitter> <636f7374> ```code paste, see link``` []
<FromGitter> <636f7374> ```code paste, see link``` []
<FromGitter> <636f7374> problem solved.
<FromGitter> <> @ghost~602995886da037398461fe8c: may be useful for you
<FromGitter> <> You can have an object, then serialize/deserialize from/to bytes
<FromGitter> <Blacksmoke16> Oof, deleted his account
<FromGitter> <> @acook: having a dedicate type, like `CustomArray{"one", 2}`
<FromGitter> <> @Blacksmoke16: who deleted which account
<FromGitter> <Blacksmoke16> That guy that posted about his slice issue being solved
<FromGitter> <> @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> Good idea. Added custom type:
<FromGitter> <> @acook: great!
<FromGitter> <> there are other computation libs doing the same thing to
<FromGitter> <> (for the custom type)
<FromGitter> <> hum 🤔
<FromGitter> <> got it; comes from crystal/src/compiler/crystal/syntax/
<FromGitter> <> j8r ( lol thats quite funny
<FromGitter> <> 👍️
<FromGitter> <> better for the issue
<FromGitter> <> don't ask me how I found this haha
<FromGitter> <> j8r ( you crossed the threshold of "1k" issues
<FromGitter> <> yupee. This comes back and forth
<FromGitter> <> j8r ( btw would have been better to end the link with `#L3518-L3519`
<FromGitter> <> how can i do that
<FromGitter> <> ha ok manually with the url
<FromGitter> <> there is no convenient way like when reviewing PRs
<FromGitter> <Blacksmoke16> you can click, shift click the line numbers
<FromGitter> <acook> 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 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> <> you could include `Indexable`