00:10:18 | FromDiscord | <sharpcdf> a proc that returns nothing is written as `proc asf(): void = ` right? |
00:10:27 | FromDiscord | <sharpcdf> i dont remember lol and i cant find it anywhere |
00:10:39 | FromDiscord | <Yardanico> In reply to @sharpcdf "a proc that returns": just `proc asf() = discard` |
00:10:51 | FromDiscord | <Yardanico> `void` can be used for an empty return type, but is not required, that's just legacy |
00:11:34 | FromDiscord | <sharpcdf> alright |
00:11:35 | FromDiscord | <sharpcdf> thanks |
00:11:45 | FromDiscord | <Yardanico> also parens are optional too if you have no arguments |
00:11:51 | FromDiscord | <Yardanico> so `proc asf = discard` is perfectly fine |
00:14:07 | FromDiscord | <sharpcdf> yea i know |
00:15:27 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3GPk |
00:15:52 | FromDiscord | <Yardanico> In reply to @sharpcdf "ive seen some examples": where is it "left out" ? |
00:16:01 | FromDiscord | <Yardanico> "discard" is like python's "pass", so just "do nothing" |
00:17:29 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3GPl |
00:17:37 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GPm |
00:17:38 | FromDiscord | <Yardanico> your first line won't compile |
00:17:39 | FromDiscord | <sharpcdf> and they just leave out hte discard |
00:17:45 | FromDiscord | <Yardanico> so if you want to have an empty proc you write "discard" |
00:17:49 | FromDiscord | <Yardanico> as the only thing inside of it |
00:17:57 | FromDiscord | <sharpcdf> In reply to @Yardanico "no, you must have": well of course, but im saying leaving out the discard |
00:18:05 | FromDiscord | <sharpcdf> In reply to @Yardanico "so if you want": ok, but what if im defining it there |
00:18:12 | FromDiscord | <sharpcdf> and adding stuff inside of it |
00:18:15 | FromDiscord | <Yardanico> ? |
00:18:16 | FromDiscord | <sharpcdf> instead of just declaring it |
00:18:19 | FromDiscord | <eqf0> I think `proc (x, y: int) {.closure.}` is a type, not a declaration |
00:18:30 | FromDiscord | <Yardanico> ah, if he's asking that, then yes |
00:18:36 | FromDiscord | <Yardanico> since it's just a procedure type, you don't need a body at all |
00:18:39 | FromDiscord | <sharpcdf> i think youre misunderstanding |
00:18:40 | FromDiscord | <Yardanico> hence you don't need = discard |
00:18:41 | FromDiscord | <sharpcdf> basically |
00:19:40 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3GPn |
00:19:54 | FromDiscord | <sharpcdf> not just declaring it |
00:19:56 | FromDiscord | <Yardanico> ahh, i think you misunderstood |
00:19:58 | FromDiscord | <sharpcdf> if it has a body |
00:20:02 | FromDiscord | <Yardanico> "discard" is _only_ for when you have an empty proc with no body |
00:20:06 | FromDiscord | <Yardanico> if you have a body, "discard" isn't needed |
00:20:08 | FromDiscord | <sharpcdf> ohhhh |
00:20:31 | FromDiscord | <sharpcdf> alright so when im defining a function with no return value i just dont add anything |
00:20:32 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GPo |
00:20:38 | FromDiscord | <sharpcdf> ohhhhhhhhhhhhhhhhhhh |
00:20:51 | FromDiscord | <sharpcdf> thanks lol |
00:20:51 | FromDiscord | <Yardanico> "discard" is a part of the procedure body, it's not a part of the procedure declaration |
00:21:30 | FromDiscord | <sharpcdf> alright that makes a ton more sense |
00:32:39 | * | src quit (Quit: Leaving) |
00:45:43 | FromDiscord | <huantian> Is there a way to get `split(string, sep, maxsplit)` return a tuple of length dependent on a static maxsplit?↵Or is that not a good idea |
00:49:10 | FromDiscord | <Yardanico> In reply to @huantian "Is there a way": and what happens if there are not enough elements? do you throw a runtime error? |
00:49:25 | FromDiscord | <Yardanico> also you can already have similar effect with normal split and unpack |
00:49:33 | FromDiscord | <Yardanico> https://github.com/Yardanico/nimpylib/blob/master/src/pylib/unpack.nim or https://github.com/technicallyagd/unpack or something similar |
00:49:50 | FromDiscord | <huantian> true |
00:50:21 | FromDiscord | <huantian> yeah that works |
01:07:30 | FromDiscord | <sharpcdf> can i link a html/css/javascript file with the link pragma? if so, how would i access it through the source file? |
01:23:54 | FromDiscord | <ynfle (ynfle)> I think `link` is for a c or cpp compiler |
01:23:58 | FromDiscord | <sharpcdf> nevermind, found `staticRead` |
01:24:02 | FromDiscord | <sharpcdf> yeai think so too |
01:24:06 | FromDiscord | <ynfle (ynfle)> What would it mean for html/css/javascript |
01:24:17 | FromDiscord | <ynfle (ynfle)> `link` isn't for linking to you nim program |
01:24:48 | FromDiscord | <sharpcdf> i was talking about embedding the files |
01:24:54 | FromDiscord | <sharpcdf> though linking did that |
01:24:57 | FromDiscord | <sharpcdf> but found staticRead |
01:25:12 | FromDiscord | <Elegantbeef> nah `link` is for linking libraries to your code |
01:36:10 | arkanoid | would nim leaders tell nim users if a large company would be using nim for a proprietary project? |
01:36:40 | FromDiscord | <Yardanico> ? |
01:36:40 | FromDiscord | <Rika> How would one know |
01:36:44 | FromDiscord | <Rika> It’s proprietary |
01:37:16 | arkanoid | well, support is a thing, they would receive requests probably |
01:37:29 | FromDiscord | <Rika> Requests for |
01:37:54 | arkanoid | fixing stuff, implement a language feature, who knows |
01:38:08 | arkanoid | stay alive and well |
01:38:54 | FromDiscord | <Rika> Large companies would probably opt to either fix it themselves or switch languages I assume |
01:39:04 | arkanoid | no |
01:39:32 | arkanoid | well, it depends on the concept of "large", but essentially no. They would send money and requests |
01:39:43 | FromDiscord | <Rika> Or they just wouldn’t disclose that they’re building an app or whatever els |
01:41:06 | arkanoid | well, so the anwer is "it depends" |
01:54:29 | FromDiscord | <sharpcdf> how do you create a file? |
01:56:12 | FromDiscord | <Elegantbeef> You can just do `open(fileName, fmWrite)` and close it after, you can open a `FileStream` you can do `writeFile(fileName, data)` |
01:56:22 | FromDiscord | <Elegantbeef> There are many ways to do it of course |
01:56:30 | FromDiscord | <sharpcdf> alright, thanks |
02:07:48 | FromDiscord | <sharpcdf> why is it erroring? this is the second time im trying to compile it and the first time it worked fine https://media.discordapp.net/attachments/371759389889003532/916148683978969148/unknown.png |
02:08:17 | FromDiscord | <sharpcdf> there was a file that the program created that i deleted afterwards, is that the problem? |
02:10:21 | * | neurocyte0132889 quit (Ping timeout: 256 seconds) |
02:11:50 | arkanoid | is move semantics sink param inferred, or I have to take care of it? |
02:12:58 | arkanoid | I'm listening to araq move semantics presentation at fosdem 2020, he said that it could be inferred somehow in the future. I'm the future now |
02:13:19 | * | stkrdknmibalz joined #nim |
02:17:32 | FromDiscord | <Yardanico> In reply to @arkanoid "I'm listening to araq": there is a feature like that, but it's turned off by default because it was causing type incompatibility in some cases where you have proc types |
02:17:34 | FromDiscord | <Yardanico> --sinkInference |
02:18:34 | FromDiscord | <Yardanico> you can try compiling with --sinkInference:on , if it works - cool, (a bit of) free performance :P |
02:18:37 | FromDiscord | <Yardanico> for your program that is |
02:21:12 | arkanoid | Yardanico: but what about arc? Benchmark of arc on code without any sink/lent annotation follows the presentation of sink/lent, like if it is already inferred with arc |
02:21:29 | FromDiscord | <Yardanico> wdym "what about arc"? |
02:21:33 | FromDiscord | <Yardanico> sinkInference is specific to arc/orc |
02:22:15 | FromDiscord | <leorize> wasn't a part of the issue with --sinkInference is that it doesn't play nice with closures and can cause memory corruption for those? |
02:22:23 | arkanoid | oh, ok. So I expect it to be turned on for that example |
02:22:37 | FromDiscord | <Yardanico> @leorize don't remember the memory corruption issues |
02:22:45 | FromDiscord | <Yardanico> but there are problems with type compatibility with closures, yes |
02:23:22 | FromDiscord | <leorize> sink is probably the weirdest feature in the language |
02:23:29 | FromDiscord | <Yardanico> why? |
02:23:36 | FromDiscord | <Yardanico> i think it makes sense actually |
02:23:48 | * | neurocyte0132889 joined #nim |
02:23:49 | * | neurocyte0132889 quit (Changing host) |
02:23:49 | * | neurocyte0132889 joined #nim |
02:23:55 | FromDiscord | <leorize> the only thing it said is "should be moved" and not "must be moved" |
02:24:39 | FromDiscord | <Yardanico> i mean, it's just that we don't have good --sinkInference so we have to use it explicitly |
02:24:42 | FromDiscord | <leorize> effectively rendering it to be an optimization (a bad one, even) rather than a constraint |
02:24:54 | FromDiscord | <Yardanico> with sinkInference by default it'll be there for everyone but you won't have to annotate your code with "sink" |
02:25:12 | FromDiscord | <Yardanico> it's a bit weird as of now when you need to annotate it manually, yes |
02:25:45 | arkanoid | in the talk araq says that badly inserted sink/lent won't make any instability/crash but maybe just make program slower |
02:32:20 | arkanoid | --sinkInference is default ON according to manual |
02:32:44 | FromDiscord | <leorize> iirc its only on for the stdlib |
02:32:48 | FromDiscord | <leorize> but that might have changed |
02:33:43 | arkanoid | OK. Very interesting subject though. Would like to read mode about this |
02:34:31 | FromDiscord | <Yardanico> In reply to @leorize "iirc its only on": yeah https://github.com/nim-lang/Nim/blob/devel/lib/system/inclrtl.nim#L51 |
02:34:35 | FromDiscord | <leorize> looks like its still off-by-default |
02:34:42 | FromDiscord | <leorize> except for stdlib |
02:34:51 | FromDiscord | <Yardanico> In reply to @leorize "looks like its still": well, not "still" |
02:35:00 | FromDiscord | <Yardanico> it was on by default for some time in the past :) |
02:35:19 | FromDiscord | <leorize> I mean, in the context of a release, then it hasn't been on since its introduction in 1.2.0 |
02:37:15 | arkanoid | so I can expect move semantics to work full speed when calling stdlib procs, but I have to setup sink and lent for my own procs |
02:45:24 | FromDiscord | <Elegantbeef> Most stdlib procs are annotated |
03:10:28 | arkanoid | Nimporter readme: possible benefits: "doesn't require nim compiler", dependencies "nim compiler". I'm confused |
03:13:07 | FromDiscord | <Yardanico> In reply to @arkanoid "Nimporter readme: possible benefits:": i guess the former is about already-published packages |
03:13:15 | FromDiscord | <Yardanico> and dependencies is for the developers (not end users) of the libraries |
03:13:33 | FromDiscord | <Yardanico> so basically you can publish binary wheels to pypi and no need for nim compiler i guess |
03:13:46 | arkanoid | well, that's obvious |
03:13:49 | FromDiscord | <Yardanico> but then idk about "on import"... |
03:13:53 | arkanoid | ok ok, btw got it |
03:30:35 | arkanoid | damn vscode and nim will always be worst enemies |
03:30:56 | arkanoid | I keep have to restart it to get autocompletion/suggestions |
03:31:48 | arkanoid | no matter which of the two main extensions I activate, ctrl+space stays in "loading ..." forever, until I restart "code ." |
03:34:44 | arkanoid | also basic stuff like "detect indentation" doesn't work. I still have to manually change from 4 to 2 and back manually according if I'm writing a py or nim file |
03:36:54 | arkanoid | ps -ae | grep nimsuggest shows it not running |
03:37:25 | FromDiscord | <evoalg> hate's a strong word, but I hate vscode |
03:38:25 | FromDiscord | <Elegantbeef> And it hates you! |
03:38:31 | FromDiscord | <Rika> I hate you beef |
03:38:32 | FromDiscord | <Rika> Smh |
03:38:39 | FromDiscord | <Elegantbeef> Everyone already knows that |
03:41:11 | FromDiscord | <evoalg> you young people ... only being able to show affection though mocking each other |
03:41:16 | arkanoid | I want to debug this, but I don't know where to start. Well, nimsuggest is not running, and that's a strong evidence that something is wrong |
03:41:52 | FromDiscord | <Elegantbeef> Open up the output tab and look at the nim extension output |
03:42:17 | FromDiscord | <Elegantbeef> If that doesnt work you may want clone the extension and build it from source to be able to debug it easier |
03:42:28 | arkanoid | it just says "2021-0011-05 04:0039:06.000306 - [info] Extension Activated" |
03:42:30 | arkanoid | and that's it |
03:43:06 | FromDiscord | <Rika> Can the program access Nim? |
03:43:13 | FromDiscord | <Rika> Like in vscode |
03:43:48 | arkanoid | what do you mean? if nim toolchain is in path? yes it is, I can run nim/nimble/nimsuggest in vscode terminal window |
03:51:44 | * | arkurious quit (Quit: Leaving) |
03:54:51 | arkanoid | I've opened a but, hopefully I can get some info about how to debug this. Log is just silent/stuck |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:19:39 | * | tiorock joined #nim |
04:19:39 | * | tiorock quit (Changing host) |
04:19:39 | * | tiorock joined #nim |
04:19:39 | * | rockcavera is now known as Guest3752 |
04:19:39 | * | tiorock is now known as rockcavera |
04:22:29 | arkanoid | got what happened. After moving from codium to ms vscode, latest workspace settings "drifted" into user settings, and I had wrong nim.projects settings |
04:23:11 | * | Guest3752 quit (Ping timeout: 252 seconds) |
04:34:52 | * | noeontheend joined #nim |
04:58:12 | nrds | <Prestige99> Is there an objectively "best" ui framework in Nim that runs on Linux? I was thinking of using the old gtk wrapper, unsure if there are better alternatives |
04:58:48 | FromDiscord | <leorize> all ui libs suck, unfortunately |
04:59:02 | FromDiscord | <leorize> gintro does work really well if you target linux, though |
04:59:31 | arkanoid | Rika, I did my benchmarks with this https://play.nim-lang.org/#ix=3GN2, and python seems 3x slower (209ms vs 589ms per loop). There are probably two elefants in the room: nimpy on and --d:debug |
04:59:51 | arkanoid | sorry, I meant the opposite. Nim seems 3x slower |
05:00:05 | FromDiscord | <Rika> Turn debug off then |
05:00:07 | FromDiscord | <Elegantbeef> Why are you benching with `-d:debug`? |
05:00:24 | FromDiscord | <Rika> And why Nimpy? |
05:00:51 | nrds | <Prestige99> Thanks leorize |
05:02:58 | arkanoid | Rika, when I sent you this piece of python, for simplicity I omitted last line and changed return type. What the python real function really do is "return pd.DataFrame(data=rows, columns=cols) if len(rows) > 0 else None", so on the nim side it is "return if len(rows) > 0: pd.DataFrame(data = rows, columns = cols) else: nil" and return type PyObject |
05:03:34 | arkanoid | it wotks, but probably doing more copies than python<>pandas |
05:03:40 | arkanoid | not sure though |
05:03:45 | FromDiscord | <Rika> Yes |
05:03:47 | FromDiscord | <Rika> Likely |
05:12:28 | arkanoid | Rika, with release and arc it went python 236ms vs nim 270ms |
05:12:47 | arkanoid | next test would be to just return list of lists to python and avoid pandas on the nim side |
05:12:49 | FromDiscord | <Yardanico> try -d:danger also |
05:15:20 | arkanoid | with danger is 224ms vs 255ms |
05:16:09 | FromDiscord | <Yardanico> also you can try lto :P |
05:16:15 | FromDiscord | <Yardanico> --passC:"-flto" --passL:"-flto" |
05:17:18 | arkanoid | sure. Also this is the nim code I'm using https://play.nim-lang.org/#ix=3GQe |
05:17:31 | arkanoid | I algo guess theres seq allocation to optimize |
05:18:05 | FromDiscord | <Rika> If you know the sizes beforehand yes |
05:19:39 | arkanoid | with lfto is 220ms vs 254ms, no changes |
05:20:14 | arkanoid | second run 220 vs 243 |
05:20:48 | arkanoid | well, it's near, but python yet faster. Surely there's nimpy in the middle, but not sure if it's doing copies or not |
05:21:13 | arkanoid | Rika, no I don't know the number of parsed lines beforehand |
05:22:14 | arkanoid | actually this is the code with imports: https://play.nim-lang.org/#ix=3GQf |
05:24:28 | arkanoid | by making column list a const now is 233 vs 237 :P |
05:24:58 | arkanoid | but there are fluctuations. not sure if %timeit is the right way to benchmark |
05:25:17 | FromDiscord | <Yardanico> @arkanoid also the python version is better optimized |
05:25:38 | arkanoid | is it? |
05:25:40 | FromDiscord | <Yardanico> list comprehensions don't need temporary lists, but in `line.split('|').mapIt(it.strip())` they are needed |
05:25:51 | FromDiscord | <Yardanico> compared to `[ll.strip() for ll in line.split(",")]` |
05:26:17 | FromDiscord | <Yardanico> hm |
05:26:25 | FromDiscord | <Yardanico> well anyway, they're close enough :) |
05:26:31 | arkanoid | would zeero-function keep the game going? |
05:26:36 | FromDiscord | <Yardanico> yes |
05:27:15 | arkanoid | sure! they are. Would be nice to know if this way to create and pass PyObject does imply more copies that in pure python |
05:27:31 | arkanoid | I'm actually "lending" PyObject here |
05:28:26 | arkanoid | or is it "lenting"? whatever |
05:30:46 | FromDiscord | <Cypheriel> do I smell nimpy |
05:31:43 | arkanoid | sure, that's the elephant in the room |
05:32:51 | FromDiscord | <Cypheriel> Nimpy's cool, but there's a lot that utterly confuses me ¯\_(ツ)_/¯ |
05:32:54 | FromDiscord | <Yardanico> huh? |
05:32:57 | FromDiscord | <Yardanico> it's pretty simple |
05:33:02 | FromDiscord | <Cypheriel> I could not for the life of me get it to work with a virtual environment |
05:33:03 | FromDiscord | <Yardanico> it's a really high level cpython api wrapper |
05:33:18 | FromDiscord | <Cypheriel> and I didn't feel super comfortable using my system interpreter |
05:33:43 | FromDiscord | <Yardanico> have you seen https://github.com/yglukhov/nimpy/issues/152 and https://github.com/yglukhov/nimpy/issues/171 ? |
05:34:11 | arkanoid | replaced sequtils with zero functional, let's check who wins now |
05:34:36 | FromDiscord | <Cypheriel> I've not seen them, but now that I have... I think I'm even more confused |
05:35:16 | arkanoid | 'line' is of type <lent string> which cannot be captured as it would violate memory safety |
05:36:39 | arkanoid | Cypheriel, I use nimpy in a venv all the time. It just picks the python in your path, so an activated venv just works |
05:36:51 | FromDiscord | <Cypheriel> hm... it did not work that way for me |
05:37:14 | FromDiscord | <Cypheriel> I even used some uh... `nim-install` PyPi package |
05:37:27 | arkanoid | but I've also tried wild experiments, like building python on my own and link dyn link to it but also tried static linking for full. It worked out every time |
05:38:10 | FromDiscord | <Cypheriel> Well, I'm not exactly experienced with Nim or anything really of this specific nature, so I could definitely see the problem just being my inexperience |
05:38:26 | arkanoid | nimble init fooproj; cd fooproj; python3 -m venv venv; ./venv/bin/activate |
05:38:42 | FromDiscord | <Cypheriel> yeah... it just didn't work that way for me |
05:39:04 | FromDiscord | <Cypheriel> it'd also use my system Python even if I had something like 3.10.0 as my global interpreter from `pyenv` |
05:39:36 | FromDiscord | <Cypheriel> I did some testing just with echoing `py_import("platform").python_version` |
05:39:40 | arkanoid | if you run "type python" once you are into your venv, what do you see? |
05:40:14 | FromDiscord | <Cypheriel> well, I'm not on Linux atm, but when I'd do `where python` and `where python3`, it'd be the Python from my venv |
05:40:27 | FromDiscord | <Cypheriel> `python -V` and etc would confirm it |
05:40:45 | FromDiscord | <Cypheriel> but when I'd execute my nim code, it'd say 3.8 |
05:40:51 | FromDiscord | <Cypheriel> (edit) "nim" => "Nim" |
05:41:22 | FromDiscord | <Cypheriel> (edit) "but when I'd execute my Nim code, it'd say 3.8 ... " added "(via platform.python_version + local modules could not be found)" |
05:45:02 | arkanoid | Cypheriel, as last resort, try pyInitLibPath https://play.nim-lang.org/#ix=3GQh |
05:45:14 | arkanoid | this is what I use to load custom compiled python in random dir |
05:46:17 | arkanoid | back to my optimization game: "for line in data.splitLines --> filter(it.strip.len > 0):" results in "NimCompileException: 'line' is of type <lent string> which cannot be captured as it would violate memory safety". Do you know why? |
05:48:59 | * | noeontheend quit (Ping timeout: 252 seconds) |
05:54:51 | arkanoid | with zero functional is actually slower than with sequtils, now python 232ms vs nim 263ms |
05:57:01 | arkanoid | this is the current nim version, do you see other room for improvements? https://play.nim-lang.org/#ix=3GQl |
05:57:46 | FromDiscord | <Yardanico> well i think it might've gotten slower because you added a closure procedure |
05:57:57 | * | rockcavera quit (Remote host closed the connection) |
05:58:40 | arkanoid | actually, yes, let me rethink |
05:58:52 | FromDiscord | <Yardanico> you can make both your python version and nim version a bit faster by iterating line-by-line instead of getting the whole list of lines |
06:00:17 | arkanoid | Yardanico, the python version is already doing that |
06:00:48 | FromDiscord | <Yardanico> is it? |
06:01:05 | FromDiscord | <Yardanico> you do `[ll for ll in data.splitlines() if ll and ll.strip()]` so you still create the whole list |
06:01:11 | arkanoid | for x in (line for line in data.splitlines() if line and line.strip()): |
06:01:17 | FromDiscord | <Yardanico> ah, yeah, this way yes |
06:01:36 | arkanoid | that's old code, I've been optimizing it after Rika suggestion |
06:01:46 | arkanoid | I've just make the nim code without closure |
06:01:53 | FromDiscord | <Yardanico> well it's hard to say anything if I can't test it myself and you modify the code :P |
06:02:55 | arkanoid | zero_functional without closure: https://play.nim-lang.org/#ix=3GQp |
06:08:30 | arkanoid | I've incremented the benchmark time to have more consistent results (now is %timeit -n 10). I'm getting python 286ms nim 321ms |
06:09:15 | arkanoid | this with arc, danger, lfto and zero_functional. Python can be quite surprising |
06:09:42 | FromDiscord | <Cypheriel> I suppose it's time to reboot my computer and see if I can get nimpy working in a venv |
06:09:50 | FromDiscord | <Cypheriel> but do I really wanna reinstall VSCode \😔 |
06:10:07 | arkanoid | what's the connection between the two? |
06:10:36 | FromDiscord | <Cypheriel> It's really the only editor I can sanely use with Nim, without having to tackle something like vim or emacs |
06:10:43 | arkanoid | fyi, I'm working with nim + nimpy + nimterop + vscode + python + venv right now, with all static checkers running |
06:11:17 | FromDiscord | <Cypheriel> I've never really had a good time with VSCode... I find configuring it to be quite the pain, and everything ends up feeling quite "hacky" |
06:11:27 | FromDiscord | <Rika> It’s only surprising because you’re going from Python to Nim to Python I would say |
06:11:51 | arkanoid | if vscode feels hacky, try real visual studio. 4x more options |
06:12:01 | FromDiscord | <Yardanico> In reply to @arkanoid "if vscode feels hacky,": no nim support :) |
06:12:12 | FromDiscord | <Cypheriel> Visual Studio on Linux would be quite the feat |
06:12:17 | FromDiscord | <Yardanico> i mean no proper autosuggest plugin, there is probably syntax highlighting though |
06:12:53 | FromDiscord | <Cypheriel> I've been thinking about learning something like emacs purely for Nim |
06:13:05 | FromDiscord | <Cypheriel> just because I'd feel like I'm the one in control of things |
06:13:18 | arkanoid | I jump between vscode and neovim (actually spacevim) quite happily |
06:14:01 | FromDiscord | <Rika> I learned neovim “for Nim” |
06:14:06 | FromDiscord | <Cypheriel> I've always tried learning vim/emacs but... I get fairly overwhelmed quite quickly |
06:14:14 | FromDiscord | <Cypheriel> In reply to @Rika "I learned neovim “for": "neonim" 😔 |
06:14:19 | FromDiscord | <Rika> Lol |
06:14:42 | FromDiscord | <Rika> I did the “learn advanced stuff along the way” so I only know some of the basic commands by heart |
06:15:11 | FromDiscord | <Rika> If you asked me what a letter did in command mode I would have prolly a 50% chance of knowing |
06:16:13 | FromDiscord | <Cypheriel> I mean things like doom emacs seem pretty cool, but it's pretty tough getting past the learning curve |
06:17:15 | FromDiscord | <Cypheriel> also tbh there's like so many different Nim extensions for VSCode, I'd never even know if I'm using the right one |
06:17:24 | FromDiscord | <Rika> While not knowing if you will like it or not yeah I get it |
06:17:44 | FromDiscord | <Cypheriel> God only knows what an "LSP" is, too lol |
06:17:48 | FromDiscord | <Rika> Imagine spending a few hours learning something just to know if you’ll like it or not |
06:18:08 | FromDiscord | <Cypheriel> in fairness, I'm kind of the same way with Nim as a language |
06:18:20 | arkanoid | I've repeated the benchmark removing pandas from the picture. Now function returns seq[seq[string]] (List[List[str]]]), and now nim shines |
06:18:52 | FromDiscord | <Rika> Well yeah |
06:18:59 | arkanoid | python 255ms, nim 152ms |
06:19:05 | FromDiscord | <Rika> Not much better huh |
06:19:11 | FromDiscord | <Rika> I mean I guess it is “much” better |
06:19:41 | arkanoid | well, I was expecting more advantage in my opinion |
06:20:22 | arkanoid | but numbers are consistent, nim is 1.75x faster than python in this context |
06:22:00 | arkanoid | but to make this result, I had to turn the solution to zero_functional and make the code somehow harder to read than python |
06:22:38 | FromDiscord | <Rika> Nim does need better iterator libraries I guess |
06:22:39 | FromDiscord | <Yardanico> what if you don't use zero functional but have a normal iterator ? |
06:22:41 | arkanoid | so it's a fair result. Python and Nim are both good here. I'll stay on python as it seems that it has no overhead in returning a List[List[str]]] or a pd.Dataframe of that table |
06:22:55 | FromDiscord | <Yardanico> sure it's "more" code visually, but not really |
06:23:12 | FromDiscord | <Rika> Always an overhead somewhere by crossing interpreter boundaries |
06:23:32 | FromDiscord | <Yardanico> In reply to @Rika "Always an overhead somewhere": nonono he is benchmarking pure nim vs pure python right now |
06:23:38 | FromDiscord | <Yardanico> i think |
06:23:40 | FromDiscord | <Rika> Really? |
06:23:44 | FromDiscord | <Yardanico> yes |
06:23:53 | FromDiscord | <Yardanico> "I've repeated the benchmark removing pandas from the picture. Now function returns seq[seq[string]] (List[List[str]]]), and now nim shines" |
06:24:02 | FromDiscord | <Rika> In reply to @arkanoid "so it's a fair": Well I meant to say that against the last statement here |
06:24:11 | FromDiscord | <Yardanico> @arkanoid can you share the input data and whatever nim code you have now? |
06:24:17 | FromDiscord | <Yardanico> i'm a bit bored anyway, so i might as well tinker with it |
06:24:26 | FromDiscord | <Yardanico> or just tell me how to generate "similar" data |
06:25:04 | arkanoid | Yardanico, nope. I've a python function, and I've a nim function with {.exportpy.} that I compile to .so and I run from python next to the python one. It's a benchmark comparison where nimpy is part of the game and nim is the guest |
06:25:14 | FromDiscord | <Yardanico> oh |
06:25:33 | FromDiscord | <Yardanico> then yeah rika is right and the results are actually good :) |
06:26:24 | arkanoid | that was to test if it was worth replacing python function with nim ones, and the answer is "yes but only if you exchange base types" or something like that |
06:28:22 | * | recreation joined #nim |
06:29:39 | arkanoid | Yardanico: I'm getting more "'line' is of type <lent string> which cannot be captured as it would violate memory safety" if I try hybrid sequtils & zero_functional approach where outer loop is sequtil and inner stuff is zero_functional |
06:29:58 | FromDiscord | <Rika> Can you not do hybrid? |
06:30:25 | arkanoid | sure, it was full zero_functional. I was trying to follow Yardanico |
06:31:08 | arkanoid | Rika, this is the full zero_functional version https://play.nim-lang.org/#ix=3GQp |
06:31:34 | arkanoid | but instead of returning the pd.Dataframe, I now return "rows" directly |
06:32:33 | arkanoid | like here: https://play.nim-lang.org/#ix=3GQt |
06:33:08 | FromDiscord | <Rika> Is it slower? |
06:33:23 | arkanoid | and this is actually faster than python returning same List[List[str]]], even crossing the border |
06:33:52 | FromDiscord | <Rika> Pandas might just be well optimised I guess |
06:35:13 | arkanoid | yes, it seems like it has zero cost creation. Returning List[List[str]]] or returning pd.Dataframe made from same rows from python function results in same benchmark time |
06:38:42 | arkanoid | well, this is surprising. Converting the List[List[str]]] on the python side to pd.Dataframe results to zero overhead for the python version but huge overhead to the nim version, even if already on the python side. Now I'm back to python 280ms vs nim 322ms |
06:41:41 | FromDiscord | <Yardanico> is it surprising though? |
06:43:24 | arkanoid | Yardanico, well, yes: https://play.nim-lang.org/#ix=3GQw |
06:44:10 | FromDiscord | <Yardanico> hmmm |
06:44:23 | FromDiscord | <Yardanico> just to be safe, you check that both nim and python give same values, right? |
06:44:32 | arkanoid | yes they do |
06:44:36 | arkanoid | just checked now |
06:44:37 | FromDiscord | <Yardanico> weird then |
06:45:50 | arkanoid | fyi the final result is a 16970 rows × 26 columns table |
06:53:52 | * | xet7 quit (Remote host closed the connection) |
07:00:17 | FromDiscord | <Cypheriel> So... is there a specific extension I should get for VSCode? |
07:00:20 | FromDiscord | <Cypheriel> for Nim, I mean |
07:02:24 | FromDiscord | <Cypheriel> I would think it's <https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode>, but I'm not totally sure |
07:03:15 | arkanoid | Yardanico: I've opened an issue on nimpy's github to talk about it. It might be something relevant as nim <- data science -> python is a hot topic |
07:14:11 | FromDiscord | <Hamid Bluri> hey, i have an issue with collect macro https://media.discordapp.net/attachments/371759389889003532/916225786648875019/unknown.png |
07:14:55 | FromDiscord | <Hamid Bluri> the result of collect macro can't be passed as function paramter directly |
07:15:11 | FromDiscord | <Hamid Bluri> (edit) "collect" => "`collect`" | "paramter" => "parameter" |
07:15:51 | FromDiscord | <Rika> Parenthesise the collect |
07:16:53 | FromDiscord | <Hamid Bluri> pure pars without function call 😵💫 https://media.discordapp.net/attachments/371759389889003532/916226463575982120/unknown.png |
07:17:42 | FromDiscord | <Hamid Bluri> should i open an issue or there is something i dont' know about nim 😕 |
07:18:03 | FromDiscord | <Cypheriel> I don't think that's what they meant lol |
07:18:06 | FromDiscord | <Rika> Isn’t there a parameter after collect like newSeq or is that optional |
07:18:11 | FromDiscord | <Rika> It is what I meant |
07:18:17 | FromDiscord | <Hamid Bluri> In reply to @Rika "Isn’t there a parameter": it's optional |
07:18:26 | FromDiscord | <Cypheriel> right... in that case, I'm completely clueless as to how Nim works |
07:18:35 | FromDiscord | <Cypheriel> that is some cursed looking syntax lol |
07:19:12 | FromDiscord | <Hamid Bluri> In reply to @Rika "Isn’t there a parameter": https://media.discordapp.net/attachments/371759389889003532/916227048983388169/unknown.png |
07:19:48 | FromDiscord | <Rika> I don’t know anymore really |
07:19:56 | FromDiscord | <Hamid Bluri> identifier expected, but found `collect newseq` 🤣 |
07:20:14 | FromDiscord | <Hamid Bluri> ok, thank u anyway |
07:25:40 | FromDiscord | <Cypheriel> What would the Nim equivalent of Python's `iter()` be? I'm a bit confused lol |
07:26:26 | FromDiscord | <Rika> None afaik, need to manually make it yourself I guess but it shouldn’t be hard |
07:26:34 | FromDiscord | <Hamid Bluri> hey @Rika it does work that way https://media.discordapp.net/attachments/371759389889003532/916228900152049664/unknown.png |
07:26:44 | FromDiscord | <Rika> In reply to @Rika "None afaik, need to": if you want a closure iterator |
07:26:51 | FromDiscord | <Rika> Otherwise it’s just .items() I assume |
07:27:11 | FromDiscord | <Rika> In reply to @hamidb80 "hey <@259277943275126785> it does": Oh nice I was thinking about that but thought it wouldn’t work |
07:27:35 | FromDiscord | <Hamid Bluri> In reply to @Cypheriel "What would the Nim": there is a package called `itertools` by narimiran that implements python's `itertools` |
07:27:53 | FromDiscord | <Cypheriel> Would that include `iter()`? |
07:28:06 | FromDiscord | <Cypheriel> cause technically `iter()` isn't from `itertools` |
07:28:18 | FromDiscord | <Rika> In reply to @Rika "Otherwise it’s just .items()": Isn’t this what you want or what |
07:28:34 | FromDiscord | <Hamid Bluri> In reply to @Cypheriel "cause technically `iter()` isn't": what do you wanna do? |
07:28:46 | FromDiscord | <Cypheriel> In reply to @Rika "Isn’t this what you": Let me test real quick |
07:29:01 | FromDiscord | <Hamid Bluri> it doesn't have `iter`↵https://github.com/narimiran/itertools |
07:30:06 | FromDiscord | <Rika> Are you trying to get an iterator as a value? |
07:32:21 | FromDiscord | <Cypheriel> In reply to @Rika "Are you trying to": Um... I'm not sure how to explain it, one second |
07:33:16 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQE |
07:33:24 | FromDiscord | <Cypheriel> this is basically what I'm trying to do |
07:36:10 | FromDiscord | <Yardanico> what you want is `toSeq` |
07:36:11 | FromDiscord | <Yardanico> from sequtils |
07:36:48 | FromDiscord | <Yardanico> that's to get values from an iterator call |
07:36:50 | FromDiscord | <Cypheriel> um... VSCode seems to be having a heart attack... one moment |
07:37:07 | FromDiscord | <Yardanico> you need to use the normal calling syntax for it though, mcs won't work |
07:37:17 | FromDiscord | <Yardanico> so `toSeq(myiter())` and not `myiter().toSeq()` |
07:37:34 | FromDiscord | <Cypheriel> so many errors have started appearing out of thin air |
07:38:16 | FromDiscord | <Elegantbeef> I believe in 1.6 `myIter().toSeq` should work |
07:38:16 | FromDiscord | <Cypheriel> https://media.discordapp.net/attachments/371759389889003532/916231850907828244/Screenshot_20211203_003806.png |
07:38:25 | FromDiscord | <Yardanico> that's a warning |
07:38:32 | FromDiscord | <Cypheriel> Yes... but it shouldn't be there |
07:38:40 | FromDiscord | <Yardanico> well, maybe you have an error above? |
07:38:42 | FromDiscord | <Cypheriel> and it's just one of the many thin air errors that make no sense |
07:38:46 | FromDiscord | <Yardanico> if you have an error, warnings can be weird |
07:38:51 | FromDiscord | <Yardanico> try to compile |
07:39:33 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQF |
07:39:53 | FromDiscord | <Yardanico> what nim version are you on? |
07:40:20 | FromDiscord | <Yardanico> `nim -v` |
07:40:40 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQG |
07:40:40 | FromDiscord | <Yardanico> yeah that's quite old |
07:40:44 | FromDiscord | <Cypheriel> It is!? |
07:40:46 | FromDiscord | <Yardanico> latest nim version is 1.6.0, two major versions ahead |
07:40:50 | FromDiscord | <Cypheriel> How'd I manage that |
07:41:20 | FromDiscord | <Yardanico> In reply to @Cypheriel "How'd I manage that": use `choosenim` to install nim instead of using your distro's package manager |
07:41:40 | FromDiscord | <Cypheriel> oh |
07:41:49 | FromDiscord | <Cypheriel> The culprit was `nim-install` from PyPi |
07:42:16 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQI |
07:42:46 | * | cvoxel joined #nim |
07:43:12 | * | cvoxel quit (Remote host closed the connection) |
07:43:29 | FromDiscord | <Yardanico> yep |
07:45:44 | FromDiscord | <Cypheriel> Okay, removing that seems to have fixed the errors |
08:07:41 | FromDiscord | <claude> In reply to @hamidb80 "hey, i have an": for inline `:` blocks you need to use `do`. so you should be doing `len collect do:` |
08:08:30 | FromDiscord | <Rika> Oh yeah I forgot that existed |
08:11:51 | * | PMunch joined #nim |
08:29:24 | * | xet7 joined #nim |
09:06:26 | * | krux02 joined #nim |
09:18:33 | FromDiscord | <n00nehere> ayo |
09:18:54 | FromDiscord | <Yardanico> hi |
09:21:12 | FromDiscord | <n00nehere> what's a good game developing library that is not dead and does not need tons of boilerplate code? |
09:21:24 | FromDiscord | <n00nehere> and not godot, i don't like it |
09:21:40 | FromDiscord | <enthus1ast> hi [n00nehere](https://matrix.to/#/@n00nehere:converser.eu) you could join the nim game development channel |
09:21:45 | FromDiscord | <n00nehere> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/916257806255030322): and not godot, i don't like it(too stupid to use it) |
09:22:04 | FromDiscord | <n00nehere> wait how do i join it |
09:22:30 | FromDiscord | <n00nehere> ok i found it |
09:22:59 | FromDiscord | <n00nehere> joking there isn't |
09:23:14 | FromDiscord | <enthus1ast> https://matrix.to/#/#nim-gamedev:matrix.org |
09:23:31 | FromDiscord | <Yardanico> @n00nehere we have 10+ channels bridged to matrix |
09:23:31 | FromDiscord | <enthus1ast> (i never know how to share rooms in matrix ughh) |
09:23:52 | FromDiscord | <enthus1ast> #nim-gamedev\:matrix.org |
10:14:05 | NimEventer | New thread by Aredirect: Updating Nim Days, see https://forum.nim-lang.org/t/8674 |
10:27:59 | * | filcuc joined #nim |
10:34:45 | * | filcuc quit (Ping timeout: 256 seconds) |
10:34:49 | * | filcuc_ joined #nim |
10:43:14 | * | filcuc_ quit (Ping timeout: 252 seconds) |
11:51:44 | FromDiscord | <firasuke> Are there any "official" vim plugins available for Nim? |
11:54:42 | PMunch | I use zah/nim |
11:54:47 | PMunch | And NimLSP |
11:54:51 | PMunch | Works pretty well |
11:56:38 | PMunch | I don't think there are any "official" Nim plugins. But Nim has a pretty loose model of contribution, so the line between official and unofficial is fairly faded |
11:57:00 | FromDiscord | <firasuke> I see |
11:57:11 | FromDiscord | <firasuke> which is more popular though? |
11:57:17 | FromDiscord | <firasuke> I suppose NimLSP is for nvim? |
11:57:32 | FromDiscord | <firasuke> (edit) "is for" => "can be used with" |
11:59:29 | PMunch | I guess so |
11:59:33 | PMunch | I use it with "normal" vim |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:30 | * | supakeen joined #nim |
12:13:51 | * | cornfeedhobo quit (Quit: ZNC - https://znc.in) |
12:25:28 | * | xet7 quit (Quit: Leaving) |
12:25:36 | * | cornfeedhobo joined #nim |
12:36:16 | FromDiscord | <retkid> So do you guys see a straight forward way to thread modifying a giant sequence |
12:36:48 | FromDiscord | <retkid> My idea is you consolidate the different parts, split it into however many threads |
12:37:21 | FromDiscord | <retkid> That might be the fastest way |
12:43:47 | PMunch | It totally depends on the algorithm you want to apply |
12:47:21 | PMunch | If it is embarrassingly parallelizable then I would simply spin up N threads and pass them a pointer to the `(mySeq.len div N) * ThreadNum`th element. Then they can modify their chunk of the elements in place. As long as the sequence is used afterwards you shouldn't run into any GC trouble, I think.. |
12:55:48 | * | recreation quit (Quit: Leaving) |
12:58:43 | FromDiscord | <retkid> In reply to @PMunch "If it is embarrassingly": I’m afraid of the Len changing during a insertion that |
12:58:47 | FromDiscord | <retkid> (edit) " that" => "there" |
12:59:10 | FromDiscord | <retkid> Then I’d have to keep it inplace |
12:59:24 | FromDiscord | <retkid> Which limits me somewhat |
13:07:17 | * | src joined #nim |
13:40:41 | PMunch | Wait, you're changing the length? |
13:40:52 | PMunch | Then you'd definitely need a completely different solution |
13:53:40 | FromDiscord | <hmmm> yo boiz can u link to the config.nims section of the manual |
13:53:43 | FromDiscord | <hmmm> can't find |
13:59:08 | FromDiscord | <hmmm> oh it's nimble stuff |
14:00:03 | FromDiscord | <Solitude> In reply to @hmmm "yo boiz can u": https://nim-lang.org/docs/nims.html |
14:02:58 | FromDiscord | <hmmm> oh I see |
14:03:42 | FromDiscord | <hmmm> this is comfy I was adding flags by hand why the collective of nim discord didn't tell me earlier 🧐 |
14:03:59 | * | xet7 joined #nim |
14:12:50 | PMunch | Hmm, is there no way to receive a single UDP datagram in Nim? |
14:13:16 | PMunch | @hmmm, how would we know you didn't add them to a file :P |
14:16:01 | FromDiscord | <hmmm> In reply to @PMunch "<@887269570765791243>, how would we": https://media.discordapp.net/attachments/371759389889003532/916331943220609024/usagyuuun-mini-fight.gif |
14:20:32 | FromDiscord | <retkid> In reply to @PMunch "Wait, you're changing the": I can make it implace or not idk |
14:24:25 | Amun-Ra | hmm, how to allocate cstring with given size? |
14:29:32 | PMunch | Well, you're not really supposed to |
14:29:46 | PMunch | But a cstring is just a `ptr char` |
14:29:50 | PMunch | Same as in C |
14:30:38 | PMunch | So you just have to allocate memory somehow |
14:30:54 | FromDiscord | <Cypheriel> uh oh... I must've done something quite bizarre |
14:31:04 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GSw |
14:31:29 | Amun-Ra | hm |
14:31:34 | Amun-Ra | PMunch: thanks |
14:31:45 | PMunch | I like to use `newString(someLen)` and then `cast[cstring](myStr[0])`. And then, since most C functions that handle string data returns a new size I would then do `myStr.setLen(returnOfCProcedure)` |
14:32:43 | Amun-Ra | how about create(char, 1024)? |
14:33:32 | PMunch | That would also work |
14:33:51 | PMunch | But then you wouldn't be able to treat it as a string in Nim |
14:34:08 | * | rockcavera joined #nim |
14:34:08 | * | rockcavera quit (Changing host) |
14:34:09 | * | rockcavera joined #nim |
14:34:19 | Amun-Ra | I need a buffer to work with libz |
14:35:02 | PMunch | If you just have `var myCStr = cast[cstring](create(char, 1024)` and then `echo myCStr` that will copy the cstring content over into a string IIRC. |
14:35:27 | PMunch | And of course with `create` you need to deallocate the memory yourself |
14:35:39 | Amun-Ra | I'll try newString, no need to dealloc |
14:35:53 | PMunch | You could of course also do `seqSeq[char]` |
14:36:00 | PMunch | newSeq* |
14:36:06 | Amun-Ra | hmm |
14:36:56 | PMunch | After all in Nim `type string = distinct seq[char]` |
14:37:11 | PMunch | Not actually, but effectively |
14:37:40 | Amun-Ra | and I'll change definition of inbuf and outbuf from cstring to pointer |
14:38:35 | PMunch | `ptr UncheckedArray[char]` is probably the best type to wrap it as |
14:38:46 | * | cvoxel joined #nim |
14:38:59 | Amun-Ra | oh, right |
14:41:38 | * | cvoxel left #nim (#nim) |
14:46:53 | * | arkurious joined #nim |
15:02:19 | * | terminalpusher joined #nim |
15:15:11 | PMunch | Streaming day 3 of AoC right now! https://www.twitch.tv/pmunche |
15:39:51 | * | rockcavera quit (Remote host closed the connection) |
15:53:13 | FromDiscord | <iffy (Matt Haggard)> I want to write unittests for some procs that manipulate `NimNode`s but the compiler complains with this error\: "request to generate code for .compileTime proc\: renderAST" What are my options? Put my tests in `static:` blocks? |
15:58:32 | * | xet7 quit (Quit: Leaving) |
15:59:48 | * | akp joined #nim |
16:08:14 | * | akp quit (Quit: Leaving) |
16:12:52 | FromDiscord | <dain> is there a way in arraymancer to turn an array of booleans into an integer |
16:13:09 | FromDiscord | <dain> i.e. treat the booleans as the values of the bitfields in the int |
16:14:11 | FromDiscord | <dain> [true, true, false, true, false, true, true, false] -> interpret as 11010110 == 214 |
16:14:23 | FromDiscord | <dain> without converting it to a string and using the parse functions |
16:15:25 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GTf |
16:18:33 | FromDiscord | <vindaar> no offense, but why is this something that should be built into arraymancer? That seems like something that should be a convenience proc in some bitarray like module |
16:22:20 | FromDiscord | <dain> guess so |
16:40:09 | * | xet7 joined #nim |
16:55:21 | * | xet7 quit (Quit: Leaving) |
16:55:39 | * | noeontheend joined #nim |
16:57:59 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
17:04:47 | FromDiscord | <Zoom> Better to stay in uint/int and use `ord` if you need to treat bits as boolean |
17:12:31 | * | Vladar joined #nim |
17:17:21 | * | pro joined #nim |
17:22:17 | * | Pyautogui joined #nim |
17:23:31 | * | Pyautogui quit (Client Quit) |
17:34:39 | * | noeontheend quit (Ping timeout: 256 seconds) |
17:38:29 | * | pro quit (Quit: WeeChat 3.3) |
18:03:45 | FromDiscord | <dain> is there any downside to making all my procs generic |
18:03:53 | FromDiscord | <dain> or making them generic as much as possible, at any rate |
18:08:59 | * | xet7 joined #nim |
18:37:25 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GTX |
18:37:50 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3GTX" => "https://play.nim-lang.org/#ix=3GTY" |
18:39:10 | * | sdmcallister joined #nim |
18:45:56 | * | terminalpusher quit (Remote host closed the connection) |
18:53:18 | FromDiscord | <Cypheriel> What does one do if a function requires a kwarg like `end`? O.o |
18:59:49 | FromDiscord | <sdmcallister> The duckdb c api has funtion that returns a pointer to a result array in a columnar format `int32_t i_data = (int32_t ) duckdb_column_data(&result, 0);` `result` is the query result and 0 is the column number. They give an example of printing a value from the array in C like `printf("%d", i_data[row]);` |
19:01:27 | FromDiscord | <sdmcallister> Just wondering how I would go about this in Nim. |
19:06:49 | FromDiscord | <sdmcallister> sent a code paste, see https://play.nim-lang.org/#ix=3GU7 |
19:25:58 | * | sdmcallister quit (Quit: Client closed) |
19:34:16 | NimEventer | New post on r/nim by Samaursa: Nim Debugging on Windows (with VS Code), see https://reddit.com/r/nim/comments/r874za/nim_debugging_on_windows_with_vs_code/ |
19:37:12 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GUg |
19:39:02 | FromDiscord | <TryAngle> (I have never written any c except for basic universtiy cource) |
19:48:46 | FromDiscord | <Cypheriel> I'm so very confused. How does one convert a `PyObject` to an `int` |
19:52:21 | NimEventer | New post on r/nim by monkey_fresco: How to send cookies with getContent?, see https://reddit.com/r/nim/comments/r87hv5/how_to_send_cookies_with_getcontent/ |
20:10:16 | * | audiophile joined #nim |
20:11:49 | audiophile | hi anyone doing aoc |
20:12:02 | audiophile | i dont mean the politician, i mean the code challenge thingy |
20:24:34 | * | xet7 quit (Remote host closed the connection) |
20:31:21 | * | audiophile_ joined #nim |
20:34:59 | audiophile_ | For this error when trying newHttpClient.getContent() "Error: unhandled exception: SSL support is not available. Cannot connect over SSL. Compile with -d:ssl to enable. [HttpRequestError]" any idea why I still get the same error on using the -d:ssl flag? |
20:35:13 | * | audiophile quit (Ping timeout: 252 seconds) |
20:35:19 | * | audiophile_ is now known as audiophile |
20:36:50 | nrds | <Prestige99> There's a #nim-aoc challenge on irc, don't know if it's linked to discord or matrix though @audiophile |
20:37:04 | nrds | <Prestige99> Channel* |
20:40:50 | audiophile | gotcha thanks, will check if it's on libera |
20:43:08 | audiophile | hi, can someone help me figure out what scheme means in this context? http://vpaste.net/XXLIk?bg=dark&nu "No uri scheme supplied"? |
20:44:26 | audiophile | i assume we dont need to encode the url passed to getContent()? |
20:52:25 | FromDiscord | <Varriount> Are there any Nim libraries for working with SFTP? |
20:53:21 | * | vicecea quit (Remote host closed the connection) |
20:53:51 | * | vicecea joined #nim |
20:54:55 | * | perro quit (Quit: WeeChat 3.0.1) |
21:02:57 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3GUB |
21:05:21 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3GUC |
21:05:58 | FromDiscord | <geekrelief> I think it's the `void const ` that's causing the issue |
21:06:30 | FromDiscord | <geekrelief> try changing that to `const void ` |
21:08:19 | FromDiscord | <geekrelief> after putting `const` in front, nimterop gives: `WGPUProcBufferGetConstMappedRange {.importc.} = proc (↵ buffer: WGPUBuffer; offset: uint; size: uint): pointer {.cdecl.}` |
21:08:53 | * | vicfred joined #nim |
21:15:52 | FromDiscord | <Vindaar> In reply to @Cypheriel "I'm so very confused.": using `to`, so `x.to(int)` |
21:16:24 | FromDiscord | <Cypheriel> In reply to @Vindaar "using `to`, so `x.to(int)`": I found out about that later on... but datetime was complaining when I used it |
21:16:50 | FromDiscord | <Cypheriel> I had to do something rather unholy to get rid of the deprecation warning |
21:16:59 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GUF |
21:20:37 | * | Pyautogui joined #nim |
21:25:34 | * | Pyautogui quit (Quit: Connection closed) |
21:28:19 | * | Vladar quit (Quit: Leaving) |
21:45:26 | * | noeontheend joined #nim |
21:54:26 | FromDiscord | <Vindaar> In reply to @Cypheriel "I had to do": what deprecation warning was that? |
21:54:46 | FromDiscord | <zidsal> What in the uniform function call syntax allows the tables proc [] to work? As the proc is defined as↵`[] [A,B](t: table[A,B], key: A): B` ↵↵Surely you must write it along the lines of t.[](key) how is it you can write t.[key] ? |
21:55:03 | FromDiscord | <zidsal> (edit) "t.[key]" => "t[key]" |
21:55:48 | FromDiscord | <Cypheriel> sent a code paste, see https://paste.rs/N0a |
21:56:30 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GUX |
21:59:43 | * | vicfred quit (Quit: Leaving) |
22:00:49 | FromDiscord | <Vindaar> ah, so it's from the python side. Then I don't know the most idiomatic way to get around it. ↵From the message though why not just convert the arguments to `float`? |
22:04:18 | audiophile | im awful |
22:05:38 | FromDiscord | <Elegantbeef> Possibly |
22:05:43 | * | audiophile_ joined #nim |
22:05:44 | FromDiscord | <Elegantbeef> What did you do now? |
22:09:29 | * | audiophile quit (Ping timeout: 256 seconds) |
22:09:35 | * | audiophile_ is now known as audiophile |
22:22:32 | FromDiscord | <Cypheriel> In reply to @Vindaar "ah, so it's from": it'd cause the same error |
22:22:37 | FromDiscord | <Cypheriel> I think... |
22:22:51 | FromDiscord | <Cypheriel> too lazy to test, tbh. as long as it works rn, idec lol |
22:23:11 | FromDiscord | <Cypheriel> by "error", I mean warning |
22:34:55 | FromDiscord | <TryAngle> In reply to @geekrelief "after putting `const` in": hmm at least I don't require that function anyways for now↵may you explain to me what this thing exactly is?↵is it a type for a function? |
22:35:52 | FromDiscord | <geekrelief> In C it's a pointer to function, taking those params and returning a pointer to some constant data. |
22:36:21 | FromDiscord | <geekrelief> size_t is defined as a platform dependent unsigned integer |
22:36:35 | * | audiophile quit (Ping timeout: 252 seconds) |
22:36:57 | FromDiscord | <geekrelief> The weird part is that `const` can be before or after void and still be valid in C. |
22:37:41 | FromDiscord | <geekrelief> Currently, I think futhark would be the only thing that could properly handle it. |
22:37:52 | FromDiscord | <geekrelief> (edit) "it." => "it (automatically)." |
22:39:19 | FromDiscord | <geekrelief> The pragmas are explained in the manual. But generally, you want to `importc` anything you're wrapping, and add `cdecl` for functions. |
22:42:52 | * | Guest87 joined #nim |
22:53:51 | FromDiscord | <TryAngle> ah I see thanks |
22:57:23 | FromDiscord | <TryAngle> is there a way to specify dependencies that are only used for tests? |
23:12:44 | * | PMunch quit (Quit: leaving) |
23:20:36 | FromDiscord | <geekrelief> In reply to @TryAngle "is there a way": what do you mean? |
23:23:36 | FromDiscord | <TryAngle> In reply to @geekrelief "what do you mean?": I want to write a test for a library I'm working on right now. ↵This test should test the interop between this and another library↵but my library should not depend on the other library in general |
23:24:01 | FromDiscord | <TryAngle> is nimble install globally the only solution to this or can this also be definined in the .nimble file? |
23:31:03 | FromDiscord | <geekrelief> In reply to @TryAngle "I want to write": It's not clear to me how you can test your library but not depend on the other library unless you have a stub for it. |
23:32:44 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=3GVr |
23:32:46 | FromDiscord | <dom96> (Haven't tested this but might work :)) |
23:33:06 | FromDiscord | <Smarc> Hey Guys, you got any tips on how to improve my code and make it less verbose? I think my solution is not that great. https://github.com/Smarcy/nim_chess/blob/master/src/rules.nim#L128 Until L230 |
23:34:03 | FromDiscord | <TryAngle> In reply to @dom96 "Test-only deps not supported": I will try that thanks |
23:35:02 | FromDiscord | <geekrelief> In reply to @dom96 "Test-only deps not supported": I do exactly this in my project. |
23:36:02 | FromDiscord | <geekrelief> Well not exactly, but `defined` plus a `.nims` config to switch between dev vs release version. |
23:36:34 | FromDiscord | <geekrelief> In reply to @Smarc "Hey Guys, you got": less verbose usually means templates or macros 🙂 |
23:37:13 | FromDiscord | <Smarc> Hm, actually I thought there would be a "native" way of making it more slim. I feel that I just doubled things but don't see how to solve it logically |
23:38:55 | FromDiscord | <geekrelief> just glanced over your code, you're basically changing some numbers between of branch right? |
23:39:24 | FromDiscord | <Smarc> Mosty I guess |
23:39:25 | FromDiscord | <geekrelief> I see the `if` is slightly different |
23:39:38 | FromDiscord | <geekrelief> you should probably use a template |
23:40:08 | FromDiscord | <geekrelief> pass in the `if` condition as a block to the template |
23:40:22 | FromDiscord | <Smarc> Never did work with templates before, could you give me a starting support? :) |
23:40:58 | FromDiscord | <geekrelief> templates are super easy. https://nim-lang.github.io/Nim/manual.html#templates |
23:41:10 | FromDiscord | <geekrelief> just code substitution |
23:42:05 | FromDiscord | <Smarc> I'll have a look into it, thank you |
23:45:11 | FromDiscord | <geekrelief> In reply to @Smarc "I'll have a look": something like this: https://play.nim-lang.org/#ix=3GVv |
23:46:30 | FromDiscord | <geekrelief> then call `chessLogic((6,7), (5, 7)): b.board[7][5]... ` |
23:46:47 | FromDiscord | <geekrelief> (edit) "b.board[7][5]... `" => "b.board[7][5].color != None or b.board[7][6].color != None`" |
23:47:09 | FromDiscord | <geekrelief> though I'm not sure you really even need a template |
23:47:21 | FromDiscord | <geekrelief> why not call a proc? |
23:47:55 | FromDiscord | <Smarc> Just thought about that, I think I could just refactor it into a single proc |
23:48:07 | FromDiscord | <Smarc> I just programmed it the way I thought of it, step by step |
23:49:36 | FromDiscord | <geekrelief> For stuff that's really repetitive I created a macro |
23:49:49 | FromDiscord | <geekrelief> https://github.com/geekrelief/genit |
23:56:35 | * | Colt quit (Quit: Leaving) |
23:58:39 | * | Colt joined #nim |