Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Apr 04 2021 12:26
    @dom96 banned @acroobat
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
From IRC (bridge bot)
<Zoom[m]> Eh, does std have a sorted table?
<Zoom[m]> I'd like to iterate over countTable in order (by keys, not by value)
From IRC (bridge bot)
<FromDiscord> <Quibono> have you looked through the tables library in the std? IDK if it has it, but it's the only tables one.
From IRC (bridge bot)
<mipri> OrderedTable's .sort looks useful
From IRC (bridge bot)
<FromDiscord> <nikki> is there some shortcut for block: let thing = ...; ... stuff with thing ...; thing
<FromDiscord> <nikki> that maybe just names it it
<FromDiscord> <nikki> in the standard library
<FromDiscord> <nikki> looks like no
<FromDiscord> <nikki> just have some code that looks like: https://play.nim-lang.org/#ix=2F1U
<FromDiscord> <nikki> maybe i should make a blockIt macro lol
<FromDiscord> <nikki> also wish collect worked on json types -- but maybe i'm just doing it wrong when i tried
From IRC (bridge bot)
<FromDiscord> <ElegantBeef> @nikki so did you implement the blockit? 😄
From IRC (bridge bot)
<FromDiscord> <nikki> haha for now this doesn't happen often enough that i'd wanna
<FromDiscord> <nikki> but maybe i will if it comes up
<FromDiscord> <nikki> still working toward reaching parity with the c++ engine; once that happens it'll be a good point to give the code a look over
<FromDiscord> <nikki> have been collecting some notes
<FromDiscord> <nikki> actually may just make blockIt anyways outside the project as an exercise
<FromDiscord> <ElegantBeef> It's a rather quick to make macro
<FromDiscord> <nikki> yeah seems like it should be
<FromDiscord> <nikki> i think it's just a template
<FromDiscord> <ElegantBeef> Yea you should be able to use a template
<FromDiscord> <nikki> template blockIt(expr, body): block: var it {.injected} = expr; body; it
<FromDiscord> <nikki> that seems like it right
<FromDiscord> <nikki> where ; is newlines
<FromDiscord> <nikki> ugh sorry i barfed on the : untyped = at the end of the header
From IRC (bridge bot)
<FromDiscord> <Quibono> Is there a better way to insert something in the middle of a string than fmt?
<FromDiscord> <ElegantBeef> There are string templates
<FromDiscord> <nikki> @Quibono depends on what exactly you mean tbh
<FromDiscord> <nikki> if you have mostly literals on either side, that's different from inserting sth in the middle of a runtime string (say, something a variable is referring to)
<FromDiscord> <Quibono> So I've got a url "/v3/accounts/{accountid}/instruments"
<FromDiscord> <nikki> ah, this is actually a case to consider fmt
<FromDiscord> <nikki> i'd probably just use & myself bc. /shrug
<FromDiscord> <Quibono> Lol is either faster under the hood?
<FromDiscord> <nikki> like "/foo/" & thingy & "/bar"
<FromDiscord> <Quibono> like double & vs fmt
<FromDiscord> <ElegantBeef> Just use the proc i gave
<FromDiscord> <nikki> that proc decides based on the os you're running on, which is probably not what you want for urls
<FromDiscord> <ElegantBeef> Fuck windows
<FromDiscord> <nikki> better just write good code instead
<FromDiscord> <Quibono> lol
<Prestige> I agree, Beef
<FromDiscord> <nikki> @Quibono i can try out both and let you know on a bit, will just look at the generated C
<FromDiscord> <ElegantBeef> I'm saying fuck windows using \ as the default seperator
<FromDiscord> <nikki> i just think using the os module for concatenating urls is just bad coding
<FromDiscord> <nikki> because urls aren't about operating systems
<FromDiscord> <nikki> the format is a separate spec from file system path specs
From IRC (bridge bot)
<FromDiscord> <nikki> even though it looks like the character is the same
<FromDiscord> <ElegantBeef> I mean i didnt read url so...
<FromDiscord> <nikki> yeah "/v3/accounts/{accountId}/instruments" seems like a v classic url situation