00:01:53 | FromDiscord | <KatrinaKitten> In reply to @qb "https://play.nim-lang.org/#ix=3Jbq": If you don't mind importing `sequtils`, this is equivalent. Not sure if there's a simpler version.↵https://play.nim-lang.org/#ix=3Jbu |
00:02:57 | FromDiscord | <KatrinaKitten> Without the `[0..^2]` it puts an extra separator on the end, beyond that the behavior is fairly intuitive. |
00:04:52 | FromDiscord | <KatrinaKitten> This is also equivalent but needs the `let`, so it can't be a one-liner. ↵https://play.nim-lang.org/#ix=3Jbw |
00:25:02 | * | vicfred quit (Quit: Leaving) |
00:29:40 | * | stosby joined #nim |
00:43:18 | FromDiscord | <marcus> is there a way to send a embed using a webhook in nim? |
00:48:26 | FromDiscord | <IsaacPaul> Anyone know why `echo result.repr` doesn't do anything in a macro ? |
00:55:26 | * | noeontheend joined #nim |
01:07:55 | FromDiscord | <Sabena Sema> tfw you think the generic cache is broken again but you actually just ... explicitly wrote out one of the generics |
01:07:59 | FromDiscord | <Elegantbeef> what is `result` |
01:08:12 | FromDiscord | <Elegantbeef> Like `echo result.treeRepr` |
01:08:28 | FromDiscord | <Elegantbeef> or `echo result.kind` |
01:11:34 | FromDiscord | <IsaacPaul> I think the macro isnt being executed (there are templates and macros with the same operator) 🤦 |
01:11:53 | FromDiscord | <marcus> In reply to @marcus "is there a way": ^^^ |
01:20:34 | * | TakinOver quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
01:24:21 | FromDiscord | <Elegantbeef> Still working on an alternative wrapnils?↵(@IsaacPaul) |
01:27:30 | FromDiscord | <IsaacPaul> Kinda I’m looking at the ‘questionable’ Library, and was trying to get it to work for procedures that return void. |
01:27:54 | FromDiscord | <IsaacPaul> Honestly it probably wouldn’t have bothered but I feel like I’m so close lol |
01:40:44 | * | Colt quit (Remote host closed the connection) |
01:41:16 | * | Colt joined #nim |
01:47:58 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3JbO |
01:48:32 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3JbO" => "https://play.nim-lang.org/#ix=3JbP" |
01:48:52 | FromDiscord | <IsaacPaul> there’s a matrix library.. I forget the name tho |
01:49:03 | FromDiscord | <retkid> i suppose I will check itertools |
01:49:06 | FromDiscord | <retkid> but the docs confuse me |
01:49:37 | FromDiscord | <IsaacPaul> Arraymancer? Maybe |
01:49:55 | FromDiscord | <retkid> isnt that ai stuff |
01:51:15 | FromDiscord | <retkid> I will write my own magick then |
01:51:37 | FromDiscord | <IsaacPaul> I think it’s more big data than so |
01:51:40 | FromDiscord | <IsaacPaul> ai |
01:52:33 | FromDiscord | <IsaacPaul> Ah deep learning focus |
02:02:22 | * | krux02 quit (Remote host closed the connection) |
02:08:05 | FromDiscord | <Rosen> Neo is the other big one? I'm not sure exactly what kind of function you're looking for tho |
02:10:06 | FromDiscord | <Rosen> Are you trying to like... glue adjacent arrays? |
02:23:37 | * | noeontheend quit (Ping timeout: 240 seconds) |
02:28:26 | FromDiscord | <Rika> its not a well defined problem |
02:28:46 | FromDiscord | <Rika> what happens when [[1,2],[3,4],[5,6]]? |
02:28:58 | FromDiscord | <Rika> and also you need seqs here |
02:36:31 | * | arkurious quit (Quit: Leaving) |
02:36:57 | * | neurocyte0132889 quit (Ping timeout: 240 seconds) |
02:40:14 | FromDiscord | <retkid> well i wrote the code |
02:40:16 | FromDiscord | <retkid> uh |
02:40:37 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Jc0 |
02:40:43 | FromDiscord | <retkid> (edit) |
02:40:55 | FromDiscord | <retkid> so you have a seq of seqs of equal lengths |
02:41:17 | FromDiscord | <retkid> any you take all of them and you plop them into one list |
02:41:35 | FromDiscord | <retkid> guys dont ask why i need this |
02:41:53 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Jc1 |
02:41:57 | FromDiscord | <retkid> (edit) |
02:43:27 | FromDiscord | <Rika> i have no fucking clue what you mean |
02:43:38 | FromDiscord | <retkid> uhhhhhn |
02:44:20 | FromDiscord | <retkid> [[1,2,3,, [1,2,3], [1,2,3]] => [[1,1,1], [2,2,2], [3,3,3,]] |
02:44:35 | FromDiscord | <retkid> (edit) "[[1,2,3,," => "[[1,2,3]," |
02:44:51 | FromDiscord | <Rika> In reply to @Rika "its not a well": still not well defined |
02:45:01 | FromDiscord | <retkid> well, my works fail me |
02:45:09 | FromDiscord | <retkid> (edit) "works" => "words" |
02:46:08 | FromDiscord | <demotomohiro> transpose matrix? |
02:46:09 | FromDiscord | <retkid> 1. all sub-sequences must be of equal lengths↵2. the returned list is defined as: each element in each place of the list is arranged based on their place into individual lists |
02:46:37 | FromDiscord | <retkid> no clue dont exist in the science world because im a baby |
02:50:15 | FromDiscord | <Rika> oh so yeah transpose matrix |
02:50:28 | FromDiscord | <Rika> it feels like its a transpose to me at least |
02:51:08 | FromDiscord | <Rika> https://2.bp.blogspot.com/-8LzbJv0zB3A/WAzRQbxP5eI/AAAAAAAAHYU/MEqPV8JxtLMCSGSQ-0UKZSYlUN3jALZaQCLcB/s1600/Java%2BProgram%2Bto%2BTranspose%2Ba%2BMatrix%2B.png |
02:51:10 | FromDiscord | <Rika> like this right |
02:51:16 | FromDiscord | <Rika> auuuuuuuuua |
02:51:37 | FromDiscord | <Rika> here the wiki i cant be assed to save the image and copy image dont work (thanks discord) |
02:51:37 | FromDiscord | <Rika> https://en.wikipedia.org/wiki/Transpose |
03:25:48 | NimEventer | New Nimble package! rangequeries - An implementation of Range Queries in Nim, see https://github.com/vanyle/RangeQueriesNim/ |
03:36:19 | * | stosby quit (Read error: Connection reset by peer) |
03:41:17 | FromDiscord | <Sabena Sema> is there a usual way to make your own data structures that can be indexed arbitrarily?↵`type mdArray[N,M: static Slice[int]] = array[len(M)len(N), int]`↵↵does not work, and triggers an ice |
03:41:25 | FromDiscord | <Sabena Sema> oh, it's actually not quite an ice |
03:42:02 | * | stosby joined #nim |
03:42:38 | * | stosby quit (Read error: Connection reset by peer) |
03:43:46 | FromDiscord | <Sabena Sema> should that work? |
03:43:53 | FromDiscord | <Sabena Sema> is the range in an array type constructor a type or a value? |
03:43:56 | FromDiscord | <Sabena Sema> is it both? |
03:43:59 | FromDiscord | <Sabena Sema> neither? |
03:44:02 | FromDiscord | <Sabena Sema> a tyvalue |
03:44:09 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jcd |
03:44:10 | FromDiscord | <Sabena Sema> sure |
03:44:18 | FromDiscord | <TryAngle> ah wait |
03:44:18 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3Jcd" => "https://play.nim-lang.org/#ix=3Jce" |
03:44:21 | FromDiscord | <Sabena Sema> but then I would need to encode the start and end indicies seperately |
03:44:27 | FromDiscord | <TryAngle> u want to index via slicen 🤔 |
03:44:52 | FromDiscord | <Sabena Sema> I want to be able to have `mdarray[1..5,0..4]` for a 5x5 array where the rows are indexed from 1 to 5 and the columns from 0 to 4 |
03:45:37 | FromDiscord | <Rika> you will need to make a custom type with a custom `[]` |
03:46:45 | FromDiscord | <TryAngle> is there a quick way to flatten an array? |
03:46:50 | FromDiscord | <TryAngle> dim 2 -> dim 1 |
03:47:05 | FromDiscord | <Sabena Sema> OK so the type will need additional parameters to indicate the top and bottom indicies |
03:47:21 | FromDiscord | <Sabena Sema> but then ... how can I write a type that can accept _any_ range for indexing like array can? |
03:47:41 | FromDiscord | <Sabena Sema> just writing a type with a custom `[]` doesn't work since the type needs to carry the start and end indicies along with it |
03:48:19 | * | stosby joined #nim |
03:49:18 | FromDiscord | <Rika> you can access generics in a function? |
03:49:28 | FromDiscord | <Sabena Sema> hih? |
03:49:30 | FromDiscord | <Sabena Sema> (edit) "hih?" => "huh?" |
03:49:31 | FromDiscord | <Sabena Sema> ofc |
03:49:56 | * | stosby quit (Client Quit) |
03:50:22 | FromDiscord | <Sabena Sema> I mean nim doesn't really do HKTs so if you have a generic proc on a type that proc is typically parameterized on all that type's parameters too |
03:50:28 | FromDiscord | <Rika> why would you need to carry |
03:50:30 | FromDiscord | <Rika> ? |
03:50:30 | FromDiscord | <Sabena Sema> for implicit generics you can use dot syntax to access them |
03:50:45 | FromDiscord | <Sabena Sema> how would the `[]` know where indexing starts? |
03:50:52 | FromDiscord | <Rika> check the type on the generic? |
03:50:55 | FromDiscord | <Sabena Sema> yes |
03:51:05 | FromDiscord | <Sabena Sema> and thus the type needs to carry that type with it |
03:51:15 | FromDiscord | <Rika> so? thats what array does |
03:51:25 | FromDiscord | <Sabena Sema> right |
03:51:38 | FromDiscord | <Sabena Sema> and that's what I tried |
03:51:43 | FromDiscord | <Sabena Sema> but `type mdArray[N,M: static Slice[int]] = array[len(M)len(N), int]` is not valid nim |
03:51:46 | FromDiscord | <Rika> then i dont know |
03:51:49 | FromDiscord | <Rika> array is a magic |
03:51:54 | FromDiscord | <Rika> you dont have much option |
03:52:03 | FromDiscord | <Sabena Sema> sigh I'll report the bug |
03:56:00 | FromDiscord | <Rika> OH |
03:56:11 | FromDiscord | <Rika> seems to compile |
03:56:12 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Jcj |
03:56:36 | FromDiscord | <Sabena Sema> maybe it's because system.len for slices uses `Ord` |
03:56:41 | FromDiscord | <Rika> it does |
03:56:47 | FromDiscord | <Rika> i mean compile |
03:56:49 | FromDiscord | <Rika> it compiles |
03:56:52 | FromDiscord | <Sabena Sema> yeah |
03:56:54 | FromDiscord | <TryAngle> nim is such a sussy language 😳 |
03:56:56 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3Jck |
03:57:05 | FromDiscord | <Sabena Sema> the len I was calling in my code was that one from system.nim |
03:57:10 | FromDiscord | <Rika> i know |
03:57:20 | FromDiscord | <Rika> its strange that it doesnt without the len |
03:57:47 | FromDiscord | <Sabena Sema> I will add your information to the bug report |
03:57:52 | FromDiscord | <Sabena Sema> and try after updating my compiler |
04:00:47 | FromDiscord | <TryAngle> I'm curious, in which cases do u want to force indexing from x to y instead of from 0 to x-y ?↵@Sabena Sema |
04:00:58 | FromDiscord | <TryAngle> (edit) "x-y" => "y-x" |
04:01:42 | FromDiscord | <Sabena Sema> none |
04:01:53 | FromDiscord | <Sabena Sema> I want indexing from 1..ncols |
04:01:56 | FromDiscord | <Sabena Sema> sometimes |
04:02:03 | FromDiscord | <Sabena Sema> but from 0..ncols-1 some other times |
04:02:12 | FromDiscord | <Sabena Sema> since in math it's traditional to index from one |
04:03:13 | FromDiscord | <TryAngle> ah I see |
04:04:17 | FromDiscord | <TryAngle> I did nimble develop in trymisc project↵and added it to requires in another nimble project↵why doesn't it get found? https://media.discordapp.net/attachments/371759389889003532/923425753482276894/unknown.png |
04:04:41 | FromDiscord | <Rika> idk, its found when i nimble develop then compile with nim |
04:05:35 | FromDiscord | <Sabena Sema> zero based indexing is kinda better for the usual ways |
04:05:48 | FromDiscord | <Sabena Sema> but if you're going between math and code frequently one based can be nice |
04:05:56 | FromDiscord | <Rika> eh both indexing schemes have its benefits and demerits |
04:06:17 | FromDiscord | <Sabena Sema> maybe I should just have a way to pass a pairing function in |
04:06:33 | FromDiscord | <Sabena Sema> that has other advantages |
04:06:42 | FromDiscord | <Sabena Sema> since you can store stuff diagonally and stuff |
04:06:49 | FromDiscord | <TryAngle> In reply to @Rika "idk, its found when": hmmm I would publish trymisc sooner or later anyways I think↵if I publish it now to use it, would I have to wait until the pull request gets accepted or does it get added automatically? |
04:07:04 | FromDiscord | <Rika> wait for the pull request afaik |
04:07:15 | FromDiscord | <TryAngle> I see |
04:07:22 | FromDiscord | <TryAngle> I guess I use nim then over nimble xd |
04:07:54 | FromDiscord | <Rika> i was looking into using other build systems like idk xmake (some dude advertised it here some time ago) |
04:08:10 | FromDiscord | <Sabena Sema> it's generally pretty easy |
04:08:27 | FromDiscord | <Sabena Sema> because generally nim projects just have one TU |
04:08:36 | FromDiscord | <Sabena Sema> the nim compiler could be a bit better about outputting deps |
04:08:52 | FromDiscord | <Sabena Sema> there is an option to do it but having it in .d format would be kinda nice |
04:09:08 | FromDiscord | <Rika> in what format |
04:09:12 | FromDiscord | <Sabena Sema> you'll need to integrate that into the build system if you want to avoid rerunning `nim` each time |
04:09:20 | FromDiscord | <Sabena Sema> `.d` it's a subset of GNU make format |
04:09:30 | FromDiscord | <Sabena Sema> it's what GCC outputs if you pass `-MD` |
04:11:37 | * | noeontheend joined #nim |
04:41:43 | FromDiscord | <TryAngle> how do I implement an iterator for a datastructure with a sequence internally that gets automatically used in for loops? |
04:42:19 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jcr |
04:45:12 | FromDiscord | <Rika> What do you mean |
04:45:21 | FromDiscord | <TryAngle> wait I edit message |
04:45:23 | FromDiscord | <Rika> You mean the items iterator |
04:45:32 | FromDiscord | <Rika> Just make an iterator named items for the type |
04:48:16 | FromDiscord | <TryAngle> In reply to @Rika "Just make an iterator": I've never done anything with iterators...↵also how do I name the iterator that the for loop automatically uses it? |
04:48:29 | FromDiscord | <Rika> Literally just call it “items” |
04:48:45 | FromDiscord | <Rika> With input type of the vector type you have and any yield type |
04:49:22 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jcs |
04:49:31 | FromDiscord | <Rika> Perfect |
04:49:40 | FromDiscord | <TryAngle> ok thanks 👍 |
04:54:37 | * | rockcavera quit (Remote host closed the connection) |
04:55:09 | FromDiscord | <Elegantbeef> `type Vector[T] = distinct ref seq[T]` goes brr 😛 |
05:05:52 | FromDiscord | <TryAngle> In reply to @Elegantbeef "`type Vector[T] = distinct": Ik that but I store extra things as well xd↵I do that for static version of vector for example with arrays |
05:08:10 | FromDiscord | <TryAngle> Does array[1, array[LEN, T]] have any overhead compared to just array[LEN, T]? |
05:08:32 | FromDiscord | <Elegantbeef> Afaik they're stored identically internally |
05:08:39 | FromDiscord | <TryAngle> That way I don't have to implement everything twice |
05:09:21 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Afaik they're stored identically": 🤔 |
05:10:04 | FromDiscord | <Rika> In reply to @TryAngle "🤔": ? |
05:10:29 | FromDiscord | <Elegantbeef> `array[1,T]` is contigious storage of `T` |
05:21:33 | FromDiscord | <TryAngle> Ok good to know 👍 |
05:22:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
06:03:54 | FromDiscord | <Rosen> Is there anyone in here who uses nvim + has a working nimlsp setup + is willing to share their init.vim? |
06:04:19 | FromDiscord | <Rosen> Going nuts trying to get completion working, or even just syntax highlighting that stays while i'm typing |
06:23:30 | FromDiscord | <Elegantbeef> @Rosen\: my messy nvim https://play.nim-lang.org/#ix=3JcN |
06:24:17 | FromDiscord | <Rosen> And your editing experience is smooth? Completion works as expected, etc? |
06:24:26 | FromDiscord | <Rosen> I think my issue might be with nimlsp then... that's unfortunate |
06:24:29 | FromDiscord | <Elegantbeef> It's not my daily driver but yes |
06:38:38 | FromDiscord | <Mrcool> I spent some time yesterday setting up nvim + coc + nim, I think its an ok setup now↵↵I only use alaviass nim plugin, and I installed nimlsp through nibmle and add it to coc settings for nim filea |
06:39:49 | FromDiscord | <Mrcool> The overrides and the no namespacing makes the completion a bit annoying (its full of duplicate and irrelevant items) |
06:46:37 | * | typnoking is now known as tinytim |
06:50:44 | FromDiscord | <Mrcool> But the experience is generally ok , I'm probably going to disable lsp completions though and keep other sources like buffer until it gets better |
06:57:12 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JcS |
06:57:31 | FromDiscord | <Elegantbeef> `var` |
06:58:27 | FromDiscord | <TryAngle> oh 😂 ↵ty |
07:00:52 | FromDiscord | <Elegantbeef> I was meaning to make a PR that explicitly states "Atleast one mismatch is due to immutabillity" |
07:16:14 | * | Colt quit (Ping timeout: 260 seconds) |
07:16:41 | * | Colt joined #nim |
07:39:52 | FromDiscord | <TryAngle> is there a way to specialize in nim? |
07:40:15 | FromDiscord | <Elegantbeef> Use your small words |
07:40:58 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JcY |
07:41:20 | FromDiscord | <TryAngle> the second proc should only be used for N != 1 |
07:41:37 | FromDiscord | <Elegantbeef> `when n != 1:` |
07:41:47 | FromDiscord | <TryAngle> where do I put that? |
07:42:53 | FromDiscord | <Elegantbeef> In the proc |
07:44:58 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JcZ |
07:45:22 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3JcZ" => "https://play.nim-lang.org/#ix=3Jd0" |
07:51:09 | FromDiscord | <Elegantbeef> I meant dispatch inside it |
07:53:24 | FromDiscord | <Elegantbeef> Or w/e |
07:53:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jd3 |
07:54:31 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jd4 |
07:54:55 | FromDiscord | <TryAngle> they're not equal types |
07:55:10 | FromDiscord | <TryAngle> ah wait |
07:55:21 | FromDiscord | <TryAngle> the T can be another array |
07:55:30 | FromDiscord | <TryAngle> (edit) "the T can be another array ... " added "for SVector no?" |
07:56:03 | FromDiscord | <Elegantbeef> You mean SMatrix? |
07:56:59 | FromDiscord | <TryAngle> I should go to bed my brain doesn't work anymore idk anymore anything tbh 🥶 |
08:02:13 | FromDiscord | <valerga> removed tooltips on hover on vscode, they only get in the way |
08:04:18 | FromDiscord | <valerga> `"editor.hover.enabled": false` |
08:04:40 | FromDiscord | <valerga> thought would be nice to summon the tooltip on demand |
08:04:43 | FromDiscord | <valerga> (edit) "thought" => "though" |
08:06:07 | * | PMunch joined #nim |
08:32:52 | FromDiscord | <Sabena Sema> huh I bet that would fix my array range problem |
08:33:09 | FromDiscord | <Sabena Sema> and arrays of arrays aren't really a sin like seq[seq]] is |
08:33:56 | FromDiscord | <Sabena Sema> For (dense) matrices and vectors it's generally better to do array[NM, T] rather than array[N, array[N, T]] |
08:34:07 | FromDiscord | <Sabena Sema> or it's more typical |
08:34:19 | FromDiscord | <Sabena Sema> for fixed size matrices it probably doesn't matter much |
08:39:04 | FromDiscord | <TryAngle> In reply to @Sabena Sema "For (dense) matrices and": I don't think array of arrays add an overhead 🤔 |
08:39:16 | FromDiscord | <Sabena Sema> yeah, it's not bad for fixed size |
08:39:24 | FromDiscord | <TryAngle> maybe in Java and C arrays werent' even arrays |
08:39:26 | FromDiscord | <Sabena Sema> seq[seq] the questionable one |
08:39:30 | FromDiscord | <Elegantbeef> The issue is with seqs since you're dealing with indirection |
08:39:31 | FromDiscord | <TryAngle> so maybe that's why the other thing is common |
08:39:52 | FromDiscord | <Sabena Sema> well, it's easy enough to do the indexing |
08:40:02 | FromDiscord | <Sabena Sema> but yeah |
08:40:26 | FromDiscord | <TryAngle> yes I also use it for my "dynamic" matrices |
08:40:40 | FromDiscord | <Sabena Sema> carry on then |
08:41:10 | FromDiscord | <Sabena Sema> nothing actually wrong with it for fixed size, I just see it a _lot_ with dynamic sized |
08:41:13 | FromDiscord | <Sabena Sema> esp C programmers |
08:41:17 | FromDiscord | <TryAngle> (edit) "yes I also use it for my "dynamic" matrices ... " added "the [i row + j] or [j col + i] thingy" |
08:42:06 | FromDiscord | <Elegantbeef> Speaking of the formula, isnt the math just so wonderful for the index, it doesnt rely on the height of the container |
08:42:25 | FromDiscord | <TryAngle> anybody knows how this operation is called? https://media.discordapp.net/attachments/371759389889003532/923495746651697163/unknown.png |
08:42:37 | FromDiscord | <Sabena Sema> sure it does, it's colsy+x |
08:42:41 | FromDiscord | <Sabena Sema> or colsx+y |
08:42:53 | FromDiscord | <Sabena Sema> (edit) "colsx+y" => "rowsx+y" |
08:43:10 | FromDiscord | <Sabena Sema> or any number of other things |
08:43:41 | FromDiscord | <qb> What is `cstring`'s equivalent of `setLen`? |
08:43:59 | FromDiscord | <Elegantbeef> It only needs the size of one dimension is the thing i like |
08:44:11 | FromDiscord | <Elegantbeef> `create(char, size)` |
08:44:18 | FromDiscord | <TryAngle> In reply to @TryAngle "anybody knows how this": in numpy that's matrix + vector but I don't understand how |
08:44:24 | FromDiscord | <Elegantbeef> `cstring` is a `ptr char` so it kinda deeppends |
08:44:53 | FromDiscord | <Elegantbeef> You must be tired try |
08:45:20 | FromDiscord | <Rika> In reply to @TryAngle "anybody knows how this": Addition? |
08:45:28 | FromDiscord | <Rika> Matrix vector addition? |
08:46:01 | FromDiscord | <Rika> What exactly do you want to know about it |
08:46:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jdo |
08:46:12 | FromDiscord | <Sabena Sema> you can also index by `(0.5 (x + y -1)(x+y)(x)` I think |
08:46:13 | FromDiscord | <Elegantbeef> Oh how it's called 😀 |
08:46:15 | FromDiscord | <Sabena Sema> if you are insane |
08:46:28 | FromDiscord | <Sabena Sema> except without the floating point |
08:46:56 | FromDiscord | <TryAngle> omg |
08:47:00 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jdp |
08:47:07 | FromDiscord | <TryAngle> I can't add |
08:47:09 | FromDiscord | <TryAngle> anymore |
08:47:12 | FromDiscord | <Elegantbeef> Is this sarcasm or did you miss that |
08:47:15 | FromDiscord | <TryAngle> .... |
08:47:32 | FromDiscord | <TryAngle> -1.79 + 3 != 1.21 in my head |
08:47:37 | FromDiscord | <TryAngle> so It hought it's different |
08:47:40 | FromDiscord | <TryAngle> ???? |
08:47:40 | FromDiscord | <Elegantbeef> Ah |
08:47:53 | * | neurocyte0132889 joined #nim |
08:47:53 | * | neurocyte0132889 quit (Changing host) |
08:47:53 | * | neurocyte0132889 joined #nim |
08:47:55 | FromDiscord | <Elegantbeef> Yea i was confused for a minute but it's just row addition |
08:48:04 | FromDiscord | <Elegantbeef> Or column, whatever the fucking stupid arbitrary term is |
08:48:09 | FromDiscord | <TryAngle> that's it I go to bed gn guys |
08:48:10 | FromDiscord | <Rika> I recommend going back to grade school 😛 |
08:48:35 | FromDiscord | <TryAngle> In reply to @Rika "I recommend going back": I'm engineering & bioinformatics undergrad 😔 |
08:48:47 | FromDiscord | <Sabena Sema> real mathematicians can't do arithmetic, as a rule |
08:49:03 | FromDiscord | <Sabena Sema> (they also can't write comments in their code, a separate issue) |
08:49:06 | FromDiscord | <Elegantbeef> Here i am "high school graduate" 😛 |
08:49:33 | FromDiscord | <Rika> I’m taking an undergrad but I’m only around halfway there so far |
08:49:49 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues/19284 is this you try? Or was there another similar conversation? |
08:49:59 | FromDiscord | <Sabena Sema> eyp I opened that |
08:50:10 | FromDiscord | <Elegantbeef> Ah |
08:50:11 | FromDiscord | <Elegantbeef> Looking at it now |
08:50:18 | FromDiscord | <Rika> The rika that answered is totally not me though |
08:50:50 | FromDiscord | <Sabena Sema> nope, that was you |
08:50:55 | FromDiscord | <Sabena Sema> you pointed out the working snippet |
08:51:04 | FromDiscord | <Elegantbeef> JokesSabena's' head |
08:51:09 | FromDiscord | <Rika> Lol |
08:51:40 | FromDiscord | <Sabena Sema> huh? |
08:51:56 | FromDiscord | <Rika> I was joking ;; |
08:52:29 | FromDiscord | <Sabena Sema> oh, totally over my head |
08:55:57 | * | neurocyte0132889 quit (Ping timeout: 268 seconds) |
08:57:46 | FromDiscord | <Elegantbeef> Oh seems like the issue is it doesnt properly generate a generic proc |
08:58:32 | FromDiscord | <Sabena Sema> that's bizarre |
08:59:05 | FromDiscord | <Elegantbeef> Well it goes through `staticExpr` so perhaps this tree doesnt know how to generate generic procs |
08:59:38 | FromDiscord | <Elegantbeef> Or a flag just isnt passed |
09:05:10 | FromDiscord | <Sabena Sema> yeah but the fact it works with a custom len function |
09:06:53 | FromDiscord | <Elegantbeef> It works if it comes from the same module |
09:06:58 | FromDiscord | <Elegantbeef> That's interesting |
09:07:18 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Jdw is the direct copy of the system version |
09:07:47 | FromDiscord | <Elegantbeef> I do know when the code runs with the dud version `result` is an ident and `max` is an `openSym` which means it's not instantiated as you well know |
09:08:30 | FromDiscord | <Elegantbeef> So it seems like it's an issue with a generic from another module causing it not be semmable |
09:11:38 | FromDiscord | <qb> https://play.nim-lang.org/#ix=3JdA |
09:11:48 | FromDiscord | <qb> How could I avoid this issue without removing the setlen? |
09:12:14 | FromDiscord | <Elegantbeef> You cant really |
09:12:32 | FromDiscord | <qb> aw |
09:12:47 | FromDiscord | <Elegantbeef> Well i mean you can always find the overlap |
09:14:12 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3JdC |
09:14:30 | FromDiscord | <Elegantbeef> I guess `getPrefixOverlap` makes the most sense |
09:18:23 | FromDiscord | <Elegantbeef> If what you're looking for is a static phrase you can do `startsWith` or w/e it's called in `strutils` |
09:19:39 | FromDiscord | <Zajt> How do I get the current process handle in Nim?↵In c++, you would do like this `(HANDLE)-1` but what would I use in Nim to do the same thing? |
09:20:54 | FromDiscord | <Rika> ? |
09:20:57 | FromDiscord | <Rika> Did someone send something here |
09:21:18 | FromDiscord | <Elegantbeef> Yes they then deleted it |
09:21:33 | FromDiscord | <Elegantbeef> Was about PID getting on windows |
09:21:47 | FromDiscord | <Rika> I see |
09:22:50 | FromDiscord | <Zajt> Yeah one sec, rewriting my question |
09:24:02 | FromDiscord | <Zajt> I got this line `DuplicateHandle(hParentProcess, (HANDLE)-1, GetCurrentProcess(), addr hDup, 0, FALSE, DUPLICATE_SAME_ACCESS)`↵which I converted from c++ but (HANDLE)-1 is c++ which is why I get this error `Error: type mismatch: got <type HANDLE, int literal(1)>`↵To solve it, should I replace it with GetCurrentProcess() as well, same as the third argument? |
09:25:05 | FromDiscord | <Elegantbeef> `HANDLE` is a type is the issue |
09:25:35 | FromDiscord | <Elegantbeef> So yes you should probably use that proc as it returns what you need |
09:26:44 | * | Vladar joined #nim |
09:27:09 | FromDiscord | <qb> Could I get the string size of 3 for "foo" even if I used setLen(50)? |
09:27:39 | FromDiscord | <Zajt> In reply to @Elegantbeef "So yes you should": thanks will use that instead |
09:27:40 | FromDiscord | <Elegantbeef> You can iterate until you find the first whitespace or control character |
09:27:48 | FromDiscord | <Elegantbeef> The issue is that it's not reliable if this is a random string |
09:30:27 | FromDiscord | <qb> >.< |
09:31:02 | FromDiscord | <Rika> There's a reason nim tracks the length unlike in c traditionally |
09:31:23 | FromDiscord | <Zajt> How would I convert this c++ line to Nim?↵`LARGE_INTEGER sectionSize = { size };` |
09:31:26 | FromDiscord | <Rika> \0 is a valid character in non-text strings (by the way pls don't do that) |
09:31:42 | FromDiscord | <Rika> Use seq byte if you need to store bytes... |
09:31:44 | FromDiscord | <Elegantbeef> `var sectionSize = size`? |
09:31:59 | FromDiscord | <Zajt> what type should sectionSize variable be? |
09:32:21 | FromDiscord | <Elegantbeef> I dont know what LargeInteger is |
09:32:27 | FromDiscord | <Elegantbeef> Sounds like a fixed size int64 |
09:32:54 | FromDiscord | <Elegantbeef> https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-large_integer-r1 |
09:32:59 | FromDiscord | <Elegantbeef> So it should be a union |
09:33:38 | FromDiscord | <Elegantbeef> https://github.com/khchen/winim since you're using winapi's you may want that |
09:34:07 | FromDiscord | <Zajt> yeah I have imported that one |
09:34:13 | FromDiscord | <Zajt> (edit) "yeah I have imported that one ... " added "`import winim`" |
09:35:06 | FromDiscord | <Elegantbeef> Well i dont know how to make a large integer using it there are probably helper procs |
09:35:38 | FromDiscord | <qb> how dangerous and dirty is that? https://play.nim-lang.org/#ix=3JdI |
09:35:50 | FromDiscord | <Zajt> sent a code paste, see https://play.nim-lang.org/#ix=3JdJ |
09:35:51 | FromDiscord | <Elegantbeef> Very |
09:36:02 | FromDiscord | <Zajt> since I use that format to define multiple variables in one section of the code, then assign them later on |
09:36:16 | FromDiscord | <Elegantbeef> Like i said there is probably a helper proc to do this |
09:36:23 | FromDiscord | <Elegantbeef> I dont know winim so i dont know how |
09:37:13 | FromDiscord | <Elegantbeef> Look for the Large\_Integer definition then see if there are any procs that return ti |
09:40:00 | FromDiscord | <qb> https://play.nim-lang.org/#ix=3JdK |
09:40:02 | * | kayabaNerve quit (Remote host closed the connection) |
09:40:38 | * | kayabaNerve joined #nim |
09:40:49 | FromDiscord | <Elegantbeef> So many assumptions made here 😀 |
09:41:27 | FromDiscord | <Rika> Len of a cstring is already dependent on \0 placement |
09:41:40 | FromDiscord | <Rika> No need to make that function again |
09:42:14 | FromDiscord | <Elegantbeef> I mean they've grown their string with empty data then are shrinking it after |
09:42:19 | FromDiscord | <Elegantbeef> Personally i dont get what they're doing |
09:44:13 | FromDiscord | <qb> b is a buffer of a c function and I need to compare that buffer to regular nim strings |
09:44:38 | FromDiscord | <qb> https://github.com/qb-0/NimbleImGui/blob/main/src/ui.nim#L127 |
09:46:27 | FromDiscord | <qb> If I don't give that buffer some space I get a segfault |
09:56:31 | FromDiscord | <Elegantbeef> I dont get it all of your code uses strings here |
10:02:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JdP |
10:14:08 | FromDiscord | <TryAngle> can forloops be run at comptime? |
10:14:14 | NimEventer | New Nimble package! nordaudio - A small wrapper around PortAudio for cross-platform audio IO., see https://github.com/Psirus/nordaudio |
10:14:32 | FromDiscord | <Elegantbeef> Do you mean unrolled or just "can i use iterators at compile time"? |
10:14:43 | FromDiscord | <TryAngle> iterators at compile time |
10:14:52 | FromDiscord | <Elegantbeef> Inline iterators work yes |
10:14:56 | FromDiscord | <Elegantbeef> Closue i believe do not |
10:22:12 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JdU |
10:24:23 | FromDiscord | <TryAngle> and, does range have a step function? |
10:24:27 | FromDiscord | <TryAngle> (edit) removed "and," |
10:24:45 | FromDiscord | <Elegantbeef> `countUp(a, b, step)` |
10:25:17 | FromDiscord | <TryAngle> ty |
10:40:27 | FromDiscord | <qb> In reply to @Elegantbeef "So instead of doing": Silly stuff 😄 well that one ends in a indexdefect atm. |
10:40:48 | FromDiscord | <Elegantbeef> `0 .. <20` |
10:40:59 | FromDiscord | <Elegantbeef> Off by one is fun |
10:41:25 | FromDiscord | <Elegantbeef> Anywho i sleep now so forward all your complaints to the nearest seal |
10:42:30 | FromDiscord | <qb> Thank you as usual ;D gn |
10:48:55 | * | xet7 quit (Remote host closed the connection) |
10:50:07 | * | xet7 joined #nim |
10:51:24 | FromDiscord | <Zajt> sent a code paste, see https://play.nim-lang.org/#ix=3Jef |
10:52:38 | FromDiscord | <Rika> Because it's defined as one in whatever library you're using |
10:52:44 | FromDiscord | <Rika> Handles are integers in general |
10:53:38 | FromDiscord | <TryAngle> In reply to @Elegantbeef "`countUp(a, b, step)`": ah I need somethign that works for floats aswell |
10:56:41 | FromDiscord | <Zajt> In reply to @Rika "Because it's defined as": okay so I should but INT instead of HANDLE in the variable definition there? |
10:57:45 | FromDiscord | <Rika> No |
10:59:23 | FromDiscord | <Zajt> What's the correct way to solve this error then? |
10:59:26 | FromDiscord | <TryAngle> In reply to @Zajt "I have these lines": Why not use std/options? |
10:59:59 | FromDiscord | <Rika> You should set to 0 and not null |
11:00:25 | FromDiscord | <TryAngle> Isn't it already set to 0 if it's a numeric? |
11:00:43 | FromDiscord | <Rika> Yeah but if you want to be explicit |
11:06:23 | FromDiscord | <Zajt> I see, that fixed it nice. On another line, I am using a function which expects a large integer (int64), and right now in that argument, I put a 0 but it didn't like that. What other value can I put instead? |
11:06:47 | FromDiscord | <Zajt> (edit) "it nice. On another line, I am using a function which expects a large integer (int64), and right now in that argument, I put a 0 but it didn't like that. What other value can I put instead?" => "it!" |
11:08:55 | * | neceve joined #nim |
11:32:42 | FromDiscord | <lumi> how do I fix this warning? `implicit conversion to 'cstring' from a non-const location` |
11:33:13 | FromDiscord | <lumi> nvm, manually casting is make the compiler happy |
11:33:19 | FromDiscord | <lumi> (edit) "make" => "makes" |
12:06:42 | FromDiscord | <tandy> i wonder if futhark can wrap ffmpeg |
12:49:11 | FromDiscord | <Zajt> Why do I get this when compiling my nim code on Linux ? Isn't windows.h correct to use on Linux? I've used it before https://media.discordapp.net/attachments/371759389889003532/923557853913022474/unknown.png |
13:06:08 | FromDiscord | <exelotl> I think you could only use windows.h if you were using a cross-compiler e.g. `mingw-w64-i686-gcc` to build for windows |
13:06:36 | FromDiscord | <exelotl> then you could run the compiled program in Wine |
13:12:16 | * | rockcavera joined #nim |
13:12:16 | * | rockcavera quit (Changing host) |
13:12:17 | * | rockcavera joined #nim |
13:25:59 | FromDiscord | <gogolxdong (liuxiaodong)> Who can bough me a $6 vultr instance so that we can pay via crypto afterwards? We can pay the twice of buying instance. |
13:33:16 | FromDiscord | <gogolxdong (liuxiaodong)> It requires credit card or paypal for the first deposit, it supports Alipay as well , we are concerned with the privacy protection though. |
13:33:24 | FromDiscord | <Zajt> In reply to @exelotl "I think you could": I see, is it possible to compile with this line in an external file that I import from my main nim file? |
13:33:57 | FromDiscord | <Zajt> The nim file that I import looks like this at the top which has that windows.h line v |
13:34:01 | FromDiscord | <Zajt> (edit) removed "v" |
13:34:03 | FromDiscord | <Zajt> https://media.discordapp.net/attachments/371759389889003532/923569142752239646/unknown.png |
13:38:32 | FromDiscord | <Zajt> Nvm I solved it by adding `--cpu:amd64 --os:windows --gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc` |
13:43:22 | FromDiscord | <gogolxdong (liuxiaodong)> or we can buy someone's Vultr account which has been verified and raised limit of cost. |
13:46:27 | FromDiscord | <gogolxdong (liuxiaodong)> which is free to pay via crypto. |
13:53:18 | FromDiscord | <gogolxdong (liuxiaodong)> We'd like to pay $100 for such account and pay in advance. |
14:03:44 | FromDiscord | <Zajt> What's the correct way to echo out a pointer to variable of type handle? |
14:04:06 | FromDiscord | <Zajt> (edit) "What's the correct way to echo out a pointer to variable of type handle? ... " added " (for debugging purposes)" |
14:05:51 | FromDiscord | <enthus1ast> `repr` can debug print pointers |
14:06:08 | FromDiscord | <enthus1ast> or what i like to use lately is treeforms/print |
14:09:56 | FromDiscord | <Zajt> I ran this `echo fmt"[DEBUG] Section base address: {repr(sectionHandle)} "` but it didn't make any differece |
14:20:18 | FromDiscord | <retkid> heyyyy how do i sort a sequence of sequences |
14:21:13 | * | arkurious joined #nim |
14:21:30 | FromDiscord | <retkid> i kinda just wanna lambda into it and do ↵↵x.sort(a=>system.cmp(a[3])) |
14:21:34 | FromDiscord | <retkid> or something like that |
14:59:21 | FromDiscord | <Solitude> https://nim-lang.org/docs/algorithm.html#sort%2CopenArray%5BT%5D%2Cproc%28T%2CT%29 |
15:00:40 | * | Vladar quit (Quit: Leaving) |
15:14:57 | NimEventer | New thread by Lyhokia: Manipulating varargs in compile time (like what lua do in runtime)?, see https://forum.nim-lang.org/t/8729 |
15:18:21 | FromDiscord | <retkid> In reply to @Solitude "https://nim-lang.org/docs/algorithm.html#sort%2Cope": the sugar syntax is the real mvp hjere |
15:25:09 | * | PMunch quit (Quit: Leaving) |
17:26:54 | FromDiscord | <Alea> does += not work for floats? |
17:26:56 | FromDiscord | <Alea> https://media.discordapp.net/attachments/371759389889003532/923627748558270464/unknown.png |
17:27:48 | FromDiscord | <Alea> wait nvm |
17:36:09 | nrds | <Prestige99> Hm? |
17:37:51 | nrds | <Prestige99> @Alea https://play.nim-lang.org/#ix=3Jgz |
17:44:03 | FromDiscord | <eyis> sent a code paste, see https://play.nim-lang.org/#ix=3JgA |
17:44:07 | FromDiscord | <Alea> yeah sorry, forgot that I used let instead of var |
17:44:20 | FromDiscord | <Alea> the error message was misleading |
17:44:30 | nrds | <Prestige99> No worries |
17:44:56 | nrds | <Prestige99> Yeah that is a pretty bad error message |
17:46:31 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3JgB |
17:46:44 | FromDiscord | <Solitude> In reply to @eyis "How do I do": https://nim-lang.github.io/Nim/tut1.html#advanced-types-reference-and-pointer-types |
17:52:32 | FromDiscord | <eyis> I see, thanks, and how to I get a reference to a an existing `Node`? |
17:53:02 | FromDiscord | <eyis> or do I need to have all my objects declared as `ref object` to do that? |
17:55:26 | FromDiscord | <Solitude> yes, you can remove `ref` from the field then |
17:56:59 | FromDiscord | <eyis> okay, thanks again :D |
18:02:44 | FromDiscord | <Smarc> Does anyone have a clue, why my program is not recognizing a check if the Rook is standing right west of the king? A test where the Rook stands right south of the king works fine, I just don't really get it. https://github.com/Smarcy/nim_chess/blob/master/tests/test_move.nim#L648 |
18:03:09 | FromDiscord | <Smarc> The isChecked proc is here: https://github.com/Smarcy/nim_chess/blob/master/src/nim_chess/model/board.nim#L76 |
18:04:12 | FromDiscord | <Smarc> (You can see the behaviour by running 'nimble test') |
18:06:09 | FromDiscord | <Smarc> My guess would be that the 'isChecked' proc has issues with checking for check if the checking-Piece is on the board-edge.. But I can't figure out how to fix that |
18:17:15 | * | anadahz joined #nim |
18:18:16 | anadahz | Hi! I am trying to deploy Nim packages locally (https://github.com/nim-lang/packages). Any suggestions on how to do this? |
18:22:05 | nrds | <Prestige99> Do you mean adding a package to nimble? |
18:23:42 | anadahz | @Prestige No, I mean running the nimble.directory |
18:32:18 | NimEventer | New post on r/nim by PrettySeriousUser: Chess Logic Issue, see https://reddit.com/r/nim/comments/rn20pp/chess_logic_issue/ |
18:32:54 | FromDiscord | <lkioi> Is there a way to parse a pdf in nim like pypdf2 does? |
18:36:21 | nrds | <Prestige99> Hm anadahz @dom96 might be the person to ask about that |
18:36:30 | nrds | <Prestige99> if he's around |
18:39:21 | anadahz | @dom96 Hi, do you know how to deploy nimble.directory? I like how simple it is and I would like to use for indexing other types of packages (not necessary nim). |
18:39:31 | anadahz | (thx @Prestige) |
18:44:07 | FromDiscord | <Mango IV.> If I have a `var seq[seq[int]]` why is the inner sequence always immutable? Can I have any nested mutable datastructure? |
18:47:05 | nrds | <Prestige99> off topic but if you want a 2D sequence I recommend having it be a single seq with helper functions, e.g. https://github.com/avahe-kellenberger/maze_bench_nim/blob/master/src/seq2d.nim |
18:48:22 | FromDiscord | <Mango IV.> well, of course that's one way to do it, but I feel like that would be severely less expressive. |
18:48:58 | nrds | <Prestige99> not really because you can do something like mySeq[x, y] = 5 |
18:50:15 | FromDiscord | <Mango IV.> Ok, I just looked a the code. I'm still very new and it confuses me that this language has so many possibilities to just write missing parts of the language yourself :D ↵Is there a standard lib that has this? |
18:50:17 | FromDiscord | <qb> Why is the inner sequence immutable? |
18:50:46 | FromDiscord | <Mango IV.> sent a code paste, see https://play.nim-lang.org/#ix=3Jh2 |
18:52:25 | FromDiscord | <qb> Guess your issue is somewhere else: https://play.nim-lang.org/#ix=3Jh3 |
18:52:29 | FromDiscord | <qb> But im a newbie aswell 😛 |
18:53:34 | FromDiscord | <enthus1ast> If there is no library available yet (which I don't know) you could always call out to a terminal application like mupdf/mutools↵(@lkioi) |
18:53:58 | FromDiscord | <Mango IV.> In reply to @qb "But im a newbie": that's not about the mutability of the data structure but of the immutability of the elements of the datastructure. |
18:54:57 | FromDiscord | <Solitude> In reply to @Mango IV. "that's not about the": show code |
18:55:13 | FromDiscord | <Mango IV.> sent a code paste, see https://play.nim-lang.org/#ix=3Jh5 |
18:55:17 | FromDiscord | <Mango IV.> It's probably my mistake then. |
18:55:21 | nrds | <Prestige99> I think qb's example made sense - he was able to modify an inner value |
18:56:10 | nrds | <Prestige99> I wonder if I should submit this Seq2D thing to be part of the stdlib |
18:58:02 | FromDiscord | <Mango IV.> sent a code paste, see https://play.nim-lang.org/#ix=3Jh6 |
18:58:19 | FromDiscord | <Mango IV.> (edit) "https://play.nim-lang.org/#ix=3Jh6" => "https://play.nim-lang.org/#ix=3Jh7" |
18:59:29 | FromDiscord | <Solitude> ` for basin in areas:`↵basin is immutable |
18:59:39 | FromDiscord | <Solitude> use mitems |
19:00:03 | FromDiscord | <Smarc> Does nobody have a clue for my issue? Or should I provide any more informations? |
19:02:08 | FromDiscord | <Mango IV.> In reply to @Solitude "use mitems": worked beautifully, thanks. What is the motivation behind making those immutable by default? |
19:12:43 | FromDiscord | <Solitude> for easier tracking of mutations? |
19:17:11 | * | xet7 quit (Ping timeout: 250 seconds) |
19:29:55 | * | xet7 joined #nim |
19:38:40 | * | xiamx[m] joined #nim |
19:39:01 | FromDiscord | <Rosen> It's nice to be certain that you're not mutating what you're looking over if you don't specifically ask for mutation |
19:59:15 | xiamx[m] | I might be still missing the answer after some google searches, can nim do static analysis to suggest replacing var with let when it knows the value doesn't change? |
20:14:45 | NimEventer | New post on r/nim by geckosarecool: Here's my interpreter, compiler and transpiler of brainfuck! Supports 3 languages and 8 targets, see https://reddit.com/r/nim/comments/rn48zf/heres_my_interpreter_compiler_and_transpiler_of/ |
20:22:05 | FromDiscord | <Smarc> I'll start a last try to get maybe at least a hint for my problem, so I'll link the reddit post. I really would appreciate some insights. I can provide more info if neede of course :/↵https://www.reddit.com/r/nim/comments/rn20pp/chess_logic_issue/ |
20:27:22 | FromDiscord | <Yardanico> did you post on the forum? that's the first place you need to post in if you want help with some bigger project |
20:27:32 | FromDiscord | <Yardanico> https://forum.nim-lang.org/ |
20:30:06 | FromDiscord | <Smarc> Gonna post it there as well, thank you! |
20:31:48 | NimEventer | New thread by Smarc: Chess logic issue, see https://forum.nim-lang.org/t/8730 |
20:35:06 | FromDiscord | <Yardanico> In reply to @Smarc "I'll start a last": ill check it out |
20:35:11 | FromDiscord | <Yardanico> try to see if there's anything obvious |
20:37:33 | FromDiscord | <Smarc> Appreciate that a lot! I'm sure it is quiet obvious for someone who is more skilled than me |
20:38:03 | FromDiscord | <Smarc> Actually the 'isChecked' proc seems to not work properly |
20:39:32 | FromDiscord | <Smarc> I just can't wrap my head around how to do it correctly |
20:56:51 | FromDiscord | <Yardanico> @Smarc do your coordinates go from 0,0 to 7,7 ? |
20:57:03 | FromDiscord | <Yardanico> i mean xPos and yPos |
20:57:24 | FromDiscord | <Smarc> yes |
20:57:34 | FromDiscord | <Smarc> [0][0] = a8 |
20:57:40 | FromDiscord | <Yardanico> but then why do you check < 7 in your `while` on line 87 |
20:57:43 | FromDiscord | <Yardanico> shouldn't it be < 8 ? |
20:57:57 | FromDiscord | <Yardanico> since if you do < 7 you discard all results where some coordinate is 7 |
20:57:59 | FromDiscord | <Yardanico> either x or y |
20:58:26 | FromDiscord | <Yardanico> ` while (currX > 0 and currX < 7) and (currY > 0 and currY < 7):` shouldn't it be `currX <= 7` or `currX < 8` and same for y? |
20:59:36 | FromDiscord | <Yardanico> i made the change but then other tests started failing for some reason |
20:59:39 | FromDiscord | <Yardanico> and this one too |
20:59:54 | FromDiscord | <Smarc> ye, other tests are failing including the one that was before :/ |
20:59:57 | FromDiscord | <Smarc> I just don't get it |
21:00:03 | FromDiscord | <Smarc> But the error has to be in this proc |
21:00:04 | FromDiscord | <Yardanico> yes, but maybe you were checking coords the wrong way before :D |
21:00:06 | * | vicfred joined #nim |
21:00:43 | FromDiscord | <Smarc> maybe the while condition is wrong? |
21:01:13 | FromDiscord | <Yardanico> well it runs the body while _both_ cords are in bounds |
21:01:22 | FromDiscord | <Yardanico> when one of the coords gets outs of the bounds it doesn't iterate any more |
21:02:00 | FromDiscord | <Smarc> Ye I thought about that, but had no clue how to fix that |
21:02:37 | FromDiscord | <Smarc> if I just change the `and` for `or` it goes OutOfBounds |
21:03:08 | FromDiscord | <Yardanico> yes, but I didn't say that your way of checking is wrong |
21:03:14 | FromDiscord | <Yardanico> I just explained what the `while` does |
21:06:27 | FromDiscord | <Yardanico> In reply to @Smarc "if I just change": wait, I'm not sure if I'm right but maybe I am |
21:06:44 | FromDiscord | <Yardanico> it seems like you don't check if the enemy piece is obstructed by another enemy piece? |
21:06:51 | FromDiscord | <Yardanico> in isChecked |
21:07:13 | FromDiscord | <Yardanico> you only check for "If a friendly piece is blocking sight, stop looking in that direction" so if an enemy queen is obstructed by enemy pawn your algo still returns true |
21:07:20 | FromDiscord | <Yardanico> that's why tests started failing after I fixed the while condition |
21:08:45 | FromDiscord | <Smarc> Yes, the proc is far from ready, right now I only wanted to check for Rook or Queen standing right beneath the king |
21:08:51 | FromDiscord | <Smarc> with dist=1 |
21:09:14 | FromDiscord | <Yardanico> well idk, I'm just sharing what I found |
21:09:23 | FromDiscord | <Yardanico> "black king all directions without captures" is the first failing test with fixed while condition |
21:11:49 | FromDiscord | <Smarc> If I comment out most of the move instructions it is green actually |
21:11:52 | FromDiscord | <Smarc> I don't get it |
21:12:05 | FromDiscord | <Yardanico> In reply to @Smarc "If I comment out": because your `move` calls `isChecked` |
21:12:25 | FromDiscord | <Yardanico> and before the while fix you simply ignored the last coordinate |
21:12:33 | FromDiscord | <Smarc> L329 is the one that lets it fail |
21:12:51 | FromDiscord | <Yardanico> yes, but as I said, that's because your `move` calls `isChecked` |
21:13:08 | FromDiscord | <Yardanico> and your algo returns `true` if a king is "checked" by a queen obstructed by a pawn |
21:13:49 | FromDiscord | <Smarc> oh so you mean the king is checked over the whole board because its on the same file as the queen, although a pawn is in the way? Do I get that right? |
21:13:53 | FromDiscord | <Yardanico> yes |
21:14:02 | FromDiscord | <Yardanico> because you don't check if an enemy piece is obstructed by another enemy piece |
21:14:06 | FromDiscord | <Yardanico> you only do that check for friendly pieces |
21:14:12 | FromDiscord | <Smarc> Ahh |
21:14:20 | FromDiscord | <Smarc> Lets see if I can fix that somehow |
21:15:18 | FromDiscord | <Smarc> Hm, how would I do that without actually crashing the isChecked? If I just check the color it would not recognize any check i guess |
21:21:53 | FromDiscord | <Smarc> ` if (currPiece.color != this.color) and not(currPiece of Rook) and↵ not(currPiece of Queen):↵ break↵` |
21:21:56 | FromDiscord | <Smarc> Seems to do the trick |
21:22:19 | FromDiscord | <Smarc> Remember right now it is just for checking Rook/Queen checks |
21:22:31 | FromDiscord | <Smarc> But still the last test is failing |
21:22:42 | FromDiscord | <Smarc> although I fixed the while |
21:26:56 | * | xet7 quit (Ping timeout: 252 seconds) |
21:27:43 | FromDiscord | <Smarc> I'm so confused :/ |
21:30:48 | FromDiscord | <Smarc> Now it does not even recognize a check where an enemy rook is on the same file as the enemy king without any piece in the way .. |
21:35:49 | FromDiscord | <TryAngle> what is more idiomatic?↵assert or if + raise Exception |
21:37:51 | FromDiscord | <Solitude> assertions throw AssertionDefect. if it fits your case then use it. |
21:39:35 | * | xiamx[m]1 joined #nim |
21:40:43 | * | xet7 joined #nim |
21:41:05 | FromDiscord | <demotomohiro> Use assert for expressions that always true as long as your program doesn't have a bug. |
21:42:39 | FromDiscord | <evoalg> In reply to @xiamx "I might be still": From what I'm lead to believe (and I don't know much), although the compiler can do many optimizations behind the scenes, there is no difference between `var` and `let` (when there are no attempts to assign to mutate a `let` variable) as they are for the programmer (to catch unintended assignments) rather than for compiler optimization ... in a working program you can replace all the `let`'s with ` |
21:42:59 | FromDiscord | <demotomohiro> if + raise for checking runtime error even if you your program doesn't have bug. |
21:46:11 | xiamx[m]1 | FromDiscord: Yeh I understand that I can replace these on my own. Though just wondering if there are programs that help me ident these. |
21:46:42 | FromDiscord | <evoalg> In reply to @xiamx "FromDiscord: Yeh I understand": ahh sorry I misread ... yea that would be nice |
21:49:03 | FromDiscord | <evoalg> and func's instead of proc's ... but only as an option that's not on by default |
21:50:49 | * | noeontheend joined #nim |
22:29:37 | * | noeontheend quit (Ping timeout: 240 seconds) |
22:31:40 | FromDiscord | <TryAngle> @ElegantBeef wait remember when I asked how to impl something only for N == 1 and the rest for N > 1 ? |
22:31:57 | FromDiscord | <TryAngle> can't I just define a type that goes from 2 to high(int) |
22:31:58 | FromDiscord | <TryAngle> ? |
22:34:20 | * | PMunch joined #nim |
22:34:26 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JhX |
22:36:12 | FromDiscord | <Elegantbeef> I suppose you could |
22:42:26 | * | PMunch quit (Quit: Leaving) |
22:44:14 | * | audiophile_ joined #nim |
22:48:30 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JhY |
22:48:43 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3JhY" => "https://play.nim-lang.org/#ix=3JhZ" |
22:49:34 | FromDiscord | <Elegantbeef> You can do `proc doThing(a: AVector or SVector): auto` |
22:49:53 | FromDiscord | <Elegantbeef> Though if you use the type information you need to do `a.type.T` or `a.type.N` |
22:51:03 | FromDiscord | <TryAngle> In reply to @Elegantbeef "You can do `proc": doesnt' it require the N: static[int]? |
22:51:27 | FromDiscord | <Elegantbeef> No those are composite type classes iirc |
22:51:39 | FromDiscord | <Elegantbeef> Nim allows generics to drop `[]` and will infer it |
22:52:12 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Ji0 |
22:52:27 | FromDiscord | <TryAngle> or even leave out the T also? |
22:52:30 | FromDiscord | <Elegantbeef> Not what i meant you need `N` for sVector |
22:52:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ji1 |
22:53:14 | FromDiscord | <TryAngle> ah I see |
22:53:40 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Ji2 |
22:53:46 | FromDiscord | <Elegantbeef> Yes it should |
22:53:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ji3 |
22:53:53 | FromDiscord | <TryAngle> ok I'll try thanks |
22:54:04 | FromDiscord | <Elegantbeef> That's a typeclass of composite type classes |
22:54:52 | FromDiscord | <Elegantbeef> Composite typeclasses are very useful when you dont need the type parameters or if they have the same API |
22:55:04 | FromDiscord | <TryAngle> ah wait I just noticed lol↵I can't do that anyways because I need to initialize the seq for AVector anyaywas... |
22:55:29 | FromDiscord | <Elegantbeef> I dont follow |
22:57:50 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Ji5 |
22:58:22 | FromDiscord | <TryAngle> while with `SVector`, I can directly edit the result because the length is known at compile time |
22:58:27 | FromDiscord | <Elegantbeef> I dont see how that's an issue, you can do per type logic like i showed above |
22:58:53 | FromDiscord | <Elegantbeef> But if everything is different there is no reason to make them all in a single proc |
22:58:55 | FromDiscord | <TryAngle> In reply to @Elegantbeef "I dont see how": of course but that's essentially still two impls of the same thing in my case |
22:59:04 | FromDiscord | <TryAngle> t_t |
22:59:27 | FromDiscord | <Elegantbeef> Yea if the entire logic has 0 overlap then two overloaded procs is best |
22:59:37 | FromDiscord | <Elegantbeef> Otherwise use type conditional logic |
23:00:35 | FromDiscord | <TryAngle> if there only was a way to infer size of a seq at compile time 🤔 ↵does that even make sense, from a compiler perspective? |
23:10:40 | * | xet7 quit (Ping timeout: 268 seconds) |
23:17:18 | FromDiscord | <Elegantbeef> One could technically figure out if a seq depends on runtime information and if not replace it with an array |
23:18:01 | FromDiscord | <Elegantbeef> But that requires a ton of fun logic and reasoning |
23:22:19 | * | xet7 joined #nim |
23:27:07 | FromDiscord | <kaddkaka> God Jul! 🙂 New nimmer here 👋 ↵How do I iterate over an array in reverse order? |
23:28:12 | FromDiscord | <Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L42-L50 there is no built in way but you can easily make an iterator or use a package that provides it |
23:31:16 | FromDiscord | <kaddkaka> In reply to @Elegantbeef "https://github.com/beef331/slicerator/blob/master/s": Is that a package that is packaged with nim, or more of an example? |
23:31:53 | FromDiscord | <Elegantbeef> It's a package on git you can use if you want, but you can always just copy my code and paste it |
23:32:15 | FromDiscord | <Elegantbeef> I'm not going to hunt down people that dont abide by the MIT license in a small regard 😀 |
23:34:18 | FromDiscord | <Elegantbeef> If you were to want to use it since it's not in nimble you'd `nimble install https://github.com/beef331/slicerator` then `import slicerator`, though i think there are nimble packages that do it |
23:35:38 | FromDiscord | <Leonardo da Vinci> Random question |
23:35:54 | FromDiscord | <Leonardo da Vinci> can i use OpenGL or SDL2 with Nim? |
23:36:16 | FromDiscord | <demotomohiro> Yes |
23:36:52 | FromDiscord | <Elegantbeef> It's a system language if you could'nt we'd be in big trouble |
23:38:15 | FromDiscord | <demotomohiro> https://nimble.directory/↵Search opengl or sdl |
23:38:35 | FromDiscord | <Leonardo da Vinci> Thanks bro! |
23:39:27 | FromDiscord | <demotomohiro> There are 3 or more OpenGL bindings for Nim. |
23:41:00 | FromDiscord | <kaddkaka> In reply to @Elegantbeef "It's a package on": thanks! 🙂 btw, are you a bot? o.O |
23:41:12 | FromDiscord | <Elegantbeef> I'm using the matrix bridge |
23:41:22 | FromDiscord | <Elegantbeef> So i'm just infinitely cooler |
23:41:44 | FromDiscord | <Elegantbeef> Atleast that's what my mom tells me |
23:43:40 | FromDiscord | <kaddkaka> 👍 |
23:46:53 | FromDiscord | <retkid> is uh, arrayMancer... useable? |
23:47:02 | FromDiscord | <retkid> or should i continue to try and use math to optimize this problem |
23:47:09 | FromDiscord | <Elegantbeef> Nah mratsim wrote it just cause he was having a gigle |
23:47:22 | FromDiscord | <Elegantbeef> Spent all that time making code that doesnt do anything |
23:47:40 | FromDiscord | <retkid> it was a funny shitpost, not real AI |
23:48:05 | FromDiscord | <retkid> but seriously, I know nothing about that world |
23:48:34 | FromDiscord | <Elegantbeef> Have you checked out scinim's stuff |
23:49:30 | FromDiscord | <retkid> it all looks very useful but I dont use because I dont wanna learn new things, but then spend large amount of times writing my own functions which are less effective |
23:49:47 | FromDiscord | <Elegantbeef> Well i dont know what to say |
23:50:24 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Jib |
23:50:27 | FromDiscord | <retkid> i've been staring at this example for a while |
23:50:30 | FromDiscord | <retkid> still haven |
23:51:11 | FromDiscord | <retkid> im gonna continue to try and find patterns in this data, this looks like last resort stuff to me |
23:51:43 | FromDiscord | <retkid> I wish there was a way to make collapsible messages in discord, so people wouldn't see that giant wall |
23:52:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jic |
23:52:46 | FromDiscord | <Elegantbeef> Jokes cause he finds the tuple unpacking more unreadable for declaration |
23:53:25 | FromDiscord | <retkid> In reply to @Elegantbeef "*Jokes cause he finds": See, im afraid to post my code here because of this. I fear people being inside of my mind-brain |
23:53:40 | FromDiscord | <Elegantbeef> Oh noes someone might make a joke |
23:53:46 | FromDiscord | <Elegantbeef> Most of my code is OSS so go shit on it |
23:54:04 | FromDiscord | <retkid> well, its less of shitting on it |
23:54:19 | FromDiscord | <retkid> its more that "this bitch doesn't like this, they like this |
23:54:20 | FromDiscord | <retkid> (edit) "this" => "this"" |
23:54:25 | FromDiscord | <retkid> its like your in my mindddd" |
23:54:26 | FromDiscord | <retkid> (edit) "mindddd"" => "mindddd\" |
23:54:28 | FromDiscord | <retkid> (edit) "mindddd\" => "minddd" |
23:54:32 | FromDiscord | <Rika> We all are |
23:54:34 | FromDiscord | <Elegantbeef> Oh noes |
23:54:40 | FromDiscord | <Elegantbeef> We dont actually exist |
23:54:49 | FromDiscord | <retkid> get out of there |
23:54:57 | FromDiscord | <retkid> GO AWAY NIM DEMONS |
23:54:58 | FromDiscord | <Rika> Nah it’s comfy and warm here |
23:55:10 | FromDiscord | <Elegantbeef> Pretty empty though |
23:55:29 | FromDiscord | <retkid> its probably pretty crampt |
23:55:45 | FromDiscord | <Rika> Only because it’s so smooth |
23:56:36 | FromDiscord | <Leonardo da Vinci> Can i use nim with geany? |
23:56:38 | FromDiscord | <Rika> I think I killed him |
23:57:00 | FromDiscord | <Rika> In reply to @Leonardo da Vinci "Can i use nim": What’s stopping you? I don’t know what Geany is exactly other than it’s for Java I think |
23:57:22 | FromDiscord | <retkid> In reply to @Rika "I think I killed": her |
23:57:41 | FromDiscord | <Leonardo da Vinci> In reply to @Rika "What’s stopping you? I": I use geany for everything |
23:58:03 | FromDiscord | <Rika> Then why do you think you can’t use Nim in there 😛 |
23:58:13 | FromDiscord | <retkid> geany has weird nim stuff |
23:58:17 | FromDiscord | <retkid> but i think you can |
23:58:45 | FromDiscord | <Elegantbeef> It has Nim support |
23:58:48 | FromDiscord | <Elegantbeef> It's a shitty editor imo though |
23:58:58 | FromDiscord | <Elegantbeef> Though that's neither here nor there |
23:59:17 | FromDiscord | <Leonardo da Vinci> In reply to @Rika "Then why do you": Idk if i can set up the compiler and linker commands for num |
23:59:45 | FromDiscord | <Elegantbeef> I mean is `nim c ./myfile.nim` really that hard? |