00:00:05 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2GhX |
00:01:24 | * | xet7 joined #nim |
00:13:05 | * | not_lum quit (Quit: Lum: Bye!) |
00:13:48 | * | lritter quit (Quit: Leaving) |
00:14:48 | * | lum joined #nim |
00:17:27 | * | hmmm quit () |
00:24:43 | * | sagax quit (Quit: Konversation terminated!) |
00:26:23 | * | NimBot joined #nim |
00:56:37 | FromDiscord | <Cohjellah> Hello! New to Nim, and excited to join this community as this language looks really fun and like it has potential.โตComing across from Python - curious what everyone uses Nim to create?โตCurrently reading through Nim in Action |
00:58:04 | FromDiscord | <Esbeesy> PIggybacking off that ^ Is Nim in Action still relevant? I noticed it was published in 2017 and was wonder how much had been deprecated/added since then |
00:58:38 | FromDiscord | <Avatarfighter> @dom96 might be able to answer the second question better than most |
00:59:13 | FromDiscord | <j-james> @Cohjellah I've been working on a lightweight Slack export viewer recently: https://github.com/j-james/static-slack |
00:59:46 | FromDiscord | <flywind> see readme for nim-in-action codes https://github.com/dom96/nim-in-action-code |
01:01:26 | FromDiscord | <nikki> this question keeps coming up so maybe https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html should be easily findable wherever the book is referenced |
01:01:54 | FromDiscord | <Esbeesy> Or someone could just write a new book right I mean how hard can it be... ๐ |
01:02:11 | FromDiscord | <nikki> you don't need a new book, it's basically all relevant |
01:02:33 | FromDiscord | <nikki> i used it when studying / learning nim fresh about 1.5 months ago |
01:10:04 | leorize[m]1 | ~errata: Nim in Action errata: https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html |
01:10:04 | disbot | no footnotes for `errata:`. ๐ |
01:10:17 | leorize[m]1 | ~errata is Nim in Action errata: https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html |
01:10:18 | * | Tanger joined #nim |
01:10:18 | disbot | errata: 11Nim in Action errata: https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html |
01:26:03 | voltist | Does anyone know if it's possible to kill the NiGui app without killing everything else? |
01:29:51 | FromDiscord | <ElegantBeef> You mean close the window but leave nim running? |
01:30:15 | voltist | Yeah |
01:30:29 | voltist | Just closing the window quits the app which stops nim |
01:30:38 | voltist | For some reason |
01:31:21 | FromDiscord | <ElegantBeef> there is a `quitOnWindowClose` bool |
01:31:37 | FromDiscord | <ElegantBeef> (edit) "`quitOnWindowClose`" => "`quitOnLastWindowClose`" |
01:32:02 | FromDiscord | <ElegantBeef> If that's set to true when all windows close it calls `quit()`, so just set that to false and be happy |
01:33:14 | voltist | Oh that looks promising thanks |
01:33:43 | voltist | If it doesn't quit it, does that mean that the app is still hanging around the in the background and using memory? |
01:34:00 | FromDiscord | <ElegantBeef> If there is anything after `app.run` |
01:34:17 | FromDiscord | <ElegantBeef> app.run is blocking, so when it stops blocking anything after it will be ran |
01:34:22 | FromDiscord | <ElegantBeef> If nothing is ran it closes |
01:34:26 | FromDiscord | <Cohjellah> Interesting, I would think not TOO much has changed since 1.0? At least it's some reading to do while there's nothing else available |
01:38:02 | voltist | Is it possible to make something run after app.run is called? Basically, I have a proc that creates a window to prompt the user about something, and I want the proc to close the window and return a value when done. With quitOnLastWindowClose set to false, I still can't figure out how to get it to end the proc all together in order to return |
01:38:27 | FromDiscord | <ElegantBeef> Well any code after `app.run` should be called after closing all windows i believe |
01:38:38 | FromDiscord | <ElegantBeef> I could be wrong, i havent used nigui much |
01:39:28 | voltist | Unfortunately that doesn't seem to work :( |
01:39:59 | * | Gustavo6046 joined #nim |
01:40:09 | FromDiscord | <Cohjellah> Are there any examples of Karax I can find? |
01:40:32 | FromDiscord | <Cohjellah> Writing client side webpages without JS seems magical |
01:42:46 | FromDiscord | <ElegantBeef> Ok so voltist you'll want to overwrite the `quit(app: App)` so it sets a `app.running` bool to false and stop blocking |
01:42:56 | FromDiscord | <ElegantBeef> https://github.com/trustable-code/NiGui/blob/07225b1737d56e8f93c8b5500f2c76f5ea7936cb/src/nigui.nim#L1152 |
01:43:34 | FromDiscord | <ElegantBeef> Could even make a fork for `quit` so it has a `terminate` bool which is defaulted to true |
01:45:02 | FromDiscord | <ElegantBeef> It's a relatively small change with a benefit so i personally thing it's a nice thing to make a PR for |
01:45:08 | FromDiscord | <ElegantBeef> (edit) "thing" => "think" |
01:45:18 | FromDiscord | <ElegantBeef> I editted the wrong think... i'm smart |
01:45:31 | voltist | Sounds like a plan |
01:46:16 | voltist | Do you know what other quit proc the quit proc at this line refers to? |
01:46:17 | voltist | https://github.com/trustable-code/NiGui/blob/07225b1737d56e8f93c8b5500f2c76f5ea7936cb/src/nigui.nim#L1160 |
01:46:39 | voltist | Confusing grammar in that question but hopefully you get the picture |
01:46:52 | FromDiscord | <ElegantBeef> Forward declaration is here https://github.com/trustable-code/NiGui/blob/07225b1737d56e8f93c8b5500f2c76f5ea7936cb/src/nigui.nim#L453 |
01:47:14 | FromDiscord | <ElegantBeef> I assume that's what you meant? |
01:47:58 | voltist | Yep |
01:48:31 | voltist | Doesn't help as much as I thought it would though, since I can't find any of the actual code that is executed on app.quit |
01:48:46 | FromDiscord | <ElegantBeef> what you first showed me was it |
01:48:48 | voltist | But maybe I'm just not understanding the structure of this libraru |
01:48:51 | FromDiscord | <ElegantBeef> it just calls quit by default |
01:49:36 | FromDiscord | <ElegantBeef> You need to add a bool to app of `running` then if you pass a true to `app.quit` terminate, else set that bool to false and let the app take the natural path |
01:50:01 | voltist | Ooohhh, system.quit right? Idk why that took me so long to figure out |
01:50:13 | FromDiscord | <ElegantBeef> dont ask me ๐ |
01:50:18 | FromDiscord | <ElegantBeef> Yea system.quit |
01:50:28 | FromDiscord | <ElegantBeef> Does your editor not have a goto defintition? |
01:50:36 | FromDiscord | <ElegantBeef> Or were you just reading on git? |
01:50:43 | voltist | Just reading on git |
01:50:49 | voltist | github |
01:50:53 | FromDiscord | <ElegantBeef> Ah i was aswell, and just assumed |
01:51:07 | voltist | Or gith-oob as someone I know calls it |
01:52:29 | voltist | Right yeah I've got my head around this now, so I'll try out the change and then do a PR |
01:53:29 | * | lbart joined #nim |
01:53:29 | * | lbart quit (Changing host) |
01:53:29 | * | lbart joined #nim |
01:53:50 | FromDiscord | <ElegantBeef> Nice |
02:15:07 | * | ^Q-Master^ joined #nim |
02:16:00 | * | Q-Master quit (Read error: Connection reset by peer) |
02:16:32 | * | apahl quit (Ping timeout: 260 seconds) |
02:18:36 | * | apahl joined #nim |
02:34:57 | * | abm quit (Read error: Connection reset by peer) |
02:35:53 | FromDiscord | <ElegantBeef> If i continue writting aoc, i might just endup only using templates ๐ https://play.nim-lang.org/#ix=2Gif |
02:35:56 | FromDiscord | <ElegantBeef> My day2 version |
02:36:43 | mipri | I just get "Unable to load ix paste, file too large, or download is too slow" from that |
02:46:00 | FromDiscord | <ElegantBeef> Think something is wrong with nim playground atm |
02:46:08 | FromDiscord | <ElegantBeef> https://hatebin.com/idvskoibyv |
02:46:14 | FromDiscord | <ElegantBeef> That should work |
03:03:07 | * | xet7 quit (Quit: Leaving) |
03:06:28 | * | xet7 joined #nim |
03:07:13 | * | kiwi_83 joined #nim |
03:11:31 | kiwi_83 | is iterative compilation available in main release yet? |
03:12:23 | FromDiscord | <flywind> incremental compilation? |
03:12:30 | kiwi_83 | yes yes thath one |
03:13:37 | FromDiscord | <flywind> I don't think they are stable enough to use. But they will come soon(maybe in Next big feature release). |
03:13:41 | FromDiscord | <flywind> https://forum.nim-lang.org/t/7185 |
03:14:01 | FromDiscord | <flywind> and https://github.com/nim-lang/RFCs/issues/46 |
03:14:02 | disbot | โฅ Incremental compilation |
03:14:22 | FromDiscord | <treeform> How does JAI (Jonathan Blow Language) go so fast without incremental compotation? |
03:14:24 | kiwi_83 | thanks! can't wait to see this in action |
03:15:17 | kiwi_83 | flywind are you xflywind |
03:15:32 | FromDiscord | <flywind> yes |
03:15:53 | kiwi_83 | any suggestions on how to get started with tinkering with nim itself? |
03:16:01 | kiwi_83 | I don't know much about compilers tbh |
03:16:04 | FromDiscord | <nikki> @treeform there's a few videos where jblow goes around the codebase and esp. works on perf, which may be insightful |
03:16:33 | FromDiscord | <flywind> @kiwi see https://dev.to/xflywind/how-to-contribute-to-nim-language-4ad8 |
03:16:34 | FromDiscord | <nikki> the main thing is they seem to have a tight compiler dev <-> using the compiler on a project workflow and optimize / dev it for that particular project |
03:17:00 | FromDiscord | <flywind> And this is very useful to read before contributing to Nim: https://nim-lang.org/docs/contributing.html |
03:20:27 | kiwi_83 | thank you, great links |
03:20:50 | kiwi_83 | if I import something in a nim program and dont use the imported stuff, will it be removed in -d:release ? |
03:20:54 | kiwi_83 | as optimization |
03:22:37 | FromDiscord | <flywind> Nim has Dead Code Elimination so dead code are removed. |
03:23:11 | mipri | you can see this by having a large dead literal in your code |
03:23:28 | mipri | and comparing binary sizes as is and after you use it somewhere |
03:23:52 | FromDiscord | <flywind> But these still increase compilation time a bit. Because symbols still need to be searched. |
03:26:56 | kiwi_83 | hmm and incremental compilation would help here right? |
03:27:20 | kiwi_83 | like if it found out once and performed dce, next time it wont do it if that part exists right |
03:27:34 | mipri | dce? |
03:27:45 | kiwi_83 | dead code elimination |
03:28:48 | leorize[m]1 | yes |
03:30:24 | leorize[m]1 | though what's exciting about IC would be the tech that's coming with it |
03:30:39 | kiwi_83 | you mean the autocomplete etc? |
03:31:36 | leorize[m]1 | that's already possible now |
03:31:52 | kiwi_83 | flywind idk how to /q you but in https://github.com/xflywind/awesome-nim s/Serializtion/Serialization |
03:32:06 | kiwi_83 | hmm what are you referring to leorize? |
03:32:22 | leorize[m]1 | ic will bring a redesigned AST (compiler side, not the user side) |
03:32:34 | FromDiscord | <flywind> Feel free to make a PR. |
03:32:40 | kiwi_83 | oh wow that sounds like a significant change |
03:32:53 | kiwi_83 | will it help making macros easier |
03:32:56 | kiwi_83 | sure flywind |
03:33:23 | FromDiscord | <flywind> Who is working on IC? |
03:34:16 | leorize[m]1 | will be in the future, but what it can do now is drastically reducing the compiler memory usage, and also allowing the AST to be (de)serialized efficiently |
03:37:23 | leorize[m]1 | it would also enable pluggable compiler passes (my fav feature) and of course, static inspection of the code for use with nimsuggest |
03:37:34 | leorize[m]1 | all of this is in development though, so no promises |
03:37:55 | leorize[m]1 | @flywind 4raq and disruptek afaik |
03:38:06 | kiwi_83 | 'pluggable compiler passes' eli5 pls |
03:40:18 | FromDiscord | <flywind> I see, thanks. |
03:43:49 | leorize[m]1 | kiwi_83: the compiler basically works by running macros over your code until you get the final result. We call these "macros" passes. |
03:44:59 | leorize[m]1 | The current architecture requires that passes be a part of the compiler since it's not possible to (de)serialize the AST effectively. |
03:46:14 | leorize[m]1 | with the new AST in development this would allow for passes outside of the compiler to be run, and these can even be written in user code |
03:46:51 | leorize[m]1 | that's what I call "pluggable passes" |
03:47:04 | leorize[m]1 | hope that makes sense |
04:04:41 | FromDiscord | <ElegantBeef> Oh, so that means you could add onto analysis for things like `options` accessing? |
04:05:24 | FromDiscord | <ElegantBeef> If so, sounds nice ๐ |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:37 | * | supakeen joined #nim |
04:13:41 | * | spiderstew_ joined #nim |
04:17:23 | * | spiderstew quit (Ping timeout: 244 seconds) |
04:17:23 | * | spiderstew_ is now known as spiderstew |
04:30:27 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:36:17 | * | mbomba quit (Quit: WeeChat 3.0) |
04:40:39 | FromDiscord | <the condor> what are some great nim modules or package to learn to get comfortable with nim |
04:41:19 | FromDiscord | <the condor> like those related to networking, cryptography and low level stuffs |
04:42:21 | kiwi_83 | awesome-nim |
04:42:28 | kiwi_83 | google that you will find it on github |
04:42:57 | FromDiscord | <the condor> thanks man |
04:43:05 | kiwi_83 | sure thing bruv |
04:46:56 | * | narimiran joined #nim |
04:51:24 | FromDiscord | <Rebel> Are there any tips and tricks to make a binary as small as possible in Nim. As drastic as the tactics employed by this guy idc if I need to modify stdlib. |
04:51:27 | FromDiscord | <Rebel> https://medium.com/@MStrehovsky/building-a-self-contained-game-in-c-under-8-kilobytes-74c3cf60ea04 |
04:51:56 | FromDiscord | <Cohjellah> Are there any statistics on the growth of Nim? |
04:52:28 | FromDiscord | <Rebel> I can tell you with 100% certainty it is growing within the security community more specifically for red teaming ๐ |
04:52:41 | FromDiscord | <Cohjellah> Red teaming? |
04:57:35 | * | kiwi_83 quit (Ping timeout: 256 seconds) |
04:57:49 | FromDiscord | <Rebel> Red teaming = On a team emulating threat actors and attempting to hack into an organization basically just acting as adversaries to a company |
04:58:35 | FromDiscord | <Rebel> fun stuff |
04:58:42 | FromDiscord | <ElegantBeef> `--opt:size` |
04:58:55 | FromDiscord | <Rebel> https://media.discordapp.net/attachments/371759389889003532/783920175116058644/4.png |
04:59:59 | FromDiscord | <Rebel> `'extreme' not in '--opt:size'` |
05:00:15 | FromDiscord | <ElegantBeef> Nim has dead code elimination, but some modules import a lot of code, so aside from checking what a module uses not much |
05:00:16 | FromDiscord | <Rebel> (edit) "'--opt:size'`" => "'--opt:size' == true`" |
05:00:19 | FromDiscord | <ElegantBeef> Atleast that i know of |
05:00:26 | FromDiscord | <Rebel> hmmm I need to test my game theory |
05:00:27 | FromDiscord | <ElegantBeef> opt is for speed or size |
05:00:29 | FromDiscord | <Rebel> that using nlvm |
05:00:34 | FromDiscord | <Rebel> and optimizing the IR |
05:00:37 | FromDiscord | <Rebel> might be the move |
05:01:02 | FromDiscord | <ElegantBeef> I mean just optimize the C |
05:01:04 | FromDiscord | <ElegantBeef> ๐ |
05:01:47 | FromDiscord | <Rebel> well isn't that what I'm basically optimizing if I go the nlvm route? |
05:02:18 | FromDiscord | <ElegantBeef> I was more implying optimizing the C output jokingly |
05:02:38 | FromDiscord | <Cohjellah> Ok I found some stats. Definitely has grown a lot |
05:02:46 | FromDiscord | <Cohjellah> Biggest growth in the last year, go figure with a stable release |
05:03:01 | FromDiscord | <Cohjellah> Was 5k stars in 2018, now past 10k |
05:14:54 | voltist | Has nimsuggest been having really bad memory leaks for anyone else lately? |
05:15:04 | voltist | When used with the vscode extension |
05:17:59 | narimiran | voltist: lately as in last 3 years? :P |
05:19:52 | ee7[m] | AoC still easy today :) |
05:23:12 | FromDiscord | <ThatTrollzer> I went from 7th to 8th H O W |
05:26:36 | FromDiscord | <ThatTrollzer> now I'm 9th why am I going down when I have completed all the challenges? |
05:27:20 | narimiran | because in the mean time somebody who was above you yesterday completed it |
05:27:33 | FromDiscord | <ThatTrollzer> ah that makes sense |
05:28:40 | FromDiscord | <ElegantBeef> Also why are we so worried about our aoc ranks? ๐ |
05:29:25 | FromDiscord | <wad35dam> Hello, i have a question, is Nim have Ternary Operator? |
05:29:45 | FromDiscord | <ElegantBeef> No we use an if expression |
05:29:54 | FromDiscord | <wad35dam> Ok, thanks |
05:30:08 | FromDiscord | <ElegantBeef> `if cond: a else: b` |
05:34:54 | voltist | narimiran: I only noticed it recently but maybe its a coincidence |
05:35:45 | * | thomasross quit (Ping timeout: 240 seconds) |
05:38:49 | * | kiwi_83 joined #nim |
05:49:59 | FromDiscord | <Idefau> wow today's aoc has grids |
05:52:03 | FromDiscord | <j-james> Speaking of Advent of Code, is there a nice way to get the iteration of an iterator? |
05:52:46 | FromDiscord | <j-james> Right now I'm throwing a `var i: int = 0` outside of a for loop and `inc(i)` inside |
05:55:43 | mipri | https://nim-lang.org/docs/enumerate.html#enumerate.m%2CForLoopStmt |
06:05:04 | FromDiscord | <j-james> This might be a dumb question, but how do I import that? |
06:10:00 | narimiran | `for i, x in myIterator` works |
06:10:48 | FromDiscord | <j-james> That doesn't seem to work for `lines()` |
06:10:53 | FromDiscord | <JSGRANT> @Cohjellah oh, funny seeing you here. Lol |
06:11:02 | * | vicfred_ joined #nim |
06:12:09 | mipri | ... |
06:12:14 | mipri | it doesn't work at all. |
06:12:23 | mipri | import std/enumerate is how you import it anyway. |
06:13:01 | mipri | ah correction, it doesn't work at all nuder 1.4.0 |
06:13:06 | mipri | forgot I had choosenim'd back to that for some reason |
06:13:58 | * | vicfred quit (Ping timeout: 260 seconds) |
06:18:43 | * | vicfred_ quit (Quit: Leaving) |
06:19:11 | FromDiscord | <Cohjellah> I just wanted the sick crown emoji |
06:24:46 | FromDiscord | <j-james> mipri: What's the distinction between modules that need to be imported with `std` and others like `htmlparser`? |
06:25:21 | mipri | no idea |
06:26:13 | mipri | although at a guess, there was an old flat namespace corresponding to the pure/ and impure/ contents, and std/ is new, and the stuff in std/ is not grandfathered into the flat namespace |
06:27:04 | mipri | !eval import pure/strformat; echo &"{1+2}" |
06:27:08 | NimBot | 3 |
06:27:43 | mipri | this creates a documentation failure however |
06:27:45 | FromDiscord | <ElegantBeef> Yea i think `std/` will be enforced eventually but only some of them currently have it |
06:27:55 | mipri | in that the docs assume that you don't have to ask this question |
06:31:34 | * | mbomba joined #nim |
06:38:10 | * | habamax joined #nim |
06:42:45 | voltist | Is there a `times` proc to get time after the UNIX epoch in seconds for any given datetime? |
06:44:14 | FromDiscord | <JSGRANT> @Cohjellah Well, welcome to the :nimAngry: |
06:47:23 | voltist | Nevermind, found it |
06:47:30 | mipri | what did you find? |
06:48:54 | * | sagax joined #nim |
06:58:17 | * | kinkinkijduet quit (Ping timeout: 260 seconds) |
07:11:41 | * | jaens[m] joined #nim |
07:20:31 | mipri | this would be good comedy timing for someone else to have the same question. |
07:27:23 | voltist | The Nim vscode extension just stopped my computer in its tracks for 15 minutes |
07:28:20 | voltist | Time to disable nimsuggest |
07:28:27 | narimiran | voltist: did you start to use some macro-heavy code? |
07:29:04 | voltist | Nope |
07:29:17 | voltist | Not that much code at all either |
07:37:18 | FromDiscord | <lqdev> can't wait for IC. |
07:40:47 | voltist | IC? |
07:41:47 | FromDiscord | <lqdev> incremental compilation |
07:42:00 | FromDiscord | <lqdev> it's said to improve the compiler by a ton |
07:42:05 | FromDiscord | <lqdev> incl. nimsuggest stability |
07:43:33 | voltist | Sounds awesome |
07:51:56 | FromDiscord | <ElegantBeef> But does it write code for me? |
07:54:58 | * | habamax_ joined #nim |
07:56:35 | Zevv | well narimiran, going for the terse ones this year, are we :) |
07:57:48 | narimiran | Zevv: trying hard :) |
07:59:38 | narimiran | Zevv: now looked at your solution. i had no idea we have `countIt` |
08:00:38 | narimiran | ...and i've never used `/%` |
08:00:39 | FromDiscord | <ElegantBeef> I hate day2, have to hardcode it ๐ |
08:00:49 | narimiran | huh? why hate? |
08:01:07 | FromDiscord | <ElegantBeef> Cause you need to hardcode code the two cases ๐ |
08:01:16 | FromDiscord | <ElegantBeef> Day one you could write a solution for N number of cases |
08:01:58 | FromDiscord | <ElegantBeef> My day1 solution isnt overkill https://hatebin.com/mflmrrgydp |
08:02:39 | FromDiscord | <ElegantBeef> Using that pull is faster than a closure iterator if you're wondering "why?" |
08:06:22 | narimiran | the first think i'm wondering is - why it takes you so many lines to solve it :P |
08:07:34 | FromDiscord | <ElegantBeef> It doesnt |
08:07:39 | FromDiscord | <ElegantBeef> It's cause i overengineered it ๐ |
08:08:31 | narimiran | heh, i tend to under-engineer my aoc submissions :) |
08:09:03 | FromDiscord | <ElegantBeef> I apparently do the complete opposite, after doing pt1 i looked at pt2 and went "Ok i can do both of these in a general solution" |
08:09:24 | narimiran | use itertools.combinations ;) |
08:10:58 | FromDiscord | <Idefau> im still stuck at the part 2 because i am an idiot, and somehow i got the first part working |
08:11:15 | narimiran | run it on the example to be sure it works correctly |
08:11:48 | FromDiscord | <ElegantBeef> I'm not doing pt3 until after i sleep, so... i guess i'll consistantly lose since i'm doing it a day behind ๐ |
08:11:52 | FromDiscord | <ElegantBeef> day3 |
08:13:02 | narimiran | this "who is fastest" is usually replaced by "who solved it at all" by day15 or so |
08:13:09 | narimiran | so don't worry |
08:13:46 | FromDiscord | <ElegantBeef> Oh i'm not worried, i dont really care about the rank |
08:14:35 | FromDiscord | <ElegantBeef> I dont quite see why you suggested combinations |
08:15:09 | narimiran | that's for after you sleep |
08:15:21 | narimiran | (it is for day1) |
08:16:09 | narimiran | p.s. don't forget to read day3 before your sleep, so you can work on the solution in your dreams |
08:16:16 | FromDiscord | <ElegantBeef> lol |
08:18:46 | FromDiscord | <ElegantBeef> Well i'm not sleeping for another hour or two, so eh |
08:20:52 | FromDiscord | <Idefau> weird, running my code on the example it works |
08:23:46 | FromDiscord | <Idefau> no fucking way |
08:23:52 | FromDiscord | <Idefau> my code was correct all along |
08:24:19 | FromDiscord | <Idefau> except the last part where i multiplied all of it.... |
08:24:37 | FromDiscord | <Idefau> i did like slope(1,2) instead of slope(2,1) |
08:24:45 | FromDiscord | <Idefau> im mad |
08:29:45 | * | alexander92 quit (Ping timeout: 240 seconds) |
08:30:29 | * | habamax_ quit (Quit: leaving) |
08:30:45 | * | habamax_ joined #nim |
08:31:55 | narimiran | :) |
08:32:02 | * | Tanger quit (Quit: Leaving) |
08:32:13 | narimiran | i like that final twist, exactly because stories like this |
08:33:44 | FromDiscord | <Idefau> atleast im still above my friendly competitor |
08:33:57 | FromDiscord | <Idefau> (edit) "competitor" => "rival" |
08:34:59 | narimiran | btw Zevv, no more "the top guy in our leaderboard uses kotlin" ;) :) |
08:42:38 | Zevv | good for you. But let's see at day 15 or so, who solves it all ;) :) |
08:42:44 | * | habamax_ quit (Quit: Lost terminal) |
08:43:05 | * | habamax_ joined #nim |
08:45:27 | * | habamax_ quit (Client Quit) |
08:57:21 | narimiran | :P |
08:57:48 | FromDiscord | <Idefau> is day 15 that hard |
08:58:03 | narimiran | sometimes day7 is hard |
08:58:11 | narimiran | usually tasks on weekend are harder |
08:58:40 | narimiran | but it is not that it is always increasing complexity |
08:58:46 | kiwi_83 | can i do this later |
08:58:49 | kiwi_83 | like next year? |
08:58:52 | narimiran | you might have one hard task, then 3 easy ones after it, etc. |
08:58:59 | narimiran | kiwi_83: whenever you like |
08:59:08 | kiwi_83 | phew that's good news to me |
08:59:11 | narimiran | kiwi_83: but you'll miss this community part of it |
08:59:17 | kiwi_83 | huh what do you mean |
09:00:00 | narimiran | everybody is solving it now. in one year, we will do AoC 2021, not tasks from this year |
09:02:01 | * | mbomba quit (Quit: WeeChat 3.0) |
09:07:44 | * | PMunch joined #nim |
09:13:31 | FromDiscord | <Rika> I just stopped trying after the first year I did |
09:13:40 | FromDiscord | <Rika> Not my thing I guess |
09:13:49 | FromDiscord | <Rika> Feels useless for me |
09:14:40 | narimiran | i find it great for learning basics of some new language |
09:15:37 | FromDiscord | <Idefau> i find it nice so i dont get bored |
09:18:32 | FromDiscord | <Rika> I found it nice at first but after a few problems I felt like I was doing nothing productice |
09:19:04 | FromDiscord | <Idefau> im doing nothing productive anyway |
09:20:21 | FromDiscord | <Rika> I don't have much time to do nothing productive and there are more enjoyable ways for me to use time unproductively |
09:24:21 | FromDiscord | <Idefau> alright |
09:30:25 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:34:00 | PMunch | I like them, they're like as small little puzzle to start the day off with |
09:44:15 | FromDiscord | <Idefau> yea |
09:48:04 | FromDiscord | <wad35dam> is nim have garbage collector? |
09:48:47 | PMunch | Yes, Nim has multiple garbage collectors/garbage collection policies |
09:48:52 | PMunch | But you can disable it |
09:49:05 | FromDiscord | <wad35dam> Its good, Thanks |
09:49:24 | FromDiscord | <lqdev> this year i have better things to do than AoC |
09:49:40 | FromDiscord | <lqdev> i give up after 2 days each year anyways so eh |
09:50:07 | PMunch | So far they've been really simple |
09:51:07 | PMunch | Only the first one really had some room for optimisation |
09:52:12 | FromDiscord | <Idefau> i liked last years first day |
09:52:32 | supakeen | It always ramps up so one can give up around day 10-20 :) |
09:52:34 | FromDiscord | <Idefau> (edit) "years" => "year's" |
09:54:08 | FromDiscord | <Idefau> i just realised i might not be able to do tommorow's AoC early, since i have to present something at school |
09:54:22 | FromDiscord | <Idefau> so i cant just solve the thing while in the meeting |
09:57:53 | kiwi_83 | fk school. all my homies h8 skool |
09:58:14 | FromDiscord | <Idefau> this |
09:58:42 | PMunch | I don't see why everyone appears to hate school |
09:58:47 | PMunch | I kinda liked it |
09:59:33 | kiwi_83 | tis but a meme mr pmunch https://knowyourmeme.com/memes/fuck-x-all-my-homies-use-y |
09:59:44 | PMunch | Aight :P |
10:03:07 | supakeen | `Error: invalid type: 'openArray[char]' in this context: 'proc (data: openArray[char], n: int): openArray[char]' for proc` send help. |
10:03:16 | supakeen | Why is it invalid in this context and what context is it talking about? |
10:03:43 | kiwi_83 | type is openarray? |
10:04:02 | narimiran | you cannot return openArray |
10:04:11 | supakeen | Ah. |
10:04:36 | supakeen | But I can take an openarray and write to that I presume. |
10:05:04 | supakeen | Or what is the common way to do this, it might just be that I'm missing some knowledge on how a signature like this should be. |
10:06:08 | narimiran | do what exactly? |
10:06:34 | supakeen | My goal is to have a function that reads an array up until a certain number and returning the slice of that. |
10:06:59 | supakeen | And before 'just use slice', I have some custom exceptions and the like when there's not enough data. |
10:07:34 | supakeen | And for example also a `readTo(data: openArray[char], to: openArray[char])` |
10:07:57 | narimiran | can https://nim-lang.github.io/Nim/strutils.html#find%2Cstring%2Cchar%2CNatural%2Cint be of help? |
10:08:28 | supakeen | My data contains null bytes and I wrongly assumed that `string` treats those specially. |
10:08:37 | supakeen | Maybe wrongly? |
10:09:18 | kiwi_83 | narimiran your nick is a palindrome huh? |
10:09:27 | narimiran | kiwi_83: indeed |
10:09:29 | FromDiscord | <ache of head> oh dang |
10:09:30 | FromDiscord | <ache of head> you're right |
10:09:41 | PMunch | How have I never noticed that before.. |
10:09:47 | kiwi_83 | no wonder my mind was itchy |
10:09:47 | narimiran | PMunch: hahaha, really? |
10:09:57 | kiwi_83 | do i get a cookie or something lol |
10:10:22 | * | ^Q-Master^ quit (Ping timeout: 246 seconds) |
10:10:37 | PMunch | narimiran, yeah really |
10:10:44 | supakeen | I think I should go with `readTo(data: openArray[char], to: openArray[char], out: openArray[char]) =` signature, bit too C-ish for my liking. |
10:10:46 | PMunch | Feel a bit daft now tbh |
10:10:54 | narimiran | btw, once i was in some other irc channel, and noticed there is a guy who has nick: nalimilan |
10:11:14 | narimiran | and i was "yeah yeah, i know your name now" |
10:12:57 | supakeen | Oh, or seq[char]. |
10:13:29 | narimiran | supakeen: don't forget `var` for your `out` |
10:13:34 | supakeen | Si. |
10:13:46 | supakeen | But I think I'll solve it with seq[char] instead of openArray[char] :) |
10:13:58 | * | kiwi_83 is now known as kiwiwiki |
10:14:14 | kiwiwiki | i like this palindrome |
10:14:29 | kiwiwiki | two words that have meaning independently but also a palindrome |
10:14:38 | kiwiwiki | um |
10:14:42 | kiwiwiki | i need sleep nvm |
10:15:04 | PMunch | Haha :P |
10:17:04 | FromDiscord | <Idefau> kek |
10:19:22 | supakeen | So for now until I run into problems I'll use: `proc readN*(data: seq[char], n: range[1..high(int)]): seq[char] =` :) |
10:19:45 | narimiran | use `n: Positive` for a start |
10:20:16 | supakeen | Grr, I only had natural in my head. |
10:20:33 | narimiran | you must be Positive in your head!! |
10:20:48 | supakeen | Thanks :) |
10:22:40 | supakeen | For the life advice! |
10:24:07 | kiwiwiki | But don't be covid positive! |
10:24:13 | kiwiwiki | thank me later for the medical advice xD |
10:42:34 | * | Q-Master joined #nim |
10:44:58 | * | kiwiwiki left #nim (#nim) |
10:47:16 | * | Q-Master quit (Ping timeout: 240 seconds) |
10:55:06 | FromDiscord | <Cohjellah> Is there a benefit of AoC over leetcode? |
10:55:14 | FromDiscord | <Cohjellah> Apart from Nim not being on Leetcode ahah |
10:55:28 | FromDiscord | <Cohjellah> More realistic questions? |
10:59:41 | supakeen | Nah, AoC is just flavor of the month each year :) |
11:01:23 | PMunch | AoC is just an advent calendar :) |
11:01:50 | PMunch | And it doesn't "support" any languages, in theory you could do all the tasks manually without programming anything |
11:02:02 | PMunch | Well, maybe not the later ones.. |
11:07:21 | * | Q-Master joined #nim |
11:24:03 | PMunch | Got bored, now my part2 runs in 0.64ms |
11:24:11 | PMunch | Average of 500 runs |
11:24:46 | PMunch | Most of that is probably the file reading and data massaging though |
11:28:03 | Zoom[m] | For those who's been doing AOC since the start, did it change much? Is it more/less fun now? |
11:30:16 | tribly | still the same, i'd say |
11:34:49 | PMunch | Down to 0.52ms when I pre-converted my file to binary :P |
11:35:29 | tribly | p2: 348ฮผs |
11:36:51 | * | apahl quit (Ping timeout: 272 seconds) |
11:36:57 | narimiran | Zoom[m]: for me 2019 was the worst; i like this year so far |
11:37:22 | narimiran | Zoom[m]: but i might be in the minority, i heard lots of people praise intcode tasks from 2019 |
11:37:32 | * | apahl joined #nim |
11:38:53 | Zoom[m] | I just logged in and I'm on day 19 of 2015 ๐ฅด That's a lot of stuff to catch up |
11:39:14 | Zoom[m] | wdym intcode? |
11:40:06 | narimiran | Zoom[m]: in 2019 there were lots of interconnected tasks (you need to solve one before the other) where you build an "intcode" computer |
11:40:12 | Zoom[m] | Worst of all, I suspect my solutions won't compile cleanly today :) |
11:40:14 | narimiran | *build and then later on - use |
11:41:07 | narimiran | Zoom[m]: IMO leave previous years for the remaining 11 months; use december to solve current AoC |
11:42:27 | Zoom[m] | I know I won't be able to do it in time anyway, usually too much stuff happens IRL and at works in December. :( |
11:43:26 | Zoom[m] | Isn't there any interconnection between years? (besides the general setting) |
11:43:48 | narimiran | nope |
11:44:07 | narimiran | and most of the time, there isn't one between the tasks either (except for the story) |
11:44:25 | narimiran | 2019 invalidated ^ quite a bit |
11:45:32 | Zoom[m] | I remember there was some build-up in 2015 too, but I didn't like the interpreter direction much. |
12:01:04 | * | spiderstew quit (Quit: spiderstew) |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:33 | * | supakeen joined #nim |
12:50:33 | * | abm joined #nim |
12:59:48 | * | lritter joined #nim |
13:05:03 | FromDiscord | <shadow.> this challenge is interesting |
13:05:11 | FromDiscord | <shadow.> im still tryna figure it out lol |
13:05:28 | FromDiscord | <shadow.> at first i was gonna just cycle fill it on x but then i realized that it's a pattern so that would be stupid |
13:05:42 | PMunch | `mod` is your friend ;) |
13:05:52 | FromDiscord | <shadow.> yeye thats what i was thinking too |
13:06:24 | FromDiscord | <shadow.> for clarification, the entire 300 or so line pattern cycles on the x axis? |
13:07:05 | FromDiscord | <shadow.> (edit) "300 or so" => "300-or-so" | "300-or-soline ... pattern" added "long" |
13:07:36 | PMunch | Yes |
13:07:43 | FromDiscord | <shadow.> OHHH |
13:07:44 | PMunch | It just repeats over and over again |
13:07:46 | FromDiscord | <shadow.> ok that makes more sense |
13:07:52 | FromDiscord | <shadow.> i thought it was that 11 y block gave in the example |
13:07:57 | FromDiscord | <shadow.> and i was like "am i seeing things bc this is not tiling-" |
13:08:00 | FromDiscord | <shadow.> loll |
13:08:15 | FromDiscord | <shadow.> ok now i get it haha |
13:09:56 | * | hmmm joined #nim |
13:11:44 | FromDiscord | <shadow.> ooooh |
13:11:46 | FromDiscord | <shadow.> i did it without mod haha |
13:12:03 | FromDiscord | <shadow.> well i guess i did an incremental mod |
13:12:06 | PMunch | Just manually? |
13:12:25 | PMunch | Like `while pos > trees[i].len: pos -= trees[i].len` or something like that? |
13:12:37 | FromDiscord | <shadow.> `if pos.x >= width: pos.x = pos.x - width` |
13:12:42 | FromDiscord | <shadow.> i suppose i shoulda used a while lol |
13:12:50 | FromDiscord | <shadow.> and yeah -= |
13:14:17 | FromDiscord | <shadow.> somehow i got away with using an if statement |
13:14:21 | FromDiscord | <shadow.> im guessing because of the low deltaX |
13:14:57 | FromDiscord | <shadow.> also, is there a better way to dynamically read all lines of a txt than `readFile("input.txt").split("\p")` lol? |
13:15:07 | FromDiscord | <shadow.> because i saw the old 1-arg `readLines()` proc is deprecated |
13:15:31 | * | natrys joined #nim |
13:15:53 | narimiran | btw, this "manual mod" was useful for one of AoC tasks in previous years, if you wanted some performance because you were dividing by a large prime |
13:16:27 | FromDiscord | <shadow.> yeah that was my idea |
13:16:35 | FromDiscord | <shadow.> that you'd be wasting time doing mods on very large numbrs |
13:17:41 | FromDiscord | <shadow.> is there a way to accept unlimited arguments? |
13:18:25 | PMunch | Unlimited? |
13:18:35 | FromDiscord | <shadow.> like |
13:18:42 | PMunch | And for reading I've been using `toSeq(lines("input.txt"))` |
13:18:48 | FromDiscord | <shadow.> ohh smart |
13:18:59 | FromDiscord | <shadow.> here like for instance |
13:19:15 | PMunch | Or if I don't plan on pre-processing just `for line in lines("input.txt")` |
13:19:25 | Zevv | PMunch: where's your aoc code then |
13:19:36 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/sRc |
13:19:36 | FromDiscord | <shadow.> something like that? |
13:19:41 | PMunch | Does the lines iterator have a pairs counterpart by the way? |
13:19:59 | PMunch | Zevv, this is today: http://ix.io/2Gmc |
13:20:25 | FromDiscord | <shadow.> ix is still buggin |
13:20:35 | PMunch | Really? |
13:20:41 | FromDiscord | <shadow.> yeah |
13:20:42 | narimiran | looks fine to me |
13:20:45 | * | Q-Master quit (Ping timeout: 240 seconds) |
13:20:46 | FromDiscord | <shadow.> oh fr? |
13:20:54 | narimiran | fr |
13:20:55 | FromDiscord | <shadow.> welp |
13:20:58 | FromDiscord | <shadow.> ix doesnt like me maybe |
13:21:01 | FromDiscord | <shadow.> lol |
13:21:11 | PMunch | Nah I'm seeing errors as well |
13:21:14 | FromDiscord | <shadow.> rip |
13:21:21 | FromDiscord | <shadow.> so is there a way to accept arguments of any size? |
13:21:27 | * | kinkinkijduet joined #nim |
13:21:32 | FromDiscord | <shadow.> like so you could pass 2 or 5 strings to a function, and it would put them in a seq[string]? |
13:21:39 | narimiran | varargs? |
13:21:39 | FromDiscord | <shadow.> (edit) "size?" => "quantity?" |
13:21:43 | FromDiscord | <shadow.> yes |
13:21:45 | FromDiscord | <shadow.> thank you lol |
13:21:54 | FromDiscord | <shadow.> how did i forget abt varargs- |
13:22:39 | narimiran | PMunch: why `height+down` on line 9? |
13:22:51 | narimiran | ah, because you increase it first |
13:23:21 | narimiran | and if there was a tree on (0, 0), you would have off-by-one ;) |
13:23:43 | FromDiscord | <shadow.> wait it counts (0, 0)? |
13:23:53 | PMunch | According to the task "You start on the open square (.) in the top-left corner" ;) |
13:24:02 | PMunch | So there should never be a tree at 0, 0 |
13:24:02 | FromDiscord | <shadow.> yeah thats what i was thinking haha |
13:24:06 | narimiran | PMunch: ok, you win |
13:24:13 | FromDiscord | <shadow.> well this sure is odd, my solvePartOne() works but not my solvePartTwo |
13:24:18 | PMunch | Haha, don't think you can come here and trick me like that |
13:24:31 | narimiran | see you tomorrow!! |
13:24:50 | PMunch | This is my bits and masking solution, with optional pre-parsing into a binary format: http://ix.io/2Gmi |
13:25:09 | FromDiscord | <shadow.> smart |
13:25:45 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/nGa |
13:25:47 | FromDiscord | <shadow.> i think i know where i messed up |
13:25:47 | FromDiscord | <shadow.> LOL |
13:25:52 | FromDiscord | <shadow.> that seems a bit of a leap- |
13:26:03 | FromDiscord | <shadow.> but it said answer was too low i am very confused lmao |
13:26:10 | PMunch | Nah that looks fine |
13:26:22 | PMunch | But yeah, those numbers look a bit low |
13:26:27 | FromDiscord | <shadow.> hmm |
13:26:46 | FromDiscord | <shadow.> whats odd is im not getting the same answer for part one i did using my part two func |
13:27:47 | PMunch | Then you probably messed it up :P |
13:27:56 | FromDiscord | <shadow.> rip |
13:28:30 | FromDiscord | <shadow.> ah i see |
13:29:03 | FromDiscord | <shadow.> tuple backwards |
13:29:16 | FromDiscord | <shadow.> there we go gottem |
13:29:56 | PMunch | tuple? |
13:30:07 | PMunch | I'm starting to think our solutions are very different :P |
13:31:25 | FromDiscord | <shadow.> aha yeah |
13:31:26 | FromDiscord | <shadow.> https://hatebin.com/idhwiplzsk |
13:31:27 | FromDiscord | <shadow.> here's mine |
13:32:23 | FromDiscord | <shadow.> oh i should just use prod |
13:32:41 | FromDiscord | <shadow.> eh nvm lol |
13:33:43 | FromDiscord | <Esbeesy> Here's my day 3 solution, finally find an excuse to write an iterator โตhttps://github.com/sambeckingham/advent-of-code-2020/blob/main/day3/day3.nim |
13:34:14 | FromDiscord | <shadow.> hmm |
13:34:20 | PMunch | Quite different indeed |
13:34:21 | FromDiscord | <Esbeesy> Ah I love that var args, didn't know Nim could do that |
13:34:30 | FromDiscord | <shadow.> thanks haha |
13:34:34 | FromDiscord | <shadow.> how so pmunch |
13:34:35 | PMunch | Why do you use four spaces for indentation by the way? |
13:34:42 | PMunch | @shadow. didn't you see mine? |
13:34:47 | FromDiscord | <shadow.> no idea its by habit haha |
13:34:47 | FromDiscord | <Esbeesy> Code just keeps defaulting to that |
13:34:54 | FromDiscord | <shadow.> oh i thought your bit masking and shifting one was not your normal one? |
13:34:55 | FromDiscord | <shadow.> was it? |
13:35:06 | FromDiscord | <Esbeesy> Is there a format/lint tool for nim somewhere? |
13:35:09 | FromDiscord | <shadow.> also i use 4 spaces because that's what i have tab bound to and i think it's default |
13:35:11 | PMunch | Nah I had another one that was more "traditional" |
13:35:18 | FromDiscord | <shadow.> ohh i didn't see that one |
13:35:23 | FromDiscord | <shadow.> send it over |
13:35:23 | PMunch | @Esbeesy, yes |
13:35:46 | FromDiscord | <Esbeesy> It's not something obvious like `nim fmt` is it |
13:35:50 | FromDiscord | <shadow.> lol |
13:36:05 | PMunch | This one: http://ix.io/2Gmu |
13:36:37 | PMunch | Well... https://github.com/FedericoCeratto/nimfmt |
13:36:44 | PMunch | It's all one word :P |
13:37:27 | * | rockcavera quit (Remote host closed the connection) |
13:37:52 | FromDiscord | <shadow.> @Esbeesy RIP- |
13:37:59 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/iq9 |
13:38:05 | FromDiscord | <shadow.> there, now my code is properly fp-obfuscated |
13:39:01 | FromDiscord | <shadow.> ah pmunch i quite like your solution haha |
13:40:25 | PMunch | Pretty simple and straight-forward :P |
13:40:31 | FromDiscord | <shadow.> haha yeah |
13:40:54 | FromDiscord | <shadow.> i just wanted an excuse to try `in` with hslice's |
13:40:58 | FromDiscord | <Quibono> How do you download nimfmt? |
13:42:47 | hmmm | I think it's called nimpretty |
13:43:02 | PMunch | nimble install nimfmt |
13:43:08 | hmmm | oh it exist! |
13:43:08 | PMunch | Yeah nimpretty is another one |
13:43:49 | hmmm | I'll try nimfmt too, nimpretty doesn't do much for all my messy whitespaces |
13:44:18 | FromDiscord | <Quibono> nimble install nimfmt isn't working for me on 1.4.2, I'mma try nimpretty |
13:44:18 | PMunch | Hmm, I wonder why I can't get my x11 window reparenting to work.. |
13:44:28 | FromDiscord | <Esbeesy> Okay so weird, nimfmt doesn't come with `scoop install nim`, I found nimpretty, tried that and it's changed the file according to git but.. not actually changed anything |
13:44:41 | PMunch | Maybe it's because the i3 window framing messes it up.. |
13:44:44 | FromDiscord | <Esbeesy> Also yeah I cant nimble install nimfmt at all |
13:44:59 | Zevv | PMunch: put that shit in git man |
13:44:59 | PMunch | Why not? |
13:45:10 | hmmm | ye nimpretty it's pretty cool it sees your file and says "good enough mate" |
13:45:15 | Zevv | ppl want to peek at and steal |
13:45:22 | PMunch | nimfmt isn't in the official Nim distribution it's a separate package |
13:45:30 | FromDiscord | <Quibono> Apparently Treeform made morepretty lol |
13:45:42 | PMunch | Zevv, "please put your stuff up, people want to steal it" not the strongest argument :P |
13:45:48 | Zevv | sure is |
13:46:44 | FromDiscord | <Quibono> @Esbeesy Nimpretty works. |
13:46:52 | FromDiscord | <Quibono> Or morepretty I mean |
13:47:28 | FromDiscord | <Esbeesy> is morepretty a separate package? |
13:47:28 | Zevv | only reason I put it up is I like to tell people the stole from me |
13:47:31 | Zevv | hear me, narimiran?! |
13:47:35 | FromDiscord | <Quibono> https://github.com/treeform/morepretty |
13:47:49 | FromDiscord | <Quibono> Seems pretty good. |
13:47:52 | FromDiscord | <Quibono> lol |
13:48:00 | hmmm | "remove blank lines" yes morepretty is what I need |
13:48:45 | FromDiscord | <Quibono> My problem is I like blank lines for formatting, but I guess I'll get over it |
13:49:37 | tribly | hm, aoc day3 part 2 down to 95ฮผs |
13:50:19 | FromDiscord | <Esbeesy> Yeah morepretty is good. Still at 4 space indent though, so I'm guessing that's ok for Nim? |
13:50:33 | FromDiscord | <shadow.> rip im in 59th |
13:50:40 | FromDiscord | <shadow.> in my timezone i cant do it until like 8 hours after its posted |
13:50:46 | PMunch | There, happy now Zevv. https://github.com/PMunch/aoc2020 |
13:50:57 | FromDiscord | <Quibono> Esbeesy it didn't mess with my two space indents |
13:51:11 | FromDiscord | <Quibono> I suspect it just keeps whatever you've already got |
13:51:15 | FromDiscord | <Esbeesy> Yeah I think it just keeps it consistent |
13:52:34 | FromDiscord | <wad35dam> Hello sir, i have a question, what the best nim's gui library? |
13:52:46 | PMunch | tribly, what kind of solution are you doing? |
13:53:04 | PMunch | At that speed I half expect a purely compile-time solution :P |
13:53:10 | narimiran | Zevv: who's stealing from you and your cryptic stuff? |
13:53:19 | Zevv | xor dude |
13:53:20 | Zevv | xor |
13:53:32 | PMunch | @wad35dam, depends on what you mean by best |
13:53:33 | Zevv | no one under 30 knows what xor is |
13:53:35 | narimiran | you invented xor?! wow!!! |
13:53:40 | FromDiscord | <shadow.> im under 30 |
13:53:43 | PMunch | Ey, I know what xor is |
13:53:44 | * | Q-Master joined #nim |
13:53:50 | Zevv | liars |
13:53:51 | narimiran | PMunch: you're under 30? |
13:53:54 | FromDiscord | <shadow.> xor is an exclusive or operator / logic gate that only returns positive if one input is positive? |
13:54:01 | FromDiscord | <shadow.> im certainly under 30... lol |
13:54:01 | narimiran | IFF |
13:54:30 | Zevv | and my stuff is not cryptic. it's concise |
13:54:39 | FromDiscord | <lqdev> and cryptic |
13:54:44 | narimiran | ^ |
13:54:51 | narimiran | (and that was not xor) |
13:54:55 | Zevv | hehe |
13:54:59 | FromDiscord | <shadow.> hm? |
13:55:06 | FromDiscord | <Esbeesy> I typed xor in my day2 solution in the chance that it worked and it actually did ๐ Was elated |
13:55:07 | narimiran | no, he goes by hmmm |
13:55:18 | FromDiscord | <shadow.> wait in the scope of booleans isnt xor just != lol |
13:55:23 | FromDiscord | <Esbeesy> Yeah |
13:55:32 | narimiran | to be honest, `!=` feels a bit more appropriate than `xor` |
13:55:43 | FromDiscord | <shadow.> eh for me xor feels better |
13:55:48 | FromDiscord | <shadow.> i feel like it's more readable |
13:56:20 | Zevv | all my solutions run in 0s. I just do it all compile time |
13:56:25 | FromDiscord | <shadow.> big brain asf |
13:56:47 | tribly | and down to 58ยตs |
13:56:55 | tribly | PMunch: mathetmatical one |
13:57:01 | narimiran | tribly: ooooh, nice |
13:57:38 | narimiran | PMunch: you separately do each part? that's cheating! |
13:58:16 | * | Q-Master quit (Ping timeout: 240 seconds) |
13:58:46 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GmU |
13:58:49 | * | Q-Master joined #nim |
13:59:03 | PMunch | narimiran, what do you mean cheating? I get them individually, I solve them individually |
13:59:13 | narimiran | booooriiing |
13:59:33 | PMunch | I mean my part2 solutions can all be used to solve the part1 puzzle as well :P |
14:00:10 | narimiran | but then you can't measure how fast your solution is for both parts :P |
14:00:13 | PMunch | Still not sure what a mathematical solution to this would look like tribly |
14:00:33 | FromDiscord | <Esbeesy> Same, I'm interested to see it too |
14:00:36 | PMunch | Of course I can, I can just insert an extra call in my part2 solutions |
14:00:57 | FromDiscord | <shadow.> is there a `mod=` op? |
14:01:13 | narimiran | how would you use that? |
14:01:24 | FromDiscord | <shadow.> var x = 10; x mod= 3; x == 1 |
14:01:49 | narimiran | so something like `x %= 3` would do that? |
14:01:52 | FromDiscord | <shadow.> yeah |
14:02:06 | FromDiscord | <shadow.> i suppose i could just make a template |
14:02:13 | narimiran | if we don't even have `%` for `mod`..... ;) |
14:02:20 | FromDiscord | <shadow.> fair enough |
14:02:23 | FromDiscord | <shadow.> time to make a template |
14:03:58 | FromDiscord | <lqdev> what's so bad about just doing x = x mod 3 |
14:04:10 | FromDiscord | <shadow.> verbose idk its reallly not an issue haha |
14:04:15 | * | lpy joined #nim |
14:04:17 | FromDiscord | <lqdev> also if your numbers are negative you're probably looking for math.floorMod |
14:04:17 | FromDiscord | <shadow.> i was just wondering |
14:04:22 | FromDiscord | <shadow.> not negative |
14:04:25 | FromDiscord | <shadow.> they're naturals |
14:04:29 | FromDiscord | <lqdev> kay |
14:06:51 | * | sagax quit (Read error: Connection reset by peer) |
14:07:41 | FromDiscord | <shadow.> can you map an iterator? |
14:08:37 | narimiran | nah |
14:08:37 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GmX |
14:08:40 | FromDiscord | <shadow.> this is giving me an error |
14:08:42 | FromDiscord | <shadow.> ah ok |
14:08:46 | FromDiscord | <shadow.> i suppose i can use collect |
14:09:51 | PMunch | @lqdev, it's annoying if you have long variable names to do `x = x mod y` |
14:10:16 | PMunch | I also want `shl=` and `and=` |
14:10:19 | FromDiscord | <lqdev> guess i should extend my scripting lang to support `x mod= y` then |
14:11:26 | * | natrys quit (Quit: natrys) |
14:11:30 | FromDiscord | <shadow.> ye probably |
14:11:34 | narimiran | `modeq` |
14:11:38 | narimiran | `shleq` |
14:11:47 | * | natrys joined #nim |
14:11:55 | FromDiscord | <Idefau> now i feel bad for letting the number just be big and then `mod`ing it when accessing the array |
14:12:22 | FromDiscord | <shadow.> lmao |
14:12:49 | FromDiscord | <shadow.> im sure in this problem it doesnt matter |
14:12:53 | FromDiscord | <Idefau> yea |
14:13:04 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/VXy |
14:13:32 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Gn0 |
14:13:54 | FromDiscord | <Idefau> i got that too some times |
14:14:03 | FromDiscord | <shadow.> yeah im unsure of the cause |
14:15:52 | PMunch | It means that you are trying to call the `lines` iterator like a procedure |
14:16:12 | FromDiscord | <shadow.> ah i see |
14:16:22 | PMunch | That's why I'm using `toSeq` |
14:16:58 | FromDiscord | <shadow.> so is there any good way to map a function to an iterator? |
14:17:05 | FromDiscord | <shadow.> `lines("dictionary.txt").map(parseInt)` |
14:17:45 | PMunch | `toSeq(lines("dictionary.txt")).map(parseInt)` |
14:17:45 | FromDiscord | <shadow.> im guessing turning it into a seq is slower |
14:18:45 | FromDiscord | <shadow.> hmm fair enough |
14:18:48 | FromDiscord | <shadow.> `collect(newSeq, for line in lines("input.txt"): parseInt(line))` |
14:18:51 | FromDiscord | <shadow.> do you think that's any faster? |
14:18:58 | FromDiscord | <shadow.> albeit a bit more verbose |
14:19:11 | PMunch | There is also this: https://nimble.directory/pkg/iterutils |
14:19:28 | FromDiscord | <shadow.> yeah i saw that but it didn't seem to like me using lines() |
14:19:29 | FromDiscord | <shadow.> same error |
14:20:02 | PMunch | Did you by any change try to call it like `lines("input.txt").map(<whatever>)`? |
14:20:13 | FromDiscord | <shadow.> `toIter(lines("input.txt")).map(parseInt)` |
14:20:21 | FromDiscord | <shadow.> is that incorrect? |
14:20:26 | narimiran | toSEQ |
14:20:37 | PMunch | narimiran, he is using iterutils |
14:20:41 | FromDiscord | <shadow.> ye |
14:20:47 | PMunch | Instead of `map(lines("input.txt", <whatever>)` |
14:21:00 | FromDiscord | <shadow.> ahh |
14:21:05 | FromDiscord | <shadow.> you have to use it like that? |
14:22:06 | PMunch | Hmm, same error |
14:22:30 | FromDiscord | <shadow.> yeah |
14:22:54 | FromDiscord | <shadow.> odd |
14:23:16 | PMunch | Indeed |
14:23:45 | FromDiscord | <shadow.> i suppose using collect or toSeq wont kill me |
14:23:59 | FromDiscord | <shadow.> but toSeq() is def slower than an iter map |
14:24:01 | FromDiscord | <shadow.> i suppose ill use collect |
14:24:02 | narimiran | RIP shadow. |
14:25:41 | FromDiscord | <shadow.> rip me |
14:25:48 | FromDiscord | <shadow.> my FP looking ass can't map an iterator |
14:25:49 | FromDiscord | <shadow.> how sad |
14:26:00 | FromDiscord | <Idefau> sad! |
14:26:12 | FromDiscord | <shadow.> smh the VERBOSITY! |
14:26:14 | FromDiscord | <shadow.> `collect(newSeq, for line in lines("input.txt"): parseInt(line))` |
14:26:22 | FromDiscord | <Idefau> at this point why not just |
14:26:30 | FromDiscord | <Idefau> for line in lines: dothing |
14:28:57 | FromDiscord | <shadow.> eh |
14:29:02 | FromDiscord | <shadow.> ehh |
14:29:10 | FromDiscord | <shadow.> that would require more than one line |
14:29:15 | FromDiscord | <shadow.> and i like writing bad code |
14:29:49 | narimiran | `toSeq(lines("dictionary.txt")).map(parseInt)` is nicer than this |
14:31:51 | * | natrys quit (Quit: natrys) |
14:32:02 | FromDiscord | <shadow.> i agree |
14:32:14 | FromDiscord | <shadow.> but doesn't that require two iterations? |
14:32:37 | narimiran | argh, it might |
14:32:51 | FromDiscord | <shadow.> eh whatever its fine |
14:32:53 | FromDiscord | <shadow.> the txt is only 200 lines anyways lma o |
14:32:54 | FromDiscord | <shadow.> (edit) "lma o" => "lmao" |
14:33:30 | narimiran | premature optimization? we would never!! |
14:34:50 | FromDiscord | <Quibono> lol |
14:35:04 | Zevv | Premature Optimization. Causes and Symptons. Talk to your doctor. |
14:35:37 | FromDiscord | <Quibono> It's only premature if your coding partners want to wait. |
14:36:43 | FromDiscord | <shadow.> lol |
14:37:23 | Zevv | for AOC it's always premature |
14:37:59 | Zevv | they never have a single puzzle that relies on processing power. |
14:38:25 | Zevv | you can complete all of aoc on whatever old hardware you want. If you find you're waiting longer then a few seconds, you're not looking at the right solution. |
14:38:50 | narimiran | Zevv: oooh, you just wait here till i find a link |
14:39:20 | narimiran | i think it was this one: https://adventofcode.com/2016/day/11 |
14:40:04 | FromDiscord | <shadow.> oh thanks zevv, in that case i suppose i shouldn't have immediately jumped two a one-pass hash set for part one lmao |
14:40:10 | FromDiscord | <shadow.> nested loops woulda been way easier |
14:40:29 | FromDiscord | <shadow.> (edit) "two" => "to" | "part" => "day" |
14:40:35 | FromDiscord | <shadow.> (edit) "oh thanks zevv, in that case i suppose i shouldn't have immediately jumped to a one-pass hash set ... for" added "solition" |
14:40:38 | FromDiscord | <shadow.> (edit) "solition" => "solution" |
14:41:47 | narimiran | there were some tasks where without optimizations you would still by this day wait for your part2 solution |
14:42:09 | FromDiscord | <shadow.> lol |
14:42:36 | Zevv | that's the whole point. |
14:42:45 | Zevv | Just recursively hammering the total problem space will not get you there |
14:44:57 | Zevv | I'm hoping to pull in cmae-es and z3 this year |
14:47:27 | Zevv | My nim cache is sometimes frigged up if I have a file with the same name in different folders |
14:47:32 | Zevv | is that a known issue? |
14:47:48 | narimiran | i haven't experienced it myself |
14:47:54 | Zevv | So I have two projects both with 'main.nim' in two different dirs |
14:48:00 | Zevv | nim throws in the wrong cached version |
14:48:30 | * | vicfred joined #nim |
14:56:43 | PMunch | Uhm, that's weird |
14:57:23 | * | hmmm quit () |
14:57:49 | * | waleee-cl joined #nim |
14:58:33 | * | tane joined #nim |
14:59:32 | * | natrys joined #nim |
15:16:06 | FromDiscord | <kenran> I have some `array[100, uint8]`. How can I get a string from that? That is, what part of the documentation should I be looking at? |
15:17:20 | PMunch | @kenran, `$` |
15:19:09 | narimiran | `a.mapIt(chr(it.int))` |
15:20:22 | PMunch | How would that help him? |
15:20:39 | PMunch | cast[array[100, char]] is way faster |
15:20:49 | * | natrys quit (Ping timeout: 246 seconds) |
15:20:56 | narimiran | true |
15:21:16 | PMunch | I mean it depends on what kind of string he wants |
15:24:38 | PMunch | here are some options for you: https://hastebin.com/mifareyeva.nim |
15:24:38 | * | natrys joined #nim |
15:24:57 | Zevv | if youre 0-terminated you should be able to cast to cstring |
15:25:10 | Zevv | but as soon as you use that as a nim string, nim wil $ify that |
15:25:15 | Zevv | effectively copying the payload |
15:25:58 | * | PMunch quit (Quit: leaving) |
15:26:28 | tribly | ok, down to 7ยตs :D |
15:26:36 | narimiran | tribly: show us! |
15:28:41 | tribly | https://play.nim-lang.org/#ix=2Gno |
15:28:51 | tribly | not very nimy, since i'm still new to the language |
15:30:08 | * | jxy quit (Quit: leaving) |
15:30:22 | * | jxy joined #nim |
15:30:25 | narimiran | i don't see what would make it *that* fast |
15:30:42 | narimiran | are you sure you're using microseconds correctly? :D :D |
15:31:13 | FromDiscord | <Idefau> i think aoc is making ix really slow |
15:31:14 | FromDiscord | <Idefau> since i cant load it |
15:31:50 | FromDiscord | <shadow.> yeah im guessing thats why ix is being used so much |
15:31:50 | narimiran | tribly: does your code maybe run in 7 ms? :) |
15:32:34 | FromDiscord | <shadow.> im going to assume that's the case haha |
15:32:46 | FromDiscord | <shadow.> microseconds are a very very small amount of time |
15:33:16 | FromDiscord | <Idefau> thats very similar to how i did it |
15:33:32 | FromDiscord | <Idefau> kinda |
15:35:18 | tribly | compile and see :P |
15:35:34 | narimiran | i can tell without compiling ;) |
15:35:38 | FromDiscord | <Idefau> lel |
15:36:09 | FromDiscord | <shadow.> lol |
15:36:16 | tribly | narimiran: compile it |
15:36:20 | narimiran | ok |
15:36:34 | FromDiscord | <shadow.> lol |
15:36:36 | FromDiscord | <shadow.> we'll see i suppose |
15:36:48 | FromDiscord | <shadow.> 7u just sounds quite speedy for code that isn't crazily optimized |
15:38:24 | narimiran | your benchmark is optimized out |
15:38:51 | narimiran | with `perf` i get similar results as for my code: around 0.5ms |
15:42:03 | narimiran | your benchmarking tool gives 24 ns for my solution |
15:42:30 | FromDiscord | <Idefau> whats perf btw |
15:42:32 | narimiran | (when i use {.discardable.} just like you did) |
15:43:21 | narimiran | https://perf.wiki.kernel.org/index.php/Main_Page |
15:43:38 | FromDiscord | <Idefau> thanks |
15:44:56 | FromDiscord | <kenran> thanks! |
15:45:48 | narimiran | tribly: is my code really ~300x faster than yours? :P |
15:46:43 | FromDiscord | <Idefau> i ran perf on day 3 and it says 1,31 msec |
15:46:47 | FromDiscord | <Idefau> fuck |
15:47:22 | FromDiscord | <shadow.> f |
15:47:30 | FromDiscord | <shadow.> time to see if `xperf` exists |
15:47:34 | FromDiscord | <shadow.> windows kiddy things i suppose |
15:47:36 | narimiran | run it multiple times: `perf stat -r 50 --table -o $out_file ./day03 > /dev/null` |
15:47:56 | ForumUpdaterBot | New thread by Geohuz: Need help for db_postgres usage, see https://forum.nim-lang.org/t/7195 |
15:48:22 | narimiran | and then you'll get results of 50 runs in $out_file |
15:48:32 | * | natrys quit (Quit: natrys) |
15:48:52 | * | natrys joined #nim |
15:49:12 | FromDiscord | <Idefau> 0,8 |
15:49:23 | FromDiscord | <Idefau> welp |
15:50:18 | FromDiscord | <kenran> sent a code paste, see https://play.nim-lang.org/#ix=2Gnv |
15:50:46 | FromDiscord | <Idefau> im reading it at compile time |
15:51:10 | FromDiscord | <kenran> sent a code paste, see https://play.nim-lang.org/#ix=2Gnw |
15:52:23 | FromDiscord | <kenran> I'm actually reading from the master FD of a PTY, and I expect to receive a "shell prompt" from reading the buffer. The error seems to happen whenever I try to read more than there actually is. But in that case I'd have expected `actualLen` to be a lower number, and not an exception. |
15:52:33 | FromDiscord | <kenran> Did I misunderstand anything with `readBuffer`? |
15:53:00 | FromDiscord | <kenran> (edit) sent a code paste, see https://paste.rs/CNZ |
15:53:22 | FromDiscord | <shadow.> oh i think i remember having this exact issue lmfao |
15:53:24 | FromDiscord | <shadow.> lemme see how i fixed it |
15:54:01 | FromDiscord | <shadow.> @kenran any reason you cant use a higher-level function? |
15:54:07 | FromDiscord | <shadow.> addr is typically bad practice |
15:55:28 | FromDiscord | <shadow.> in addition, prolly makes more sense to use a `let` for `actualLen` but ill leave that up to you |
15:57:09 | * | hnOsmium0001 joined #nim |
15:58:40 | FromDiscord | <enthus1ast> or use @flywind 's nice timit module: https://github.com/xflywind/timeit |
15:59:21 | FromDiscord | <enthus1ast> this generates output like this:โต`[1ms 10ฮผs 246.60ns] ยฑ [33ฮผs 723.53ns] per loop (mean ยฑ std. dev. of 7 runs, 1000 loops each)` |
15:59:43 | * | rockcavera joined #nim |
15:59:57 | FromDiscord | <enthus1ast> (which is my day3) |
16:00:27 | narimiran | i think he's using that module |
16:00:45 | FromGitter | <HJarausch_gitlab> valgrind output - is that to be expected? โ I get LOTS of โ Use of uninitialised value of size 8 โ and โ Conditional jump or move depends on uninitialised value(s) ... [https://gitter.im/nim-lang/Nim?at=5fc90bad657e0c48225be3bb] |
16:01:17 | FromDiscord | <kenran> I don't know any. These are my "first step" (I took a long break) with Nim. Can you point me to one? (The `var` is just there from me duplicating the same code below to see where the problem happened). |
16:01:23 | FromDiscord | <shadow.> i am quite confused timeit says `51ms` for one of my benchmarking programs but powershell Measure-Command says `18ms` lmao |
16:01:25 | FromDiscord | <kenran> (edit) "step"" => "steps"" |
16:01:35 | FromDiscord | <shadow.> @kenran take a look at the `streams` module perhaps |
16:01:38 | FromDiscord | <kenran> Can you point me to a higher-level module/function I could try? |
16:01:44 | FromDiscord | <kenran> Ah thanks |
16:01:49 | FromDiscord | <shadow.> i mean |
16:01:52 | FromDiscord | <shadow.> you're just reading uint8's right? |
16:01:54 | tribly | narimiran: well, then tell xflywind his 'timeit' is wrong :P |
16:02:24 | FromDiscord | <kenran> But doesn't this smell buggy in some way? I could read one `uint8` after another, but even then I wouldn't know when I'd have read the one that was "too much". |
16:02:30 | FromDiscord | <shadow.> ohh wait |
16:02:36 | FromDiscord | <shadow.> lemme take a look at my file transfer client lol |
16:02:40 | FromDiscord | <shadow.> i remember reading bytes in that |
16:03:19 | FromDiscord | <enthus1ast> can you peek on the stream @keran ? |
16:03:19 | FromDiscord | <shadow.> maybe `readBytes()` ? |
16:03:28 | FromDiscord | <enthus1ast> (edit) "@keran" => "@kenran " |
16:04:52 | FromDiscord | <shadow.> tho im guessing that's similar to readBuffer |
16:05:01 | FromDiscord | <flywind> or use https://github.com/disruptek/criterion |
16:05:05 | FromDiscord | <kenran> I tried `readBytes` before |
16:05:28 | FromDiscord | <flywind> (edit) "or use https://github.com/disruptek/criterion ... " added " It is very convenient." |
16:05:49 | FromDiscord | <kenran> I'm now taking a look at the streams. I could probably create a `FileStream` from my `File` then see what I can do with that. |
16:05:58 | narimiran | but beware of stuff getting optimized out |
16:06:11 | FromDiscord | <shadow.> lemme look over streams again |
16:06:41 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Gny |
16:06:42 | FromDiscord | <shadow.> thats what i used apparently |
16:06:47 | FromDiscord | <shadow.> back on 11/13 when i first asked lol |
16:07:12 | * | kinkinkijduet quit (Read error: Connection reset by peer) |
16:07:26 | tribly | narimiran: what does you code look like? |
16:07:42 | narimiran | tribly: like this: https://github.com/narimiran/AdventOfCode2020/blob/master/nim/day03.nim |
16:09:43 | FromDiscord | <shadow.> may i ask why you use func? |
16:10:32 | narimiran | so the compiler can yell at me if i use some global variable |
16:10:36 | FromDiscord | <shadow.> ohhhh |
16:10:48 | FromDiscord | <shadow.> func's doesn't allow global or io operations right? |
16:10:54 | FromDiscord | <shadow.> (edit) "func's doesn't" => "funcs dont" |
16:13:01 | FromDiscord | <kenran> I tried using `while (strm.readLine(line):`, but get the same error. I gotta leave now, but I'll check back later. I wanna get this to work... |
16:13:15 | FromDiscord | <kenran> will try that next, ty |
16:13:38 | FromDiscord | <shadow.> ofc |
16:22:59 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2GnB |
16:25:51 | tribly | narimiran: shouldn't just reading the file via 'readFile' and just going over it be a bit faster than doing a 'toSeq'? |
16:26:16 | narimiran | tribly: readfile and then splitlines? |
16:26:33 | narimiran | i think i tried to measure both and didn't see a measurable difference |
16:26:40 | tribly | narimiran: no, just readFile |
16:27:01 | narimiran | but then i would need to know how long is each line, no? |
16:27:11 | narimiran | (that's cheating :)) |
16:27:40 | tribly | hm, true |
16:29:01 | tribly | but since everyone has the same line-length, maybe it's not! |
16:29:06 | FromDiscord | <lqdev> @ajusa because you're effectively discarding the Heartbeat's fields by converting it to a smaller type Data, and then trying to widen that small Data into a bigger Client |
16:29:21 | FromDiscord | <lqdev> try using `ref object of <whatever>` on all your objects |
16:29:31 | narimiran | tribly: the example has shorter lines ;) |
16:29:42 | FromDiscord | <lqdev> this will make them into pointers so these conversions will be mostly legal |
16:29:51 | FromDiscord | <lqdev> except the last conversion from Data to Client |
16:29:51 | tribly | narimiran: and is the same for everyone :P |
16:30:00 | FromDiscord | <lqdev> because Heartbeat is a different object type |
16:30:25 | FromDiscord | <ajusa> So I can't convert from the parent object type to a different child object like this then? |
16:30:25 | narimiran | tribly: but the same code won't work both for the example and real input |
16:30:55 | tribly | narimiran: is this cheating then aswell? https://en.wikipedia.org/wiki/Fast_inverse_square_root |
16:30:58 | narimiran | the example - one inside the text of the task |
16:31:05 | FromDiscord | <lqdev> @ajusa nope. how would you expect this to work anyways? |
16:31:42 | FromDiscord | <ajusa> What I would like to do is assign all of the fields that both Data and Heartbeat share into an new Client. |
16:31:58 | narimiran | tribly: for these initial tasks i prefer as least amount of "cheating" as possible |
16:32:16 | narimiran | later on: bring all the hackr |
16:32:20 | narimiran | *hacks |
16:33:02 | FromDiscord | <lqdev> @ajusa that's not possible |
16:33:18 | FromDiscord | <lqdev> initially you're allocating an object with the size of `Heartbeat` |
16:33:33 | FromDiscord | <lqdev> but `Client` and `Heartbeat` have different sizes and memory layouts |
16:33:43 | FromDiscord | <lqdev> so that sort of conversion simply isn't possible |
16:35:20 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2GnD |
16:35:36 | FromDiscord | <lqdev> yes |
16:35:43 | FromDiscord | <lqdev> otherwise it will raise |
16:35:46 | FromDiscord | <ajusa> Oh god I'm dumb the next line literally says that |
16:35:47 | FromDiscord | <kenran> damn, same problem. I have to figure out what is actually being read. I can for instance read, say, 50 bytes into a 100-byte buffer. It returns 50, but I can see that there are only zeroes after a certain point anyway (like, position 15 or so). |
16:35:50 | FromDiscord | <kenran> I don't get it... |
16:36:00 | FromDiscord | <ajusa> (edit) "that" => "that,โต"The InvalidObjectConversionDefect exception is raised if x is not a Student"" |
16:36:22 | FromDiscord | <shadow.> yeah i remember getting weird behaviour from this |
16:36:25 | FromDiscord | <shadow.> i just dont remember how i fixed it |
16:36:30 | FromDiscord | <shadow.> @kenran whats the exact problem again |
16:38:15 | FromDiscord | <kenran> I'm beginning to get a better grasp now. If I try to read "too much" in some way from the PTY (given to me as an FD, and I use `open` to get a `File`), then I get an error "resource temporarily unavailable". But I just found something that says that this is an `EAGAIN` error (whatever that means). In some way, I cannot read as much from the FD. |
16:39:15 | FromDiscord | <ajusa> sent a code paste, see https://paste.rs/z3P |
16:39:37 | FromDiscord | <lqdev> you can actually convert a Heartbeat to a Client because Client is its parent type |
16:40:06 | FromDiscord | <lqdev> this will produce a Client that is in reality a Heartbeat |
16:40:09 | FromDiscord | <lqdev> however |
16:40:21 | FromDiscord | <lqdev> ah wait |
16:40:26 | FromDiscord | <ajusa> Data is the parent type |
16:40:29 | FromDiscord | <lqdev> i meant Data yes |
16:40:29 | FromDiscord | <lqdev> my bad |
16:40:49 | FromDiscord | <lqdev> so yeah that's your only solution for that |
16:41:09 | FromDiscord | <shadow.> @kenran are you stopping once the number is less than the amount of bytes ur tryna read? |
16:42:53 | FromDiscord | <kenran> I only have one call to `readXXX` now, which tries to read 50 bytes on first try. This works. If I increase this number to for instance 250, it fails on first try. So I'm actually not getting any length back, it crashes immediately. |
16:43:01 | * | sagax joined #nim |
16:43:26 | FromDiscord | <kenran> I now found out that this has to do with the access being nonblocking. Not sure how exactly, but it's a start. |
16:44:13 | * | narimiran quit (Ping timeout: 256 seconds) |
16:45:42 | FromDiscord | <shadow.> fair enough haha |
16:46:21 | * | narimiran joined #nim |
16:48:34 | FromDiscord | <kenran> I think I have to find out how to find out when I'm allowed to read anything. This is supposed to become a terminal emulator, and I still haven't quite understood how that whole thing works at all. That is, there are three "threads": one that reads from the stream/pipe/fd/pty/whatever, one that displays the terminal using what has been read, and one that writes user input to the fd. |
16:49:10 | FromDiscord | <kenran> That is, one has to continuously read while another one has to write to the same FD. No idea yet how that's supposed to go well ๐ |
16:57:29 | FromDiscord | <shadow.> ohh you're on threads? |
16:57:35 | FromDiscord | <shadow.> still odd how inconsistent it is |
16:59:49 | FromGitter | <sealmove> how to add a child to NimNode in specific index? |
17:00:00 | FromGitter | <sealmove> basically I want to add it before the last child |
17:01:24 | FromGitter | <sealmove> for example I have `children = @[a, b, c]` and after adding `d` I want to have `children = @[a, b, d, c]` |
17:01:34 | FromDiscord | <lytedev> is there some reason this wouldn't work? https://nim-lang.org/docs/macros.html#insert%2CNimNode%2Cint%2CNimNode |
17:02:05 | Zoom[m] | How are you guys benchmarking your stuff? |
17:02:19 | * | Q-Master quit (Ping timeout: 246 seconds) |
17:03:00 | Zoom[m] | Any lib to streamline the process? |
17:03:17 | FromDiscord | <Vindaar> @lytedev Well, it might not work if the length of the node `n` is smaller than `pos` but should work otherwise |
17:03:36 | FromGitter | <sealmove> oh thank lytedev, this looks file, just missed the proc |
17:03:41 | FromDiscord | <kenran> no no, it will be at some point, or rather it has to |
17:03:55 | FromDiscord | <shadow.> oh ok |
17:04:05 | FromDiscord | <shadow.> zoom you can use perf |
17:04:07 | FromDiscord | <shadow.> or timeit |
17:04:42 | * | letto quit (Quit: Konversation terminated!) |
17:04:54 | FromDiscord | <kenran> Right now I'm trying to get a scenario to work where I write something to the FD, then read the resulting stuff, that is, the shell prompt with the stuff I've written to it and the result thereof (if I've written something like "ls -l") |
17:05:30 | Zoom[m] | It would be great to have some benchmarking facilities included in a testing library. |
17:06:28 | * | letto joined #nim |
17:06:30 | FromDiscord | <kenran> My main problem is that I've never done low-level stuff before and that I can't read C very well. I tried reading the `st` source code, but lots of it is X stuff, plus it's even lower-level than I'd like my Nim code to be. |
17:07:50 | FromDiscord | <shadow.> zoom maybe try criterion? |
17:07:53 | FromDiscord | <shadow.> or timeit yeah |
17:08:01 | FromDiscord | <shadow.> depends on how much you need |
17:09:34 | Zoom[m] | Thanks @shadow. |
17:09:48 | FromDiscord | <shadow.> np |
17:11:04 | FromDiscord | <nim> hi |
17:11:09 | FromDiscord | <nim> i joined just bc my name is nim |
17:11:53 | * | ehmry quit (Ping timeout: 272 seconds) |
17:12:44 | FromDiscord | <Idefau> lmfao |
17:12:59 | Clonkk[m] | Isn't that copyright infringement ? |
17:13:11 | Clonkk[m] | ๐ |
17:13:15 | FromDiscord | <nim> what |
17:13:31 | FromDiscord | <nim> its short for nimuriell |
17:13:46 | FromDiscord | <Idefau> its actually short for nimrod |
17:14:19 | FromGitter | <sealmove> wtf, insert is weird, it is 1-indexed |
17:14:29 | FromDiscord | <shadow.> well |
17:14:33 | FromDiscord | <nim> nono when i played lotro in like 2010 i took that name |
17:14:33 | FromDiscord | <nim> :3 |
17:14:41 | FromDiscord | <shadow.> nimrod has been around since what, 2004? |
17:14:44 | * | a_chou joined #nim |
17:14:48 | FromDiscord | <nim> dunno |
17:14:55 | FromDiscord | <nim> ive heard of nim the language like |
17:14:58 | mipri | please change your name. You are infringing on our copyright. |
17:14:58 | FromDiscord | <nim> 2 years ago |
17:15:01 | FromDiscord | <nim> id l ike to learn it |
17:15:01 | FromDiscord | <shadow.> lol |
17:15:10 | FromDiscord | <nim> ok time to leave and change my name iog |
17:15:12 | FromDiscord | <nim> (edit) "iog" => "ig" |
17:15:14 | FromDiscord | <shadow.> LOL |
17:15:17 | FromGitter | <sealmove> or maybe not, but I did `insert(node.len, child)` and it worked, don't know what that means |
17:15:24 | FromDiscord | <shadow.> brb changing my name to google so someone arrests me |
17:15:44 | mipri | google's a big evil company. They can afford to send an assassin instead. |
17:15:48 | * | a_chou quit (Remote host closed the connection) |
17:15:49 | FromDiscord | <shadow.> true |
17:16:08 | Clonkk[m] | They don't really have to send an assassin, they can just threaten to send your search history to your mother |
17:16:13 | FromDiscord | <shadow.> hmm |
17:16:17 | FromDiscord | <shadow.> let me find my search history |
17:16:27 | FromDiscord | <shadow.> "macros |
17:16:31 | FromDiscord | <shadow.> (edit) ""macros ... " added "in nim"" |
17:16:35 | FromDiscord | <shadow.> "how old is nim language" |
17:16:42 | FromDiscord | <shadow.> "github" |
17:16:51 | FromDiscord | <shadow.> and then |
17:16:54 | FromDiscord | <shadow.> some advent of code stuff |
17:16:55 | FromDiscord | <shadow.> school work |
17:17:01 | FromDiscord | <shadow.> lmao |
17:17:03 | FromDiscord | <Idefau> yeah bro i totally believe you didnt search rule34 |
17:17:04 | FromDiscord | <shadow.> nothing my mother would kill me for |
17:17:15 | FromDiscord | <shadow.> i mean |
17:17:23 | FromDiscord | <shadow.> i cant send pictures bc my name is in my schoolwork searches lmao |
17:17:31 | FromDiscord | <Idefau> fair |
17:17:46 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/784106113347354644/unknown.png |
17:17:50 | FromDiscord | <shadow.> mostly me searching shit abt the odyssey |
17:18:03 | FromDiscord | <shadow.> lmfao |
17:19:10 | FromDiscord | <shadow.> n e way |
17:19:24 | FromDiscord | <shadow.> i suppose we'll know where most people fail on aoc once ix comes back up |
17:21:33 | FromGitter | <sealmove> @PMunch please merge https://github.com/PMunch/binaryparse/pull/10 It should be very easy to review, only 3 lines added and 1 edited. |
17:21:33 | disbot | โฅ Generate extra parameters and arguments for custom write proc |
17:26:59 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
17:28:41 | * | Lord_Nightmare joined #nim |
17:29:58 | * | Q-Master joined #nim |
17:34:44 | * | Q-Master quit (Ping timeout: 265 seconds) |
17:46:52 | * | Vladar joined #nim |
17:48:20 | planetis[m] | @sealmove I made a small binary marshal lib https://github.com/planetis-m/bingod would you be interested? |
17:49:38 | FromGitter | <sealmove> hey planetis, busy rn, I'll check it later |
17:50:51 | planetis[m] | cool, usecase is just saving and loading game state |
17:53:45 | * | habamax quit (Ping timeout: 240 seconds) |
17:54:50 | * | spiderstew joined #nim |
17:56:35 | FromDiscord | <shadow.> im just curious, what are the benefits of using irc rather than discord? |
17:56:40 | FromDiscord | <shadow.> since i see a large amount of people are on irc |
17:57:05 | * | Q-Master joined #nim |
18:00:16 | * | zarlet joined #nim |
18:01:08 | FromDiscord | <lytedev> not having to have a web or electron app is nice |
18:01:56 | FromDiscord | <zetashift> also Discord could be doing all kinds of things with your info |
18:02:42 | FromDiscord | <zetashift> also IRC is one of the best "old school" things ever๐คญ |
18:03:18 | FromDiscord | <shadow.> ah fair enough haha |
18:03:51 | mipri | trivial-to-implement servers and clients. open source servers. self-hostable servers. easy tooling. clients you can run from a VPS. client software that doesn't feel the need to constantly scan your memory for 'features' like telling people what game you're playing, etc. |
18:04:25 | mipri | planetis[m] is probably using Matrix though, and only showing up as coming from IRC. |
18:05:01 | FromDiscord | <lytedev> I love being able to just ripgrep through my logs, personally -- just being able to own your data is so nice |
18:06:03 | FromDiscord | <zetashift> Discord is really just, really easy to use. That's pretty much it |
18:06:17 | ForumUpdaterBot | New thread by Snej: Unicode "sortkey" API?, see https://forum.nim-lang.org/t/7196 |
18:08:17 | ForumUpdaterBot | New thread by Snej: Meta: Can't change category of a thread after creating it, see https://forum.nim-lang.org/t/7197 |
18:11:39 | FromDiscord | <shadow.> yeah idk i just like discord because of easy file uploads and code formatting |
18:11:46 | FromDiscord | <shadow.> but i suppose i could get use to ix lol |
18:15:49 | FromDiscord | <lytedev> if you're in the terminal all the time, uploads are definitely easier there -- especially if you setup a reasonable aliasโตโตI prefer 0x0.st |
18:16:48 | FromDiscord | <Idefau> yeah 0x0.st is nice |
18:17:29 | FromDiscord | <shadow.> i suppose i could always make my own |
18:17:30 | FromDiscord | <shadow.> lol |
18:17:42 | FromDiscord | <Idefau> i mean you can host 0x0.st yourself afaik |
18:17:58 | FromDiscord | <shadow.> oh lol |
18:18:02 | FromDiscord | <shadow.> " anything related to crypto currencies" |
18:18:09 | FromDiscord | <shadow.> why's this a rule? just curious |
18:20:00 | FromDiscord | <Idefau> probably just to prevent bitcoin scams or whatever |
18:20:23 | FromDiscord | <Idefau> just share your address in pgp B) |
18:23:51 | FromDiscord | <shadow.> lmao fair enough haha |
18:23:59 | FromDiscord | <shadow.> i dont use crypto so doesnt affect me i was just wondering |
18:48:29 | * | natrys quit (Quit: natrys) |
18:58:48 | * | thomasross joined #nim |
19:03:20 | * | wiml joined #nim |
19:03:59 | FromDiscord | <shadow.> should i be using `\n` or `\p`? |
19:04:16 | FromDiscord | <shadow.> \p is platform-specific newline right |
19:04:19 | FromDiscord | <shadow.> and \n is line feed? |
19:04:33 | FromDiscord | <shadow.> or am i mixing something up |
19:07:05 | * | PMunch joined #nim |
19:07:08 | FromDiscord | <lqdev> yeah |
19:07:17 | FromDiscord | <lqdev> you can't use \p in char literals |
19:07:23 | FromDiscord | <shadow.> hmm ok |
19:07:41 | FromDiscord | <shadow.> wait |
19:07:46 | FromDiscord | <shadow.> \n isnt allowed either as a char right? |
19:08:18 | FromDiscord | <lqdev> it is allowed |
19:08:20 | FromDiscord | <lqdev> \p isn't |
19:08:29 | FromDiscord | <lqdev> because it can actually be 2 characters |
19:08:59 | FromDiscord | <shadow.> > The newline escape sequence \n isnโt allowed inโต> a character literal as it may be composed of multiple characters on some platforms. |
19:09:01 | FromDiscord | <shadow.> very confused |
19:09:06 | FromDiscord | <shadow.> - nim in action |
19:09:11 | FromDiscord | <Idefau> \n is a singular special character |
19:09:16 | FromDiscord | <Idefau> \p is not |
19:09:17 | FromDiscord | <Idefau> so its |
19:09:30 | FromDiscord | <Idefau> (edit) "its" => "it can be 2 chars" |
19:09:32 | FromDiscord | <shadow.> ah ok |
19:09:40 | FromDiscord | <shadow.> any reason why the book says \n cant be a char? |
19:09:47 | FromDiscord | <shadow.> not calling anything out im just wondering lmao |
19:10:24 | FromDiscord | <Idefau> !eval echo typeof('\n') |
19:10:28 | NimBot | char |
19:10:56 | FromDiscord | <Idefau> i assume the behaviour of older nim was that in the book |
19:11:30 | mipri | yeah, that's why there are two escape codes for ascii 10 |
19:11:56 | FromDiscord | <$not> :rooHacker: |
19:11:58 | FromDiscord | <lqdev> @dom96 being the author probably knows the history |
19:11:59 | FromDiscord | <$not> im nimrod now |
19:12:16 | FromDiscord | <Idefau> yup |
19:13:01 | FromDiscord | <$not> <a:D7_ThonkLeave:765378344589066242> |
19:13:42 | FromDiscord | <shadow.> ah makes sense |
19:13:47 | FromDiscord | <shadow.> welcome |
19:15:05 | FromDiscord | <shadow.> how come echo can be called without parentheses but other procs cant? |
19:15:07 | FromDiscord | <shadow.> is echo not a proc |
19:15:28 | mipri | it's a proc. |
19:15:37 | FromDiscord | <kenran> @shadow. well, non-blocking IO on pipes/ptys is the reason after all. I can't test it right now, but getting an 11/`EAGAIN` from `read()` (which is most likely the function used underneath `readBuffer` and such) is normal and one might just try again, but the better alternative would be to use `select()` in some way to read as soon as it's readable again. |
19:15:40 | mipri | other procs can be called without parens. |
19:16:24 | FromDiscord | <shadow.> wait |
19:16:26 | FromDiscord | <shadow.> really? |
19:16:29 | mipri | yes. |
19:16:33 | FromDiscord | <shadow.> WHAT |
19:16:34 | FromDiscord | <shadow.> MY BRAIN- |
19:17:22 | * | hmmm joined #nim |
19:17:27 | FromDiscord | <shadow.> @kenran yeah sounds abt right |
19:18:15 | mipri | https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
19:21:31 | FromDiscord | <Idefau> if i wanted i could do |
19:21:37 | FromDiscord | <Idefau> !eval echo typeof '\n' |
19:21:42 | NimBot | char |
19:22:30 | wiml | hey, is there documentation on how to write type guards for generics? the "language manual" doesn't really cover it, but there are some examples that show it, and the grammar is way too general for me to infer it |
19:23:43 | * | vicfred quit (Ping timeout: 246 seconds) |
19:31:48 | FromDiscord | <shadow.> oh ok good to know thanks |
19:34:06 | hmmm | hey my dudes, "if not @seq" works like in python? |
19:35:22 | FromDiscord | <shadow.> !eval echo not @impbox |
19:35:24 | FromDiscord | <shadow.> bruh |
19:35:25 | FromDiscord | <shadow.> autocomplete |
19:35:25 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: undeclared identifier: 'impbox' |
19:35:44 | FromDiscord | <Idefau> nice ping |
19:35:53 | FromDiscord | <shadow.> !eval echo not newSeq[int]() |
19:35:55 | FromDiscord | <shadow.> autocomplete |
19:35:56 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <seq[int]> |
19:36:09 | FromDiscord | <shadow.> :hmmm i dont think it does |
19:36:38 | hmmm | bummer |
19:36:58 | FromDiscord | <shadow.> i mean `.len` |
19:37:09 | FromDiscord | <shadow.> lemme whip open inim |
19:37:41 | FromDiscord | <shadow.> yeah there's no bool converter for seq's |
19:37:55 | hmmm | yea if xyz.len = 0 works just the same |
19:38:05 | hmmm | still if not xyz is cooler |
19:38:09 | FromDiscord | <shadow.> == but ye ik wym |
19:38:24 | FromDiscord | <Idefau> < 1 |
19:38:29 | FromDiscord | <shadow.> eh i guess it could be "cooler" but it is a bit less clear for a non-python programer |
19:38:41 | FromDiscord | <shadow.> (edit) "programer" => "programmer" |
19:41:06 | wiml | shadow. you can also just locally define a seq[T] to bool converter if you want that kind of implicit falsy-ness |
19:41:58 | FromDiscord | <shadow.> no i would not want that lmao |
19:42:01 | FromDiscord | <shadow.> that's what im saying |
19:42:24 | FromDiscord | <shadow.> idk imo its harder to read and it's really not that hard to type `s.len > 0` |
19:44:05 | mipri | and such a converter will apply in all cases that you pass a seq to something expecting a bool, not just the few ifs you're thinking of. If you come back later after you've forgotten it, and change some code, you might get code that compiles but doesn't do what you want due to a blatant error that would normally fail to typecheck |
19:44:49 | mipri | I'd rather just define an .empty |
19:44:54 | FromDiscord | <shadow.> yeah same |
19:45:40 | FromDiscord | <shadow.> ? |
19:45:41 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/6WE |
19:45:57 | FromDiscord | <shadow.> i suppose openArray would work too |
19:45:59 | FromDiscord | <Idefau> what about a template |
19:46:01 | FromDiscord | <shadow.> fair |
19:46:11 | FromDiscord | <shadow.> i thought of that too but i didnt know the speed difference |
19:46:13 | FromDiscord | <Idefau> or an inline |
19:46:54 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/UwB |
19:47:27 | FromDiscord | <Idefau> hmmm |
19:47:35 | FromDiscord | <shadow.> might want parentheses for precedence |
19:47:38 | FromDiscord | <shadow.> nvm |
19:47:44 | FromDiscord | <shadow.> doesn't == have low precedence |
19:47:56 | FromDiscord | <shadow.> nvm ive no idea lmao |
19:48:24 | * | NimBot joined #nim |
19:48:32 | FromDiscord | <Idefau> (edit) "https://play.nim-lang.org/#ix=2GoA" => "https://paste.rs/9so" |
19:48:45 | FromDiscord | <Idefau> (edit) "https://paste.rs/d11" => "https://paste.rs/P14" |
19:48:49 | FromDiscord | <shadow.> that's incorrect is it not |
19:48:51 | FromDiscord | <shadow.> that's notEmpty |
19:49:10 | FromDiscord | <Idefau> works in nim playground :^) |
19:49:14 | FromDiscord | <shadow.> wtf |
19:49:16 | FromDiscord | <shadow.> confused |
19:49:18 | FromDiscord | <Idefau> oh |
19:49:21 | FromDiscord | <shadow.> lol |
19:49:23 | FromDiscord | <Idefau> yeah thats notempty |
19:49:25 | FromDiscord | <lqdev> @shadow. why parentheses? |
19:49:29 | FromDiscord | <lqdev> nim's templates are not dumb |
19:49:32 | FromDiscord | <shadow.> ohh ok |
19:49:33 | FromDiscord | <shadow.> whew |
19:49:33 | FromDiscord | <shadow.> lol |
19:49:35 | FromDiscord | <lqdev> like C macros are |
19:50:06 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/ywh |
19:50:18 | FromDiscord | <shadow.> unnecessary obfuscation we love that here |
19:50:53 | FromDiscord | <Idefau> yeah thats not gonna look well for a template |
19:50:59 | FromDiscord | <shadow.> LMAO |
19:51:03 | FromDiscord | <shadow.> i agree |
19:51:25 | FromDiscord | <Idefau> like for every occurence of .empty you would have to do conversion from int to bool |
19:51:29 | FromDiscord | <Idefau> which isnt a lot but still |
19:51:30 | FromDiscord | <Idefau> odd |
19:51:32 | FromDiscord | <shadow.> i know it was sarcastic lol |
19:53:33 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GoF |
19:53:34 | FromDiscord | <shadow.> best function just saying |
19:53:58 | FromDiscord | <Idefau> bruh |
19:54:06 | FromDiscord | <shadow.> doesn't work f |
19:54:11 | FromDiscord | <shadow.> ah prefix |
19:54:39 | hmmm | hey how do I stringtuple a seq |
19:54:45 | FromDiscord | <shadow.> (edit) "https://play.nim-lang.org/#ix=2GoF" => "https://paste.rs/QWn" |
19:54:47 | FromDiscord | <shadow.> wdym |
19:55:03 | FromDiscord | <shadow.> has it not been made better? |
19:57:45 | FromDiscord | <Idefau> yeah dude, way better |
19:59:36 | Evolver | Is the var `a_bc` the same as `ab_c` or are they two different vars? |
20:00:22 | PMunch | They're the same |
20:01:32 | FromGitter | <sealmove> @PMunch :> did you see my mention? |
20:04:02 | FromGitter | <sealmove> @planetis interesting. Essentially it saves and loads back any nim object? |
20:04:47 | FromGitter | <sealmove> @Evolver: https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality |
20:05:00 | PMunch | @sealmove, no, when was that? |
20:05:45 | FromGitter | <sealmove> 1-2 hours ago. I fixed the issue with write proc, it's a 4-line edit PR, pls merge https://github.com/PMunch/binaryparse/pull/10 |
20:05:46 | disbot | โฅ Generate extra parameters and arguments for custom write proc |
20:08:13 | hmmm | nim version for f"hello I'm {name}" |
20:08:28 | narimiran | hmmm: huh? |
20:08:36 | FromDiscord | <lqdev> import strformat |
20:08:42 | narimiran | it is `fmt` in nim land, not `f` |
20:08:49 | hmmm | oh |
20:08:49 | narimiran | or, better yet, use `&` |
20:08:52 | FromDiscord | <sealmove> sent a code paste, see https://paste.rs/7qs |
20:08:56 | hmmm | I see |
20:08:59 | hmmm | love u all <3 |
20:09:13 | narimiran | if only you would love our documentation too :'( |
20:09:17 | hmmm | D: |
20:09:20 | FromDiscord | <Idefau> brutal |
20:09:22 | FromDiscord | <sealmove> fmt is less surprising, & has some catches |
20:09:59 | FromDiscord | <sealmove> oh sorry, it's the other way around |
20:10:38 | ForumUpdaterBot | New thread by Araq: Macros that compose (and work well with auto-completion tooling), see https://forum.nim-lang.org/t/7199 |
20:11:03 | FromDiscord | <sealmove> & less surprising, fmt does raw strings, for example you can't do `fmt"{smthg\n}` and get a line feed |
20:13:31 | FromDiscord | <shadow.> whats the difference between quote and quote do? |
20:14:07 | PMunch | That stuff gets done |
20:14:21 | PMunch | Sorry sealmove, I was in a video chat |
20:14:33 | FromDiscord | <sealmove> np |
20:14:44 | PMunch | But yeah I was probably offline when you tried to highlight me |
20:17:02 | hmmm | why stuff so important as strformat and strutils need to get imported |
20:17:08 | hmmm | they should be std :o |
20:17:14 | FromDiscord | <lqdev> no they shouldn't |
20:17:19 | PMunch | Well for one they require the GC |
20:17:25 | narimiran | everybody has their own "X should work without import" |
20:17:28 | FromDiscord | <lqdev> not everyone needs to extend their compile times with strformat and strutils |
20:17:29 | PMunch | Which would mean that Nim could no longer be compiled without it |
20:17:33 | FromDiscord | <sealmove> @PMunch thx |
20:17:45 | hmmm | hmm |
20:17:48 | hmmm | I see |
20:17:58 | narimiran | for some people neither of those two is important |
20:18:10 | FromDiscord | <shadow.> id rather type one line for imports rather than have gc required and longer compile-time |
20:18:16 | PMunch | Not sure if I've ever used strformat myself |
20:18:28 | FromDiscord | <lqdev> i use it when i'm lazy |
20:18:30 | FromDiscord | <sealmove> really? wow |
20:18:46 | FromDiscord | <sealmove> never needed to print something? ๐ |
20:18:52 | PMunch | I don't use it when I'm lazy, because I've never used it so that would require me to look up the documentation :P |
20:19:01 | narimiran | you can print without stringformat, you know? |
20:19:09 | narimiran | !eval echo "printing a string" |
20:19:13 | NimBot | printing a string |
20:19:28 | FromDiscord | <sealmove> sure but it's very useful when printing |
20:19:45 | narimiran | ...sometimes |
20:20:00 | FromDiscord | <shadow.> i mean depends where you come from |
20:20:03 | FromDiscord | <shadow.> as a python dev sure |
20:20:10 | narimiran | i come from python ;) |
20:20:16 | FromDiscord | <shadow.> but if you're a c++ dev im sure `cout << a << b << c` would make more sense |
20:20:26 | FromDiscord | <shadow.> which is similar to `echo a & b & c` |
20:20:36 | FromDiscord | <shadow.> (edit) "c`" => "c;`" |
20:20:41 | FromDiscord | <shadow.> or yk using varargs |
20:23:09 | * | jaggz joined #nim |
20:25:24 | jaggz | if line =~ re"\s*(\w+)\s*\=\s*(\w+)": |
20:25:31 | jaggz | can " be substituted with another char? |
20:25:43 | FromDiscord | <shadow.> single equals? |
20:25:44 | jaggz | (using: template `=~`(s: string; pattern: Regex): untyped ) |
20:25:51 | FromDiscord | <shadow.> oh lmfao |
20:26:06 | mipri | be warned: =~ adds an implicit ^ to the beginning of the regex. |
20:26:17 | mipri | you can use """ with re |
20:26:26 | jaggz | that's not nice. I want my perl =~ .. :) |
20:26:58 | mipri | yeah, it's disappointing, .contains with an explicit matches works as well |
20:27:03 | jaggz | also, the ability to swap out the quote with a different delimiter |
20:27:38 | * | vicfred joined #nim |
20:28:57 | mipri | I'd prefer either D or Rust solutions, but at least with Nim there's always the option of putting a readable string in your code and then fixing it at up at compile-time |
20:30:15 | * | tiorock joined #nim |
20:30:15 | * | rockcavera is now known as Guest42063 |
20:30:15 | * | tiorock quit (Changing host) |
20:30:15 | * | tiorock joined #nim |
20:30:15 | * | Guest42063 quit (Killed (beckett.freenode.net (Nickname regained by services))) |
20:30:15 | * | tiorock is now known as rockcavera |
20:30:22 | mipri | a good literal for that use is a raw string, r"", where your inner " get doubled instead of escaped |
20:32:45 | jaggz | mipri, thanks |
20:33:10 | * | narimiran quit (Ping timeout: 256 seconds) |
20:36:05 | hmmm | error invalid indentation and error type mismatch are like 90% of my builds D: |
20:36:16 | hmmm | is there a way to check without compiling all the stuff? |
20:39:02 | mipri | nim check |
20:39:31 | jaggz | <nim> I don't want to |
20:40:24 | hmmm | yea it works mipri :o |
20:40:30 | FromDiscord | <lqdev> i'd say that using `nim c -o:/dev/null file.nim` is a better idea than `nim check` |
20:40:40 | FromDiscord | <lqdev> because sometimes `nim check` just has a stroke for no reason |
20:40:44 | hmmm | but I lose the handy F6 vscode integration :| |
20:40:51 | mipri | if you don't want to produce output, just 'nim r file' |
20:41:02 | FromDiscord | <lqdev> and it reports warnings that don't occur when you nim c |
20:41:32 | jaggz | r? |
20:42:15 | FromDiscord | <lqdev> that's a new thing in 1.4 |
20:42:32 | FromDiscord | <lqdev> almost a shortcut to c -r, but better :) |
20:42:40 | FromDiscord | <lqdev> because it doesn't clutter your dir with executables |
20:43:39 | planetis[m] | sealmove, sry i was excercising, yes that's right |
20:43:44 | FromGitter | <timotheecour> โฆ or js files; (`nim r -b:js main`) |
20:43:58 | FromDiscord | <exelotl> Bruh |
20:44:10 | FromDiscord | <exelotl> I didn't know about nim r |
20:44:14 | FromDiscord | <exelotl> That's amazing |
20:44:56 | FromGitter | <timotheecour> always read changelogs :) |
20:44:57 | planetis[m] | I anounced my package at https://forum.nim-lang.org/t/7198 but irc wasn't |
20:44:57 | planetis[m] | updated |
20:47:45 | FromDiscord | <Quibono> Is there a guide anywhere for using async? |
20:48:27 | jaggz | nim (v.) "to take, take up in the hands in order to move, carry, or use; take unlawfully, steal" (archaic), Old English niman "to take, accept, receive, grasp, catch," ... |
20:50:35 | hmmm | BinGod like a binary divinity? |
20:53:12 | hmmm | that almost tops not iFish in a shower in the nim metatitle leaderboard |
20:54:14 | jaggz | nim android hello.nim |
20:54:57 | planetis[m] | hmmm: i understood some of what you said |
20:55:01 | planetis[m] | but i agree |
20:56:50 | hmmm | yesterday we were joking about PMunch project named notifishower that makes people cross eyes and pop veins trying to parse it |
20:57:50 | mipri | "not if I shower!" is a great name though |
20:57:56 | hmmm | lol |
20:58:03 | PMunch | <_< |
20:58:27 | PMunch | I think I might have to rename it though, it just does too many things now |
20:58:40 | hmmm | running on windows in not one of them :| |
20:58:42 | PMunch | It's not really only for notifications |
20:58:46 | mipri | import notifishower; stink_up_place() # <-- never happens due to program abort if notifishower detects a recent cleaning |
20:59:05 | PMunch | Pfft, nah Windows user can go roll around in the mud or something to have their fun |
20:59:08 | PMunch | They are simpler folk |
20:59:32 | hmmm | munchie if I'm online I will watch your next stream |
20:59:51 | PMunch | First I need to find something to stream.. |
21:00:05 | * | Jesin quit (Quit: Leaving) |
21:00:24 | PMunch | I kinda want to try and get my 3rd party window framer working |
21:00:39 | PMunch | But that might just be two hours of desk smashing |
21:01:03 | supakeen | A nice change from the usual 8 hours of desk smashing :) |
21:01:05 | hmmm | that things that retiles windows? I think I've seen you talk about it |
21:01:21 | PMunch | Ah no, that is the window manager |
21:01:34 | PMunch | This is what creates the decoration around your windows |
21:01:40 | PMunch | Which is typically done by your window manager |
21:01:45 | PMunch | But doesn't really have to be |
21:04:54 | * | WilhelmVonWeiner quit (Read error: Connection reset by peer) |
21:08:42 | * | junland quit (Quit: %ZNC Disconnected%) |
21:09:31 | * | junland joined #nim |
21:12:41 | * | Jesin joined #nim |
21:26:39 | * | bunbunbunbunny joined #nim |
21:32:35 | * | ehmry joined #nim |
21:41:22 | * | Vladar quit (Quit: Leaving) |
21:46:08 | FromGitter | <iffy> Besides "everything" what am I doing wrong to cause this compiler error? https://play.nim-lang.org/#ix=2GoX |
21:47:39 | mipri | https://nim-lang.org/docs/tables.html#TableRef |
21:49:23 | FromGitter | <iffy> mipri: is that for me? |
21:49:30 | mipri | yes. |
21:49:41 | mipri | what you've got there is like a parameter with at type of just 'seq' or 'array' |
21:50:37 | FromGitter | <iffy> oh, derp... |
22:06:43 | FromDiscord | <j-james> !eval echo(toInt("5")) |
22:06:46 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: type mismatch: got <string> |
22:07:29 | mipri | !eval import strutils; echo "5".parseInt |
22:07:34 | NimBot | 5 |
22:07:46 | mipri | if you're doing aoc, try strscans |
22:08:22 | * | hmmm left #nim (#nim) |
22:09:07 | FromDiscord | <j-james> oh, interesting |
22:09:35 | FromDiscord | <j-james> i need to read through the nim libraries sometime |
22:11:27 | PMunch | That'll take you a while :P |
22:11:40 | PMunch | Or do you mean the standard library? |
22:11:49 | PMunch | Still take you a while, but at least a bit shorter |
22:11:57 | PMunch | It's quite comprehensive though |
22:13:45 | FromDiscord | <j-james> the standard library, yes ๐
|
22:24:49 | * | sagax quit (Remote host closed the connection) |
22:27:23 | FromDiscord | <Avatarfighter> nim r? |
22:27:30 | ehmry | is there documentation for the nim.cfg parser? |
22:27:49 | ehmry | or the syntax? |
22:28:34 | PMunch | Yes, but you really should use the much newer nims syntax |
22:30:32 | ehmry | ok, *where* is the documentation for nim.cfg? |
22:31:20 | ehmry | though if I can avoid the old style completly that would be ideal |
22:32:11 | PMunch | https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files |
22:36:26 | FromGitter | <iffy> Do you see any memory-leak problems with this heterogeneous object storage thinger? https://play.nim-lang.org/#ix=2Gpd |
22:37:22 | ehmry | PMunch: could I rewrite nim.cfg to nims? |
22:37:47 | PMunch | Yup |
22:39:09 | FromGitter | <iffy> I think maybe I need some `reset()` calls on the object members, right? |
22:41:44 | * | apahl quit (Ping timeout: 240 seconds) |
22:42:14 | * | apahl joined #nim |
22:44:55 | FromDiscord | <j-james> why does `var program: seq[int] = map(split(readFile(input), ','), parseInt)` error out with a `unhandled exception: invalid integer: 0`? |
22:45:14 | ehmry | PMunch: I don't believe you |
22:45:15 | FromDiscord | <j-james> passing the contents of the file as a string in place of `readFile(input)` works fine |
22:45:39 | * | mbomba joined #nim |
22:46:06 | voltist | Nim does astronomy now: https://raw.githubusercontent.com/dizzyliam/randomImgs/master/graph.png |
22:46:09 | * | bunbunbunbunny quit (Quit: Lost terminal) |
22:46:42 | mipri | j-james: there's a newline after 0 |
22:46:45 | PMunch | Probably it's something like 0\n |
22:46:57 | PMunch | And ehmry well what can I say :P |
22:47:26 | PMunch | voltist, what're you plotting there? |
22:47:51 | ehmry | PMunch: is using nims documented? |
22:47:51 | FromDiscord | <Avatarfighter> ^ Yeah I'm really interested |
22:48:41 | PMunch | https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files |
22:49:09 | PMunch | I meant this: https://nim-lang.org/docs/nims.html |
22:49:11 | voltist | It's the magnitude of a star over time, with each point being an image I took at my local observatory |
22:49:34 | voltist | I got dissatisfied with existing open source software that does this kind of image processing, so I made a Nim library :) |
22:49:52 | ehmry | looks like strace is the documentation |
22:50:03 | FromDiscord | <Avatarfighter> voltist: got a github I can look at? |
22:50:06 | PMunch | voltist, nice |
22:50:33 | PMunch | Why are the observations so chunked? |
22:50:44 | PMunch | ehmry, it's not that bad |
22:50:59 | PMunch | At least you can have a look at what other people do |
22:51:03 | ehmry | PMunch: no it is that bad, this is pure shit |
22:51:26 | voltist | https://github.com/dizzyliam/astroNimy |
22:51:32 | voltist | No documentation at the moment |
22:51:46 | voltist | I'll do that very soon |
22:51:49 | PMunch | ehmry, oh yeah don't get me wrong |
22:51:52 | PMunch | It's not great |
22:52:23 | voltist | The observations are in bursts like that because they were taken over multiple days, and each of the bursts is one clear evening |
22:53:02 | * | tane quit (Quit: Leaving) |
22:55:55 | PMunch | Right, that's kinda what I expected |
23:00:07 | voltist | My goal is to build a node based GUI for image processing, but for now I'm just designing it have a nice programmatic interface |
23:00:56 | * | lum quit (Quit: Lum: Bye!) |
23:04:09 | * | lum joined #nim |
23:04:33 | FromDiscord | <shadow.> lol pmunch i revised my solution |
23:04:34 | FromDiscord | <shadow.> https://hatebin.com/kvqmqtddao |
23:04:40 | FromDiscord | <shadow.> i just realized how much i was overcomplicating it |
23:05:04 | PMunch | Haha, simple is often the best |
23:05:18 | FromDiscord | <shadow.> haha yeah |
23:05:29 | FromDiscord | <shadow.> i realized instead of using a while loop and incrementing a value statically |
23:05:33 | FromDiscord | <shadow.> (edit) "statically" => "linearly" |
23:05:37 | FromDiscord | <shadow.> i can just use a for loop countup lol |
23:05:39 | FromDiscord | <shadow.> forgot abt step |
23:08:49 | FromDiscord | <Quibono> So Iโve been thinking about maybe making a currency library. |
23:09:12 | PMunch | Damn it.. I think my clocks tick faster at night.. |
23:09:15 | PMunch | Good night |
23:09:16 | * | PMunch quit (Quit: leaving) |
23:11:18 | FromDiscord | <shadow.> good night haha |
23:20:01 | FromDiscord | <shadow.> what are inlines? |
23:20:11 | FromDiscord | <shadow.> i've heard them mentioned but i'm not sure what they are or what they do lmao |
23:20:25 | FromDiscord | <shadow.> i'm pretty sure i've seen the inline pragma |
23:38:40 | FromDiscord | <Quibono> Uhh I tried googling it and it doesnโt make any more sense having read what google says |
23:40:31 | FromDiscord | <shadow.> lmfao |
23:40:38 | FromDiscord | <shadow.> that is often the case with nim |
23:40:40 | FromDiscord | <shadow.> lemme check the book |
23:41:16 | FromDiscord | <shadow.> no mention of inline in the book lol |
23:49:32 | FromDiscord | <Quibono> I feel like Nim is a little bit like a rare monastic sect. Very powerful, but you need to be initiated into its secrets |
23:50:57 | FromDiscord | <shadow.> lol i agree |
23:53:24 | FromDiscord | <j-james> Speaking of obscure parts of Nim, there's a slightly-nicer way to do `proc foo(bar: int) = var bar: int = bar`, and I can't remember what it was |
23:54:19 | FromDiscord | <shadow.> my brain is hurting from this code |
23:54:27 | FromDiscord | <shadow.> what does that even do |
23:54:32 | FromDiscord | <shadow.> shadows an argument? |
23:54:35 | FromDiscord | <shadow.> (edit) "shadows" => "shadow" |
23:54:49 | FromDiscord | <j-james> Oh |
23:55:26 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=2GpD |
23:55:58 | FromDiscord | <j-james> (edit) "https://play.nim-lang.org/#ix=2GpD" => "https://play.nim-lang.org/#ix=2GpE" |
23:57:14 | FromDiscord | <shadow.> im so confused |
23:57:24 | FromDiscord | <shadow.> why are you shadowing bar with itself |
23:57:57 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GpG |
23:58:36 | FromDiscord | <j-james> No, sorry, my examples are bad |
23:58:47 | FromDiscord | <shadow.> you mean incrementing a value by one? |
23:58:51 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=2GpH |
23:58:56 | FromDiscord | <shadow.> oh hm |
23:59:06 | FromDiscord | <shadow.> OHHH |
23:59:10 | FromDiscord | <shadow.> you mean getting a mutable argument? |
23:59:20 | FromDiscord | <j-james> A couple of days ago, someone posted a slightly-nicer way to do `var program: seq[int] = program` |
23:59:21 | * | wiml quit (Quit: Leaving) |
23:59:25 | FromDiscord | <shadow.> that? |
23:59:26 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GpI |
23:59:33 | FromDiscord | <shadow.> (edit) "https://play.nim-lang.org/#ix=2GpI" => "https://play.nim-lang.org/#ix=2GpJ" |
23:59:36 | FromDiscord | <j-james> I don't think it's a mutable argument |
23:59:43 | FromDiscord | <shadow.> well they sure are mutating it... |
23:59:46 | FromDiscord | <shadow.> lmfao |