00:00:05 | arkanoid | I want to access PPyObject from a PyObject here: https://github.com/yglukhov/nimpy/blob/3ca0f3c58b70ee67823b6575fd43f279db70b7e3/nimpy.nim#L13 |
00:00:21 | * | krux02 quit (Remote host closed the connection) |
00:00:35 | arkanoid | so I'm doing cast[PPyObject](myPyObject) |
00:01:23 | FromDiscord | <Elegantbeef> Seems like it'd be better to just export the fields, maybe with a conditional |
00:03:33 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Hr8 something like this |
00:04:18 | FromDiscord | <Elegantbeef> No clue if a PR would be accepted |
00:05:12 | arkanoid | no no, I don't intend to make a PR, I just want to know if I manage to interface https://numpy.org/doc/stable/reference/c-api with numpy |
00:05:50 | arkanoid | I like nim because I want to use it for science, but interop from python and nim curretly rely on value copy |
00:06:10 | FromDiscord | <Elegantbeef> Yea i know |
00:06:21 | arkanoid | it works nicely, but if you want to go back and forth python and nim is not convenient |
00:06:46 | arkanoid | so currently nim can be used for large functions with small inputs |
00:06:54 | FromDiscord | <Elegantbeef> if only i cared to use python |
00:07:33 | FromDiscord | <Elegantbeef> That joke is implying i'd probably get annoyed and have made it work |
00:07:46 | arkanoid | I would be happy to kick python from my life, but a lot of work for science rely on it today |
00:10:12 | arkanoid | actually there are larger projects that aims to bridge different science stacks to handle zero-copy between them: https://arrow.apache.org/ |
00:11:28 | arkanoid | question is if it is better to have one fast lib for nim (arraymancer, datamancer), or rely on interop |
00:11:33 | FromDiscord | <Elegantbeef> I dont know much about python \<-\> native interop so cannot say much, seems if you can map the python object to a Nim object and have the abillity to allocate in the python interpreter you're golden |
00:11:48 | FromDiscord | <Elegantbeef> But that means you need embeded python, not an external interpreter afaik |
00:19:17 | arkanoid | Elegantbeef, it depents on the "glue" object you rely on. Numpy is a possibility, apache arrow another, but there's no silver bullet |
00:20:30 | arkanoid | and apparently there's there's no intention to sacrifice stability over performance here https://github.com/SciNim/scinim/issues/8 |
00:22:12 | FromDiscord | <treeform> In reply to @Mister_Magister "<@107140179025735680> only issue i": I have added made it possible to "check if query contains parameter": https://github.com/treeform/urlly/commit/9a51fa34b6d4775e02191af5169bac481eab02c4 |
00:36:11 | FromDiscord | <treeform> In reply to @Mister_Magister "<@107140179025735680> only issue i": You don't have to `parseUrl("?" & req.url.query)` any more it will now parse without the leading ? https://github.com/treeform/urlly/commit/4a5fa3fd6e8d5389667075c7dd1176110e340718 |
00:40:52 | * | src quit (Quit: Leaving) |
00:49:12 | FromDiscord | <ynfle (ynfle)> How do I print a seq in nim-gdb? |
00:51:12 | arkanoid | do you know why this type is OverflowDefect? https://play.nim-lang.org/#ix=3Hrf |
01:12:29 | arkanoid | nevermind, excessive empty spaces. Not sure why the error is OverflowDefect though |
01:16:11 | FromDiscord | <Fish-Face> how do you create a `set[char]` from a string? |
01:16:49 | FromDiscord | <Elegantbeef> !eval import std/setutils; echo "hello".toSet |
01:16:51 | NimBot | {'e', 'h', 'l', 'o'} |
01:18:36 | FromDiscord | <Fish-Face> danke |
01:41:36 | FromDiscord | <evoalg> In reply to @Elegantbeef "!eval import std/setutils; echo": I'm wondering if you mind-read Michal as to why he used a func instead of toSet? https://github.com/MichalMarsalek/Advent-of-code/blob/master/2021/Nim/day8.nim |
01:42:13 | FromDiscord | <Elegantbeef> Probably didnt know it existed |
01:43:05 | FromDiscord | <evoalg> are you saying you looked into Michal's mind and saw nothing? |
01:43:13 | FromDiscord | <Elegantbeef> Perhaps |
01:43:48 | FromDiscord | <Elegantbeef> My telepathy is a bit under utilised so i could be wrong |
01:43:49 | FromDiscord | <ynfle (ynfle)> Any help with this error message `Error: 's' is of type <var seq[seq[int]]> which cannot be captured as it would violate memory safety`? |
01:44:17 | FromDiscord | <Elegantbeef> You'e attempting to capture a `var` which is unsafe |
01:44:18 | FromDiscord | <ynfle (ynfle)> I'm using `s.apply((x: var seq[int]) => some operate)` |
01:44:34 | FromDiscord | <ynfle (ynfle)> In a function with `s: var seq[seq[int]]` |
01:44:34 | FromDiscord | <Elegantbeef> What's the entire code? |
01:45:17 | FromDiscord | <ynfle (ynfle)> a mess 😉 |
01:45:26 | FromDiscord | <ynfle (ynfle)> It's AOC |
01:45:30 | FromDiscord | <ynfle (ynfle)> I'm going to sleep |
01:45:36 | FromDiscord | <ynfle (ynfle)> I'll think about it tomorrow |
01:45:36 | FromDiscord | <Elegantbeef> anyway use `applyIt` instead |
01:45:56 | FromDiscord | <Elegantbeef> You're making a closure procedure which is capturing `s` |
01:48:16 | nrds | <Prestige99> Is there a way in nim to prevent overflows or underflows in math operations? E.g. https://play.nim-lang.org/#ix=3Hrn |
01:49:27 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Hro |
01:49:34 | FromDiscord | <Elegantbeef> Unless you mean "I want compiler errors" |
01:49:43 | FromDiscord | <Elegantbeef> I dont want runtime errors\ |
01:51:03 | FromDiscord | <Elegantbeef> What are you after prestige? |
01:51:08 | nrds | <Prestige99> Ye just trying to avoid the runtime error if possible. Like if I'm doing something simple checking if x - y > 0, it could crash |
01:51:31 | nrds | <Prestige99> eh just theoretical atm |
01:51:31 | FromDiscord | <Elegantbeef> Then yes the way would be to check if it's valid |
01:51:57 | FromDiscord | <codic> If you don't want runtime errors you can also use the `+%/-%/%//%` operators etc, which overflow instead of panic |
01:52:06 | FromDiscord | <codic> overflow as in wrap around |
01:52:16 | nrds | <Prestige99> oh interesting |
01:52:16 | FromDiscord | <Elegantbeef> Well he doesnt want it to wrap he just wants to safely check |
01:52:26 | nrds | <Prestige99> yeah |
01:52:35 | nrds | <Prestige99> was hoping there'd be a non-cumbersome way to do so |
01:52:46 | FromDiscord | <Elegantbeef> My suggestion would be subrange types or procs |
01:55:48 | FromDiscord | <Fish-Face> In reply to @evoalg "I'm wondering if you": haha well it is for AoC but I have no idea how to read Michal's code there |
01:55:50 | FromDiscord | <Fish-Face> mine is way longer |
01:58:04 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3Hrr |
02:00:21 | FromDiscord | <Elegantbeef> Something like this prestige https://play.nim-lang.org/#ix=3Hrs |
02:00:53 | FromDiscord | <Elegantbeef> I think you need to make a PR to fix it |
02:02:33 | nrds | <Prestige99> hm I wonder what the expected behavior should be |
02:03:00 | nrds | <Prestige99> I almost would want it to stay at int.low or int.high if it would have exceeded those values, but that's just my pref |
02:03:18 | nrds | <Prestige99> I mean I can code that into what you sent ofc but if I were to make a PR |
02:03:37 | FromDiscord | <Elegantbeef> The PR was to impbox |
02:03:45 | FromDiscord | <Elegantbeef> The current behaviour is the correct behaviour |
02:03:46 | nrds | <Prestige99> o :P |
02:04:24 | nrds | <Prestige99> yeah it's not bad |
02:11:09 | FromDiscord | <nwilburn> Hey would this be the appropriate place to ask potentially stupid questions? |
02:11:24 | FromDiscord | <Elegantbeef> Well i'm here to provide stupid answers |
02:13:13 | arkanoid | haha |
02:14:28 | FromDiscord | <nwilburn> sent a code paste, see https://play.nim-lang.org/#ix=3Hrw |
02:14:36 | * | vicfred quit (Quit: Leaving) |
02:15:00 | FromDiscord | <Elegantbeef> You're making a `ref ref Gitlabclient` |
02:15:12 | FromDiscord | <Elegantbeef> `proc newGitlabClient(api_endpoint: string, api_key: string): ref GitlabClient =` make that `GitlabClient` |
02:15:51 | FromDiscord | <Elegantbeef> Right now you're allocating the first `ref`and the second one is unallocated hence the nil error |
02:17:17 | FromDiscord | <nwilburn> Oops! Changed that however I am still getting the same Illegal storage access error |
02:17:49 | FromDiscord | <Elegantbeef> Do you have the full code somewhere? |
02:17:59 | FromDiscord | <nwilburn> Yea one sec I can push it up somewhere |
02:18:08 | FromDiscord | <Elegantbeef> Thanks |
02:20:46 | FromDiscord | <nwilburn> https://github.com/ragingpastry/tap/tree/improve-documentation/src (Hold your breath before you enter. I'm sure it smells something fierce) |
02:22:07 | FromDiscord | <nwilburn> Is the traceback https://media.discordapp.net/attachments/371759389889003532/918326610015432724/unknown.png |
02:23:51 | FromDiscord | <Elegantbeef> Check if `glClient.isNil` or `glClient.client.isNil` |
02:24:48 | FromDiscord | <Elegantbeef> There is much reason i can see presently for you to use `ref object` anywho for your glClient |
02:25:45 | FromDiscord | <nwilburn> Yea I moved to ref object because I don't really understand how that all works and it wasn't working when I was just using object haha. Also yea glClient.client is nil |
02:26:22 | FromDiscord | <Elegantbeef> Well you just use `var GitlabClient` instead of `GitlabClient` when you want to mutate it 😛 |
02:26:33 | FromDiscord | <Elegantbeef> Ok so now to see why it get's nil'd |
02:26:59 | FromDiscord | <Elegantbeef> https://github.com/ragingpastry/tap/blob/improve-documentation/src/cli.nim#L21 you dont use `newGitlabClient` |
02:27:14 | FromDiscord | <nwilburn> doh! |
02:31:36 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Hrz one example at how normal objects are supposed to be used |
02:34:02 | FromDiscord | <nwilburn> Thanks! |
02:34:43 | FromDiscord | <Elegantbeef> Though the constuctor you made is idiomatic it doesnt play well with generics |
02:40:49 | FromDiscord | <nwilburn> Cheers! Got it working thanks much |
02:40:58 | FromDiscord | <Elegantbeef> No problem |
02:51:21 | * | arkurious quit (Quit: Leaving) |
03:19:16 | * | rockcavera quit (Remote host closed the connection) |
03:45:12 | FromDiscord | <impbox [ftsf]> argh, i'm so confused |
03:47:06 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3HrJ |
03:47:14 | FromDiscord | <impbox [ftsf]> any idea what could cause this? |
03:48:28 | FromDiscord | <impbox [ftsf]> https://gist.github.com/ftsf/21dba0c07a8f0614b81ed2728540de74 compiles fine |
03:49:20 | FromDiscord | <impbox [ftsf]> it's not like it's being called from another template, so the template nesting should be identical |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:30 | * | supakeen joined #nim |
07:11:52 | * | anddam quit (Ping timeout: 256 seconds) |
07:16:01 | * | anddam joined #nim |
07:29:33 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
07:31:44 | * | Lord_Nightmare joined #nim |
07:38:35 | * | neurocyte0132889 joined #nim |
07:38:35 | * | neurocyte0132889 quit (Changing host) |
07:38:35 | * | neurocyte0132889 joined #nim |
07:40:22 | FromDiscord | <Cypheriel> Is there a cleaner way to do `foo[y1..y2, x1..x2] = foo[y1..y2, x1..x2].map(bar)`? |
07:40:44 | FromDiscord | <Cypheriel> A certain line of mine is getting a bit stupidly long because of this |
07:40:49 | FromDiscord | <Rika> what is foo |
07:40:50 | FromDiscord | <Rika> type |
07:40:57 | FromDiscord | <Cypheriel> `Tensor` |
07:41:06 | FromDiscord | <Rika> i cannot help you here |
07:41:08 | FromDiscord | <Cypheriel> I should've specified, my bad |
07:41:16 | FromDiscord | <Cypheriel> I'm a bit confused as to what to do lol |
08:13:03 | * | jjido joined #nim |
08:15:11 | * | PMunch joined #nim |
08:34:11 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:52:23 | * | src joined #nim |
08:53:34 | FromDiscord | <retkid> how do i know when my code is presentable to the world |
08:53:35 | FromDiscord | <retkid> well |
08:53:38 | FromDiscord | <retkid> i kinda do know |
08:53:48 | FromDiscord | <retkid> should i include a db or just the tools to generate the db? |
09:14:19 | PMunch | @retkid, you publish it and gauge the response :P |
09:14:33 | PMunch | Not quite sure what you mean about the db question |
09:14:39 | FromDiscord | <Rika> “Presentable” depends on who sees it |
09:15:01 | FromDiscord | <Rika> Probably means should he provide a sample database |
09:15:29 | PMunch | Oh I see |
09:15:31 | FromDiscord | <Rika> Usually applications that rely on a database generate one when needed or fail gracefully when one is found but is malformed |
09:15:57 | PMunch | I mean you could publish a database of test data or something, but it should be done outside of your repo (you don't want large binaries in a git repository) |
09:16:24 | FromDiscord | <Rika> I guess it depends on what this database is actually consisting of |
09:16:36 | PMunch | Not really |
09:17:42 | PMunch | I mean if the repository contains a script to build a database or instructions on how to do it then the repo is "complete". But if it takes a long time to do it, or it's easy to mess it up it's nice to also have somewhere that people can go and download a test database. |
09:17:55 | PMunch | But this database shouldn't be put in the Git repository |
09:18:24 | FromDiscord | <retkid> well |
09:18:25 | PMunch | If you don't have another hosting solution then you could of course create a separate Git repository for your binaries |
09:18:37 | FromDiscord | <retkid> the re are tools in the git which can generate the same or very similar database |
09:18:44 | FromDiscord | <retkid> but currently that process takes like 16 hours |
09:19:11 | PMunch | Yeah, so you probably want to share your database as well. Just don't put it in the main repo |
09:19:13 | FromDiscord | <Rika> I mean if it’s an empirical dataset in a database then there literally isn’t much else to do other than publish it |
09:19:27 | FromDiscord | <Rika> Otherwise if it’s for config or whatever then you generate it |
09:19:44 | FromDiscord | <Rika> Publish it not in the git repo |
09:20:17 | FromDiscord | <retkid> Ok I'll include the code i used to make it, but put a warning that it'll take a very long to make it, that is, if you can get HTTPclient to not bug out when you close it 4392 times |
09:20:23 | FromDiscord | <retkid> (edit) "Ok I'll include the code i used to make it, but put a warning that it'll take a very long to make it, that is, if you can get HTTPclient to not bug out when you close it 4392 times ... " added "with threadpool" |
09:20:40 | PMunch | Trust me, you don't want to have build artifacts in your repo and suddenly it takes a couple hours and a hard-disk and a half to download it |
09:20:54 | FromDiscord | <retkid> well, its not a big dataset |
09:20:55 | FromDiscord | <Rika> Totally |
09:21:25 | PMunch | @retkid, I guess it's bigger than your code-files though? |
09:21:29 | FromDiscord | <retkid> just, building the db takes pinging someone elses DB 16,000 times |
09:21:38 | PMunch | And can't easily use diffs to store variances between versions |
09:21:59 | PMunch | Yes, please publish the DB as well, just not in your repo |
09:22:05 | PMunch | Link to it or something |
09:22:14 | FromDiscord | <retkid> oh lol |
09:22:18 | FromDiscord | <retkid> i accidentally deleted the db |
09:22:21 | FromDiscord | <retkid> ............................ |
09:22:21 | FromDiscord | <Rika> What |
09:22:23 | FromDiscord | <Rika> How |
09:22:25 | PMunch | Haha :P |
09:22:30 | FromDiscord | <Rika> Rest in peace |
09:22:32 | FromDiscord | <retkid> i was cleaning up in vscode |
09:22:35 | FromDiscord | <retkid> :| |
09:22:44 | FromDiscord | <Rika> Generate it again, have fun |
09:22:52 | FromDiscord | <Rika> This time make a backup haha |
09:23:00 | FromDiscord | <retkid> i had a backuo |
09:23:04 | FromDiscord | <retkid> (edit) "backuo" => "backup" |
09:23:06 | FromDiscord | <Rika> Had? |
09:23:08 | FromDiscord | <retkid> deleted it to |
09:23:09 | FromDiscord | <retkid> (edit) "to" => "too" |
09:23:13 | FromDiscord | <Rika> My goodness |
09:23:13 | FromDiscord | <retkid> :| |
09:23:54 | FromDiscord | <retkid> well shit |
09:24:00 | FromDiscord | <retkid> im starting it halfway done though |
09:24:08 | FromDiscord | <retkid> so instead of 16 hours it'll be like 12 |
09:24:32 | FromDiscord | <Rika> Wow that’s long |
09:24:44 | FromDiscord | <retkid> well you try pinging a slow as db 16000 times |
09:24:47 | FromDiscord | <Rika> This thing you’re requesting from really has a bad API does it |
09:25:04 | FromDiscord | <retkid> im also using python because nim has no NLP |
09:25:08 | FromDiscord | <retkid> and i dont wanna make one |
09:25:18 | FromDiscord | <Rika> Async? |
09:25:24 | FromDiscord | <retkid> no l |
09:25:32 | FromDiscord | <retkid> native language processer |
09:25:36 | FromDiscord | <Rika> I mean do you use async |
09:25:37 | FromDiscord | <retkid> (edit) "processer" => "processor" |
09:25:39 | FromDiscord | <Rika> I know NLP |
09:25:45 | FromDiscord | <retkid> oh yea |
09:25:49 | FromDiscord | <retkid> i didn't thread or async it |
09:25:55 | FromDiscord | <retkid> i'll do it |
09:25:58 | FromDiscord | <Rika> Maybe that’s why lol |
09:26:02 | FromDiscord | <retkid> (edit) "it" => "that" |
09:26:08 | FromDiscord | <Rika> Not really sure if it would help though |
09:26:55 | FromDiscord | <retkid> i need to get good at async |
09:26:59 | PMunch | Apparently there is something called Git LFS: https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-git-large-file-storage |
09:27:07 | PMunch | To store large files in Git repos |
09:27:17 | FromDiscord | <retkid> well, i'd love to tell you how big it was |
09:27:19 | FromDiscord | <retkid> but i cant |
09:27:24 | FromDiscord | <retkid> the raw data is only 12mb |
09:27:37 | FromDiscord | <retkid> but it expands quite a bit |
09:27:52 | FromDiscord | <retkid> i would make it smaller if i use base64 |
09:27:54 | FromDiscord | <retkid> (edit) "base64" => "base64, etc" |
09:28:08 | PMunch | Smaller if you used base64? |
09:28:22 | FromDiscord | <retkid> if i compress it i mean |
09:28:25 | PMunch | base64 typically makes stuff way bigger |
09:28:26 | PMunch | Ah |
09:28:30 | FromDiscord | <Rika> LFS is an extension for those who store massive monorepos |
09:28:32 | FromDiscord | <Rika> Afaik |
09:28:40 | FromDiscord | <retkid> actually |
09:28:42 | FromDiscord | <retkid> i have a copy of my db |
09:28:51 | FromDiscord | <retkid> well |
09:28:58 | FromDiscord | <retkid> i need to rebuild it |
09:29:04 | FromDiscord | <retkid> but i have all its contents in json form |
09:29:18 | FromDiscord | <retkid> 3 backups 😎 |
09:29:57 | FromDiscord | <retkid> its not super big of a dB |
09:30:00 | FromDiscord | <retkid> (edit) "dB" => "only 20 m" |
09:30:02 | FromDiscord | <retkid> (edit) "m" => "mb" |
09:30:33 | PMunch | Aha, so basically Git LFS just creates a small file with an ID for your file in the remote repo. Then it uploads the file to the host in the normal way. And then when you pull a branch it will pull the actual large file from the web host. |
09:30:36 | PMunch | Pretty clever |
09:31:38 | FromDiscord | <Cypheriel> am I confused or.. is it not possible to convert a range with negative step to a sequence |
09:33:01 | PMunch | A large file in a Git context is like anything above a couple kilobytes, maybe up to about a megabyte. |
09:33:01 | FromDiscord | <retkid> In reply to @Cypheriel "am I confused or..": anything is possible if you try hard enough |
09:33:01 | FromDiscord | <Cypheriel> my brain already hurts enough 😔 |
09:33:01 | FromDiscord | <Cypheriel> I can't even get ranges with steps working in inim |
09:33:01 | PMunch | @Cypheriel, it's certainly possible. But remember that the normal `..` iterator can only go up |
09:33:01 | FromDiscord | <retkid> I have no clue what a range is or a negative step |
09:33:01 | FromDiscord | <retkid> well no |
09:33:01 | FromDiscord | <retkid> (edit) removed "no" |
09:33:01 | FromDiscord | <Elegantbeef> !eval import std/sequitls; countDown(10, 0).toSeq |
09:33:01 | FromDiscord | <retkid> if you start from a on the left |
09:33:02 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: cannot open file: std/sequitls |
09:33:07 | FromDiscord | <retkid> you can use its absolute value to go down |
09:33:07 | FromDiscord | <Elegantbeef> !eval import std/sequitls; echo countDown(10, 0).toSeq |
09:33:09 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: cannot open file: std/sequitls |
09:33:17 | FromDiscord | <Elegantbeef> god damn it |
09:33:25 | PMunch | !eval import std/sequtils; echo countDown(10, 0).toSeq |
09:33:27 | NimBot | @[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] |
09:33:28 | FromDiscord | <Elegantbeef> !eval import std/sequtils; countDown(10, 0).toSeq |
09:33:30 | NimBot | Compile failed: /playground/nim/lib/pure/collections/sequtils.nim(854, 7) Error: expression 'result`gensym0' is of type 'seq[int]' and has to be used (or discarded); start of expression here: /usercode/in.nim(1, 39) |
09:33:31 | FromDiscord | <Elegantbeef> There we go no more spam |
09:33:34 | FromDiscord | <retkid> for y in 10 .. 0:↵ echo 0 - y |
09:33:40 | FromDiscord | <retkid> (edit) "10" => "-10" |
09:33:44 | FromDiscord | <retkid> or something like that |
09:33:51 | FromDiscord | <Cypheriel> idk if I'd want to use `countDown`, though |
09:33:59 | FromDiscord | <Cypheriel> I kinda just want to do what I'd do in Python |
09:34:12 | FromDiscord | <Cypheriel> which is like `list(range(10, 0, -1))` |
09:34:18 | PMunch | @Elegantbeef, haha you seem to struggle a bit with getting your snippets to run properly :P |
09:34:19 | FromDiscord | <retkid> https://play.nim-lang.org/ |
09:34:22 | FromDiscord | <retkid> this makes stuff easier |
09:34:23 | FromDiscord | <Cypheriel> but where the step is variable |
09:34:33 | FromDiscord | <retkid> nim playground is really useful for visualizing this stuff imo |
09:34:54 | FromDiscord | <Elegantbeef> `toSeq(countDown(10, 0, -1))` |
09:34:58 | FromDiscord | <Elegantbeef> How is that any different? |
09:35:01 | PMunch | @Cypheriel, well then you have to write `range` for yourself |
09:35:12 | FromDiscord | <Rika> He probably wants a unified count down and up |
09:35:28 | PMunch | Which Nim doesn't have AFAIK |
09:35:31 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3HsE |
09:35:35 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3HsE" => "https://play.nim-lang.org/#ix=3HsF" |
09:35:41 | PMunch | I mean it's easy enough to write one |
09:35:41 | FromDiscord | <Cypheriel> :faint: |
09:35:56 | FromDiscord | <Cypheriel> I fear I've exhausted a fair majority of my brain power |
09:35:56 | FromDiscord | <Rika> I’ll be honest, I don’t know what reason there is to not have one |
09:35:59 | FromDiscord | <retkid> a lot of things nim is missing because nobody wants to actually sit down and do not fun things |
09:36:13 | FromDiscord | <retkid> like NLP is cool and all |
09:36:17 | FromDiscord | <retkid> but who wants to actually make one |
09:36:25 | FromDiscord | <Rika> A few probably do what to |
09:36:26 | FromDiscord | <Rika> Want |
09:36:35 | FromDiscord | <retkid> well fuck |
09:36:40 | PMunch | @Rika, no idea, I guess the rationale that `..` doesn't do it is that it means an extra check every time you want to do iteration over a range |
09:36:50 | FromDiscord | <Rika> We just don’t have the size to have those kinds of people |
09:37:01 | FromDiscord | <retkid> i mean, i kinda want to |
09:37:02 | FromDiscord | <retkid> but also |
09:37:04 | FromDiscord | <retkid> i really do not |
09:37:07 | FromDiscord | <Elegantbeef> Yea pmunch i think that's the reason |
09:37:13 | FromDiscord | <Rika> Then you are not that kind |
09:37:20 | FromDiscord | <Elegantbeef> This comes up every so often |
09:37:28 | FromDiscord | <Cypheriel> I spent probably like a good hour wondering why my stuff wasn't working, and then I eventually found out that my ranges converted to sequences broke if any step was negative and became empty |
09:37:57 | PMunch | But why there isn't a combined countup/countdown I have no idea, such a simple thing that really should just be included.. |
09:38:10 | FromDiscord | <retkid> it would be cool but learning everything about English grammar, figuring out a fast way to classify it, scraping thousands and thousands and thousands of websites, seems not fun |
09:38:17 | FromDiscord | <Cypheriel> Needless to say... I've spent a stupid amount of time echoing random things https://media.discordapp.net/attachments/371759389889003532/918436379782959104/Screenshot_20211209_023745.png |
09:38:19 | FromDiscord | <retkid> (edit) "would" => "wouldn't" |
09:38:30 | FromDiscord | <retkid> (edit) "wouldn't" => "would" |
09:38:35 | PMunch | I guess `countup` should probably have an `assert x > y` in it.. |
09:38:50 | FromDiscord | <Rika> I’d say it’s more common to expect .. to count both up and down than to expect it to be a bit quicker |
09:39:25 | FromDiscord | <Rika> In reply to @PMunch "I guess `countup` should": Then a lot of peoples code would break, some people depend on 0..0 being empty |
09:39:32 | PMunch | Hmm, but that would still exist in `-d:release`.. Is there an assert which is the opposite of doAssert? ie. one that only gets checked in debug mode? |
09:39:39 | FromDiscord | <Rika> I feel like I’ve encountered a lot of code that expects that |
09:39:45 | PMunch | >= then :P |
09:39:56 | PMunch | And 0..0 isn't empty, it's 0 |
09:39:58 | FromDiscord | <Rika> 0.. -1 as well |
09:40:02 | FromDiscord | <Rika> Yeah |
09:40:04 | PMunch | .. is inclusive ;) |
09:40:06 | FromDiscord | <Rika> I meant what I said |
09:40:09 | FromDiscord | <Elegantbeef> Well it'd also not be consistent |
09:40:16 | FromDiscord | <Cypheriel> so... what am I to do, then? |
09:40:22 | FromDiscord | <Cypheriel> surely I'm not to right my own range D: |
09:40:32 | FromDiscord | <Rika> If you want what you described |
09:40:35 | FromDiscord | <Rika> Then you write it |
09:40:36 | FromDiscord | <Elegantbeef> It takes all of 3 seconds |
09:40:50 | FromDiscord | <impbox [ftsf]> you could wait for someone else to write it |
09:40:53 | FromDiscord | <Rika> It’s just an if positive count up else count down |
09:41:01 | FromDiscord | <Cypheriel> I'm not sure where I'd even start... |
09:41:10 | FromDiscord | <Rika> In reply to @impbox "you could wait for": Probably that Python like library Yardanico wrote |
09:41:23 | FromDiscord | <Hamid_Bluri> take a look at `iterator`s |
09:41:24 | FromDiscord | <Rika> In reply to @Rika "It’s just an if": @Cypheriel it’s just this literally |
09:41:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HsJ |
09:41:52 | FromDiscord | <Cypheriel> what the |
09:41:58 | FromDiscord | <Rika> “What the” what? |
09:42:20 | FromDiscord | <Rika> You’ll have to assert that count is not 0 |
09:42:23 | FromDiscord | <Rika> At the start |
09:42:29 | FromDiscord | <Rika> Lest you explode |
09:42:30 | FromDiscord | <Elegantbeef> Also that you dont go over b |
09:42:43 | FromDiscord | <retkid> lol i found an npm package that used coffeescript |
09:42:52 | PMunch | @Cypheriel, something like this: https://play.nim-lang.org/#ix=3HsK |
09:42:57 | FromDiscord | <Cypheriel> In reply to @Rika "Lest you explode": I think my brain has already exploded |
09:43:07 | FromDiscord | <Rika> In reply to @retkid "lol i found an": Haha |
09:43:10 | FromDiscord | <Elegantbeef> There we go pmunch 😀 |
09:43:12 | PMunch | Or what @Elegantbeef posted :P |
09:43:22 | FromDiscord | <Elegantbeef> Well what i posted has 2 buhgs |
09:43:34 | FromDiscord | <Rika> When are we getting `yield from` |
09:43:37 | FromDiscord | <Hamid_Bluri> yes 2 buhgs |
09:43:50 | PMunch | @Rika, yield from? |
09:43:53 | FromDiscord | <Rika> In reply to @Rika "When are we getting": It would be nice if we had it… |
09:44:02 | PMunch | Ah, like yield everything from this iterator |
09:44:05 | FromDiscord | <Rika> Same thing as looping the iterator and yielding the result |
09:44:06 | FromDiscord | <Rika> Yes |
09:44:08 | FromDiscord | <Elegantbeef> should be `while i in min(a, b)..max(a.b)` and ensuring `count` != 0 |
09:44:14 | PMunch | Instead of having to write `for x in iter: yield x` |
09:44:18 | FromDiscord | <Rika> Yes |
09:44:19 | PMunch | That would be pretty neat |
09:44:38 | FromDiscord | <Elegantbeef> Not overly worth the effort in my view |
09:44:40 | FromDiscord | <Rika> Actually I think it could be a template |
09:45:10 | FromDiscord | <Cypheriel> oh hey. I understand now |
09:45:19 | FromDiscord | <Rika> Yeah it could just be a template with the for loop and yield thing hm |
09:45:19 | PMunch | If you call it `yieldFrom` it'd be easy to do as a template |
09:45:24 | FromDiscord | <Rika> Yeah |
09:45:29 | FromDiscord | <Elegantbeef> yep |
09:45:36 | FromDiscord | <Rika> And we already do that anyway (ala notIn) |
09:45:37 | FromDiscord | <impbox [ftsf]> the from sounds odd |
09:45:54 | FromDiscord | <Rika> Well you’re yielding the values from the iterator |
09:45:56 | FromDiscord | <Rika> So yield from |
09:46:03 | FromDiscord | <retkid> so apparently well written JS will surpass NIM's JS compiler by like 20 : 1 |
09:46:13 | FromDiscord | <impbox [ftsf]> makes me think of COMEFROM =p |
09:46:17 | FromDiscord | <Rika> No, you should turn optimisations on |
09:46:43 | FromDiscord | <retkid> you think i didn't compile with optimizations? thats a thing for JS? |
09:46:44 | FromDiscord | <Rika> Also again, Nim output is not optimised or aiming to be short |
09:46:53 | FromDiscord | <Rika> It is a thing for JS |
09:47:02 | FromDiscord | <impbox [ftsf]> compile with `-d:danger` |
09:47:02 | * | jjido joined #nim |
09:47:05 | FromDiscord | <retkid> yea |
09:47:12 | FromDiscord | <Elegantbeef> Nim's runtime checks and debug info is still included without `danger/release` |
09:47:18 | FromDiscord | <retkid> but i dont think it'll be as fast as the JS it seems kinda crazy |
09:47:18 | FromDiscord | <impbox [ftsf]> but yeah, i wouldn't be surprised if hand coded assembly or js is faster than nim generated code |
09:47:33 | PMunch | Something like this: https://play.nim-lang.org/#ix=3HsM |
09:47:34 | FromDiscord | <retkid> well the Assembly thing is expected |
09:47:38 | FromDiscord | <Rika> You can further optimise by directly using the js apis and not Nim’s shims for its own functions |
09:47:51 | FromDiscord | <Elegantbeef> Well the main issue afaik is that JS has advanced a bit so there are some things that could be changed to make it a bit faster |
09:47:56 | FromDiscord | <Rika> Yes |
09:48:03 | FromDiscord | <Rika> Nim is stuck in ES3 afaik |
09:48:06 | FromDiscord | <retkid> I don't think i can get faster than the original code, it seems really smoothe |
09:48:08 | FromDiscord | <retkid> (edit) "smoothe" => "smooth" |
09:48:28 | FromDiscord | <Elegantbeef> ftfy pmunch https://play.nim-lang.org/#ix=3HsN |
09:48:34 | FromDiscord | <retkid> look at that |
09:48:35 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3HsO |
09:48:41 | FromDiscord | <Cypheriel> oh gosh... I've just realized a problem |
09:48:56 | FromDiscord | <Cypheriel> since this new range isn't an actual range... I can't use it with tensor slicing |
09:49:08 | PMunch | @Elegantbeef, probably a good idea :P |
09:49:29 | FromDiscord | <Elegantbeef> Not really cause it sucks |
09:49:42 | PMunch | `iterable` sucks? |
09:49:42 | FromDiscord | <Elegantbeef> `[10]` cannot be used in place of iterable |
09:49:53 | FromDiscord | <Elegantbeef> Yea there are many issues with it imo |
09:50:08 | FromDiscord | <Elegantbeef> It's a good idea but badly implemented |
09:50:17 | FromDiscord | <Elegantbeef> You cannot pass iterators to iterators |
09:50:44 | FromDiscord | <Elegantbeef> Objects/collections that have `items/pairs` do not implicitly pass to them |
09:51:42 | FromDiscord | <retkid> holy shit |
09:51:45 | FromDiscord | <Elegantbeef> You cannot use it in a typeclass so `template doThing(a: int or iterable[int])` doesnt work for both `int` and an `iterable` |
09:51:56 | FromDiscord | <retkid> with -d:danger the code went from 1200 lines to 14 |
09:52:00 | FromDiscord | <retkid> this might be faster |
09:52:19 | FromDiscord | <Elegantbeef> Well Nim's js still has runtime checks |
09:52:21 | PMunch | Haha, might be :P |
09:52:27 | FromDiscord | <Elegantbeef> danger removes most them |
09:52:48 | PMunch | Danger sounds so ominous |
09:52:51 | madprops | is `something in someseq` as fast as `sometable.hasKey(somekey)` ? |
09:52:53 | FromDiscord | <retkid> compilers are magic |
09:52:56 | FromDiscord | <Elegantbeef> Suffice to say I like the idea of iterable but the implementation we have makes me sad |
09:52:57 | FromDiscord | <retkid> well its danger |
09:53:01 | PMunch | It's like we're expecting it to break :P |
09:53:15 | PMunch | madprops, nope, it's way slower |
09:53:17 | FromDiscord | <retkid> In reply to @Elegantbeef "Suffice to say I": whats wrong with iterable |
09:53:31 | FromDiscord | <Cypheriel> is it just me or are some of these error messages absolutely terrible |
09:53:41 | FromDiscord | <retkid> oh yea |
09:53:41 | FromDiscord | <Elegantbeef> retkid i just explained |
09:53:43 | FromDiscord | <retkid> tons of them suck |
09:53:48 | FromDiscord | <Elegantbeef> Some error messages do indeed suck |
09:54:03 | PMunch | `something in someseq` literally goes through the entire sequence and looks for your item. `sometable.hasKey(someKey)` hashes your key to a memory address and then looks it up directly to see if it exists. |
09:54:11 | FromDiscord | <retkid> well |
09:54:14 | PMunch | That's kinda the whole point with using tables |
09:54:16 | FromDiscord | <retkid> even if its flawed |
09:54:21 | FromDiscord | <retkid> i think its better we have them, then not |
09:54:47 | FromDiscord | <Elegantbeef> the table is O(1) the seq is O(n) |
09:54:52 | PMunch | @Cypheriel, some of them can be a bit confusing. But most of the time if you know the concepts at play they're pretty easy to read |
09:55:01 | FromDiscord | <Elegantbeef> Depending on the values/range you can use a bitset which is the best of both |
09:55:20 | FromDiscord | <Cypheriel> So apparently `count_down()` doesn't accept negative step... good to know, idk how I'd not expected that |
09:55:43 | PMunch | Oh yeah, if you only care about if it exists or not then a set is better than a table |
09:55:53 | FromDiscord | <Rika> Both count down and count up accept positives only |
09:56:13 | PMunch | @Cypheriel, how would a negative step work? |
09:56:32 | PMunch | You'd have to go all the way until the number wrapped round before you arrived at your destination.. |
09:56:34 | FromDiscord | <Cypheriel> It wouldn't, which is why I'm annoyed I didn't spot it sooner |
09:56:36 | FromDiscord | <Elegantbeef> You iterate backwards until you over/underflow |
09:56:38 | FromDiscord | <Elegantbeef> 😀 |
09:57:02 | FromDiscord | <Cypheriel> Praise the lord, I think I've finally got what I wanted |
09:57:17 | FromDiscord | <petsqui> when I write a macro that accepts some `Thing[T]` can I somehow extract the concrete type of T |
09:57:18 | PMunch | I wouldn't be the least bit surprised if I actually found something like that in an old C codebase @Elegantbeef :P |
09:57:22 | FromDiscord | <petsqui> (edit) "T" => "T?" |
09:57:29 | PMunch | @petsqui, yes |
09:57:34 | FromDiscord | <retkid> its still much slower but not as bad |
09:57:39 | FromDiscord | <retkid> the JS is just super optimized |
09:58:31 | FromDiscord | <Cypheriel> woo, praise. Fixing the range fixed my AoC solution |
09:58:35 | FromDiscord | <Cypheriel> I never wanna deal with that ever again |
09:58:44 | FromDiscord | <Elegantbeef> There you go petsqui |
09:58:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HsT |
09:58:54 | FromDiscord | <Elegantbeef> Yea cyph that was an issue i had for that day aswell |
09:59:03 | FromDiscord | <Elegantbeef> remembers he hasnt done AoC for a few days now |
10:00:16 | PMunch | @petsqui, https://play.nim-lang.org/#ix=3HsU |
10:00:32 | FromDiscord | <petsqui> In reply to @PMunch "<@325637384517713920>, https://play.nim-lang.org/#i": thank you! |
10:00:53 | FromDiscord | <Elegantbeef> Pmunch was slow on that one |
10:01:08 | PMunch | I'm rusty >_< |
10:01:15 | FromDiscord | <Elegantbeef> No this is nim |
10:01:28 | PMunch | I'm Nimmy? |
10:01:57 | FromDiscord | <Elegantbeef> Nah you're timmy |
10:03:40 | PMunch | Ugh, so many of my macros have broken with recent versions of Nim.. |
10:03:52 | FromDiscord | <Cypheriel> welp. sometimes I wonder if I'm a masochist for choosing to use Nim for things like Advent of Code |
10:04:06 | FromDiscord | <Cypheriel> There's a lot of cool stuff... but also a lot of... not-so-cool stuff |
10:04:08 | PMunch | Apparently notificatcher doesn't build on anything later than 1.2.6.. |
10:04:35 | FromDiscord | <Elegantbeef> I mean you made your problem harder than it was |
10:04:56 | PMunch | @Cypheriel, I think it's mostly a matter of knowing which tools you have available to you |
10:05:07 | FromDiscord | <Cypheriel> In reply to @Elegantbeef "I mean you made": I did? |
10:05:19 | FromDiscord | <Cypheriel> tbh I couldn't even comprehend my problem |
10:05:47 | FromDiscord | <Elegantbeef> Using tensors and other fancy stuff for that problem is self harm imo |
10:05:48 | PMunch | @Cypheriel, if you want to see how I solve them, and how little trouble I run into, you can check my solving on YouTube: https://www.youtube.com/playlist?list=PL9Yd0XwsGAqyd_lKcHm3f_nlE8vMdacV0 |
10:06:05 | PMunch | Wait, you're using tensors for AoC? |
10:06:10 | PMunch | Which day? |
10:06:26 | FromDiscord | <Cypheriel> 4 and 5 ._. |
10:06:44 | FromDiscord | <Cypheriel> I heard somebody talking about them and I thought maybe this was a good time to try and learn about that kind of stuff |
10:06:50 | FromDiscord | <Cypheriel> it was something I've wanted to learn anyways |
10:06:54 | FromDiscord | <Cypheriel> but eheh... |
10:07:00 | FromDiscord | <Elegantbeef> If you want to see less masochisitic approaches https://github.com/beef331/aoc2021 |
10:07:30 | PMunch | I think you might be the first person to use tensors to score bingo sheets :P |
10:07:40 | FromDiscord | <Cypheriel> LMAO |
10:07:52 | PMunch | But using AoC to learn new stuff is a good idea :) |
10:08:03 | FromDiscord | <Cypheriel> I... had a lot of trouble figuring out how to get the nth column of a matrix |
10:11:02 | FromDiscord | <Cypheriel> In reply to @Elegantbeef "If you want to": what on Earth. So much shorter than my solution... |
10:11:17 | FromDiscord | <Elegantbeef> How does he do it! |
10:11:35 | FromDiscord | <Cypheriel> My whole part two as 94 lines |
10:12:38 | FromDiscord | <Elegantbeef> My philosophy on programming is it's fun to work through problems but writing code sucks, so i try not to write a lot of code 😛 |
10:13:30 | FromDiscord | <Cypheriel> I mean me as well... but I keep feeling like "ugh, the only way I know to do this is the long way" |
10:15:07 | FromDiscord | <Elegantbeef> In the case of 4/5 i have a ton of experience with grids so it was basically 100% the usual for what i work with |
10:17:46 | FromDiscord | <Elegantbeef> Anyway i'm going to sleep, maybe i'll be interested in doing the day's i've missed, though the fish one had me going "Yep this is just a math solution i dont know" |
10:18:44 | FromDiscord | <Cypheriel> I should probably be heading to bed, as well... I stayed up trying to solve this darn puzzle. Thank y'all for the help and sharing some insight |
10:25:28 | * | src quit (Quit: Leaving) |
10:45:49 | * | dv2 joined #nim |
10:56:28 | FromDiscord | <gogolxdong (liuxiaodong)> What's the default gc of 1.6 |
11:01:19 | FromDiscord | <Yardanico> refc |
11:01:27 | FromDiscord | <Yardanico> it's been the default and is still the default |
11:01:35 | FromDiscord | <Yardanico> ORC is expected to become the default in nim 2.0 |
11:05:17 | FromDiscord | <Yardanico> https://github.com/nim-lang/RFCs/issues/437 for more info |
11:07:07 | FromDiscord | <gogolxdong (liuxiaodong)> ok, here is an error which not sure has business of swtiching arc/orc to default gc↵`C:\Users\root\nimcache\fight_r\@mfight.nim.c: In function 'claim_fight_6436':↵C:\Users\root\nimcache\fight_r\@mfight.nim.c:5169:72: error: redeclaration of 'fmtRes' with no linkage↵ 5169 | NimStringDesc fmtRes;` |
11:08:12 | FromDiscord | <gogolxdong (liuxiaodong)> I remembered it compiles before. |
11:08:17 | FromDiscord | <Yardanico> yeah, that's a Nim bug, are you using ARC/ORC or refc? |
11:08:42 | FromDiscord | <Yardanico> there has only been one similar issue with ARC but it's been closed since https://github.com/nim-lang/Nim/issues/13622 |
11:10:49 | FromDiscord | <gogolxdong (liuxiaodong)> yes, I'm using arc/orc and switched to default gc because websocket of nim-json-rpc has issues with arc/orc. |
11:11:38 | FromDiscord | <Yardanico> so is this bug with refc? |
11:11:54 | FromDiscord | <Yardanico> anyway, I don't think I can help much without the code to reproduce it :( |
11:23:24 | FromDiscord | <gogolxdong (liuxiaodong)> switch to default gc gives me this compile error, cps threadpool works but memory grow fast , not sure whether memory leaks. |
11:24:56 | FromDiscord | <gogolxdong (liuxiaodong)> use cps means unable to listen event using websocket of json-rpc-client. |
11:29:04 | FromDiscord | <gogolxdong (liuxiaodong)> listening on websocket is required now, I remember it worked before. Does nim has some change in these days? |
11:30:53 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:05:28 | FromDiscord | <geohuz> Hi, I'm trying to cross compile my web app using jester, and I use docker run --rm -v `pwd`:/usr/src/app -w /usr/src/app nimlang/nim "nimble install -y jester; nim c -r myapp.nim", I specified to install dependency package on the command line, is there any way to have a dependency list file so compileer can install them automatically ? |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:31 | * | supakeen joined #nim |
12:12:08 | PMunch | @geohuz, what I normally do is create a .nimble file that list the requirements, then either run `nimble build` to build my application, or `nimble install` a dummy package that is just a list of requirements. |
12:12:44 | PMunch | The latter is what I do to populate the playground with packages, but it really only makes sense if you want to build a docker image with a set of packages already installed. |
12:18:09 | FromDiscord | <geohuz> Ok, so I should use nimble init to create it and add dependenies in the file then run nimble build |
12:18:55 | FromDiscord | <geohuz> @PMunch , is it correct? |
12:19:09 | PMunch | Yes |
12:19:28 | FromDiscord | <geohuz> Ok, thanks! @PMunch |
12:19:29 | PMunch | You essentially want to create a Nimble project for your program, and then use Nimble to build it |
12:20:01 | arkanoid | I perfectly understand "prt UncheckedArray[T]", but what is "UncheckedArray[T]"? |
12:21:53 | PMunch | A piece of memory holding an unknown number of T |
12:25:21 | PMunch | arkanoid, you would typically use it for flexible array members in a struct: https://www.geeksforgeeks.org/flexible-array-members-structure-c/ |
12:27:28 | arkanoid | hm, ok |
12:31:22 | arkanoid | got it, it's spacer inside a struct |
12:32:02 | arkanoid | but it makes sizeof unreliable |
12:33:54 | PMunch | Yup |
12:34:05 | PMunch | And it's not really a spacer |
12:34:32 | PMunch | It makes a bit more sense if you come from C :P |
12:36:30 | PMunch | To get a pointer to a struct in C you typically call `malloc(sizeof(mystruct))` or similar. If you know that `mystruct` has a flexible array member with e.g. ints you could do `malloc(sizeof(mystruct) + 42 * sizeof(int))` to create a pointer to mystruct where the flexible member would now be able to hold 42 integers. |
12:37:39 | PMunch | If you now store the number 42 somewhere in that struct you can now do one pointer dereference and then directly be able to iterate over your data. |
12:37:40 | arkanoid | sure, that's what I mean with "spacer". Struct is now a piece of memory with non-fixed size |
12:37:51 | PMunch | Correct |
12:38:13 | PMunch | I thought you meant "spacer" as in "padding", but that is incorrect |
12:38:29 | arkanoid | is this the only way to build structs not 1:1 with its sizeof? |
12:38:44 | PMunch | Well.. |
12:38:55 | arkanoid | well, "only way", let me take it with a grain of salt |
12:39:05 | arkanoid | I know you can do everything |
12:39:14 | PMunch | I mean you can always malloc more or less memory than you actually need for a struct |
12:46:56 | arkanoid | Sure. Thanks for the info |
12:52:37 | * | Guest70 joined #nim |
12:53:10 | * | Guest70 quit (Client Quit) |
12:54:47 | NimEventer | New Nimble package! contractabi - ABI Encoding for Ethereum contracts, see https://github.com/status-im/nim-contract-abi |
13:27:42 | * | rockcavera joined #nim |
13:27:42 | * | rockcavera quit (Changing host) |
13:27:42 | * | rockcavera joined #nim |
13:58:35 | * | Guest461 joined #nim |
14:03:20 | * | u0_a185 quit (Read error: Connection reset by peer) |
14:07:23 | * | arkurious joined #nim |
14:19:49 | * | Guest461 quit (Quit: Client closed) |
16:28:09 | FromDiscord | <ajusa> Is there a way to force a library to use header files instead of dynamic linking? Or do I need to modify the library itself and make it use header files? |
16:29:02 | Amun-Ra | I don't quite get the question |
16:29:43 | FromDiscord | <IsaacPaul> huh? you link a library via dynamically or statically. Headers are kinda different for both. One has some sort of dll export, the other has functions without it |
16:29:44 | FromDiscord | <Yardanico> In reply to @ajusa "Is there a way": if you're talking about some wrapper, then yes, you need to modify it so it uses header files instead |
16:29:57 | FromDiscord | <Yardanico> if it's hardcoded to dynamic libs |
16:30:16 | Amun-Ra | you can either: use dynlib (loading library at runtime, may faile), use dynlib pragma (loading library at runtime (may not fail) or compile directly into binary |
16:30:21 | FromDiscord | <ajusa> Yup, https://github.com/nim-lang/sdl1/blob/master/src/sdl.nim seems to be hardcoded to dynlib. I'll want to change the dynlib to the header pragma then I assume. |
16:30:24 | Amun-Ra | fail* |
16:30:33 | FromDiscord | <Yardanico> In reply to @ajusa "Yup, https://github.com/nim-lang/sdl1/blob/master/s": any reason you'd want sdl1 specifically? |
16:30:35 | FromDiscord | <ajusa> 3ds |
16:30:37 | FromDiscord | <Yardanico> oh |
16:30:45 | FromDiscord | <ajusa> no dynamic libraries on that target either lol |
16:30:45 | FromDiscord | <IsaacPaul> nice |
16:31:02 | * | xet7 joined #nim |
16:31:11 | FromDiscord | <Yardanico> In reply to @ajusa "no dynamic libraries on": you really just have to change `dynlib: LibName` to header in proc definitions |
16:31:22 | FromDiscord | <Yardanico> assuming all object definitions are correct you don't really need to set `header` pragma for them |
16:32:13 | Amun-Ra | mhm |
16:33:12 | FromDiscord | <ajusa> In reply to @Yardanico "you really just have": Not quite sure what you mean? Don't I need to tell it which header to look for |
16:33:21 | FromDiscord | <Yardanico> In reply to @ajusa "Not quite sure what": well that's what I meant |
16:33:36 | FromDiscord | <Yardanico> you don't have to do much other than replacing the dynlib pragma with the header pragma pointing to the header |
16:33:40 | FromDiscord | <Yardanico> for proc declarations |
16:33:49 | FromDiscord | <ajusa> Ah I see what you meant now, yup we're on the same page |
16:49:26 | * | src joined #nim |
16:52:42 | * | terminalpusher joined #nim |
17:34:11 | FromDiscord | <Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=3HuP |
17:36:01 | FromDiscord | <Professor Actual Factual> (edit) "https://play.nim-lang.org/#ix=3HuP" => "https://play.nim-lang.org/#ix=3HuQ" |
17:40:38 | * | terminalpusher quit (Remote host closed the connection) |
17:41:14 | * | terminalpusher joined #nim |
17:44:09 | FromDiscord | <Clonkk> Difficult to says for sure without knowing the code, but I think it's when you try to do async operation using non-async socket |
17:44:42 | FromDiscord | <Clonkk> So look into https://nim-lang.org/docs/asyncdispatch.html |
17:46:04 | FromDiscord | <Clonkk> You can look into the async layer of the ZMQ bindings also https://github.com/nim-lang/nim-zmq/blob/master/zmq/asynczmq.nim |
17:46:33 | FromDiscord | <Clonkk> Where it takes a raw file descriptor and makes it into an AsyncSocket and register it in the dispatch loop |
17:47:04 | FromDiscord | <Clonkk> Not sure if that's what you're looking for, but from the error message it looks like raw socket operation failing into an async context \:) |
17:49:58 | FromDiscord | <Professor Actual Factual> Thank you for the link. Ya Im using a proprietary library from someone who claims its an async http client, I wonder if there is a bug on their code where like you said they are using a non-async socket. |
17:50:13 | FromDiscord | <Professor Actual Factual> (edit) "client," => "client library," |
17:50:39 | FromDiscord | <Clonkk> Maybe it's just not declared as async from Nim's perspective and that's why you get an error |
17:51:25 | FromDiscord | <Clonkk> Technically, an async dispatch loop written in pure C could achieve the functionality of an async http server but from Nim's `{.async.}` context not be seen as async ? |
17:52:27 | FromDiscord | <Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=3HuW |
17:53:04 | FromDiscord | <Clonkk> Are you sure mixing async and thread is a good idea ? |
17:53:15 | FromDiscord | <Professor Actual Factual> Thats the thing, this is just an experiment |
17:54:23 | FromDiscord | <Clonkk> Ah ok then you might be interested in https://github.com/yglukhov/asyncthreadpool |
17:54:26 | FromDiscord | <Professor Actual Factual> If i could get async multithreaded to work it would be what my client wants. First thread is Producer IO-bound, second thread is Consumer CPU-bound. I'd rather not mix the two, but I dont know of a better way |
17:54:48 | FromDiscord | <Clonkk> Which allows you to spawn function from a threadpool and return `Future[T]` variable |
17:59:37 | FromDiscord | <Clonkk> I would limit the scope of the async to their own thread and then use some messaging queue primitive for inter-thread communication. You can use channels (either built-ins or the more experimental https://github.com/nim-lang/threading ) or ZMQ to achieve this; I mention ZMQ because I4ve used extensively as an inter-process / inter-thread messaging queue (only downsize is necessity to copy data unless you're confortable handling raw shared |
18:02:58 | FromDiscord | <Professor Actual Factual> In reply to @Clonkk "I would limit the": I have looked into channels, but this is a latency-sensitive application, I'd rather not commit to copying. I can use it as a worst case scenario though. But I think you are correct in seperating the async stuff in one thread only. I currently did a greedy approach where I have all my procs (both async/sync) in a single object, which is what I'm passing to between these threads. |
18:04:07 | Zevv | PMunch: logs on the fire yet? |
18:06:48 | FromDiscord | <Clonkk> If I'm not mistaken, Nim's channels can send `ref` with --gc\:arc so no copy involved.ZMQ benefit is to use its patterns to easily distribute workload on multiple running thread but it usually does require to perform one copy of your data but - depending on your application - that may not represent a bottleneck.↵(@Professor Actual Factual) |
18:08:09 | FromDiscord | <Professor Actual Factual> In reply to @Clonkk "If I'm not mistaken,": Oh snap, can't believe I haven't thought of something that obvious lol, I am using ref objects so copy wouldn't be too bad. |
18:08:33 | FromDiscord | <Professor Actual Factual> I will try that tonight, hopefully it works |
18:09:02 | FromDiscord | <Professor Actual Factual> (edit) "works" => "works, thank you" |
18:09:04 | FromDiscord | <Clonkk> If oyu only have need for basic patterns, channels should suffice |
18:26:29 | NimEventer | New thread by Geohuz: Could not run program which compiling with static linked lib, see https://forum.nim-lang.org/t/8697 |
18:59:28 | * | xet7 quit (Quit: Leaving) |
19:06:59 | FromDiscord | <hmmm> yoyo how do I auto unroll some strings I have in a seq in a type object? |
19:07:18 | FromDiscord | <hmmm> don't tell me I can't I'm lazy 🤔 |
19:07:19 | FromDiscord | <IsaacPaul> what do you mean by unroll> |
19:07:44 | FromDiscord | <hmmm> I mean first element of string goes in first element of type object and so on |
19:07:50 | FromDiscord | <hmmm> of seq string |
19:08:08 | FromDiscord | <IsaacPaul> oh.. so you want to serialize an array of strings into an object |
19:08:12 | FromDiscord | <hmmm> YES! |
19:08:25 | FromDiscord | <hmmm> big brainy isaac computing the answer... |
19:08:27 | FromDiscord | <hmmm> tick tick tick |
19:09:22 | FromDiscord | <IsaacPaul> Honestly sounds like a terrible way to serialize objects. Is there a built-in solution that does what you want? idk |
19:09:30 | FromDiscord | <Mocha> Is there some way to access nimble package information from within the package, e.g. the version number/author? |
19:09:43 | FromDiscord | <hmmm> are you really telling me I can't? 😒 |
19:10:06 | * | jjido joined #nim |
19:10:13 | FromDiscord | <IsaacPaul> I'm saying idk, but I'm also saying that if you could you probably shouldn't... lol |
19:11:13 | FromDiscord | <hmmm> ok I think about it some more and will come back again 🤔 |
19:12:06 | FromDiscord | <IsaacPaul> (edit) "probably" => "_probably_" |
19:35:25 | Amun-Ra | hmm, I've found another bug in 1.6 |
19:42:44 | arkanoid | how can I wrap a static C function a.k.a. internal linkage? |
19:47:57 | FromDiscord | <pmunch> @hmmm\: pretty easy with a macro |
19:48:04 | FromDiscord | <pmunch> If you want to get your toes wet |
19:49:39 | arkanoid | PMunch: I'm facing another edge case with futhark where I'd like to import a function with internal linkage |
19:54:49 | * | averell quit (Quit: .) |
20:01:25 | FromDiscord | <hmmm> hmmm my toes are already frozen. Macros seems overkill for lowly me. I'm trying my hand at constructors but the more I go the more it seems a dumb way to go about it |
20:15:59 | FromDiscord | <nwilburn> Has anybody had any luck getting a statically compiled binary working on windows with HTTPS client support? My google-fu has not returned a whole lot of positive information about this |
20:20:05 | FromDiscord | <hmmm> my own personal google-fu says that if I get no results for "how to blabla python" it can't be done 🧐 |
20:20:53 | FromDiscord | <hmmm> but if it can be done in python there are very good chances you can do it nim 😃 |
20:21:56 | * | averell joined #nim |
20:22:53 | * | PMunch_ joined #nim |
20:24:41 | FromDiscord | <Recruit_main707> strictly speaking you can do anything even in brainfuck, if you hate yourself hard enough |
20:25:01 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
20:26:38 | * | PMunch quit (Killed (NickServ (GHOST command used by PMunch_))) |
20:26:39 | FromDiscord | <leorize> @nwilburn\: if you just want to ship the binary, you won't have a good time since nim's tls implementation requires a cacert.pem file in PATH or next to the executable |
20:26:43 | * | PMunch_ is now known as PMunch |
20:27:04 | * | PMunch_ joined #nim |
20:27:11 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3HvV |
20:27:17 | FromDiscord | <hmmm> it unpacks the seq into the vars |
20:28:27 | PMunch | New advent of code stream will be live in a couple of minutes :) |
20:28:40 | FromDiscord | <hmmm> go git them munchie! |
20:28:54 | FromDiscord | <hmmm> the yellow |
20:29:02 | FromDiscord | <nwilburn> In reply to @leorize "<@784085658292715520>\: if you just": 😦 ↵Honestly I just ignore SSL certs at the moment. When I was attempting to build windows it just failed completely which was disappointing. I can deal with proper cert management later, but was hoping that somebody has some experience with HTTPS + nim + windows and a single binary |
20:29:05 | * | neurocyte0132889 joined #nim |
20:29:05 | * | neurocyte0132889 quit (Changing host) |
20:29:05 | * | neurocyte0132889 joined #nim |
20:29:33 | PMunch | !eval let (a, b, c) = (100, 200, 300); echo b |
20:29:35 | NimBot | 200 |
20:29:38 | PMunch | Nim has that for tuple unpacking |
20:30:05 | FromDiscord | <leorize> @nwilburn\: `--dynlibOverrideAll`, then `--passL` your way to static openssl |
20:30:23 | FromDiscord | <Solitude> In reply to @hmmm "speaking of which, it": https://github.com/technicallyagd/unpack |
20:30:35 | FromDiscord | <nwilburn> hmm ok I'll play around with it. Thanks! |
20:32:47 | FromDiscord | <ni-max> sent a code paste, see https://play.nim-lang.org/#ix=3HvW |
20:33:13 | FromDiscord | <hmmm> my boi solitude that thingy looks like something that can work for me 🥳 |
20:38:01 | PMunch | Stream is live! https://www.twitch.tv/pmunche |
20:45:03 | * | NimBot joined #nim |
20:45:03 | * | neurocyte0132889 quit (Ping timeout: 265 seconds) |
20:48:13 | * | happycorsair[m] quit (Ping timeout: 250 seconds) |
20:49:31 | * | nixfreaknim[m] quit (Ping timeout: 250 seconds) |
20:50:38 | * | cheer[m] quit (Ping timeout: 268 seconds) |
20:53:04 | FromDiscord | <geekrelief> Is there an equivalent of `astGenRepr` for `PNode`? |
21:02:00 | * | krux02 joined #nim |
21:02:40 | * | cheer[m] joined #nim |
21:22:39 | * | nixfreaknim[m] joined #nim |
21:36:18 | arkanoid | PMunch: thanks! bye |
21:36:38 | PMunch | Thank you for watching :) |
21:36:38 | * | PMunch quit (Quit: leaving) |
21:38:28 | FromDiscord | <Elegantbeef> PNode means you're playing with the VM?↵(@geekrelief) |
21:40:15 | FromDiscord | <Elegantbeef> If so you can steal the code here though `parseObject` needs to be replaced, but havent been arsed yet https://github.com/beef331/nimscripter/blob/master/src/nimscripter/vmconversion.nim |
21:59:38 | * | vicfred joined #nim |
22:00:36 | * | terminalpusher quit (Remote host closed the connection) |
22:19:59 | * | happycorsair[m] joined #nim |
22:20:41 | arkanoid | I'm trying to run this line here https://github.com/SciNim/scinim/blob/a6f937ad7a78708333a93e51a1355035491090d7/scinim/numpyarrays.nim#L134 where T is int, I'm getting "numpyarrays.nim(134, 20) Error: cannot instantiate: 'T'". What does it mean? |
22:21:53 | arkanoid | is it because NumpyArray[T] type is not exported? |
22:22:04 | * | happycorsair[m] quit (Read error: Connection reset by peer) |
22:22:05 | * | nixfreaknim[m] quit (Write error: Connection reset by peer) |
22:22:07 | * | cheer[m] quit (Write error: Connection reset by peer) |
22:24:56 | * | cheer[m] joined #nim |
22:24:58 | arkanoid | found the problem, I have to use function(obj) instead of obj.function to don't get in the way of nimpy |
22:25:14 | * | happycorsair[m] joined #nim |
22:25:14 | * | nixfreaknim[m] joined #nim |
22:33:03 | FromDiscord | <Elegantbeef> arkanoid if you want to use a generic proc with method call syntax you need to do `obj.proc[: T]` |
22:33:51 | arkanoid | thanks! |
22:34:16 | FromDiscord | <Elegantbeef> This overrides the ambiguity |
22:42:14 | arkanoid | is there a way to get line by line the total heap size / memory consumption? |
22:42:54 | arkanoid | I'm gettings results by running valgrind after each edit but it's long and boring |
22:43:27 | FromDiscord | <Elegantbeef> Perhaps stepping through the program? I dont know though |
22:46:04 | FromDiscord | <geekrelief> In reply to @Elegantbeef "PNode means you're playing": I'm trying to fix an issue with nimterop where named nested unions aren't being renamed like they are in c2nim. |
22:47:16 | FromDiscord | <Elegantbeef> Ah then i dont know what to say |
22:48:06 | FromDiscord | <geekrelief> no worries, I'll try to muddle through it. Thanks. I'm hoping to get to use nimscripter soon. 👍 |
22:48:13 | * | nixfreaknim[m] quit (Quit: Client limit exceeded: 20000) |
22:49:12 | * | cheer[m] quit (Quit: Client limit exceeded: 20000) |
22:49:13 | * | nixfreaknim[m] joined #nim |
22:49:49 | * | happycorsair[m] quit (Quit: Client limit exceeded: 20000) |
23:05:50 | arkanoid | Elegantbeef, the `obj.proc[: T]` trick seems not working in my context |
23:06:03 | * | cheer[m] joined #nim |
23:06:03 | * | happycorsair[m] joined #nim |
23:06:09 | FromDiscord | <Elegantbeef> Code example? |
23:07:20 | arkanoid | let me reduce to min example |
23:09:15 | arkanoid | Elegantbeef: https://play.nim-lang.org/#ix=3Hx4 |
23:09:47 | FromDiscord | <Elegantbeef> Why are you accquoting the entire thing? |
23:10:12 | FromDiscord | <Elegantbeef> pyObj.toTensor0Copyint64 should work |
23:10:28 | FromDiscord | <Elegantbeef> God damn it matrix really destroyed that |
23:10:51 | FromDiscord | <Elegantbeef> Anyway drop the accquotes and it should work |
23:12:02 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Hx5 |
23:12:35 | FromDiscord | <Elegantbeef> The accquotes were just cause some chat clients can render codeblocks/lines and makes life lovely |
23:13:25 | arkanoid | haha, I tough the ` were part of the fix ^^". It is working with [: T] .... but why? |
23:13:41 | FromDiscord | <Elegantbeef> Like i said that overrides the ambiguity |
23:13:55 | FromDiscord | <Elegantbeef> `a.doThing[T]` is taken as `[T](a.doThing)` |
23:14:10 | arkanoid | I'm using IRC so everything is lovely, and by lovely I mean not even parsed |
23:14:19 | FromDiscord | <Elegantbeef> sorry `[](a.doThing, T)` |
23:14:37 | FromDiscord | <Elegantbeef> But `a.doThing[: T]` is `doThing[T](a)` |
23:14:43 | FromDiscord | <Elegantbeef> Oh i know how it is |
23:14:50 | FromDiscord | <Elegantbeef> It's shit, and anyone that says otherwise is a liar |
23:16:28 | arkanoid | possibly, yes, but it works nicely with ssh and tmux |
23:17:11 | FromDiscord | <Elegantbeef> Eh i'm just joking of course whatever works for you |
23:17:20 | FromDiscord | <Elegantbeef> I mean matrix even has TUI 😛 |
23:17:54 | arkanoid | I never explored martrix, don't even know the advantage. What has more than old irc? |
23:18:15 | arkanoid | for a programmer and the community he likes, I mean |
23:19:11 | FromDiscord | <Elegantbeef> It has more modern things like spaces which group channels together, it also has voip and file uploading(of course not that interesting to irc users) |
23:19:26 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:20:03 | FromDiscord | <Elegantbeef> Though there is only 1 on 1 voip implemented at the moment |
23:32:16 | arkanoid | Elegantbeef, interesting |
23:33:52 | arkanoid | there's no nim language in client filter list :( |
23:42:37 | FromDiscord | <Elegantbeef> Welcome to the world of tomorrow! |
23:43:13 | FromDiscord | <arkanoid> Damn, too many pixels! |
23:44:03 | FromDiscord | <Elegantbeef> What client are you using?\> |
23:44:47 | FromDiscord | <arkanoid> currently the web based @ element.io, not sure which one to pick, I went to the original. Thinking about trying weechat one \:P |
23:45:21 | FromDiscord | <Elegantbeef> But the code blocks! 😛 |
23:45:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Hxb |
23:46:18 | FromDiscord | <arkanoid> cool! how is done? `eval echo "foobar"` |
23:46:59 | FromDiscord | <Elegantbeef> It's 3 backticks for code blocks |
23:47:09 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#ix= |
23:47:14 | FromDiscord | <Elegantbeef> It's much like github MD |
23:47:25 | FromDiscord | <Elegantbeef> so you can specify a language after the first 3 ticks |
23:48:31 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#ix=3Hxc |
23:49:10 | FromDiscord | <Elegantbeef> There is an in development matrix sdk for Nim so Nim client soon TM |
23:49:49 | arkanoid | as a system administrator I am interested in setting up private server now |
23:50:37 | FromDiscord | <Elegantbeef> Aw shit you're now in the whole thing 😛 |
23:50:41 | arkanoid | status is sponsor of matrix? |
23:51:09 | FromDiscord | <Elegantbeef> Are they? |
23:51:20 | FromDiscord | <Elegantbeef> Interesting they are |
23:51:41 | arkanoid | are they using matrix as backend for the "im" part? |
23:52:30 | FromDiscord | <Elegantbeef> Doesnt seem they have a library for matrix so i assume not |
23:56:36 | arkanoid | in #<roomname>:<serverhost> does the <roomname> part remain contains across federated servers? |
23:56:46 | arkanoid | s/contains/costant |
23:56:51 | FromDiscord | <Elegantbeef> I believe so |
23:57:15 | arkanoid | feels strange to me, it means that a server may pollute all the others, I'd guess no |
23:57:39 | FromDiscord | <Elegantbeef> How does it pollute? |
23:57:54 | FromDiscord | <Elegantbeef> They're delimited by their host domain |
23:58:20 | arkanoid | manual says "Rooms are distributed and do not exist on any single server" |
23:59:41 | FromDiscord | <Elegantbeef> I think that's just talking about how communication works, afaik the host domain deliminates rooms, cause if i dont have a host domain in my "known rooms" how would another room interfere |