<< 03-12-2021 >>

00:10:18FromDiscord<sharpcdf> a proc that returns nothing is written as `proc asf(): void = ` right?
00:10:27FromDiscord<sharpcdf> i dont remember lol and i cant find it anywhere
00:10:39FromDiscord<Yardanico> In reply to @sharpcdf "a proc that returns": just `proc asf() = discard`
00:10:51FromDiscord<Yardanico> `void` can be used for an empty return type, but is not required, that's just legacy
00:11:34FromDiscord<sharpcdf> alright
00:11:35FromDiscord<sharpcdf> thanks
00:11:45FromDiscord<Yardanico> also parens are optional too if you have no arguments
00:11:51FromDiscord<Yardanico> so `proc asf = discard` is perfectly fine
00:14:07FromDiscord<sharpcdf> yea i know
00:15:27FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3GPk
00:15:52FromDiscord<Yardanico> In reply to @sharpcdf "ive seen some examples": where is it "left out" ?
00:16:01FromDiscord<Yardanico> "discard" is like python's "pass", so just "do nothing"
00:17:29FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3GPl
00:17:37FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GPm
00:17:38FromDiscord<Yardanico> your first line won't compile
00:17:39FromDiscord<sharpcdf> and they just leave out hte discard
00:17:45FromDiscord<Yardanico> so if you want to have an empty proc you write "discard"
00:17:49FromDiscord<Yardanico> as the only thing inside of it
00:17:57FromDiscord<sharpcdf> In reply to @Yardanico "no, you must have": well of course, but im saying leaving out the discard
00:18:05FromDiscord<sharpcdf> In reply to @Yardanico "so if you want": ok, but what if im defining it there
00:18:12FromDiscord<sharpcdf> and adding stuff inside of it
00:18:15FromDiscord<Yardanico> ?
00:18:16FromDiscord<sharpcdf> instead of just declaring it
00:18:19FromDiscord<eqf0> I think `proc (x, y: int) {.closure.}` is a type, not a declaration
00:18:30FromDiscord<Yardanico> ah, if he's asking that, then yes
00:18:36FromDiscord<Yardanico> since it's just a procedure type, you don't need a body at all
00:18:39FromDiscord<sharpcdf> i think youre misunderstanding
00:18:40FromDiscord<Yardanico> hence you don't need = discard
00:18:41FromDiscord<sharpcdf> basically
00:19:40FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3GPn
00:19:54FromDiscord<sharpcdf> not just declaring it
00:19:56FromDiscord<Yardanico> ahh, i think you misunderstood
00:19:58FromDiscord<sharpcdf> if it has a body
00:20:02FromDiscord<Yardanico> "discard" is _only_ for when you have an empty proc with no body
00:20:06FromDiscord<Yardanico> if you have a body, "discard" isn't needed
00:20:08FromDiscord<sharpcdf> ohhhh
00:20:31FromDiscord<sharpcdf> alright so when im defining a function with no return value i just dont add anything
00:20:32FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GPo
00:20:38FromDiscord<sharpcdf> ohhhhhhhhhhhhhhhhhhh
00:20:51FromDiscord<sharpcdf> thanks lol
00:20:51FromDiscord<Yardanico> "discard" is a part of the procedure body, it's not a part of the procedure declaration
00:21:30FromDiscord<sharpcdf> alright that makes a ton more sense
00:32:39*src quit (Quit: Leaving)
00:45:43FromDiscord<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:10FromDiscord<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:25FromDiscord<Yardanico> also you can already have similar effect with normal split and unpack
00:49:33FromDiscord<Yardanico> https://github.com/Yardanico/nimpylib/blob/master/src/pylib/unpack.nim or https://github.com/technicallyagd/unpack or something similar
00:49:50FromDiscord<huantian> true
00:50:21FromDiscord<huantian> yeah that works
01:07:30FromDiscord<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:54FromDiscord<ynfle (ynfle)> I think `link` is for a c or cpp compiler
01:23:58FromDiscord<sharpcdf> nevermind, found `staticRead`
01:24:02FromDiscord<sharpcdf> yeai think so too
01:24:06FromDiscord<ynfle (ynfle)> What would it mean for html/css/javascript
01:24:17FromDiscord<ynfle (ynfle)> `link` isn't for linking to you nim program
01:24:48FromDiscord<sharpcdf> i was talking about embedding the files
01:24:54FromDiscord<sharpcdf> though linking did that
01:24:57FromDiscord<sharpcdf> but found staticRead
01:25:12FromDiscord<Elegantbeef> nah `link` is for linking libraries to your code
01:36:10arkanoidwould nim leaders tell nim users if a large company would be using nim for a proprietary project?
01:36:40FromDiscord<Yardanico> ?
01:36:40FromDiscord<Rika> How would one know
01:36:44FromDiscord<Rika> It’s proprietary
01:37:16arkanoidwell, support is a thing, they would receive requests probably
01:37:29FromDiscord<Rika> Requests for
01:37:54arkanoidfixing stuff, implement a language feature, who knows
01:38:08arkanoidstay alive and well
01:38:54FromDiscord<Rika> Large companies would probably opt to either fix it themselves or switch languages I assume
01:39:04arkanoidno
01:39:32arkanoidwell, it depends on the concept of "large", but essentially no. They would send money and requests
01:39:43FromDiscord<Rika> Or they just wouldn’t disclose that they’re building an app or whatever els
01:41:06arkanoidwell, so the anwer is "it depends"
01:54:29FromDiscord<sharpcdf> how do you create a file?
01:56:12FromDiscord<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:22FromDiscord<Elegantbeef> There are many ways to do it of course
01:56:30FromDiscord<sharpcdf> alright, thanks
02:07:48FromDiscord<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:17FromDiscord<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:50arkanoidis move semantics sink param inferred, or I have to take care of it?
02:12:58arkanoidI'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:32FromDiscord<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:34FromDiscord<Yardanico> --sinkInference
02:18:34FromDiscord<Yardanico> you can try compiling with --sinkInference:on , if it works - cool, (a bit of) free performance :P
02:18:37FromDiscord<Yardanico> for your program that is
02:21:12arkanoidYardanico: 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:29FromDiscord<Yardanico> wdym "what about arc"?
02:21:33FromDiscord<Yardanico> sinkInference is specific to arc/orc
02:22:15FromDiscord<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:23arkanoidoh, ok. So I expect it to be turned on for that example
02:22:37FromDiscord<Yardanico> @leorize don't remember the memory corruption issues
02:22:45FromDiscord<Yardanico> but there are problems with type compatibility with closures, yes
02:23:22FromDiscord<leorize> sink is probably the weirdest feature in the language
02:23:29FromDiscord<Yardanico> why?
02:23:36FromDiscord<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:55FromDiscord<leorize> the only thing it said is "should be moved" and not "must be moved"
02:24:39FromDiscord<Yardanico> i mean, it's just that we don't have good --sinkInference so we have to use it explicitly
02:24:42FromDiscord<leorize> effectively rendering it to be an optimization (a bad one, even) rather than a constraint
02:24:54FromDiscord<Yardanico> with sinkInference by default it'll be there for everyone but you won't have to annotate your code with "sink"
02:25:12FromDiscord<Yardanico> it's a bit weird as of now when you need to annotate it manually, yes
02:25:45arkanoid in the talk araq says that badly inserted sink/lent won't make any instability/crash but maybe just make program slower
02:32:20arkanoid--sinkInference is default ON according to manual
02:32:44FromDiscord<leorize> iirc its only on for the stdlib
02:32:48FromDiscord<leorize> but that might have changed
02:33:43arkanoidOK. Very interesting subject though. Would like to read mode about this
02:34:31FromDiscord<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:35FromDiscord<leorize> looks like its still off-by-default
02:34:42FromDiscord<leorize> except for stdlib
02:34:51FromDiscord<Yardanico> In reply to @leorize "looks like its still": well, not "still"
02:35:00FromDiscord<Yardanico> it was on by default for some time in the past :)
02:35:19FromDiscord<leorize> I mean, in the context of a release, then it hasn't been on since its introduction in 1.2.0
02:37:15arkanoidso 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:24FromDiscord<Elegantbeef> Most stdlib procs are annotated
03:10:28arkanoidNimporter readme: possible benefits: "doesn't require nim compiler", dependencies "nim compiler". I'm confused
03:13:07FromDiscord<Yardanico> In reply to @arkanoid "Nimporter readme: possible benefits:": i guess the former is about already-published packages
03:13:15FromDiscord<Yardanico> and dependencies is for the developers (not end users) of the libraries
03:13:33FromDiscord<Yardanico> so basically you can publish binary wheels to pypi and no need for nim compiler i guess
03:13:46arkanoidwell, that's obvious
03:13:49FromDiscord<Yardanico> but then idk about "on import"...
03:13:53arkanoidok ok, btw got it
03:30:35arkanoiddamn vscode and nim will always be worst enemies
03:30:56arkanoidI keep have to restart it to get autocompletion/suggestions
03:31:48arkanoidno matter which of the two main extensions I activate, ctrl+space stays in "loading ..." forever, until I restart "code ."
03:34:44arkanoidalso 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:54arkanoidps -ae | grep nimsuggest shows it not running
03:37:25FromDiscord<evoalg> hate's a strong word, but I hate vscode
03:38:25FromDiscord<Elegantbeef> And it hates you!
03:38:31FromDiscord<Rika> I hate you beef
03:38:32FromDiscord<Rika> Smh
03:38:39FromDiscord<Elegantbeef> Everyone already knows that
03:41:11FromDiscord<evoalg> you young people ... only being able to show affection though mocking each other
03:41:16arkanoidI 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:52FromDiscord<Elegantbeef> Open up the output tab and look at the nim extension output
03:42:17FromDiscord<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:28arkanoidit just says "2021-0011-05 04:0039:06.000306 - [info] Extension Activated"
03:42:30arkanoidand that's it
03:43:06FromDiscord<Rika> Can the program access Nim?
03:43:13FromDiscord<Rika> Like in vscode
03:43:48arkanoidwhat 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:51arkanoidI'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:29arkanoidgot 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:12nrds<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:48FromDiscord<leorize> all ui libs suck, unfortunately
04:59:02FromDiscord<leorize> gintro does work really well if you target linux, though
04:59:31arkanoidRika, 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:51arkanoidsorry, I meant the opposite. Nim seems 3x slower
05:00:05FromDiscord<Rika> Turn debug off then
05:00:07FromDiscord<Elegantbeef> Why are you benching with `-d:debug`?
05:00:24FromDiscord<Rika> And why Nimpy?
05:00:51nrds<Prestige99> Thanks leorize
05:02:58arkanoidRika, 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:34arkanoidit wotks, but probably doing more copies than python<>pandas
05:03:40arkanoidnot sure though
05:03:45FromDiscord<Rika> Yes
05:03:47FromDiscord<Rika> Likely
05:12:28arkanoidRika, with release and arc it went python 236ms vs nim 270ms
05:12:47arkanoidnext test would be to just return list of lists to python and avoid pandas on the nim side
05:12:49FromDiscord<Yardanico> try -d:danger also
05:15:20arkanoidwith danger is 224ms vs 255ms
05:16:09FromDiscord<Yardanico> also you can try lto :P
05:16:15FromDiscord<Yardanico> --passC:"-flto" --passL:"-flto"
05:17:18arkanoidsure. Also this is the nim code I'm using https://play.nim-lang.org/#ix=3GQe
05:17:31arkanoidI algo guess theres seq allocation to optimize
05:18:05FromDiscord<Rika> If you know the sizes beforehand yes
05:19:39arkanoidwith lfto is 220ms vs 254ms, no changes
05:20:14arkanoidsecond run 220 vs 243
05:20:48arkanoidwell, 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:13arkanoidRika, no I don't know the number of parsed lines beforehand
05:22:14arkanoidactually this is the code with imports: https://play.nim-lang.org/#ix=3GQf
05:24:28arkanoidby making column list a const now is 233 vs 237 :P
05:24:58arkanoidbut there are fluctuations. not sure if %timeit is the right way to benchmark
05:25:17FromDiscord<Yardanico> @arkanoid also the python version is better optimized
05:25:38arkanoidis it?
05:25:40FromDiscord<Yardanico> list comprehensions don't need temporary lists, but in `line.split('|').mapIt(it.strip())` they are needed
05:25:51FromDiscord<Yardanico> compared to `[ll.strip() for ll in line.split(",")]`
05:26:17FromDiscord<Yardanico> hm
05:26:25FromDiscord<Yardanico> well anyway, they're close enough :)
05:26:31arkanoidwould zeero-function keep the game going?
05:26:36FromDiscord<Yardanico> yes
05:27:15arkanoidsure! 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:31arkanoidI'm actually "lending" PyObject here
05:28:26arkanoidor is it "lenting"? whatever
05:30:46FromDiscord<Cypheriel> do I smell nimpy
05:31:43arkanoidsure, that's the elephant in the room
05:32:51FromDiscord<Cypheriel> Nimpy's cool, but there's a lot that utterly confuses me ¯\_(ツ)_/¯
05:32:54FromDiscord<Yardanico> huh?
05:32:57FromDiscord<Yardanico> it's pretty simple
05:33:02FromDiscord<Cypheriel> I could not for the life of me get it to work with a virtual environment
05:33:03FromDiscord<Yardanico> it's a really high level cpython api wrapper
05:33:18FromDiscord<Cypheriel> and I didn't feel super comfortable using my system interpreter
05:33:43FromDiscord<Yardanico> have you seen https://github.com/yglukhov/nimpy/issues/152 and https://github.com/yglukhov/nimpy/issues/171 ?
05:34:11arkanoidreplaced sequtils with zero functional, let's check who wins now
05:34:36FromDiscord<Cypheriel> I've not seen them, but now that I have... I think I'm even more confused
05:35:16arkanoid'line' is of type <lent string> which cannot be captured as it would violate memory safety
05:36:39arkanoidCypheriel, 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:51FromDiscord<Cypheriel> hm... it did not work that way for me
05:37:14FromDiscord<Cypheriel> I even used some uh... `nim-install` PyPi package
05:37:27arkanoidbut 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:10FromDiscord<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:26arkanoidnimble init fooproj; cd fooproj; python3 -m venv venv; ./venv/bin/activate
05:38:42FromDiscord<Cypheriel> yeah... it just didn't work that way for me
05:39:04FromDiscord<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:36FromDiscord<Cypheriel> I did some testing just with echoing `py_import("platform").python_version`
05:39:40arkanoidif you run "type python" once you are into your venv, what do you see?
05:40:14FromDiscord<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:27FromDiscord<Cypheriel> `python -V` and etc would confirm it
05:40:45FromDiscord<Cypheriel> but when I'd execute my nim code, it'd say 3.8
05:40:51FromDiscord<Cypheriel> (edit) "nim" => "Nim"
05:41:22FromDiscord<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:02arkanoidCypheriel, as last resort, try pyInitLibPath https://play.nim-lang.org/#ix=3GQh
05:45:14arkanoidthis is what I use to load custom compiled python in random dir
05:46:17arkanoidback 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:51arkanoidwith zero functional is actually slower than with sequtils, now python 232ms vs nim 263ms
05:57:01arkanoidthis is the current nim version, do you see other room for improvements? https://play.nim-lang.org/#ix=3GQl
05:57:46FromDiscord<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:40arkanoidactually, yes, let me rethink
05:58:52FromDiscord<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:17arkanoidYardanico, the python version is already doing that
06:00:48FromDiscord<Yardanico> is it?
06:01:05FromDiscord<Yardanico> you do `[ll for ll in data.splitlines() if ll and ll.strip()]` so you still create the whole list
06:01:11arkanoidfor x in (line for line in data.splitlines() if line and line.strip()):
06:01:17FromDiscord<Yardanico> ah, yeah, this way yes
06:01:36arkanoidthat's old code, I've been optimizing it after Rika suggestion
06:01:46arkanoidI've just make the nim code without closure
06:01:53FromDiscord<Yardanico> well it's hard to say anything if I can't test it myself and you modify the code :P
06:02:55arkanoidzero_functional without closure: https://play.nim-lang.org/#ix=3GQp
06:08:30arkanoidI've incremented the benchmark time to have more consistent results (now is %timeit -n 10). I'm getting python 286ms nim 321ms
06:09:15arkanoidthis with arc, danger, lfto and zero_functional. Python can be quite surprising
06:09:42FromDiscord<Cypheriel> I suppose it's time to reboot my computer and see if I can get nimpy working in a venv
06:09:50FromDiscord<Cypheriel> but do I really wanna reinstall VSCode \😔
06:10:07arkanoidwhat's the connection between the two?
06:10:36FromDiscord<Cypheriel> It's really the only editor I can sanely use with Nim, without having to tackle something like vim or emacs
06:10:43arkanoidfyi, I'm working with nim + nimpy + nimterop + vscode + python + venv right now, with all static checkers running
06:11:17FromDiscord<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:27FromDiscord<Rika> It’s only surprising because you’re going from Python to Nim to Python I would say
06:11:51arkanoidif vscode feels hacky, try real visual studio. 4x more options
06:12:01FromDiscord<Yardanico> In reply to @arkanoid "if vscode feels hacky,": no nim support :)
06:12:12FromDiscord<Cypheriel> Visual Studio on Linux would be quite the feat
06:12:17FromDiscord<Yardanico> i mean no proper autosuggest plugin, there is probably syntax highlighting though
06:12:53FromDiscord<Cypheriel> I've been thinking about learning something like emacs purely for Nim
06:13:05FromDiscord<Cypheriel> just because I'd feel like I'm the one in control of things
06:13:18arkanoidI jump between vscode and neovim (actually spacevim) quite happily
06:14:01FromDiscord<Rika> I learned neovim “for Nim”
06:14:06FromDiscord<Cypheriel> I've always tried learning vim/emacs but... I get fairly overwhelmed quite quickly
06:14:14FromDiscord<Cypheriel> In reply to @Rika "I learned neovim “for": "neonim" 😔
06:14:19FromDiscord<Rika> Lol
06:14:42FromDiscord<Rika> I did the “learn advanced stuff along the way” so I only know some of the basic commands by heart
06:15:11FromDiscord<Rika> If you asked me what a letter did in command mode I would have prolly a 50% chance of knowing
06:16:13FromDiscord<Cypheriel> I mean things like doom emacs seem pretty cool, but it's pretty tough getting past the learning curve
06:17:15FromDiscord<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:24FromDiscord<Rika> While not knowing if you will like it or not yeah I get it
06:17:44FromDiscord<Cypheriel> God only knows what an "LSP" is, too lol
06:17:48FromDiscord<Rika> Imagine spending a few hours learning something just to know if you’ll like it or not
06:18:08FromDiscord<Cypheriel> in fairness, I'm kind of the same way with Nim as a language
06:18:20arkanoidI've repeated the benchmark removing pandas from the picture. Now function returns seq[seq[string]] (List[List[str]]]), and now nim shines
06:18:52FromDiscord<Rika> Well yeah
06:18:59arkanoidpython 255ms, nim 152ms
06:19:05FromDiscord<Rika> Not much better huh
06:19:11FromDiscord<Rika> I mean I guess it is “much” better
06:19:41arkanoidwell, I was expecting more advantage in my opinion
06:20:22arkanoidbut numbers are consistent, nim is 1.75x faster than python in this context
06:22:00arkanoidbut 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:38FromDiscord<Rika> Nim does need better iterator libraries I guess
06:22:39FromDiscord<Yardanico> what if you don't use zero functional but have a normal iterator ?
06:22:41arkanoidso 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:55FromDiscord<Yardanico> sure it's "more" code visually, but not really
06:23:12FromDiscord<Rika> Always an overhead somewhere by crossing interpreter boundaries
06:23:32FromDiscord<Yardanico> In reply to @Rika "Always an overhead somewhere": nonono he is benchmarking pure nim vs pure python right now
06:23:38FromDiscord<Yardanico> i think
06:23:40FromDiscord<Rika> Really?
06:23:44FromDiscord<Yardanico> yes
06:23:53FromDiscord<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:02FromDiscord<Rika> In reply to @arkanoid "so it's a fair": Well I meant to say that against the last statement here
06:24:11FromDiscord<Yardanico> @arkanoid can you share the input data and whatever nim code you have now?
06:24:17FromDiscord<Yardanico> i'm a bit bored anyway, so i might as well tinker with it
06:24:26FromDiscord<Yardanico> or just tell me how to generate "similar" data
06:25:04arkanoidYardanico, 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:14FromDiscord<Yardanico> oh
06:25:33FromDiscord<Yardanico> then yeah rika is right and the results are actually good :)
06:26:24arkanoidthat 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:39arkanoidYardanico: 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:58FromDiscord<Rika> Can you not do hybrid?
06:30:25arkanoidsure, it was full zero_functional. I was trying to follow Yardanico
06:31:08arkanoidRika, this is the full zero_functional version https://play.nim-lang.org/#ix=3GQp
06:31:34arkanoidbut instead of returning the pd.Dataframe, I now return "rows" directly
06:32:33arkanoidlike here: https://play.nim-lang.org/#ix=3GQt
06:33:08FromDiscord<Rika> Is it slower?
06:33:23arkanoidand this is actually faster than python returning same List[List[str]]], even crossing the border
06:33:52FromDiscord<Rika> Pandas might just be well optimised I guess
06:35:13arkanoidyes, 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:42arkanoidwell, 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:41FromDiscord<Yardanico> is it surprising though?
06:43:24arkanoidYardanico, well, yes: https://play.nim-lang.org/#ix=3GQw
06:44:10FromDiscord<Yardanico> hmmm
06:44:23FromDiscord<Yardanico> just to be safe, you check that both nim and python give same values, right?
06:44:32arkanoidyes they do
06:44:36arkanoidjust checked now
06:44:37FromDiscord<Yardanico> weird then
06:45:50arkanoidfyi the final result is a 16970 rows × 26 columns table
06:53:52*xet7 quit (Remote host closed the connection)
07:00:17FromDiscord<Cypheriel> So... is there a specific extension I should get for VSCode?
07:00:20FromDiscord<Cypheriel> for Nim, I mean
07:02:24FromDiscord<Cypheriel> I would think it's <https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode>, but I'm not totally sure
07:03:15arkanoidYardanico: 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:11FromDiscord<Hamid Bluri> hey, i have an issue with collect macro https://media.discordapp.net/attachments/371759389889003532/916225786648875019/unknown.png
07:14:55FromDiscord<Hamid Bluri> the result of collect macro can't be passed as function paramter directly
07:15:11FromDiscord<Hamid Bluri> (edit) "collect" => "`collect`" | "paramter" => "parameter"
07:15:51FromDiscord<Rika> Parenthesise the collect
07:16:53FromDiscord<Hamid Bluri> pure pars without function call 😵‍💫 https://media.discordapp.net/attachments/371759389889003532/916226463575982120/unknown.png
07:17:42FromDiscord<Hamid Bluri> should i open an issue or there is something i dont' know about nim 😕
07:18:03FromDiscord<Cypheriel> I don't think that's what they meant lol
07:18:06FromDiscord<Rika> Isn’t there a parameter after collect like newSeq or is that optional
07:18:11FromDiscord<Rika> It is what I meant
07:18:17FromDiscord<Hamid Bluri> In reply to @Rika "Isn’t there a parameter": it's optional
07:18:26FromDiscord<Cypheriel> right... in that case, I'm completely clueless as to how Nim works
07:18:35FromDiscord<Cypheriel> that is some cursed looking syntax lol
07:19:12FromDiscord<Hamid Bluri> In reply to @Rika "Isn’t there a parameter": https://media.discordapp.net/attachments/371759389889003532/916227048983388169/unknown.png
07:19:48FromDiscord<Rika> I don’t know anymore really
07:19:56FromDiscord<Hamid Bluri> identifier expected, but found `collect newseq` 🤣
07:20:14FromDiscord<Hamid Bluri> ok, thank u anyway
07:25:40FromDiscord<Cypheriel> What would the Nim equivalent of Python's `iter()` be? I'm a bit confused lol
07:26:26FromDiscord<Rika> None afaik, need to manually make it yourself I guess but it shouldn’t be hard
07:26:34FromDiscord<Hamid Bluri> hey @Rika it does work that way https://media.discordapp.net/attachments/371759389889003532/916228900152049664/unknown.png
07:26:44FromDiscord<Rika> In reply to @Rika "None afaik, need to": if you want a closure iterator
07:26:51FromDiscord<Rika> Otherwise it’s just .items() I assume
07:27:11FromDiscord<Rika> In reply to @hamidb80 "hey <@259277943275126785> it does": Oh nice I was thinking about that but thought it wouldn’t work
07:27:35FromDiscord<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:53FromDiscord<Cypheriel> Would that include `iter()`?
07:28:06FromDiscord<Cypheriel> cause technically `iter()` isn't from `itertools`
07:28:18FromDiscord<Rika> In reply to @Rika "Otherwise it’s just .items()": Isn’t this what you want or what
07:28:34FromDiscord<Hamid Bluri> In reply to @Cypheriel "cause technically `iter()` isn't": what do you wanna do?
07:28:46FromDiscord<Cypheriel> In reply to @Rika "Isn’t this what you": Let me test real quick
07:29:01FromDiscord<Hamid Bluri> it doesn't have `iter`↵https://github.com/narimiran/itertools
07:30:06FromDiscord<Rika> Are you trying to get an iterator as a value?
07:32:21FromDiscord<Cypheriel> In reply to @Rika "Are you trying to": Um... I'm not sure how to explain it, one second
07:33:16FromDiscord<Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQE
07:33:24FromDiscord<Cypheriel> this is basically what I'm trying to do
07:36:10FromDiscord<Yardanico> what you want is `toSeq`
07:36:11FromDiscord<Yardanico> from sequtils
07:36:48FromDiscord<Yardanico> that's to get values from an iterator call
07:36:50FromDiscord<Cypheriel> um... VSCode seems to be having a heart attack... one moment
07:37:07FromDiscord<Yardanico> you need to use the normal calling syntax for it though, mcs won't work
07:37:17FromDiscord<Yardanico> so `toSeq(myiter())` and not `myiter().toSeq()`
07:37:34FromDiscord<Cypheriel> so many errors have started appearing out of thin air
07:38:16FromDiscord<Elegantbeef> I believe in 1.6 `myIter().toSeq` should work
07:38:16FromDiscord<Cypheriel> https://media.discordapp.net/attachments/371759389889003532/916231850907828244/Screenshot_20211203_003806.png
07:38:25FromDiscord<Yardanico> that's a warning
07:38:32FromDiscord<Cypheriel> Yes... but it shouldn't be there
07:38:40FromDiscord<Yardanico> well, maybe you have an error above?
07:38:42FromDiscord<Cypheriel> and it's just one of the many thin air errors that make no sense
07:38:46FromDiscord<Yardanico> if you have an error, warnings can be weird
07:38:51FromDiscord<Yardanico> try to compile
07:39:33FromDiscord<Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQF
07:39:53FromDiscord<Yardanico> what nim version are you on?
07:40:20FromDiscord<Yardanico> `nim -v`
07:40:40FromDiscord<Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GQG
07:40:40FromDiscord<Yardanico> yeah that's quite old
07:40:44FromDiscord<Cypheriel> It is!?
07:40:46FromDiscord<Yardanico> latest nim version is 1.6.0, two major versions ahead
07:40:50FromDiscord<Cypheriel> How'd I manage that
07:41:20FromDiscord<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:40FromDiscord<Cypheriel> oh
07:41:49FromDiscord<Cypheriel> The culprit was `nim-install` from PyPi
07:42:16FromDiscord<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:29FromDiscord<Yardanico> yep
07:45:44FromDiscord<Cypheriel> Okay, removing that seems to have fixed the errors
08:07:41FromDiscord<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:30FromDiscord<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:33FromDiscord<n00nehere> ayo
09:18:54FromDiscord<Yardanico> hi
09:21:12FromDiscord<n00nehere> what's a good game developing library that is not dead and does not need tons of boilerplate code?
09:21:24FromDiscord<n00nehere> and not godot, i don't like it
09:21:40FromDiscord<enthus1ast> hi [n00nehere](https://matrix.to/#/@n00nehere:converser.eu) you could join the nim game development channel
09:21:45FromDiscord<n00nehere> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/916257806255030322): and not godot, i don't like it(too stupid to use it)
09:22:04FromDiscord<n00nehere> wait how do i join it
09:22:30FromDiscord<n00nehere> ok i found it
09:22:59FromDiscord<n00nehere> joking there isn't
09:23:14FromDiscord<enthus1ast> https://matrix.to/#/#nim-gamedev:matrix.org
09:23:31FromDiscord<Yardanico> @n00nehere we have 10+ channels bridged to matrix
09:23:31FromDiscord<enthus1ast> (i never know how to share rooms in matrix ughh)
09:23:52FromDiscord<enthus1ast> #nim-gamedev\:matrix.org
10:14:05NimEventerNew 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:44FromDiscord<firasuke> Are there any "official" vim plugins available for Nim?
11:54:42PMunchI use zah/nim
11:54:47PMunchAnd NimLSP
11:54:51PMunchWorks pretty well
11:56:38PMunchI 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:00FromDiscord<firasuke> I see
11:57:11FromDiscord<firasuke> which is more popular though?
11:57:17FromDiscord<firasuke> I suppose NimLSP is for nvim?
11:57:32FromDiscord<firasuke> (edit) "is for" => "can be used with"
11:59:29PMunchI guess so
11:59:33PMunchI 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:16FromDiscord<retkid> So do you guys see a straight forward way to thread modifying a giant sequence
12:36:48FromDiscord<retkid> My idea is you consolidate the different parts, split it into however many threads
12:37:21FromDiscord<retkid> That might be the fastest way
12:43:47PMunchIt totally depends on the algorithm you want to apply
12:47:21PMunchIf 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:43FromDiscord<retkid> In reply to @PMunch "If it is embarrassingly": I’m afraid of the Len changing during a insertion that
12:58:47FromDiscord<retkid> (edit) " that" => "there"
12:59:10FromDiscord<retkid> Then I’d have to keep it inplace
12:59:24FromDiscord<retkid> Which limits me somewhat
13:07:17*src joined #nim
13:40:41PMunchWait, you're changing the length?
13:40:52PMunchThen you'd definitely need a completely different solution
13:53:40FromDiscord<hmmm> yo boiz can u link to the config.nims section of the manual
13:53:43FromDiscord<hmmm> can't find
13:59:08FromDiscord<hmmm> oh it's nimble stuff
14:00:03FromDiscord<Solitude> In reply to @hmmm "yo boiz can u": https://nim-lang.org/docs/nims.html
14:02:58FromDiscord<hmmm> oh I see
14:03:42FromDiscord<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:50PMunchHmm, is there no way to receive a single UDP datagram in Nim?
14:13:16PMunch@hmmm, how would we know you didn't add them to a file :P
14:16:01FromDiscord<hmmm> In reply to @PMunch "<@887269570765791243>, how would we": https://media.discordapp.net/attachments/371759389889003532/916331943220609024/usagyuuun-mini-fight.gif
14:20:32FromDiscord<retkid> In reply to @PMunch "Wait, you're changing the": I can make it implace or not idk
14:24:25Amun-Rahmm, how to allocate cstring with given size?
14:29:32PMunchWell, you're not really supposed to
14:29:46PMunchBut a cstring is just a `ptr char`
14:29:50PMunchSame as in C
14:30:38PMunchSo you just have to allocate memory somehow
14:30:54FromDiscord<Cypheriel> uh oh... I must've done something quite bizarre
14:31:04FromDiscord<Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GSw
14:31:29Amun-Rahm
14:31:34Amun-RaPMunch: thanks
14:31:45PMunchI 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:43Amun-Rahow about create(char, 1024)?
14:33:32PMunchThat would also work
14:33:51PMunchBut 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:19Amun-RaI need a buffer to work with libz
14:35:02PMunchIf 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:27PMunchAnd of course with `create` you need to deallocate the memory yourself
14:35:39Amun-RaI'll try newString, no need to dealloc
14:35:53PMunchYou could of course also do `seqSeq[char]`
14:36:00PMunchnewSeq*
14:36:06Amun-Rahmm
14:36:56PMunchAfter all in Nim `type string = distinct seq[char]`
14:37:11PMunchNot actually, but effectively
14:37:40Amun-Raand I'll change definition of inbuf and outbuf from cstring to pointer
14:38:35PMunch`ptr UncheckedArray[char]` is probably the best type to wrap it as
14:38:46*cvoxel joined #nim
14:38:59Amun-Raoh, right
14:41:38*cvoxel left #nim (#nim)
14:46:53*arkurious joined #nim
15:02:19*terminalpusher joined #nim
15:15:11PMunchStreaming day 3 of AoC right now! https://www.twitch.tv/pmunche
15:39:51*rockcavera quit (Remote host closed the connection)
15:53:13FromDiscord<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:52FromDiscord<dain> is there a way in arraymancer to turn an array of booleans into an integer
16:13:09FromDiscord<dain> i.e. treat the booleans as the values of the bitfields in the int
16:14:11FromDiscord<dain> [true, true, false, true, false, true, true, false] -> interpret as 11010110 == 214
16:14:23FromDiscord<dain> without converting it to a string and using the parse functions
16:15:25FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GTf
16:18:33FromDiscord<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:20FromDiscord<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:47FromDiscord<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:45FromDiscord<dain> is there any downside to making all my procs generic
18:03:53FromDiscord<dain> or making them generic as much as possible, at any rate
18:08:59*xet7 joined #nim
18:37:25FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GTX
18:37:50FromDiscord<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:18FromDiscord<Cypheriel> What does one do if a function requires a kwarg like `end`? O.o
18:59:49FromDiscord<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:27FromDiscord<sdmcallister> Just wondering how I would go about this in Nim.
19:06:49FromDiscord<sdmcallister> sent a code paste, see https://play.nim-lang.org/#ix=3GU7
19:25:58*sdmcallister quit (Quit: Client closed)
19:34:16NimEventerNew 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:12FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GUg
19:39:02FromDiscord<TryAngle> (I have never written any c except for basic universtiy cource)
19:48:46FromDiscord<Cypheriel> I'm so very confused. How does one convert a `PyObject` to an `int`
19:52:21NimEventerNew 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:49audiophilehi anyone doing aoc
20:12:02audiophilei 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:59audiophile_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:50nrds<Prestige99> There's a #nim-aoc challenge on irc, don't know if it's linked to discord or matrix though @audiophile
20:37:04nrds<Prestige99> Channel*
20:40:50audiophilegotcha thanks, will check if it's on libera
20:43:08audiophilehi, 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:26audiophilei assume we dont need to encode the url passed to getContent()?
20:52:25FromDiscord<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:57FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3GUB
21:05:21FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3GUC
21:05:58FromDiscord<geekrelief> I think it's the `void const ` that's causing the issue
21:06:30FromDiscord<geekrelief> try changing that to `const void `
21:08:19FromDiscord<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:52FromDiscord<Vindaar> In reply to @Cypheriel "I'm so very confused.": using `to`, so `x.to(int)`
21:16:24FromDiscord<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:50FromDiscord<Cypheriel> I had to do something rather unholy to get rid of the deprecation warning
21:16:59FromDiscord<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:26FromDiscord<Vindaar> In reply to @Cypheriel "I had to do": what deprecation warning was that?
21:54:46FromDiscord<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:03FromDiscord<zidsal> (edit) "t.[key]" => "t[key]"
21:55:48FromDiscord<Cypheriel> sent a code paste, see https://paste.rs/N0a
21:56:30FromDiscord<Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=3GUX
21:59:43*vicfred quit (Quit: Leaving)
22:00:49FromDiscord<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:18audiophileim awful
22:05:38FromDiscord<Elegantbeef> Possibly
22:05:43*audiophile_ joined #nim
22:05:44FromDiscord<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:32FromDiscord<Cypheriel> In reply to @Vindaar "ah, so it's from": it'd cause the same error
22:22:37FromDiscord<Cypheriel> I think...
22:22:51FromDiscord<Cypheriel> too lazy to test, tbh. as long as it works rn, idec lol
22:23:11FromDiscord<Cypheriel> by "error", I mean warning
22:34:55FromDiscord<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:52FromDiscord<geekrelief> In C it's a pointer to function, taking those params and returning a pointer to some constant data.
22:36:21FromDiscord<geekrelief> size_t is defined as a platform dependent unsigned integer
22:36:35*audiophile quit (Ping timeout: 252 seconds)
22:36:57FromDiscord<geekrelief> The weird part is that `const` can be before or after void and still be valid in C.
22:37:41FromDiscord<geekrelief> Currently, I think futhark would be the only thing that could properly handle it.
22:37:52FromDiscord<geekrelief> (edit) "it." => "it (automatically)."
22:39:19FromDiscord<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:51FromDiscord<TryAngle> ah I see thanks
22:57:23FromDiscord<TryAngle> is there a way to specify dependencies that are only used for tests?
23:12:44*PMunch quit (Quit: leaving)
23:20:36FromDiscord<geekrelief> In reply to @TryAngle "is there a way": what do you mean?
23:23:36FromDiscord<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:01FromDiscord<TryAngle> is nimble install globally the only solution to this or can this also be definined in the .nimble file?
23:31:03FromDiscord<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:44FromDiscord<dom96> sent a code paste, see https://play.nim-lang.org/#ix=3GVr
23:32:46FromDiscord<dom96> (Haven't tested this but might work :))
23:33:06FromDiscord<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:03FromDiscord<TryAngle> In reply to @dom96 "Test-only deps not supported": I will try that thanks
23:35:02FromDiscord<geekrelief> In reply to @dom96 "Test-only deps not supported": I do exactly this in my project.
23:36:02FromDiscord<geekrelief> Well not exactly, but `defined` plus a `.nims` config to switch between dev vs release version.
23:36:34FromDiscord<geekrelief> In reply to @Smarc "Hey Guys, you got": less verbose usually means templates or macros 🙂
23:37:13FromDiscord<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:55FromDiscord<geekrelief> just glanced over your code, you're basically changing some numbers between of branch right?
23:39:24FromDiscord<Smarc> Mosty I guess
23:39:25FromDiscord<geekrelief> I see the `if` is slightly different
23:39:38FromDiscord<geekrelief> you should probably use a template
23:40:08FromDiscord<geekrelief> pass in the `if` condition as a block to the template
23:40:22FromDiscord<Smarc> Never did work with templates before, could you give me a starting support? :)
23:40:58FromDiscord<geekrelief> templates are super easy. https://nim-lang.github.io/Nim/manual.html#templates
23:41:10FromDiscord<geekrelief> just code substitution
23:42:05FromDiscord<Smarc> I'll have a look into it, thank you
23:45:11FromDiscord<geekrelief> In reply to @Smarc "I'll have a look": something like this: https://play.nim-lang.org/#ix=3GVv
23:46:30FromDiscord<geekrelief> then call `chessLogic((6,7), (5, 7)): b.board[7][5]... `
23:46:47FromDiscord<geekrelief> (edit) "b.board[7][5]... `" => "b.board[7][5].color != None or b.board[7][6].color != None`"
23:47:09FromDiscord<geekrelief> though I'm not sure you really even need a template
23:47:21FromDiscord<geekrelief> why not call a proc?
23:47:55FromDiscord<Smarc> Just thought about that, I think I could just refactor it into a single proc
23:48:07FromDiscord<Smarc> I just programmed it the way I thought of it, step by step
23:49:36FromDiscord<geekrelief> For stuff that's really repetitive I created a macro
23:49:49FromDiscord<geekrelief> https://github.com/geekrelief/genit
23:56:35*Colt quit (Quit: Leaving)
23:58:39*Colt joined #nim