<< 16-08-2021 >>

00:07:38madpropsmade this little function. might be useful https://gist.github.com/madprops/9ed21ff1ca83e87878f63b404e6a13f2
00:12:13FromDiscord<Elegantbeef> for showcasing logic mad easier to use asserts `assert multistring("day", -1, "is") == "-1 days are"`
00:13:30madpropsyou're right
00:14:11arkanoiddo you know if its possible to do multiple preprocessing passes with nimterop?
00:14:40FromDiscord<Elegantbeef> I know nothing of nimterop, so nope 😀
00:20:15arkanoidk
00:55:40*arkurious quit (Quit: Leaving)
01:10:45FromDiscord<proud linux user> In reply to @konsumlamm "it's called modules": :|
01:18:32*vicfred quit (Quit: Leaving)
01:31:29FromDiscord<deech> If I have an `Option[void]` how do I instantiate `some(...)`? I tried `some[void]()` and that failed.
01:35:18FromDiscord<Yardanico> In reply to @deech "If I have an": I don't think you can, why do you need that?
01:39:53FromDiscord<deech> Considering and API where a successful action yields a `some(void)` and unsuccessful one is `none()`. In functional langs it's a nice way of chaining a bunch of actions with short circuiting if one failes.
01:40:14FromDiscord<deech> (edit) "and" => "an" | "failes." => "fails."
01:40:31FromDiscord<Yardanico> In reply to @deech "Considering an API where": what about using a plain old boolean? :P
01:40:35FromDiscord<Yardanico> since you don't need any value anyway
01:40:39FromDiscord<Yardanico> just return true or false
01:41:25FromDiscord<deech> Yeah I know. 🙂 I just wanted to flatmap things together.
01:41:41FromDiscord<deech> It's a fairly common idiom in FP but no big deal.
01:42:04FromDiscord<Yardanico> well there might be some other way to do it, since there are some FP libs out there
01:42:39FromDiscord<Yardanico> i mean some alternatives to the options module
01:45:07FromDiscord<deech> I should probably just use Status' `results` library. 🙂
02:40:05*rockcavera joined #nim
02:40:05*rockcavera quit (Changing host)
02:40:05*rockcavera joined #nim
02:57:57madpropswhat could be a good way to have a default array argument like...
02:57:58madpropsafterwords: array[2, string] = ["a", "a"]
02:58:07madpropsi want to check if it's not the default value, and do something
02:58:22madpropsbut checking if [0] == "a" seems dumb
02:58:46madpropscan't simply do [] since it expects two items
03:03:25madpropsalso is there an argument type that is fixed but accepts array and seq ?
03:03:36madpropsopenarray can be any size, but i need it fixed
03:07:06FromDiscord<Rika> Use sequtils map prolly , not sure if there’s an open array version
03:41:01NimEventerNew thread by Kalbhairab: Convert func to property box, see https://forum.nim-lang.org/t/8329
03:48:36FromDiscord<Rika> I don’t know what he means
03:48:46FromDiscord<Elegantbeef> me either
03:51:01FromDiscord<InventorMatt> I believe he is saying that he wants a GUI that can generate code for a GUI to make it easier to build
03:56:06FromDiscord<Yardanico> yeah
03:56:19FromDiscord<Yardanico> He wants something like Delphi if I understand correctly
04:05:57FromDiscord<JSONBash> does anyone know of a macro that allows array/sequence unpacking?
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:30*supakeen joined #nim
04:07:12FromDiscord<Elegantbeef> https://github.com/technicallyagd/unpack
04:09:25FromDiscord<JSONBash> In reply to @Elegantbeef "https://github.com/technicallyagd/unpack": cheers
04:40:08*rockcavera quit (Remote host closed the connection)
04:42:27*Onionhammer joined #nim
04:42:38*flynn quit (*.net *.split)
04:42:38*nixfreak_nim[m] quit (*.net *.split)
04:42:38*mjsir911 quit (*.net *.split)
04:42:38*icebattle quit (*.net *.split)
04:42:38*Amun-Ra quit (*.net *.split)
04:43:13*flynn joined #nim
04:43:13*nixfreak_nim[m] joined #nim
04:43:13*mjsir911 joined #nim
04:43:13*icebattle joined #nim
04:43:13*Amun-Ra joined #nim
04:44:54*beshr quit (*.net *.split)
04:44:54*LyndsySimon quit (*.net *.split)
04:44:54*Jjp137 quit (*.net *.split)
04:44:54*jfrent quit (*.net *.split)
04:45:22*beshr joined #nim
04:45:22*LyndsySimon joined #nim
04:45:22*Jjp137 joined #nim
04:45:22*jfrent joined #nim
04:47:18*Helios quit (Ping timeout: 272 seconds)
04:47:52*flynn quit (Ping timeout: 272 seconds)
04:48:03*Yardanico quit (*.net *.split)
04:48:04*Ekho quit (*.net *.split)
04:48:04*greyrat quit (*.net *.split)
04:48:04*robertmeta quit (*.net *.split)
04:48:04*oz quit (*.net *.split)
04:48:43*Yardanico joined #nim
04:48:43*Ekho joined #nim
04:48:43*greyrat joined #nim
04:48:43*robertmeta joined #nim
04:48:43*oz joined #nim
04:50:20*Lord_Nightmare quit (*.net *.split)
04:50:20*blackbeard420 quit (*.net *.split)
04:50:20*ecs quit (*.net *.split)
04:50:20*lucerne quit (*.net *.split)
04:50:20*jkl quit (*.net *.split)
04:50:24*nixfreak_nim[m] quit (Ping timeout: 272 seconds)
04:50:45*Lord_Nightmare joined #nim
04:50:45*blackbeard420 joined #nim
04:50:45*ecs joined #nim
04:50:45*lucerne joined #nim
04:50:45*jkl joined #nim
04:50:56*happycorsair[m] quit (Ping timeout: 268 seconds)
04:52:42*asd quit (*.net *.split)
04:52:55*asd joined #nim
04:54:20*NimBot joined #nim
04:54:31*mikko joined #nim
04:54:42*nisstyre joined #nim
04:55:26*flynn joined #nim
04:55:31FromDiscord<proud linux user> ohyes goog module
05:06:09*Onionhammer quit (Ping timeout: 248 seconds)
06:18:06*Helios joined #nim
06:55:11*nixfreak_nim[m] joined #nim
06:55:24*PMunch joined #nim
07:18:16*happycorsair[m] joined #nim
07:37:04FromDiscord<enthus1ast> He wants to render a gui element that shows all the properties (variables) of a object and also all the procs/methods like in Delphi or VisualStudio I think it's called property editor↵(@Rika)
07:39:18FromDiscord<Rika> Can’t GDB do that
07:39:45FromDiscord<Yardanico> uh no
07:40:12FromDiscord<Yardanico> as I understand he wants an ui editor which'll allow to create handlers for button events easily
07:40:16FromDiscord<Yardanico> "button have many properties like color, on_click, onHover, etc. autocomplete gives us what we need but if we can make gui which gives all button properties and we only need to provide value and it gives us code then it will be fast."
07:40:46FromDiscord<Rika> I’m still confused lol
07:40:47FromDiscord<Elegantbeef> It's very unclear what they want so maybe in time they'll elaborate and explain
07:42:02FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/876732519360389130/unknown.png
07:50:16*max22- joined #nim
08:13:16*xet7 quit (Remote host closed the connection)
08:13:16FromDiscord<Chiggy> In reply to @enthus1ast "He wants to render": Hey enthus1ast! are you there?
08:13:35FromDiscord<enthus1ast> yep but working
08:13:59FromDiscord<Chiggy> oh ok
08:14:15FromDiscord<Chiggy> can you let me know when you'll be free
08:14:24FromDiscord<enthus1ast> sure
08:14:37FromDiscord<Chiggy> please do ping me. Thanks
08:29:51*xet7 joined #nim
08:32:08NimEventerNew thread by Wani: Ubuntu Noobish Questions, see https://forum.nim-lang.org/t/8330
08:43:46*Vladar joined #nim
09:11:26*PMunch quit (Remote host closed the connection)
09:12:20*PMunch joined #nim
09:12:59*PMunch quit (Remote host closed the connection)
09:14:05*PMunch joined #nim
10:32:35FromDiscord<Stuffe> Does anyone know how to get the time as an int out of a Time object? I am trying to use getLastAccessTime for a file, it returns a Time, but when I try to access the "seconds" field it gives me an error
10:33:48PMunchWhat error?
10:34:00PMunchAnd I assume you want a UNIX timestamp?
10:34:34FromDiscord<Stuffe> yeah
10:34:34FromDiscord<PsychoClay> toUnix() ?
10:34:41PMunchtoUnix is probably what you want
10:34:54FromDiscord<Stuffe> it thinks I want to access a method called "seconds", which doesn't take a Time type as argument
10:35:30FromDiscord<Stuffe> toUnix() works! thanks
10:37:42PMunchseconds takes an integer and converts it to a TimeInterval that can be added to a Time object
10:38:10PMunchIt's so you can do things like `myTime + 10.seconds`
10:39:23FromDiscord<Stuffe> yeah but it is also listed as a field on the Time object
10:39:43FromDiscord<Stuffe> I feel like that should take precedence. But maybe it is a private field
10:39:57FromDiscord<Stuffe> In which case there is probably no reason to show it in the docs
10:41:09FromDiscord<Rika> In reply to @Stuffe "yeah but it is": It is likely a private field
10:41:40FromDiscord<Rika> Maybe it should be more obvious that it is private
10:42:00FromDiscord<Rika> I think it’s fine to show it in the docs just make it more obvious that it is private
10:43:20PMunch@Stuffe, it's private because it's not annotated with a *
10:43:38PMunchIt's a but odd that it even appears in the docs *shrugs*
10:46:52FromDiscord<Rika> Yes but that is not obvious to beginners or people skimming
10:52:19FromDiscord<PsychoClay> is it a bad idea to spawn 400 threads?
10:54:03FromDiscord<Rika> At once? Maybe
10:54:04PMunchYup
10:54:16PMunchUnless you have 400 cores
10:54:17FromDiscord<Rika> Maybe just use a thread pool
10:54:31FromDiscord<Rika> In reply to @PMunch "Unless you have 400": For all you know he might be programming for a super computer
10:55:04PMunchI mean it's not going to crash or anything, but it could easily end up being slower than a single thread
10:55:09FromDiscord<PsychoClay> 400 = 20 secs, 1gb ram↵200 = 35 secs, 500mb↵100 = 50 secs, 250mb
10:55:15FromDiscord<PsychoClay> it seems a bit faster
10:55:38FromDiscord<PsychoClay> but the ram usage is pretty high
10:55:46PMunchHmm, that actually surprises me quite a bit
10:56:00PMunchDo you by any chance lock your threads up with IO?
10:56:21FromDiscord<PsychoClay> yea it does a bunch of http requests
10:56:26PMunch@Rika, exactly, you never know :P
10:56:47PMunchTry doing it with asynchttpclient instead
10:56:51FromDiscord<PsychoClay> i know async is supposed to be better for io things
10:56:58FromDiscord<PsychoClay> but i couldnt get i to work
10:57:00FromDiscord<Rika> In reply to @PMunch "Try doing it with": I would assume that would still be slower
10:57:06FromDiscord<Rika> In reply to @PsychoClay "but i couldnt get": How?
10:57:11FromDiscord<Rika> What issues were you hitting
10:57:21FromDiscord<PsychoClay> i think its because i used waitfor
10:57:36FromDiscord<PsychoClay> but it seemed like only 1 worker was doing anything
10:57:59FromDiscord<Rika> That sounds like your issue alright
10:58:08FromDiscord<Rika> It’s a bit harder to think in async
10:58:18FromDiscord<PsychoClay> yep
10:58:23FromDiscord<Rika> Because there’s a lot of stuff being hidden from you
10:58:55FromDiscord<PsychoClay> maybe if i use 10 or so threads with async in them
10:59:16FromDiscord<Rika> Like how you don’t need to await an async proc for it to be queued in the loop (you just need to yield control back to the loop)
10:59:38FromDiscord<Rika> I know that sounds obvious to other people here
11:02:22PMunchPsychoClay, yup waitFor will stop the thread waiting for the async procedure to complete
11:02:36PMunchSo that's essentially the same as not running async
11:02:40FromDiscord<PsychoClay> so i should await instead right?
11:02:44PMunchYup
11:04:16PMunchYou could run async in multiple threads, but it's probably not going to do anything extra for you. If you need to do some processing you could have one thread that does all the async stuff and puts the results in a channel that multiple consumer threads reads from and performs the calculations
11:06:35FromDiscord<PsychoClay> sent a code paste, see https://play.nim-lang.org/#ix=3waf
11:07:35FromDiscord<PsychoClay> (edit) "https://play.nim-lang.org/#ix=3waf" => "https://play.nim-lang.org/#ix=3wag"
11:09:46FromDiscord<Rika> Needs to be in a proc with pragma async
11:10:03FromDiscord<PsychoClay> oh ok
11:10:14FromDiscord<Rika> If that’s outside of a proc make a main proc with async then do wait for on the main proc
11:12:54FromDiscord<PsychoClay> hmm it still appears to be running one at the time
11:14:14FromDiscord<PsychoClay> maybe because im using curl instead of std/httpclient
11:15:03FromDiscord<proud linux user> oof
11:15:49PMunchWait what? You're just awaiting a procedure that does a blocking call to curl?
11:15:54PMunchYeah that won't work
11:16:11FromDiscord<PsychoClay> guess its back to threads then lol
11:16:27PMunchJust use asynchttpclient instead of curl..
11:16:45FromDiscord<PsychoClay> it has no configuarbility
11:16:53FromDiscord<PsychoClay> not enough atleast
11:17:08PMunchWhat do you want to configure?
11:17:33PMunchYou should be able to configure pretty much anything you could need with it..
11:17:58FromDiscord<PsychoClay> cant write to file
11:18:34FromDiscord<PsychoClay> how do i download a 10 gb file with asynchttpclient?
11:19:15FromDiscord<PsychoClay> oh wait theres a downloadFile proc
11:19:55PMunchMhm
11:20:11FromDiscord<PsychoClay> can it do chunked downloads tho?
11:20:31PMunchDefine chunked
11:21:18FromDiscord<PsychoClay> multiple connections download different parts of a file with the range header
11:22:32FromDiscord<Rika> You just do exactly that…
11:22:36PMunchWould that even speed up the download?
11:22:53FromDiscord<PsychoClay> yea it bypassed speedlimits on some file hosting sites
11:23:01FromDiscord<PsychoClay> (edit) "bypassed" => "bypassew"
11:23:06FromDiscord<PsychoClay> (edit) "bypassew" => "bypasses"
11:23:16PMunchAh right
11:23:39FromDiscord<PsychoClay> In reply to @Rika "You just do exactly": how do u do that with httpclient ?
11:23:41FromDiscord<Rika> I could have written some pseudo code if I were home
11:24:06FromDiscord<Rika> The range thing is just a header so you just make many clients then send the get request with the differing headers
11:24:22FromDiscord<Rika> Though the writing to a file part is a bit more complicated
11:24:40FromDiscord<Rika> In reply to @Rika "The range thing is": Requests
11:24:51FromDiscord<PsychoClay> but doesnt downloadFile just start at the start of the file or something
11:25:13FromDiscord<PsychoClay> so it would just be overwriting itself all the time
11:25:25PMunchYeah, easiest would probably be to download to a bunch of small files and then stitch them together afterwards
11:25:35FromDiscord<PsychoClay> isnt that slow?
11:26:01PMunchMight be..
11:26:11FromDiscord<PsychoClay> i guess i could just get it as a string with `get` and then put it in the file
11:26:26FromDiscord<PsychoClay> but that might also be slow
11:26:39FromDiscord<Yardanico> that'll take huge amounts of RAM since you'll have to store the file in memory before writing
11:26:40PMunchWhat do you think curl is doing?
11:27:00FromDiscord<PsychoClay> well curl seems to only take a few bytes at the time
11:27:13FromDiscord<PsychoClay> wich i can then directily write to the correct place in the file
11:27:50FromDiscord<PsychoClay> it seems like that would be the fastest way
11:28:12PMunchWhat you do is queue up a bunch of `get` with asynchttpclient, then you throw on a callback that writes it to the file with an async file writer
11:28:56FromDiscord<PsychoClay> il try that, see if its faster
11:29:25FromDiscord<Rika> Since this is asynchronous you don’t need to worry about fucking up a write so it should be fine to open the file, seek, write, then close
11:29:29FromDiscord<Rika> Then yield back to the loop
11:30:22PMunchWhy open and close every step?
11:32:59PMunchFirst run a HEAD request to the file, that should give you the size. Then create an async file and run setFileSize on it with that size. Then chunk that length into parts, request them all with async, and in a callback seek the file and write into that position.
11:34:10FromDiscord<PsychoClay> yea i already did it with curl so i should be able to just translate it
11:35:42FromDiscord<PsychoClay> does httpclient support socks proxies?
11:37:30FromDiscord<Rika> In reply to @PMunch "Why open and close": I am unsure if it is safe for open to open the same file multiple times
11:37:51FromDiscord<PsychoClay> In reply to @Rika "I am unsure if": it worked for me
11:38:10FromDiscord<Rika> Then good
11:38:31FromDiscord<PsychoClay> dunno about safe but it didnt get corrupted or anything
11:38:35PMunch@Rika, why would you open it multiple times?
11:39:06FromDiscord<Rika> Because I was thinking of writing while receiving data and since this is concurrent reception of data then you need to open the same file many times
11:39:42FromDiscord<Rika> Unless you want to do the many files then combine after finish
11:39:45PMunchUhm, no?
11:39:51FromDiscord<Rika> Which I would say would probably be more robust
11:39:55FromDiscord<Rika> Explain
11:40:13FromDiscord<PsychoClay> u can just use setFilePos right to move around
11:40:19FromDiscord<Rika> Indeed
11:40:39FromDiscord<PsychoClay> open once and then just move to where u need to be?
11:41:00FromDiscord<Rika> And then pass that to each iterative
11:41:04FromDiscord<Rika> Iterator
11:41:07FromDiscord<Rika> Okay
11:41:12FromDiscord<xflywind> bug existed with opening file multiple times without closing https://github.com/nim-lang/Nim/issues/13940
11:52:09FromDiscord<Yardanico> In reply to @Rika "Because I was thinking": that won't happen
11:52:18FromDiscord<Yardanico> two async callbacks can't happen at exactly the same time
11:52:23FromDiscord<Yardanico> concurrency is not parallelism
11:52:58FromDiscord<Yardanico> since even if you do a lot of async stuff you're still essentially running a single thread
11:53:11FromDiscord<Yardanico> that said, async is actually not bad for network tasks (obviously)
11:53:26FromDiscord<Yardanico> i have a quite fast prnt.sc scraper in simple async code, also https://github.com/Yardanico/adbscan/
11:56:12arkanoidnimterop says that it is doing preprocessing, but to me seems failing in doing multiple passes
11:57:01FromDiscord<Rika> In reply to @Yardanico "two async callbacks can't": Well yes I never said parallel write
11:57:32FromDiscord<Rika> I mean having many of the same file open at once since that is possible if you yield before closing
11:57:43FromDiscord<Rika> Please read what I say
11:58:24FromDiscord<Yardanico> anyway time to do fun investigations
11:58:24FromDiscord<Yardanico> https://stackoverflow.com/questions/67665566/how-to-cosmonim-gcc-on-solus-linux-segfault
11:58:27FromDiscord<Yardanico> unanswered
11:58:38FromDiscord<Yardanico> guess i should update cosmonim (if needed) and try to find the reason of this
12:05:50PMunch@PsychoClay, something like this http://ix.io/3waA/nim
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:29*supakeen joined #nim
12:09:29FromDiscord<PsychoClay> In reply to @PMunch "<@596976507033747466>, something like this": shouldnt line 28 be await instead of waitfor?
12:10:13PMunchIt could be await, but we're not using the result
12:10:20PMunchAnd you shouldn't discard a future
12:10:32PMunchasyncCheck doesn't await completion, so that wouldn't work
12:10:54PMunchwaitFor should work fine since we've already added all the tasks
12:11:01PMunchI think..
12:12:05FromDiscord<PsychoClay> hmm i still dont really understand the difference between waitfor and await ig
12:14:11FromDiscord<Yardanico> @PMunch wouldn't it make more sense to https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D `requests` and waitFor on the result?
12:14:15FromDiscord<Yardanico> so waitFor all(requests)
12:14:29PMunchOh I was looking for something like that!
12:15:00FromDiscord<Yardanico> actually `discard waitFor all(requests)` in full right
12:15:08PMunchawait: yield control over the process to the caller, so that other stuff can be done while we're waiting for IO. waitFor: Spin until the IO is done, blocking the thread
12:15:43FromDiscord<Yardanico> hmm maybe not
12:15:49FromDiscord<Yardanico> ah wait it seems to complete
12:15:52FromDiscord<Yardanico> but took quite some time, that's weirdf
12:15:53FromDiscord<Yardanico> (edit) "weirdf" => "weird"
12:21:02*dsrw joined #nim
12:21:18PMunchNot that weird, if the server isn't throttling you it will be faster to just grab the whole file as one stream
12:22:56arkanoidI see that nor c2nim nor nimterop support C macros that require multiple preprocessor passes. If I do "gcc -C -P -E" it gets expanded successfully but now nimterop fails to convert (outputs pragma only) without explicit error, and c2nim tried to pull in whole stdlib names. I feel not following the right strategy here, what would you do?
12:27:27*rockcavera joined #nim
12:27:27*rockcavera quit (Changing host)
12:27:27*rockcavera joined #nim
12:28:35*dsrw quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:30:31FromDiscord<Yardanico> so apparently cosmopolitan doesn't seem to be happy with refc on latest nim devel, works with orc though XD
12:30:38FromDiscord<Yardanico> (sigsegv with refc, runs fine with orc)
12:31:54FromDiscord<Yardanico> ah no, i celebrated too soon, it crashes on more complex programs with orc too
12:37:41*stkrdknmibalz quit (Ping timeout: 258 seconds)
12:37:51*dsrw joined #nim
12:44:46PMunchhttp://ix.io/3waD/nim <- PsychoClay, there, this should be a bit more stable
12:45:03PMunchStill no retry for failing requests though
12:45:18PMunchWhich you probably want
12:46:36PMunchBy the way, I'm rebooting that server right now. So replace the URL if you want to try it :P
12:47:06FromDiscord<Rika> error handling would be somewhat problematic to implement this way
12:47:40*xet7 quit (Ping timeout: 240 seconds)
12:47:47PMunchWhy?
12:48:17PMunchJust keep track of the ranges that have failed and retry them
12:51:35FromDiscord<Rika> so do you readd to the seq or what
12:51:48PMunchHuh?
12:52:10FromDiscord<Rika> do you readd the failed ranges to the requests seq with the same callback
12:53:27PMunchwhile requests.len != 0: waitFor all(requests); requests = failedRequests
12:53:52PMunchAnd in the callback populate the failedRequests sequence
12:53:58FromDiscord<Rika> so an extra seq okay
12:54:08FromDiscord<Rika> not in the same callback, in the error callback right
12:54:36FromDiscord<Rika> eh i feel like this could be nicer
12:55:21PMunchHmm, yeah I guess it would have to go in the error callback
12:56:37*arkurious joined #nim
12:59:43FromDiscord<Clonkk> As anyone heard / used NvChad ? https://github.com/NvChad/NvChad
13:01:06*xet7 joined #nim
13:01:09FromDiscord<Rika> what does it do?
13:01:55PMunchWell shit.. My server doesn't seem to want to come back up..
13:02:09*kayabaNerve_ joined #nim
13:03:18FromDiscord<PsychoClay> eew lua
13:04:44FromDiscord<Rika> `if s > size or i + chunkSize == size: size else: s` why the or? s >= size would be true if the other is true is it not?
13:05:25FromDiscord<Rika> actually no the or is just not needed at all since if s == size it doesnt matter...
13:05:33*kayabaNerve quit (Ping timeout: 276 seconds)
13:11:17*max22- quit (Ping timeout: 245 seconds)
13:13:22*max22- joined #nim
13:16:16PMunchHuh?
13:17:47PMunchs > size is to cap the last range. i + chunkSize == size is to make sure that if the chunks exactly split the size the last chunk wouldn't do -1 and then lose a byte
13:18:04PMunchSince it loops to size -1
13:18:33FromDiscord<PsychoClay> In reply to @PsychoClay "400 = 20 secs,": async 100 = 30 secs, 50mb↵async 200 = 20 secs, 50mb↵async 400 = 10 sec, 60mb
13:19:05FromDiscord<PsychoClay> def a big improvement
13:19:19FromDiscord<Rika> In reply to @PMunch "s > size is": then just add 1 to s? s+1 > size?
13:23:51PMunchHmm, yeah I guess :P
13:26:17*max22- quit (Ping timeout: 245 seconds)
13:29:42FromDiscord<Rika> also this naming is awful, i did `s/\<i\>/chunkStart/g` and `s/\<s\>/chunkEnd/g` then removed stop and just did `min(size, ...)`
13:29:51FromDiscord<Rika> not sure if that's equivalent though, have to check
13:30:04FromDiscord<Rika> actually, why is it -1?
13:39:26*Vladar quit (Remote host closed the connection)
13:41:17PMunchWhy is what -1?
13:43:05PMunchI originally had min(size, ...) but that had a bad edge case where it would drop the last byte of the file
13:45:36FromDiscord<fae> what's the difference between `for k, v in table:` and `for k, v in table.pairs`
13:45:43PMunchNothing
13:46:09PMunchThe pairs iterator is automatically assumed when you give two variables in a for loop
13:46:41FromDiscord<fae> but if you only do one variable it returns it as a tuple, hmm
13:46:51PMunchYup
13:47:07PMunchThe k, v syntax is just sugar for tuple unpacking
13:47:28FromDiscord<fae> cool, feels very compact
13:49:46*pro joined #nim
13:50:10*pro quit (Client Quit)
14:05:37*PMunch quit (Quit: Leaving)
14:23:07*max22- joined #nim
14:38:42FromDiscord<Chiggy> In reply to @enthus1ast "yep but working": You there?
14:43:12*nisstyre quit (Changing host)
14:43:12*nisstyre joined #nim
15:05:23FromDiscord<enthus1ast> want to look at your nimscript tutorials ;)
15:11:23FromDiscord<Chiggy> In reply to @enthus1ast "want to look at": Huh?
15:11:27FromDiscord<haxscramper> I have some examples in https://github.com/haxscramper/hack/tree/master/testing/nim/compilerapi and added seveal more
15:11:37FromDiscord<haxscramper> From peterme.net
15:13:23FromDiscord<enthus1ast> [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)\: this dynamic execution thing is hard stuff (for me), i want to play around with nimscript first to get more familiar with compiler/vm api
15:13:42FromDiscord<enthus1ast> at least i fixed the return issue
15:14:10FromDiscord<haxscramper> yes, the code I linked starts with basic examples
15:14:18FromDiscord<haxscramper> like hello world
15:14:18FromDiscord<enthus1ast> yeah i see
15:17:52FromDiscord<dom96> In reply to @PMunch "<@596976507033747466>, something like this": nice example, but you should really make these changes: template->proc, do not use `waitFor` in an async proc, ever.
15:46:05FromDiscord<Chiggy> In reply to @enthus1ast "want to look at": What did you mean?
15:46:18FromDiscord<Chiggy> (edit) "In reply to @enthus1ast "want to look at": What did you mean? ... " added "was that msg meant for me"
16:02:34*flynn quit (Ping timeout: 240 seconds)
16:03:41*flynn joined #nim
16:05:43FromDiscord<PsychoClay> is there a way to get n amount of (random) elements from a `HashSet`
16:07:30FromDiscord<Rika> pop?
16:07:34FromDiscord<Rika> https://nim-lang.org/docs/sets.html#pop%2CHashSet%5BA%5D
16:07:37FromDiscord<PsychoClay> hmm yea ig
16:07:52FromDiscord<Rika> just pop n times
16:23:52*_KurtGodel joined #nim
16:26:21FromDiscord<TechnoRazor> If I want to abandon OOP completely, there's just one issue that I can't find a solution to:↵In Java or other object-oriented languages, you can keep a list of objects that match a certain interface. Is there any way to do this, or something similar, in Nim? Generics don't work because there's no way to know the type of an object in the list at compile-time.
16:26:55*KurtGodel quit (Ping timeout: 268 seconds)
16:30:17FromDiscord<chiggy_> [enthus1ast](https://matrix.to/#/@sn0re:matrix.code0.xyz) you there?
16:34:11FromDiscord<⃟⃟> when i saw that i already noticed hte text is grey
16:34:42FromDiscord<⃟⃟> why would you stare at grey text for extended periods of time
16:34:59FromDiscord<⃟⃟> the comments looks even harder to read
16:36:02FromDiscord<⃟⃟> also i see those bars which look like for a music player
16:36:05FromDiscord<⃟⃟> ....in a text editor
16:38:33FromDiscord<Rika> what are you talking abou
16:38:35FromDiscord<tandy> when using the \`poParentStreams\` option, and the \`process.errorStream\`, how do i stop the program from stopping when there is an error? I just want the error to be logged
16:41:04FromDiscord<haxscramper> In reply to @TechnoRazor "If I want to": You can try using concepts (experimental) or https://github.com/yglukhov/iface
16:43:28FromDiscord<TechnoRazor> It doesn't look like you can use a concept as a type for a seq, sadly https://media.discordapp.net/attachments/371759389889003532/876868773985022023/unknown.png
16:43:54FromDiscord<haxscramper> yes, concepts define compile-time interface
16:44:51FromDiscord<TechnoRazor> Yeah that's the issue
16:45:46FromDiscord<TechnoRazor> I need some way of storing objects that match a certain interface into an array or seq or something, without their types being known at compile-time
16:49:25*max22- quit (Quit: Leaving)
16:50:27*max22- joined #nim
16:54:23FromDiscord<gerwy> hi, so umm idk where i can post it and i just wanted to show it lol↵i made mandelbrot renderer that is using avx2 and also multithreading, again thanks for everyone that helped me :>
16:54:26FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/876871531727294464/image.png
16:54:43FromDiscord<haxscramper> In reply to @TechnoRazor "I need some way": then try iface
16:55:24FromDiscord<everyon> In reply to @Life Sucks "hi, so umm idk": can you post a link please?
16:57:53FromDiscord<TechnoRazor> In reply to @haxscramper "then try iface": iface seems to work well, thanks!
17:07:56FromDiscord<gerwy> In reply to @everyon "can you post a": i just wrote it and it works but there are still a lot of issues with it so i don't recommend to use that for anything but yeah its in my tomata project↵https://github.com/g3rwy/tomata↵its mandel_optim
17:08:44FromDiscord<gerwy> in near future i could also try to rewrite it in GLSL for even more performance, but raylib shader needs to work for that and it doesn't
17:10:46*icebattle quit (Ping timeout: 272 seconds)
17:19:09FromDiscord<treeform> In reply to @Life Sucks "hi, so umm idk": That is pretty cool! I also made one recently using shady:
17:19:11FromDiscord<treeform> https://media.discordapp.net/attachments/371759389889003532/876877765801017384/mandelbrot.png
17:19:25FromDiscord<treeform> Mine does not look as good.
17:19:42FromDiscord<treeform> https://github.com/treeform/shady/blob/master/examples/circle.nim
17:19:58FromDiscord<treeform> https://github.com/treeform/shady/blob/master/examples/mandelbrot.nim
17:20:16FromDiscord<treeform> But same code runs on both GPU and CPU.
17:21:15FromDiscord<treeform> How can I make mine look as good as yours?
17:23:59arkanoidfilterIt cannot be used on iterator?
17:25:37FromDiscord<Rika> sequtils things can only be used on container-like types
17:25:43FromDiscord<Rika> iterators can be infinite so
17:25:50FromDiscord<Rika> would need a different implementation
17:27:34arkanoidgot it
17:28:13arkanoidnot sure then why XmlNode "items" proc is an iterator
17:28:24arkanoidshouldn't the child nodes be finite
17:30:35arkanoidalso: what's this? https://nim-lang.org/1.0.6/sequtils.html#items.i
17:31:57FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/collections/sequtils.nim#L985 mapit & other explicitly call items so it break everything
17:32:15FromDiscord<haxscramper> it is not about infinite or finite iterators, it has nothing to do with seqs
17:32:19FromDiscord<haxscramper> filterit etc.
17:33:05FromDiscord<haxscramper> In reply to @arkanoid "also: what's this? https://nim-lang.org/1.0.6/sequt": you need this in order to iterate over closure iterator
17:33:09FromDiscord<haxscramper> idk why this is not in system
17:33:48FromDiscord<haxscramper> but `let it = (iterator(): int = yield 12)` and `for i in it` probably won't work by default
17:34:13FromDiscord<haxscramper> ye https://wandbox.org/permlink/Vz6iCJ5xCbIKoc7k
17:34:17arkanoidI'm just trying to filter out XmlNode according to direct child tag
17:34:47arkanoidfor node in sequtils.items(rootNode).filterIt(it.tag == "bar"):
17:35:12arkanoidfor node in sequtils.items(rootNode.items).filterIt(it.tag == "bar"):
17:35:35FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wc4
17:36:33FromDiscord<haxscramper> I think there should be a library for composable `collect`-like code, similar to zerofunctional and the thing I described in pattern matching article
17:36:41arkanoidI think there's something wrong with your paste on nim-lang
17:36:54FromDiscord<haxscramper> https://wandbox.org/permlink/f6AEg6GLn7ugyqMM
17:38:15FromDiscord<gerwy> In reply to @treeform "": @treeform oh shit so you are the author of shady hah↵i tried to use it too, because GLSL was my target too, but raylib doesn't like it for some reason... (using the mandelbrot from shady examples)
17:39:55*rockcavera quit (Remote host closed the connection)
17:40:15FromDiscord<haxscramper> In reply to @arkanoid "for node in sequtils.items(rootNode.items).filterIt": Though in this particular case you overenginerr stuff `echo parseXml("<a><b/><c/><b/></a>").filterIt(it.tag == "b")`
17:40:37FromDiscord<haxscramper> `filterIt` implicitly calls items, so you don't need to
17:41:18FromDiscord<haxscramper> !eval import std/[sequtils, xmltree, xmlparser]; echo parseXml("<a><b/><c/><b/></a>").filterIt(it.tag == "b")
17:41:22NimBot@[<b />, <b />]
17:42:33FromDiscord<treeform> In reply to @Life Sucks "<@107140179025735680> oh so you": I never test it with raylib so I don't know. It just produces GLSL code you can inspect it to see what the issues is.
17:44:37arkanoidk thanks
17:44:38FromDiscord<gerwy> yeah i tried, i wanted to use the generated glsl file and one issue i think i could have was that i couldn't get or set time uniform↵but idk, if shady won't work for me i can also try to modify julia set example in nimraylib-now
17:50:28FromDiscord<Rika> didnt realise it worked with closure iterators
17:50:32*jfrent left #nim (WeeChat 3.1)
17:50:36FromDiscord<Rika> then the issue is that items() isnt a closure iterator no?
17:53:16FromDiscord<haxscramper> you mean filterIt?
17:53:24FromDiscord<haxscramper> "worked with closure iterators"
17:58:09FromDiscord<Rika> yes the reply didnt seem to work
17:58:10FromDiscord<Rika> xd
18:02:12FromDiscord<haxscramper> filterit break with `.items` not because it is a non-closure, but because it calls `items()` explicitly in template, so you get `items(items(X))`, or `items(<some other iterator>)`
18:02:22FromDiscord<haxscramper> If inline iterators were composable this would be a non-issue
18:07:35FromDiscord<Chiggy> Hey uh, can anyone help me port some python code into nim? the thing is my code right now is too slow to run in python. And am new to nim, so some help would be appreciated 😅
18:08:06FromDiscord<linux user> do it man
18:08:11FromDiscord<linux user> let the probkllems in
18:10:30FromDiscord<Rika> In reply to @haxscramper "filterit break with `.items`": well if `items()` were wrapped in a closure iterator then it would work because of the proc sent above
18:10:58FromDiscord<Rika> if it were tried with another inline iterator it would not work i assume, doesnt that mean i'm right?
18:15:33FromDiscord<Rika> In reply to @Chiggy "Hey uh, can anyone": well it would be nice to just have said what you needed help with
18:16:46FromDiscord<Chiggy> I tried porting the first part (of 3 parts) of my python code to nim, and uhhh, its horribly inefficient. my python code took 2 minutes 15 seconds, and nim version took 11 minutes 💀. I am now looking into ways I can improve my code
18:17:00FromDiscord<Chiggy> my python code <https://gist.github.com/Chiggy-Playz/09daa4563f5b7dd0275d92ffbefef60e>
18:17:02FromDiscord<Rika> well yeah but i mean more
18:17:03FromDiscord<Rika> okay
18:17:06FromDiscord<Rika> the nim code?
18:17:12FromDiscord<Chiggy> gimme a sec lemme upload
18:18:08FromDiscord<Rika> i didnt realise it is 3 am for me okay well im not sure if i can help
18:18:13FromDiscord<Chiggy> In reply to @Rika "the nim code?": nim code <https://gist.github.com/Chiggy-Playz/2217d1322cd77527c246c136bead70ee>
18:18:28FromDiscord<Chiggy> In reply to @Rika "i didnt realise it": oh
18:18:30FromDiscord<Chiggy> well
18:18:39FromDiscord<Chiggy> ig I will be stuck on it lol
18:19:17FromDiscord<Chiggy> does nim have something like python dicts
18:19:19FromDiscord<Rika> ill look at it and try if i can see anything obvious but ill leave soon
18:19:24FromDiscord<Rika> yes theyre called tables
18:19:48FromDiscord<Chiggy> why are they not in here lol https://media.discordapp.net/attachments/371759389889003532/876893018886656041/unknown.png
18:20:23FromDiscord<PsychoClay> theyre here https://nim-lang.org/docs/lib.html
18:20:26*max22- quit (Ping timeout: 272 seconds)
18:20:51FromDiscord<Chiggy> ok
18:21:34FromDiscord<Rika> i dont see anything obviously slow other than probably the `json` module, you might have more luck with another (3rd party) json parser
18:21:52FromDiscord<Chiggy> the loop is the slowest thing
18:21:58FromDiscord<Chiggy> its just
18:22:00FromDiscord<Chiggy> so slow lol
18:22:34FromDiscord<Chiggy> I am looking into tables
18:22:36FromDiscord<Chiggy> (edit) "I am looking into tables ... " added "r"
18:22:38FromDiscord<Chiggy> (edit) "r" => "rn"
18:22:45FromDiscord<Chiggy> hopefully they will help out much more
18:23:18FromDiscord<PsychoClay> doesnt `client.getContent("ip")` give any errors?
18:23:27FromDiscord<PsychoClay> ip isnt a valid url right?
18:23:27FromDiscord<Chiggy> no?
18:23:34FromDiscord<Chiggy> I changed the ip on purpose
18:23:35FromDiscord<Chiggy> duh
18:23:38FromDiscord<PsychoClay> ahh ok
18:23:42FromDiscord<Chiggy> wait
18:23:49FromDiscord<Chiggy> <https://gist.github.com/Chiggy-Playz/09daa4563f5b7dd0275d92ffbefef60e> if you scroll down
18:23:53FromDiscord<Chiggy> you can see it return
18:23:54FromDiscord<Chiggy> (edit) "return" => "returns"
18:24:01FromDiscord<Chiggy> whats present in the `raw_data.json` file
18:24:35FromDiscord<Rika> In reply to @Chiggy "hopefully they will help": doubt
18:24:58FromDiscord<Chiggy> ah shit
18:25:23FromDiscord<Rika> just use a different json library, i feel like it would be faster that way. maybe packedjson?
18:25:44FromDiscord<Chiggy> is it really the issue of the json lib and not my code?
18:25:55FromDiscord<Chiggy> like old players gts contains a good amount of jsonnodes. Like 40k+
18:26:09FromDiscord<Rika> `json` is notorious for being slow so its my suspicion
18:26:14FromDiscord<Rika> yes
18:26:27FromDiscord<Rika> if that's so im almost sure its `json` now
18:26:40FromDiscord<Chiggy> so what do you suggest
18:26:42FromDiscord<PsychoClay> if you get really stuck u can try the profiling section in this guide: https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html
18:26:44FromDiscord<Rika> swap
18:26:48FromDiscord<Rika> to packedjson
18:27:01FromDiscord<Rika> or try doing something else, do you really need to copy the whole section?
18:27:22FromDiscord<Chiggy> huh?
18:27:29FromDiscord<Rika> if you can avoid doing `player["Old Server"] = player["Server"]` and company then it would probably be quicker
18:27:40FromDiscord<Chiggy> I have to
18:27:45FromDiscord<Chiggy> its necesarry
18:27:59FromDiscord<Chiggy> those 4 lines are important yes
18:27:59FromDiscord<Rika> then use the different library, i dont see any other way to make this quicker
18:28:03FromDiscord<Chiggy> which
18:28:11FromDiscord<Rika> i already told you
18:28:54FromDiscord<Chiggy> ok
18:29:34FromDiscord<Rika> im thinking still
18:29:59FromDiscord<Rika> actually
18:29:59FromDiscord<Rika> wait
18:30:06FromDiscord<Rika> @Chiggy wait, maybe try a different GC
18:30:28FromDiscord<Rika> im not sure if that would help at all because having a massive number of json nodes means a fucktonne of indirection
18:30:55FromDiscord<Chiggy> I am thinking of converting my json nodes into table key value pairs
18:31:07FromDiscord<Rika> actually, does it even copy? i dont think that's the issue is it?
18:31:12FromDiscord<Chiggy> then I can do if table.hasKey instead of this https://media.discordapp.net/attachments/371759389889003532/876895883420135475/unknown.png
18:31:21FromDiscord<Chiggy> I believe this image above is the issue
18:31:26FromDiscord<Chiggy> coz like it has to loop 40k every time
18:31:34FromDiscord<Chiggy> (edit) "every time" => "like 6-7k times"
18:31:50FromDiscord<Chiggy> would table.hasKey be fast
18:31:51FromDiscord<Chiggy> (edit) "fast" => "faster"
18:31:55FromDiscord<Chiggy> I think it will be?
18:31:57*greaser|q quit (Changing host)
18:31:57*greaser|q joined #nim
18:32:00FromDiscord<Rika> what
18:32:01*greaser|q is now known as GreaseMonkey
18:32:14FromDiscord<Rika> i dont see where haskey would slot in here
18:32:25FromDiscord<Chiggy> yes sorry
18:32:32FromDiscord<Chiggy> In reply to @Chiggy "I am thinking of": .
18:32:34FromDiscord<Chiggy> this is my plan now
18:32:47FromDiscord<Rika> please note that tables arent like python dictionaries
18:32:54FromDiscord<Chiggy> uh
18:33:14FromDiscord<Rika> in the fact that the value is limited to a single type is what i mean
18:33:20FromDiscord<Chiggy> oh ok
18:33:21FromDiscord<Chiggy> lmao
18:33:24FromDiscord<Chiggy> you had me scared
18:33:25FromDiscord<Chiggy> thats fine
18:33:33FromDiscord<Chiggy> all my values will be string
18:33:35FromDiscord<PsychoClay> u can also try the `strtabs` lib if ur only working with strings
18:33:43FromDiscord<PsychoClay> i think its supposed to be faster
18:33:55FromDiscord<Chiggy> I don't think I will be working with only strings
18:33:59FromDiscord<Chiggy> but I will have a look at it
18:34:02FromDiscord<PsychoClay> in the table i mean
18:34:20FromDiscord<Chiggy> also, for some reason, as soon as I import nimprof, lots of errors appear
18:35:22FromDiscord<Chiggy> In reply to @Rika "in the fact that": except that they are pretty much the same right
18:36:03FromDiscord<Rika> i think so? my brain is thinking of a lot of scenarios and i cant see any difference
18:36:14FromDiscord<Chiggy> ok
18:36:23FromDiscord<Rika> other than pythony stuff like how globals is a dict or w/e
18:39:27FromDiscord<Chiggy> can I have nested table?
18:39:33FromDiscord<Chiggy> key is string, but value is another tble
18:39:36FromDiscord<Chiggy> (edit) "tble" => "table"
18:39:45FromDiscord<PsychoClay> should be fine
18:39:57FromDiscord<Chiggy> So how do I init such a table?
18:40:50FromDiscord<PsychoClay> i think its automatic not sure tho
18:40:57FromDiscord<Chiggy> `initTable[string, initTable[string,string]]()` ?
18:41:01FromDiscord<Rika> no need to init
18:41:14FromDiscord<Chiggy> I was just trying to follow this example : https://nim-lang.org/docs/tables.html#basic-usage-table
18:41:57FromDiscord<Rika> `initTable[string, Table[string, string]]()`
18:42:09FromDiscord<Rika> `Starting from Nim v0.20, tables are initialized by default and it is not necessary to call this function explicitly.`
18:42:12FromDiscord<Rika> https://nim-lang.org/docs/tables.html#initTable
18:42:32FromDiscord<Chiggy> so how do I create a blank table
18:42:41FromDiscord<Chiggy> just `var t = {}.toTable` ?
18:42:43FromDiscord<Rika> the table is blank by default
18:42:45FromDiscord<PsychoClay> sent a code paste, see https://play.nim-lang.org/#ix=3wcx
18:43:04FromDiscord<Chiggy> Ok
18:43:05FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3wcy
18:43:34FromDiscord<Rika> it is pushing 4 am
18:43:36FromDiscord<Rika> i forgot
18:43:48FromDiscord<Chiggy> you should sleep
18:43:53FromDiscord<PsychoClay> how are u even awake lol
18:43:56FromDiscord<Chiggy> I appreciate your help 🙂
18:44:50FromDiscord<Rika> In reply to @PsychoClay "how are u even": short story is that ive been doing this for years now because of the schools i attend (prestigious therefore pretty intense)
18:45:12FromDiscord<PsychoClay> that sucks
18:49:04FromDiscord<Chiggy> Ok uh somethings going wrong here
18:49:12FromDiscord<Chiggy> https://media.discordapp.net/attachments/371759389889003532/876900416300941322/unknown.png
18:49:32FromDiscord<Chiggy> this is how I defined old_players_gts var old_players_gts : Table[string, Table[string, string]]
18:49:38FromDiscord<Chiggy> (edit) "var" => "`var" | "string]]" => "string]]`"
18:50:34FromDiscord<PsychoClay> Put a getStr after x[name]
18:51:53FromDiscord<Chiggy> oh yeah thans
18:51:54FromDiscord<Chiggy> (edit) "thans" => "thanks"
18:51:55FromDiscord<Chiggy> btw
18:52:02FromDiscord<Chiggy> can I just do `$x["Name"]`
18:52:14FromDiscord<PsychoClay> I dont think so
18:52:51FromDiscord<PsychoClay> I think that gives the string representation of the jsonnode
18:53:05FromDiscord<Chiggy> oh ok
18:56:40*dsrw quit (Ping timeout: 240 seconds)
18:57:08*SebastianM joined #nim
19:03:47NimEventerNew thread by Martin: Newbie kick-in-the-pants: nim as a cgi application, see https://forum.nim-lang.org/t/8331
19:07:25*max22- joined #nim
19:08:03*dsrw joined #nim
19:08:22FromDiscord<tandy> is it possible to "subtract" two sorted seqs in nim?
19:08:22FromDiscord<tandy> to get the difference / missing items?
19:12:37FromDiscord<exelotl> there's probably not a built-in method for it
19:15:04*rockcavera joined #nim
19:15:04*rockcavera quit (Changing host)
19:15:04*rockcavera joined #nim
19:16:04FromDiscord<Chiggy> if I define a variable inside a for loop, it will not be accessible out of the lop right? and will be destroyed when loop is done?
19:18:52FromDiscord<haxscramper> yes
19:19:18FromDiscord<haxscramper> For loop variables are not exactly "created", so I'm not sure if they would trigger destructor
19:19:34FromDiscord<Chiggy> yeah destruction actually doesnt matter much in this case
19:19:44FromDiscord<haxscramper> i.e. for loop variables are not copied from container
19:20:00FromDiscord<Chiggy> and also one more question
19:20:26FromDiscord<Chiggy> I have a table. Printing it would be horrible since its really big. How can I save it into a file?
19:21:12FromDiscord<haxscramper> You want to serialize or just print to the file?
19:21:32FromDiscord<haxscramper> priting to file would be `"myFile".writeFile($table)`
19:21:34FromDiscord<Chiggy> Like, for debugging purposes, I would like to see the contents of the table
19:21:44FromDiscord<Chiggy> but its really big to echo
19:21:50FromDiscord<Chiggy> In reply to @haxscramper "priting to file would": ok
19:26:29*SebastianM quit (Quit: Bye)
19:33:07FromDiscord<Chiggy> sent a code paste, see https://play.nim-lang.org/#ix=3wcL
19:33:17FromDiscord<Chiggy> (edit) "https://play.nim-lang.org/#ix=3wcL" => "https://play.nim-lang.org/#ix=3wcM"
19:34:51FromDiscord<haxscramper> sent a code paste, see https://paste.rs/83C
19:35:09FromDiscord<haxscramper> (edit) "https://play.nim-lang.org/#ix=3wcO" => "https://play.nim-lang.org/#ix=3wcN"
19:35:19FromDiscord<haxscramper> This would leave `"Server"` node in the both keys and values
19:35:20FromDiscord<Chiggy> I am hoping to make the seq elements Table
19:35:27FromDiscord<Chiggy> (edit) "I am hoping to make the seq elements Table ... " added "not a jsonNode"
19:35:47FromDiscord<haxscramper> so you want to have like `table[string, seq[Record]]`?
19:35:56FromDiscord<Chiggy> um. Whats a Record
19:35:58FromDiscord<Chiggy> let me searh
19:35:59FromDiscord<Chiggy> (edit) "searh" => "search"
19:36:07FromDiscord<haxscramper> `{"Name":"Foo","Time":"1 minute"},`
19:36:48FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wcQ
19:36:51*dsrw quit (Ping timeout: 268 seconds)
19:37:16FromDiscord<Chiggy> I didnt understand the mget part
19:37:16FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wcR
19:37:25FromDiscord<Chiggy> wouldnt that just set the value to an empty seq every time
19:37:26FromDiscord<haxscramper> https://nim-lang.org/docs/tables.html#mgetOrPut%2CTable%5BA%2CB%5D%2CA%2CB
19:37:44FromDiscord<haxscramper> In reply to @Chiggy "wouldnt that just set": mgetOrPut stands for mutable get OR put
19:37:54FromDiscord<haxscramper> > Retrieves value at t[key] or puts val if not present, either way returning a value which can be modified.
19:38:21FromDiscord<haxscramper> so no, it would not put empty sequence each time, only when first encountered
19:38:29FromDiscord<Chiggy> oh yeah it makes sense now
19:38:32FromDiscord<Chiggy> got it
19:39:16FromDiscord<Chiggy> sent a code paste, see https://play.nim-lang.org/#ix=3wcS
19:39:26*dsrw joined #nim
19:39:38FromDiscord<haxscramper> https://wandbox.org/permlink/Mp2FTMq0f5kllz2S
19:40:20FromDiscord<haxscramper> You want to get result as `Table[string, seq[JsonNode]]` or as `Table[string, seq[Record]]`?
19:40:57FromDiscord<Chiggy> Whichever is best for performance
19:42:31FromDiscord<Chiggy> so uh, which would be best for perf?
19:44:49FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wcX
19:44:56FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wcY
19:45:01FromDiscord<haxscramper> jsony is ~43/23 times faster
19:45:09FromDiscord<haxscramper> ~twice
19:46:38FromDiscord<Chiggy> Damn this timeit thingy is cool
19:46:44FromDiscord<Chiggy> lemme search jsony
19:47:09FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wd0
19:47:24FromDiscord<haxscramper> In reply to @Chiggy "lemme search jsony": https://github.com/treeform/jsony https://github.com/treeform/benchy
19:47:30FromDiscord<Chiggy> got it
19:54:23*dsrw quit (Quit: Textual IRC Client: www.textualapp.com)
19:57:45FromDiscord<Chiggy> hey @haxscramper, if my input json has spaces in the field, jsony just puts a blank string (`""`) for the records. How do I deal with that
19:58:13FromDiscord<haxscramper> `renameHook`
19:58:52FromDiscord<Chiggy> ok
19:59:03FromDiscord<Chiggy> so just defining a proc called renameHook wil ldo it?
19:59:05FromDiscord<Chiggy> (edit) "wil ldo" => "will do"
19:59:41FromDiscord<haxscramper> yes, I have it in my example
19:59:57FromDiscord<haxscramper> I used it to convert `"Name"` to the nep1-conforming field names
20:00:12FromDiscord<Chiggy> ok
20:00:14FromDiscord<Chiggy> thanks
20:06:19arkanoidis it possible to force a seq[MyVariantTypeOfParticularKind]?
20:06:56FromDiscord<undersquire> wdym force
20:07:54arkanoida seq that contains object variants of a particular kind
20:08:05FromDiscord<undersquire> oh
20:08:13FromDiscord<undersquire> not that I know of
20:08:15FromDiscord<haxscramper> no, this is not possible
20:08:26arkanoidk
20:08:29FromDiscord<haxscramper> well
20:08:37FromDiscord<haxscramper> depends on definition on sanity
20:08:42FromDiscord<undersquire> 😂
20:09:00FromDiscord<haxscramper> but you can make a generic wrapper with `static[set[Kind]]`
20:09:39FromDiscord<haxscramper> and then write all sort of operators that would statically check for intersection/subset/superset relations between static generic parameters of the arguments
20:09:42FromDiscord<haxscramper> this is possible
20:10:14arkanoidI don't want it anymore :D
20:10:20FromDiscord<haxscramper> https://wandbox.org/permlink/5bWPmFbPiWEYmSDL example of this madness for compile-time query validation
20:10:40FromDiscord<haxscramper> It doesn't look that bad, just more work then you'd probably want to put in
20:10:41FromDiscord<haxscramper> ye
20:10:43FromDiscord<haxscramper> yes
20:11:20FromDiscord<haxscramper> well, now I'm interested
20:12:14arkanoidoh dear, I fear like having activated evil robot by accident
20:13:01FromDiscord<PsychoClay> you could also just use pointers right?
20:13:50FromDiscord<haxscramper> is this related to `MyVariantTypeOfParticularKind`?
20:20:25FromDiscord<haxscramper> okay, yes, https://wandbox.org/permlink/bzWymdCvs7mX8bQD type mismatch errors would literally murder anyone's willingness to work with that
20:20:40FromDiscord<haxscramper> `required type for arg: AstWrap[{0, 1, 2}] but expression 'AstWrap[toSet({akInt})]()' is of type: AstWrap[{0}]`
20:20:59FromDiscord<haxscramper> But we are getting so deep into
20:21:31FromDiscord<haxscramper> Like, this would be an awesome feature if nim supported some way of user-defined callbacks for user messages
20:21:33FromDiscord<haxscramper> idk
20:22:13FromDiscord<haxscramper> and btw, this is a zero-cost-at-runtime solution (wrap has the same `sizeof`),
20:22:33FromDiscord<haxscramper> Only paying for field access on non-compiled backends
20:24:27FromDiscord<tandy> is there a method for escaping \`$\` in a filename?
20:25:09FromDiscord<tandy> im substituting the filename in here, \` FFMPEG = "ffmpeg -hide\_banner -loglevel error -i \\"$#\\" -n -map\_metadata 0 -c\:a libopus -b\:a 128k \\"$#\\""\`, and when the filename has a \`$\` it fails some how
20:26:08FromDiscord<haxscramper> you are using runtime string interpolation with `$#`, and when file has `$` it fails. Can you use strformat maybe?
20:28:15FromDiscord<tandy> i wil try that
20:31:57FromDiscord<Chiggy> shouldnt the hour minute and second values be 1, 35 and 40 respectively? https://media.discordapp.net/attachments/371759389889003532/876926273421729832/unknown.png
20:32:36FromDiscord<tandy> hmm, since i am using this string as a constant and i dont have the vars that i am substituting until later in the program im not sure how to do it
20:32:51FromDiscord<tandy> because you cant just put fmt"string\: {}"
20:34:44FromDiscord<konsumlamm> In reply to @Chiggy "shouldnt the hour minute": `var hours, minutes, seconds = ...` doesn't destructure the result, it just assigns the same result to every variable
20:35:02FromDiscord<Chiggy> In reply to @konsumlamm "`var hours, minutes, seconds": how can I get the values then?
20:35:24FromDiscord<konsumlamm> assign them to a variable and then index?
20:35:27FromDiscord<Chiggy> like other than doing `var hour = time[0]`
20:35:31FromDiscord<konsumlamm> or use `fusion/matching`
20:35:40FromDiscord<Chiggy> hmm ok
20:40:27FromDiscord<haxscramper> I forgot you can escape `$` by doubling it
20:40:28FromDiscord<haxscramper> so replace `$` with `$$`
20:40:42FromDiscord<haxscramper> !eval import std/strutils; echo "$1 eats $$2 $2." % ["The cat", "fish"]
20:40:45NimBotThe cat eats $2 fish.
20:42:19arkanoidI'm getting "Error: unhandled exception: assignment to discriminant changes object branch; compile with -d:nimOldCaseObjects for a transition period [FieldDefect]" but I dont know how this is possible, I'm just doing "result.kind = nyMyKind" where result is non-ref
20:42:53arkanoidoh, wait, I have an idea
20:43:03FromDiscord<Chiggy> @haxscramper how can I create an empty table?
20:43:47FromDiscord<haxscramper> `var table: Table[...]`
20:44:06FromDiscord<haxscramper> you can't assign to kind fields↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
20:44:19FromDiscord<haxscramper> https://github.com/nim-lang/RFCs/issues/407
20:44:33FromDiscord<Chiggy> In reply to @haxscramper "`var table: Table[...]`": https://media.discordapp.net/attachments/371759389889003532/876929445829697536/unknown.png
20:45:11FromDiscord<haxscramper> Use `initTable[K, V]()` to init empty table then
20:45:19FromDiscord<Chiggy> ok
20:48:24arkanoidsimplest way to pretty print nested objects in nim?
20:49:53FromDiscord<haxscramper> treeform/jsony or haxscramper/hmisc/other/hpprint
20:50:04FromDiscord<haxscramper> s/jsony/print/
20:50:20FromDiscord<haxscramper> hpprint is more featured, but I still havent properly tested it
20:50:27FromDiscord<konsumlamm> In reply to @Chiggy "": the empty "table" literal is `{:}`
20:50:43FromDiscord<konsumlamm> but `var table: Table[...]` also would've worked
20:50:49FromDiscord<haxscramper> But it should give you the best results wrt. to coloring, formatting etc
20:51:23FromDiscord<haxscramper> In reply to @konsumlamm "the empty "table" literal": not when the expression is part of another I believe
20:51:52FromDiscord<Ducko> Sorry to intrude, is this the best channel for support / help?
20:52:01FromDiscord<haxscramper> `let table = toTable({"123": {:}})` `Error: invalid type: 'empty' in this context: 'KeyValuePairSeq[system.string, array[0..-1, empty]]' for var`
20:52:03FromDiscord<haxscramper> In reply to @Ducko "Sorry to intrude, is": yes
20:52:09FromDiscord<konsumlamm> no, #offtopic is way better /s
20:52:12FromDiscord<Ducko> haha
20:53:12FromDiscord<konsumlamm> In reply to @haxscramper "`let table = toTable({"123":": well, that's type inference being bad though, not having an unexpected set literal
20:53:32FromDiscord<Ducko> sent a code paste, see https://play.nim-lang.org/#ix=3wdl
20:53:39FromDiscord<konsumlamm> In reply to @haxscramper "`let table = toTable({"123":": and it would still need the `.toTable`
20:53:46*nisstyre quit (Ping timeout: 240 seconds)
20:53:49FromDiscord<haxscramper> it is annoying when "no HM" described as "bad type inference" honestly
20:54:04FromDiscord<konsumlamm> independently of it being HM, it is bad imo
20:54:10FromDiscord<tandy> oh wow
20:54:22FromDiscord<tandy> i think i need to add an escape rule for this
20:55:12FromDiscord<Ducko> (edit) "https://play.nim-lang.org/#ix=3wdl" => "https://play.nim-lang.org/#ix=3wdm"
20:55:45*nisstyre joined #nim
20:56:06FromDiscord<Ducko> it seems to be still trying to use `clang` even though I specify to use mingw? unsure
20:58:00FromDiscord<Chiggy> @haxscramper thanks to your help, I have already reduced my code time from 2 minutes to 5 seconds. I appreciate your help a lot 😁
20:58:10arkanoidthanks haxscramper
20:58:28FromDiscord<Chiggy> I will be finishing porting my program tom coz its 230am here and I gotta sleep now
20:58:40FromDiscord<Chiggy> (edit) "seconds." => "seconds ish."
20:59:03FromDiscord<haxscramper> In reply to @Ducko "it seems to be": I think you need to do `nimble -d:mingw build`. I don't remember how nimble handles flags exactly, so
20:59:19FromDiscord<haxscramper> Because `nim c -d:mingw for_windows.nim` for me correctly runs with `/usr/bin/x86_64-w64-mingw32-gcc`
20:59:19FromDiscord<Ducko> In reply to @haxscramper "I think you need": Same issue
20:59:32FromDiscord<Ducko> I have it instalel
20:59:35FromDiscord<Ducko> (edit) "instalel" => "installed"
20:59:52FromDiscord<Ducko> https://media.discordapp.net/attachments/371759389889003532/876933300499923014/unknown.png
21:00:11FromDiscord<Ducko> it just is still using `clang`?
21:00:21FromDiscord<Ducko> > Error: execution of an external compiler program 'clang
21:00:41FromDiscord<haxscramper> which nim version do you have? I Use 1.4.8 and `nim c -d:mingw test.nim` shows it is trying to use mingw
21:01:12FromDiscord<Ducko> sent a code paste, see https://paste.rs/xbF
21:01:50FromDiscord<haxscramper> and simple mingw hello world hasm the same issue?
21:01:55FromDiscord<Ducko> could it be my `nim.cfg`?
21:02:01FromDiscord<Ducko> I have `cc: "clang"` in it
21:03:18FromDiscord<Ducko> Well I have progress
21:03:23FromDiscord<haxscramper> yes, this affects configuration
21:03:31FromDiscord<Ducko> using this `$ nimble build -d:mingw --cc="gcc"`
21:03:39FromDiscord<Ducko> it now uses mingw
21:03:51FromDiscord<Ducko> but now I have errors in mingw internally?
21:04:03FromDiscord<Ducko> sent a code paste, see https://play.nim-lang.org/#ix=3wdo
21:04:03*stkrdknmibalz joined #nim
21:04:26FromDiscord<Ducko> it's trying to run `ld -z`?
21:05:05FromDiscord<haxscramper> https://forum.nim-lang.org/t/7803 okay, at least they had the same error
21:05:46FromDiscord<Ducko> > Try adding `--os:windows`
21:06:08FromDiscord<Ducko> And now I get a different error as it's trying to use normal `gcc`
21:06:30FromDiscord<haxscramper> whack-a-mole time
21:07:00FromDiscord<tandy> hmm that didnt solve my problem, i need to look into this more
21:07:51FromDiscord<Ducko> In reply to @haxscramper "whack-a-mole time": yeah I only have 2 errors lol
21:09:38FromDiscord<haxscramper> you can explicitly specify compilation path
21:09:58FromDiscord<Ducko> wdym?
21:10:07FromDiscord<haxscramper> https://nim-lang.github.io/Nim/nimc.html#crossminuscompilation
21:10:12FromDiscord<haxscramper> compiler path
21:10:26FromDiscord<Ducko> yeah I did that, same thing
21:10:30FromDiscord<haxscramper> and maybe run with `--skipParentCfg --skipProjectCfg` etc.
21:11:01FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wdr
21:11:28FromDiscord<Ducko> it compiles fine, then linking it dies
21:11:57FromDiscord<Ducko> sent a code paste, see https://play.nim-lang.org/#ix=3wds
21:13:03FromDiscord<Ducko> I think it's related to the args it's trying to pass to mingw-gcc?
21:13:13FromDiscord<Ducko> sent a code paste, see https://play.nim-lang.org/#ix=
21:13:19FromDiscord<Ducko> > `-z` `-z`
21:13:32FromDiscord<haxscramper> yes, but `-z` is known option for gcc linker
21:13:38FromDiscord<haxscramper> But maybe not for mingw
21:13:56FromDiscord<Ducko> yeah
21:14:07FromDiscord<haxscramper> You can try running `/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld` manually and check whether it accepts options, syntax etc.
21:14:24FromDiscord<Ducko> trying to do that
21:14:25FromDiscord<haxscramper> Though docs say `-z keyword -z is passed directly on to the linker along with the keyword keyword. See the section in the documentation of your linker for permitted values and their meanings. `
21:17:10FromDiscord<Ducko> In reply to @haxscramper "You can try running": can't find the file so hmm
21:18:40FromDiscord<Ducko> would these actually do anything important?↵> `-z,relro,-z,now`
21:18:57FromDiscord<haxscramper> idk, this is linker-specific
21:19:13FromDiscord<haxscramper> you can try without them, at least right now
21:19:18FromDiscord<Ducko> if I remove it, it compiles
21:20:20FromDiscord<haxscramper> ` -z now Marks the object to override the runtime linker's default mode and require non-lazy runtime binding. This is similar to adding the object to the process by using dlopen(3DL) with the RTLD_NOW mode, or setting the LD_BIND_NOW environment variable in effect. See ld.so.1(1).`
21:21:20FromDiscord<haxscramper> Anyway, I'm almost done for today, so
21:21:55FromDiscord<Ducko> fair enough
21:22:04FromDiscord<Ducko> getting someone to see if it works on win
21:22:29FromDiscord<tandy> how do you add a backslash to a string in nim?
21:22:36FromDiscord<tandy> i need it to escape a $ in a unix command
21:23:56FromDiscord<tandy> oh yeah you do double backslash
21:24:07FromDiscord<Ducko> In reply to @haxscramper "Anyway, I'm almost done": thanks!
21:41:55arkanoidI have two functions that calls each other. I tried adding code {.experimental: "codeReordering".} but it didn't work: Warning: Circular dependency detected. `codeReordering` pragma may not be able to reorder some nodes properely. What is the proper way to solve this? Forward declaration?
21:42:23FromDiscord<Elegantbeef> Yep
22:25:08*max22- quit (Quit: Leaving)
22:47:07*xet7 quit (Ping timeout: 245 seconds)
22:54:15*flynn quit (Read error: Connection reset by peer)
22:55:23*flynn joined #nim
23:03:14madpropscan I use toTable and define the type?
23:03:22madprops[int64, string]
23:05:02FromDiscord<Elegantbeef> Yeswould be `{..}.toTable[: K, V]`
23:05:03FromDiscord<Elegantbeef> Yes would be `{..}.toTable[: K, V]`
23:07:05madpropswhat does the : mean ?
23:07:32FromDiscord<Elegantbeef> It's a way to override the `[]` so it knows it's generic arguements in MCS
23:07:50FromDiscord<Elegantbeef> Cause otherwise it's turned into `[](toTable({..})`
23:08:34FromDiscord<Elegantbeef> It's a simple/clean way to override the `[]` operator
23:08:46madpropswondering what's wrong here https://play.nim-lang.org/#ix=3wdK
23:09:53FromDiscord<Elegantbeef> The issue here is that the tuples are inferred separately so each one needs the `i64` written after the int literal
23:10:08madpropsi see. thanks
23:11:00FromDiscord<Elegantbeef> This should be like an array though, so wonder if this can be fixed easily
23:13:11NimEventerNew thread by Col: Html tags from template not being rendered, see https://forum.nim-lang.org/t/8332
23:18:08FromDiscord<Elegantbeef> Atleast the devel error message is cleaner in this case mad, but yea this should be converted automatically
23:27:18madpropsi see
23:27:29madpropsmaybe this is offtopic but I'm trying to convert some scala to nim
23:27:30madpropshttps://scastie.scala-lang.org/pgXjPxTxR5WnQaXBG8SEZg
23:27:40madpropswondering if I could do that
23:27:50madpropsnot sure what ".to(number)" is doing here
23:28:01madpropsbut it matches 100 for 120 for example
23:28:07madprops1000 for 1200
23:28:37FromDiscord<Elegantbeef> Yea i dont quite get it