00:00:04 | * | syl quit (*.net *.split) |
00:00:04 | * | sagax quit (*.net *.split) |
00:00:04 | * | averell quit (*.net *.split) |
00:00:05 | * | GreaseMonkey quit (*.net *.split) |
00:00:05 | * | gsalazar quit (*.net *.split) |
00:00:05 | * | matt_13377 quit (*.net *.split) |
00:00:23 | * | matt_13377 joined #nim |
00:00:27 | * | gsalazar joined #nim |
00:00:30 | FromDiscord | <retkid> whats the function to convert a hex into to a hex char |
00:00:40 | FromDiscord | <retkid> eg procy(20) == " |
00:00:42 | FromDiscord | <retkid> (edit) """ => """" |
00:00:42 | FromDiscord | <retkid> (edit) """" => "" "" |
00:01:12 | * | greaser|q joined #nim |
00:01:25 | FromDiscord | <retkid> might be toHex |
00:01:26 | * | averell joined #nim |
00:01:33 | * | averell quit (Changing host) |
00:01:33 | * | averell joined #nim |
00:01:46 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/992580810005819472/unknown.png |
00:01:47 | FromDiscord | <retkid> no |
00:02:25 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/strutils.html#toHex%2CT |
00:02:51 | FromDiscord | <j-james> `char(0x20)`? |
00:03:30 | FromDiscord | <demotomohiro> !eval echo char(0x20) |
00:03:34 | NimBot | |
00:03:48 | FromDiscord | <retkid> its base 10 ints |
00:04:15 | FromDiscord | <retkid> i got it i think |
00:04:25 | * | syl joined #nim |
00:04:41 | FromDiscord | <retkid> hmm |
00:05:15 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#lexical-analysis-numeric-literals |
00:07:03 | FromDiscord | <retkid> parseHexStr(toHex(42)) |
00:12:06 | FromDiscord | <j-james> In reply to @j-james "i think the problem": turns out this does actually cause a problem - as `result != return T` |
00:13:04 | FromDiscord | <j-james> so i've got a bunch of useless structures as the layouts' parents instead of a pointer to the returned type |
01:21:52 | * | CyberTailor joined #nim |
02:46:28 | FromDiscord | <valerga> does breaking inside a block, which is inside a for, not break the for? |
02:47:15 | FromDiscord | <j-james> it should not |
02:47:57 | FromDiscord | <valerga> so it breaks what, the block? |
02:48:11 | FromDiscord | <j-james> yeah |
02:48:14 | FromDiscord | <valerga> using continue works as expected though so idk |
02:48:30 | FromDiscord | <j-james> if you want to break out of both the block and the for loop, you can use a named block |
02:48:38 | FromDiscord | <valerga> that's what i do yeah |
02:50:19 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=41p0 |
02:50:50 | FromDiscord | <valerga> so inside the block, "break", and "continue", do the same? |
02:50:50 | * | CyberTailor quit (Remote host closed the connection) |
02:51:25 | FromDiscord | <valerga> without using the name |
02:52:00 | FromDiscord | <j-james> break and continue should refer to the current scope |
02:52:18 | FromDiscord | <valerga> ok yeah. i mean on outer scrope |
02:52:20 | FromDiscord | <valerga> (edit) "scrope" => "scope" |
02:52:25 | FromDiscord | <valerga> inside the block |
02:53:46 | FromDiscord | <j-james> oh inside `block name` but outside the for loop and the second block? |
02:53:49 | FromDiscord | <j-james> yes |
02:54:34 | * | CyberTailor joined #nim |
02:56:30 | FromDiscord | <j-james> yeah you don't _need_ to name named blocks in break statements |
03:02:05 | FromDiscord | <j-james> In reply to @valerga "using continue works as": oh yeah - continue statements aren't effected by blocks |
03:02:22 | FromDiscord | <j-james> /s/effected/affected |
03:02:45 | FromDiscord | <j-james> (edit) "effected" => "affected" |
03:03:09 | FromDiscord | <j-james> they'll just immediately skip to the next iteration |
03:08:23 | FromDiscord | <Elegantbeef> Continue is only effected by continuable control |
03:08:26 | FromDiscord | <Elegantbeef> So `for` and `while` |
03:10:36 | FromDiscord | <!Patitotective> hey guys i was thinking on making a twitter bot that retweets & likes any tweet with the #nimlang hashtag or containing "nimlang"↵how else do you guys think i should filter the tweets? i was thinking of only in english and maybe exclude tweets including the word malware lol |
03:11:00 | FromDiscord | <Elegantbeef> This is indeed a society |
03:11:46 | FromDiscord | <Prestige> I hate twitter |
03:12:12 | FromDiscord | <Elegantbeef> Well we're not answering their question with our critique 😛 |
03:12:36 | FromDiscord | <Elegantbeef> Sounds fine to filter the way you're doign |
03:12:59 | FromDiscord | <Prestige> I think he should filter out all the tweets, then work on literally anything else |
03:13:25 | FromDiscord | <!Patitotective> :[ |
03:13:46 | FromDiscord | <Elegantbeef> Though this gives me an idea a social media platform where traffic is done by bots but content is human generated |
03:13:48 | FromDiscord | <Elegantbeef> We can call it insert your least favourite social media platform here |
03:14:19 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Though this gives me": that sounds like youtube but well made |
03:14:46 | madprops | wondering if any of you have as an example of a simple nim program published in the arch's aur ? |
03:15:04 | FromDiscord | <Elegantbeef> Is nimdow there? |
03:15:06 | FromDiscord | <Elegantbeef> I dont recall |
03:15:22 | madprops | https://archlinux.org/packages |
03:15:27 | madprops | oh wait |
03:15:36 | madprops | https://aur.archlinux.org/packages |
03:16:11 | madprops | it should depend on the nim compiler. then just fetch from github, and compile |
03:16:18 | madprops | im looking for an example pkgbuild |
03:16:25 | FromDiscord | <Elegantbeef> There you go now hit prestige to give you answers |
03:16:30 | FromDiscord | <Prestige> Yes nimdow-bin is in the aur |
03:16:48 | FromDiscord | <Prestige> I just have it upload the pre-compiled binary though |
03:17:04 | FromDiscord | <Elegantbeef> Not very archy |
03:17:06 | FromDiscord | <Prestige> Cuz I couldn't figure out how to pull in Nim so I could compile nimdow |
03:17:28 | FromDiscord | <Prestige> Cuz nim was super outdated and we couldn't pull down choosenim etc |
03:17:42 | FromDiscord | <Elegantbeef> Well it's modern now iirc |
03:17:54 | FromDiscord | <ripluke> In reply to @Elegantbeef "Not very archy": What does that mean |
03:18:09 | FromDiscord | <Elegantbeef> Does what i say ever really have meaning |
03:18:31 | FromDiscord | <!Patitotective> ive already said this, hes high |
03:18:47 | FromDiscord | <ripluke> In reply to @Avahe "Cuz I couldn't figure": It's 1.4.8 |
03:18:53 | FromDiscord | <Prestige> @ripluke do you have any PKGBUILD experience? |
03:18:59 | FromDiscord | <ripluke> Yes lol |
03:19:07 | FromDiscord | <Elegantbeef> I'm never high, i thought that arch had a reputation for easily enabling compilation from source |
03:19:07 | FromDiscord | <ripluke> I literally only package for arch |
03:19:20 | FromDiscord | <Prestige> nim is 1.6.6 in community/nim |
03:19:26 | FromDiscord | <Prestige> So you should be good |
03:19:46 | FromDiscord | <ripluke> They updated it then |
03:20:11 | FromDiscord | <Prestige> yeah pretty recently |
03:21:10 | FromDiscord | <Prestige> oh it was madprops that was asking, mb |
03:21:37 | madprops | yeah im reading the guidelines |
03:21:40 | madprops | don't want to mess up |
03:21:45 | FromDiscord | <Prestige> https://wiki.archlinux.org/title/Creating_packages#PKGBUILD_functions |
03:21:59 | FromDiscord | <Prestige> and check out other PKGBUILDs with build steps |
03:22:17 | FromDiscord | <ripluke> Funny thing I actually figured out how to write pkgbuilds from reading the nimdow pkgbuild |
03:23:27 | FromDiscord | <Prestige> Heh, that's cool |
03:23:35 | FromDiscord | <ripluke> Lol yea |
03:25:31 | FromDiscord | <Prestige> If I land this new job, I'll have to start using Ubuntu for work. So I'll likely be packaging it for Ubuntu then |
03:25:43 | FromDiscord | <ripluke> Oh |
03:25:56 | FromDiscord | <Elegantbeef> Sorry for your loss 😄 |
03:25:58 | FromDiscord | <Elegantbeef> snapd WM when? |
03:26:05 | FromDiscord | <ripluke> Lol I have to write a pkgbuild now for an aur now |
03:26:15 | FromDiscord | <ripluke> In reply to @Elegantbeef "snapd WM when?": 😳😳 |
03:26:28 | FromDiscord | <ripluke> I'd use it 💀 |
03:26:38 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Sorry for your loss": 😄 |
03:26:46 | FromDiscord | <ripluke> (edit) "use" => "~~use~~ try" |
03:30:13 | FromDiscord | <Prestige> In reply to @Elegantbeef "Sorry for your loss": Yeah, at least it's Linux though |
03:30:42 | FromDiscord | <Prestige> If it's not managed like crazy I could transform it into whatever I'd like |
03:31:10 | FromDiscord | <Elegantbeef> at that point just use debian and play it off 😛 |
03:34:01 | FromDiscord | <Prestige> Eh has to be some specific ubuntu lts version unfortunately |
03:36:21 | madprops | ripluke you have an example of a pkgbuild that pulls from github and compiles with the nim compiler? |
03:37:10 | madprops | this is a simple program though, doesn't even have 3rd party libs |
03:37:22 | madprops | only depends on the compiler |
03:37:54 | FromDiscord | <ripluke> Yup |
03:38:05 | FromDiscord | <ripluke> Give me a sec |
03:40:11 | FromDiscord | <ripluke> sent a code paste, see https://play.nim-lang.org/#ix=41p4 |
03:40:57 | FromDiscord | <Prestige> I thought you're not supposed to use sudo for install here |
03:41:14 | FromDiscord | <ripluke> idk it didnt work without it |
03:41:25 | madprops | are you installing to /usr/local/bin? |
03:41:25 | FromDiscord | <ripluke> so i just put it there |
03:41:29 | FromDiscord | <ripluke> yea |
03:41:30 | FromDiscord | <Prestige> Gotta do like `install -D "nimdow-$pkgver" "$pkgdir/usr/bin/nimdow"` |
03:41:33 | madprops | "Packages should never be installed to /usr/local/" |
03:41:36 | madprops | from the docs ^ |
03:41:40 | FromDiscord | <j-james> hey, we've got an aur helper written in nim |
03:41:41 | FromDiscord | <ripluke> oh |
03:41:42 | FromDiscord | <j-james> https://aur.archlinux.org/packages/pakku |
03:41:59 | FromDiscord | <ripluke> In reply to @j-james "hey, we've got an": lol im actually working on one |
03:42:14 | FromDiscord | <ripluke> In reply to @madprops ""Packages should never be": yea this was my first pkg |
03:42:27 | FromDiscord | <ripluke> it gets the job done tho |
03:44:48 | FromDiscord | <!Patitotective> also guys, what do you think is the best way to host the twitter bot? running it with a cron task locally? heroku? |
03:47:09 | FromDiscord | <ripluke> Nvim is fun |
03:47:14 | FromDiscord | <ripluke> Super fun |
03:47:19 | FromDiscord | <Prestige> I love neovim |
03:47:31 | FromDiscord | <ripluke> Yea but it has quirks |
03:47:33 | FromDiscord | <Prestige> In reply to @Patitotective "also guys, what do": How do you want it to run, periodically? |
03:47:47 | * | noeontheend joined #nim |
03:47:51 | FromDiscord | <!Patitotective> yea |
03:47:57 | FromDiscord | <ripluke> In reply to @ripluke "Yea but it has": Like pasting with "p" always puts it in the wrong spot |
03:48:11 | FromDiscord | <Prestige> Huh? It works perfectly for me |
03:48:48 | FromDiscord | <ripluke> Idk sometimes when I want to paste something inside a string, it puts it outside of the quotes |
03:49:00 | FromDiscord | <!Patitotective> In reply to @Patitotective "also guys, what do": actually github actions might work :o |
03:49:08 | FromDiscord | <ripluke> In reply to @Patitotective "actually github actions might": Ya |
03:49:16 | FromDiscord | <Prestige> Depends if you yanked a newline at the end, or if your cursor is inside the quotes |
03:49:24 | FromDiscord | <Prestige> but it works consistently and how it's intended to work |
03:50:00 | FromDiscord | <ripluke> In reply to @Avahe "Depends if you yanked": Yea but with shift+v then yanking it does that |
03:50:24 | FromDiscord | <Prestige> That yanks the newline at the end of the line |
03:50:36 | FromDiscord | <Prestige> and `p` pastes _after_ the current character |
03:51:08 | FromDiscord | <Prestige> maybe you want `yg_` then you can `p` |
03:51:32 | FromDiscord | <Prestige> or `0yg_` |
03:51:48 | FromDiscord | <ripluke> In reply to @Avahe "maybe you want `yg_`": I'll try that |
04:01:36 | FromDiscord | <Rika> Shift P? |
04:03:12 | madprops | should i make the arch x86_64 or any for the pkgbuild if nim is compiling it? |
04:07:31 | madprops | im guessing nim can compile to anything |
04:10:39 | FromDiscord | <Prestige> In reply to @Rika "Shift P?": That'd put it on the previous line if he's yanked a whole line |
04:25:50 | FromDiscord | <!Patitotective> does nim have a URL query parser? |
04:31:05 | * | arkurious quit (Quit: Leaving) |
04:32:15 | FromDiscord | <j-james> url queries? |
04:33:08 | FromDiscord | <!Patitotective> `https://github.com/search?q=parser&l=nim`↵the `?key=val&otherkey=otherval` |
04:33:19 | FromDiscord | <Elegantbeef> `std/uri` |
04:33:30 | FromDiscord | <j-james> anything that implements uri parsing should do that |
04:33:33 | FromDiscord | <j-james> https://github.com/treeform/urlly is another one |
04:34:50 | * | noeontheend quit (Ping timeout: 260 seconds) |
04:35:10 | FromDiscord | <!Patitotective> :] |
04:39:54 | * | noeontheend joined #nim |
04:42:26 | FromDiscord | <Prestige> `This library has no dependencies other than the Nim standard library.` |
04:42:28 | FromDiscord | <Prestige> Music to my ears |
04:51:08 | FromDiscord | <huantian> But you do realize that if you use it your library now has an extra rep |
04:52:39 | FromDiscord | <Elegantbeef> Rep or dep?! |
04:53:03 | FromDiscord | <huantian> Dep lmao |
04:55:02 | * | noeontheend quit (Ping timeout: 260 seconds) |
04:58:45 | FromDiscord | <Prestige> In reply to @huantian "But you do realize": 🤔 |
05:09:44 | FromDiscord | <j-james> got that treeform rep |
05:22:09 | * | CyberTailor quit (Remote host closed the connection) |
05:22:52 | * | CyberTailor joined #nim |
05:28:37 | * | rb quit (Quit: ZNC - https://znc.in) |
05:34:14 | * | rwb joined #nim |
05:44:02 | madprops | uploaded the package if anybody wants to try it ! |
05:44:03 | madprops | https://aur.archlinux.org/packages/goldie-git |
06:06:13 | FromDiscord | <Prestige> Is that like ripgrep? |
06:06:43 | madprops | haven't used that. i used ag before, but it sometimes just wouldn't work. so i wrote my own thing |
06:06:56 | madprops | and it's surprisingly fast |
06:50:02 | FromDiscord | <d4rckh> any cool library for generating text tables? |
06:51:30 | FromDiscord | <Elegantbeef> As a TUI? |
06:53:28 | FromDiscord | <d4rckh> yes |
06:54:00 | FromDiscord | <Elegantbeef> https://github.com/xmonader/nim-terminaltables |
06:55:20 | FromDiscord | <d4rckh> thanks, looks pretty |
07:31:24 | * | rockcavera quit (Remote host closed the connection) |
07:41:07 | * | greaser|q quit (Changing host) |
07:41:07 | * | greaser|q joined #nim |
07:41:10 | * | greaser|q is now known as GreaseMonkey |
07:51:49 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
07:54:38 | * | wallabra joined #nim |
08:14:10 | FromDiscord | <Casato> Hello, can anyone show me an example of downloading file (yes downloading) via puppy library? |
08:14:43 | FromDiscord | <ezquerra> Why not use httpclient? |
08:15:08 | FromDiscord | <Casato> I woud like to stick with native libraries |
08:15:39 | FromDiscord | <ezquerra> Not sure what you mean. httpclient is in the standard library |
08:17:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41pB |
08:17:33 | FromDiscord | <Casato> sent a code paste, see https://play.nim-lang.org/#ix=41pC |
09:04:13 | * | Network2501 quit (Read error: Connection reset by peer) |
09:49:25 | madprops | what's faster than strutils.contains ? |
09:51:25 | FromDiscord | <Rika> What’s your exact use case, there might be a better way than naive string operations |
09:51:37 | madprops | i want to check if a substring exists in a line of text |
09:51:52 | madprops | in a case insensitive manner. currently i toLower it |
09:52:10 | madprops | but that the bottleneck is at contains |
09:53:42 | madprops | im gonna try re.contains |
09:54:17 | FromDiscord | <Rika> Regex is possibly slower |
09:54:34 | FromDiscord | <Rika> Might not be depending on optimisations but it’s prolly going to be slower |
09:57:11 | madprops | hmm how can i build this |
09:57:14 | madprops | let regexp = re(&"/{q}/") |
09:57:21 | madprops | trying to use the variable (q) |
10:00:47 | madprops | re(q) works in my case |
10:01:12 | madprops | but speed is basically the same |
10:01:57 | madprops | im trying to beat "ag" in speed but something funny happens |
10:02:05 | madprops | it alternates between 6ms and 16ms in time |
10:02:12 | madprops | it's not consistent (ag) |
10:02:28 | madprops | my implementation is at around 14ms but consistent |
10:04:49 | madprops | but ag is still faster overall when i try whole directories |
10:05:09 | madprops | it probably cheats in some way |
10:11:27 | madprops | ah interesting. like 10ms from the 16ms are spent making it toLower |
10:23:47 | FromDiscord | <phargob> alloc() documentation suggests a separate heap per thread. with ARC/ORC is this valid anymore? isnt there one shared heap? |
10:29:42 | FromDiscord | <vindaar> are you using `toLower` for unicode runes or for regular chars? the former is likely pretty slow. the latter should be pretty quick (just shifting based on `ord`)↵(<@709044657232936960_madprops=5b=49=52=43=5d>) |
10:29:50 | FromDiscord | <Rika> How are you profiling your application |
11:24:03 | FromDiscord | <enthus1ast> ag is the\_silver\_searcher right? |
11:24:13 | FromDiscord | <enthus1ast> they also use pcre ↵#include \<pcre.h\> |
11:43:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qf |
11:46:34 | FromDiscord | <Yardanico> I have a similar proc in my Nim eventer , lemme see if it's better |
11:47:08 | FromDiscord | <Phil> I have a playground project with benchy etc. already set up, if you can throw in the proc I can copy paste it in quickly for a comparison |
11:47:33 | FromDiscord | <Yardanico> it's a bit different as it does that by words |
11:47:38 | FromDiscord | <Yardanico> But there's an idea to make your proc faster |
11:48:01 | FromDiscord | <Yardanico> iterate on split (there's an iterator version of it) and increment untill you get 40 words |
11:48:05 | FromDiscord | <Yardanico> then just break |
11:49:04 | FromDiscord | <Yardanico> rugby now you split, then slice and then join again |
11:49:38 | FromDiscord | <Yardanico> I'm not a home so I can't write a complete proc, maybe in the evening |
11:52:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qg |
11:53:28 | FromDiscord | <Yardanico> how are you benchmarking? |
11:54:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qi |
11:54:13 | FromDiscord | <Yardanico> this doesn't keep the result string |
11:54:24 | FromDiscord | <Yardanico> Add `keep str` to all blocks |
11:55:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qj |
11:56:22 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=41qk |
11:56:31 | FromDiscord | <Yardanico> you don't need the splitString, as I said, use split as an iterator |
11:56:43 | FromDiscord | <Phil> Ohhh that's what you meant, alrighty, let me see |
11:57:20 | FromDiscord | <Yardanico> https://nim-lang.org/docs/strutils.html#split.i%2Cstring%2Cchar%2Cint |
11:57:32 | FromDiscord | <Yardanico> Also you don't need to concat like that |
11:58:19 | FromDiscord | <Yardanico> " " & str |
12:00:11 | FromDiscord | <Phil> Holy shit |
12:00:30 | FromDiscord | <Phil> Okay, yeah that's a significantly better approach, and I haven't even done anything to the concat yeah |
12:00:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qn |
12:02:02 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=41qo |
12:03:02 | FromDiscord | <Yardanico> you can make it add word first and space later, then you can remove setLen but you'll have a leading space |
12:04:07 | FromDiscord | <Phil> Given that I'll be adding "..." to indicate there's more text either way, I think I can save myself the hassle of even doing that |
12:04:54 | FromDiscord | <Yardanico> yeah although this approach makes it impossible to not add ... if you put in the whole string |
12:05:06 | FromDiscord | <Yardanico> you can make it possible with parseutils, but it'll be a bit more low level |
12:12:30 | * | attah joined #nim |
12:14:26 | * | Guest21aaaaaa joined #nim |
12:14:49 | * | Guest21aaaaaa quit (Client Quit) |
12:17:42 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/EFO |
12:18:31 | FromDiscord | <Phil> I've rerun he above a couple of times, at avg time of the last 3 fluctuates enough that any one of them is first place depending on chance |
12:19:00 | * | FromDiscord quit (Remote host closed the connection) |
12:19:13 | * | FromDiscord joined #nim |
12:20:09 | FromDiscord | <Yardanico> yes, but it depends on what input you feed to them |
12:20:27 | FromDiscord | <Yardanico> the preallocated memory one will be more performant for longer strings with longer words |
12:23:31 | FromDiscord | <enthus1ast> this is the truncate in nimjautils\: https://github.com/enthus1ast/nimja/blob/620aceecd91a9c34b408755e5a50ce6218cc33a7/src/nimja/nimjautils.nim#L113 |
12:24:09 | FromDiscord | <enthus1ast> idk how well it performs |
12:24:31 | FromDiscord | <Yardanico> it keeps the whole string split in memory |
12:24:48 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/UIN |
12:26:57 | FromDiscord | <Phil> In reply to @enthus1ast "this is the truncate": Hmmm you truncate by characters, rather than words |
12:27:10 | FromDiscord | <Yardanico> I do too in nimeventer |
12:27:17 | FromDiscord | <Yardanico> But I check if it's the word boundary |
12:28:08 | FromDiscord | <Yardanico> So I split by words but max context length is in chars |
12:28:11 | FromDiscord | <enthus1ast> do you want to truncate by words? |
12:28:18 | FromDiscord | <Yardanico> that way you can control resulting length of the string better |
12:28:23 | FromDiscord | <Yardanico> I think it makes more sense |
12:28:42 | FromDiscord | <Yardanico> Unless you're doing unicode, then doing that is not so simple |
12:29:06 | FromDiscord | <Phil> In reply to @enthus1ast "do you want to": I originally wanted to in order to avoid having cut-off words and thought doing it by word was simpler than doing it by char overall |
12:29:35 | FromDiscord | <Phil> Due to the complexity added by checking for "am I in the middle of a word, if not add more chars/remove chars until I am not" |
12:30:02 | FromDiscord | <Yardanico> There's no complexity |
12:30:04 | FromDiscord | <Phil> Which I found not-so-nice to have for a first naive implementation |
12:30:36 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=41qt |
12:30:43 | FromDiscord | <Yardanico> fullText is needed to add ... |
12:31:08 | FromDiscord | <Yardanico> postWords can be str.split(' ') |
12:31:42 | FromDiscord | <Yardanico> although after that I join the words from res seq, you can add words inline like you do already |
12:32:33 | FromDiscord | <Yardanico> So you still split by words, but you have precise control over max context string length |
12:35:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qw |
12:36:13 | FromDiscord | <Phil> Just an FYI since I thought you might find it interesting |
12:37:32 | FromDiscord | <Phil> From what I've seen, performance wise `splitWhitespace.pairs()` is really hurting |
12:37:42 | FromDiscord | <enthus1ast> yeah, some perfomance potential still there |
12:37:44 | FromDiscord | <Phil> (edit) "hurting" => "hurting, compared to having var i = 0" |
12:38:02 | FromDiscord | <enthus1ast> ill fiddle with it a little |
12:38:26 | FromDiscord | <Yardanico> Yeah you can just use std/enumerate instead |
12:38:27 | FromDiscord | <Phil> I think I should do a lot more optimizations. Not that they're insanely useful for me, but you can learn quite a bit |
12:38:36 | FromDiscord | <Yardanico> there's a splitWhitespace iterator iirc |
12:38:37 | FromDiscord | <Phil> It's fun! |
12:38:41 | FromDiscord | <Yardanico> And enumerate adds indexes |
12:38:46 | FromDiscord | <Yardanico> to iterators |
12:40:39 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41qx |
12:40:41 | FromDiscord | <enthus1ast> indeed wow |
12:40:57 | FromDiscord | <Phil> Yeah, similar results here |
12:41:18 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/2f8 |
12:41:35 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=41qy" => "https://play.nim-lang.org/#ix=41qA" |
12:44:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qB |
12:45:11 | FromDiscord | <Yardanico> enumerate is the same as manual indexing |
12:45:13 | FromDiscord | <Phil> I guess it gets compiled into similar assembly in the end |
12:45:15 | FromDiscord | <Phil> Check |
12:45:20 | FromDiscord | <enthus1ast> thinks its quite the same |
12:45:34 | FromDiscord | <Phil> I'll definitely keep enumerate in mind more |
12:46:13 | FromDiscord | <Yardanico> I mean it's just sugar over manually declaring a variable and inc'ing it |
12:46:37 | FromDiscord | <Phil> I like sugar, I'll use that sugar |
12:47:10 | FromDiscord | <enthus1ast> wonder if we can teach the pairs() or the normal looping these tricks as well |
12:47:31 | FromDiscord | <enthus1ast> would be nice if the simplest is also the fastest |
12:48:55 | FromDiscord | <Yardanico> but the problem is that you call pairs on the non-iterator version |
12:49:01 | FromDiscord | <enthus1ast> yes |
12:49:04 | FromDiscord | <Yardanico> You can't really compose non-closure iterators |
12:49:47 | FromDiscord | <enthus1ast> did you not have these lib (zero functional?)↵(@Yardanico) |
12:50:46 | FromDiscord | <enthus1ast> ah no, but stuff like this would be nice |
12:55:58 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/n6Q |
12:56:21 | FromDiscord | <enthus1ast> min time is not always lower, but avg is always |
12:56:43 | FromDiscord | <Phil> it also seems to fluctuate less if the std dv is semi stable |
12:56:48 | FromDiscord | <enthus1ast> yes |
12:57:05 | FromDiscord | <Phil> I guess because less allocations mean less chance of having to wait for the system or sth? |
12:57:20 | FromDiscord | <enthus1ast> yes i also think so |
12:58:58 | FromDiscord | <enthus1ast> think i pr nimja \:D |
12:59:34 | FromDiscord | <Phil> Thanks Yard! |
12:59:41 | * | TakinOver joined #nim |
12:59:47 | FromDiscord | <enthus1ast> yeah |
13:01:00 | FromDiscord | <Phil> Actually, I'll post some of this on stackexchange codereview simply because I can |
13:33:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qK |
13:34:19 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=41qL |
13:36:36 | FromDiscord | <enthus1ast> huh |
13:36:42 | FromDiscord | <enthus1ast> what can possible be -4 here |
13:37:05 | FromDiscord | <Phil> no clue. even if I pass in straight up 400 into newStringOfCap it throws that |
13:37:37 | FromDiscord | <enthus1ast> maybe its something else |
13:37:57 | FromDiscord | <enthus1ast> (have to leave, get some food etc..) |
13:57:50 | madprops | > Error: Can't read '' :o |
14:11:28 | NimEventer | New thread by NameUndefined: ErrorStream(p) returns output stream, see https://forum.nim-lang.org/t/9277 |
14:17:05 | FromDiscord | <halc> sent a code paste, see https://paste.rs/KK1 |
14:17:05 | * | pch quit (Read error: Connection reset by peer) |
14:17:44 | * | pch joined #nim |
14:17:54 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=41qR |
14:18:33 | FromDiscord | <halc> (edit) "https://play.nim-lang.org/#ix=41qT" => "https://play.nim-lang.org/#ix=41qS" |
14:18:35 | * | arkurious joined #nim |
14:19:06 | FromDiscord | <halc> In reply to @halc "I had been getting": just make a test `hello-world.nim` and try using `newStringOfCap` |
14:21:57 | FromDiscord | <halc> ah wait, yours is a runtime error |
14:22:02 | FromDiscord | <halc> mine happened at compile-time |
14:22:06 | FromDiscord | <halc> probably not the same issue |
15:07:27 | FromDiscord | <Phil> The proc itself even works, it's just when I throw it in a timeit block that the error occurs |
15:11:18 | * | noeontheend joined #nim |
15:12:50 | FromDiscord | <xflywind> I checked with `koch temp`. It seems to be a benchy/Nim bug => .nimble\pkgs\benchy-0.0.1\benchy.nim(109) |
15:13:33 | FromDiscord | <xflywind> https://media.discordapp.net/attachments/371759389889003532/992810265202667551/unknown.png |
15:15:41 | FromDiscord | <xflywind> `template dots(n: Natural): string =` requires `Natural`, but the pass parameters `dots(40 - tag.len - m.len)` is somehow equal to `-4`. |
15:16:02 | FromDiscord | <xflywind> https://github.com/treeform/benchy/blob/848dc851559d48b60bd368fddb2761414daa8c3c/src/benchy.nim#L109 |
15:18:40 | FromDiscord | <Yardanico> but it's a template |
15:19:00 | FromDiscord | <Yardanico> I don't think Natural would affect anything for a template |
15:19:18 | FromDiscord | <Yardanico> it should be a proc so Natural can actually check the range of the int |
15:19:24 | FromDiscord | <xflywind> Change 40 to 60 works. |
15:19:36 | FromDiscord | <xflywind> (edit) "Change 40 to 60 ... works." added "and then it" |
15:20:51 | FromDiscord | <xflywind> In reply to @Yardanico "I don't think Natural": Yeah, it calls `repeat` internally => `func repeat(c: char, count: Natural)` |
15:23:34 | FromDiscord | <xflywind> For a naive solution, I thin it should change `40` to a variable adjusting itself relative to `tag.len + m.len` in case that they are too large. |
15:24:17 | FromDiscord | <xflywind> In reply to @Isofruit "The proc itself even": In this case I think benchy cannoyt handle a tag name which is as long as `truncate_breakfor_enumerate_memoryalloc`. |
15:24:23 | FromDiscord | <xflywind> (edit) "cannoyt" => "cannot" |
15:24:35 | FromDiscord | <Phil> The length of the tag name is the issue? Fascinating |
15:25:44 | FromDiscord | <xflywind> Yeah, shorter name works. You can submit a issue or PR to benchy. |
15:26:02 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=41ro |
15:26:04 | FromDiscord | <xflywind> (edit) |
15:32:16 | FromDiscord | <xflywind> In reply to @Isofruit "The length of the": These has been a fix => https://github.com/treeform/benchy/pull/11 |
15:32:26 | FromDiscord | <xflywind> (edit) "These" => "There" |
15:35:19 | FromDiscord | <Phil> In reply to @flywind "There has been a": Check, thanks, noted that in the issue |
15:36:38 | FromDiscord | <dain> i got the new nim book that araq wrote |
15:36:43 | FromDiscord | <dain> trying to follow the first example |
15:37:00 | FromDiscord | <dain> it doesnt work, sdl window just shows what's below |
15:37:04 | FromDiscord | <dain> https://media.discordapp.net/attachments/371759389889003532/992816183973777458/unknown.png |
15:37:07 | FromDiscord | <dain> i drag it around and it's fixed |
15:37:39 | FromDiscord | <dain> also i got errors when i tried to do it at first, book doesnt say to install SDL dependencies first which i didnt have |
15:37:59 | FromDiscord | <dain> is there more stuff i need to install |
15:40:29 | FromDiscord | <Yardanico> can't really help as I don't have the book |
15:40:40 | FromDiscord | <Yardanico> Unless you show the code :P |
15:41:10 | FromDiscord | <dain> oh sorry i forgot |
15:41:24 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=41rr |
15:41:30 | FromDiscord | <xflywind> You can also send an email to ask support from the author. |
15:42:08 | FromDiscord | <Phil> Is that the entire code?↵Isn't there stuff like creating a window etc. missing? |
15:42:20 | FromDiscord | <Yardanico> pixels library does the |
15:42:22 | FromDiscord | <Yardanico> that |
15:42:23 | FromDiscord | <Yardanico> I think |
15:42:24 | FromDiscord | <dain> no the book just gives that code snippet and i typed it verbatim |
15:42:29 | FromDiscord | <Yardanico> Also, are you on Wayland? |
15:42:33 | FromDiscord | <dain> no |
15:42:46 | FromDiscord | <dain> actually how do i check |
15:43:06 | FromDiscord | <dain> KDE isnt wayland right |
15:43:06 | FromDiscord | <Phil> What distro do you use? |
15:43:22 | FromDiscord | <dain> manjaro kde |
15:43:24 | FromDiscord | <Phil> KDE does have wayland support backed in↵WHen you log in on the lower right you should be seeing a gear |
15:43:40 | FromDiscord | <Phil> That's where you choose what type of session to run, whether its wayland or not |
15:44:01 | FromDiscord | <Phil> Mot sure whether KDE defaults you to wayland already, I know gnome does |
15:45:06 | FromDiscord | <Yardanico> In reply to @dain "manjaro kde": do `echo $XDG_SESSION_TYPE` in the shell |
15:45:15 | FromDiscord | <Yardanico> I'm not sure Wayland is the case, but it might be |
15:46:02 | FromDiscord | <dain> x11 |
15:47:14 | FromDiscord | <Phil> I just ran the example myself, can confirm error:↵`could not load: libSDL2_ttf(|-2.0).so(|.0)` |
15:47:34 | FromDiscord | <Phil> I am under wayland |
15:47:45 | FromDiscord | <Yardanico> well you need sdl |
15:47:54 | FromDiscord | <Yardanico> and sdl ttf obviously |
15:48:06 | FromDiscord | <xflywind> In reply to @Isofruit "I just ran the": https://github.com/Vladar4/sdl2_nim/blob/master/LINKS.md |
15:48:08 | FromDiscord | <Yardanico> Maybe Araq omitted that from the book in the hopes that people would have it installed already |
15:49:37 | FromDiscord | <Phil> Yeh, that info should've been included somewhere, if not in the book, then in the github page of pixels or some kind of docs there |
15:50:32 | FromDiscord | <xflywind> I agree. |
15:51:55 | FromDiscord | <Phil> Is pinging Araq a thing for this? |
15:52:09 | FromDiscord | <Phil> Ah, no, mail is an option you said earlier, nevermind. |
15:53:45 | FromDiscord | <xflywind> PR welcome for pixels 😜 |
15:55:13 | FromDiscord | <xflywind> (edit) "PR" => "PR/Issue" | "PR/Issuewelcome for pixels 😜 ... " added "Since I will probably translate it later." |
15:57:55 | * | noeontheend quit (Ping timeout: 260 seconds) |
15:58:11 | FromDiscord | <Phil> I have way too little skin in the game to start writing the issue, as it would entail doing the research on what the needed package names are for the lib in an example I never plan on using and discovered as part of troubleshooting for somebody else |
15:59:16 | FromDiscord | <xflywind> Yeah, just kidding 😆 |
16:05:58 | FromDiscord | <dain> k i made a github issue about it |
16:18:21 | FromDiscord | <dain> ill try it on my laptop as well |
16:34:32 | FromDiscord | <ripluke> Is getHomeDir run at compile time |
16:40:57 | * | pch quit (Read error: Connection reset by peer) |
17:01:34 | FromDiscord | <Rika> not that im aware of, no |
17:01:51 | FromDiscord | <Phil> It should not, since getHomeDir depends on environment variables |
17:05:36 | * | pch joined #nim |
17:18:28 | * | pch_ joined #nim |
17:18:28 | * | pch quit (Read error: Connection reset by peer) |
17:29:44 | FromDiscord | <Prestige> If it ran at compile time, you could compile it on your machine and send it to someone else, and the path would be incorrect - has to be runtime |
17:30:38 | reversem3[m] | Anyone uses nimlsp on neovim ? |
17:30:55 | reversem3[m] | How do you get the references to pop up ? |
17:33:19 | * | noeontheend joined #nim |
17:39:34 | FromDiscord | <ripluke> In reply to @Rika "not that im aware": Well when I have someone a binary of some code that read the home dir and made some folders it tried using my home dir |
17:39:50 | FromDiscord | <ripluke> Because I had compiled it |
17:40:06 | FromDiscord | <ripluke> When I sent them the code and they compiled it it worked fine |
17:42:40 | * | wallabra_ joined #nim |
17:44:10 | * | wallabra quit (Ping timeout: 272 seconds) |
17:44:17 | * | wallabra_ is now known as wallabra |
17:47:25 | FromDiscord | <PyryTheBurger> how do i prevent error lenght of seq changed while iterating over it? |
17:49:23 | FromDiscord | <Yardanico> copy the seq to a new variable and iterate over that copy |
17:49:36 | FromDiscord | <Yardanico> I mean iterate over the original and modify the cooy |
17:49:42 | FromDiscord | <Yardanico> (edit) "cooy" => "copy" |
17:51:39 | * | pch_ is now known as pch |
17:51:40 | * | noeontheend quit (Ping timeout: 260 seconds) |
17:53:29 | reversem3[m] | Ok I figured it out , you have to create the nim file first then you can go in to edit using nvim or neovim. For some reason you can't just create the file using neovim. |
17:55:28 | * | sagax joined #nim |
17:56:54 | FromDiscord | <Luckayla> In reply to @ripluke "When I sent them": Something sounds fucky. Might want to share your relevant code. |
17:58:15 | FromDiscord | <ripluke> sent a code paste, see https://play.nim-lang.org/#ix=41rQ |
17:58:41 | FromDiscord | <Rika> Const |
17:58:50 | FromDiscord | <Rika> Compile time |
17:58:52 | FromDiscord | <Rika> Use let |
17:58:55 | FromDiscord | <ripluke> oh |
18:00:37 | FromDiscord | <huantian> why not just use getCacheDir or whatever for yoru cache |
18:01:32 | FromDiscord | <ripluke> because i want the directory in a specific spot |
18:02:09 | FromDiscord | <huantian> but then you're not adhering to the xdg desktop specifications! 😛 |
18:09:16 | FromDiscord | <ripluke> In reply to @huantian "but then you're not": Yea |
18:13:36 | reversem3[m] | where can I find more information between the differences of a ; semicolon and , comma using a nim proc ? |
18:14:04 | FromDiscord | <Phil> difference in what sense? |
18:14:11 | FromDiscord | <Phil> In proc parameters? |
18:15:07 | reversem3[m] | yes in proc parameters |
18:19:29 | FromDiscord | <Phil> https://nim-lang.org/docs/manual.html#statements-and-expressions↵https://nim-lang.org/docs/manual.html#procedures |
18:19:40 | FromDiscord | <Phil> The latter is what you're looking for, the former shows another way in how it's used |
18:28:10 | reversem3[m] | ok so its for readability ? |
18:42:53 | * | rockcavera joined #nim |
18:42:53 | * | rockcavera quit (Changing host) |
18:42:53 | * | rockcavera joined #nim |
18:49:56 | FromDiscord | <Phil> Of sorts. I'm really not the best person to ask, I'm personally not a massive fan of using `;` for separating proc params because it's a "non-standard" thing to me. But I also don't use `using` so...eh |
18:50:46 | FromDiscord | <Phil> It's one of those things you "have to know" and I tend to avoid those |
18:50:59 | FromDiscord | <Phil> (edit) ""have" => ""just have" |
19:09:02 | reversem3[m] | So you use only , "commas" for your proc parameters? |
19:13:49 | FromDiscord | <Phil> pretty much |
19:14:30 | FromDiscord | <Phil> ElegantBeef, enthus1ast, Rika or Yard likely can make a better case for using comma |
19:14:54 | FromDiscord | <Phil> Semicolon, I mean semicolobn |
19:17:10 | reversem3[m] | ok , thanks |
19:21:29 | FromDiscord | <Rika> Not really |
19:21:47 | FromDiscord | <Rika> If you don’t use using you don’t really have a reason to use semicolon other than preference |
19:38:46 | FromDiscord | <dom96> there is no differences between the comma and semicolon as far as I know |
19:39:24 | FromDiscord | <dom96> they are only there to allow more clearly to separate generic types in param lists |
19:39:36 | FromDiscord | <dom96> I also don't use them |
19:49:47 | reversem3[m] | dom96: what don't you use? semicolon , or colon? |
19:50:43 | FromDiscord | <dom96> semicolon |
19:51:58 | FromDiscord | <Yardanico> In reply to @dom96 "there is no differences": there are differences, but they only appear when you use `using| |
19:52:06 | FromDiscord | <Yardanico> (edit) "`using|" => "`using`" |
19:52:16 | FromDiscord | <enthus1ast> There is a difference↵(@dom96) |
19:52:58 | FromDiscord | <enthus1ast> a,b\: string |
19:53:10 | FromDiscord | <enthus1ast> Both are string |
19:53:34 | FromDiscord | <enthus1ast> a;b\: string |
19:53:42 | FromDiscord | <enthus1ast> Only b is string |
19:54:09 | FromDiscord | <enthus1ast> (I'm on mobile atm, sorry) |
19:54:43 | FromDiscord | <enthus1ast> This becomes relevant in generics |
19:55:21 | reversem3[m] | he's referring to `proc(x, y: int, s: string) to `proc(x, y: int, s: string)` comma compared to semi-colon for proc parameters |
19:55:35 | FromDiscord | <enthus1ast> Foo[A; B\: string\|int] |
19:55:48 | FromDiscord | <Yardanico> yes, this is a more common case than using actually |
19:55:54 | reversem3[m] | s/,/;/ |
19:57:02 | reversem3[m] | Ok but the end of day using a semi-colon or a comma for proc parameters doesn't really matter. |
19:57:17 | reversem3[m] | Expect in special cases correct ? |
19:57:21 | FromDiscord | <Yardanico> I was replying to enthusiast |
19:57:29 | reversem3[m] | s/Expect/Except/ |
19:57:44 | FromDiscord | <Yardanico> yes, in most cases the difference isn't visible, but the main thing is - , and ; ARE different |
19:57:52 | FromDiscord | <Yardanico> It's just that this different is not apparent in most cases |
19:58:05 | FromDiscord | <Yardanico> (edit) "different" => "difference" |
19:58:12 | reversem3[m] | great , got it |
19:58:49 | FromDiscord | <enthus1ast> No [A\: any, B\: int\|\|float] should also work in this case↵(<@709044657232936960_reversem3=5b=4datrix=5d>) |
20:02:54 | reversem3[m] | umm , now I'm confused |
20:03:07 | reversem3[m] | can you post that in a proc ? |
20:04:22 | FromDiscord | <Yardanico> proc test[A; B: SomeNumber](a: A, b: B) |
20:04:33 | FromDiscord | <Yardanico> in this case A will just be a generic for any type |
20:04:43 | FromDiscord | <Yardanico> While B is restricted for types from SomeNumber |
20:05:14 | FromDiscord | <Yardanico> If you replace ; with , both A and B will require the type to be SomeNumber |
20:09:59 | reversem3[m] | Ok so why doesn't this work using inim https://play.nim-lang.org/#ix=41sk |
20:14:30 | FromDiscord | <Yardanico> spacing I think |
20:14:36 | FromDiscord | <Yardanico> 0 ..< |
20:18:44 | reversem3[m] | hmm , https://play.nim-lang.org/#ix=41sr |
20:19:23 | reversem3[m] | /home/nixfreak/nim/master_nim/20220702/generics.nim(9, 15) template/generic instantiation of `items` from here |
20:19:23 | reversem3[m] | /home/nixfreak/nim/master_nim/20220702/generics.nim(5, 5) Error: type mismatch: got 'int' for 'i' but expected 'string' |
20:22:12 | FromDiscord | <Prestige> Weird, I'd expect that to work |
20:34:20 | FromDiscord | <Prestige> oh reversem3 you need `yield s[i]` |
21:00:28 | reversem3[m] | ahh yes thanks |
21:22:42 | reversem3[m] | https://play.nim-lang.org/#ix=41sI |
21:23:30 | reversem3[m] | Ok ... so stupid question (I think) if Point[float] is already declared as var p , why would you need to declare it again with x and y ? |
21:24:11 | reversem3[m] | var p: Point[float] p = Point[float](x: 1.0, y: 2.0) |
21:26:18 | FromDiscord | <Generic> I don't really understand what your question is |
21:26:39 | FromDiscord | <Generic> you can also write `var p = Point[float](x: 1.0, y: 2.0)` to do everything in one step |
21:28:40 | reversem3[m] | ok maybe that's what I was referring to |
21:31:38 | reversem3[m] | ok so var p: Point[float](x: 1.9, y: 3.4) is not the same as var p: Point[float](x: 1.8, y: 1.5) |
21:31:53 | reversem3[m] | * ok so var p = Point[float](x: 1.9, y: 3.4) is not the same as var p: Point[float](x: 1.8, y: 1.5) |
21:37:59 | * | pch quit (Quit: Leaving) |
21:49:13 | * | pch joined #nim |
22:01:28 | FromDiscord | <Elegantbeef> The answer reversem is that Nim doesnt have any funky intializer syntax it only has constructors or field access |
22:03:36 | FromDiscord | <Elegantbeef> You can of course use tuple assignment syntax https://play.nim-lang.org/#ix=41sT |
22:34:17 | FromDiscord | <!Patitotective> damn the twitter bot code is just 18 lines long↵i might have done something wrong, it needs to be longer |
22:38:00 | FromDiscord | <Elegantbeef> RIIR |
22:38:08 | FromDiscord | <Elegantbeef> Or RIIC |
22:48:18 | * | CyberTailor quit (Read error: Connection reset by peer) |
22:49:09 | * | CyberTailor joined #nim |
22:53:20 | * | CyberTailor quit (Remote host closed the connection) |
22:54:10 | * | CyberTailor joined #nim |
23:06:01 | FromDiscord | <!Patitotective> https://twitter.com/nimlangbot :D |
23:27:44 | FromDiscord | <retkid> efficient way to remove every 4th element in an array? |
23:28:31 | FromDiscord | <Elegantbeef> `del` |
23:29:28 | FromDiscord | <retkid> countup(0 x.high, 4): |
23:29:30 | FromDiscord | <retkid> (edit) "4):" => "4)" |
23:29:48 | FromDiscord | <retkid> (edit) "4)" => "4): x.del(delete)" |
23:31:14 | FromDiscord | <Generic> this won't work because eventually del will move items which where previously on a fourth position into the holes created by previous deletions |
23:33:14 | FromDiscord | <retkid> for delete in countup(0, a.high, 4): a.delete(delete) |
23:33:22 | FromDiscord | <retkid> i know |
23:35:15 | FromDiscord | <Elegantbeef> I mean they said delete the 4th element |
23:35:39 | FromDiscord | <voidwalker> why does adding entries to a table takes twice as long vs a sequence ? |
23:36:11 | FromDiscord | <voidwalker> same data, same algorithm |
23:36:18 | FromDiscord | <Elegantbeef> Oh i misread |
23:36:36 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=41tf |
23:36:38 | FromDiscord | <Generic> tada, I think this'll do |
23:37:19 | FromDiscord | <Generic> (edit) "https://play.nim-lang.org/#ix=41tf" => "https://play.nim-lang.org/#ix=41tg" |
23:37:49 | FromDiscord | <Generic> In reply to @voidwalker "why does adding entries": because adding data to a table is a fundametally more complex operation |
23:38:33 | FromDiscord | <voidwalker> Searching string in the table values is also 2x or 3x slower |
23:38:37 | FromDiscord | <Elegantbeef> Tables are hashed |
23:38:53 | FromDiscord | <Elegantbeef> Also are you testing in release or debug? |
23:38:59 | FromDiscord | <voidwalker> in danger |
23:39:11 | FromDiscord | <Generic> In reply to @voidwalker "Searching string in the": searching as in iterating over it or using it's proper access functions? |
23:39:33 | FromDiscord | <voidwalker> @Generic iterating over all values to search for a substring |
23:40:05 | FromDiscord | <Generic> I think you should make yourself familiar with some basic knowledge on data structures |
23:40:20 | NimEventer | New thread by Matthesoundman: How to let nim know to search an additional path for linking a lib?, see https://forum.nim-lang.org/t/9278 |
23:40:25 | FromDiscord | <Generic> the data lies sparsely in a table |
23:40:56 | FromDiscord | <Generic> in a seq all values lies contigously in memory, accessing one by one is trivial |
23:41:12 | FromDiscord | <Generic> in a table it has to check every entry first to see if there even lies a value |
23:42:22 | FromDiscord | <Yardanico> huh? |
23:42:25 | FromDiscord | <Yardanico> there are hashes |
23:42:40 | FromDiscord | <Generic> hashes don't help you when iterating over the table |
23:46:11 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=41th |
23:46:19 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=41th" => "https://play.nim-lang.org/#ix=41ti" |
23:46:20 | FromDiscord | <retkid> no need for that we have math |
23:46:24 | reversem3[m] | Type inference doesn't work for object construction , that's why. |
23:47:19 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=41tj |
23:47:25 | FromDiscord | <retkid> good enough |
23:47:36 | FromDiscord | <Generic> not when O(n) is possible 😛 |
23:48:14 | FromDiscord | <retkid> the largest the array will get is like 64 |
23:48:24 | FromDiscord | <Elegantbeef> Or reversem you were asking why you had to specify its generic parameters? |
23:48:29 | FromDiscord | <Elegantbeef> oh reversem\ |
23:48:55 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=41tl |
23:49:01 | FromDiscord | <retkid> its chunked and it just slices the last element |
23:49:15 | FromDiscord | <Elegantbeef> Two maps and a slice |
23:49:28 | FromDiscord | <Elegantbeef> Damn buh bye heap allocations 😄 |
23:49:49 | FromDiscord | <Generic> also string conversion :puke: |
23:49:59 | FromDiscord | <Elegantbeef> yea what're you even doing |
23:49:59 | FromDiscord | <retkid> In reply to @Generic "also string conversion :puke:": what other option do i have |
23:50:11 | FromDiscord | <retkid> I've shown too much I'm being questioned |
23:50:16 | FromDiscord | <Generic> bit and |
23:50:39 | FromDiscord | <Generic> ah no |
23:51:33 | FromDiscord | <Elegantbeef> I dont even get what you're doing |
23:52:16 | FromDiscord | <Generic> me not really either, though converting things to a string and then back again is just scary |
23:52:18 | FromDiscord | <retkid> https://y.yarn.co/531e70aa-a107-4f0f-b819-ce7f4a3ce4a7_text.gif |
23:52:42 | FromDiscord | <Generic> what type is x? |
23:52:43 | FromDiscord | <Elegantbeef> Seems they have some type that they want to extract the first 3 ints from |
23:52:43 | FromDiscord | <retkid> In reply to @Generic "me not really either,": i have a bytechar, i need to convert into a its int numeric |
23:52:55 | FromDiscord | <Elegantbeef> "bytechar" |
23:53:00 | FromDiscord | <retkid> look |
23:53:02 | FromDiscord | <Generic> what is a bytechar? |
23:53:16 | FromDiscord | <Elegantbeef> retkid we're willing to help you dont have to act all defensive |
23:53:27 | FromDiscord | <retkid> y'know when you reading and you cast an array with a type |
23:53:33 | FromDiscord | <retkid> buffer[type] |
23:53:37 | FromDiscord | <retkid> this is of buffer[char] |
23:53:44 | FromDiscord | <retkid> that kind of data |
23:53:51 | FromDiscord | <Generic> so it's the raw bytes of some unspecified object? |
23:53:57 | FromDiscord | <retkid> yes |
23:54:03 | FromDiscord | <retkid> but i need it to be an int |
23:54:11 | FromDiscord | <Generic> ah |
23:54:17 | FromDiscord | <retkid> so it goes from (unprintable)=>(FF)=>256 |
23:54:18 | FromDiscord | <Elegantbeef> `copyMem(dest.addr, myArray[0].addr, sizeof(dest))` |
23:54:59 | FromDiscord | <Generic> yeah memcpy go brr |
23:55:57 | FromDiscord | <retkid> i should learn more about memcpy |
23:56:02 | FromDiscord | <Generic> I think in Nim cast[int](object) should even work |
23:56:13 | * | wallabra_ joined #nim |
23:56:21 | FromDiscord | <Elegantbeef> Otherwise bitwise ops should work |
23:56:31 | FromDiscord | <Generic> why do you need bitwise ops for this? |
23:56:37 | FromDiscord | <Generic> ah you mean to combine bytes? |
23:56:42 | FromDiscord | <Elegantbeef> I really wish you provided more code so we could give other solutions |
23:56:55 | FromDiscord | <Elegantbeef> Instead of screaming about us offering to better your code |
23:57:04 | FromDiscord | <Generic> or pointer aliasing works too |
23:57:06 | * | wallabra quit (Ping timeout: 264 seconds) |
23:57:16 | FromDiscord | <Elegantbeef> strict aliasing says no |
23:57:27 | FromDiscord | <Generic> doesn't Nim compile with strict aliasing disabled? |
23:57:37 | FromDiscord | <Elegantbeef> Not by default |
23:57:53 | * | wallabra_ is now known as wallabra |
23:58:07 | FromDiscord | <Elegantbeef> I'd say it should but i dont know how beneficial strict aliasing is for performance |
23:58:39 | FromDiscord | <Generic> me neither, though I can say from experience that violating strict aliasing with strict aliasing enabled works 99% of the time |
23:59:01 | FromDiscord | <Elegantbeef> UB is UB and should be avoided |
23:59:07 | FromDiscord | <Generic> in the other 1% of the cases debugging is pretty painful, because in worst case it only happens in lto builds where there are no symbols at all |
23:59:18 | FromDiscord | <Generic> and you have to load your own binary into ghidra to figure out where the problem happens |
23:59:22 | FromDiscord | <Generic> but I'll do it anyway |