00:05:52 | FromDiscord | <Elegantbeef> Afaik nimble can work with local repositories so when you download Nim you could also download the most recent nimble packages for those and then bring them with your own distribution of nim |
00:10:26 | * | Guest98 joined #nim |
00:13:54 | * | Guest98 quit (Client Quit) |
00:24:22 | FromDiscord | <elcritch> You can also set the nimble path, and then add it to the repo. Probably not ideal, but it works. |
00:27:54 | * | rlitp joined #nim |
00:46:13 | * | om3ga quit (Quit: Bye) |
00:46:25 | * | om3ga joined #nim |
01:02:39 | * | blackbeard420 joined #nim |
01:02:58 | * | byanka joined #nim |
01:03:29 | * | byanka_ joined #nim |
01:04:34 | * | byanka_ quit (Client Quit) |
01:06:26 | FromDiscord | <nqeron> I have a sequence with a custom type, and it doesn't seem to let me use add on it - is there a way I can implement this? |
01:06:46 | FromDiscord | <Elegantbeef> Declare your seq as a var |
01:06:52 | FromDiscord | <jtv> Any pointers to help me figure out how to debug, when using concepts, the obtuse error: "cannot instantiate: 'somefunc[seq[int]]'"?? There is NO diagnostic info other than that. |
01:07:12 | FromDiscord | <Elegantbeef> Best diagnostic is a proc that takes the type |
01:07:12 | * | blackbeard420 quit (Client Quit) |
01:08:55 | FromDiscord | <jtv> I don't understand that, can you explain to me specifically? Write a different concrete function for the type being instantiated? Because there's definitely a match for the generic function |
01:09:31 | FromDiscord | <Elegantbeef> Yes make a procedure that takes the concept |
01:09:42 | * | blackbeard420 joined #nim |
01:14:07 | FromDiscord | <jtv> That helped, though it doesn't help me figure out how to lazily generate types to decompose types đ |
01:18:34 | FromDiscord | <jtv> In the simplest form, I'm trying to statically serialize seqs that may be arbitrarily nested, but will only contain primitive types, where the full type of such seqs is known at compile time. But if I try to add a 'type' assignment to the concept that will ACTUALLY let me access the item type more than one layer deep. Some ways I've tried it works the one layer, everything else just blows up. |
01:20:23 | FromDiscord | <jtv> I feel like I've been fighting this forever, I'm about to give up and carry run-time type info with me :/ |
01:28:46 | FromDiscord | <Elegantbeef> What's your present concept/usage? |
01:35:15 | FromDiscord | <jtv> sent a long message, see http://ix.io/4jeN |
01:38:36 | FromDiscord | <Elegantbeef> What makes up a boxable item? |
01:38:47 | FromDiscord | <Elegantbeef> It's a sequence or string or value type? |
01:39:33 | FromDiscord | <jtv> For the moment, just sequences of int64, float64, string |
01:39:43 | FromDiscord | <jtv> Or other sequences of those things |
01:40:51 | FromDiscord | <jtv> Though the language does have dictionaries as well, I'm just trying to get something static working w/o that additional pain |
01:41:06 | FromDiscord | <jtv> So my box type for the moment is simply: |
01:41:16 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4jeO |
01:43:34 | FromDiscord | <jtv> Trying to basically define a Boxable concept that will accept just those primitive types based on having a pack(x) -> Box and an unpack(Box, var x), but then since I statically know the whole src or dst type I want to be able to essentially have, say, an unpack() that, if the object is a nested list, removes all the layers of boxing |
01:45:35 | FromDiscord | <jtv> Or, if I know I've got an array of array of strings, that I want to box, would want to essentially recursively box each layer. Part of the reason for all this is that the language DOES allow one case where I might have to stop at a special "mixed" list, where the type checking DOES go dynamic. |
01:48:42 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4jeP does this help any? |
01:51:16 | FromDiscord | <jtv> Probably, will play around with it, thanks very much. Took me a minute to confirm, I had to reload the link it was showing me something else that was some React related code |
01:52:17 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4jeQ to expand it a bit further |
01:55:00 | FromDiscord | <Elegantbeef> Using procedures like that ime is a fantastic way of introspecting types |
01:58:56 | FromDiscord | <jtv> Okay, thanks. This is definitely helpful. I am going to try to figure out why what I was doing was problematic, I feel like if I can figure that out, I might be up for writing some documentation to better elucidate. I have found the little docs there are on concepts don't even show instantiation, so some of the basics are not too obvious |
01:59:25 | FromDiscord | <Bung> am trying to update my project to devel, try to fix the warning `Warning: catch a more precise Exception deriving from CatchableError or Defect` , however when I change one Exception to CatchableError , shows `close(currentDisposition(parser).file) can raise an unlisted exception: Exception` |
02:00:08 | FromDiscord | <Elegantbeef> Well remember concepts are not really instantiated they're just type classes |
02:00:38 | FromDiscord | <Elegantbeef> It's a constraint that instantiates it for the given type that passes |
02:01:48 | FromDiscord | <jtv> Sure, but the aliases I was making within the class would be available from within the generic functions I was writing where it was a parameter |
02:04:18 | FromDiscord | <jtv> But I get why it was going to put the type solver into an infinite loop if it's not doing lazy evaluation. At some point, I will reconstruct what I was trying that failed to explain better, but right now I'm marching forward with this, so thank you |
02:05:20 | FromDiscord | <Elegantbeef> No problem |
02:09:03 | * | yolo joined #nim |
02:09:52 | yolo | new to nim, does nim always convert to some other language(e.g. c) first then it invokes that compiler(e.g. gcc) to build the final binary? |
02:10:08 | FromDiscord | <Elegantbeef> Yes |
02:10:49 | yolo | is there a default language(e.g. c, or c++)? |
02:11:22 | FromDiscord | <Elegantbeef> It targets C by default |
02:11:27 | yolo | read the 2.0 rc1 news and plan to learn nim in the holiday break and see how far I can go |
02:11:35 | FromDiscord | <Elegantbeef> It also has a C++ backend |
02:11:40 | yolo | Thanks! first step is nim-by-example for me |
02:11:42 | FromDiscord | <Elegantbeef> And a JS backend |
02:12:05 | yolo | it looks like python, i thought it has a python backend... |
02:12:14 | FromDiscord | <Elegantbeef> Nope |
02:12:27 | FromDiscord | <Elegantbeef> Aside from passing similarities it's unrelated to python |
02:12:36 | FromDiscord | <Elegantbeef> There is an ecosystem to support python |
02:12:49 | FromDiscord | <Elegantbeef> https://github.com/yglukhov/nimpy exists |
02:15:24 | yolo | thanks! |
02:16:05 | yolo | it seems easier than rust, maturer than zig, safer than c/c++, it should take off like a rocket years ago |
02:16:37 | yolo | but, i need write 50 small programs to tell if the above is true, wait and see |
02:17:03 | FromDiscord | <Elegantbeef> I'd say all of that is true |
02:17:30 | FromDiscord | <Elegantbeef> Though you can easily make it as safe as C/C++ so maybe it's not đ |
02:17:36 | FromDiscord | <Elegantbeef> There is no unsafe keyword here |
02:18:01 | yolo | what's the discord link, though I use irc more often |
02:18:16 | yolo | i will google it. thanks |
02:18:35 | FromDiscord | <Elegantbeef> Uhh i dont have the discord link, i'm actually on matrix |
02:19:04 | yolo | irc says "FromDiscord <Elegantbeef>" |
02:19:08 | yolo | interesting |
02:19:25 | FromDiscord | <Elegantbeef> Yea it goes Matrix -\> discord -\> irc |
02:19:32 | FromDiscord | <Elegantbeef> It's nothing but bridges |
02:19:41 | yolo | i c |
02:19:44 | FromDiscord | <Rika> Me about to burn the matrix bridge |
02:24:46 | * | Figworm joined #nim |
02:25:25 | FromDiscord | <Elegantbeef> Matrix bridge is burning down, burning down |
02:26:29 | FromDiscord | <Rika> I donât even need to do anything for it to burn down :baqua: |
02:26:51 | FromDiscord | <Elegantbeef> Eh t2bot runs an old version of the brdige |
02:26:53 | FromDiscord | <Elegantbeef> bridge even |
02:26:58 | FromDiscord | <Elegantbeef> Probably better upstream |
02:46:53 | yolo | ok so nim can export the same code base to c|c++|js, the goal is "one (expressive) code base for 3 languages"? what's the major selling point |
02:49:52 | FromDiscord | <Elegantbeef> You can write front end and backend in a single language with a shared code base is the point of js atleast |
02:50:11 | FromDiscord | <Elegantbeef> The reason it emits C/C++ is for interop and it's more portable than LLVM |
02:51:11 | FromDiscord | <answer> oh so i was wondering about this the other day, because i'm trying to do js interop with a library that exports a certain AST.â”the thing that sucks about it though is like... it has 4 potential values, `undefined`, a string value, an array, or an object describing some structureâ”so i was wondering like... how can i properly detect the types in nim, and if there's anything special i need to do for undefined |
02:51:19 | * | Guest34 joined #nim |
02:51:24 | FromDiscord | <answer> (edit) "values," => "values:" |
02:51:32 | FromDiscord | <answer> (edit) "oh so i was wondering about this the other day, because i'm trying to do js interop with a library that exports a certain AST.â”the thing that sucks about it though is like... it has 4 potential values: `undefined`, a string value, an array, or an object describing some structureâ”so i was wondering like... how can i properly detect the types in nim, and if there's anything special i need to do for undefined ... " added "or i |
02:52:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jeZ |
02:53:15 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/jsffi.html has some helper methods for this |
02:53:21 | * | Guest34 quit (Client Quit) |
02:53:27 | yolo | is zig similar, in that it emits to c|c++|etc first? did not look into it |
02:53:36 | FromDiscord | <Elegantbeef> Nope |
02:53:38 | FromDiscord | <Elegantbeef> Zig targets the llvm |
02:54:05 | FromDiscord | <answer> ah nice, i should've looked closer at that, thanks |
03:07:21 | FromDiscord | <darth> In reply to @yolo "it seems easier than": i like this comparison, tho I'm not sure about zig even after it matures, it feels so unfun to write - nim feels a bit like ... idk, I'm still huge noob to tell properly, but "as productive as rust, maybe more?" ... maybe it's cuz I've spent too much time in rust, but these days I feel I write rust faster than python lol |
03:08:16 | FromDiscord | <Rika> Itâs really a subjective thing |
03:08:45 | FromDiscord | <Rika> I cannot stomach Rust, Iâm somewhat repulsed by Zig, Nim is pretty good, etc |
03:08:47 | FromDiscord | <darth> I'm curious if anyone noticed this too, or how they feel about switching to nim fully ... rust feels like it should be slow but it's so fast for certain things with the stdlib/itertools and stuff just kinda flows, unlike in some other languages :< |
03:09:04 | FromDiscord | <darth> haha "repulsed by zig" is how I feel too about their allocators lol |
03:09:14 | FromDiscord | <darth> or even just "how to print to stdout" |
03:09:33 | FromDiscord | <Rika> Itâs likely that I should give it more time but eh |
03:09:40 | FromDiscord | <Rika> Hard sell |
03:09:58 | FromDiscord | <darth> I wish rust didn't have such a good/fast LSP, makes it harder to compare to languages with worse tooling :< ... like in some ways I feel the tooling is carrying my productivity, not the language |
03:10:13 | FromDiscord | <Rika> Thatâs because it pretty much is I guess |
03:10:33 | FromDiscord | <Rika> For me Iâm a bit of a masochist who can program with no extra tooling at all aside from the compiler of course |
03:10:44 | FromDiscord | <Rika> No plugin no problem |
03:10:46 | FromDiscord | <darth> hehe that would explain why you can't stomach rust |
03:10:54 | FromDiscord | <Rika> True |
03:10:56 | FromDiscord | <darth> I used to write python like that years ago, but python was fine for it |
03:10:56 | FromDiscord | <Rika> Could be |
03:11:18 | FromDiscord | <Rika> If itâs annoying to program in it with my keyboard alone then yeah |
03:11:47 | FromDiscord | <darth> do you find nim the most productive overall in that setting? or just most useful overall |
03:12:28 | FromDiscord | <Rika> One of the more productive languages because there isnât much you need to keep on writing just to get something working |
03:12:37 | FromDiscord | <Rika> I guess thatâs called boilerplate |
03:13:07 | FromDiscord | <darth> yeah :< i keep hopping between stuff and every time I hop back to rust because "it works" but then I'm mad at all the bullshit it requires me to do |
03:13:22 | FromDiscord | <darth> and then i get mad at other languages for not being productive in them even without the rust bullshit lol |
04:13:55 | * | yolo left #nim (#nim) |
04:16:58 | FromDiscord | <nqeron> current issue: I have a object with generic type that has a sub object (array) with the same generic type , but when I try to reference something like `type.sub[0][1]` it tries to break it down into just type.sub and 0, rather than getting sub and applying [0][1] |
04:17:30 | FromDiscord | <Elegantbeef> `typeof(sub[0][1])`? |
04:19:43 | FromDiscord | <Elegantbeef> Concrete code is better than wordy sentences |
04:20:20 | FromDiscord | <nqeron> I believe typeof(sub[0][1]) == Tile |
04:21:04 | FromDiscord | <nqeron> oh - I see what I triggered in the bot |
04:21:28 | FromDiscord | <Elegantbeef> I'm not a bot |
04:21:36 | FromDiscord | <huantian> that's what a bot would say |
04:21:50 | FromDiscord | <nqeron> given the bot tag |
04:21:55 | FromDiscord | <Elegantbeef> huantian more like tuantan |
04:22:29 | FromDiscord | <Elegantbeef> Yes I use matrix |
04:23:07 | FromDiscord | <Elegantbeef> Provide the code that causes the issue or the compiler error |
04:23:11 | FromDiscord | <Elegantbeef> It makes life much easier |
04:23:51 | FromDiscord | <nqeron> `result = game.board[square.column][square.row]` |
04:24:21 | FromDiscord | <nqeron> more specifically, `proc `[]`(game: var Game, square: Square): Tile =â” result = game.board[square.column][square.row]` |
04:24:43 | FromDiscord | <Elegantbeef> Do you mean to return `var Tile`? |
04:25:12 | FromDiscord | <nqeron> I'm not sure if it needs to be var |
04:25:28 | FromDiscord | <Elegantbeef> Well what's the actual issue? |
04:26:35 | FromDiscord | <nqeron> this might help: https://play.nim-lang.org/#ix=4jf9 |
04:26:36 | FromDiscord | <Elegantbeef> `a.fieldAcces[0][1]` does `[]([](a.fieldAccess, 0), 1)` |
04:27:08 | FromDiscord | <nqeron> hmm... |
04:27:52 | FromDiscord | <Elegantbeef> `Board[N: static uint8]` |
04:32:32 | FromDiscord | <huantian> to elaborate, `Board[N: uint8]` means `N` is always the type `uint8` |
04:32:58 | FromDiscord | <huantian> if you do `Board[N: static uint8]`, that means `N` is an instance of `uint8` known at compile time |
04:43:58 | FromDiscord | <nqeron> bit of fiddling, but that seems to have helped - thanks! |
04:57:43 | FromDiscord | <nqeron> last question before I go to bed - I'm working in VSCode on windows and I keep getting frustrating interactions with the autocomplete. What's the recommended extension to use for Nim? |
04:58:00 | FromDiscord | <huantian> the nim extension by saem |
04:58:16 | FromDiscord | <huantian> though unfortunately, nim tooling is still quite imprefect |
05:00:05 | NimEventer | New post on r/nim by shassard: Nim 2.0 release candidate is available, see https://reddit.com/r/nim/comments/zscs8w/nim_20_release_candidate_is_available/ |
05:04:02 | NimEventer | New Nimble package! htest - Simple library to make tests on html string using css query selectors, see https://github.com/Yandall/HTest/ |
05:54:01 | FromDiscord | <Bung> what's the syntax inject untyped argument to proc name in template ? |
05:55:23 | FromDiscord | <Elegantbeef> It's just stropping both with a space |
05:55:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jfe |
05:56:14 | FromDiscord | <huantian> meh proc |
05:56:16 | FromDiscord | <huantian> it's on fire |
05:56:48 | FromDiscord | <Bung> oh , i see, I was trying `proc a`p\`\` |
05:56:49 | FromDiscord | <ShalokShalom> In reply to @huantian "though unfortunately, nim tooling": Do you already know this: https://discord.com/channels/371759389889003530/371759389889003532/1054117863125958716 |
05:57:59 | FromDiscord | <huantian> I dsaw it rq but idk what my current settings are |
05:58:11 | FromDiscord | <huantian> I think it's just broken rn and I'm not getting any suggestions or errors at all |
05:58:16 | FromDiscord | <huantian> but I'm too lazy to fix that |
05:58:30 | FromDiscord | <ShalokShalom> I considered testing this |
05:58:39 | FromDiscord | <ShalokShalom> And if it works, I would send a pull |
05:58:49 | FromDiscord | <ShalokShalom> Might fix it for everyone. |
05:59:02 | FromDiscord | <ShalokShalom> You could be a hero đ |
06:00:10 | FromDiscord | <Elegantbeef> All it does is provide errors in that case |
06:25:18 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
06:40:41 | * | madprops quit (Remote host closed the connection) |
06:41:58 | * | madprops joined #nim |
06:41:58 | * | madprops quit (Changing host) |
06:41:58 | * | madprops joined #nim |
07:27:17 | FromDiscord | <ShalokShalom> You mean for you? |
07:27:30 | FromDiscord | <ShalokShalom> It seems to work for this person? |
07:29:38 | * | ltriant quit (Ping timeout: 272 seconds) |
07:29:59 | FromDiscord | <HitBlast> I've just reset my Mac and am attempting to install choosenim using the provided shell command. However, it says bad CPU architecture in the error prompt while trying to run the commane. Thoughts? https://media.discordapp.net/attachments/371759389889003532/1055386704661458944/Screenshot_2022-12-22_at_1.28.56_PM.png |
07:30:03 | FromDiscord | <HitBlast> (edit) "commane." => "command." |
07:30:57 | FromDiscord | <ShalokShalom> Is it a M1 or M2? |
07:32:58 | FromDiscord | <ShalokShalom> If yes, Araq has one to double checkâ”https://github.com/nim-lang/Nim/pull/18772 |
07:34:09 | FromDiscord | <huantian> Iirc choosenim itself doesnât have apple silicon support |
07:34:26 | FromDiscord | <Elegantbeef> That's correct afaik |
07:44:11 | FromDiscord | <HitBlast> In reply to @ShalokShalom "Is it a M1": It's an M1 |
07:44:15 | NimEventer | New thread by Araq: Atlas -- the package cloner, see https://forum.nim-lang.org/t/9748 |
07:45:23 | FromDiscord | <amadan> https://github.com/asdf-community/asdf-nimâ”Have used that for managing Nim on a rasp pi, not too sure how well it works with macs |
08:00:36 | FromDiscord | <Phil> In reply to @NimEventer "New Nimble package! htest": @Yandall Congratz about the initial release!â”Happy you made it! |
08:01:12 | FromDiscord | <Phil> Now to start implementing testing in snorlogue with this because I really ignored frontend testing precisely because HTML testing was inconvenient |
08:02:25 | FromDiscord | <Slava0135> In reply to @darth "I wish rust didn't": rust also have nicest error messages |
08:04:30 | FromDiscord | <Phil> In reply to @darth "I'm curious if anyone": I never got the impression Rust was particularly slow in anything, I just find my eyes glazing over at how the syntax looks not as pretty as I like |
08:04:53 | FromDiscord | <Phil> So if I can have nicer syntax with similar performance if I so choose to have it, I'm sold |
08:05:02 | FromDiscord | <Slava0135> and in my experience Nim error messages are lacking. Try to mutate `let` variable and it won't tell you you should use `var` |
08:05:29 | FromDiscord | <Phil> In reply to @Elegantbeef "I'm not a bot": That's what a chatgpt bot would say... the fact this can be a legit answer now is scary |
08:07:20 | FromDiscord | <Phil> Argh, caught myself again, the rust discussion is more appropriate for offtopic as it's less about nim syntax |
08:11:34 | FromDiscord | <ShalokShalom> In reply to @Slava0135 "and in my experience": Nimskull improved on that |
08:45:13 | * | PMunch joined #nim |
09:22:34 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jfN |
09:26:13 | FromDiscord | <kaddkaka> This is the error message for `t`:â”`Error: type mismatch: got '(proc (a: int): int{.noSideEffect, gcsafe, locks: 0.},)' foâ”r '(op,)' but expected 'S = tuple[operation: proc (i0: int): int{.closure.}]'`â”so the type/proc signature seems perhaps more strict for tuples? I feel dumb đ |
09:32:47 | FromDiscord | <Bung> they mismatched at call converstation one is nimcall another is closure |
09:38:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jfP |
09:39:18 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Iqa |
09:39:31 | FromDiscord | <Phil> I definitely do not use tuples enough it seems, may have screwed up the assignment code on my end |
09:39:40 | * | fallback quit (Ping timeout: 260 seconds) |
09:40:22 | FromDiscord | <ringabout> In reply to @Isofruit "I definitely do not": You need a comma to complete the tuple |
09:40:33 | FromDiscord | <ringabout> Try `(op,)` instead |
09:40:46 | FromDiscord | <Phil> Huh, yeah, fair play |
09:40:48 | FromDiscord | <Phil> Keep forgetting that |
09:41:15 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jfQ |
09:41:29 | FromDiscord | <Phil> You need to turn your proc into a closure |
09:41:35 | FromDiscord | <Phil> You can use the closure pragma for that |
09:42:20 | FromDiscord | <Phil> You don't strictly speaking need the assignment to `procTuple` , that was just me trying things out and writing my code in smaller steps as per my preference |
09:45:05 | FromDiscord | <Phil> Out of curiosity, what is the usecases for tuples for you guys? |
09:49:05 | FromDiscord | <kaddkaka> In reply to @Bung "they mismatched at call": In my case it was grouping data (and procs) |
09:49:22 | FromDiscord | <kaddkaka> In reply to @Isofruit "Out of curiosity, what": In my case it was grouping data (and procs) |
09:50:43 | FromDiscord | <Phil> In reply to @kaddkaka "In my case it": Given what I've seen from you your style is more functional, correct?â”Disclaimer: I have no proper functional knowledge, thus my questions.â”Does functional programming in general use tuples to do this kind of thing? Because that sounds like OOP to me (grouping data with methods acting on the data) |
09:50:55 | FromDiscord | <kaddkaka> complicated stuff, I dont see the reason why the closure specification is needed just because I put it inside a tuple, But I also dont know any details about Nim. |
09:52:17 | FromDiscord | <kaddkaka> That might be my problem, I'm not doina either style full out. Instead I make strange mix đ |
09:52:24 | FromDiscord | <kaddkaka> (edit) "doina" => "doing" |
09:55:55 | FromDiscord | <Phil> Ahhh check. I'm never passing up an opportunity to learn if I can find the time đâ”As for this, chances are that because it's in a tuple and that tuple can go anywhere, that nim demands that the proc be self-contained. IIRC the normal calling conventions do not apply to this.â”But I haven't developed much deeper knowledge into that, I typically just write procs that generate procs and that's it |
09:57:16 | FromDiscord | <kaddkaka> This particular questiong was spawned by AoC day11 |
09:57:20 | FromDiscord | <kaddkaka> (edit) "questiong" => "question" |
10:11:44 | FromDiscord | <Elegantbeef> Phil is wrong @kaddkaka you dont need to use closure inside of a type |
10:11:56 | FromDiscord | <Phil> You don't? |
10:11:58 | FromDiscord | <Elegantbeef> The issue is that proc types by default are closures so you need to specify that it's a nimcall |
10:12:01 | FromDiscord | <Elegantbeef> You do not |
10:12:30 | FromDiscord | <Elegantbeef> Works just fine |
10:12:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jfT |
10:12:37 | FromDiscord | <kaddkaka> I was thinking that it implicitly has a closure because it's using a local variable (but perhaps that not the case either). |
10:12:45 | FromDiscord | <kaddkaka> Hmm, so I better read up on nimcall perhaps |
10:14:05 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jfU |
10:14:35 | * | attah quit (Ping timeout: 246 seconds) |
10:15:03 | FromDiscord | <kaddkaka> (Minor issue with nim manual is that the search box doesn't find things like `nimcall`)â”So, if nimcall is the default calling convention, why do I need to explicitly specify it? |
10:15:05 | FromDiscord | <Elegantbeef> In this case you do need a closure as you have an environment you want |
10:15:05 | FromDiscord | <Elegantbeef> but you will need to use `capture i` to make it work as you want |
10:15:05 | FromDiscord | <Elegantbeef> sugar has a `capture` macro for this case |
10:15:07 | * | attah joined #nim |
10:15:26 | FromDiscord | <Elegantbeef> Nim is the default call convention on procedures not on types |
10:15:29 | FromDiscord | <Elegantbeef> On types `closure` is |
10:15:47 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4jfW |
10:15:55 | FromDiscord | <Elegantbeef> An example of how capture helps |
10:17:56 | FromDiscord | <kaddkaka> I see ... the manual also states "This is needed because Nim's default calling convention for procedures is fastcall to improve speed."â”So .. is fastcall the default calling convention as well? In som cases? |
10:18:29 | FromDiscord | <Elegantbeef> It's Nimcall but nimcall is an alias to fastcall where it's valid |
10:19:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Ugo |
10:19:33 | FromDiscord | <Elegantbeef> Works just fine minus the fact `op` isnt capturing as one expects |
10:20:44 | FromDiscord | <Elegantbeef> Unrelated but this is down a bad path for a solution to day11 đ |
10:20:56 | FromDiscord | <kaddkaka> so the type works out, but `i` will be using the global `i` without creating separate closures? |
10:21:26 | FromDiscord | <Elegantbeef> Without capture each instance gets the same variable |
10:21:35 | FromDiscord | <Elegantbeef> So when you call it at the end of the iteration they're all the same |
10:21:49 | FromDiscord | <Elegantbeef> You very much do want a closure for your code, but i was just correcting phil |
10:21:57 | FromDiscord | <Elegantbeef> You can have pointer procs without nimcall |
10:22:02 | FromDiscord | <Elegantbeef> Or with nimcall rather |
10:22:28 | FromDiscord | <Elegantbeef> You can even have a pointer proc that is a cdecl or any other calling convention aside from `inline` |
10:22:42 | FromDiscord | <Elegantbeef> Actually dont know about inline, i imagine you cannot |
10:23:00 | FromDiscord | <kaddkaka> inline is not that special though, right? |
10:23:05 | FromDiscord | <Elegantbeef> Ah you can |
10:23:08 | FromDiscord | <Elegantbeef> Just defeats the inline part |
10:23:18 | FromDiscord | <kaddkaka> are you sure? |
10:23:24 | FromDiscord | <kaddkaka> I mean inline never gives any guarantees |
10:24:13 | FromDiscord | <Elegantbeef> I just tested, so yes |
10:24:17 | FromDiscord | <Elegantbeef> Sure but adding that calling convention to a pointer proc is like wearing socks ontop of your shoes |
10:25:25 | FromDiscord | <Elegantbeef> Though if i ever get my PR functioning we'll have anyConvention -\> {Nimcall, Closure} |
10:26:40 | FromDiscord | <Phil> In reply to @Elegantbeef "Sure but adding that": That's a beautiful analogy |
10:26:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/SbK |
10:27:01 | FromDiscord | <Elegantbeef> But since your loop was global it was valid |
10:29:02 | FromDiscord | <Elegantbeef> And making it a named proc also probably instantiates it once, but i dont know i never tested that |
10:30:17 | FromDiscord | <Elegantbeef> Thanks i thought long and hardâ”(@Phil) |
10:30:40 | FromDiscord | <Elegantbeef> Then i looked down and seen my socks were dirty and my shoes clean |
10:31:46 | FromDiscord | <Elegantbeef> No i dont wear shoes inside, i'm not a fucking gremlin |
10:31:49 | FromDiscord | <Bung> is there force cast without check ? |
10:31:58 | FromDiscord | <Elegantbeef> copyMem is closest you get |
10:32:35 | FromDiscord | <Bung> hmm, I only want pass type check |
10:33:05 | FromDiscord | <Elegantbeef> Well you can do `cast[ptr T](mydata.addr)[]` |
10:33:11 | FromDiscord | <Elegantbeef> But there be dragons with aliasing rules |
10:34:25 | FromDiscord | <Bung> oh, that works |
10:34:51 | FromDiscord | <Elegantbeef> And with that i'm off |
10:37:03 | FromDiscord | <Bung> well, still seems cast doesn't work in compiler proc |
10:37:22 | FromDiscord | <Bung> get nil access error |
10:39:42 | FromDiscord | <kaddkaka> I guess `{.closure.}` doesn't automatically capture variables, gotta try out the `capture` sugar |
10:42:59 | FromDiscord | <kaddkaka> Props for capture đ easy to understand and use |
10:44:54 | * | attah quit (Ping timeout: 268 seconds) |
10:45:49 | * | attah joined #nim |
10:55:24 | * | oddish joined #nim |
11:12:05 | FromDiscord | <arkanoid> Lol |
11:19:42 | PMunch | Is there really no way to push a custom pragma? |
11:20:11 | PMunch | I tried to just push the macro, didn't work, tried to use {.pragma.} to define a pragma proper, didn't work |
11:20:41 | PMunch | I was just trying to replace every instance of `echo` in a file with my own custom version of echo.. |
11:22:49 | PMunch | Hmm, I guess maybe patchFile would work.. |
11:35:38 | NimEventer | New thread by domogled: Ormin example chat - websocket failed, see https://forum.nim-lang.org/t/9749 |
11:44:07 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
12:17:27 | FromDiscord | <blaze_arch> hi everyone \:3 |
12:22:01 | FromDiscord | <Phil> Cheers |
12:25:10 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jgq |
12:27:18 | FromDiscord | <Phil> In reply to @kaddkaka "I'm not sure if": You mean why must it be Table[int, int]? |
12:27:36 | FromDiscord | <Phil> Ohhh no, why toTable needs the addition of a type |
12:31:39 | * | ltriant joined #nim |
12:32:09 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jgs |
12:32:35 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jgt |
12:33:17 | FromDiscord | <kaddkaka> (disregard the tuple syntax in the 2 latter examples) |
12:33:30 | FromDiscord | <Phil> To me this makes sense because in my head the 2 statements (1: Instantiating the table, 2: Instantiating the tuple with the table) happen separately one after another. |
12:33:47 | FromDiscord | <albassort> does |
12:34:17 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4jgu |
12:34:38 | FromDiscord | <albassort> idk why you'd do this tbh |
12:34:44 | FromDiscord | <kaddkaka> @albassort yes |
12:35:08 | FromDiscord | <Phil> It first creates the table with `toTable[int, int]({:})`, to do so it needs to know the type, but within its own statement it can't find the type information it needs to do so. The information is outside. |
12:35:19 | FromDiscord | <Phil> In reply to @kaddkaka "<@217459674700578816> yes": You using nim 1.6? Because it does not on nim devel |
12:35:26 | FromDiscord | <kaddkaka> @albassort assigning a table? |
12:35:28 | FromDiscord | <Phil> (which is future nim 2.0) |
12:35:36 | FromDiscord | <albassort> your mom is future nim 20.0 |
12:35:40 | FromDiscord | <albassort> (edit) "20.0" => "2.0" |
12:35:44 | FromDiscord | <kaddkaka> I use `1.6.6` |
12:35:51 | FromDiscord | <albassort> which is stable |
12:36:06 | FromDiscord | <Phil> Let me see in 1.6.6, sec |
12:36:12 | FromDiscord | <albassort> phil how can i downgrade from 1.9.4 to 1.7.7 |
12:36:19 | FromDiscord | <albassort> 1.9.4 is pretty buggy |
12:36:26 | FromDiscord | <Phil> .... choosenim 1.7.7? |
12:36:30 | FromDiscord | <albassort> damn |
12:36:32 | FromDiscord | <albassort> that simple huh |
12:36:39 | FromDiscord | <Phil> I assume, I never tried |
12:36:52 | FromDiscord | <Phil> I typically only jump between devel and stable releasess |
12:36:59 | FromDiscord | <Phil> Never tried to jump to a particular unstable release |
12:37:22 | FromDiscord | <albassort> orc has some bugs in stable which i need fixed |
12:37:49 | FromDiscord | <Phil> Okay, now I am massively confused |
12:38:00 | FromDiscord | <kaddkaka> In reply to @Isofruit "You using nim 1.6?": do you think it should, or should not work? |
12:38:28 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jgv |
12:39:20 | FromDiscord | <Phil> In reply to @kaddkaka "do you think it": From what I'm seeing, it shouldn't work and always require the type information in the `toTable` call because as far as I'm aware that proc is not that great at looking "outside" of itself for type information |
12:40:19 | FromDiscord | <kaddkaka> wth now it doesn't work me either ... |
12:40:48 | FromDiscord | <Phil> You might have just had weird compiler-cache problems |
12:40:50 | FromDiscord | <kaddkaka> I must have been blind or done something else.. |
12:40:54 | FromDiscord | <Phil> Meaning it never should've worked |
12:40:58 | FromDiscord | <kaddkaka> probably just blind đ |
12:41:08 | FromDiscord | <Phil> Brain-cache-problems then đ |
12:41:31 | FromDiscord | <kaddkaka> yes đ |
12:56:25 | FromDiscord | <albassort> @Phil i'll pay you $5 to do a pre-release code review |
12:56:42 | FromDiscord | <Phil> No you won't, but I'll skim over it anyway đ |
12:56:55 | FromDiscord | <albassort> if you lived near me I'd buy you a coffee |
12:57:14 | FromDiscord | <Phil> Convenient for you that I don't đ |
12:57:27 | FromDiscord | <albassort> do i give the impression that im cheap? |
12:57:33 | FromDiscord | <albassort> because that'd be correct |
12:59:33 | FromDiscord | <Phil> Cheap vibes transferring over the internet đâ”Anyway, what am I supposed to skim through? |
12:59:54 | * | kenran joined #nim |
13:00:35 | * | kenran quit (Remote host closed the connection) |
13:03:04 | FromDiscord | <albassort> like 2000 lines of code |
13:04:38 | FromDiscord | <Phil> Yeah skim is definitely the right word |
13:38:06 | PMunch | Is there an easy interpolation library in Nim? |
13:38:22 | PMunch | I have data at DateTime points and want to interpolate it |
13:51:43 | FromDiscord | <ajusa> Nearly done porting over a tiny language interpreter I wrote in Lua a few years back:â”Lua version is 116 lines and Nim version is at 135. Not bad at all since 30 of the lines in the Nim version are just type definitions, which Lua doesn't have. |
13:52:48 | FromDiscord | <ezquerra> In reply to @PMunch "Is there an easy": Maybe ask in #science? Worst case you could use nimFFT to do an FFT / zero padding / IFFT / scaling⊠|
13:57:39 | FromDiscord | <vindaar> pmunch\: `numericalnim` has multiple interpolation routines |
13:58:51 | PMunch | Hmm, they're so complicated to use though.. |
13:59:11 | FromDiscord | <Vindaar> huh? |
13:59:21 | PMunch | I just wanted something like `interpolate(myTimestamps, myData, point)` |
14:02:52 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4jgQ |
14:05:06 | FromDiscord | <Rika> Looks complicated to just set up yeah |
14:06:12 | FromDiscord | <vindaar> a single `newCubicSpline` line is complicated now? |
14:07:06 | PMunch | What's a df? linspace? |
14:07:22 | PMunch | And how can I get a specific value? |
14:07:39 | FromDiscord | <vindaar> the whole fluff around is just to show that it's actually working and plotting it for you to see (if you want). |
14:07:46 | FromDiscord | <vindaar> `df` = DataFrame |
14:08:01 | FromDiscord | <vindaar> `linspace` = takes beginning, end, number of points and creates a linear grid |
14:08:20 | FromDiscord | <vindaar> getting a specific value\: in that `mapIt` call the `interp.eval` |
14:08:36 | FromDiscord | <Rika> In reply to @vindaar "a single `newCubicSpline` line": If thatâs all thatâs needed if thereâs already data then okay, sounds fine |
14:08:56 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4jgS |
14:09:18 | FromDiscord | <Rika> Sounds good |
14:09:21 | PMunch | Right.. So linspace creates the points to sample, and interp.eval does the actual interpolation. The df is just for plotting? |
14:09:40 | FromDiscord | <vindaar> yeah |
14:09:43 | PMunch | Right, yeah that's actually pretty simple |
14:09:45 | FromDiscord | <luteva> Hi! Is there something like lunatic in nim?â”https://github.com/lunatic-solutions/lunaticâ”so an erlang inspired environment with "micro" processes and a supervision tree, eassy intra- and interprocess communication (e.g. channel based)... |
14:10:12 | FromDiscord | <hugogranstrom> sent a code paste, see https://paste.rs/Okl |
14:10:32 | FromDiscord | <hugogranstrom> (edit) "https://play.nim-lang.org/#ix=4jgU" => "https://play.nim-lang.org/#ix=4jgT" |
14:12:31 | FromDiscord | <Yandall> In reply to @Isofruit "<@376485432805949443> Congratz about": Thanks for the help |
14:34:15 | PMunch | Hmm, @vindaar do you know of any good way to interpolate angles? |
14:35:18 | FromDiscord | <vindaar> can you expand on that? |
14:35:37 | PMunch | Well I'm working with windspeed, and it's given as speed and angle |
14:36:09 | PMunch | Basically I have a forecast with hour precision, and I want to be able to get forecast windspeed for arbitrary times |
14:36:59 | FromDiscord | <vindaar> do you have an excerpt of what your data looks like? |
14:37:42 | FromDiscord | <vindaar> is your problem that angles are modulo 360° or that interpolation shouldn't be linear in some sense? |
14:38:14 | PMunch | https://api.met.no/weatherapi/locationforecast/2.0/#!/data/get_compact |
14:38:34 | PMunch | The problem is the modulo 360 thing |
14:39:24 | PMunch | You can try with this coordinate if you want: 69.6899724,18.9276432 (random point in Norway) |
14:40:33 | PMunch | I grab the properties.timeseries[].time and properties.timeseries[].data.wind_from_direction and wind_speed |
14:40:46 | PMunch | The timestamp is converted to a Unix timestamp |
14:40:48 | * | PMunch quit (Quit: Leaving) |
14:45:20 | FromDiscord | <vindaar> I'm not entirely sure, from the top of my head. I suppose it will depend a bit on which timescales you want to apply an interpoelation. Maybe you could do a preprocessing step in which you check whether you have a wrap \>360° -\> 0° or \<0° -\> 360° and in that case fix the angles by artificially correcting them (i.e. going over 360° or into negative). Then perform the interpolation and for the result revert the artificial extension? |
14:52:36 | FromDiscord | <ezquerra> Maybe you could consider the (speed, angle) pairs as polar coordinates. Then you could convert them to Cartesian coordinates, and treating them as complex numbers, interpolate on those and then go back to polar? |
14:52:55 | FromDiscord | <ezquerra> Also maybe this discussion belongs to the #science channel |
15:10:38 | FromDiscord | <vindaar> Hmm, having looked at the data my suggestion is very problematic given how sparse the data is. The jumps in the angles are huge sometimes O(\> 100°) |
15:11:12 | FromDiscord | <Phil> In reply to @Yandall "Thanks for the help": Any plans on what you want to do next?â”Still interested in github pipelines, writing another package or writing an application and wanting to play around with a package in that regard? |
15:14:02 | FromDiscord | <Yandall> Still interested in github pipelines but maybe not for this one just because is very small package |
15:14:24 | FromDiscord | <Yandall> I still want to learn more about nim writing another package |
15:22:53 | FromDiscord | <Phil> sent a long message, see http://ix.io/4jht |
15:23:08 | FromDiscord | <Phil> (edit) "http://ix.io/4jht" => "https://paste.rs/UMJ" |
15:24:05 | FromDiscord | <Phil> And for that one the #security channel would be a really good idea to frequent (can't say I look into that one) |
15:25:57 | FromDiscord | <Phil> Like, for reference, this is the only piece in terms of hashing I'm aware of and that I use myself (it replicates the default hashing algorithm from Django):â”https://stackoverflow.com/questions/70716906/how-do-i-re-build-djangos-password-hashing-in-nim |
15:27:12 | FromDiscord | <Phil> If that goes a bit too far it might make sense to write a small application first, maybe a CLI one |
15:28:01 | FromDiscord | <Phil> Or since you know webdev you could of course also do a small web-application, there I can help since I have somewhat of an overview over the packages nim has available |
15:29:00 | FromDiscord | <Yandall> Yeah, a small web application would give me a better understanding of nim |
15:29:11 | FromDiscord | <Yandall> For that I have some ideas |
15:33:09 | FromDiscord | <Phil> sent a long message, see https://paste.rs/Zyj |
15:33:42 | FromDiscord | <Phil> (edit) "http://ix.io/4jhw" => "http://ix.io/4jhv" |
15:34:48 | FromDiscord | <Phil> For ORM I'd recommend either norm or if you want absolutely no abstraction of SQL, use `std/db_sqlite` together with `nisane` to parse the values it returns to you into your own object-types. |
15:35:18 | FromDiscord | <Phil> (edit) "For ORM I'd recommend either norm ... or" added "(also comes with connection pooling nowadays, supports sqlite and postgres)" |
15:35:27 | FromDiscord | <Phil> (edit) "`std/db_sqlite`" => "`std/db_sqlite/db_postgres/db_mysql`" |
15:36:02 | FromDiscord | <Yandall> And there is a lib for mongo? |
15:36:04 | FromDiscord | <Phil> A package I generally recommmend taking a look at would be constructor, as it can save you a fair bit of typing if you want auto-generated constructor procs |
15:36:18 | FromDiscord | <Phil> There likely is, I just never used mongo with nim, but one sec |
15:36:50 | FromDiscord | <Phil> https://nimble.directory/search?query=mongoâ”There's 4 + 1 specifically for jester |
15:37:04 | FromDiscord | <Phil> Though I'm not entirely sure what would be jester-specific there |
15:37:08 | FromDiscord | <Phil> đ€·ââïž |
15:38:29 | FromDiscord | <Yandall> Well, I'll just see which one is better for my use case |
15:38:46 | FromDiscord | <Phil> If you want to just write a API that deals with JSON I recommend jsony, as it is faster than std/json (and imo easier to reason about and extend) |
15:39:35 | FromDiscord | <Phil> If you want to generate HTML, use nimja as it does a fair bit of stuff at compile-time (e.g. it pulls your HTML templates into the binary, meaning when you deploy the server you won't have to push an HTML folder around. Also means you need to recompile the project if you change a HTML file) |
15:39:45 | FromDiscord | <Phil> (edit) "If you want to generate ... HTML," added "and serve" |
15:40:52 | FromDiscord | <Phil> And other than that for bells and whistles you can use `zippy` to compress your response, typically reduces the size of the response by 50-80% for me (Those were JSON responses) |
15:41:30 | FromDiscord | <Phil> There isn't yet a package for Signals the same way Django signals work, but they aren't hard to implement so I can help there |
15:42:10 | FromDiscord | <Phil> But yeah, that's what I can provide in terms of knowledge so far. |
15:43:20 | FromDiscord | <Phil> (edit) "work," => "work (so procs that get triggered automatically when an entry is added/updated/deleted from a table/collection)," |
15:43:26 | FromDiscord | <Yandall> Thanks, you're awesome |
15:43:47 | FromDiscord | <Phil> Happy to help |
15:44:27 | FromDiscord | <Phil> I can't believe I've been shilling for Elegantbeef's constructor package for almost a year now |
15:44:45 | FromDiscord | <Phil> And I shall continue to do so as even nim 2.0 doesn't yet support distinct datetime types in default intialization đ |
15:45:00 | FromDiscord | <ambient> how do you define .low and .high for a custom type? |
15:45:24 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4jhE |
15:45:35 | FromDiscord | <Phil> Not to me, sorry |
15:47:13 | FromDiscord | <jmgomez> np, There is a reference to it in the compiler.. not sure if it's a genAst issue |
15:47:36 | FromDiscord | <Phil> There also is a closed issue about sth like it:â”https://github.com/nim-lang/Nim/issues/9476 |
15:52:02 | FromDiscord | <0x454d505459> sent a code paste, see https://play.nim-lang.org/#ix=4jhG |
15:52:46 | FromDiscord | <ambient> sent a code paste, see https://paste.rs/7Xt |
15:56:32 | FromDiscord | <0x454d505459> In reply to @0x454d505459 "Simple question I wasn't": nvm find out I think |
16:01:28 | * | sagax quit (Remote host closed the connection) |
16:05:03 | FromDiscord | <JeysonFlores> I'm writing a small lib with some CLI utilities but I need to check user's keyboard input. I saw that the easiest way to do this in Nim is using the illwill library. I've tried it and works OK but it seems this lib is more than just a keyboard input abstraction and it has many API drawbacks I would like to avoid (like "initializing" and "de-initializing" IllWill contexts and stuff) |
16:05:11 | FromDiscord | <JeysonFlores> Is there any other option? |
16:06:31 | FromDiscord | <auxym> maybe https://github.com/ansiwave/nimwave ? |
16:10:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jhM |
16:10:41 | * | fallback joined #nim |
16:11:35 | FromDiscord | <ambient> yeah but I don't have an object, just a type |
16:11:47 | FromDiscord | <Phil> Don't need an object to define procs for it |
16:12:08 | FromDiscord | <Phil> As long as you can infer the low/high values from a value of that type you're good |
16:12:09 | FromDiscord | <ambient> in your example, I would need A.low and A.high |
16:12:42 | FromDiscord | <Phil> Ahhh you mean you don't have an instance, just a type definition, now I get it |
16:13:41 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=4jhP |
16:14:03 | FromDiscord | <Phil> What value would you assume that "low" should return for the Coords2D type? |
16:14:21 | FromDiscord | <ambient> (int.low, int.low) |
16:15:20 | FromDiscord | <Phil> then why not `proc low(t: typedesc[Coords2D]): Coords2D = (int.low, int.low)`? |
16:16:17 | FromDiscord | <ambient> In reply to @Isofruit "then why not `proc": https://github.com/amb/aoc2022/blob/master/aoc.nim#L146 stuff I'm doing, may be smart approach or not |
16:16:58 | FromDiscord | <Phil> One sec, you want "low" defined for `Hashset[Coord2D]`? |
16:17:15 | FromDiscord | <auxym> just aoc stuff đ |
16:17:15 | FromDiscord | <Phil> (Since you wanted those procs for Coords2D, not Coord2D) |
16:17:30 | FromDiscord | <ambient> it was an example |
16:18:02 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=4jhQ |
16:18:14 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=4jhR |
16:18:28 | FromDiscord | <ambient> and it should pick either 2D or 3D depending on the context |
16:19:46 | FromDiscord | <ambient> although can Nim match function signature based on just what it returns if everything else is the same? |
16:36:43 | FromDiscord | <vindaar> pmunch\: I wasted a bit of time now playing around with this https://gist.github.com/Vindaar/1e50a8515e87058033de30b2ceb92fa5#file-weather_wind_interpolation-nimâ”As @ezquerra mentioned, treating the data as polar coordinates makes it somewhat possible. I don't literally treat them as complex numbers in the cartesian domain and just pretend I can interpolate each separately. It more or less works, but I wouldn't call it elegant đ |
16:37:45 | * | oz left #nim (WeeChat 3.7.1) |
16:37:51 | * | oz joined #nim |
17:29:31 | * | pusewicz joined #nim |
17:36:34 | * | pusewicz is now known as pusewicz|away |
17:50:40 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i set a default for a `var` proc argument |
17:59:08 | FromDiscord | <@thatrandomperson5-6310e3b26da03> nvm, i found std/options |
18:00:32 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Wait, it says get cannot be assinged to! Arggghh |
18:01:14 | * | pusewicz|away quit (Quit: My MacBook has gone to sleep. ZZZzzzâŠ) |
18:02:06 | FromDiscord | <@thatrandomperson5-6310e3b26da03> > How would i set a default for a `var` proc argumentâ”How would i make this optional |
18:02:36 | * | jmdaemon joined #nim |
18:15:18 | FromDiscord | <@thatrandomperson5-6310e3b26da03> like \`\`\` |
18:16:52 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4jid |
18:22:08 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4jif |
18:22:20 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4jig |
18:23:27 | FromDiscord | <vindaar> uhh |
18:43:46 | FromDiscord | <@thatrandomperson5-6310e3b26da03> . |
18:45:31 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Never mind it does not work. i want it optional, if it does not exist i will not set to it. |
18:48:38 | FromDiscord | <@thatrandomperson5-6310e3b26da03> My solution right now is to use overloads, if you have any better ideas please let me know |
18:57:06 | FromDiscord | <vindaar> optional in what sense though? You explicitly want an `Option[T]` type or you just want a proc taking a `var` argument, which you sometimes can also just not give? |
19:20:47 | * | pro joined #nim |
19:26:14 | * | pro left #nim (#nim) |
19:30:57 | FromDiscord | <gcao> hi, what's the reason that channels should not be used by threads created by createThread? What are the differences between threads in threadpool and threads created by the user? |
19:31:21 | FromDiscord | <gcao> (edit) "threads created by createThread?" => "spawn?" |
19:53:58 | FromDiscord | <c4ulmu> Hey. I asked a question on the nim forum and my question has crossed eye and hint `Thread is noderated`. What does it mean? Is something wrong with my question or it just waits moderator to approve it? |
20:10:51 | FromDiscord | <thindil> c4ulmu\: Hey, if it is your first topic on the forum, it just awaits for moderators approval. From my experience, it should be approved very soon (TM). đ |
20:11:44 | FromDiscord | <c4ulmu> Oh, thanks. Yes it is the first question on the forum |
20:23:42 | FromDiscord | <vindaar> approved your account đïž |
20:24:42 | NimEventer | New thread by c4UlMu: Use multithreading without channel and threadpool, see https://forum.nim-lang.org/t/9750 |
20:30:11 | * | ltriant quit (Ping timeout: 246 seconds) |
20:31:24 | FromDiscord | <Yandall> @Phil Can you help me? I'm running in some error when trying to make a release build with prologue |
21:07:25 | * | kenran joined #nim |
21:08:30 | FromDiscord | <kaddkaka> I'm trying to add to a sequence of tables, but for some reason it looks like I have TableRefs that I'm trying to add?â”`Error: type mismatch: got <seq[Table[system.int, system.int]], TableRef[system.int, system.int]>`â”How should I think |
21:09:05 | FromDiscord | <vindaar> did you type `newTable` somewhere? |
21:09:48 | FromDiscord | <kaddkaka> Yes, I used collect with newTable! đź |
21:10:22 | FromDiscord | <vindaar> that constructs a `TableRef`. You need to use `initTable` \:) |
21:11:22 | FromDiscord | <kaddkaka> thanks đ |
21:12:49 | * | kenran quit (Remote host closed the connection) |
21:37:24 | FromDiscord | <kaddkaka> `SIGSEGV: Illegal storage access. (Attempt to read from nil?)Segmentation fault (core dumped)` T_T |
21:38:10 | FromDiscord | <Phil> In reply to @Yandall "<@180601887916163073> Can you help": Back and available, what up? |
21:39:01 | FromDiscord | <Phil> Sidenote, it's always more efficient to just ask here in chat or the webdev channel directly, rather than asking to ask or waiting for someone specific |
21:39:19 | FromDiscord | <Phil> đ |
21:39:58 | FromDiscord | <Yandall> I followed the guide in the docs on how to deploy but I get an error en when compiling with the option `-d:lto` |
21:40:10 | FromDiscord | <Yandall> In reply to @Isofruit "đ": Yeah, you're right |
21:40:21 | FromDiscord | <Yandall> (edit) removed "en" |
21:41:00 | FromDiscord | <Phil> What error and what's the exact compile command? |
21:42:04 | FromDiscord | <Phil> Just for reference, this is what I use to build my side project with musl for alpine containers : https://github.com/PhilippMDoerner/NimStoryFont/blob/44e0bc1a7b1d031e320c0deb9324ef07cec03eed/nimstoryfont.nimble#L33 |
21:42:12 | FromDiscord | <Yandall> sent a code paste, see https://play.nim-lang.org/#ix=4jja |
21:42:32 | FromDiscord | <Phil> The exact compiler command? |
21:42:48 | FromDiscord | <Phil> And are you on Windows? |
21:43:22 | FromDiscord | <Yandall> I'm on mac |
21:43:35 | FromDiscord | <Phil> Check. Compiler command? |
21:44:11 | FromDiscord | <Yandall> sent a code paste, see https://paste.rs/zpF |
21:44:22 | FromDiscord | <Phil> --define |
21:44:49 | FromDiscord | <Phil> -d and --define are identical, -d is just the short form |
21:45:06 | FromDiscord | <Yandall> In reply to @Isofruit "--define": My bad. But still have the same error |
21:45:12 | FromDiscord | <Phil> But the long form must have 2 minuses |
21:45:29 | FromDiscord | <Phil> And the short form 1.â”Same error? Hmm |
21:46:11 | FromDiscord | <Phil> Does clang maybe not have an lto option? |
21:46:24 | FromDiscord | <Phil> The guide was written with GCC in mind tbh |
21:46:41 | FromDiscord | <Yandall> The option in clang is `-flto` |
21:46:50 | FromDiscord | <Phil> Does that work? |
21:47:08 | FromDiscord | <Yandall> Nah, that's the option in clang that causes the error |
21:47:24 | FromDiscord | <Yandall> When I remove it, it compiles just fine |
21:47:47 | * | ltriant joined #nim |
21:48:21 | FromDiscord | <Phil> Alrighty. For reference you're not giving up much by not having it, it's just "free performance" for slightly longer compile times on gcc |
21:48:33 | FromDiscord | <Phil> But the fact it's problematic is strange |
21:49:04 | FromDiscord | <Phil> I think ringabout is also on Mac(?) |
21:49:29 | FromDiscord | <Phil> I know araq is but chances are he is sleeping atm |
21:50:57 | FromDiscord | <Yandall> I couldn't find any reference for the error. Just to have installed llvm |
21:53:29 | * | ltriant quit (Ping timeout: 246 seconds) |
21:54:44 | FromDiscord | <Phil> @ringabout are you familiar whether anything changed with clang regarding -d:lto? |
21:55:13 | FromDiscord | <Yandall> Or maybe is something in my enviroment that is missing? |
21:55:35 | FromDiscord | <Phil> I'll be back home in A bit and play around with clang , should still have it installed somewhere |
21:55:52 | FromDiscord | <Elegantbeef> for clang you need to d `--passC:"-flto" --passL:"-flto"` |
21:56:47 | FromDiscord | <Phil> If you're on Mac and clang is your default compiler, does it not do that for you automatically? |
21:56:48 | FromDiscord | <Elegantbeef> It's better to just do that in general for crossplatform/compiler purposes |
21:57:05 | FromDiscord | <Phil> I thought that was a Linux thing since our default compiler was gcc |
21:57:13 | FromDiscord | <Elegantbeef> Nope `-d:lto` afaik doesnt work with clang properly |
21:58:28 | FromDiscord | <Phil> That is really good to know... I guess I should add that to the prologue deployment docs |
21:59:12 | FromDiscord | <Yandall> So I just add those options and remove `-d:lto`? |
21:59:17 | FromDiscord | <Phil> Aye |
21:59:57 | FromDiscord | <Phil> Compilers really are arcane knowledge |
22:00:40 | FromDiscord | <Yandall> Well, it compiled just fine. thanks @ElegantBeef |
22:11:24 | * | pusewicz joined #nim |
22:24:09 | FromDiscord | <Goel> > The definition of âstrict funcsâ changed and is now considered to be stable enough to become the default in later versions.â”What's that? |
22:25:59 | FromDiscord | <Goel> (edit) "> The definition of âstrict funcsâ changed and is now considered to be stable enough to become the default in later versions.â”What's that? ... " added "Means the `func` keyword used instead of the `proc` or something else?â”And its definition changed how exactly?" |
22:27:38 | FromDiscord | <Phil> Alrighty, commit with adjustment to deployment docs is out |
22:34:36 | FromDiscord | <Elegantbeef> Strict funcs now just prevent writing to `ptr` or `ref`â”(@Goel) |
22:36:23 | FromDiscord | <Phil> So you can now have side-effects in functions, but they can't be manipulating data in references? |
22:36:40 | FromDiscord | <Elegantbeef> No funcs still are funcs |
22:36:54 | FromDiscord | <Elegantbeef> But the new definition of strict funcs is you cannot write to ref/ptr |
22:46:13 | * | ltriant joined #nim |
22:49:06 | FromDiscord | <user2m> sent a code paste, see https://paste.rs/JBz |
22:50:50 | FromDiscord | <Elegantbeef> Cause in Nim arrays are static sized |
22:50:55 | FromDiscord | <Elegantbeef> And that size is apart of the type |
22:52:32 | FromDiscord | <user2m> ahh ok so Idx is a built in keyword and not user defined |
22:52:40 | FromDiscord | <Elegantbeef> Nope |
22:52:44 | FromDiscord | <Elegantbeef> It's a generic parameter |
22:53:07 | FromDiscord | <Elegantbeef> Also works |
22:53:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jjo |
22:53:27 | FromDiscord | <Elegantbeef> It's just a generic parameter it could be anything but `array[size, type]` is what you need |
22:53:46 | FromDiscord | <user2m> gotcha! very helpful thanks! |
23:02:45 | Onionhammer | So when we moving nim-template to the nim-lang org? đ |
23:06:07 | FromDiscord | <Elegantbeef> What? |
23:07:37 | Onionhammer | https://github.com/onionhammer/nim-templates |
23:08:52 | FromDiscord | <Phil> What is the benefit of this over strformat? |
23:18:34 | * | pusewicz is now known as pusewicz|away |
23:19:38 | * | oprypin quit (Ping timeout: 272 seconds) |
23:20:10 | * | pusewicz|away quit (Quit: My MacBook has gone to sleep. ZZZzzzâŠ) |
23:23:51 | FromDiscord | <deech> Is there a generalized interspersing function on `openArray`, a `join` that works on any `T` not just strings, eg. `@[1,2,3].intersperse(20)` -> `@[1,20,2,20,3]` |
23:44:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jjy |
23:46:40 | FromDiscord | <nqeron> sent a long message, see http://ix.io/4jjz |
23:47:08 | FromDiscord | <nqeron> I'm trying to allow the user to set the value of N, so obviously that can't be done at compile time |
23:47:21 | FromDiscord | <nqeron> but if I stop using the static variable other things break |
23:50:54 | FromDiscord | <huantian> switch to a `seq` instead of `array` ig |
23:53:38 | FromDiscord | <huantian> other than doing what you have above, I'm not sure if there's a better way, because like you said the size is set by the user at runtime |
23:54:08 | FromDiscord | <nqeron> I was hoping to take advantage of array optimizations - but I guess that would work |
23:56:05 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4jjD |