00:08:05 | * | D_ quit (Ping timeout: 256 seconds) |
00:09:44 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2G5X |
00:11:18 | FromDiscord | <ElegantBeef> myType.isSome |
00:12:01 | FromDiscord | <ElegantBeef> or `isNone` |
00:15:34 | FromDiscord | <tinygiant> That was working for the type, but it wouldn't allow me to assign values to the type components. |
00:16:01 | FromDiscord | <ElegantBeef> What do you mean? |
00:16:02 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2G5k |
00:16:24 | FromDiscord | <ElegantBeef> If you want actual nil behaviour make the MyType ` ref object` |
00:16:35 | FromDiscord | <tinygiant> Give me a second to find my computer. |
00:16:45 | FromDiscord | <ElegantBeef> There is actual reference type objects in Nim, if you want them |
00:18:39 | FromDiscord | <Quibono> Is there a nim graphing library that supports like live updates? |
00:18:53 | FromDiscord | <ElegantBeef> https://nimble.directory/search?query=graph |
00:20:20 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2G5Z |
00:20:36 | FromDiscord | <ElegantBeef> result.get.token |
00:21:11 | FromDiscord | <ElegantBeef> Options require `get`ing and should only be done inside a `if a.isSome` |
00:21:41 | FromDiscord | <Quibono> Lol beef that answers a question, not necessarily my question |
00:21:59 | FromDiscord | <ElegantBeef> I mean there are a lot of graph libraries and i can only point you to there as i've never used them |
00:22:01 | FromDiscord | <ElegantBeef> So i did 😄 |
00:22:16 | FromDiscord | <tinygiant> Yup, I got the basics on options, but all my googling couldn't find an example of using options with custom types. That's exactly the answerI needed to resolve part of my insanity with the current project. Thanks! Now to do some more experimenting. |
00:22:58 | FromDiscord | <ElegantBeef> I know some arent actual plotting or graph libraries |
00:23:05 | FromDiscord | <Quibono> lol |
00:23:40 | FromDiscord | <ElegantBeef> Nmiline i assume would be live updating |
00:25:36 | FromDiscord | <Quibono> Yeah, ideally it'd work with Fidget since that seems to be the gui option de jour |
00:30:28 | FromDiscord | <ElegantBeef> Well fidget hasnt really been used as a dependancy anywhere that i know of so yea have fun making it ;P |
00:31:01 | FromDiscord | <Quibono> Lol dear lord, I don't know the first thing about making a graphing library |
00:31:19 | FromDiscord | <ElegantBeef> The first step to learning anything is not knowing anything |
00:39:04 | FromDiscord | <tinygiant> sent a code paste, see https://paste.rs/RTE |
00:40:50 | FromDiscord | <ElegantBeef> well yea you need to make the result `some(Auth()))` |
00:42:18 | FromDiscord | <tinygiant> That's hilariously awful. I tried `result = some(Auth)` and variations, but never with the `()`. Thanks for the pointer, again. |
00:42:22 | FromDiscord | <ElegantBeef> https://github.com/beef331/nimscripter/blob/master/src/nimscripter.nim#L182 |
00:42:31 | FromDiscord | <ElegantBeef> That's how i do it for nimscripter |
00:42:47 | FromDiscord | <ElegantBeef> If the script fails to load i dont set the output as it defaults to an none |
00:56:49 | * | lritter quit (Quit: Leaving) |
01:00:34 | FromDiscord | <tinygiant> Awesome. Thanks for the example. It's it possible to send an optional argument of this type, such as `proc someProc(auth: Option[Auth] = none(Auth))` or something like that? |
01:04:05 | FromDiscord | <ElegantBeef> Does that not work? |
01:08:44 | FromDiscord | <tinygiant> Sorry, wasn't in front of my computer, just random throughts flying through my cranium while I'm doing homework with the kids. I'll give a shot. Sorry, shouldn't have asked until I tried. |
01:12:52 | FromDiscord | <Zachary Carter> @shashlick quick question whenever you have a chance - if I am producing two wrappers using `nimFile` is there a way to have one import the file the other generates? |
01:13:04 | FromDiscord | <Zachary Carter> or is there some way to add a list of imports to a generated wrapper |
01:13:06 | FromDiscord | <Zachary Carter> ? |
01:13:50 | ForumUpdaterBot | New thread by Elcritch: When to use IncompleteStruct pragma?, see https://forum.nim-lang.org/t/7180 |
01:21:53 | * | bunbunbunbunny joined #nim |
01:22:00 | bunbunbunbunny | hi there |
01:22:48 | bunbunbunbunny | i'm pretty new to nim and trying to use lldb to debug my program... when i br at a specific spot in my code successfully the variable stack doesn't reflect the nim code and i'm seeing a bunch of nim obfuscated vars |
01:23:16 | bunbunbunbunny | i'm using the --debugger:native flag when i compile with nimble c ..is there something i'm missing? |
01:23:24 | * | Tanger joined #nim |
01:25:40 | FromDiscord | <Zachary Carter> I don't think `nimble c` will work with `--debugger:native` |
01:25:42 | FromDiscord | <Zachary Carter> `nim c` will |
01:25:51 | FromDiscord | <Zachary Carter> I could be wrong though |
01:26:19 | bunbunbunbunny | oh ok |
01:27:14 | FromDiscord | <Zachary Carter> you could throw it in a `nim.cfg` in the same dir as the `nimble` file |
01:27:20 | bunbunbunbunny | nah it's the same |
01:27:50 | bunbunbunbunny | it works but i just get the obfuscated variables from nim and can't see vars from the stack frame i'm in |
01:28:19 | bunbunbunbunny | but when i use 'l' it can see the code block i'm in.. |
01:28:20 | FromDiscord | <Zachary Carter> well you're going to get mangled variable names |
01:29:00 | bunbunbunbunny | yeah that's ok... but i can't even see my variable that i've done a simple assignment on `var something = "dog"` |
01:29:19 | * | lum quit (Quit: Lum: Bye!) |
01:29:35 | * | lum joined #nim |
01:30:33 | FromDiscord | <ElegantBeef> I dont do much proper debugging but dont you need `--linedir:on` aswell? |
01:31:04 | bunbunbunbunny | according to the dcumentation --debugger:native is an alias for that and another thing set |
01:31:08 | FromDiscord | <Zachary Carter> it is |
01:32:18 | FromDiscord | <ProfessorEevee> Is there an example of Nim async? I can't seem to find anything that I can understand... |
01:32:33 | FromDiscord | <Zachary Carter> it's working fine for me bunbunbunbunny |
01:32:42 | FromDiscord | <Zachary Carter> https://media.discordapp.net/attachments/371759389889003532/783143503710388244/Screen_Shot_2020-11-30_at_8.32.22_PM.png |
01:32:55 | bunbunbunbunny | for context i'm debugging something in a test.nim file |
01:33:07 | bunbunbunbunny | so i'm guessing that the test "" macro is obscuring a lot of stuff |
01:33:23 | bunbunbunbunny | i'll try it and get back to u |
01:33:25 | FromDiscord | <Zachary Carter> okay |
01:34:58 | bunbunbunbunny | nop[e... this is what i see: https://pastebin.com/2aSeHMSW |
01:35:21 | bunbunbunbunny | still running it from test1.nim |
01:36:05 | * | guelosk[m] quit (Ping timeout: 240 seconds) |
01:36:37 | bunbunbunbunny | zackary can you press v |
01:36:43 | bunbunbunbunny | and see if you get your variables in the stack frame? |
01:36:46 | bunbunbunbunny | or do you see what i see |
01:38:29 | FromDiscord | <Zachary Carter> you might want to read https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#using-gdb-lldb |
01:39:01 | FromDiscord | <Zachary Carter> in my example, the variable was a global so I needed to use `ta v` to view them |
01:39:14 | FromDiscord | <Zachary Carter> I don't know what your code looks like so I can't really reproduce your example |
01:39:37 | bunbunbunbunny | ok thanks |
01:39:48 | FromDiscord | <Zachary Carter> no problem |
01:40:08 | FromDiscord | <Zachary Carter> have you done asynchronous programming in any other languages @ProfessorEevee? |
01:40:16 | FromDiscord | <ProfessorEevee> Python, yeah |
01:43:00 | FromDiscord | <Zachary Carter> well you can look at the nim in action repo - it has some example code here - https://github.com/dom96/nim-in-action-code/tree/master/Chapter3/ChatApp |
01:43:13 | FromDiscord | <Zachary Carter> I'm not sure how up to date it is - I don't really use async in Nim |
01:43:19 | FromDiscord | <Zachary Carter> it's never been very stable |
01:43:54 | FromDiscord | <Zachary Carter> I think if you poke around github you'll find a lot of example code |
01:45:57 | FromDiscord | <ProfessorEevee> ah I'm so confused |
01:46:53 | FromDiscord | <shashlick> @Zachary Carter since both are being generated, the second could simply generator could simply import the first generator |
01:48:24 | * | guelosk[m] joined #nim |
01:48:36 | * | jrhawley[m] quit (Ping timeout: 246 seconds) |
01:48:48 | * | jrhawley[m] joined #nim |
01:50:03 | * | abm quit (Read error: Connection reset by peer) |
01:52:41 | FromDiscord | <ProfessorEevee> What on Earth is a "generic method" |
01:59:39 | FromDiscord | <Zachary Carter> google parametric polymorphism |
02:00:27 | FromDiscord | <Zachary Carter> well that worked when I wasn't generating standalone files with `nimFile` |
02:00:44 | FromDiscord | <Zachary Carter> but now it doesn't |
02:01:02 | FromDiscord | <Zachary Carter> I'll try to figure out a workaround |
02:02:42 | FromGitter | <bung87> how to make a common used type that part of a module so that type private properties visible to that module ,I can thought use a sub type ,wonder if theres another way |
02:06:03 | FromDiscord | <notchris> If I have a method like `sdl2.getDisplayDPI() `.. can I get the pixel ratio from that? |
02:08:49 | FromGitter | <bung87> same thing right? |
02:18:38 | * | apahl quit (Ping timeout: 264 seconds) |
02:20:07 | * | apahl joined #nim |
02:22:07 | FromDiscord | <notchris> so sdl2 has a proc `getLogicalSize(renderer: RendererPtr; w, h: var cint)` |
02:22:21 | FromDiscord | <notchris> in the clib, it takes a pointer for w,h |
02:22:34 | FromDiscord | <notchris> but in the nim version, it takes two cint vars? |
02:22:44 | FromDiscord | <notchris> I tried it out, but it wasn't setting the vars, like it would a pointer |
02:22:47 | FromDiscord | <notchris> am i missing something? |
02:26:13 | FromDiscord | <nikki> it should set the vars |
02:26:20 | FromDiscord | <ElegantBeef> a `var cint` is just a fancy ptr |
02:26:35 | FromDiscord | <nikki> `var w, h: cint; getLogicalSize(renderer, w, h)` |
02:26:41 | FromDiscord | <nikki> after that `w, h` should have the result |
02:26:54 | FromDiscord | <nikki> it's possible the SDL call itself is not setting it for whatever reasn tho |
02:27:14 | FromDiscord | <nikki> but yeah i usually use `var` for such things except when possibility for `nil` is actually useful |
02:29:21 | FromDiscord | <ProfessorEevee> I figured out why I was so confused with Nim async |
02:29:28 | FromDiscord | <ProfessorEevee> VSCode giving me fake errors :( |
02:29:53 | * | stefantalpalaru quit (Ping timeout: 272 seconds) |
02:30:43 | FromGitter | <bung87> dont relys on that compile and see errors |
02:31:00 | FromDiscord | <ProfessorEevee> Yep, I keep learning that over and over again lol |
02:31:25 | FromDiscord | <ProfessorEevee> Hopefully eventually there's JetBrains compatibility. I really love their IDEs |
02:31:52 | FromGitter | <bung87> many times my program works nim ide tools reporting errors |
02:32:30 | FromDiscord | <notchris> thank you @nikki 🙂 |
02:32:58 | FromDiscord | <notchris> sadly i dont think its setting it correctly, i always get back 0, 0 |
02:33:08 | FromGitter | <bung87> there're two spot compiler inject code check only for nimsuggest |
02:34:16 | FromDiscord | <nikki> @notchris the remark on https://wiki.libsdl.org/SDL_RenderGetLogicalSize seems relevant |
02:34:26 | FromDiscord | <nikki> (in general the SDL docs are pretty helpful actually) |
02:34:51 | FromDiscord | <notchris> Ooo |
02:35:03 | FromDiscord | <notchris> _is silly_ |
02:49:25 | * | D_ joined #nim |
03:00:16 | * | stefantalpalaru joined #nim |
03:05:11 | * | stefantalpalaru quit (Changing host) |
03:05:11 | * | stefantalpalaru joined #nim |
03:16:16 | * | bunbunbunbunny quit (Ping timeout: 260 seconds) |
03:16:34 | * | vicfred quit (Quit: Leaving) |
03:18:21 | * | rockcavera quit (Remote host closed the connection) |
03:18:22 | * | bunbunbunbunny joined #nim |
03:19:17 | * | bunbunbunbunny quit (Client Quit) |
03:28:52 | FromDiscord | <Quibono> So Ajusa, you need the first int of any size? |
03:29:01 | FromDiscord | <Quibono> So like 900 is a valid input? |
03:29:04 | FromDiscord | <ajusa> yeah |
03:29:22 | FromDiscord | <ajusa> like `hello 900 world` should return `900` |
03:29:46 | FromDiscord | <Quibono> I mean we can definitely make a function that does that, IDK if one does it out of the box |
03:29:55 | FromDiscord | <ajusa> and `hello900 world` should do the same, can't assume whitespace is surrounding the number. |
03:30:24 | FromDiscord | <ajusa> Yeah the regex solution I posted works, but it feels like a lot of code so I was wondering if this was baked into the stdlib and I missed it somehow |
03:31:04 | FromDiscord | <ajusa> (edit) "works," => "works (`test.find(re"\d+").get.match.parseInt`)," |
03:33:00 | leorize[m]1 | have you tried strscans.scanf? |
03:38:13 | FromDiscord | <Quibono> Heh is this a bug? https://play.nim-lang.org/#ix=2G6O |
03:38:46 | FromDiscord | <ElegantBeef> no |
03:38:55 | FromDiscord | <ElegantBeef> Characters converted to ints are not the symbols |
03:39:22 | FromDiscord | <Quibono> What are they? |
03:39:29 | FromDiscord | <ElegantBeef> Ascii characters |
03:39:33 | FromDiscord | <ajusa> I just tried strscans.scanf but didn't see an option to skip non-digit characters at the start of a string, just whitespace. I could define a custom proc but that would be more complicated |
03:39:34 | FromDiscord | <ElegantBeef> https://www.asciitable.com/ |
03:39:43 | FromDiscord | <Quibono> So 5 is the 53rd ascii char? |
03:39:53 | FromDiscord | <Quibono> lol |
03:39:53 | FromDiscord | <ElegantBeef> yes |
03:40:06 | leorize[m]1 | @ajusa the scan expression should be `$*$i` for your case |
03:40:08 | FromDiscord | <ElegantBeef> You change to my code is not the way to do it 😄 |
03:40:51 | FromDiscord | <Quibono> Lol I'm trying to steal from better coders. |
03:41:14 | FromDiscord | <ElegantBeef> You never even set found 😄 |
03:41:36 | FromDiscord | <Quibono> lol |
03:41:40 | FromDiscord | <Rika> You assume we’re better |
03:41:57 | FromDiscord | <ElegantBeef> also the "else: continue" |
03:43:03 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2G6P |
03:43:20 | FromDiscord | <ajusa> (edit) "https://play.nim-lang.org/#ix=2G6P" => "https://play.nim-lang.org/#ix=2G6Q" |
03:47:01 | FromDiscord | <Quibono> https://play.nim-lang.org/#ix=2G6R |
03:47:08 | FromDiscord | <Quibono> Okay, it does it, it just returns as a string |
03:47:35 | FromGitter | <gogolxdong> `nim c -d:ssl --cpu:arm64 --os:linux -d:release convert.nim` cross compile for arm64 errors `cannot execute binary file: Exec format error` |
03:48:09 | FromGitter | <gogolxdong> just hello world. |
03:48:43 | FromDiscord | <ElegantBeef> I know this should be obvious but you are attempting to run it on a arm64 cpu right? |
03:49:18 | leorize[m]1 | @gogolxdong have you set up a cross C compiler? |
03:50:16 | leorize[m]1 | @ajusa hmm, seems like a bug then. In the meantime for lightweight parsing you can probably mix `parseutils.skipUntil` and `parseutils.parseInt` to get the desired result |
03:51:50 | leorize[m]1 | so use skipUntil to get the index where the number would start, then call parseInt with that index as the `start` parameter |
03:52:44 | FromDiscord | <Quibono> https://play.nim-lang.org/#ix=2G6T Okay this is the cleanest answer I have for a custom function do do what @ajusa wants |
03:52:54 | leorize[m]1 | alternatively pegs or regex works with less lines :p (but probably not as fast) |
03:52:58 | FromDiscord | <ElegantBeef> How is that better than mine? |
03:53:27 | FromGitter | <gogolxdong> you mean change cc to cross c compiler before compile when cross compile? |
03:53:53 | FromDiscord | <ajusa> looks pretty good to me! currently trying out the parseutils stuff too |
03:54:06 | leorize[m]1 | @gogolxdong if you're on *nix the `file` command can be used to determine the executable architecture |
03:54:07 | FromDiscord | <Quibono> It's not? |
03:54:09 | FromDiscord | <ElegantBeef> quibono using a case for an if statement 😄 |
03:54:26 | FromDiscord | <Quibono> lol, well I almost need like a conjoined case |
03:54:39 | FromDiscord | <ElegantBeef> I mean you're using it as an if statement |
03:55:02 | FromDiscord | <ElegantBeef> It's `if c != number and found` |
03:55:13 | FromDiscord | <ElegantBeef> but you already have the original if so you just need found |
03:55:15 | FromDiscord | <ElegantBeef> Like what i did |
03:55:28 | leorize[m]1 | @gogolxdong, yea, in nim.cfg there's also an example on how to configure the compiler to be used for a given architecture |
03:55:31 | FromDiscord | <ElegantBeef> It's code golf to the extreme 😄 |
03:55:34 | FromGitter | <gogolxdong> is there any example? |
03:55:58 | FromDiscord | <Quibono> Can you use a case statement along with another logic expression on the same line lol |
03:56:02 | FromDiscord | <ElegantBeef> No |
03:56:06 | FromDiscord | <ElegantBeef> My point is it's just what this does https://play.nim-lang.org/#ix=2G6U |
03:56:31 | FromDiscord | <ElegantBeef> Yes i realized the bool was redundant |
03:56:59 | FromGitter | <gogolxdong> What are need when cross compile for arm64? |
03:57:04 | FromDiscord | <Quibono> Lol well I'm just happy my newb ass figured out a way to do it |
03:57:12 | FromDiscord | <ElegantBeef> Didnt you just copy my impl? |
03:57:14 | FromDiscord | <eggy> Hello everyone. I am new to Nim . I tried it when it was still called Nimrod. Is there a way to use TCC on windows for Nim instead of gcc? |
03:57:35 | FromDiscord | <ElegantBeef> You can change the compiler in the `nim.cfg` |
03:57:46 | leorize[m]1 | @eggy assuming that you have tcc in PATH, pass --cc:tcc to the compiler |
03:58:00 | leorize[m]1 | alternatively change the default in nim.cff |
03:58:09 | leorize[m]1 | cfg* |
03:58:57 | FromDiscord | <eggy> Thanks @ElegantBeef @leorize[Matrix]1 |
03:59:29 | leorize[m]1 | @gogolxdong this should helps: https://nim-lang.org/docs/nimc.html#crossminuscompilation |
04:03:40 | FromDiscord | <ajusa> https://play.nim-lang.org/#ix=2G70 is the parseutils version I came up with, I think I'll just stick with regex lol |
04:04:07 | FromDiscord | <ElegantBeef> Leorize thanks for mentioning `scanf` i'm now interested i static analyising the `pattern` from `scanf` to make something that creates the required variables for the capture 😄 |
04:04:44 | FromGitter | <gogolxdong> @leorize yes, it's helpful.Thanks! |
04:05:40 | leorize[m]1 | ElegantBeef just make sure whatever you create can beat npeg :p |
04:05:49 | FromDiscord | <ajusa> is scanf actually broken though? there was a github issue related to it a few months ago, but I didn't see any open issues with it being mentioned |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:23 | FromDiscord | <ElegantBeef> I mean it's not to beat npeg, more just to remove that whole `var a: T` then `str.scanf(pattern, a)` |
04:06:36 | * | supakeen joined #nim |
04:06:46 | FromDiscord | <ElegantBeef> i'd just be like `whenScanf(str, pattern, a):` |
04:06:55 | FromDiscord | <ElegantBeef> (edit) "i'd" => "it'd" |
04:07:25 | FromDiscord | <ElegantBeef> Basically just extracting the type of the variable identifiers from the pattern |
04:08:18 | FromDiscord | <ElegantBeef> I very much dont really like repetitive code, i do imagine it's possible to extract the types, but i could be wrong |
04:10:16 | FromDiscord | <ElegantBeef> Like if you look at the pattern you should be able to see in this demo the identifiers are `int, int, int, s, float` `scanf(input, "$i-$i-$i $w$s$f", year, month, day, identifier, myfloat):` |
04:15:56 | * | Jjp137_ quit (Quit: Leaving) |
04:16:04 | * | Jjp137_ joined #nim |
04:16:06 | FromDiscord | <eggy> @ElegantBeef which nim.cfg to put tcc reference in? There are a few in the Windows installation in different Nim directories. Is there a specific line or command? Thanks in advance! I couldn't find it on the Nim site or via a search. |
04:16:31 | FromDiscord | <ElegantBeef> I dont know on windows, leorize is probably more useful in this case |
04:18:29 | FromDiscord | <eggy> Thanks anyway! |
04:20:02 | leorize[m]1 | @eggy config/nim.cfg is the file |
04:23:20 | * | rockcavera joined #nim |
04:24:10 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G75 |
04:25:34 | FromDiscord | <ProfessorEevee> I know why, but I don't know what the Nim alternative to Python's `asyncio.gather()` is |
04:32:43 | FromDiscord | <ElegantBeef> Hey leorize the example works 😄 https://media.discordapp.net/attachments/371759389889003532/783188808786378812/unknown.png |
04:34:24 | FromDiscord | <ElegantBeef> Silly code is silly https://play.nim-lang.org/#ix=2G77 |
04:36:02 | FromDiscord | <ElegantBeef> Just like that he ran away 😛 |
04:37:03 | leorize[m]1 | @ProfessorEevee you can put them all in a seq then use `asyncfutures.all()` |
04:37:28 | FromGitter | <gogolxdong> Is it should be `--cpu:aarch64 --os:linux --cc:gnu-gcc` when cross compiler is aarch64-linux-gnu-gcc |
04:39:55 | leorize[m]1 | `--cc:gnu-cc` should be `--aarch64.linux.gcc.exe:aarch64-linux-gnu-gcc` and `--aarch64.linux.gcc.linkerexe:aarch64-linux-gnu-gcc` |
04:41:34 | leorize[m]1 | @ElegantBeef have you considered reusing scanf's scan string parser? :p |
04:42:14 | FromDiscord | <ElegantBeef> I mean i should just for 1:1 parity 😛 |
04:42:48 | FromDiscord | <ElegantBeef> I was just doing it for fun, although i guess it could possibly be PR'd into the stdlib if it actually worked properly |
04:43:53 | FromDiscord | <eggy> @leorize Thanks! I changed gcc to tcc, but I receive errors on compiling even hallo.nim in the examples directory. I think it must be a TCC issue, because I used finish.exe to install the Nim server msys and it works. I'll try again tomorrow. I only want to use TCC for minimalism on my system. I use Raylib the c library with TCC just fine. This is a separate TCC standalone install. I will test tomorrow to find the error. Thanks! |
04:46:04 | * | mbomba joined #nim |
04:46:16 | * | mbomba quit (Client Quit) |
04:46:47 | * | mbomba joined #nim |
04:49:00 | FromGitter | <gogolxdong> why gnu is stripped in option key? |
04:53:45 | * | narimiran joined #nim |
04:58:17 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G79 |
05:02:17 | ForumUpdaterBot | New thread by Jiyinyiyong: Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect], see https://forum.nim-lang.org/t/7181 |
05:02:25 | * | thomasross quit (Ping timeout: 240 seconds) |
05:03:44 | * | a_chou joined #nim |
05:15:57 | * | a_chou quit (Remote host closed the connection) |
05:17:16 | FromDiscord | <ProfessorEevee> ah I fixed my issue |
05:17:29 | FromDiscord | <ProfessorEevee> I had to use `newSeq[Future[void]]()` |
05:17:57 | FromDiscord | <ProfessorEevee> Now my only issue is creating 700~ objects concurrently |
05:18:05 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
05:23:07 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G7d |
05:24:04 | FromDiscord | <tinygiant> <https://nim-lang.org/docs/sequtils.html#repeat%2CT%2CNatural> might do it? |
05:25:34 | FromDiscord | <ProfessorEevee> Ah yep. That's exactly what I was looking for. Thank you |
05:25:46 | FromDiscord | <ProfessorEevee> Weird how I missed that lol |
05:28:16 | * | D_ quit (Ping timeout: 240 seconds) |
06:09:11 | * | D_ joined #nim |
06:56:49 | * | habamax joined #nim |
07:02:00 | narimiran | Zevv: where are you? |
07:07:42 | * | mbomba quit (Quit: WeeChat 3.0) |
07:22:46 | Zevv | at home, like the rest of the world |
07:26:42 | narimiran | Zevv: smartass, go get your first advent star! |
07:27:07 | Zevv | dude I got taht |
07:27:12 | Zevv | but I'm not joining the race this time |
07:27:18 | Zevv | I used to do this on my commute |
07:27:39 | Zevv | but it really doesn't fit my morning schedule now, with the kids still lingering etc |
07:28:46 | * | Zevv quit (Quit: Lost terminal) |
07:29:05 | * | Zevv joined #nim |
07:29:13 | * | Zevv quit (Client Quit) |
07:29:37 | * | Zevv joined #nim |
07:29:45 | * | Zevv quit (Client Quit) |
07:30:33 | * | Zevv joined #nim |
07:30:40 | Zevv | sigh what's this shit with my irc client |
07:31:00 | Zevv | anyway, I just conceived the absolute apex of my programming career |
07:31:03 | Zevv | three nested loops |
07:31:04 | Zevv | hooray |
07:32:14 | * | narimiran quit (Ping timeout: 260 seconds) |
07:34:10 | * | narimiran joined #nim |
07:34:31 | narimiran | Zevv: dude, spoilers! |
07:34:35 | narimiran | what if somebody doesn't know that loops should be used? |
07:35:04 | narimiran | (yeah yeah, i heard of functional programming) |
07:56:22 | Zevv | ok you do it with FP |
07:59:24 | FromDiscord | <Vindaar> kinda want to join AoC after all. Probably because I really don't have time until the evening, haha |
07:59:55 | * | PMunch joined #nim |
07:59:57 | * | crem quit (Quit: WeeChat 2.8) |
08:02:48 | narimiran | @Vindaar today's one is very easy. you can do it even if you don't have time :P |
08:14:22 | * | dddddd quit (Ping timeout: 246 seconds) |
08:18:48 | FromDiscord | <Vindaar> ok, you're right. Done. Naive solution though 😛 https://github.com/Vindaar/AdventOfCode2020 |
08:19:38 | narimiran | he claims he has no time, and then he.......... writes some tests?!?! |
08:21:31 | FromDiscord | <Vindaar> hahaha |
08:21:47 | FromDiscord | <Vindaar> I'm a professional procrastinator aka PhD student, ok? |
08:23:33 | FromDiscord | <Vindaar> also feels wrong not to write the unit tests they give us, huh 😉 |
08:23:53 | FromDiscord | <PizzaFox> what's the proc/pragma/flag?? for reading a file at compile time |
08:24:16 | FromDiscord | <Vindaar> where's your solution miran? |
08:24:29 | FromDiscord | <Vindaar> (it's not in your repo yet) |
08:24:29 | FromDiscord | <PizzaFox> i think you can get fast fast using `sums` for pairwise summation for part 1 |
08:25:21 | FromDiscord | <Vindaar> `staticRead` |
08:25:24 | FromDiscord | <PizzaFox> thx |
08:25:35 | FromDiscord | <PizzaFox> (edit) "i think you can get fast fast using `sums` for pairwise summation for part 1 ... " added "(unless i am vastly misunderstanding the docs here, this is possible)" |
08:25:41 | Zevv | https://github.com/zevv/aoc2020/blob/master/01/main.nim I wrote a test |
08:27:03 | FromDiscord | <Vindaar> Zevv, I'd say you wrote 3 "test"s |
08:27:25 | Zevv | well, look at me |
08:27:31 | Zevv | I'd *so* hire me |
08:32:41 | FromDiscord | <ProfessorEevee> lol did AoC go down as soon as I was going to submit my answer |
08:36:40 | FromDiscord | <PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2G7U |
08:41:32 | narimiran | @Vindaar i haven't pushed it to my repo yet. i usually do that in the evening (after i maybe optimize a bit) |
08:41:50 | * | lckmidnight joined #nim |
08:41:52 | narimiran | currently i have one optimization that cuts the time ~4x |
08:41:59 | FromDiscord | <PizzaFox> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2G7V |
08:42:19 | FromDiscord | <Vindaar> Ah, right. You're trying to make it go brrrr always indeed (: |
08:42:57 | narimiran | Zevv: oh, `lines`! nice, i always forget that exists! |
08:43:37 | * | lckmidnight quit (Remote host closed the connection) |
08:43:55 | narimiran | much better than my `readFile` + `splitLines` |
08:44:13 | Zevv | I'd *so* not hire you |
08:44:40 | FromDiscord | <Vindaar> that's just mean Zevv! You have way more years of programming experience than Miran and me! |
08:44:55 | Zevv | that's why I would not hire you |
08:45:04 | narimiran | both of you iterate whole input for every number!? what is this, an amateur hour? |
08:45:04 | Zevv | all these punks |
08:45:15 | narimiran | what if you had 1010 in your input? |
08:45:16 | Zevv | can you read? |
08:45:26 | Zevv | oh I can optimize so much |
08:45:34 | Zevv | I can probably make this run in 1% of the time I use now |
08:45:45 | narimiran | that is not the optimization i was referring earlier |
08:45:53 | supakeen | aoc fights? |
08:45:58 | Zevv | there are so many optimizations possible |
08:46:07 | Zevv | but they do not matter * at all * |
08:46:11 | supakeen | christmas really is the most peaceful time of year, except for aoc submissions |
08:46:24 | Zevv | it's such a waste of time, effort, code and electrons |
08:47:00 | FromDiscord | <Vindaar> electrons |
08:47:11 | FromDiscord | <Vindaar> I see what you did there, looks at electron |
08:47:24 | narimiran | supakeen: yep |
08:47:47 | FromDiscord | <Vindaar> imo the AoCs are fun where the naive brute force solution doesn't work, cause it makes it run way too slow 🙂 |
08:47:48 | FromDiscord | <Idefau> my aoc solution is just bruteforcing |
08:47:50 | FromDiscord | <Idefau> but it works |
08:48:16 | Zevv | vindaar: xactly, and that's not until day 8 or so |
08:48:23 | Zevv | these are fun |
08:48:38 | Zevv | and the ones a loathe are all the maze hunting games with tons of arbritrary rules and expections |
08:48:47 | Zevv | that happen to describe the original implementation the author made |
08:49:48 | narimiran | yeah, don't like those with wall of text |
08:50:01 | FromDiscord | <Vindaar> yep those can be annoying |
08:50:05 | FromDiscord | <Idefau> yeah |
08:50:44 | FromDiscord | <PizzaFox> how should i convert an array of a bunch of stringified ints, back into ints, all at compile time? |
08:51:10 | PMunch | A {.compileTime.} proc |
08:51:18 | FromDiscord | <PizzaFox> true? |
08:51:43 | FromDiscord | <ElegantBeef> or a `static` block |
08:51:46 | FromDiscord | <Idefau> !eval echo true == true |
08:51:49 | NimBot | true |
08:51:51 | FromDiscord | <PizzaFox> thought compiletime got removed |
08:51:53 | FromDiscord | <Idefau> yeah true |
08:52:06 | FromDiscord | <ElegantBeef> I'm not currently code golfing the AOC by attempting to use closure iterators |
08:52:32 | narimiran | !eval echo "life" == "life" |
08:52:34 | NimBot | true |
08:52:40 | narimiran | la la, la la la |
08:52:43 | PMunch | Na na nanana |
08:52:43 | Zevv | dude, that's deep |
08:52:51 | narimiran | :D :D |
08:52:55 | supakeen | All together noew. |
08:53:07 | FromDiscord | <Idefau> !eval echo "work" > "success" |
08:53:10 | NimBot | true |
08:53:10 | FromDiscord | <ElegantBeef> So closure operators dont store their state, so to continue iterating you need to supply the last position? |
08:53:13 | FromDiscord | <Idefau> deep.... |
08:53:26 | FromDiscord | <ElegantBeef> iterators |
08:53:33 | narimiran | ...space... |
08:54:29 | PMunch | !eval type Life = distinct void; proc `==`(a, b: Life): string = "na na nanana"; echo Life() == Life() |
08:54:31 | NimBot | Compile failed: /usercode/in.nim(1, 37) Error: invalid type: 'void' in this context: 'proc (a: Life, b: Life): string' for proc |
08:54:45 | PMunch | Ah, damn it :P |
08:57:42 | FromDiscord | <Idefau> !eval type Nim = distinct void; proc foo(loveFor: Nim) = discard |
08:57:44 | NimBot | Compile failed: /usercode/in.nim(1, 35) Error: invalid type: 'void' in this context: 'proc (loveFor: Nim)' for proc |
08:57:52 | FromDiscord | <Idefau> deep... |
09:00:40 | narimiran | PMunch: better solve that second part than trying to create lyrics :) |
09:02:28 | PMunch | There, happy? |
09:02:31 | * | Tanger quit (Quit: Leaving) |
09:02:41 | narimiran | PMunch: very :) |
09:02:59 | PMunch | Aaaw "Because of an outage during the day 1 puzzle unlock, day 1 is worth no points." |
09:03:31 | supakeen | lel |
09:04:26 | narimiran | see you all tomorrow :P |
09:05:19 | FromDiscord | <Idefau> i hope its not a wall of text |
09:05:49 | FromDiscord | <Idefau> too early for that anyway |
09:06:50 | PMunch | Hmm, now the question becomes, how can we over-engineer this |
09:07:19 | FromDiscord | <ElegantBeef> I'm already doing it |
09:07:28 | PMunch | I mean my part2 takes 0.495s on -d:release and --gc:arc |
09:07:29 | FromDiscord | <ElegantBeef> Using closure iterators to make it so you can solve it with a single proc 😄 |
09:07:44 | FromDiscord | <ElegantBeef> my part 2 is borked |
09:07:46 | PMunch | Procs? |
09:07:56 | PMunch | http://ix.io/2G80 <- I just put everything in main :P |
09:08:00 | FromDiscord | <ElegantBeef> lol |
09:08:19 | FromDiscord | <Idefau> jesus |
09:08:36 | narimiran | 0.5 ms on my computer |
09:08:49 | PMunch | 0.5 ms? |
09:08:55 | FromDiscord | <Idefau> 0.004 B) |
09:10:30 | narimiran | yes, 0.5 ms |
09:10:38 | narimiran | that's what `perf` reports for 50 runs |
09:10:55 | narimiran | that's for both solutions |
09:13:24 | narimiran | but running manually it is 11ms |
09:15:09 | FromDiscord | <kodkuce> what is point of registring on advent of code, cant i just do those puzles myself, you reg only for competition right? |
09:15:29 | FromDiscord | <ElegantBeef> Yea |
09:15:34 | narimiran | without registering you won't see the second part of a puzzle |
09:15:47 | narimiran | and you won't know if your solution is correct |
09:16:07 | FromDiscord | <ElegantBeef> `~.021s` with my closure method |
09:16:15 | FromDiscord | <ElegantBeef> and it works for `n` number of steps |
09:16:21 | FromDiscord | <ElegantBeef> Worth over engineering 😄 |
09:16:43 | FromDiscord | <ElegantBeef> If you want to see https://media.discordapp.net/attachments/371759389889003532/783260276862222376/SPOILER_unknown.png |
09:17:29 | PMunch | Damn 0.5ms I'm curious how you did that narimiran. But I kinda want to try my hand at over-engineering this myself before I get any input |
09:17:39 | PMunch | Oh wait, did you just do it all during compile-time? |
09:18:01 | narimiran | PMunch: nope :) but maybe perf is wrong tool to measure this? |
09:18:17 | FromDiscord | <kodkuce> so do i have to make a repo? |
09:18:29 | FromDiscord | <kodkuce> how does AoC test my code |
09:18:58 | FromDiscord | <kodkuce> oh it dosent i submit answer |
09:19:06 | PMunch | Yup |
09:19:10 | PMunch | It's a pretty neat system actually |
09:19:43 | PMunch | Everyone gets the same task, but with different inputs, and it just checks that you arrive at the correct output and assume that you did it by computer |
09:19:56 | PMunch | Allows you to write it in absolutely any language (even your own) |
09:19:59 | FromDiscord | <ElegantBeef> It's sorta how CS should do code 😄 |
09:20:07 | FromDiscord | <ElegantBeef> CS education |
09:20:08 | PMunch | Eh, not really |
09:20:27 | PMunch | You can easily have a program that seems to do the right thing, but does something horribly wrong |
09:20:39 | narimiran | PMunch: here's the output of perf: http://ix.io/2G85 |
09:20:42 | PMunch | I've seen that a couple times in my year of correcting CS hand-ins :P |
09:21:04 | PMunch | narimiran, and how do you run it? |
09:21:05 | FromDiscord | <ElegantBeef> That's why i said sorta |
09:21:19 | PMunch | Wait ./nim/? Are you doing these in multiple languages? |
09:21:46 | FromDiscord | <ProfessorEevee> How do you check how long it takes your code to finish running? |
09:21:58 | FromDiscord | <ElegantBeef> `time binary` on nix |
09:22:05 | narimiran | PMunch: `perf stat -r 50 --table -o outfile.txt nim/day01` |
09:22:17 | narimiran | PMunch: i'm not doing it in multiple languages. yet. :) |
09:22:32 | FromDiscord | <ProfessorEevee> Uhh |
09:23:09 | FromDiscord | <ProfessorEevee> I'm on Windows, so I con't think I have access to that |
09:23:51 | FromDiscord | <ElegantBeef> You can time inside the code, but the OS timing method is easier to do 😄 |
09:23:58 | FromDiscord | <ElegantBeef> Dont know the windows way |
09:24:01 | FromDiscord | <ProfessorEevee> Ah rip |
09:24:10 | FromDiscord | <kodkuce> i reinstalled os, have fresh vscode what nim plugin is best atm? |
09:24:17 | FromDiscord | <ElegantBeef> I use the alt |
09:24:25 | FromDiscord | <ElegantBeef> They dont differ internally |
09:24:44 | FromDiscord | <ElegantBeef> The syntax highlighting was the only difference between nim-alt and the normal nim |
09:25:01 | FromDiscord | <kodkuce> there is lsp one too |
09:25:15 | FromDiscord | <ElegantBeef> You might be able to do timeit professor |
09:25:18 | FromDiscord | <ElegantBeef> Oh |
09:25:26 | FromDiscord | <ElegantBeef> Gotta try the lsp one now |
09:25:47 | FromDiscord | <ProfessorEevee> What's timeit? |
09:25:59 | FromDiscord | <ElegantBeef> Possibly a windows command |
09:26:17 | FromDiscord | <ProfessorEevee> ah nope |
09:26:25 | PMunch | The goal is for the LSP one to become the best ne |
09:27:22 | PMunch | Oh, there are just 200 numbers? |
09:28:21 | FromDiscord | <kodkuce> lsp is the way |
09:29:13 | FromDiscord | <ElegantBeef> Yea the LSP makes me happy as it properly highlights stuff |
09:29:13 | PMunch | This is the way |
09:30:25 | FromDiscord | <ElegantBeef> `Object.field.toFloat` doesnt highlight `tofloat` |
09:30:34 | FromDiscord | <ElegantBeef> Feels bad |
09:30:55 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G88 |
09:31:19 | PMunch | Wait, LSP shouldn't highlight anything.. |
09:31:27 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:31:43 | * | Q-Master quit (Quit: Ушел) |
09:31:56 | FromDiscord | <ElegantBeef> Well it highlights, which i thought it was doing through LSP |
09:32:00 | FromDiscord | <kodkuce> https://media.discordapp.net/attachments/371759389889003532/783264118756212746/2020-12-01_103147.png |
09:32:24 | FromDiscord | <ElegantBeef> What's your code evee? |
09:32:26 | FromDiscord | <ElegantBeef> (edit) "evee?" => "eevee?" |
09:33:44 | FromDiscord | <ProfessorEevee> ||https://hastebin.com/zobisiwoti.nim|| |
09:34:24 | FromDiscord | <ElegantBeef> Interesting solution |
09:34:37 | FromDiscord | <ProfessorEevee> I'm kind of proud of it, honestly |
09:34:40 | FromDiscord | <ElegantBeef> You dont save any computation doing that way though |
09:34:56 | FromDiscord | <ProfessorEevee> Well, to be fair it's been like a week since I've gotten into Nim |
09:35:25 | PMunch | Wait, is that valid Nim code? |
09:35:27 | FromDiscord | <ElegantBeef> I'm just pointing out the `2020 - x - y in numbers` is going to be the same as a `for z in numbers` |
09:35:56 | * | NimBot joined #nim |
09:36:04 | PMunch | Oooh, it's (2020 - x) in numbers :P |
09:36:54 | PMunch | How about sorting the numbers first and then binary searching your way to the solution? |
09:37:16 | narimiran | PMunch: that is probably much much faster than my simple optimization |
09:37:27 | FromDiscord | <Idefau> i saw a solution that sorted the input first |
09:37:27 | PMunch | Wait narimiran, was that timing for part1 or part2? |
09:37:35 | narimiran | PMunch: both |
09:37:36 | FromDiscord | <Idefau> might try that |
09:37:44 | PMunch | Both? in 0.5ms? |
09:37:46 | FromDiscord | <ProfessorEevee> Yeah I have no clue, the people over at Python are using combinations to solve it |
09:37:54 | narimiran | i search for both in one pass |
09:38:06 | FromDiscord | <ProfessorEevee> get every possible combination of the numbers |
09:38:13 | FromDiscord | <ProfessorEevee> and see if they add to 2020 then multiply |
09:38:34 | PMunch | narimiran, huh |
09:38:39 | PMunch | Did you post your code? |
09:38:49 | narimiran | PMunch: not yet |
09:39:10 | narimiran | well, it is on reddit, if you want to search for it |
09:39:35 | narimiran | but usually i don't publish my code till the afternoon |
09:40:23 | narimiran | PMunch: running it manually, it is around 7ms |
09:42:42 | PMunch | Hmm, the binary search solution would only work for part1 though.. |
09:43:52 | FromDiscord | <PizzaFox> how does one properly benchmark this when it takes sub millisecond to execute |
09:44:18 | narimiran | creates on input with 200,000 lines? :P |
09:44:20 | narimiran | *an |
09:44:21 | Zevv | run it a million times |
09:44:21 | FromDiscord | <ElegantBeef> you can use the time modules in Nim |
09:44:35 | FromDiscord | <PizzaFox> surely monotimes is better suited than times |
09:44:41 | Zevv | mumble mumble optimization mumble evil mumble |
09:44:44 | FromDiscord | <ElegantBeef> who said use times? |
09:44:51 | Zevv | cpuTime() is the way to go |
09:44:59 | FromDiscord | <PizzaFox> > time modules↵i was 1 character off |
09:46:37 | FromDiscord | <ElegantBeef> I mean either one should work they're both ns accuracy iirc |
09:46:53 | FromDiscord | <PizzaFox> isnt cputime exported by 2 modules for some reason |
09:47:06 | FromDiscord | <ElegantBeef> It's in `times` |
09:47:14 | FromDiscord | <PizzaFox> is it in os or something |
09:47:22 | FromDiscord | <PizzaFox> i swear there was some cpu method that was in 2 modules |
09:47:24 | FromDiscord | <PizzaFox> and did the exact same thing |
09:48:35 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G8f |
09:49:06 | FromDiscord | <ElegantBeef> Damn everyone has a faster impl than me |
09:49:12 | FromDiscord | <ElegantBeef> But i like my 1 solution fits all 😄 |
09:49:14 | voltist | Is there a standard library proc to find the most common item in a seq? |
09:49:16 | FromDiscord | <Rika> Hello what is up |
09:50:31 | FromDiscord | <ElegantBeef> If it's not in sequtils or algorithm probably not |
09:51:06 | FromDiscord | <ProfessorEevee> You can probably copy the list, remove duplicates and use `count` |
09:51:27 | FromDiscord | <ProfessorEevee> then get highest value from that |
09:52:01 | FromDiscord | <PizzaFox> surely iterating once and adding some numbers in a frequency table is the most straightforward way |
09:52:26 | PMunch | narimiran, and what number are you looking at? |
09:52:40 | voltist | Yeah I've implemented something but its pretty slow |
09:52:41 | FromDiscord | <ElegantBeef> Just clear the list and then you're certain the most common elements are there 😄 |
09:52:48 | voltist | It should do until I actually tun into a problem |
09:52:52 | voltist | run* |
09:52:55 | PMunch | CountTable? |
09:52:59 | narimiran | PMunch: either first or last line |
09:53:18 | PMunch | Ah, tha final results line |
09:53:32 | PMunch | Hmm 0.8ms |
09:53:47 | voltist | PMunch: Oo! Yes! |
09:54:32 | PMunch | What CPU do you have narimiran? |
09:54:44 | PMunch | Just trying to guess at a comparison of numbers :P |
09:54:53 | narimiran | ryzen 7 3700x |
09:55:00 | narimiran | 3.6 Ghz |
09:56:32 | PMunch | Ah, so you do have a slightly higher single-core rating than I do: https://www.cpubenchmark.net/compare/AMD-Ryzen-7-3700X-vs-Intel-i7-4770K/3485vs1919 |
09:56:56 | Clonkk[m] | Quick question, I'm trying to generate a C header from a simple Nim file. All my the exported type / proc are marked with {.exportc.}. I use `` nim c --header --noMain --noLinking file.nim`` but there is no output |
09:57:21 | Clonkk[m] | I was expecting a ``file.h`` |
09:57:33 | voltist | PMunch: Creating a count table then iterating over it to find the largest value is orders of magnitude faster. Thanks for the tip! |
09:57:50 | PMunch | No problem :) |
09:58:25 | PMunch | By the way, you don't have to iterate the CountTable, it has a largest proc |
09:58:39 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G8h |
09:58:41 | FromDiscord | <ProfessorEevee> idk what to believe anymore |
09:58:57 | narimiran | this reminded my what AoC tasks i like the most: the ones it takes 5 minutes to solve, and then we spend 55 minutes trying to optimize them |
09:59:04 | PMunch | Pfft, that's nothing, try to optimise it to negative numbers! |
09:59:17 | PMunch | Haha, that's the fun part :P |
09:59:37 | FromDiscord | <ProfessorEevee> I don't even know how to optimize mine |
09:59:42 | PMunch | Hmm, I think my optimisations end up taking more time because of the small input set.. |
09:59:57 | voltist | PMunch: Similar result but cleaner code, thanks again |
10:00:30 | FromDiscord | <ProfessorEevee> What does 0.01 even mean. what kind of time is this |
10:00:49 | PMunch | voltist: Yeah I wasn't sure if it was any faster, but at least it's cleaner :) |
10:00:57 | PMunch | 0.01 time |
10:01:00 | narimiran | small time |
10:01:06 | PMunch | It is 1/100th time |
10:01:47 | PMunch | Sorting the table is a net loss :P |
10:02:14 | * | Q-Master joined #nim |
10:03:35 | narimiran | table? where did table come from? |
10:04:18 | PMunch | Err, I meant sorting the seq |
10:04:19 | FromDiscord | <ProfessorEevee> Alright, well.. this was fun. Too bad the first day doesn't count, though |
10:04:40 | PMunch | I was thinking of Voltist problem :P |
10:07:47 | * | apahl quit (Ping timeout: 272 seconds) |
10:08:34 | * | apahl joined #nim |
10:11:17 | PMunch | Eh, this is as far as I bother to go: http://ix.io/2G8p |
10:11:29 | PMunch | Would work a lot better on a bigger list though |
10:11:32 | FromDiscord | <kodkuce> i did my advent like pro tard with 3 loops |
10:11:50 | PMunch | Haha, my initial solution was like that :) |
10:11:54 | FromDiscord | <ElegantBeef> It's quicker than my method 😄 |
10:12:25 | FromDiscord | <ElegantBeef> But mine uselessly works on all versions of this problem, so i guess winning? |
10:12:54 | FromDiscord | <ElegantBeef> I keep saying that but i dont know, seems like a weird way to do aoc |
10:13:34 | PMunch | On all versions? |
10:13:36 | FromDiscord | <kodkuce> i expect next advent to be like 20 numbers |
10:13:44 | FromDiscord | <kodkuce> loops of doom |
10:13:55 | FromDiscord | <ElegantBeef> Yea both two versions and any theoretical alterations |
10:14:14 | FromDiscord | <ElegantBeef> No matter the depth or the number if it's there it can do it |
10:14:38 | * | habamax_ joined #nim |
10:15:34 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2G8q if you didnt look at mine previously |
10:16:04 | PMunch | Haha, modified mine to do 4 numbers, slightly less than twice the time of the 3 version, which is pretty good |
10:16:14 | PMunch | (There's no solution for that in my set though) |
10:17:45 | FromDiscord | <ElegantBeef> Nice, my 3 takes .022 due to actually finding one, my 4 takes 3 seconds |
10:17:49 | PMunch | Oh right |
10:18:00 | * | habamax_ quit (Client Quit) |
10:18:13 | PMunch | My 3 takes 0.0007 something and my 4 takes 0.0012 something |
10:18:32 | FromDiscord | <ElegantBeef> Now take your optimizations and marry them with mine 😄 |
10:18:35 | PMunch | The four doesn't find a solution though |
10:19:12 | ForumUpdaterBot | New thread by Lihf8515: Nim compiled DLL, using Powerbuild programming language call, parameter return result garbled code., see https://forum.nim-lang.org/t/7183 |
10:19:38 | PMunch | Well it is basically just sort the seq first, then only loop numbers larger that the outer loop, and break early if the sum gets too large (because they are sorted it can't become smaller this loop anyways). |
10:19:44 | FromDiscord | <kodkuce> i dont want to look yours atm its spoiler for me, will check on end to see how could have done stuff beter |
10:21:10 | FromDiscord | <ElegantBeef> Well mine is how to do it for N steps, so it's not really "better" |
10:21:27 | FromDiscord | <ElegantBeef> It took me like 20 minutes to solve how to do it |
10:21:43 | FromDiscord | <ElegantBeef> But i seen the first problem and the second and had to do it in one way or i wouldnt have been satisifed |
10:23:40 | voltist | Sometimes debugging is pretty |
10:23:41 | voltist | https://raw.githubusercontent.com/dizzyliam/randomImgs/master/out.png |
10:23:50 | FromDiscord | <ElegantBeef> It's always pretty |
10:35:15 | ForumUpdaterBot | New thread by Mratsim: Nimbus -> Ethereum 2 launch is imminent 12PM UTC., see https://forum.nim-lang.org/t/7184 |
10:37:55 | * | kiwi_83 joined #nim |
10:41:28 | Zoom[m] | PMunch: >>You can easily have a program that seems to do the right thing, but does something horribly wrong" |
10:41:29 | Zoom[m] | That's why you write a ton of tests and check for all possible inputs. If it still outputs the right thing, then it doesn't matter what's inside. Or, more realistically, your tests are not working. |
10:45:39 | FromDiscord | <ProfessorEevee> Man. I'm getting the weirdest errors trying to make an async HTTP client from sockets |
10:45:58 | FromDiscord | <ProfessorEevee> sent a code paste, see https://play.nim-lang.org/#ix=2G8v |
10:46:50 | * | Vladar joined #nim |
10:52:43 | * | jmiven quit (Quit: reboot) |
10:53:29 | * | jmiven joined #nim |
10:56:38 | voltist | Is there a standard library proc to 'rotate' an array or seq by some amount. As in, increase the index of all items by n and move overflow to the start |
10:57:13 | supakeen | voltist: In the `algorithm` module you have `rotateLeft`, etc. |
10:57:24 | supakeen | https://nim-lang.org/docs/algorithm.html#rotateLeft |
10:57:26 | voltist | Oh awesome thanks |
11:00:55 | * | crem joined #nim |
11:09:08 | * | abm joined #nim |
11:11:01 | voltist | So I just changed a section of code so that it handles a tuple with two fields instead of a array of length two, and it's way faster. Any reason why this would happen? |
11:11:57 | supakeen | Without going into specifics for tuples it might be assumed that they will never change. |
11:12:04 | supakeen | (I don't *know* the specifics) |
11:23:26 | kiwi_83 | [is it better to omit the default value's type in a function arg? I thought making the compiler detect the type would be slower |
11:23:52 | kiwi_83 | also why cannot a ternary conditional be used without indentation? I wish to do 'proc ... = if blah blah else blah blah' |
11:24:55 | supakeen | You can wrap them in parens. |
11:25:00 | supakeen | And for the first bit, is it actually slow? |
11:27:02 | kiwi_83 | oh I'm assuming the inference would take time, although probably negligible |
11:27:19 | supakeen | `proc foo(x: int): int = (if x > 2: result = 1 else: result = 2)` |
11:27:21 | kiwi_83 | thanks, what keywords should i use for this parentheses notation |
11:27:23 | supakeen | Works fine. |
11:27:40 | supakeen | Ah, I don't think one should worry too much about speed unless it becomes a problem :) |
11:28:09 | kiwi_83 | fair enough! thanks :D |
11:28:43 | kiwi_83 | can someone helpme read this? `proc multiReplace(s: string; replacements: varargs[(string, string)]): string {...}` this varargs bit means it can take a dictionary mapping from strings to strings right? |
11:29:12 | supakeen | varargs means it takes multiple of that argument |
11:29:25 | supakeen | and they end up in a sequence of that name |
11:29:43 | kiwi_83 | umm |
11:30:22 | kiwi_83 | so is it a tuple of strings then? |
11:30:27 | kiwi_83 | im a bit confused |
11:30:40 | PMunch | Yeah it's a variable amount of tuples |
11:30:47 | supakeen | https://play.nim-lang.org/#ix=2G8K |
11:30:59 | supakeen | In that case it'd be a bunch of tuples of strings :) |
11:31:48 | PMunch | !eval echo "hello world".multiReplace(("hello", "goodbye"), ("world", "kiwi_83")) |
11:31:52 | NimBot | Compile failed: /usercode/in.nim(1, 19) Error: attempting to call undeclared routine: 'multiReplace' |
11:32:04 | PMunch | !eval import strutils; echo "hello world".multiReplace(("hello", "goodbye"), ("world", "kiwi_83")) |
11:32:09 | NimBot | goodbye kiwi_83 |
11:32:12 | supakeen | (needs strutils) |
11:32:14 | supakeen | ah yea |
11:32:45 | kiwi_83 | ahh sweet, now I know how to parse that! thanks |
11:33:05 | * | schmaydo joined #nim |
11:33:19 | supakeen | It's `varargs[T]` and the `T` or type in this case is a `(string, string)` or a 2-tuple of `string` :) |
11:33:31 | schmaydo | why do case statement macros need the macro to be called match? shouldn't it be called `case` instead? it says here https://nim-lang.org/docs/manual_experimental.html#case-statement-macros |
11:34:13 | kiwi_83 | oh wait! PMunch is that the UFCS in action? |
11:34:31 | kiwi_83 | you are calling multiReplace on a string directly instead of passing as the first arg! |
11:34:43 | kiwi_83 | UFCS = uniform function call syntax iirc |
11:34:45 | FromDiscord | <lqdev> that's method call syntax, yes |
11:35:01 | FromDiscord | <lqdev> more popularly known as UFCS |
11:35:08 | supakeen | popularly :o |
11:35:17 | supakeen | what's the popular name for command syntax then |
11:35:34 | FromDiscord | <lqdev> there is none |
11:35:53 | FromDiscord | <lqdev> it's just "command call syntax" and afaict it's kinda nim-specific |
11:35:59 | supakeen | It is. |
11:36:11 | supakeen | So, function call syntax, command call syntax, uniform function call syntax. |
11:37:10 | PMunch | kiwi_83, indeed :) |
11:37:30 | schmaydo | i think `case` would make more sense for case statement macros, but if `match` is being used then it should both be supported |
11:38:01 | PMunch | I tend to use that style when the procedure sounds like a verb |
11:39:05 | PMunch | Well, I tend to use it quite a lot. Means I can write out a statement as I think, instead of having to jump back and forth to put brackets and arguments. |
11:41:12 | kiwi_83 | oh yes that does sound convenient |
11:45:42 | kiwi_83 | what does 'ordinal type expected' error mean |
11:45:57 | FromDiscord | <lqdev> that an ordinal type was expected. |
11:46:48 | kiwi_83 | um looks like I gave "A" (a string?) but 'A' a char was expected |
11:46:58 | kiwi_83 | didn't know there was a distinction between both types of quotes |
11:47:12 | narimiran | nim is not python |
11:47:21 | kiwi_83 | ninp |
11:48:59 | kiwi_83 | how do I raise this error? https://nim-lang.org/docs/system.html#ValueError |
11:49:12 | schmaydo | what is 1 + 1 |
11:49:14 | * | schmaydo quit (Remote host closed the connection) |
11:49:24 | kiwi_83 | I tried `raise ValueError('blah blah')` but that doesnt work |
11:49:29 | FromDiscord | <haxscramper> `raise newException(ValueError, "Message")` |
11:49:37 | kiwi_83 | ooof thanks |
11:51:35 | narimiran | !eval proc whatIsLove: string = "baby don't hurt me"; echo whatIsLove() |
11:51:38 | NimBot | Compile failed: /usercode/in.nim(1, 27) Error: expression '"baby don\'t hurt me"' is of type 'string' and has to be used (or discarded) |
11:52:16 | kiwi_83 | i like how the assignment for variables AND functions is the = symbol |
11:52:48 | narimiran | bad bot, that works in the playground |
11:53:21 | kiwi_83 | !eval echo 42 |
11:53:25 | NimBot | 42 |
11:53:34 | FromDiscord | <Imperatorn> What IRC-client(s) do you use? |
12:01:32 | kiwi_83 | anyone nkow if there's a zeal docset for nim? can't seem to find anything |
12:02:48 | FromDiscord | <flywind> https://forum.nim-lang.org/t/5050#33933 |
12:02:49 | PMunch | @Imperatorn, I use HexChat |
12:03:24 | supakeen | Huh, how do I assert that a proc raises a certain exception in my test suite? :) |
12:03:28 | PMunch | narimiran, wait, it does? |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:35 | * | supakeen joined #nim |
12:08:42 | kiwi_83 | thanks flywind |
12:11:15 | * | matthias_ joined #nim |
12:13:09 | * | letto quit (Quit: Konversation terminated!) |
12:13:53 | kiwi_83 | is there any prerequisite knowledge needed before going through the compiler details in the nim docs? |
12:17:51 | tribly | i'm trying to use a template for benchmarking the aoc code, but i'm confused on how to use it properly. any tips? https://p.tribly.de/m-FwfPwz/ (i'm new to nim) |
12:20:06 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2G97 |
12:20:21 | FromDiscord | <ProfessorEevee> I had ended up using the `time` command to see mine |
12:21:21 | FromDiscord | <flywind> https://github.com/xflywind/timeit/blob/ba4e90546af33632aea06208bc0f2d33418d2558/src/timeitpkg/main.nim#L146 |
12:21:42 | FromDiscord | <flywind> You could ref to this |
12:21:50 | FromDiscord | <flywind> (edit) removed "to" |
12:22:09 | narimiran | PMunch: well, in multiple lines :P |
12:22:53 | narimiran | give us braces, this whitespace stuff is shite!! |
12:24:37 | * | shad0w_ joined #nim |
12:24:47 | FromDiscord | <flywind> you should use this I guess. |
12:24:52 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2G9c |
12:25:34 | FromDiscord | <flywind> And there is already a great library to benchmark codes. https://github.com/disruptek/criterion |
12:32:25 | matthias_ | I'm having some trouble getting Prologue and Norm working together. It's a GC issue but I'm out of my depth. Basically, if I have a Prologue handler that calls `db.insert(foo)` I get a compiler error, `type mismatch: got <Prologue, string, proc (ctx: Context): Future[system.void]{.locks: <unknown>.}> but expected proc get(app: Prologue; route: string; handler: HandlerAsync; name = ""; middlewares: openArray[HandlerAsync] = @[]) first |
12:32:27 | matthias_ | type mismatch at position: 3` That indicates Norm is not GC safe, and Prologue requires this, but I'm unclear how to proceed (or if I can) |
12:34:05 | matthias_ | FWIW, I can run `select` statements w/ Norm just fine, only `inserts` so far are giving issues. And it looks more like an issue with ndb/sqlite rather than Norm itself. |
12:40:53 | FromDiscord | <flywind> What happened, if you add `{.gcsafe.}` to your async procs. |
12:42:15 | FromDiscord | <bloomhead> But then I don't get any output from the proc. Anyway, I'm gonna try criterion, thanks |
12:42:59 | FromDiscord | <flywind> you could `echo part1()` |
12:44:34 | kiwi_83 | is it idiomatic in nim to fully qualify a function call with the package name? |
12:44:42 | FromDiscord | <mratsim> no |
12:45:01 | FromDiscord | <mratsim> but if your project gets very large with lots of dependencies that makes sense |
12:48:18 | * | abm quit (Quit: Leaving) |
12:51:29 | FromDiscord | <exelotl> I'm considering that approach in some parts of my GBA library. Like I currently have `irqInit()` (for interrupt requests) and `tteInit()` (for tonc's text engine), but would prefer to write `irq.init()` and `tte.init()` |
12:52:01 | matthias_ | flywind: It yells at me that my proc is not gcsafe :) It does give me a chain of reasoning though, that ultimately leads me to `'tryWithStmt' is not GC-safe as it performs an indirect call via 'body'` |
12:54:06 | FromDiscord | <flywind> Maybe you could open an issue for it. if you could make sure `tryWithStmt` is `gcsafe`, you could use `{.cast(gcsafe).}: insert()` |
12:54:50 | FromDiscord | <flywind> Is it a warning instead of error with single thread? |
12:55:57 | matthias_ | So it seems that it possibly uses a closure, which is seemingly not GC safe. The call signature for it: `proc tryWithStmt(db: DbConn, query: SqlQuery, args: seq[DbValue], body: proc(stmt: Pstmt): bool {.raises: [], tags: [].}): bool =` |
12:56:11 | FromDiscord | <flywind> https://github.com/nim-lang/RFCs/issues/142 |
12:56:12 | disbot | ➥ Proposal to remove the `.gcsafe` effect from Nim ; snippet at 12https://play.nim-lang.org/#ix=26qX |
12:57:00 | FromDiscord | <flywind> `gcsafe` is really painful in Nim language. |
12:57:00 | FromDiscord | <flywind> https://forum.nim-lang.org/search?q=gcsafe |
13:02:39 | matthias_ | So it seems. Thanks for the assist! Gets me pointed in the right direction. |
13:03:36 | kiwi_83 | has anyone used a queue processing thingy like celery with nim for web apps? |
13:04:00 | FromDiscord | <flywind> @matthias No problem, `Prologue` has it own discord channel. Maybe you could ask there too. |
13:11:58 | kiwi_83 | just discovered that nim has an advent of code event |
13:12:05 | kiwi_83 | can I do the day 1 now? looks like day 2 is on :/ |
13:12:19 | narimiran | kiwi_83: you can even do stuff from 2015 |
13:12:28 | kiwi_83 | ohhh lmao nice! |
13:13:22 | FromDiscord | <mratsim> But it's still Day1 Dec 1 is day one no? |
13:15:51 | narimiran | https://adventofcode.com/2020/day/1 this is today's task (until tomorrow at 5 am UTC) |
13:17:33 | * | kiwi_83 quit (Ping timeout: 260 seconds) |
13:19:44 | ForumUpdaterBot | New thread by Miran: Nim 1.4.2 is out!, see https://forum.nim-lang.org/t/7185 |
13:19:54 | narimiran | ^^^ nim 1.4.2 is out ^^^ |
13:21:00 | shad0w_ | ooo shiny ? |
13:21:51 | shad0w_ | updated : P |
13:22:50 | FromDiscord | <Yardanico> I'm honestly surprised the forum updater bot has been running without issues for such a long time |
13:23:02 | FromDiscord | <Yardanico> And yay to 1.4.2 :) |
13:28:00 | FromGitter | <sambeckingham> hola |
13:29:15 | FromDiscord | <Yardanico> Konnichiwa |
13:29:57 | FromGitter | <sambeckingham> Does anyone know of a CLI framework/library for Nim? Something like Cobra for Golang? |
13:31:23 | FromDiscord | <Digitalcraftsman> sent a long message, see http://ix.io/2G9s |
13:32:53 | FromDiscord | <Yardanico> @sambeckingham take a look at cligen, there's also docopt and a few others |
13:33:30 | FromDiscord | <Yardanico> @Digitalcraftsman you need to import it as "import std/enumerate" |
13:34:01 | FromDiscord | <Yardanico> From a certain point in time in the past all new Nim stdlib modules are only available in the std "namespace" |
13:34:06 | FromDiscord | <Yardanico> You can use it for older modules too |
13:34:36 | FromDiscord | <Yardanico> Like "import std/[strutils, os, enumerate]", you get the idea |
13:35:03 | FromDiscord | <Digitalcraftsman> thanks a lot @Yardanico. I stumbled upon a this a while ago but I should remember this for imports in the future |
13:35:51 | FromDiscord | <Yardanico> Yeah, it takes some time but it's better to remember to use std for stdlib imports :) |
13:51:24 | FromGitter | <bung87> how can a make a type definition file used by all file but keep private properties visible to specific file |
13:57:53 | * | hmmm joined #nim |
13:58:00 | hmmm | woah this advent of code stuff is super cute |
13:58:45 | supakeen | Always has been :) |
13:59:06 | supakeen | It's a great way to get to grips with a new language or just have 'fun' discussions about optimizations. |
13:59:18 | Zevv | or over-optimizations |
13:59:21 | Zevv | bunch of nerds |
13:59:45 | supakeen | :D |
14:00:21 | supakeen | arme zevv |
14:01:23 | * | dddddd joined #nim |
14:06:19 | FromDiscord | <mratsim> I remember optimizing prime gneeration for project euler 🙂 |
14:08:59 | * | lritter joined #nim |
14:20:37 | * | shad0w_ quit (Ping timeout: 264 seconds) |
14:23:25 | * | shad0w_ joined #nim |
14:30:23 | FromDiscord | <Zachary Carter> Doing AOC this year - do I just hardcode the input in my solution? |
14:30:30 | FromDiscord | <Zachary Carter> for problem number one I mean? |
14:33:01 | FromDiscord | <Idefau> if you want too, or you download the file and read it from there |
14:33:19 | hmmm | :O |
14:33:21 | FromDiscord | <Idefau> hardcoding the input in your code will become hard in the long term tho, since the input might get really huge |
14:33:25 | hmmm | we have a new nim 142 |
14:33:29 | FromDiscord | <Idefau> yup |
14:33:36 | FromDiscord | <Zachary Carter> okay thanks |
14:33:39 | hmmm | how am I supposed to upgrade from 140 |
14:33:45 | FromDiscord | <Zachary Carter> do you use choosenim? |
14:34:19 | hmmm | iirc I just shoved some files in some folder the first time |
14:35:05 | FromDiscord | <Zachary Carter> I guess shove new files in the folder? |
14:35:20 | FromDiscord | <Zachary Carter> or delete your old Nim install and use choosenim |
14:35:27 | FromDiscord | <Zachary Carter> or install from source |
14:35:51 | hmmm | I think I will go with the choosenim route just for change, but idk what to do with the other installation |
14:36:03 | hmmm | should I let choosenim take care of it? |
14:36:27 | FromDiscord | <Zachary Carter> choosenim won't as it sets up its own directory structure for storing Nim installations |
14:36:30 | FromDiscord | <Zachary Carter> so I would just delete it |
14:36:47 | hmmm | sigh I liked 140 :| |
14:36:54 | hmmm | but you can't stop progress |
14:37:02 | hmmm | ok I'll try it |
14:40:20 | * | vicfred joined #nim |
14:40:31 | * | Vladar quit (Quit: Leaving) |
14:47:15 | hmmm | choosenim is warning me that the exes are shadowed by 1.4.0 exes |
14:47:27 | hmmm | don't know if I should worry >.> |
14:50:04 | PMunch | Have you installed 1.4.0 some other way than choosenim? |
14:50:14 | hmmm | yes |
14:50:22 | hmmm | by shoving files in a nim folder in C: |
14:50:48 | PMunch | Then that's your issue I guess |
14:51:03 | hmmm | should I just delete my precious 1.4.0? |
14:51:05 | PMunch | If you run nim --version it will probably say 1.4.0 instead of 1.5.2 |
14:51:09 | PMunch | 1.4.2* |
14:51:31 | PMunch | Because your path is set up to have your specially installed Nim before the choosenim one |
14:51:39 | hmmm | ye it still show 1.4.0 |
14:52:05 | PMunch | Just remove your local copy from the PATH |
14:52:19 | hmmm | this I can do |
14:53:17 | PMunch | Hmm, choosenim said Already built.. |
14:53:21 | hmmm | can I tell choosenim I'd rather have nimble on C: than Userpath? |
14:53:36 | PMunch | Did I update it this morning when I was too tired to remember it? |
14:54:41 | hmmm | ok now nim version shows 1.4.2 |
14:54:58 | hmmm | I guess we golden except I might need to update something on vscode |
14:59:26 | * | kiwi_83 joined #nim |
15:00:07 | kiwi_83 | what's a cool nim tip |
15:00:14 | kiwi_83 | s/cool/kool |
15:02:09 | * | natrys joined #nim |
15:02:51 | FromDiscord | <Rika> Write a macro |
15:03:21 | kiwi_83 | do you use solarized? |
15:04:35 | * | hmmm quit (Quit: brb) |
15:09:29 | * | habamax quit (Quit: leaving) |
15:12:07 | kiwi_83 | what is the equivalent of decorators from python in nim (assuming there is) |
15:12:33 | narimiran | !eval echo NimVersion |
15:12:37 | NimBot | 1.4.0 |
15:14:39 | FromDiscord | <Rika> Kiwi so what if I use solarized reeeee |
15:14:59 | FromDiscord | <Rika> Pragmas are the equivalent by the way |
15:15:03 | kiwi_83 | it's a nice colorscheme that's all |
15:15:07 | kiwi_83 | thanks! |
15:15:09 | FromDiscord | <Rika> Okay |
15:16:22 | kiwi_83 | is this the only way to have a memoize pragma? https://github.com/andreaferretti/memo |
15:18:12 | FromDiscord | <Rika> Well no it’s the only one in existence though |
15:18:37 | FromDiscord | <Rika> You gotta know Nim is fundamentally different to Python |
15:18:42 | FromDiscord | <Rika> In many ways |
15:18:51 | FromDiscord | <Rika> Including to how decorators/pragmas work |
15:19:42 | PMunch | narimiran, damn it, did my script break? |
15:20:06 | * | shad0w_ quit (Remote host closed the connection) |
15:22:41 | PMunch | Oh wait, it is updating |
15:22:55 | PMunch | Just takes a while to build an image on the VPS :P |
15:23:36 | narimiran | excuses, excuses |
15:23:46 | PMunch | Just wait and see :) |
15:24:21 | ForumUpdaterBot | New post on r/nim by miran1: Nim 1.4.2 released, see https://nim-lang.org/blog/2020/12/01/version-142-released.html |
15:24:36 | narimiran | huh? |
15:24:52 | FromDiscord | <Idefau> with 1.4.2 i can say that i used nim in the timespan of one major version |
15:24:57 | narimiran | ahaaa, this is for reddit, not forum |
15:26:52 | PMunch | Hmm, when I query a website with wget I manage to get the content. But with httpclient I get an empty string.. |
15:30:13 | PMunch | Hmm, I get a status 302 Found |
15:30:18 | PMunch | Doesn't it follow? |
15:52:56 | * | waleee-cl joined #nim |
15:53:30 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/783360132222287902/unknown.png |
15:53:36 | FromDiscord | <shadow.> wrong server |
15:53:37 | FromDiscord | <shadow.> whoopsies |
15:53:40 | FromDiscord | <shadow.> lmfao |
15:53:50 | * | hmmmmm joined #nim |
15:54:33 | * | vicfred_ joined #nim |
15:54:59 | * | vicfred quit (Read error: Connection reset by peer) |
15:55:17 | * | vicfred_ quit (Remote host closed the connection) |
15:57:14 | PMunch | This is so weird.. |
15:57:33 | PMunch | The get from httpclient returns a different thing than what I can see in wget |
15:58:10 | narimiran | PMunch: you were supposed to update the bot, not to find bugs |
15:58:30 | narimiran | silly PMunch! |
15:58:37 | PMunch | It is supposed to auto-update |
15:58:44 | PMunch | I'm working on something completely different .P |
16:02:18 | ForumUpdaterBot | New thread by Jlindsay: Override decrement on indexed object, see https://forum.nim-lang.org/t/7186 |
16:09:46 | * | Gustavo6046 joined #nim |
16:09:50 | Gustavo6046 | Good afternoon! |
16:10:09 | Gustavo6046 | Is it possible to build a binary that executes in a DOS16 environment? Say, if I use Nim to compile it only to C. |
16:10:40 | Gustavo6046 | And then use a C compiler that targets DOS, like Watcom C. |
16:12:35 | * | abm joined #nim |
16:14:39 | * | Vladar joined #nim |
16:15:00 | PMunch | Should be possible |
16:15:14 | PMunch | And you can even tell the Nim compiler what C compiler you want to use |
16:16:09 | Gustavo6046 | Ah |
16:16:11 | Gustavo6046 | Ooh! |
16:16:13 | Gustavo6046 | That is interesting. |
16:17:07 | Gustavo6046 | Sadly, many C compilers today don't seem to support it themselves. At least not MZ, nor do they come with the DOS API headers (although I'm sure those can be written in Nim too, ironically). Although that does raise a few questions. |
16:18:17 | FromGitter | <sealmove> @PMunch Hi, just made an issue at binaryparse. There is an important bug/limitation. I will post an example soon. |
16:20:26 | Clonkk[m] | <PMunch "Should be possible"> Do all the module in stdlib support 16-bit OS though ? |
16:22:04 | * | vicfred joined #nim |
16:24:48 | Gustavo6046 | For instance, how do I define the address of the VGA framebuffer in a Nim file? In DOS systems that is usually mapped to address 0xA0000. |
16:25:21 | Gustavo6046 | In C that would be as simple as, < vga.h > const inline char *vga_framebuffer = 0xA0000; |
16:27:12 | FromDiscord | <mratsim> const foo = cast[pointer](0xA0000) |
16:27:26 | * | vicfred quit (Quit: Leaving) |
16:28:05 | FromDiscord | <mratsim> maybe the compiler will refuse compile-time addresses, so in that case use `let foo = cast[pointer](0xA0000)` |
16:30:07 | * | vicfred joined #nim |
16:30:22 | Gustavo6046 | Ah, okay |
16:30:33 | Gustavo6046 | I see. Thanks! |
16:30:48 | Gustavo6046 | Clonkk[m]: I assume that it's as simple as not using those that don't work in a 16-bit environment? |
16:34:14 | FromDiscord | <mratsim> but those are not tagged |
16:34:38 | FromDiscord | <mratsim> in any case, in embedded you have special requirements anyway so you end up writing a lot of code yourself |
16:36:51 | FromGitter | <sealmove> @PMunch, ok I gave an example: https://github.com/PMunch/binaryparse/issues/9 |
16:36:53 | disbot | ➥ Custom encoder does not support extra parameters ; snippet at 12https://play.nim-lang.org/#ix=2GaG |
16:37:31 | Clonkk[m] | <Gustavo6046 "Clonkk: I assume that it's as si"> Yes, of course if you odon't use things that do not work in 16-bits you'll be fine. Problem is that you don't know in advance which does work and which don't. So it'll be fun debugging sessions where you don't know if the problem comes from your code or the std/lib. |
16:38:08 | Clonkk[m] | Which happens often in embedded with external dependencies anyway 🙂 |
16:39:24 | * | Sembei quit (Ping timeout: 260 seconds) |
16:40:48 | PMunch | @sealmove, hmm |
16:41:05 | FromGitter | <bung87> @mratsim Do you know either chronos planed add a `readLineInto` api ? |
16:45:31 | PMunch | Ah, I see what has happened.. I added the writer much later (hence why it's called binaryparse) |
16:45:43 | * | matthias_ quit (Quit: matthias_) |
16:46:09 | * | matthias_ joined #nim |
16:47:18 | * | hnOsmium0001 joined #nim |
16:47:51 | * | habamax joined #nim |
16:50:01 | FromDiscord | <reilly> I'm trying to write something asynchronous again, and as always it's headache-inducing. How do I return a `Future[Option[string]]`? |
16:51:06 | FromGitter | <bung87> with async pragma you do some(yourStr) or none(string) |
16:53:12 | FromDiscord | <reilly> I don't have to do something special for the Future part? `return some(response.body.parseJson()["id"].getStr())` Nimsuggest is complaining: https://hastebin.com/ugilicuwar.txt |
16:54:06 | Gustavo6046 | Clonkk[m]: true :P |
16:56:45 | FromGitter | <bung87> async pragma will transform your code |
16:58:29 | FromDiscord | <sealmove> So is there any chance you can fix it easily? Or should I did into the code and make a PR? |
16:58:48 | FromDiscord | <sealmove> dig |
17:02:14 | FromDiscord | <reilly> Well, here's my proc. Feel free to tell me what I'm doing wrong. https://hastebin.com/okufufuben.nim |
17:07:39 | reversem3 | currently I'm comping projects on osx , can I use the same compiler for Ubuntu 16 linux ? |
17:08:07 | PMunch | Define compiler |
17:08:16 | PMunch | Nim compiler, yes. C compiler, quite possibly |
17:08:33 | reversem3 | yes using the nim compiler |
17:08:43 | PMunch | Yes it can |
17:08:50 | reversem3 | awesome thanks |
17:09:58 | reversem3 | question , I'm writing a program to extract information from two different OS's, using SSH to do it ? Do you know of a better way? |
17:10:18 | reversem3 | Async and SSH works really well so far |
17:14:27 | PMunch | Well if it works really well I'd say stick with it |
17:15:05 | * | Vladar quit (Quit: Leaving) |
17:23:45 | * | Vladar joined #nim |
17:30:22 | FromDiscord | <exelotl> Gustavo6046: do you need volatile access to that address? |
17:30:36 | Gustavo6046 | I don't think so? |
17:36:29 | ForumUpdaterBot | New thread by Mantielero: C++ wrapper - Any recommendation?, see https://forum.nim-lang.org/t/7187 |
17:37:50 | FromDiscord | <exelotl> if you wanted to treat it like an array of bytes you might be better off with e.g. cast[ptr UncheckedArray[uint8]](0xA0000) |
17:38:30 | ForumUpdaterBot | New thread by Snej: Where is `memcmp` in std lib? Or `cmp()` for byte sequences?, see https://forum.nim-lang.org/t/7188 |
17:38:36 | FromDiscord | <exelotl> or if you know the size you could even do cast[ptr array[2048, uint8]](0xA0000) |
17:39:09 | FromDiscord | <Rebel> Is it possible to do a nested keepIf within sequtils? |
17:39:26 | FromDiscord | <Rebel> or a double list comprehension in Nim |
17:43:37 | FromDiscord | <shadow.> lol its funny you mention comprehensions that's what im tryna make rn lmao |
17:43:40 | * | Sembei joined #nim |
17:44:27 | FromDiscord | <haxscramper> If you don't need to use both variables then sure - just `mapIt(it.mapIt( ... ))` |
17:45:01 | FromDiscord | <haxscramper> Or you can try to use `std/sugar.collect` to use nested for loops |
17:45:09 | FromDiscord | <Rebel> Shadow are we doing the same thing? lol |
17:45:21 | FromDiscord | <Rebel> advent of code? |
17:45:32 | FromDiscord | <shadow.> lol i did advent of code earlier today |
17:45:40 | FromDiscord | <shadow.> the 2sum one? |
17:45:50 | FromDiscord | <shadow.> ive seen people asking about comprehensions but i havent had to use them for it? |
17:46:04 | FromDiscord | <shadow.> im just making comprehensions for fun |
17:47:12 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2Gb0 - not one-liner, but should work |
17:47:52 | FromDiscord | <haxscramper> And for 1d sequence just remove nested `collect` |
17:48:52 | FromDiscord | <reilly> Is there some documentation I can read to figure out how to async in Nim? I haven't made any progress. |
17:52:48 | FromDiscord | <Rebel> Hot thanks hexscramper |
17:52:59 | FromDiscord | <Rebel> Asyncdispatch? The manual? Pretty good resources for async |
17:53:03 | FromDiscord | <Rebel> What are you trying to do? |
18:02:15 | FromDiscord | <reilly> Code that's giving me problems: https://hastebin.com/okufufuben.nim The problems in question: https://hastebin.com/ubaxelodeq.txt |
18:04:12 | FromDiscord | <For Your Health> How do you go about including c source code in your project? I am having a really hard time finding resources to learn about this. |
18:05:02 | FromDiscord | <For Your Health> So say I have some wrapper `proc testFunction: cint {.importc, header: "test.h".}` |
18:05:19 | FromDiscord | <For Your Health> How do I compile `test.c` |
18:14:26 | FromDiscord | <mratsim> {.compiler: "test.c".} |
18:14:29 | FromDiscord | <mratsim> (edit) "{.compiler:" => "{.compile:" |
18:16:03 | FromDiscord | <mratsim> example: https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_lowlevel.nim#L25-L26↵ABI: https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_abi.nim↵header: https://github.com/supranational/blst/blob/aae0c7d70b799ac269ff5edf29d8191dbd357876/bindings/blst.h |
18:17:17 | FromDiscord | <mratsim> and the compiled C code includes all other C files so we only need to call that one: https://github.com/supranational/blst/blob/aae0c7d70b799ac269ff5edf29d8191dbd357876/src/server.c |
18:18:02 | FromDiscord | <mratsim> you can also use wildcards to compile all C files in a directory: https://github.com/numforge/agent-smith/blob/master/third_party/ale_build.nim#L67-L74 |
18:19:15 | FromDiscord | <mratsim> @For Your Health ^ |
18:20:07 | * | Zevv quit (Quit: Lost terminal) |
18:21:03 | * | Zevv joined #nim |
18:21:14 | FromDiscord | <For Your Health> Awesome, that seems to work. I will look into all of those links. Thank you for the information! |
18:22:02 | * | Zevv quit (Client Quit) |
18:22:05 | * | Q-Master quit (Quit: Ушел) |
18:23:04 | * | Zevv joined #nim |
18:27:08 | * | matthias_ quit (Quit: matthias_) |
18:29:49 | * | letto joined #nim |
18:34:23 | FromDiscord | <rutenl> hello this is my first time here, does Nim have a find function that accepts a lambda as argument? Similar to seq.filter but it only returns the first item that matches the condition. I couldn't find such a function in the sequtils documentation |
18:38:32 | FromDiscord | <rutenl> I've made a proc myself to achieve it for now, but I'd rather use built in stuff |
18:38:34 | Zoom[m] | While everyone's busy with AOC, I'm casually writng some RosettaCode: https://github.com/ZoomRmc/rosettacode_nim/blob/main/src/file_size_distribution.nim |
18:38:49 | Zoom[m] | Could anyone take a glance? |
18:40:09 | FromDiscord | <mratsim> look in algorithms |
18:40:19 | Zoom[m] | I'm a bit concerned about sharing a bool between threads with a ptr, but I don't know an easier way to communicate between the main thread and a progress-bar thread |
18:40:32 | hmmmmm | zoomie I find your code style more airy than most of the rosetta nim code |
18:40:52 | hmmmmm | I mean I get that nim can be very concise but calling variables like "v" and "r" doesn't help a lot lol |
18:40:55 | Zoom[m] | What do you mean 'airy'? |
18:41:04 | hmmmmm | I mean readable |
18:42:10 | Zoom[m] | It's supposed to be educational => easily readable and self-documenting, reasonably so |
18:42:20 | Zoom[m] | Thanks |
18:42:46 | hmmmmm | also why the first class guys have syntax highlighting and nim doesnt :| |
18:43:00 | hmmmmm | I am mildly enraged at this state of things |
18:43:26 | * | letto quit (Quit: Konversation terminated!) |
18:45:26 | * | habamax left #nim (#nim) |
18:49:06 | * | hmmmmm quit (Quit: brb) |
19:01:01 | * | letto joined #nim |
19:05:36 | * | Kaivo quit (Ping timeout: 240 seconds) |
19:06:27 | planetis[m] | Is it a good idea to store an nim set as an integer? Kinda weird that other json serialization libs dont implement this. |
19:08:23 | * | Kaivo joined #nim |
19:09:50 | planetis[m] | I dont know whats the point of BiggestInt and BiggestFloat, but I think you just want to use int and float |
19:11:15 | planetis[m] | also module strformat makes all the format stuff from strutils obsolete |
19:11:40 | planetis[m] | well no, it uses them under the hood but its more convenient |
19:12:39 | * | thomasross joined #nim |
19:15:30 | Zoom[m] | That's for me, right? (Besides your first message) |
19:16:26 | Zoom[m] | Doesn't seem to me using strformat could result in significantly simpler code in this case |
19:17:26 | planetis[m] | Yep, dont know, thought that you would like it |
19:17:48 | Zoom[m] | planetis: What I want to use is int64 and uint for indexing/counting, but it seems Nim stdlib doesn't support my wishes there |
19:18:24 | leorize[m]1 | in Nim we would prefer Natural over uint |
19:18:41 | leorize[m]1 | just because Natural is actually bound-checked |
19:18:44 | Zoom[m] | I'm not sure including some DSL in an educational piece of code is such a great idea, when it's not the point of attention |
19:19:07 | Zoom[m] | Ah, but it's 2 times smaller! :D |
19:19:29 | * | hmmm joined #nim |
19:20:01 | planetis[m] | What that would you write the high(int) for me? |
19:20:27 | hmmm | hey when you join irc it says latest version 1.4.0 |
19:20:31 | hmmm | that can't be true! |
19:20:37 | planetis[m] | ...never used nimbot before lets see |
19:20:48 | leorize[m]1 | because dom haven't update it |
19:20:54 | hmmm | :> |
19:20:56 | Zoom[m] | !eval high(Natural) |
19:20:59 | NimBot | Compile failed: /usercode/in.nim(1, 5) Error: expression 'high(Natural)' is of type 'Natural' and has to be used (or discarded) |
19:21:00 | Zoom[m] | nope |
19:21:02 | planetis[m] | !eval echo high(int64) |
19:21:05 | NimBot | 9223372036854775807 |
19:21:36 | Zoom[m] | !eval echo high(Natural) |
19:21:39 | NimBot | 9223372036854775807 |
19:21:54 | Zoom[m] | hmmm... |
19:22:28 | Zoom[m] | That's how good I am at reading the specs :( |
19:22:29 | leorize[m]1 | Natural is defined as `range[0..high(int)]` |
19:22:56 | Zoom[m] | !eval echo high(uint64) |
19:22:59 | NimBot | 18446744073709551615 |
19:23:02 | leorize[m]1 | * Natural is defined as `range[0..high(int)]` |
19:23:03 | Zoom[m] | Wait, I know that |
19:24:50 | * | Jesin quit (Quit: Leaving) |
19:25:11 | Zoom[m] | So uint and the unsigned gang aren't ordinal |
19:25:37 | Zoom[m] | But it promisingly says they will be `in a later version` |
19:25:53 | leorize[m]1 | yea that's not happening |
19:26:29 | Zoom[m] | So you say unsigned aren't bound-checked? |
19:26:31 | Zoom[m] | Why is that? |
19:26:55 | leorize[m]1 | because there are too many use cases for them not being bound-checked |
19:27:21 | leorize[m]1 | in fact we tried to add bound checking to uint and it broke way too many things |
19:27:26 | Zoom[m] | That's a quirk, to say the least. |
19:27:48 | leorize[m]1 | so currently we only type check the conversions to and from uint |
19:28:13 | Zoom[m] | Why not just add a wrappingAdd and such and start using unsigned for Natural? |
19:28:47 | leorize[m]1 | because there wasn't a need for natural to be uint-big |
19:29:42 | * | Jesin joined #nim |
19:29:59 | * | tane joined #nim |
19:31:44 | Zoom[m] | Yeah, but when it happens, Nim programs will overflow 2 times faster |
19:32:09 | Zoom[m] | I mean, crash on IOOB |
19:33:24 | Zoom[m] | Again, probably it's all OK from the pov of practicality, just unusual |
19:35:55 | Zoom[m] | Why not make indexing with bare int a compile-time error? |
19:39:26 | leorize[m]1 | because it may not be an error :) |
19:39:43 | leorize[m]1 | when you're prototyping being able to express simple things matters a lot |
19:39:56 | leorize[m]1 | there's also a compile-time array bound checker that's in development |
19:40:11 | leorize[m]1 | other things took precedence atm though |
19:41:18 | Zoom[m] | For BiggestInt i just expected it to behave like intmax_t |
19:42:03 | Zoom[m] | ...from stdint.h |
19:42:19 | leorize[m]1 | it should work like that atm? |
19:42:43 | FromGitter | <HJarausch> Is it possible to "limit" the "effect" of a converter to part of a module? Thanks for a hint. |
19:42:55 | Zoom[m] | I hope so, just not sure why me using them drawn some attention. |
19:49:14 | leorize[m]1 | Zoom: after you set `mainThreadBusy` to false you should `joinThread` to make sure that the worker is stopped before continuing |
19:49:37 | leorize[m]1 | also please use result directly |
19:50:29 | Zoom[m] | leorize: ha, I actually wrote that, I've deleted the join accidentally while cleaning the code |
19:50:58 | leorize[m]1 | using `result` enables optimizations allowing in-place construction so that no copying has to be done |
19:51:30 | Zoom[m] | leorize: "because it may not be an error :)" do you mean indexing with a negative number to aim some memory region outside of a collection? |
19:51:37 | * | jmiven quit (Quit: bye) |
19:51:47 | * | jmiven joined #nim |
19:52:14 | FromDiscord | <alehander42> Araq narimiran guys sorry for the ping |
19:52:14 | leorize[m]1 | Zoom: I mean smt like: `seq.add 1; seq[0]` |
19:52:59 | FromDiscord | <alehander42> just asking if the nil pr needs more work before initial merging |
19:53:06 | FromDiscord | <alehander42> to know if i should plan some time for it |
19:56:36 | Zoom[m] | leorize: I don't get it. It's doable with Natural or uint :) |
19:56:45 | FromDiscord | <mratsim> @Zoom if you want to share a bool between threads use a ptr Atomic[bool] https://github.com/mratsim/weave/blob/master/weave/cross_thread_com/scoped_barriers.nim#L44-L57 |
19:56:56 | Zoom[m] | Thank a lot for inspecting the code, I appreciate it a lot |
19:58:45 | leorize[m]1 | @mratsim for something this simple do you even need atomics? |
19:59:04 | Zoom[m] | mratsim, that's great. Could you please explain/point somewhere so I could understand the possible source of a bug? Two threads, one "owns" the var, the other just looks at it |
19:59:05 | leorize[m]1 | it doesn't matter if one or two cycles were wasted before the value updates |
20:00:01 | leorize[m]1 | I don't know if the cost of atomic reads in a loop is worth it |
20:03:14 | * | hmmm quit (Ping timeout: 272 seconds) |
20:03:44 | FromDiscord | <Quibono> So ref objects are just like... objects you want to subclass but won't instantiate? |
20:05:15 | FromDiscord | <Recruit_main707> ref object is a managed pointer to an object |
20:05:33 | FromDiscord | <Quibono> When would you use it? |
20:06:25 | FromDiscord | <Recruit_main707> well, when you want your object, or int, or whatever type, to be heap allocated |
20:07:18 | FromDiscord | <shadow.> @Quibono like if you were making linked list nodes probably |
20:07:43 | leorize[m]1 | when you need reference semantics |
20:07:58 | leorize[m]1 | objects are value types |
20:08:00 | leorize[m]1 | meaning that they copies |
20:08:21 | leorize[m]1 | refs are references, so you can, uh, refer to them if that makes sense :p |
20:09:22 | Zoom[m] | leorize: could you please confirm my usage of a pointer is ok? I'm not sure my reasoning is correct. |
20:09:48 | leorize[m]1 | yes that's fine |
20:10:05 | leorize[m]1 | I would recommend using var-blocks so that they look more nim-ish |
20:10:18 | Zoom[m] | Thanks |
20:10:28 | Zoom[m] | More pascalishm :D |
20:10:41 | FromGitter | <deech> Is there a way to statically get the current `block` name inside the block? |
20:10:59 | leorize[m]1 | yes and merge your type blocks while you're at it |
20:11:02 | FromDiscord | <Quibono> Second maybe silly question, I'm writing an API and I'm a little bit stuck on what's the best way to organize it. Should GET and POST be procs that other more specific procs reference, should endpoints be objects in an enum... should there just be one API proc that uses the args to figure out what type of connection it is? |
20:11:13 | leorize[m]1 | @deech no, unfortunately |
20:11:42 | kiwi_83 | would metaprogramming help there? |
20:12:06 | leorize[m]1 | yes, it should be trivial |
20:12:08 | FromGitter | <deech> leorize[m]1: thanks! |
20:14:52 | FromDiscord | <Quibono> Like basically, what's the best way to format/think about an API for a website |
20:17:21 | kiwi_83 | i've seen people use swagger for designing rest apis |
20:20:16 | * | Jesin quit (Quit: Leaving) |
20:23:12 | leorize[m]1 | Zoom: `incStatsTempl` looks like it can be a func named `addFile` |
20:24:18 | Zoom[m] | It's remnants of a bigger version where I wanted it to be inlined. Should I add inline pragma, btw? |
20:25:11 | * | Jesin joined #nim |
20:27:21 | * | NimBot joined #nim |
20:27:42 | leorize[m]1 | you're writing it for rosetta code, don't over complicates unless necessary :p |
20:28:51 | Zoom[m] | And if I weren't? |
20:29:43 | leorize[m]1 | btw `quit` have a variant that takes a string, very useful for replacing the `echo-quit` pattern |
20:31:00 | Zoom[m] | BTW, shouldn't addFile be a proc, not a func? Strict Functions are coming, right? |
20:32:09 | leorize[m]1 | strict functions doesn't affect var parameters |
20:32:19 | leorize[m]1 | it only concerns refs |
20:34:17 | Zoom[m] | Hm, technically it's not a function then |
20:35:56 | * | leorize[m]1 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/syxxxeuwrinMtMuBAUnXvMRq/message.txt > |
20:36:04 | leorize[m]1 | just in case you prefer this style more |
20:37:22 | Zoom[m] | I'm doing it wherever I can. Have I missed it somewhere? |
20:38:10 | leorize[m]1 | Zoom: well if you don't use var parameters it will the a function the way you expects :p |
20:38:38 | Zoom[m] | I'll leave it a proc then :P |
20:39:26 | leorize[m]1 | in the main code |
20:40:27 | FromDiscord | <mratsim> @zoom the owner is the one who allocates and free the bool. but 2 can write as long as you ensure that the lifetime of that bool is sufficient. |
20:40:39 | FromDiscord | <mratsim> i;e. the owner must be the last user |
20:41:53 | Zoom[m] | I think I understand that. This is the case of `unsafe` code where I promise to not mutate the var from the other thread. I wish there was an immutable ptr type for that |
20:42:24 | leorize[m]1 | strict funcs is exactly that :) |
20:42:42 | leorize[m]1 | but then you have the print :p |
20:42:58 | leorize[m]1 | well guess you gotta wait until we actually have immutable pointers |
20:45:45 | Zoom[m] | ¯\_(ツ)_/¯ @leorize:envs.net: I scanned the code for ifs and almost al of them are used in this way already. |
20:46:15 | leorize[m]1 | I guess you haven't pushed it to your github |
20:50:34 | Zoom[m] | Done. I didn't expect such a thorough audit, that's very kind of you |
20:52:38 | * | narimiran quit (Ping timeout: 272 seconds) |
20:52:55 | Zoom[m] | That's a more tight feedback loop than checking codewars solutions for sure. :D |
20:53:12 | leorize[m]1 | np, the code you're putting out will be representing idiomatic Nim afterall :) |
20:53:33 | leorize[m]1 | so line 48 there's still a same-line if |
20:54:23 | leorize[m]1 | so is line 97 and 115 |
20:55:08 | leorize[m]1 | line 54 all of them are Natural so should just be grouped |
20:55:27 | Zoom[m] | Ah, so you meant I should split the line, ok |
20:56:38 | leorize[m]1 | 92-94 should potentially be put into a try-finally or a defer block for exception safety reasons |
20:58:28 | Zoom[m] | I'm not sure I like that dangling assignment |
20:58:57 | leorize[m]1 | and line 4, 60, 89, 90, 109, 112, 123 can use some spaces |
20:59:10 | leorize[m]1 | Zoom: if you don't like it you can keep it as-is |
20:59:43 | Zoom[m] | I'll keep it in my extended version :P |
21:00:10 | leorize[m]1 | instead of `contains` you can use the `in` operator |
21:00:43 | leorize[m]1 | the `%` operator from strutils can be used in place of format, but I think format looks fine here |
21:01:30 | Zoom[m] | <leorize[m]1 "92-94 should potentially be put "> Huh, so you use exclusive ranges mentally, alrighty |
21:02:08 | leorize[m]1 | I use inclusive range actually |
21:02:20 | planetis[m] | Anyone knows about casting nim builtin sets to ints? |
21:02:37 | reversem3 | is it possible to connect to two separate connections using async ? I'm using ssh for the connection protocol |
21:02:53 | leorize[m]1 | since if you put them in a defer block you need all of them or else that \r will be printed before the progress update finishes |
21:03:32 | leorize[m]1 | planetis: not recommended, the sets can span over more than 8 bytes |
21:05:02 | leorize[m]1 | nixfreak: I'm not sure what you're trying to do |
21:05:46 | reversem3 | connect to multiple ssh sessions to extract OS stats |
21:05:54 | reversem3 | using async |
21:07:23 | Zoom[m] | leorize: I'm still completely ignorant on error handling in Nim, gonna read the docs on that. And on testing facilities next |
21:08:51 | planetis[m] | Leorize thanks will research this further |
21:10:12 | leorize[m]1 | nixfreak: sure? I don't know if we have any async ssh libraries though |
21:13:39 | Zoom[m] | Ok, so what's left is to change all the vars, funcs and methods to snake case and we're all set~! |
21:19:16 | * | mbomba joined #nim |
21:20:12 | leorize[m]1 | if you do that I'll ban you :p |
21:20:54 | * | kiwi_83 quit (Quit: Connection closed) |
21:23:23 | Zoom[m] | ¯\_(ツ)_/¯ You haven't ban PMunch yet. Don't know if he used snake case for rosetta, though |
21:23:42 | PMunch | What?! I haven't used snake case for ages! |
21:23:54 | PMunch | Well, apart from whenever I'm 1:1 copying code from C.. |
21:26:17 | Zoom[m] | It's probably just me watching your streams in 360p then 😛 |
21:27:53 | Zoom[m] | BTW, we should crowdsource Andreas a gift and order him a proper mike for his future talks. |
21:30:14 | reversem3 | no I found a ssh library using async called ssh2 |
21:31:13 | * | reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/ZhQjGCqmBjBIYNTmoNiWmLKF/message.txt > |
21:31:58 | PMunch | Zoom[m], ah my notifishower code does indeed have quite a bit of snake_case in it |
21:32:12 | PMunch | Simply because a lot of it is copied from xlunch and various C samples |
21:32:32 | PMunch | One perk of Nim, with the right wrappers you can pretty much copy C code directly into your Nim code and it will be valid |
21:33:23 | Zoom[m] | Are you blushing right now? |
21:33:35 | PMunch | And by the way, if you didn't know Zoom[m] Nim is case-, and style-insensitive |
21:33:39 | PMunch | Blushing? |
21:33:50 | * | Q-Master joined #nim |
21:34:11 | Zoom[m] | I know, I'm just teasing in good spirits |
21:34:29 | * | Q-Master quit (Client Quit) |
21:36:07 | PMunch | I assumed you did, just wanted to be sure :) |
21:36:32 | PMunch | It's one of the more uncommon features of Nim |
21:37:55 | reversem3 | !help |
21:42:22 | reversem3 | what does defer do ? |
21:42:50 | * | letto quit (Quit: Konversation terminated!) |
21:43:38 | * | letto joined #nim |
21:47:28 | FromDiscord | <UNIcodeX> reversem3: wraps the code in the block which follows, in a `try` block, with the code immediately following the `defer` as the `finally` |
21:48:03 | reversem3 | Ok , is that in the manual somewhere ? |
21:48:14 | reversem3 | I tried looking for it |
21:49:11 | FromDiscord | <UNIcodeX> https://nim-lang.org/docs/manual.html#exception-handling-defer-statement |
21:49:34 | FromDiscord | <UNIcodeX> or... just the manual page and `[CTRL][F]` and search for "defer" |
21:50:29 | reversem3 | yep that was my problem I used the search box instead |
21:50:30 | reversem3 | thanks |
21:51:11 | FromDiscord | <UNIcodeX> np |
22:02:10 | reversem3 | so If I'm connecting to ssh using async and I call this proc |
22:02:13 | * | reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/GEiXWCqVQypHKBqaxZcFZyzZ/message.txt > |
22:04:52 | reversem3 | and then end it with waitFor, if I duplicate that proc with another and change the names. The only connection is the first one ? |
22:06:04 | reversem3 | is it even possible to call on two seperate connections using asysnc? |
22:08:07 | Zoom[m] | waiting blocks |
22:11:40 | reversem3 | So put the function in a block? |
22:20:10 | * | Vladar quit (Quit: Leaving) |
22:28:13 | * | abm quit (Quit: Leaving) |
22:33:54 | * | natrys quit (Quit: natrys) |
22:42:27 | PMunch | Uhm... http://ix.io/2Gcu |
22:46:13 | * | tane quit (Quit: Leaving) |
22:47:47 | * | apahl quit (Ping timeout: 272 seconds) |
22:48:15 | * | apahl joined #nim |
22:59:41 | * | Gustavo6046 quit (Quit: WeeChat 2.9) |
23:00:31 | * | Gustavo6046 joined #nim |
23:09:43 | PMunch | Ugh, why doesn't this work.. http://ix.io/2GcE |
23:13:10 | * | abm joined #nim |
23:22:29 | FromDiscord | <fwsgonzo> are there any plans to move towards borrow checking on the long term? |
23:25:53 | PMunch | Don't think so, why? |
23:56:02 | FromDiscord | <JSGRANT> @fwsgonzo Afaik no; But Nim's move semantics & deconstructors should be a good-enough solution "in this space" imo then ceeding a bunch of the structure of the language in trying to accommondate this. |
23:58:53 | * | PMunch quit (Quit: leaving) |