00:05:48 | * | TakinOver joined #nim |
00:50:24 | * | vicfred quit (Quit: Leaving) |
01:33:51 | * | ad-absurdum joined #nim |
01:43:22 | * | arkurious quit (Quit: Leaving) |
02:33:08 | * | xet7 quit (Quit: Leaving) |
02:51:57 | * | TakinOver quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
03:22:57 | FromDiscord | <evoalg> to get the max value in a seq containing ints, I can't seem to do: max(myseq), so I have to do: myseq[maxIndex(myseq)] ... is that really what I should do? |
03:23:15 | FromDiscord | <Elegantbeef> `myseq[^1]`? |
03:23:39 | FromDiscord | <evoalg> not the value of the max index, but the max value |
03:23:55 | FromDiscord | <Elegantbeef> `mySeq.high`? |
03:24:41 | FromDiscord | <evoalg> that's the max index, but I want the max value that myseq holds |
03:25:06 | FromDiscord | <Elegantbeef> you want the highest value stored in the seq? |
03:25:15 | FromDiscord | <evoalg> yes |
03:26:49 | FromDiscord | <evoalg> maxIndex returns the index of the maximum value of a seq, so maxIndex(myseq) returns the index of that highest value stored in seq, but to get that actual value, I seem to have to do: myseq[maxIndex(myseq)] ... other programming languages it's just "max(myseq)" |
03:27:24 | FromDiscord | <impbox [ftsf]> Sounds like something that would be in a statistics library |
03:28:27 | FromDiscord | <evoalg> ahhh ... I tried googling and looked at math, sequtils but they didn't have it ... and I couldn't see anything else in google .. I'll try stat library... |
03:29:23 | FromDiscord | <Rika> https://nim-lang.org/docs/sequtils.html#maxIndex%2CopenArray%5BT%5D |
03:29:59 | FromDiscord | <Elegantbeef> wait max should work |
03:30:20 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#max%2CopenArray%5BT%5D |
03:30:27 | FromDiscord | <Elegantbeef> !eval var a = @[10, 20, 5, 100, 3]; echo a.max |
03:30:29 | NimBot | 100 |
03:30:58 | FromDiscord | <evoalg> oh it works out of the box? ... gosh must be my code then ... thanks! |
03:31:21 | FromDiscord | <Elegantbeef> If you're doing `yourSeq.max = someVal` it wont work |
03:32:31 | FromDiscord | <evoalg> it works ... gosh I dunno what I was doing before ... hehe it was driving me a bit crazy ... thank you all for your help once again! |
03:33:12 | FromDiscord | <evoalg> (... and I thought it was strange that I could do "sum" but not "max" hehe) |
03:44:00 | * | ad-absurdum quit (Remote host closed the connection) |
03:46:25 | * | ad-absurdum joined #nim |
03:57:22 | * | ad-absurdum quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:32 | * | supakeen joined #nim |
04:25:00 | * | rockcavera quit (Remote host closed the connection) |
04:39:28 | FromDiscord | <theangryepicbanana> In reply to @Elegantbeef "If you're doing `yourSeq.max": wait this is a cool idea though |
04:41:03 | FromDiscord | <Elegantbeef> Sure it's doable just not clear what it should do 😛 |
04:41:55 | FromDiscord | <theangryepicbanana> it would assign the max value in a seq to something else, no? |
04:42:11 | FromDiscord | <Elegantbeef> It could or it could just add a new value that's max |
04:42:19 | FromDiscord | <Elegantbeef> Both would be technically correct |
04:42:37 | FromDiscord | <Elegantbeef> I'm kidding mostly, it should mutate |
04:42:40 | FromDiscord | <theangryepicbanana> yeah but that seems less helpful and less intuitive |
04:43:18 | FromDiscord | <theangryepicbanana> ah ok |
04:43:54 | FromDiscord | <Elegantbeef> But luckily it's easy to implement https://play.nim-lang.org/#ix=3D7O |
04:44:20 | FromDiscord | <theangryepicbanana> yeah I figured, pretty neat |
05:57:15 | NimEventer | New Nimble package! db_nimternalsql - An in-memory SQL database library, see https://github.com/rehartmann/nimternalsql |
06:27:29 | FromDiscord | <Revenant> hey there, just upgraded to 1.6.0 and i'm getting a lot of HoleEnumConv warnings in my code |
06:27:34 | FromDiscord | <Revenant> any way to suppress only those? |
06:27:46 | FromDiscord | <Revenant> can't use the hint disabling mechanism, because it's not a hint... |
06:29:24 | FromDiscord | <Revenant> ooooooo, just tried `warning "HoleEnumConv", false` and it worked! |
06:29:43 | FromDiscord | <Revenant> should be probably documented in the manual, though |
06:31:03 | FromDiscord | <Elegantbeef> It's in the compiler user guide and on the 1.6.0 changelogs |
06:31:44 | FromDiscord | <Revenant> cheers, but info about disabling hints is in the manual |
06:31:58 | FromDiscord | <Revenant> it's a bit counterintuitive to start looking for missing info in the compiler docs 🙂 |
06:32:09 | FromDiscord | <Revenant> if you don't find it in the manual |
06:32:24 | FromDiscord | <Elegantbeef> The compiler docs document the compiler interface |
06:32:42 | FromDiscord | <Elegantbeef> Guess you're using the pragma though |
06:33:01 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nimc.html#compiler-usage-list-of-warnings for reference |
06:33:36 | FromDiscord | <Revenant> yes yes, but the manual also partially contains info that's in the compiler manual, that is why it's misleading |
06:34:00 | FromDiscord | <Revenant> thanks for that link |
06:34:29 | FromDiscord | <Revenant> i'm talking about this |
06:34:30 | FromDiscord | <Revenant> https://nim-lang.org/docs/manual.html#pragmas-disabling-certain-messages |
06:34:39 | FromDiscord | <Revenant> that's in the manual but it only mentions hints |
06:34:58 | FromDiscord | <Elegantbeef> Yea it should mention warning/hints and link to the compiler guide for a list of them |
06:35:06 | FromDiscord | <Rika> Well it does |
06:35:09 | FromDiscord | <Rika> At the first line |
06:35:19 | FromDiscord | <Rika> Just the example doesn’t show warning disabling |
06:35:20 | FromDiscord | <Revenant> yes, because some people might just give up at that point instead of looking everywhere 🙂 |
06:35:31 | FromDiscord | <Elegantbeef> Well time for a PR to docs revenant 😛 |
06:35:38 | FromDiscord | <Revenant> haha yeah 😄 |
06:35:46 | FromDiscord | <Revenant> i might do that actually |
06:35:47 | FromDiscord | <Rika> Smh beef you’re lazy why not do it yourself |
06:35:53 | FromDiscord | <Rika> I’m joking |
06:35:57 | FromDiscord | <Revenant> noticed the manual is lagging behind quite a bit in general |
06:35:58 | FromDiscord | <Elegantbeef> too busy looking at the VM |
06:36:11 | FromDiscord | <Rika> Man are you in love with it or something |
06:36:22 | FromDiscord | <Elegantbeef> No i'm trying to clean it up/optimize it |
06:37:22 | FromDiscord | <Elegantbeef> I did find something that can cause a sizable compilation impact if using macros so take that 😛 |
06:40:41 | FromDiscord | <Rika> What is it |
06:40:44 | FromDiscord | <Revenant> umm, disabling warnings work when provided as a compiler flag, but how do i do it per file? or per proc would be even better |
06:40:51 | FromDiscord | <Revenant> tried this at the top of the file `{.warningHoleEnumConv:off.}` |
06:40:58 | FromDiscord | <Rika> Probably using push |
06:41:03 | FromDiscord | <Revenant> that just gives me an error |
06:41:05 | FromDiscord | <Rika> Push and pop |
06:41:06 | FromDiscord | <Revenant> `Error: cannot attach a custom pragma to 'persistence'` |
06:41:10 | FromDiscord | <Elegantbeef> you dont need to push it |
06:41:30 | FromDiscord | <Rika> In reply to @Revenant "tried this at the": Isn’t this missing the angle brackets |
06:41:33 | FromDiscord | <Rika> Sorry |
06:41:37 | FromDiscord | <Rika> Square brackets |
06:41:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3D8b |
06:41:50 | FromDiscord | <Rika> Am I going insane |
06:42:00 | FromDiscord | <Revenant> right... |
06:42:00 | FromDiscord | <Elegantbeef> or do `{.push warningHoleEnumConf.}` with `{.pop.}` |
06:42:00 | FromDiscord | <Revenant> thanks |
06:42:13 | FromDiscord | <Revenant> the manual actually contains some references to that in an offhand manner |
06:42:22 | FromDiscord | <Revenant> in the examples |
06:42:58 | FromDiscord | <Revenant> yeah so a general comment, and don't take it a wrong way, i think it should be made easy to find this info in the manual for a clueless person like me 🙂 |
06:43:25 | FromDiscord | <Revenant> anyway, thanks, that gets me past my problems for now 🙂 |
06:44:40 | FromDiscord | <Revenant> that push pragma thing is nifty |
06:47:17 | FromDiscord | <Elegantbeef> Though sadly doesnt work with destructors so you cannot error selectively on implicit copies |
06:47:29 | FromDiscord | <Elegantbeef> And you cannot make your own |
06:48:47 | FromDiscord | <Rika> I think the push pragma is a hack |
06:49:20 | FromDiscord | <Yardanico> why? |
06:49:46 | FromDiscord | <Yardanico> imo it's actually a pretty good alternative to indentation if you want to switch some stuff for a big block of code |
06:49:52 | FromDiscord | <Revenant> seems like you can only use it around proc/template/etc declarations, but not inside them |
06:49:55 | FromDiscord | <Revenant> still, that's good enough |
06:50:28 | FromDiscord | <Revenant> tried to narrow it down the usage to just a single line, but that didn't work. had to wrap the whole proc. |
06:50:58 | FromDiscord | <Elegantbeef> given the work why not just do `enum.ord.otherEnum`? |
06:52:37 | FromDiscord | <Revenant> well if you have a HoleyEnum, say E, whenever you do E(intval), you get the warning |
06:53:04 | FromDiscord | <Revenant> even if you use `enumutils` and do `E.items`, you get the warning |
06:53:27 | FromDiscord | <Revenant> so to me it seems the only way it just to suppress it |
06:53:34 | FromDiscord | <Revenant> (edit) "it" => "is" |
06:53:56 | FromDiscord | <Revenant> now i have this which is fine |
06:54:08 | FromDiscord | <Revenant> sent a code paste, see https://play.nim-lang.org/#ix=3D8e |
06:54:17 | FromDiscord | <Revenant> (edit) |
06:54:39 | FromDiscord | <Revenant> actually, could get rid of the `name`... |
06:54:41 | FromDiscord | <Elegantbeef> `YourEnum(range[YourEnum.low.ord..YourEnum.high.ord](yourInt))` |
06:54:41 | FromDiscord | <Elegantbeef> Seems to work to me |
06:55:01 | FromDiscord | <Elegantbeef> you're catching an enum defect |
06:55:08 | FromDiscord | <Elegantbeef> Dont catch defects |
06:55:49 | FromDiscord | <Revenant> ok, but why does that matter if they're catchable? |
06:56:00 | FromDiscord | <Elegantbeef> Cause they're not always catachable |
06:56:07 | FromDiscord | <Elegantbeef> They're only catchable in some dialects |
06:56:09 | FromDiscord | <Rika> There is a setting that will not make them catchable |
06:56:23 | FromDiscord | <Revenant> hmm okay |
06:56:26 | FromDiscord | <Rika> It will crash the program instead |
06:56:37 | FromDiscord | <Elegantbeef> Nah it'll silently work |
06:56:51 | FromDiscord | <Elegantbeef> here is a write up about it https://forum.nim-lang.org/t/8342#53776 |
06:57:04 | FromDiscord | <Revenant> hmm, `std/enumutils` doesn't seem that useful then |
06:59:55 | FromDiscord | <Revenant> well, your example still gives me the warning |
06:59:58 | FromDiscord | <Revenant> `Warning: conversion to enum with holes is unsafe: Foo(range[low(Foo).ord .. high(Foo).ord](5)) [HoleEnumConv]` |
07:00:05 | FromDiscord | <Elegantbeef> Odd |
07:00:10 | FromDiscord | <Elegantbeef> maybe i did it wrong 😀 |
07:00:11 | FromDiscord | <Revenant> in any case, i'm happy with catching the defect for now 🙂 it works |
07:00:27 | FromDiscord | <Elegantbeef> Is this for a library or your own code? |
07:00:34 | FromDiscord | <Revenant> my own code |
07:00:47 | FromDiscord | <Revenant> i mean, some app i will release in binary form |
07:01:10 | FromDiscord | <Elegantbeef> Well as long as you build it so you can catch defects you'll be fine, but it's bad form |
07:01:14 | FromDiscord | <Revenant> yeah i get your point it can be problematic for a library that people are going to use in different ways on different platforms etc |
07:01:56 | FromDiscord | <Elegantbeef> So just disregard the defect then and ensure you never accidently disable catching defects 😛 |
07:01:59 | FromDiscord | <Revenant> yeah, the only option is to suppress the warning, convert the result to string |
07:02:18 | FromDiscord | <Revenant> and if you instantiated a "hole", then this will be the stringified value: `2 (invalid data!)` |
07:02:47 | FromDiscord | <Revenant> then check if the string contains `(invalid data!)`... i thought using `symbolRank` will be less hacky |
07:03:06 | FromDiscord | <Revenant> ...but then i need to catch a defect 🤷♂️ hence i said, `enumutils` doesn't seem that useful, after all... |
07:03:32 | FromDiscord | <Elegantbeef> Yea this is the prefered solution imo but i'm biased 😀 https://forum.nim-lang.org/t/8188#52705 |
07:03:36 | * | pro joined #nim |
07:05:37 | FromDiscord | <Revenant> thanks, probably this could go into the stdlib |
07:05:43 | FromDiscord | <Revenant> i'll try this |
07:05:57 | FromDiscord | <Revenant> guess it's a bit slower, but it doesn't actually matter in my case |
07:06:45 | FromDiscord | <Elegantbeef> It's 3 checks 1 of which is bitwise, so it's not overly complex |
07:11:27 | * | PMunch joined #nim |
07:33:50 | * | casionaut joined #nim |
07:53:36 | meowray | `var a: seq[cint]; a.reverse` generates something like `reverse_a_175((a0.p)->data, a0.len);` which may be a null pointer dereference. Does reverse support empty seq? |
07:56:54 | FromDiscord | <haxscramper> !eval import std/algorithm; var a: seq[int]; a.reverse() |
07:56:56 | NimBot | <no output> |
07:57:25 | FromDiscord | <haxscramper> as you can see there is no failure in execution, so yes |
07:57:34 | FromDiscord | <Yardanico> @haxscramper wonder how that works though |
07:57:48 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3D8w |
07:58:30 | meowray | i get a failure by compiling with -fsanitize=undefined |
07:58:50 | meowray | for-submit.c:2057:23: runtime error: member access within null pointer of type 'struct tySequence__9apztJSmgERYU8fZOjI4pOg_Content' |
07:59:51 | FromDiscord | <Yardanico> well nim doesn't always play nice with C compiler sanitizers like this :) |
07:59:56 | FromDiscord | <Yardanico> especially refc |
08:00:00 | FromDiscord | <haxscramper> I guess it has something to do with pointer magic |
08:03:57 | meowray | ok, i believe `var a: seq[int]; a.reverse()` is an arc/orc specific problem due to `reverse_a_175((a0.p)->data, a0.len);` refc seems fine |
08:26:14 | * | casionaut quit (Remote host closed the connection) |
09:28:48 | FromDiscord | <Stuffe> Does anyone know how garbage collection works with multi threading? I am creating a new thread with createThread(), but it looks like the garbage of that thread is not getting collected |
09:29:44 | FromDiscord | <Rika> Every thread has its own collector I would be led to believe |
09:29:51 | FromDiscord | <Rika> How are you passing data between threads |
09:29:59 | FromDiscord | <Stuffe> I use 2 channels |
09:30:07 | FromDiscord | <Stuffe> one for each direction |
09:31:00 | FromDiscord | <Rika> What kind of garbage are you seeing that isn’t being collected |
09:31:31 | FromDiscord | <Stuffe> I can just tell from system monitor that the program memory grows each time I send a task to the thread |
09:31:39 | FromDiscord | <Stuffe> and it never goes away |
09:32:09 | FromDiscord | <Stuffe> I know you may think I could have a reference to the data somewhere, but I really don't think that is the case |
09:32:56 | FromDiscord | <Stuffe> I might try to kill the threads and respawn them after each task instead of keeping this one thread alive |
09:33:36 | FromDiscord | <Rika> You can force a GC call |
09:33:56 | FromDiscord | <Rika> https://nim-lang.org/docs/gc.html |
09:35:28 | FromDiscord | <Stuffe> I tried GC_step, it only seems to work in the main thread |
09:36:54 | * | Vladar joined #nim |
09:36:57 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#GC_fullCollect |
09:41:10 | FromDiscord | <Stuffe> ok just tried that and it didn't help. But checking getFreeMem() from the first page you sent |
09:41:21 | FromDiscord | <Stuffe> that number just increases explosively |
09:41:38 | FromDiscord | <Stuffe> meaning the GC reserves a bunch of memory it doesn't reuse for some reason |
09:43:42 | FromDiscord | <Stuffe> no actually the used memory is also exploading |
09:44:16 | FromDiscord | <enthus1ast> Is this the winapi createThread? If yes, does the gc also works there? |
09:44:57 | FromDiscord | <Stuffe> https://nim-lang.org/docs/threads.html it is the one mentioned here |
09:45:00 | FromDiscord | <enthus1ast> Maybe with orc? |
09:45:48 | FromDiscord | <Stuffe> no I am not using orc |
09:45:58 | FromDiscord | <enthus1ast> Can you try? |
09:46:20 | FromDiscord | <Stuffe> wouldn't that be worse since it doesn't collect cycles? |
09:46:24 | FromDiscord | <Stuffe> I can try though why not |
09:46:29 | FromDiscord | <Yardanico> In reply to @Stuffe "wouldn't that be worse": what? |
09:46:34 | FromDiscord | <Yardanico> orc does collect cycles, arc doesn't |
09:48:03 | FromDiscord | <Stuffe> ah yes sorry |
09:48:27 | FromDiscord | <Stuffe> the library I am using does not allow me to use orc, I was able to try a few of the other ones though |
09:48:34 | FromDiscord | <Rika> Why not |
09:48:41 | FromDiscord | <Yardanico> what library? just curious |
09:48:51 | FromDiscord | <Stuffe> `/Users/stefanlund/.nimble/pkgs/godot-0.8.5/nim/godotnim.nim(899, 3) Error: undeclared identifier: 'GC_disable'` |
09:48:56 | FromDiscord | <Yardanico> oh godot nim |
09:48:56 | FromDiscord | <Stuffe> (edit) "`/Users/stefanlund/.nimble/pkgs/godot-0.8.5/nim/godotnim.nim(899," => "`/Users/.nimble/pkgs/godot-0.8.5/nim/godotnim.nim(899," |
09:49:06 | FromDiscord | <Yardanico> also why does it use GC_disable |
09:49:09 | FromDiscord | <Rika> Probably needs to put that under a when |
09:49:28 | * | xet7 joined #nim |
09:49:36 | FromDiscord | <Stuffe> I tried commented a few lines out just to try, but there are too many |
09:49:50 | FromDiscord | <Stuffe> it is built for the default GC with realtime I guess |
09:49:58 | FromDiscord | <Yardanico> not really |
09:50:03 | FromDiscord | <Rika> Comment them all with sed |
09:50:05 | FromDiscord | <Yardanico> i don't see it using any "realtime" features of refc :) |
09:50:20 | FromDiscord | <Yardanico> ah nvm, actually yes, it does use GC_step |
09:50:25 | FromDiscord | <Stuffe> yeah |
09:50:30 | FromDiscord | <Stuffe> In reply to @Rika "Comment them all with": sed? |
09:50:31 | FromDiscord | <Yardanico> but yeah, you can try just removing GC_disable and GC_step and see if it works |
09:50:39 | FromDiscord | <Yardanico> with orc |
09:50:56 | FromDiscord | <Stuffe> https://media.discordapp.net/attachments/371759389889003532/903219272447316018/Screen_Shot_2021-10-28_at_12.50.51.png |
09:51:07 | FromDiscord | <Stuffe> https://media.discordapp.net/attachments/371759389889003532/903219320073650186/Screen_Shot_2021-10-28_at_12.51.03.png |
09:51:16 | FromDiscord | <Stuffe> these places also throw errors using orc |
09:51:33 | FromDiscord | <Rika> That looks like funky code that shouldn’t be there ngl |
09:51:38 | FromDiscord | <Yardanico> oh well, seems like those leaks you are experiencing might as well come from godot nim itself |
09:52:15 | FromDiscord | <Yardanico> it does seem to use a lot of the gc options extensively :) |
09:52:39 | FromDiscord | <Stuffe> any suggestions? |
09:53:49 | FromDiscord | <Stuffe> I will try to respawn the thread for each task, just in case this somehow causes those objects to get collected |
10:05:57 | FromDiscord | <r2> sent a long message, see http://ix.io/3D9n |
10:06:48 | FromDiscord | <Rika> Async functions are iterator s |
10:06:52 | FromDiscord | <Rika> (edit) "iterator s" => "iterators" |
10:11:23 | FromDiscord | <r2> ah :D |
10:35:52 | FromDiscord | <Stuffe> trying to use threads that compute a single result and die, I keep getting this kind of error: `'threading_get_latest' is not GC-safe as it accesses 'data_result' which is a global using GC'ed memory` |
10:37:07 | FromDiscord | <Stuffe> I am guessing this means that I can't use dynamically sized global objects in threads in general? |
10:42:14 | FromDiscord | <Rika> You can’t use global objects period |
10:42:16 | FromDiscord | <Rika> Afaik |
10:42:25 | FromDiscord | <Rika> Unless you go tell the compiler shh it’s fine |
10:42:32 | FromDiscord | <Rika> With a cast gcsafe |
10:42:36 | FromDiscord | <Stuffe> how am I supposed to get data back then? |
10:42:38 | FromDiscord | <Rika> I don’t remember the specific syntax |
10:43:00 | FromDiscord | <Yardanico> In reply to @Stuffe "how am I supposed": with refc you can't use global variables that have GC'd types |
10:43:08 | FromDiscord | <Yardanico> because each thread has its own heap |
10:43:16 | FromDiscord | <Stuffe> ok I see |
10:43:28 | FromDiscord | <Yardanico> so you either pass by channels, messages, or something like that, or allocate memory by yourself with raw pointers |
10:43:56 | FromDiscord | <Stuffe> I was passing by channels |
10:43:59 | FromDiscord | <Yardanico> but if you're planning on accessing the same global variable from separate threads at the same time you should also use locks of course |
10:44:35 | FromDiscord | <Stuffe> just now I was trying to use the thread_pool thing |
10:44:48 | FromDiscord | <Stuffe> but I need to keep a reference to the resulting FlowVar |
10:45:32 | FromDiscord | <Stuffe> Idk, if you guys know the specifics of this, but basically a reference to the running thread, so I can ask it if it is done and has the result for me |
10:46:41 | FromDiscord | <Stuffe> I guess I could try using createThread like my first attempt, then pass the result back through Channel and then let it die and respawn it |
10:46:43 | FromDiscord | <Rika> Ideally you would just do message passing “I need this, parameters are this, my address is this, post back” |
10:47:34 | FromDiscord | <Stuffe> Ok, I never tried that before, could you please elaborate a little bit on how I get started |
10:47:59 | FromDiscord | <Rika> Well I was just saying that conceptually |
10:48:38 | FromDiscord | <Stuffe> I guess you are saying I should pass a pointer to the memory where I want the result to be stored? |
10:50:04 | FromDiscord | <Rika> No, address as in channel |
10:50:23 | FromDiscord | <Rika> “This is the channel you use to contact me back” I guess, but then the issue is how to pass such channel |
10:51:06 | FromDiscord | <Stuffe> Originally I used one channel for sending to the thread and one channel for receiving the results back |
10:51:22 | FromDiscord | <Stuffe> but yeah, it didn't garbage collect in the thread |
11:48:44 | * | rockcavera joined #nim |
11:48:44 | * | rockcavera quit (Changing host) |
11:48:44 | * | rockcavera joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:32 | * | supakeen joined #nim |
12:16:35 | PMunch | @r2, if you want to understand what's going on with Async check out this: https://peterme.net/asynchronous-programming-in-nim.html |
12:16:43 | PMunch | In particular appendix A |
12:30:27 | * | tk quit (Quit: Well, this is unexpected.) |
12:32:10 | * | tk joined #nim |
12:41:08 | * | arkurious joined #nim |
12:51:22 | FromDiscord | <Imperatorn> Hey again guys |
12:52:13 | FromDiscord | <Imperatorn> (remember I'm a Nim noob) Have a question about async/await or coroutines or <<insert_name_that_nim_uses_here>> |
12:52:47 | FromDiscord | <Imperatorn> Coming from languages like Erlang, I'm used to having peace of mind when it comes to process isolation |
12:53:05 | * | neurocyte0132889 joined #nim |
12:53:06 | * | neurocyte0132889 quit (Changing host) |
12:53:06 | * | neurocyte0132889 joined #nim |
12:53:15 | FromDiscord | <Imperatorn> Someone told me about Go that, if a coroutine crashes, the entire program crashes, which sounded kinda insane to me. |
12:53:51 | FromDiscord | <Imperatorn> That made me wonder how Nim does it. Does it rely on normal threads, a fiber approach etc |
12:54:47 | FromDiscord | <Imperatorn> Or rather the question might be:↵If I want to isolate some unit of execution in Nim (so that a crash in A doesn't spread to B), how would I do it.↵↵Thanks |
12:55:08 | PMunch | Total separation? Run it as a separate program |
12:55:17 | FromDiscord | <enthus1ast> Yes if you use async and your async procedure crash (and the exception is not catched) your whole application will crash as well |
12:55:18 | PMunch | But you could also wrap things in a try statement |
12:56:01 | FromDiscord | <enthus1ast> Hu didn't know that erlang does this I maybe should have a look at erlang 😁 |
12:56:49 | FromDiscord | <enthus1ast> I think the same is for threads but I'm not 100% sure |
12:56:52 | FromDiscord | <Imperatorn> Erlang is extreme in this sense |
12:57:02 | PMunch | I mean that is what it is designed for |
12:57:05 | PMunch | So it makes sense |
12:57:07 | FromDiscord | <Imperatorn> Yeah |
12:57:18 | PMunch | Threads are the same in Nim, crash one thread and you crash them all |
12:57:52 | FromDiscord | <Imperatorn> Yes, I just thought maybe there are some green threads/fiber library which handled things for you in some way |
12:59:42 | FromDiscord | <Imperatorn> Anyway, thanks for answering. I think I'll still use the "let it crash" mindset, but wrap it in try-catch or something similar |
13:00:32 | FromDiscord | <Rika> not really the same idea i would say |
13:00:35 | FromDiscord | <Rika> when you catch stuff |
13:01:03 | FromDiscord | <Rika> if you really want to do it like erlang you'd prolly use different processes or design the system in nim yourself (though that might even need a language fork) |
13:02:16 | PMunch | I wonder how Erlang does that actually |
13:02:23 | PMunch | I mean it has to be separate processes right? |
13:05:36 | FromDiscord | <Imperatorn> Yes, separate stacks and heaps, everything is isolated |
13:05:55 | FromDiscord | <Imperatorn> Message passing between "processes" |
13:06:14 | FromDiscord | <Imperatorn> A process in Erlang is nothing like a OS process or thread |
13:06:58 | FromDiscord | <Rika> vm process afaik |
13:07:00 | FromDiscord | <Imperatorn> It's a lightweight thing, about 300 bytes or so |
13:07:01 | PMunch | Nothing like it? It's gotta be somewhat like it if it doesn't cause a crash |
13:07:03 | PMunch | Oh wait |
13:07:05 | FromDiscord | <Imperatorn> Yes |
13:07:09 | PMunch | Duh, Erlang runs in a VM |
13:07:13 | FromDiscord | <Rika> ya forgot? 😛 |
13:07:27 | pro | I always wondered how earlang bypasses limit of 65k TCP ports |
13:07:32 | PMunch | Yeah I was super confused there for a second |
13:08:24 | FromDiscord | <Imperatorn> In reply to @pro "I always wondered how": Does it? I don't recall |
13:08:52 | FromDiscord | <Rika> "bypass" because its on the vm it doesnt need tcp ports i assume |
13:09:01 | FromDiscord | <Imperatorn> Oh you mean in the Erlang world |
13:09:38 | FromDiscord | <Imperatorn> Yeah it can be raised to 268 435 456 |
13:09:56 | pro | but how/why |
13:10:07 | FromDiscord | <Imperatorn> Why not 😎 |
13:10:40 | FromDiscord | <Rika> why? prolly needed in erlang because of how it works |
13:10:49 | FromDiscord | <Rika> how? again, implemented in vm |
13:10:59 | FromDiscord | <Rika> a vm makes things easier |
13:11:12 | pro | got it |
13:24:43 | PMunch | What does this mean? Warning: suspicious code: enum to enum conversion [EnumConv] |
13:25:24 | FromDiscord | <Rika> you uh |
13:25:29 | FromDiscord | <Rika> converted from an enum to another enum |
13:25:43 | FromDiscord | <Rika> apparently that isnt desirable, you have to convert from enum to ordinal to enum |
13:25:48 | FromDiscord | <enthus1ast> 65k TCP ports? |
13:25:59 | FromDiscord | <Rika> what about the tcp ports |
13:26:07 | FromDiscord | <enthus1ast> s socket constist if yourIP\:port + remoteIP\:port |
13:26:15 | FromDiscord | <Rika> yes |
13:26:42 | FromDiscord | <enthus1ast> only relevant afaik when you run behind a proxy or so |
13:26:56 | FromDiscord | <enthus1ast> but even then you can always assign another ip or use ipv6 |
13:27:21 | FromDiscord | <Rika> assign another ip? |
13:27:42 | FromDiscord | <enthus1ast> that you have more allowed sockets |
13:28:08 | FromDiscord | <enthus1ast> or addressable sockets |
13:30:04 | PMunch | @Rika, I don't though. As far as I can tell |
13:30:26 | PMunch | I do `if someobject.field in {enumVal1, enumVal2}` |
13:31:32 | FromDiscord | <Rika> is that the line where the warning pops up? then it might be a system thing |
13:40:33 | FromDiscord | <Gumber> @Imperatorn I work in Elixir for my day job |
13:42:34 | FromDiscord | <Gumber> also writing the backend for my game in Elixir |
13:47:24 | FromDiscord | <Gumber> Nim doesn't have anything like BEAM's supervisor hierarchy / process isolation - it does have channels to facilitate message passing and previously there were some libraries that focused on the actor model but I think they're very old and outdated at this point |
13:47:58 | FromDiscord | <Gumber> as far as green threads go - nim has closure iterators and now CPS is in the works |
13:48:08 | * | pro quit (Quit: WeeChat 3.3) |
13:48:26 | FromDiscord | <Gumber> I've also implemented fibers /coroutines using boost's context library (deboostified) |
13:59:57 | FromDiscord | <Imperatorn> Interesting 👌 |
14:09:21 | * | casionaut joined #nim |
14:14:19 | * | lively_sparkle joined #nim |
14:30:37 | * | pch is now known as kinkinkijkin |
14:42:14 | FromDiscord | <no name fits> I keep forgetting that ^1 is last element and not ^0. Is there a good way to memorize it other than repetition? |
14:42:45 | FromDiscord | <Rika> nth to the last |
14:43:28 | FromDiscord | <Rika> wrt deepcopy, why is it off by default on [ao]rc? |
14:44:29 | nrds | <Prestige99> @no name fits I think of it as -1 |
14:45:18 | nrds | <Prestige99> but with ^ it moves "left" from the 0th element, bringing it to the rightmost element (like it loops around) |
14:47:33 | FromDiscord | <Rika> afaik its why it's 1 indexed, to copy python afaik |
14:51:35 | FromDiscord | <no name fits> In reply to @nrds "<Prestige> but with ^": That makes sense to me |
14:55:54 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3DaS |
14:56:08 | FromDiscord | <haxscramper> for `var stack: seq[T]` and for `var generalList: seq[T]` |
14:58:16 | FromDiscord | <Rika> ~~tail~~ |
14:58:51 | FromDiscord | <haxscramper> I have this one as well |
14:59:16 | FromDiscord | <haxscramper> Though ideal signature would be a `func tail[T](s: seq[T]): openarray[T]`, but without view types it is super expensive |
14:59:41 | FromDiscord | <haxscramper> and I think I ran into some bug when I tried to use it this, way so I just dropped it altogether |
15:13:33 | * | lain quit (Ping timeout: 265 seconds) |
15:14:27 | * | lain joined #nim |
15:18:18 | FromDiscord | <Rika> beef are ya here? if ya aint then ping me, do you have any benchmark numbers for ya nimscripter? |
16:06:40 | FromDiscord | <MrMadPie> hello |
16:07:18 | FromDiscord | <MrMadPie> i keep seeing things like `{.gcsafe}` in function definitions and i don't understand what those are called and what they do |
16:07:24 | FromDiscord | <MrMadPie> can anyone clear that up for me? |
16:08:53 | nrds | <Prestige99> They are called pragmas, I believe they are documented in the manual |
16:09:35 | nrds | <Prestige99> https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect |
16:13:45 | * | kayabaNerve quit (Ping timeout: 260 seconds) |
16:15:36 | * | kayabaNerve joined #nim |
16:21:46 | NimEventer | New thread by Ggibson: Basic nimterop usage for simple c++ struct?, see https://forum.nim-lang.org/t/8555 |
16:23:12 | * | vicecea quit (Remote host closed the connection) |
16:23:44 | * | vicecea joined #nim |
16:33:53 | FromDiscord | <MrMadPie> thank you |
16:38:19 | * | lively_sparkle quit (Ping timeout: 260 seconds) |
16:51:10 | * | andylearningnimt joined #nim |
17:00:48 | andylearningnimt | Hello! I have some confusion about declaring objects: can I specify a field's initial value? can I specify that a certain proc be run whenever the object is instantiated? |
17:02:03 | FromDiscord | <Rika> no |
17:02:03 | FromDiscord | <Rika> no |
17:02:26 | FromDiscord | <Rika> common convention is to make an initialiser proc for instantiation |
17:02:34 | FromDiscord | <Rika> instead of using object construction synta |
17:02:35 | FromDiscord | <Rika> (edit) "synta" => "syntax" |
17:02:47 | FromDiscord | <Rika> initial values go in such proc as well |
17:03:12 | FromDiscord | <Rika> RFCs are in place for both initial values and more standardised initialisation procedures |
17:03:33 | * | lively_sparkle joined #nim |
17:04:06 | * | kayabaNerve quit (Remote host closed the connection) |
17:04:16 | andylearningnimt | Thanks |
17:04:25 | * | kayabaNerve joined #nim |
17:07:41 | andylearningnimt | What's the simplest way to determine what a type's default value is? e.g. looking at https://nim-lang.org/docs/manual.html#types-boolean-type I can't tell if my objects' boolean fields will be true or false |
17:09:57 | FromDiscord | <Rika> default(T) |
17:10:06 | FromDiscord | <Rika> all values are zero initialised |
17:10:18 | FromDiscord | <Rika> eg booleans will always be false |
17:10:22 | FromDiscord | <Rika> integers 0 |
17:10:30 | FromDiscord | <Rika> strings empty |
17:10:51 | FromDiscord | <Rika> (note that strings and seqs are somewhat special in that they are implemented as pointers but do not behave like such) |
17:11:37 | andylearningnimt | Thank you again |
17:17:35 | * | casionaut quit (Quit: o7) |
17:21:06 | FromDiscord | <Alea> I used nim for a code signal test↵And I got boofed because of an index error that wouldn't show a line number 😒 |
17:21:21 | andylearningnimt | OK now I have an object field that is seq[string], and in a proc try to add a string to it, but apparently that field is immutable? field is lst (line 18) add at line 30: http://ix.io/3DbX |
17:21:27 | FromDiscord | <Alea> I wonder if that was nim or codesignal's fault |
17:22:19 | FromDiscord | <Rika> andy, objects need to be marked as mutable |
17:22:25 | FromDiscord | <Rika> `proc init(self: var Allergies) =` |
17:22:48 | FromDiscord | <Rika> same with `is_allergic_to` |
17:22:51 | andylearningnimt | oh as a parameter? cool cool cool thanks |
17:26:08 | andylearningnimt | oof but the included tests from exercism use an immutable instance, so I guess I have to rethink how I'm doing everything |
17:29:38 | FromDiscord | <Rika> create a copy and return the copy |
17:32:51 | andylearningnimt | OK, thank you, I'll think this way. A copy of the object? None of my procs return an object right now, and if I copied it during init, I'd still have to add a whole caching mechanism anyway to prevent calculating the lst field every time is_allergic_to is called, I think. |
17:34:36 | * | kayabaNerve quit (Remote host closed the connection) |
17:34:51 | andylearningnimt | So I think I'll start a cache as a map of score to seq |
17:34:55 | * | kayabaNerve joined #nim |
17:57:24 | * | PMunch_ joined #nim |
18:03:04 | * | PMunch quit (Killed (NickServ (GHOST command used by [email protected]))) |
18:03:10 | * | PMunch_ is now known as PMunch |
18:03:29 | * | PMunch_ joined #nim |
18:08:18 | andylearningnimt | Rika: The tests from exercism (so I shouldn't change them) have, e.g.:: let allergies = Allergies(score: 1); check allergies.lst == @["eggs"] :: How or where could I be returning a copy so I can modify the field? |
18:09:19 | FromDiscord | <Imperatorn> In reply to @Gumber "<@!750836245919170771> I work in": Btw, have you tried the BeamAsm? |
18:10:58 | FromDiscord | <Gumber> In reply to @Imperatorn "Btw, have you tried": I haven't! Thanks for cluing me into this - I figured something like this had to exist but I hadn't really poked around much yet |
18:12:53 | FromDiscord | <Gumber> I might already be using it and just not know - but I doubt it |
18:14:59 | andylearningnimt | I just don't understand how I can do the calculation when the instantiations and tests are outside my control, and the field is checked immediately after that initialization. |
18:18:44 | FromDiscord | <Rika> Is the object itself out of your control |
18:18:52 | FromDiscord | <Rika> Can you link me the exercise I’ll read it |
18:19:11 | andylearningnimt | Rika: no I can define it, just the tests should be unchanged. 1 sec |
18:19:48 | FromDiscord | <Rika> Recall that in Nim, that syntax doesn’t only mean a field |
18:19:55 | andylearningnimt | instructions: http://ix.io/3Dcj -- tests: http://ix.io/3Dci |
18:20:31 | andylearningnimt | Rika: oh, I thought maybe I could make it a fake field and actually a proc, but then it complained about the field being missing so I must have done that wrong if it's possible |
18:20:40 | andylearningnimt | (lst, that is) |
18:21:55 | andylearningnimt | my latest attempt: http://ix.io/3Dcl |
18:22:23 | FromDiscord | <Rika> “Complained that the field is missing” how |
18:22:27 | FromDiscord | <Rika> In what way |
18:22:48 | FromDiscord | <Rika> You didn’t export the proc |
18:22:49 | andylearningnimt | "test_allergies.nim(175, 20) Error: undeclared field: 'lst' for type allergies.Allergies" |
18:22:52 | FromDiscord | <Rika> That’s why it complained |
18:22:54 | andylearningnimt | ohh |
18:22:59 | andylearningnimt | ugh, thank you again |
18:23:48 | andylearningnimt | compiling nicely, now to go find out all the other mistakes I've made |
18:25:12 | andylearningnimt | ah yes I wanted to see if Tables filled in default values for missing keys, which they don't |
18:25:55 | FromDiscord | <Elegantbeef> Ah that's a nice challenge |
18:27:47 | FromDiscord | <Elegantbeef> More solutions than i'd think to use sets to solve it |
18:35:31 | FromDiscord | <Imperatorn> In reply to @Gumber "I might already be": Depends. I think atm you need to run 64-bit x86 for it to be enabled |
18:41:11 | * | lively_sparkle quit (Ping timeout: 264 seconds) |
18:41:18 | FromDiscord | <Gumber> In reply to @Imperatorn "Depends. I think atm": found out we're quite a few versions behind so I dont't hink we're using it |
18:44:04 | andylearningnimt | Is there a common, obvious way to prepend to a seq? |
18:44:34 | FromDiscord | <Elegantbeef> `insert`? |
18:44:56 | PMunch | Or concat if you want to add more than one value |
18:46:05 | andylearningnimt | thanks, I thought maybe I could add an element without first wrapping it in a second seq, I'll use insert |
18:47:22 | andylearningnimt | oh unless I can do that if I go find out what sink means. I'll check it out |
18:53:37 | andylearningnimt | Thanks to all the help, I'm *almost* there, just one case to fix. current version: http://ix.io/3Dcs |
18:54:04 | * | lively_sparkle joined #nim |
19:14:14 | * | sagax quit (Remote host closed the connection) |
19:21:52 | PMunch | Man editing these videos on Badger takes forever.. |
19:21:58 | PMunch | There has to be a better way |
19:29:17 | nrds | <Prestige99> What are you doing? |
19:31:48 | FromDiscord | <Elegantbeef> Methinks he's editing videos of him using badger from his keyboard streams |
19:32:07 | PMunch | Almost |
19:32:20 | PMunch | I'm editing down the original streams into a more watchable format |
19:32:43 | PMunch | Like I did for the first three videos |
19:32:59 | PMunch | I have 4-7 that I've recorded but not edited -_- |
19:39:41 | FromDiscord | <tandy> https://github.com/jjv360/nim-classes |
19:39:50 | FromDiscord | <tandy> has anyone used this? |
19:40:34 | FromDiscord | <Elegantbeef> I know impbox used oolib |
19:41:10 | andylearningnimt | woohoo, just posting my finally-passing-the-tests but amateur solution to the exercism problem I've been working on: http://ix.io/3DcI |
19:43:07 | FromDiscord | <tandy> oh this looks good |
19:45:01 | FromDiscord | <Elegantbeef> Nice andy, very elaborate though 😀 |
19:45:12 | * | lively_s1 joined #nim |
19:46:11 | FromDiscord | <tandy> whats the fastest / easiest gui library? i need to make a tictactoe game quick lol |
19:47:01 | FromDiscord | <Elegantbeef> Nigui, Nimx, Gintro, Nico one of these has to be usable for you |
19:47:11 | * | lively_sparkle quit (Ping timeout: 245 seconds) |
19:47:20 | FromDiscord | <tandy> ive used gintro |
19:47:21 | PMunch | Nico would probably be a good match |
19:47:32 | PMunch | Or maybe even Pixie |
19:47:34 | FromDiscord | <Elegantbeef> Nico is a game framework so probably the easiest |
19:47:34 | andylearningnimt | Elegantbeef: I figure there's a nim pattern/feature to do a more do-while style loop, but otherwise I'm not sure where/how to simplify. Not that I need to, but if something seems obviously too-much-work-for-the-job please do give me a hint |
19:47:35 | FromDiscord | <tandy> i was curious if there was anything that would be super fast / no boiler plate needed |
19:47:37 | PMunch | Does it have inputs? |
19:47:47 | FromDiscord | <tandy> yep, mouse controled |
19:48:16 | FromDiscord | <Elegantbeef> Andy the challenge is written such to have a slightly lower level solution |
19:48:21 | PMunch | Haha, I meant Pixie :P |
19:48:38 | FromDiscord | <tandy> ohh |
19:48:40 | FromDiscord | <tandy> hahaha |
19:48:44 | FromDiscord | <Elegantbeef> Pixie is just a drawing library |
19:48:54 | FromDiscord | <Elegantbeef> So you use sdl2/gflw for inputs |
19:48:55 | FromDiscord | <tandy> il peep nico, would be cool to play with that |
19:49:21 | PMunch | Ah right, so you can have it draw to a SDL2 surface or something, and then use that for input handling |
19:49:23 | PMunch | Cool |
19:49:34 | FromDiscord | <Elegantbeef> Indeed |
19:49:45 | FromDiscord | <Elegantbeef> Treeform even has boxy if you wanted to do it efficiently |
19:50:05 | andylearningnimt | I know I could alternatively use a Table to make the known point values constant as well, but what kind of "lower level" do you mean? |
19:50:14 | FromDiscord | <Elegantbeef> Andy this is the intended solution https://exercism.org/tracks/nim/exercises/allergies/solutions/beef331 |
19:50:54 | andylearningnimt | holy moly ok thanks |
19:51:46 | FromDiscord | <Elegantbeef> It's just a bitwise operation which was eluded to with the `1, 2, 4, 8, 16, 32, 64, 128` |
19:53:55 | FromDiscord | <Elegantbeef> If you have any questions feel free to ask |
19:55:30 | * | casionaut joined #nim |
20:12:12 | PMunch | Ugh, this video is a mess.. |
20:12:39 | PMunch | I have a 1 hour segment where I try to make some progmem stuff work and end up patching the compiler.. |
20:30:18 | * | andylearningnimt quit (Quit: Leaving) |
21:08:26 | * | lively_s1 quit (Ping timeout: 245 seconds) |
21:22:33 | * | casionaut left #nim (o7) |
21:22:47 | * | PMunch quit (Quit: leaving) |
21:30:14 | * | lively_s1 joined #nim |
21:34:39 | * | lively_s1 quit (Ping timeout: 260 seconds) |
21:43:11 | * | Vladar quit (Quit: Leaving) |
22:00:33 | * | lively_s1 joined #nim |
22:26:12 | FromDiscord | <RattleyCooper> Hmmm, can't seem to compile anything with nim v1.6.0.. |
22:26:25 | FromDiscord | <RattleyCooper> I guess it can't find `gcc.exe` |
22:28:26 | FromDiscord | <demotomohiro> does `gcc.exe --version` work? |
22:28:52 | FromDiscord | <RattleyCooper> no |
22:29:06 | FromDiscord | <RattleyCooper> But nim v1.4.8 worked. I'm just trying to `nim c script.nim` |
22:30:33 | FromDiscord | <RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3Ddw |
22:33:40 | nixfreak_nim[m] | whats a good library to parse columns and rows and to manipulate them ? |
22:35:39 | FromDiscord | <demotomohiro> How about to set path env var temporary like `set path=c:\full\path\to\gcc;%path%` and see if nim call gcc. |
22:46:24 | FromDiscord | <RattleyCooper> In reply to @demotomohiro "How about to set": hmmm, seems that `dist/mingw64/bin/gcc.exe` is in my nim v1.4.8 folder but not for v1.6.0. Guessing I downloaded it manually when I installed v1.4.8 and forgot about that step or something? But for some reason v1.6.0 still can't find it.. |
22:47:42 | FromDiscord | <RattleyCooper> (edit) "it.." => "it when I copy it to the `dist` folder for v1.6.0" |
22:50:29 | FromDiscord | <demotomohiro> Probably you forget to run `finish.exe`.↵https://nim-lang.org/install_windows.html |
22:55:12 | nixfreak_nim[m] | I want to take an exported file which has columns and rows but if you try to import into a spreadsheet the columns are messed up, I would like to convert the exported file to a suitable csv file. Some rows are not together so it makes it really hard to print out say with awk |
22:56:06 | nixfreak_nim[m] | Can I use parsecsv to manipulate the data to turn into a useable csv file? |
22:59:48 | FromDiscord | <Elegantbeef> What's on those rows not together? empty lines? |
22:59:48 | FromDiscord | <Elegantbeef> Do you really need to be CSV aware is basically my question |
23:04:26 | nixfreak_nim[m] | Looks like this |
23:04:34 | FromDiscord | <Elegantbeef> Is what i'd suggest https://play.nim-lang.org/#ix=3DdD |
23:04:42 | FromDiscord | <Elegantbeef> But given i dont know the data inbetween 😀 |
23:05:12 | FromDiscord | <Elegantbeef> did you forget to post it? |
23:06:26 | FromDiscord | <RattleyCooper> In reply to @demotomohiro "Probably you forget to": You would be correct 😊 |
23:07:01 | nixfreak_nim[m] | 2021-05-06 13:50:15 fname lname store1 Exit door... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/49b5c1c94b2eacb487547e80e3b4d582a9a937f7) |
23:07:25 | nixfreak_nim[m] | like this , but the rows will change depending on the access |
23:07:39 | FromDiscord | <Elegantbeef> Ah so it's a horizontal issue |
23:07:49 | nixfreak_nim[m] | yes |
23:08:19 | FromDiscord | <Elegantbeef> I guess the solution is to find the largest word in each column and pad the result to that size |
23:09:12 | FromDiscord | <Elegantbeef> So sadly a 2 step process |
23:11:03 | nixfreak_nim[m] | so the read the file line by line and search for largest word and pad the result |
23:11:16 | FromDiscord | <Elegantbeef> I'll give you what i'd do might not be best though |
23:11:25 | nixfreak_nim[m] | ok |
23:28:15 | FromDiscord | <Elegantbeef> Well the csv parser doesnt seem to play nice |
23:29:12 | FromDiscord | <Elegantbeef> If you want some shitty reference code https://play.nim-lang.org/#ix=3DdH |
23:33:50 | FromDiscord | <Elegantbeef> Ah i was dumb quick change made it work https://play.nim-lang.org/#ix=3DdJ |
23:34:10 | * | lively_s1 quit (Ping timeout: 260 seconds) |
23:45:14 | nixfreak_nim[m] | Ok thanks, so in this program you would still have to input what you want to see or was that just an example |
23:49:08 | FromDiscord | <Elegantbeef> your input can be a filestream |
23:49:34 | FromDiscord | <Elegantbeef> So you can do `yourInput = openFileStream("someFile.csv")` and it should work, though the `csv` open will not respect you seperator |
23:53:51 | nixfreak_nim[m] | ok interesting |
23:54:17 | FromDiscord | <Elegantbeef> You can also make the output a stream to |
23:54:21 | FromDiscord | <Elegantbeef> Even your stdout 😀 |
23:55:48 | FromDiscord | <Elegantbeef> just do `newFileStream(stdout)` and that example will write right to your stdout |
23:56:09 | nixfreak_nim[m] | ok , thank you very much |
23:56:59 | nixfreak_nim[m] | Did something change with opening a file with nim ? I thought you could always just open using openFile("file.txt") |
23:58:21 | FromDiscord | <Elegantbeef> you can |
23:58:25 | FromDiscord | <Elegantbeef> fileStreams are not files |