jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
zorp has quit [Ping timeout: 240 seconds]
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 272 seconds]
chachasmooth has quit [Ping timeout: 256 seconds]
chachasmooth has joined #crystal-lang
duane has quit [Ping timeout: 258 seconds]
duane has joined #crystal-lang
_whitelogger has joined #crystal-lang
avane has joined #crystal-lang
<avane> hey all. I would like to get a specific portion of a file using hex locations (e.g. 0x123 - 0x125) and store it into a variable. how would I go about doing this?
<FromGitter> <HertzDevil> `IO#read_at(0x123, 3, &.gets_to_end)`
sagax has quit [Read error: Connection reset by peer]
yukai has quit [Ping timeout: 260 seconds]
Human_G33k has quit [Ping timeout: 240 seconds]
twistedpixels has quit [Ping timeout: 244 seconds]
twistedpixels has joined #crystal-lang
sagax has joined #crystal-lang
HumanG33k has joined #crystal-lang
zorp has joined #crystal-lang
zorp has quit [Client Quit]
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 260 seconds]
psydroid has quit [Quit: killed]
return0e[m] has quit [Quit: killed]
ryanprior has quit [Quit: killed]
psydroid has joined #crystal-lang
ryanprior has joined #crystal-lang
return0e[m] has joined #crystal-lang
_whitelogger has joined #crystal-lang
Andriamanitra has joined #crystal-lang
Liothen has joined #crystal-lang
<FromGitter> <phykos> hello there
<FromGitter> <phykos> I am looking for something like `Int#chr` but returning a c-like char
<FromGitter> <phykos> I mean `255.times { |i| puts(i.chr) }`
<FromGitter> <phykos> In Ruby it has a different behavious
<FromGitter> <phykos> behaviour
<jhass> STDOUT.write_byte i
<FromGitter> <phykos> yes but I want to save the result to a variable and not write it to the stdout
<jhass> why?
<FromGitter> <phykos> anyway just tested that line of both Ruby and Crystal and it does the same thing , I missed something
<FromGitter> <phykos> I am implementing the mandelbrot program from benchmarks game and it is slow to print it while iterating
<jhass> You can use String.build to get an IO for building a string
<jhass> but the difference to using a buffered IO shouldn't be big
<FromGitter> <phykos> yeah, this is big brain time
<FromGitter> <phykos> nope, that yields a block and I have to do that 2 times
<jhass> well just put the block around both
<FromGitter> <phykos> 1 - isn't it inefficient? ⏎ 2 - I don't exactly know the capacity of the string, I'll be overallocating stuff
<FromGitter> <asterite> you can do `STDOUT.sync = false` then manually flush
<FromGitter> <asterite> After you call the global `puts` or `print` it always flushes on a terminal, if I remember correctly
hugopl has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 260 seconds]
f1refly has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
f1refly has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Is select timeout documented anywhere cause I'm only coming across the Issue/PR
<oprypin> no
<oprypin> hm thinking how to find if there are no zeros in a nested array
<FromGitter> <Blacksmoke16> `array.none? &.zero?`?
<oprypin> `[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]].all?(&.none?(&.zero?))`
<FromGitter> <Blacksmoke16> er if its nested, `array.all? &.none? &.zero?`
<oprypin> is confusing though what do u mean all none xD
<FromGitter> <Blacksmoke16> yea :p
<oprypin> wait `.all?(&.all?(&.>(0)))` actually works?
<FromGitter> <Blacksmoke16> why wouldnt it?
zorp has joined #crystal-lang
<yxhuvud> oprypin: that's how half my code for aoc looks like :)
<oprypin> hmm?
<oprypin> oh you're commenting on the prior thing
<yxhuvud> lots of nested levels of &. blocks :)
<FromGitter> <j8r> What does `Object#==`? It's just an abstract def on object.cr, but it works on any `class`
<FromGitter> <j8r> Ho, found a "bug": https://crystal-lang.org/api/master/Struct.html#direct-known-subclasses ⏎ There are hidden object listed
<oprypin> j8r, https://crystal-lang.org/api/master/Reference.html#==(other:self)-instance-method https://crystal-lang.org/api/master/Value.html#==(other)-instance-method
<oprypin> https://crystal-lang.org/api/master/Struct.html#==(other):Bool-instance-method
<FromGitter> <j8r> ok thanks
<FromGitter> <j8r> A bit mystic this things
<FromGitter> <j8r> `abstract struct Struct` ?
<FromGitter> <j8r> Also it is said that Struct inherits from Value, which inherits from Object, which is a class
<FromGitter> <Blacksmoke16> *magic*
<FromGitter> <j8r> I guess, primitives are magic - handled directly by the compiler
<FromGitter> <Blacksmoke16> yea
<FromGitter> <lbarasti> Hi folks, I'm streaming on Twitch tomorrow at 7pm BST. I'd like to talk about Crystal and application metrics. ⏎ Would someone like to join me to explore some Prometheus queries - I'm not well versed in those - and chat about observability?
<FromGitter> <lbarasti> I'll send this again tomorrow, just in case a potential reader misses it :D
<FromGitter> <j8r> you expose Crystal metrics in the Prometheus format, which ones?
<FromGitter> <lbarasti> I was planning on starting with the basics included in https://github.com/Darwinnn/crometheus/
<FromGitter> <lbarasti> then add some fiber's heartbeat
<FromGitter> <lbarasti> counting the number of times tasks happen
<FromGitter> <lbarasti> very open ended
<FromGitter> <lbarasti> I'm not an expert on the topic by any means, so wanted to turn this into a conversation
<FromGitter> <j8r> Ha I got something for fibers
<FromGitter> <j8r> https://carc.in/#/r/9tck
<oprypin> @j8r: object
<oprypin> @j8r: Object is entirely fake; Value and Reference are the only true bases
<oprypin> and yes Value itself is still largely fake because it's impossible to create one
<FromGitter> <j8r> the cake is a lie!
<FromGitter> <j8r> (not https://github.com/axvm/cake)
<FromGitter> <lbarasti> ah, thanks! I had this :D ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f80e2f902e81701b0106f75]
<FromGitter> <lbarasti> how unsafe is unsafe_each, I'd like to understand better
<FromGitter> <j8r> better avoiding monkey patching
<FromGitter> <j8r> I think it is ok we don't modify anything
<oprypin> which unsafe_each is it? of which type
<FromGitter> <j8r> *if we don't modify anything
<FromGitter> <lbarasti> 👍
<FromGitter> <j8r> `Thread#unsafe_each`
<FromGitter> <j8r> also, you can have fibers for each thread
<FromGitter> <lbarasti> oh, I see, so if I'm in multi-threaded mode I will be missing out on fibers if I run my snippet
<FromGitter> <lbarasti> that's really useful, thanks