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
postmodern has joined #crystal-lang
Vexatoast has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
duane has quit [Ping timeout: 260 seconds]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 260 seconds]
chachasmooth has quit [Ping timeout: 260 seconds]
chachasmooth has joined #crystal-lang
duane has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
<FromGitter> <incognitorobito> Hi all, I want to check if the type used to initialize my class is comparable ⏎ Would that just be T.is_a?(Comparable) or should I use responds_to just check that the methods I need are there?
<FromGitter> <3n-k1> is there a crystal library for runtime-configured plugins, or do i have to load the so and grab a fn pointer manually?
duane has quit [Ping timeout: 246 seconds]
Andriamanitra has joined #crystal-lang
<Andriamanitra> how do i check or is it even possible to check if ARGF got anything to read? ideally i would like both "cat input.txt | my_program" and "my_program input.txt" to do work on ARGF but "my_program" should do something else (maybe print a helpful message about usage)
<Andriamanitra> the api docs don't really list the methods for ARGV object
<FromGitter> <HertzDevil> `ARGV` is an `Array(String)`
<Andriamanitra> ARGF i mean but i guess the same is true for argv too :p
<Andriamanitra> oh i should be looking at IO methods?
<Andriamanitra> got it, i'm stupid
<Andriamanitra> (ok i read through the methods and source code in argf.cr, still can't figure it out, i guess i'll have to manage without helpful messages)
postmodern has quit [Quit: Leaving]
<FromGitter> <3n-k1> event doesn't have that method, but the subclass does
<FromGitter> <3n-k1> oh wait, ignore me
<FromGitter> <3n-k1> i was scrolled way far up lol
sorcus has quit [Ping timeout: 264 seconds]
sorcus has joined #crystal-lang
sorcus has quit [Quit: WeeChat 2.9]
sorcus has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> hello
<FromGitter> <ImAHopelessDev_gitlab> happy december first
<FromGitter> <tenebrousedge> same atcha
<FromGitter> <ImAHopelessDev_gitlab> just got off work, it's crystal time baby!!
<FromGitter> <tenebrousedge> yay!
<FromGitter> <tenebrousedge> πŸ’Ž
<FromGitter> <ImAHopelessDev_gitlab> :ruby:
<FromGitter> <ImAHopelessDev_gitlab> πŸ’Ž
<FromGitter> <ImAHopelessDev_gitlab> opening up notepad++ with crystal code, and waiting on a doordash order for food. life can't get better
<FromGitter> <tenebrousedge> spacevim :plus1:
<FromGitter> <tenebrousedge> what noms are you nomming?
<FromGitter> <ImAHopelessDev_gitlab> jack in the box. value fries and jumbo jack
<FromGitter> <tenebrousedge> cool
<FromGitter> <tenebrousedge> oh shit it's Advent of Code
<FromGitter> <ImAHopelessDev_gitlab> ary on it
<erdnaxeli> does people are doing it on crystal and share their solutions?
<FromGitter> <Blacksmoke16> @incognitorobito no `is_a?` would be how you do it
<erdnaxeli> it's always a good way to learn
<FromGitter> <ImAHopelessDev_gitlab> learning? what's dat
<kevinsjoberg> I did it this morning (GMT+1), https://github.com/kevinsjoberg/aoc-2020.
<FromGitter> <Dan-Do> new UI for https://crystal-lang.org/reference is nice :)
<erdnaxeli> kevinsjoberg, cool! I try to optimize it a bit so it's not as compact:Β https://github.com/erdnaxeli/adventofcode/blob/master/2020/src/01.cr
<kevinsjoberg> erdnaxeli: I was thinking of writing an optimised solution where I subtract one of the pairs, but I decided not to pursue it given how small the actual puzzle input was.
<erdnaxeli> yep the input is really small
<kevinsjoberg> @Dan-Do when did they release that? Just now? Look slick!
<erdnaxeli> yesterday iirc
repo has quit [Ping timeout: 256 seconds]
repo has joined #crystal-lang
<FromGitter> <naqvis> @Dan-Do Added `CSS Selector` support to crystal-html5 (https://github.com/naqvis/crystal-html5) shard
<FromGitter> <Dan-Do> that's great, I will look at it
<FromGitter> <naqvis> πŸ‘
<FromGitter> <Dan-Do> btw, is there setter `node.inner_html = "<div id='foo'>bar</div>"`?
<FromGitter> <naqvis> you can set the textual part by updating the `data`, but not the node markup
<FromGitter> <naqvis> to create new node, you better construct a `Node` instance
duane has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<kevinsjoberg> Andriamanitra: Could you share the benchmark results. Not at the computer right now but interested in the output. :)
<Andriamanitra> i'm sure there are even smarter ways for the part two but at least mine is better than O(n^3)
<erdnaxeli> the smart one is … smart :p
<Andriamanitra> yeah, i wish i could say i came up with it myself :(
<kevinsjoberg> This is how my friend implemented p1 and p2 in Ruby.
<kevinsjoberg> Kind of like how he went about it.
<Andriamanitra> i was thinking there's probably a way to re-use part 1 solution, that's nice
<straight-shoota> hint: Crystal has lots of useful collection methods for these little AoC tasks
duane has joined #crystal-lang
<Andriamanitra> straight-shoota: did i miss something obvious in mine?
<straight-shoota> hm
<straight-shoota> that smart solution looks interesting
<straight-shoota> but I'd figure it would probably be faster if you use an array instead of a set. The numbers aren't that big.
<kevinsjoberg> straight-shoota: I think my implementation is very readable but it's basically "brute force". https://github.com/KevinSjoberg/aoc-2020/blob/main/01/day01.cr
<straight-shoota> And you save on hashing
<straight-shoota> kevinsjoberg, yeah it's brute force but it's also concise. And performance doesn't need to be a constraint for such tasks.
<straight-shoota> I did it that way, too. Just with less boilerplate
<kevinsjoberg> Pretty much my thinking, the puzzle input was so small I thought I'd favour readability over performance here.
<straight-shoota> readability is always top priority
<Andriamanitra> i thought combinations(2).find is too boring so i did it the fun way first
<straight-shoota> I used each_combination for being a bit less boring :D
<kevinsjoberg> Haha. I like it! 🀘
<kevinsjoberg> Anyone attending Raw Crystal by the way?
<straight-shoota> of course
<FromGitter> <Blacksmoke16> theres also that `reuse` argument
<FromGitter> <Blacksmoke16> granted idk what the challenge/problem is so no idea if its useful or not tho πŸ˜†
<straight-shoota> yeah, reuse should be passed
<kevinsjoberg> What does `reuse` do more specifically?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fc65fe28abfba5d471fc301]
<FromGitter> <ImAHopelessDev_gitlab> falsey, i hate that word
<straight-shoota> if you don't pass reuse: true the method will allocate a new array for each invocation, adding a lot of overhead
<straight-shoota> that's the safe default because it allows you to modify the array and keep a reference to it
<straight-shoota> with reuse its contents would change on the next invocation
xaxisx has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<yxhuvud> I can recommend sorting the input before using it btw - it gives me a factor 10 in performance :)
<FromGitter> <tenebrousedge> I love the gh app
<FromGitter> <tenebrousedge> apparently
<FromGitter> <tenebrousedge> `gh repo create`
<kevinsjoberg> straight-shoota: didn’t know about that. Thanks!
xaxisx has quit [Quit: Leaving...]
_whitelogger has joined #crystal-lang
<FromGitter> <wontruefree> I am presenting at Chicago Ruby tonight if anyone is interested https://www.meetup.com/ChicagoRuby/events/pjfxvrybcqbcb/
<FromGitter> <RespiteSage> Is there a Crystal leaderboard for AoC?
<FromGitter> <tenebrousedge> oh do we do leaderboards for AoC?
<FromGitter> <RespiteSage> Who can say? :P It's my first year trying to do AoC as the puzzles come out. I thought there was a Crystal leaderboard or something last year, but I might be misremembering.
<erdnaxeli> there can be private leaderboard, accessible with a code
<erdnaxeli> we could do a crystal one and share the code here
<erdnaxeli> IΒ don't know if there is a user count limit
Xeago_ has joined #crystal-lang
Xeago has quit [Read error: Connection reset by peer]
Xeago_ is now known as Xeago