00:00:48 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/786019479825285130/unknown.png |
00:00:49 | FromDiscord | <shadow.> here? |
00:00:52 | FromDiscord | <shadow.> on the line below? |
00:01:22 | mipri | hmm, or rather, I wouldn't do that at all. |
00:01:30 | FromDiscord | <shadow.> wdym? |
00:01:38 | mipri | it removes your ability to select another gc |
00:02:06 | FromDiscord | <shadow.> true, but ive used refc all this time with no issues, so surely using orc instead wouldnt really pose an issue? |
00:02:41 | FromDiscord | <shadow.> i can always delete the line if i have issues, right |
00:02:44 | mipri | in any case, yeah that's the line I meant |
00:02:50 | FromDiscord | <shadow.> alr thanks |
00:03:01 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/786020038762430484/unknown.png |
00:03:02 | FromDiscord | <shadow.> seems to have worked |
00:03:48 | mipri | you can confirm by compiling `when defined(gcOrc): echo "it worked"` |
00:04:25 | FromDiscord | <shadow.> yeah, also the line length is dif |
00:04:27 | FromDiscord | <shadow.> it worked, thanks |
00:04:39 | disruptek | !repo disruptek/grok |
00:04:40 | disbot | https://github.com/disruptek/grok -- 9grok: 11spelunking gear 15 0⭐ 0🍴 |
00:04:48 | disruptek | see the star.nim |
00:05:07 | FromDiscord | <shadow.> what about it? |
00:05:18 | FromDiscord | <shadow.> interesting code |
00:08:43 | FromDiscord | <Quibono> I think I’m going to make a web crawler. |
00:09:37 | * | vicfred joined #nim |
00:11:15 | FromDiscord | <shadow.> nice |
00:11:23 | FromDiscord | <shadow.> `httpclient` and `htmlparser` |
00:11:25 | FromDiscord | <shadow.> are your friends |
00:11:39 | FromDiscord | <shadow.> also i suggest https://github.com/GULPF/nimquery |
00:13:19 | FromDiscord | <sealmove> oh, you can specify object variant after object construction |
00:13:23 | FromDiscord | <sealmove> nice |
00:14:42 | FromDiscord | <shadow.> ye |
00:14:49 | * | mbomba joined #nim |
00:19:25 | disruptek | you should use two-space indentation, chucklehead. |
00:30:53 | FromDiscord | <Quibono> For split, how do I split by "? |
00:31:40 | mipri | !eval import strutils; echo """a"b"c"d""".split("\"") |
00:31:43 | NimBot | @["a", "b", "c", "d"] |
00:32:19 | FromDiscord | <Quibono> Thank you |
00:34:55 | FromDiscord | <Quibono> Hrm when I try three quotes in the split it freaks out at me |
00:35:06 | FromDiscord | <Quibono> Because it's expecting another triple quote |
00:35:14 | * | wowaname joined #nim |
00:35:23 | * | opal quit (Ping timeout: 240 seconds) |
00:35:25 | * | wowaname is now known as opal |
00:35:37 | mipri | what I typed there was doublequote, backslash, doublequote, doublequote |
00:36:04 | FromDiscord | <Quibono> Ahhhh. |
00:39:59 | FromDiscord | <sealmove> discord messes it up |
00:40:17 | mipri | that, and * coming from discord to IRC |
00:40:40 | mipri | there aren't even 0x7F values that should be round-tripped through this thing. |
00:49:32 | FromDiscord | <Cypheriel> Are the IntelliJ IDEs any good for Nim yet? I saw there was an update to the plugin but I haven't checked it out yet |
00:49:46 | FromDiscord | <shadow.> i mean if it has nimsuggest then id assume so |
00:50:02 | FromDiscord | <ElegantBeef> The highlighting isnt amazing from when i checked yesterday |
00:50:11 | FromDiscord | <Cypheriel> ah. RIP |
00:50:12 | FromDiscord | <ElegantBeef> It now is intelligent across files afaik |
00:50:23 | FromDiscord | <Cypheriel> I'd much rather use Jetbrains than VSCode |
00:50:59 | FromDiscord | <ElegantBeef> And i'd rather use the editor i have in my head 😛 |
00:51:06 | FromDiscord | <Cypheriel> oh no |
00:51:09 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/786032149529755698/unknown.png |
00:51:22 | FromDiscord | <Cypheriel> That is such weird highlighting |
00:51:23 | FromDiscord | <ElegantBeef> I have a hypothetical editor idea, but i cannot be arsed to make it 😄 |
00:51:33 | FromDiscord | <shadow.> lmfao fair enough |
00:51:44 | FromDiscord | <shadow.> yeah i kinda hate jetbrains highlighting ngl |
00:51:51 | FromDiscord | <shadow.> the theme in general lmao |
00:51:59 | FromDiscord | <Cypheriel> You can change the theme easily |
00:52:03 | FromDiscord | <Cypheriel> I use the One Dark theme |
00:52:05 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/786032385040973824/unknown.png |
00:52:06 | FromDiscord | <shadow.> same |
00:52:09 | FromDiscord | <shadow.> one dark is sexy as fuck |
00:52:13 | FromDiscord | <Cypheriel> you can also use the uh |
00:52:17 | FromDiscord | <Cypheriel> background image thing |
00:52:20 | FromDiscord | <ElegantBeef> Ayu-mirage > anything 😄 |
00:52:25 | FromDiscord | <shadow.> one dark |
00:52:26 | FromDiscord | <shadow.> <3 |
00:52:26 | FromDiscord | <Cypheriel> it's so good, I usually use like space/particle images |
00:52:34 | FromDiscord | <shadow.> i feel like that'd distract me |
00:52:41 | FromDiscord | <Cypheriel> Not really, honestly |
00:52:47 | FromDiscord | <Cypheriel> Well maybe it differs from person to person |
00:53:01 | FromDiscord | <Cypheriel> but I find it oddly helpful |
00:53:02 | * | disbot quit (Remote host closed the connection) |
00:54:57 | * | disbot joined #nim |
00:59:45 | FromDiscord | <shadow.> fair |
01:02:10 | FromDiscord | <sealmove> vim in transparent terminal with desktop wallpaper |
01:04:09 | FromDiscord | <Cypheriel> Ah I was just talking about with the people in PyDis about Vim |
01:04:22 | FromDiscord | <Cypheriel> It sounds really cool, right? but idk if I wanna learn it for programming |
01:04:44 | mipri | what, vim? it takes 15 minutes. just run through vimtutor |
01:04:58 | FromDiscord | <sealmove> yeah sure lol, nah not worth learning |
01:06:18 | FromDiscord | <sealmove> whatever plugins you use it never reaches the usability of a GUI editor/IDE for programming |
01:06:48 | FromDiscord | <sealmove> it's fun for editing data though |
01:08:53 | FromDiscord | <Rika> depends on you really |
01:09:07 | FromDiscord | <Rika> i never really needed the various uses of an ide |
01:09:20 | FromDiscord | <Rika> and its pretty bloated with the boot time and stuff |
01:09:42 | FromDiscord | <j-james> my vim setup replicates vscode |
01:10:00 | FromDiscord | <j-james> including staying in insert mode by default |
01:10:18 | FromDiscord | <j-james> makes switching between them very nice |
01:13:51 | * | Tanger joined #nim |
01:22:46 | * | letto_ quit (Quit: Konversation terminated!) |
01:24:41 | * | letto joined #nim |
01:30:32 | * | xet7 quit (Ping timeout: 258 seconds) |
01:30:47 | * | xet7 joined #nim |
01:41:14 | * | mbomba quit (Quit: WeeChat 3.0) |
02:01:55 | * | letto quit (Quit: Konversation terminated!) |
02:03:43 | * | letto joined #nim |
02:11:57 | * | abm quit (Read error: Connection reset by peer) |
02:18:08 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=2HeX |
02:19:40 | FromDiscord | <Rika> ngl the lack of chaining hurts me but you do you |
02:20:16 | FromDiscord | <Rika> i dont see anything wrong per se |
02:20:31 | FromDiscord | <Rika> is this strutils or re? |
02:20:38 | FromDiscord | <Rika> ah dumb question |
02:21:01 | FromDiscord | <Rika> `multiReplace(split(rule, " contain ")[1], {" bags", " bag", "."})` -> `multiReplace(split(rule, " contain ")[1], " bags", " bag", ".")` |
02:21:18 | * | casaca quit (Remote host closed the connection) |
02:21:54 | FromDiscord | <Rika> how'd it go? |
02:22:07 | FromDiscord | <j-james> the compiler isn't happy with that either |
02:22:18 | * | vicfred quit (Ping timeout: 256 seconds) |
02:22:28 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=2HeZ |
02:22:43 | FromDiscord | <ElegantBeef> Yall people need jesus |
02:22:44 | FromDiscord | <Rika> whats the error? |
02:22:51 | FromDiscord | <Rika> ikr beef |
02:22:57 | FromDiscord | <Rika> this hurts but ill try helping anyway |
02:23:09 | FromDiscord | <Rika> even if it takes significantly longer for me to understand this code |
02:23:19 | FromDiscord | <ElegantBeef> this is nim we have ufcs do `rule.replace(x).replace(y).split(z)` 😄 |
02:23:55 | FromDiscord | <Rika> so whats the error j-james |
02:24:03 | FromDiscord | <j-james> there's no error on that last block |
02:24:17 | FromDiscord | <j-james> what i'm trying to do is convert it to use the multiReplace proc |
02:24:21 | FromDiscord | <Rika> i mean with the multireplace |
02:24:29 | FromDiscord | <Rika> oh |
02:24:30 | FromDiscord | <Rika> i see |
02:24:33 | FromDiscord | <Rika> im a dumb |
02:25:05 | FromDiscord | <j-james> oh, d'oh↵the multiReplace error is `Error: type mismatch: got <string, string, string, string>` |
02:25:34 | FromDiscord | <Rika> this is hard to understand |
02:25:45 | FromDiscord | <Rika> very very hard to understand, wait please |
02:25:48 | FromDiscord | <j-james> i'll rewrite it as beef suggested |
02:26:06 | FromDiscord | <ElegantBeef> I mean i'd suggest using strscan personally |
02:26:11 | FromDiscord | <ElegantBeef> do you want to see my implementation for that day |
02:26:19 | FromDiscord | <ElegantBeef> It's not perfect but it's much more readable imo 😄 |
02:26:25 | * | vicfred joined #nim |
02:26:38 | FromDiscord | <Rika> `rule.split(" contain ")[1].replace(" bags").replace(" bag").replace(".").split(", ")` |
02:26:41 | FromDiscord | <Rika> this makes no sense |
02:26:51 | FromDiscord | <Rika> replace needs three arguments |
02:26:54 | FromDiscord | <Rika> you only give 2 |
02:26:58 | FromDiscord | <Rika> i am still confused |
02:27:02 | FromDiscord | <j-james> i'm removing those elements |
02:27:14 | FromDiscord | <Cypheriel> oh no |
02:27:17 | FromDiscord | <Cypheriel> is this day 7 |
02:27:19 | FromDiscord | <j-james> that's the only way i know how 😅 |
02:27:22 | FromDiscord | <j-james> yup |
02:27:23 | FromDiscord | <Rika> yeah so this is what you have to write: |
02:27:34 | FromDiscord | <j-james> the rest of my code is better i swear |
02:27:38 | FromDiscord | <Rika> `multiReplace(split(rule, " contain ")[1], {" bags", " bag", "."})` -> `multiReplace(split(rule, " contain ")[1], {" bags": "", " bag": "", ".": ""})` |
02:28:05 | FromDiscord | <ElegantBeef> My version if you want to see https://media.discordapp.net/attachments/371759389889003532/786056542679728158/SPOILER_unknown.png |
02:28:11 | FromDiscord | <Cypheriel> ohh you can split by space and use index to get the meat |
02:29:06 | FromDiscord | <j-james> ohhh, that's what the `varargs[(string, string)]` means |
02:29:37 | FromDiscord | <ElegantBeef> Yep a replaced by b |
02:29:40 | FromDiscord | <shadow.> beef |
02:29:47 | FromDiscord | <shadow.> why use scanf when you can use npeg |
02:29:48 | FromDiscord | <shadow.> smh |
02:29:53 | FromDiscord | <ElegantBeef> Cause i have smol brain |
02:29:56 | FromDiscord | <Cypheriel> woah |
02:29:58 | FromDiscord | <shadow.> rip |
02:29:59 | FromDiscord | <ElegantBeef> scanf go brrrt |
02:30:00 | FromDiscord | <shadow.> lemme whip out mine |
02:30:16 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/786057092922343445/SPOILER_unknown.png |
02:30:33 | FromDiscord | <ElegantBeef> Yep that's ancient greek to me |
02:30:36 | FromDiscord | <shadow.> LMAO |
02:30:45 | FromDiscord | <shadow.> !repo zevv/npeg |
02:30:46 | disbot | https://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 135⭐ 7🍴 |
02:30:54 | FromDiscord | <ElegantBeef> I know what npeg is |
02:30:56 | FromDiscord | <ElegantBeef> I've read the docs |
02:30:59 | FromDiscord | <shadow.> ohh you've read docs |
02:31:00 | FromDiscord | <shadow.> nvm then |
02:31:21 | FromDiscord | <j-james> `rules <- rule` |
02:31:22 | FromDiscord | <j-james> what |
02:31:31 | FromDiscord | <Rika> rules is many rule |
02:31:35 | FromDiscord | <Rika> thats what it means |
02:31:45 | FromDiscord | <shadow.> 0 or more |
02:31:54 | FromDiscord | <shadow.> ye |
02:32:02 | FromDiscord | <shadow.> i prolly shoulda done + but eh |
02:32:07 | FromDiscord | <j-james> that backwards arrow is scary |
02:32:12 | FromDiscord | <shadow.> i mean |
02:32:14 | FromDiscord | <shadow.> custom operator in a macro |
02:32:16 | FromDiscord | <shadow.> lol |
02:32:18 | FromDiscord | <Rika> <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- <- |
02:32:20 | FromDiscord | <Rika> spooky |
02:32:22 | FromDiscord | <shadow.> its just used for defining capture groups |
02:32:23 | FromDiscord | <shadow.> or somethin |
02:32:25 | FromDiscord | <Rika> wooo backwards arrow <- <- <- <- |
02:32:30 | FromDiscord | <shadow.> wooo <-<-<-<- |
02:32:32 | FromDiscord | <j-james> here's mine: https://play.nim-lang.org/#ix=2Hf1 |
02:32:43 | FromDiscord | <ElegantBeef> I mean it's less of a custom operator and more of just a segment of zevv's DSL afaik 😄 |
02:32:45 | FromDiscord | <j-james> recursion ftw |
02:32:54 | FromDiscord | <shadow.> thats |
02:32:57 | FromDiscord | <shadow.> surprisingly small |
02:33:03 | FromDiscord | <ElegantBeef> That's what she said |
02:33:08 | FromDiscord | <shadow.> https://play.nim-lang.org/#ix=2Hf2 |
02:33:10 | FromDiscord | <shadow.> heres mine |
02:33:15 | FromDiscord | <shadow.> yeah, sadly you're not wrong beef |
02:33:18 | FromDiscord | <shadow.> anyhow |
02:33:23 | FromDiscord | <j-james> all thanks to the line 5 monstrosity |
02:33:26 | FromDiscord | <shadow.> lmfao yeah |
02:33:31 | FromDiscord | <shadow.> if you indented it it'd be like |
02:33:35 | FromDiscord | <shadow.> a whole essay of code |
02:34:09 | FromDiscord | <Cypheriel> You guys did it so differently than I did |
02:34:13 | FromDiscord | <Cypheriel> parsing at least |
02:34:46 | FromDiscord | <ElegantBeef> Did you use npeg for day 8 shadow? |
02:34:52 | FromDiscord | <shadow.> day 8? |
02:34:58 | FromDiscord | <shadow.> gosh no |
02:35:01 | FromDiscord | <ElegantBeef> Lol |
02:35:06 | FromDiscord | <shadow.> indexing |
02:35:11 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Hf4 |
02:35:22 | FromDiscord | <shadow.> and then a case statement |
02:35:30 | FromDiscord | <ElegantBeef> god i'm lazy |
02:35:31 | * | casaca joined #nim |
02:35:49 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/786058489680101376/unknown.png |
02:36:49 | FromDiscord | <shadow.> damn |
02:36:52 | FromDiscord | <shadow.> lmao |
02:37:10 | FromDiscord | <shadow.> all mine r on github |
02:37:12 | FromDiscord | <ElegantBeef> it'd be even less code with the `whenScanf` |
02:37:17 | FromDiscord | <shadow.> !repo shadowninja55/aoc2020 |
02:37:19 | disbot | no results 😢 |
02:37:22 | FromDiscord | <shadow.> what- |
02:37:29 | FromDiscord | <ElegantBeef> inb4 it's private |
02:37:33 | FromDiscord | <shadow.> wait |
02:37:34 | FromDiscord | <shadow.> nope |
02:37:37 | FromDiscord | <shadow.> /repo shadowninja55/aoc-2020 |
02:37:41 | FromDiscord | <shadow.> !repo shadowninja55/aoc-2020 |
02:37:43 | disbot | https://github.com/shadowninja55/aoc-2020 -- 9aoc-2020: 11My attempt at Advent of Code 2020 in Nim. 15 1⭐ 0🍴 |
02:37:45 | FromDiscord | <Cypheriel> What even is `scanf`? |
02:37:46 | FromDiscord | <shadow.> there we go |
02:37:52 | FromDiscord | <shadow.> parses a string into variables |
02:37:54 | FromDiscord | <shadow.> using simple data types |
02:37:58 | FromDiscord | <Cypheriel> Ohh, interesting |
02:38:04 | FromDiscord | <ElegantBeef> It's a cooler regex really |
02:38:05 | FromDiscord | <shadow.> https://nim-lang.org/docs/strscans.html |
02:38:06 | FromDiscord | <shadow.> ehh |
02:38:11 | FromDiscord | <shadow.> less flexible, better for parsing |
02:38:13 | FromDiscord | <shadow.> by rule of them is like |
02:38:28 | FromDiscord | <shadow.> (edit) "them" => "thumb" |
02:38:34 | FromDiscord | <ElegantBeef> I've used it a shitton for aoc |
02:38:39 | FromDiscord | <shadow.> flexible pattern matching - regex↵simple parsing - scanf↵flexible pattern matching and parsing - npeg |
02:38:44 | FromDiscord | <shadow.> yeah i used it for day 2 |
02:38:46 | FromDiscord | <shadow.> the rest i used npeg |
02:39:00 | FromDiscord | <shadow.> well ↵day 2 - scanf ↵day 4 - regex ↵day 7 - npeg |
02:39:19 | FromDiscord | <ElegantBeef> scanf for all those for me |
02:39:22 | FromDiscord | <Cypheriel> Ohh, I see |
02:39:34 | FromDiscord | <Cypheriel> How cool |
02:39:51 | FromDiscord | <shadow.> npeg is more gamerer |
02:40:10 | FromDiscord | <Cypheriel> I stopped using Nim for the AoC solutions because I didn't know enough to translate from Python |
02:40:20 | FromDiscord | <shadow.> rip |
02:40:26 | FromDiscord | <Cypheriel> Things started getting pretty complicated on day 5 |
02:40:27 | FromDiscord | <Cypheriel> (edit) "5" => "4" |
02:40:51 | FromDiscord | <shadow.> just a big case statement tbh |
02:41:16 | FromDiscord | <Cypheriel> yeah idk, I could barely understand in Python, so using Nim would be much harder for me |
02:41:20 | FromDiscord | <shadow.> fair |
02:41:49 | FromDiscord | <shadow.> idk i found nim easier than py |
02:41:51 | FromDiscord | <Cypheriel> I still have yet to do day 8 part two |
02:42:09 | FromDiscord | <shadow.> i tried in py, nim, and c++ for day one and tbh i found nim easiest |
02:42:18 | FromDiscord | <Cypheriel> It probably is to an extent, honestly. but I still have to learn it |
02:42:23 | FromDiscord | <shadow.> fair |
02:42:30 | FromDiscord | <shadow.> time to plug doms book |
02:42:42 | FromDiscord | <Cypheriel> There's a book? |
02:42:51 | FromDiscord | <shadow.> nim in action |
02:42:54 | FromDiscord | <Cypheriel> Oh yeah |
02:42:58 | FromDiscord | <ElegantBeef> in a nix server there is someone doing them both in Python and Nim, and keeps getting caught up on the type system and not exactly knowing how to navigate it |
02:43:06 | FromDiscord | <shadow.> rip |
02:43:12 | FromDiscord | <shadow.> wym? |
02:43:17 | FromDiscord | <shadow.> its pretty simple |
02:43:35 | FromDiscord | <ElegantBeef> I mean their main issue is with sets |
02:43:43 | FromDiscord | <shadow.> i mean i only touched nim a month ago and id i understand it well enough to use it as flexibly as python for aoc |
02:43:49 | FromDiscord | <shadow.> id say |
02:44:02 | FromDiscord | <Cypheriel> Sets were... fun |
02:44:05 | FromDiscord | <ElegantBeef> they tried a set for the computer challenge and cause they attempted a set of an int it wasnt working properly |
02:44:09 | FromDiscord | <shadow.> what type of sets? |
02:44:10 | FromDiscord | <ElegantBeef> Sets are super easy to use and work well |
02:44:18 | FromDiscord | <shadow.> is it that hard to `import intsets` |
02:44:33 | FromDiscord | <Cypheriel> yeah idk in Python there's really only 2 main types of set |
02:44:39 | FromDiscord | <Cypheriel> set() and frozenset() |
02:44:41 | FromDiscord | <shadow.> set and frozenset? |
02:44:42 | FromDiscord | <shadow.> yeah |
02:44:43 | FromDiscord | <Cypheriel> yep |
02:45:01 | FromDiscord | <shadow.> iirc py sets r hash sets so slower than int sets (which are bit sets internally?) |
02:45:21 | FromDiscord | <shadow.> dont quote me |
02:45:28 | FromDiscord | <Cypheriel> I think that sentence alone is enough to explain how it could be a lot more complicated in Nim |
02:45:34 | FromDiscord | <shadow.> lmao |
02:46:34 | FromDiscord | <shadow.> to store something in a set you need to hash it with a function but since in a sense ordinals (int-based vars) are already hashed they're more efficient |
02:46:49 | FromDiscord | <shadow.> since you can just use bitsets |
02:46:55 | FromDiscord | <shadow.> idk if i explained that well |
02:46:57 | FromDiscord | <Cypheriel> Yeah, all of that flew right over my head |
02:47:21 | FromDiscord | <ElegantBeef> You have hashsets which are just look up tables where the key to look it up is the value |
02:47:21 | FromDiscord | <shadow.> rip |
02:47:34 | FromDiscord | <ElegantBeef> Then you have bitset where you have a bit per each possible value |
02:47:43 | FromDiscord | <ElegantBeef> Nim's builtin set is the latter |
02:47:54 | FromDiscord | <shadow.> and to make the key you needa run a hash function so thats even more time added on the hash set |
02:48:01 | FromDiscord | <Cypheriel> I guess that explains why both dictionaries and sets are denoted with `{}` |
02:48:13 | FromDiscord | <shadow.> yeah bc they work internally as hashmaps |
02:48:31 | FromDiscord | <shadow.> (id assume) |
02:48:37 | FromDiscord | <shadow.> python has some weird abstractions so |
02:48:40 | FromDiscord | <shadow.> im not sure |
02:49:02 | FromDiscord | <Cypheriel> I'm considering quitting the AoC to give myself the room to learn more stuff |
02:49:09 | FromDiscord | <shadow.> hm |
02:49:13 | FromDiscord | <Cypheriel> I can't help but feel pressured while it's going on |
02:49:28 | FromDiscord | <shadow.> well if you need beginners resources feel free to dm me lol i can send some stuff i used |
02:50:01 | FromDiscord | <Cypheriel> Got it |
02:52:02 | FromDiscord | <ElegantBeef> Why do you feel pressured? |
02:54:17 | * | vicfred_ joined #nim |
02:54:21 | FromDiscord | <Rika> because leaderboards |
02:54:41 | FromDiscord | <ElegantBeef> The entire leaderboard is about who gets there first, that's the only metric |
02:55:02 | FromDiscord | <Rika> is that not pressuring? |
02:55:14 | FromDiscord | <ElegantBeef> Not to me |
02:56:12 | FromDiscord | <ElegantBeef> They're fun little challenges, that's it to me |
02:56:17 | FromDiscord | <shadow.> yeah same |
02:56:48 | FromDiscord | <shadow.> i'm just doing it to see what gaps the unrealism of leetcode has left in my problem solving abilities |
02:57:09 | * | vicfred quit (Ping timeout: 260 seconds) |
03:04:42 | FromDiscord | <Cypheriel> I mean I'd eventually come back to them |
03:05:39 | FromDiscord | <speckledlemon> AoC last year was how I learned Nim |
03:05:52 | FromDiscord | <Cypheriel> I heard last year was harder than this year |
03:06:02 | FromDiscord | <Cypheriel> something about... intcode something something intcode |
03:06:24 | FromDiscord | <speckledlemon> I am proud of my Nim Intcode computer |
03:06:58 | FromDiscord | <Cypheriel> ngl I haven't even installed Nim on this... uh OS(?) yet |
03:17:40 | FromDiscord | <Rika> intcode was ok |
03:24:33 | * | vicfred_ quit (Quit: Leaving) |
03:31:03 | * | a_chou joined #nim |
03:40:31 | * | disruptek throbs. |
03:47:35 | FromDiscord | <Quibono> So I pushed changes to a private repo from VSCode, and my real name is on the commit. Anyone know how to fix that in the future? |
04:01:58 | FromDiscord | <ElegantBeef> change your git name |
04:02:29 | FromDiscord | <j-james> `git config --global user.name "your-name"` |
04:02:32 | FromDiscord | <nikki> git config --global user.name |
04:02:41 | FromDiscord | <nikki> jinx |
04:02:44 | FromDiscord | <ElegantBeef> Or legally change your name |
04:02:46 | FromDiscord | <j-james> haha |
04:02:53 | FromDiscord | <ElegantBeef> The latter is more comical of a solution |
04:02:55 | FromDiscord | <j-james> nikki's command also tells you what your current one is |
04:03:35 | FromDiscord | <nikki> implement a breaking change to unicode, then influence github to use it, so that your name is rendered differently |
04:03:35 | FromDiscord | <j-james> when run without an argument |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:34 | * | supakeen joined #nim |
04:06:42 | * | a_chou quit (Quit: a_chou) |
04:10:14 | FromDiscord | <Quibono> lol |
04:11:33 | * | spiderstew quit (Ping timeout: 260 seconds) |
04:11:58 | FromDiscord | <Cypheriel> So how exactly am I meant to get Nimble on Linux? |
04:12:14 | FromDiscord | <Cypheriel> I did the `install.sh` but I uh don't have Nimble |
04:12:31 | FromDiscord | <j-james> Is it in your package manager? |
04:12:42 | FromDiscord | <Cypheriel> Oh, it might be |
04:12:43 | * | spiderstew joined #nim |
04:13:18 | FromDiscord | <Cypheriel> Oh yep. `sudo pacman -S nimble` |
04:13:46 | FromDiscord | <shadow.> i feel so excluded as a windows kiddy |
04:13:58 | FromDiscord | <shadow.> i dont get easy cmd installs 😔 |
04:14:01 | FromDiscord | <ElegantBeef> Eh dont use your pkg manager |
04:14:07 | FromDiscord | <ElegantBeef> use choose nim then add the nimble dir to your path |
04:14:14 | FromDiscord | <ElegantBeef> as choosenim tells you |
04:14:40 | FromDiscord | <shadow.> what abt gitnim |
04:14:46 | FromDiscord | <shadow.> !repo disruptek/gitnim |
04:14:47 | disbot | https://github.com/disruptek/gitnim -- 9gitnim: 11choosenim for choosey nimions 15 6⭐ 0🍴 |
04:14:47 | FromDiscord | <ElegantBeef> or use gitnim |
04:14:50 | FromDiscord | <shadow.> gamer |
04:15:06 | disruptek | you can use gitnim on windows. |
04:15:09 | FromDiscord | <j-james> (I'd still recommend pacman) |
04:15:45 | FromDiscord | <j-james> Dealing manually with paths is like↵the worst thing ever |
04:15:54 | FromDiscord | <ElegantBeef> Why would you use the package manager for nim, so it's a pain in the arse to switch to a different nim version? |
04:15:56 | FromDiscord | <shadow.> I CAN USE GITNIM ON KIDDY OS? |
04:16:04 | FromDiscord | <shadow.> this is excellent news |
04:16:06 | FromDiscord | <ElegantBeef> It's `nano ./.bashrc` and add a single line |
04:16:08 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:16:21 | disruptek | gitnim is designed to be cloned for any os you want. |
04:16:31 | FromDiscord | <shadow.> btw disruptek did we ever figure out why the tests failed on 1.0-1.2 |
04:16:32 | FromDiscord | <Cypheriel> uh |
04:16:44 | FromDiscord | <Cypheriel> time to figure out what choosenim is |
04:16:49 | disruptek | i didn't look, but you have the code. |
04:16:50 | FromDiscord | <shadow.> nim installer |
04:16:51 | FromDiscord | <j-james> I have had to switch Nim versions exactly once, and don't expect to do it again |
04:17:00 | FromDiscord | <shadow.> !repo pmunch/choosenim |
04:17:01 | disbot | no results 😢 |
04:17:04 | FromDiscord | <ElegantBeef> it's dom |
04:17:09 | FromDiscord | <shadow.> ohh |
04:17:11 | FromDiscord | <j-james> and even then it was just `sudo pacman -U oldnimpackage` |
04:17:13 | FromDiscord | <shadow.> right |
04:17:28 | FromDiscord | <ElegantBeef> whatabout new versions or devel commits? |
04:17:29 | FromDiscord | <shadow.> !repo dom96/choosenim |
04:17:29 | disbot | https://github.com/dom96/choosenim -- 9choosenim: 11Tool for easily installing and managing multiple versions of the Nim programming language. 15 300⭐ 38🍴 |
04:17:35 | FromDiscord | <shadow.> there we go |
04:17:39 | FromDiscord | <ElegantBeef> Choosenim lets you change to any version of nim and even build from head |
04:17:54 | FromDiscord | <ElegantBeef> gitnim is probably equally as smart but just uses git instead of ssl 😄 |
04:18:27 | disruptek | no, gitnim is much simpler. that's the point. |
04:18:30 | FromDiscord | <j-james> `sudo pakku -S nim-git` |
04:18:35 | FromDiscord | <Cypheriel> uh I don't see the reason to need anything but the latest stable, though |
04:18:45 | FromDiscord | <Cypheriel> well... not yet |
04:18:47 | disruptek | ~gitnim |
04:18:48 | disbot | gitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek |
04:19:09 | FromDiscord | <ElegantBeef> bugs/packages that rely on older nim 😄 |
04:19:17 | FromDiscord | <shadow.> haha yeah |
04:19:30 | disruptek | i'm about to stop supporting earlier nims and just live at head. |
04:19:44 | FromDiscord | <shadow.> disruptek: i tried useVersion:1.0 and it worked fine but ig ill try installing 1.0 and see the issue |
04:19:51 | disruptek | okay. |
04:20:02 | FromDiscord | <shadow.> yeah fuck it, screw old nimions just merge expect lol |
04:20:12 | FromDiscord | <shadow.> jk |
04:20:59 | FromDiscord | <Cypheriel> what on Earth are nimions |
04:21:27 | FromDiscord | <shadow.> programmers with brains |
04:21:56 | FromDiscord | <shadow.> in contrast to say the white boomers of c#↵- elegantbeef |
04:22:55 | FromDiscord | <ElegantBeef> why am i a boomer? |
04:23:38 | FromDiscord | <shadow.> no werent you the one who said c# was white boomers |
04:23:43 | FromDiscord | <shadow.> i was quoting you |
04:23:51 | FromDiscord | <shadow.> not calling you a boomer |
04:23:58 | * | narimiran joined #nim |
04:24:21 | FromDiscord | <shadow.> im convinced java programmers are just professional typists who need an excuse to type entire essays of meaningless words |
04:25:57 | FromDiscord | <j-james> what, you don't like typing `public static void main(String[] args) {}` every time you want to run a quick scrap of code? |
04:26:02 | FromDiscord | <Cypheriel> "Wait, if Go has Gophers, and Python has Pythonistas, Rust has Rustaceans and C# has White Boomers" - Esbeesy |
04:26:53 | FromDiscord | <shadow.> ahh esbeesy not beef my bad |
04:27:38 | FromDiscord | <shadow.> i dont mind needing a class and a main function, what i mind is ThisCouldActuallyBeAValidSTLClassName |
04:28:39 | FromDiscord | <Cypheriel> Well. I tried getting choosenim |
04:28:48 | FromDiscord | <Cypheriel> I don't understand what the heck I've done but I don't think it worked |
04:28:52 | FromDiscord | <Quibono> lol |
04:28:57 | FromDiscord | <Quibono> I'm laughing with you |
04:28:57 | FromDiscord | <shadow.> gitnim is sexier |
04:29:04 | FromDiscord | <shadow.> sexier approach is better |
04:29:08 | FromDiscord | <Quibono> nimble is the og sexy |
04:29:13 | FromDiscord | <shadow.> therefore gitnim is the way |
04:29:17 | FromDiscord | <shadow.> no, nimph |
04:29:17 | FromDiscord | <j-james> `sudo pacman -S nim` will always be there for you |
04:29:30 | FromDiscord | <shadow.> nimph is sexier |
04:30:03 | FromDiscord | <shadow.> idk why i plug disruptek repos so much but they are pretty useful |
04:30:42 | FromDiscord | <Cypheriel> uh |
04:30:46 | FromDiscord | <Cypheriel> What've I done |
04:30:50 | FromDiscord | <ElegantBeef> Yea shadow i knew something was up cause i'd never say that |
04:33:37 | FromDiscord | <shadow.> yeah it was esbeesy whoops |
04:34:31 | FromDiscord | <Cypheriel> Why do I feel like learning Linux is harder than learning any programming language |
04:34:33 | FromDiscord | <Cypheriel> My brain hurts |
04:35:32 | FromDiscord | <Cypheriel> Never mind! I did something |
04:35:39 | FromDiscord | <shadow.> there we go |
04:35:50 | FromDiscord | <Cypheriel> apparently adding the export thing to `~/.profile` wasn't enough |
04:35:58 | FromDiscord | <Cypheriel> I had to add it to `~/.bashrc` |
04:36:13 | FromDiscord | <j-james> `~/.profile` should be enough, you'd just need to reboot |
04:36:14 | FromDiscord | <shadow.> at least you're not on windows where you need a windows search, 4 popup layers, and gui just to edit path |
04:36:24 | FromDiscord | <Cypheriel> Oh, that would make a lot of sense |
04:36:37 | FromDiscord | <Cypheriel> Welp time to remove it from `~/.bashrc` |
04:36:49 | FromDiscord | <j-james> or type `source ~/.profile` into each terminal instance |
04:37:58 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HfH |
04:38:42 | FromDiscord | <shadow.> (edit) "https://play.nim-lang.org/#ix=2HfH" => "https://play.nim-lang.org/#ix=2HfJ" |
04:39:53 | FromDiscord | <Cypheriel> Technically, yeah |
04:41:23 | FromDiscord | <Rebel> you can just use powershell to edit path lol |
04:41:39 | FromDiscord | <shadow.> smart |
04:44:50 | * | cypheriel_ joined #nim |
04:48:33 | * | cypheriel_ left #nim (#nim) |
04:49:20 | FromDiscord | <ElegantBeef> Make it the `winblows` nim package |
05:02:25 | * | thomasross quit (Ping timeout: 240 seconds) |
05:25:26 | * | habamax joined #nim |
05:27:33 | * | fowl quit (Ping timeout: 272 seconds) |
05:28:14 | * | kwilczynski quit (Ping timeout: 264 seconds) |
05:28:52 | * | fowl joined #nim |
05:29:18 | * | kwilczynski joined #nim |
05:46:44 | FromDiscord | <mikabozu> Hiya, all. Just finished AoC Day 9 |
05:47:01 | FromDiscord | <mikabozu> Glad that 8 & 9 weren't so bad after the nightmare that was day 7 |
05:47:14 | FromDiscord | <mikabozu> Took me 3.5 hours >.> |
05:48:27 | FromDiscord | <ElegantBeef> Grats, 3.5 hours for all three? |
05:48:58 | FromDiscord | <mikabozu> Just for 7 😦 |
05:49:03 | FromDiscord | <ElegantBeef> Oh |
05:49:37 | FromDiscord | <mikabozu> Others were like 20 min.. but I guess I'm missing some cs knowledge that I needed for that day |
05:50:00 | FromDiscord | <ElegantBeef> Yea 7 was a bit of work, took me the longest i think |
05:50:06 | FromDiscord | <ElegantBeef> Have you looked at other solutions? |
05:50:17 | FromDiscord | <mikabozu> Not yet. Any recommendations? |
05:50:23 | FromDiscord | <mikabozu> Did zevv use npeg |
05:50:27 | FromDiscord | <ElegantBeef> Yea |
05:50:40 | FromDiscord | <ElegantBeef> Well here is mine if you want to read it https://play.nim-lang.org/#ix=2Hg1 |
05:50:51 | FromDiscord | <mikabozu> Thanks! Will do |
05:54:01 | FromDiscord | <j-james> Day 7 was a pain, yeah |
05:54:11 | FromDiscord | <j-james> This is what my cleaned-up solution looked like: https://play.nim-lang.org/#ix=2Hf1 |
05:55:58 | FromDiscord | <j-james> (also, today's: https://play.nim-lang.org/#ix=2Hg4) |
05:56:45 | ForumUpdaterBot | New thread by Jiyinyiyong: Any way to extra version info from <project>.nimble file?, see https://forum.nim-lang.org/t/7231 |
05:57:04 | FromDiscord | <bark> what do you folks recommend for making an android app in nim? |
05:57:48 | FromDiscord | <bark> (I j hate the android sdk, it doesn't have to be close to it. I really would use SDL rather than the SDK if I have to) |
05:58:16 | FromDiscord | <bark> (edit) "to)" => "any choice)" |
05:58:31 | FromDiscord | <ElegantBeef> Well you could try nimx or fidget, they both can publish to mobile afaik |
05:58:37 | FromDiscord | <ElegantBeef> although fidgets api is going to change soon |
06:00:08 | FromDiscord | <bark> what about accessing OS specific components? |
06:00:39 | FromDiscord | <bark> like setting an alarm? (that wakes up the app from sleep, if possible even from a phone turned off) |
06:00:46 | FromDiscord | <bark> or pushing notifications |
06:00:58 | FromDiscord | <ElegantBeef> You'll have to use java and the like to glue together |
06:02:59 | FromDiscord | <bark> I see |
06:08:15 | FromDiscord | <bark> oh I found android JS, where you can electron android apps |
06:08:35 | FromDiscord | <bark> I could do the noob developer move 🤔 |
06:37:48 | FromDiscord | <Rebel> Kotlin is also an option |
06:54:39 | FromDiscord | <Idefau> cant you use ndk for OS specific stuff too? |
06:57:23 | * | kungtotte quit (Read error: Connection reset by peer) |
07:00:15 | * | kungtotte joined #nim |
07:37:15 | * | PMunch joined #nim |
07:47:39 | FromGitter | <offbeat-stuff> Hi |
07:47:48 | FromGitter | <offbeat-stuff> How to throw errors in nim |
07:48:15 | mipri | !eval raise newException(ValueError, "example") |
07:48:16 | NimBot | /usercode/in.nim(1) in↵Error: unhandled exception: example [ValueError] |
08:04:59 | FromDiscord | <bark> thatt still means java code |
08:05:08 | FromDiscord | <Idefau> a |
08:08:57 | * | JustASlacker quit (Remote host closed the connection) |
08:17:34 | * | Tanger quit (Remote host closed the connection) |
08:22:03 | FromDiscord | <lqdev> b |
08:22:10 | * | PMunch quit (Ping timeout: 260 seconds) |
08:22:29 | * | PMunch joined #nim |
08:26:31 | FromDiscord | <ache of head> c |
08:29:37 | * | Vladar joined #nim |
08:30:46 | FromDiscord | <j-james> d |
08:30:57 | PMunch | e |
08:37:20 | FromGitter | <sealmove> f |
08:37:40 | * | mbomba joined #nim |
08:42:08 | FromDiscord | <Rika> g |
08:42:25 | narimiran | h |
08:45:08 | FromDiscord | <ElegantBeef> i |
08:50:20 | FromDiscord | <Vindaar> j |
08:54:54 | Clonkk[m] | k |
08:55:28 | FromDiscord | <haxscramper> l |
09:21:38 | FromDiscord | <kenran> sent a long message, see http://ix.io/2HgP |
09:22:30 | FromDiscord | <ElegantBeef> Is there a way in the stdlib to iterate a slice of an openArray without making a new one? |
09:24:16 | FromDiscord | <ElegantBeef> I'm not expert in threading, but just follow the threading manual. https://nim-lang.org/docs/threads.html I suppose channels would be the best for that thread communication but i could be wrong |
09:26:58 | FromDiscord | <ElegantBeef> Something like this is my question https://play.nim-lang.org/#ix=2HgT |
09:32:14 | * | audiofile joined #nim |
09:32:23 | FromDiscord | <hugogranstrom> @ElegantBeef are you also on the openarray track for todays AoC? |
09:32:42 | FromDiscord | <ElegantBeef> I'm done, but toying around optimizing it made me think about that |
09:32:53 | FromDiscord | <lqdev> @kenran there's also an easier API you can use for threading https://nim-lang.org/docs/threadpool.html |
09:32:56 | narimiran | hehe, i'm also using OA today |
09:33:13 | FromDiscord | <hugogranstrom> Experimental gang B) |
09:33:25 | narimiran | doesn't `for x in xs.toOpenArray(lo, hi):` work for you? |
09:33:40 | FromDiscord | <hugogranstrom> Isn't the overhead in creating a new openArray quite small? |
09:34:06 | * | PMunch quit (Ping timeout: 256 seconds) |
09:34:15 | narimiran | i have a version with OAs without the need for experimental flag |
09:34:16 | FromDiscord | <ElegantBeef> I was doing normal `data[low..high]` |
09:34:30 | FromDiscord | <ElegantBeef> with a seq and not an openarray |
09:34:32 | audiofile | hi is orc > arc |
09:34:48 | FromDiscord | <lqdev> depends |
09:35:48 | FromDiscord | <ElegantBeef> Like with `seq[slice]` it returns a new seq, which i was attempting to avoid |
09:35:56 | narimiran | audiofile: yes, 'o' > 'a' |
09:35:56 | FromDiscord | <hugogranstrom> oh so that's possible as well 😮 |
09:37:21 | FromDiscord | <ElegantBeef> would `toOpenArray` work as a replacement for my example? |
09:37:36 | narimiran | it works in my code :) |
09:37:38 | FromDiscord | <hugogranstrom> I think so |
09:38:26 | FromDiscord | <hugogranstrom> Oh so if I don't assign my openArray to an lvalue I don't need the experimental flag? |
09:38:48 | narimiran | yep |
09:39:06 | FromDiscord | <ElegantBeef> Ah it does work as a replacement in my example, but it's very unclear to why it's being used 😄 |
09:39:32 | narimiran | my today's motto: if it is ugly but it works....... |
09:39:34 | FromDiscord | <ElegantBeef> the name `toOpenArray` is weird |
09:39:40 | FromDiscord | <ElegantBeef> Well i mean just in general |
09:39:54 | FromDiscord | <hugogranstrom> I see, that's pretty neat. Think I'll keep my experimental version though hehe |
09:40:00 | FromDiscord | <hugogranstrom> haha |
09:40:07 | FromDiscord | <ElegantBeef> I honestly feel like `items` should take a `Hslice` but yea good luck getting that accepted |
09:40:38 | * | PMunch joined #nim |
09:40:46 | FromDiscord | <hugogranstrom> Or some way to take a `lent` slice of an seq |
09:41:00 | FromDiscord | <ElegantBeef> well i mean `items(slice)` seems fairly straightforward what it's dooing |
09:41:02 | PMunch | I'm still waiting with my AoC so I can stream it later :) |
09:41:10 | * | hmmmmm joined #nim |
09:41:12 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:41:16 | PMunch | It's kinda torture :P |
09:41:18 | hmmmmm | g'day fellas |
09:41:24 | PMunch | Hi hmmmmm |
09:41:29 | hmmmmm | explain this to me: pls https://play.nim-lang.org/#ix=2Hh6 |
09:41:31 | FromDiscord | <Rika> good day hm+ |
09:41:32 | hmmmmm | hi munchie! |
09:41:43 | FromDiscord | <ElegantBeef> That hmm has more Ms it's an imposter |
09:41:53 | narimiran | hmmmmm: floating points are not exact |
09:41:53 | FromDiscord | <ElegantBeef> That's aurl 😄 |
09:42:00 | FromDiscord | <lqdev> damn this makes me want a `slice` iterator in stdlib https://play.nim-lang.org/#ix=2Hh7 |
09:42:05 | FromDiscord | <ElegantBeef> floating point impercision |
09:42:10 | narimiran | hmmmmm: you know that `0.1 + 0.2 != 0.3`, right? |
09:42:12 | PMunch | hmmmmm, that's just how floating point numbers work |
09:42:24 | FromDiscord | <ElegantBeef> @lqdev glad it's not me |
09:42:24 | hmmmmm | :0 |
09:42:27 | FromDiscord | <ElegantBeef> (edit) "@lqdev glad it's not ... me" added "just" |
09:42:51 | PMunch | narimiran, isn't that only for single precision? |
09:43:01 | FromDiscord | <Rika> any sort of binary representation of all fractional values are imprecise in some range of value i believe |
09:43:06 | FromDiscord | <ElegantBeef> @lqdev https://play.nim-lang.org/#ix=2Hh8 use mine and make a PR to get shot down 😛 |
09:43:29 | FromDiscord | <ElegantBeef> I guess it should be a Slice instead |
09:43:38 | PMunch | @sealmove, are you around? |
09:43:54 | FromDiscord | <sealmove> @PMunch yeah |
09:43:56 | FromDiscord | <Rika> they are not around, theyre sealmove duh |
09:44:00 | FromDiscord | <Rika> cant u read smh smh |
09:44:10 | FromDiscord | <ElegantBeef> I do really think there should be a more clear non allocating slice iterator for all types |
09:44:29 | FromDiscord | <lqdev> yeah |
09:44:33 | PMunch | @sealmove, I'm looking at your new stuff for binaryparse, and I like what I see |
09:44:36 | FromDiscord | <lqdev> like a{1..2} that could be used :p |
09:44:56 | FromDiscord | <ElegantBeef> I did kinda want `^[]` but yea |
09:44:58 | PMunch | But I was thinking, would it be able to make this more plug-able/extendable? |
09:44:58 | FromDiscord | <sealmove> @PMunch this makes me happy 🙂 |
09:45:04 | FromDiscord | <ElegantBeef> the `^` is a point, so it makes sense 😛 |
09:45:17 | FromDiscord | <lqdev> well you can do that |
09:45:43 | FromDiscord | <ElegantBeef> You sure? |
09:45:45 | FromDiscord | <sealmove> well I am open to ideas, do you have something other way in mind? |
09:46:03 | PMunch | I mean the original binaryparse can parse any binary format as it allows you to mix in custom parsers |
09:46:20 | PMunch | So all this is really just adding convenience for certain kinds of things |
09:46:29 | FromDiscord | <sealmove> but if everything has to be custom then it doesn |
09:46:35 | FromDiscord | <sealmove> t serve its purpose well |
09:46:38 | PMunch | True |
09:46:47 | PMunch | But typically you end up in a mix |
09:47:16 | FromDiscord | <sealmove> with my features making the tuple by hand will be extremely rare |
09:47:17 | FromDiscord | <lqdev> @ElegantBeef https://play.nim-lang.org/#ix=2Hhb |
09:47:30 | FromDiscord | <ElegantBeef> Ah |
09:47:36 | PMunch | For example your Option type parsing could easily be implemented with a small shim custom parser that returns either none(<type>) or calls a parser and returns some(value) |
09:48:09 | narimiran | @lqdev we're talking about slices of openArray |
09:48:14 | PMunch | Some for the looping thing, that can easily be done by calling a custom parser that just loops another parser |
09:48:15 | FromDiscord | <ElegantBeef> I mean i wasnt |
09:48:22 | FromDiscord | <ElegantBeef> I was talking about slices of arrays/sequences |
09:48:28 | FromDiscord | <ElegantBeef> Non allocating ones |
09:48:32 | narimiran | something less verbose than `for x in xs.toOpenArray(lo, hi):` |
09:48:38 | FromDiscord | <ElegantBeef> yea |
09:48:43 | narimiran | where `xs` is already an openArray |
09:48:50 | PMunch | So I was thinking, what if the {} syntax was simply a way to hook these small wrapper procedures around that parsing step |
09:49:06 | FromDiscord | <ElegantBeef> Again in my case xs is a seq, or an array |
09:49:22 | narimiran | OA covers those too ;) |
09:49:52 | FromDiscord | <sealmove> PMunch, that's essentially what is happening, but to wrap _fields_ instead of parsers, it has to be in the codegen |
09:50:18 | PMunch | Well it doesn't *have* to be |
09:50:47 | PMunch | I mean the generator could just generate a sub-parser and wrap it |
09:51:08 | FromDiscord | <ElegantBeef> AH i see the issue, didnt notice lqdev left out the openarray 😄 |
09:51:32 | FromDiscord | <ElegantBeef> is the `slice` iterator too unclear? 😄 |
09:51:57 | PMunch | That way people could also write their own |
09:51:59 | FromDiscord | <sealmove> indeed. your idea could work but I doubt it would be easier to implement. also the main repo will need support for the {} syntax anyway |
09:52:13 | hmmmmm | ok and how about this now |
09:52:14 | hmmmmm | https://play.nim-lang.org/#ix=2Hhe |
09:52:14 | PMunch | Oh yeah, it won't be easier to implement :P |
09:52:46 | FromDiscord | <ElegantBeef> Again |
09:52:47 | FromDiscord | <ElegantBeef> Floats |
09:52:54 | hmmmmm | b-b-but |
09:52:55 | hmmmmm | round! |
09:53:01 | FromDiscord | <ElegantBeef> but floats |
09:53:04 | hmmmmm | :| |
09:53:20 | FromDiscord | <ElegantBeef> If you want a value to be exact use an int |
09:53:31 | FromDiscord | <ElegantBeef> floats are a bastardized version of base 10 slid into base 2 😄 |
09:53:48 | FromDiscord | <sealmove> what are the real benefits of the approach? |
09:53:57 | PMunch | hmmmmm, https://docs.python.org/3/tutorial/floatingpoint.html |
09:54:17 | FromDiscord | <ElegantBeef> Look at it this way for 32bits 0-4294967296 is all the possible values of ints, but floats say you can have -inf to inf |
09:54:38 | FromDiscord | <ElegantBeef> You're going to lose accuracy across that range |
09:55:22 | FromDiscord | <sealmove> I mean, let's say we do implement it as you propose. What's the difference? |
09:55:51 | PMunch | sealmove, well the extensions you have now aren't universally needed (I for one have never needed any of them for the binary formats I have parsed with binaryparse). And by making them plugable we allow the user to write their own extensions without having to contribute to binaryparse |
09:56:04 | FromDiscord | <lqdev> @sealmove you can now have a decimal point |
09:56:15 | FromDiscord | <lqdev> oh you were talking to pmunch |
09:56:22 | PMunch | Haha |
09:56:32 | FromDiscord | <lqdev> i thought you were arguing with beef XD |
09:56:52 | hmmmmm | ok then, explain this: https://www.online-python.com/H1IsNhTR5q |
09:56:56 | hmmmmm | :| |
09:57:05 | FromDiscord | <ElegantBeef> Python uses different floats |
09:57:17 | FromDiscord | <Rika> python still uses imprecise floats |
09:57:21 | FromDiscord | <Rika> they just hide it from you |
09:57:33 | FromDiscord | <Rika> at least thats what i recall what python does |
09:57:38 | hmmmmm | hmmm |
09:57:43 | FromDiscord | <sealmove> oh, so you say use will somehow be able to define option keys |
09:57:45 | hmmmmm | I want the python version :| |
09:57:48 | FromDiscord | <hugogranstrom> Beef has a beef with everyone (I'll find my way to the door myself (: ) |
09:57:49 | FromDiscord | <sealmove> hmm this is interesting |
09:58:03 | FromDiscord | <Rika> it isnt going to change anything other than how its shown to you |
09:58:11 | FromDiscord | <Rika> errors will still accumulate |
09:58:11 | FromDiscord | <lqdev> hmmmmm: https://github.com/JohnAD/decimal128 |
09:58:42 | FromDiscord | <Rika> i have to go, the shop im visiting is about to close |
09:58:45 | FromDiscord | <ElegantBeef> !eval import strformat; echo fmt"{70.43:2}" |
09:58:47 | hmmmmm | oh lqdev that seems interesting |
09:58:49 | NimBot | 70.43 |
09:58:56 | FromDiscord | <ElegantBeef> There you go bub 😄 |
09:59:11 | hmmmmm | beefy what is that sorcery :o |
09:59:21 | FromDiscord | <ElegantBeef> strformat let's you cutoff decimals |
09:59:27 | hmmmmm | :O |
09:59:31 | FromDiscord | <Rika> !eval import strformat; echo &"{0.1+0.2:2}" |
09:59:34 | NimBot | 0.3 |
09:59:42 | FromDiscord | <Rika> !eval echo 0.1+0.2 |
09:59:43 | hmmmmm | :O |
09:59:45 | NimBot | 0.3 |
09:59:45 | FromDiscord | <ElegantBeef> Huzah we hid the following 0s |
09:59:53 | FromDiscord | <Rika> well its still hidden here |
09:59:54 | FromDiscord | <ElegantBeef> !eval echo 70.43 |
09:59:56 | NimBot | 70.43000000000001 |
09:59:59 | FromDiscord | <ElegantBeef> Nope |
10:00:10 | FromDiscord | <Rika> do we hide subnormal errors? |
10:00:24 | FromDiscord | <Rika> i really gtg lmao |
10:00:54 | FromDiscord | <ElegantBeef> Buh bye |
10:01:14 | FromDiscord | <ElegantBeef> So where would be the best place for those slice iterators? |
10:01:44 | FromDiscord | <ElegantBeef> Cause i'm looking at the `iterators` module, but i know that the system stuff is typically off limits 😄 |
10:02:35 | FromDiscord | <kenran> oh, when and where are you streaming if I may ask? |
10:03:08 | FromDiscord | <ElegantBeef> Pmunch ^ |
10:03:17 | FromDiscord | <ElegantBeef> ~~Discord replies dont do anything for those distant folks~~ |
10:03:34 | PMunch | @kenran, as soon as I'm done at work pretty much |
10:03:44 | PMunch | So 3:15PM UTC |
10:04:04 | FromDiscord | <ElegantBeef> But it's 3am here 😛 |
10:04:18 | FromDiscord | <kenran> ah dang, too early for me then. are they being recorded? |
10:04:31 | FromDiscord | <kenran> and where is it, twitch? |
10:04:35 | FromDiscord | <sealmove> @PMunch Hmm, how could we implement this? We need an API for allowing user to define wrappers in a generic way (not bound to any particular parser) |
10:04:48 | supakeen | decorators? |
10:05:04 | FromDiscord | <ElegantBeef> Nah they're too expensive for my tastes |
10:06:14 | PMunch | @kenran, Twitch and YouTube, and they are recorded on YouTube |
10:06:25 | PMunch | So far I've only streamed 6 and 8 though |
10:06:40 | PMunch | But I think I'll try to stream all the coming ones |
10:07:05 | PMunch | @sealmove, yeah, something similar to how custom parsers are |
10:08:35 | PMunch | I guess it could be very similar to how the current custom parsers work, but you need to get a procedure to call to parse that exact field |
10:09:03 | PMunch | And some way to make sure that the sub-byte positions and such are updated properly in the main parser |
10:09:22 | FromDiscord | <Cypheriel> Is there any reason to use MS VSCode over VSCodium for Nim? I know the pacman `code` doesn't have the Nim extension for some reason |
10:10:18 | FromDiscord | <Cypheriel> ah nvm. VSCodium doesn't either |
10:10:27 | FromDiscord | <ElegantBeef> They use an open source registry now |
10:10:29 | PMunch | Hmm, that's weird |
10:10:33 | PMunch | Ah |
10:10:41 | PMunch | So the Nim plug-in should be put in that registry as well? |
10:10:46 | FromDiscord | <ElegantBeef> Yea |
10:10:53 | FromDiscord | <sealmove> ok noted, I'll try to do it, although I am a bit scared :3 sounds hard |
10:10:57 | FromDiscord | <Cypheriel> There's one there, but it's not the "official" one |
10:11:03 | FromDiscord | <Cypheriel> Should I just use that? |
10:11:08 | FromDiscord | <ElegantBeef> What is it? |
10:11:10 | PMunch | @sealmove, good things usually are hard |
10:11:18 | PMunch | Err, that came out wrong... |
10:11:19 | FromDiscord | <Cypheriel> Um it looks like the exact same thing but it's a different author |
10:12:06 | FromDiscord | <ElegantBeef> https://open-vsx.org/ |
10:12:13 | FromDiscord | <ElegantBeef> There's the opensource code registry now |
10:12:39 | FromDiscord | <Cypheriel> https://i.imgur.com/r6DhijP.png |
10:13:10 | FromDiscord | <ElegantBeef> Yea it's probably just a reupload by someone |
10:13:17 | FromDiscord | <Cypheriel> Funnily enough this one has had updates as late as november |
10:13:41 | FromDiscord | <Cypheriel> https://i.imgur.com/eHKkSHl.png |
10:14:08 | FromDiscord | <ElegantBeef> Can always get the nimlsp powered one from here https://marketplace.visualstudio.com/items?itemName=bung87.nim |
10:14:33 | FromDiscord | <Cypheriel> except I would assume that means I have to use the MS branded VSCode |
10:14:37 | FromDiscord | <ElegantBeef> Nope |
10:14:46 | FromDiscord | <ElegantBeef> Oh i meant to link the git |
10:14:59 | FromDiscord | <Cypheriel> Oh, lol |
10:15:23 | FromDiscord | <ElegantBeef> It's on that page, if you want to build it, but the one you got is probably fine |
10:16:30 | FromDiscord | <Cypheriel> No clue, it may or may not even end up being better than the current one |
10:16:38 | FromDiscord | <Cypheriel> considering that one hasn't been updated since March |
10:17:37 | PMunch | !eval proc ᚛ᚅᚔᚋ᚜= echo "᚛ᚅᚔᚋ᚜"; ᚛ᚅᚔᚋ᚜() |
10:17:40 | NimBot | <no output> |
10:18:10 | FromDiscord | <Cypheriel> oh my |
10:23:14 | * | Vladar quit (Quit: Leaving) |
10:25:38 | FromDiscord | <kenran> ah, that looks promising as well, but the `channels` module says it's not fit to be used with `spawn` yet I think |
10:25:53 | FromDiscord | <lqdev> i'm not sure why though |
10:26:09 | FromDiscord | <lqdev> i guess the only reason is that it's not tested very well |
10:28:00 | FromDiscord | <kenran> I'm not sure that I want to use channels for sharing data between the threads anyway, but as you can see I know next to nothing wrt concurrency/parallelism in low-level languages 😄 |
10:28:18 | FromDiscord | <j-james> @Cypheriel ohh it's a different registry |
10:28:39 | FromDiscord | <j-james> i have literally been wondering for months where all my extensions went in the sidebar |
10:28:44 | FromDiscord | <kenran> I could probably do it with channels first and see how that goes, then try using a mutable var and a lock perhaps and compare those methods? |
10:28:51 | FromDiscord | <j-james> that makes so much SENSE |
10:29:16 | FromDiscord | <kenran> I'm a bit irritated because channels deep-copy the objects that are sent, and I'd probably send the whole state of the application. |
10:29:18 | FromDiscord | <Cypheriel> Haha at first I thought maybe it was because I was on Linux but then I remembered that other people here use Linux too |
10:30:19 | FromDiscord | <sealmove> @PMunch for now I will focus on implementing core features and parse the `{option: value}` syntax into a `Table[string, NimNode]` and do nothing with it. Then we can think about the API you proposed. Would you merge the changes after core features are implemented? |
10:30:35 | FromDiscord | <sealmove> I will update the documentation to explain the plugin idea |
10:31:13 | PMunch | What core features are you thinking about? |
10:34:16 | * | Cthalupa quit (Ping timeout: 240 seconds) |
10:35:56 | * | Cthalupa joined #nim |
10:36:49 | FromDiscord | <sealmove> Everything that's not in {Options}. first part (Type) is unchanged but I want some changes in the last part - sequences and assertion |
10:38:20 | FromDiscord | <sealmove> Other than specific number of repetition, I want to allow terminating sequence by arbitrary condition. Also assertions should allow for testing against a Nim expression, not just ints and strings |
10:40:13 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Hhw |
10:41:46 | FromDiscord | <sealmove> Do you like this? |
10:47:38 | PMunch | Yeah that's fine |
10:48:07 | PMunch | Or, hmm |
10:48:27 | PMunch | That could also be implemented as a custom wrapper over a parser.. |
10:49:20 | FromDiscord | <sealmove> it's not that easy in this case, because the syntax is more firm. Options will be key-value pairs and user will be able to define the keys. |
10:49:52 | PMunch | Oh for sure |
10:49:58 | FromDiscord | <sealmove> sure we could implement repetition as plugins, this is how kaitai does it |
10:50:19 | FromDiscord | <sealmove> for example `{repeat: until, repeat-expr: stream.atEnd}` |
10:50:33 | PMunch | I was just saying that the repetition stuff is something that can be written as a custom parser. Which you probably want to do if you have some complex logic there anyways |
10:50:36 | FromDiscord | <sealmove> do you prefer this (I think I don't) |
10:51:52 | PMunch | Oh no, I definitely don't prefer that |
10:52:28 | FromDiscord | <sealmove> cool, then it has to be in core features :ρ |
10:56:35 | * | abm joined #nim |
10:57:08 | FromDiscord | <Cypheriel> ah, yes. How have I not heard of format strings earlier? This is great |
10:58:10 | FromDiscord | <sealmove> Btw @PMunch I don't know how to do this thing with doc generation. Would you mind doing it yourself (or not at all) after we merge the PR? |
10:58:55 | PMunch | doc generation? |
10:59:28 | FromDiscord | <sealmove> this thing with `nim doc2 binaryparse.nim` and nimtorst |
10:59:31 | PMunch | Oh, to generate the README from the source file? |
10:59:37 | FromDiscord | <sealmove> yup |
10:59:45 | PMunch | Ah, it's not actually using the output of that |
10:59:52 | PMunch | The nimtorst script is all you need |
11:00:00 | PMunch | Just run that and it should update the README |
11:00:33 | narimiran | @ElegantBeef, @hugogranstrom now i have a version without any `toOpenArray`. and it is twice as fast as before :D :D |
11:00:47 | PMunch | It's basically some silly sed logic that pulls out all lines that starts with unindented ## |
11:01:01 | FromDiscord | <sealmove> will markdown work? |
11:01:59 | PMunch | Uhm, no? |
11:02:57 | FromDiscord | <hugogranstrom> narimiran: wow, what did you change it to? :o |
11:03:13 | FromDiscord | <sealmove> ok so I have to convert my README.md to rst and then add it at the top of binaryparse.nim and add `##`s |
11:03:52 | PMunch | Pretty much |
11:04:21 | narimiran | @hugograntrom i changed my logic a bit (in several places), but now everything is `for i in lo..hi:` and then use `mySeq[i]` |
11:04:49 | narimiran | but i think the main speedup is *not* from removing toOpenArray |
11:05:07 | supakeen | How do I get 'around' a "is not GC-safe": https://bpa.st/raw/DY3Q |
11:05:17 | narimiran | i was creating some unnecessary stuff in my original version |
11:05:25 | supakeen | I am wanting to wait on a few Redis keys with the blocking pop in threads. |
11:05:31 | * | Vladar joined #nim |
11:05:36 | FromDiscord | <haxscramper> You can use `## .. include:: <otherfile>.rst` to avoid pasting whole thing as comment |
11:06:36 | FromDiscord | <sealmove> wha... |
11:07:08 | PMunch | Eeeh |
11:07:10 | PMunch | Not for this |
11:07:17 | PMunch | It doesn't actually hook into Nims tooling... |
11:07:21 | PMunch | Unfortunately |
11:07:24 | FromDiscord | <haxscramper> It does |
11:07:41 | PMunch | Does GitHub support that? |
11:08:18 | FromDiscord | <haxscramper> What kind of support we are talking about? |
11:08:58 | supakeen | Or is the `nim-lang/redis` package not a working option if I want to use `redis` in threads. |
11:10:10 | FromDiscord | <haxscramper> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/pegs.nim#L15 nim stdlib uses this for some modules too |
11:10:53 | PMunch | Yes, but this doesn't use the Nim doc parsing/rendering |
11:11:15 | PMunch | It just rips the module doc comment out into an rst file and lets GitHub display it |
11:14:46 | FromDiscord | <haxscramper> Well, I don't really understand what exactly do you mean by that, but my point was only about ability to just write regular rst file and include it in documentation, without need to prefix everything with `##` (or wrap in `##[ ]##`) |
11:15:32 | FromDiscord | <haxscramper> And then edit said file like normal rst, with all syntax highlighting of proper rst |
11:15:42 | PMunch | Yes, and I was saying that since this isn't the Nims rst tooling that might not be supported.. |
11:16:15 | PMunch | I guess the binaryparse.nim file could `.. include:: README.rst` though |
11:19:34 | FromDiscord | <hugogranstrom> narimiran: oh that's a pretty obvious way to do it now that you say it |
11:19:41 | narimiran | :) |
11:20:00 | supakeen | Mrm. |
11:20:59 | FromDiscord | <hugogranstrom> Would be interesting to see what difference toOpenArray does on its own as well. |
11:21:21 | FromDiscord | <hugogranstrom> Will see if I can test it on my version later today |
11:22:44 | supakeen | Nope, I thought I found it but I just wasn't familiar with multisync. |
11:22:58 | FromDiscord | <hugogranstrom> I did check my current version excluding the loading of the file and parsing the numbers and it was sub 0.1ms with -d:danger so perhaps it won't be noticable at all |
11:24:29 | supakeen | In this proc: https://bpa.st/7DZQ what makes it not pass gcsafe? :) |
11:37:40 | * | mbomba quit (Quit: WeeChat 3.0) |
11:42:32 | FromDiscord | <skyhawk172> anyone know how to create a IntSet of values from 0 to 1023? I've tried `[0..1023].toIntSet()` and other variations thereof and keep getting a type mismatch error: `proc toIntSet(x: openArray[int]): IntSet↵ first type mismatch at position: 1↵ required type for x: openArray[int]↵ but expression '[0 .. 1023]' is of type: array[0..0, HSlice[system.int, system.int]]` |
11:42:41 | FromDiscord | <skyhawk172> (edit) "a" => "an" |
11:44:00 | FromDiscord | <lqdev> `0..1023` constructs a slice |
11:44:11 | FromDiscord | <lqdev> so you're creating an array with a single slice inside of it |
11:45:17 | FromDiscord | <InventorMatt> it may not be the most efficient way to do it but https://play.nim-lang.org/#ix=2HhX this works |
11:47:02 | FromDiscord | <skyhawk172> Thanks @InventorMatt, I was hoping to avoid that but if there's no better way.. |
11:47:23 | FromDiscord | <skyhawk172> (edit) "that" => "the intermediate sequence" |
11:48:22 | FromDiscord | <sealmove> ok @PMunch, I laid out the idea. check the updated README. |
11:51:04 | FromDiscord | <InventorMatt> if you want to keep it simple and just 1 line I don't think there is a better way but you could just use a for loop and populate that way which is what toseq does behind the scenes |
11:56:01 | * | antranigv quit (Remote host closed the connection) |
11:56:09 | * | Perkol joined #nim |
11:56:54 | * | antranigv joined #nim |
11:57:25 | narimiran | @hugogranstrom how do you measure it without loading and parsing? you time it in your code and execute only once? |
11:58:36 | FromDiscord | <hugogranstrom> I load and parse it once in the beginning. Then I ran it in a loop and passed the parsed numbers to the procs |
11:59:51 | FromDiscord | <hugogranstrom> var numbers = parseInput()↵timeit:↵ runPart1(numbers)↵ runPart2(numbers) |
11:59:56 | FromDiscord | <hugogranstrom> Kinda like this |
12:00:27 | narimiran | `timeit` is from some nimble package? |
12:03:04 | narimiran | i usually run my program 100 times with `perf`. now i removed both parts (only input parsing remains), and compared to my full program. less than 0.1ms difference, just like you |
12:03:12 | FromDiscord | <hugogranstrom> Yes, I used my own from Numericalnim but there are surely better ones out there |
12:04:21 | FromDiscord | <hugogranstrom> Oh that's also a neat way to do it :) I'm on windows so I don't have any fancy `perf` |
12:05:32 | FromDiscord | <hugogranstrom> This one looks promising: https://github.com/xflywind/timeit |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:35 | * | supakeen joined #nim |
12:10:25 | * | rockcavera quit (Read error: Connection reset by peer) |
12:10:51 | * | rockcavera joined #nim |
12:14:22 | narimiran | heh, last time that one was mentioned, somebody was getting some microsecond-number, because (i suppose) the code got optimized out on repetitions |
12:15:47 | narimiran | (using `perf`, the same code was in a millisecond-range) |
12:17:37 | ForumUpdaterBot | New thread by LeFF: Windows to Mac OSX cross compiler? , see https://forum.nim-lang.org/t/7232 |
12:19:12 | FromDiscord | <hugogranstrom> oh that's interesting |
12:20:27 | FromDiscord | <hugogranstrom> I think I saw somewhere a `keep()` template but I can't remember where |
12:23:39 | FromDiscord | <hugogranstrom> can't find where I saw it now but its purpose was to make sure the variable wasn't optimized away |
12:34:35 | FromDiscord | <Vindaar> sent a code paste, see https://play.nim-lang.org/#ix=2Hii |
12:36:08 | Zoom[m] | Hm, why doesn't openArray doesn't work for Deques? |
12:36:33 | Zoom[m] | How can I implement a function with a view into a deque? |
12:36:54 | Zevv | because it isnt |
12:37:11 | PMunch | @sealmove, what's the deal with n/r? |
12:37:30 | Zoom[m] | Zevv: "The underlying implementation uses a seq." |
12:37:49 | Zevv | yeah, but it has head and tail pointers chasing each other |
12:37:59 | Zevv | so the contents of the underlying seq might be "5 6 . 1 2 3 4" |
12:38:10 | Zevv | what would you expect from indexing [0] in this case? |
12:38:14 | FromDiscord | <sealmove> @PMunch I couldn't come up with better names for bit endianness since `l` and `b` are reserved for _typical_ endianness. |
12:38:52 | Zevv | Zoom[m]: if you feel brave you could access the dequees 'data' member with a cast |
12:38:54 | Zevv | but then what |
12:39:00 | narimiran | Zoom[m]: is this for today's AoC? |
12:39:01 | PMunch | bit-endianess? |
12:39:19 | Zoom[m] | narimiran: Yep. Doing it the dumb way |
12:39:26 | narimiran | :X |
12:41:04 | FromDiscord | <hugogranstrom> @Vindaar never heard of it before but it seems to seal the deal |
12:41:10 | Zoom[m] | Zevv: I just want to look into every item, in no particular order and don't want my function to require copying |
12:43:00 | FromDiscord | <hugogranstrom> I did also use a deque for part1 and just looping over it did it for me |
12:43:18 | FromDiscord | <sealmove> @PMunch eh we briefly discusses this before. https://github.com/PMunch/binaryparse/pull/8 |
12:43:19 | disbot | ➥ Endian control |
12:43:23 | FromDiscord | <hugogranstrom> `int`s get copied either way |
12:44:57 | FromDiscord | <sealmove> when fields are not byte-aligned, the extra bits can be parsed in either direction |
12:45:01 | PMunch | Ah rigt |
12:47:07 | Zoom[m] | So, how to get a view into a deque? I think I'll get by with {.inline.} for now, but it's not good. |
12:47:30 | Zevv | The implementation does not expose the seq |
12:47:51 | Zevv | so if you really need to you can cast the dequeue to a seq, because I happen to know the seq is the first element of the object type |
12:48:54 | FromDiscord | <pietroppeter> https://github.com/treeform/benchy |
12:49:42 | FromDiscord | <hugogranstrom> Zoom: why do you need a view into it in the firs place? |
12:50:10 | FromDiscord | <hugogranstrom> @pietroppeter that was it! Thanks 🙂 |
12:52:10 | FromDiscord | <pietroppeter> You are welcome. I have tried also criterion which also does a weird trick to avoid optimizing away stuff. Also there is golden but it is for benchmarking execution and compilation and not for measuring parts of code. |
12:52:57 | Zoom[m] | @hugogranstrom Why do you need any view? Visit the contents from a function |
12:53:54 | Zevv | I assume he wants to avoid the copies that might happen |
12:54:21 | FromDiscord | <hugogranstrom> Doesn't the copy only happen if you modify it? |
12:55:01 | hmmmmm | jeebus |
12:55:05 | hmmmmm | floats are hairy |
12:55:41 | hmmmmm | still python makes them somewhat easier to the eye |
12:55:58 | hmmmmm | they hide the 0.000001 unpleasentries and their round() works |
12:57:08 | PMunch | Our round also works.. |
12:57:23 | FromDiscord | <hugogranstrom> @pietroppeter I'll take a look at criterion as well 🙂 |
12:57:39 | Zoom[m] | That's the thing. Nim compiler is described as smart, but if the situation is simple I'd like to just say "don't copy, we're just visiting" and don't scan the docs/resulting C to understand if the copying has actually taken place or not |
12:57:47 | hmmmmm | well our manual says it's unreliable, also it didn't work for my 70.43 case, while python gobbles it easy peasy |
12:58:12 | PMunch | But it did work for 70.43, Python just hides some stuff from you |
12:59:00 | * | planetis[m] joined #nim |
12:59:32 | hmmmmm | well apparently the standard way to handle this stuff is comparing the float to a very small delta, close enough is proxy for equal |
12:59:37 | PMunch | And IMO the manual there is wrong, it's completely reliable |
12:59:38 | FromDiscord | <hugogranstrom> Zoom: I'm perhaps coming at this from a differerent point of view. Do you want to pass the deque to a proc or do you want to return it as a view FROM a proc? |
12:59:57 | PMunch | But it might not give you what you expect, if you don't expect the intricacies of floats |
13:00:08 | FromDiscord | <hugogranstrom> If you want to pass it, can't you pass it as a `var` parameter? |
13:00:35 | FromDiscord | <hugogranstrom> Even if you don't get the benefit of immutability |
13:01:10 | Zoom[m] | @hugogranstrom Yeah, I want to pass it, but var is the complete opposite semantically so it's a no-no |
13:01:26 | planetis[m] | Zoom: this is fixed with arc and lent annotation |
13:01:56 | hmmmmm | munchie: https://play.nim-lang.org/#ix=2Hiq |
13:02:17 | FromDiscord | <Rika> what is wrong |
13:02:20 | FromDiscord | <Rika> i see nothing wrong |
13:02:28 | hmmmmm | round should result 70.43 as in python |
13:02:32 | PMunch | hmmmmm, yeah that is exactly what I would expect |
13:02:37 | PMunch | No it shouldn't |
13:02:41 | hmmmmm | :| |
13:02:48 | PMunch | It rounds a nuber, it doesn't change it's string representation |
13:02:51 | FromDiscord | <Rika> python prints it as 70.43 but in mmeory its the same as nim |
13:02:54 | Zoom[m] | planetis: I suppose it is, but I haven't used lent one single time yet, I get it's for getters, but I'd like a "lent" for function arguments much more |
13:03:03 | FromDiscord | <Rika> use fmt rounding if you want to print it rounded |
13:03:04 | FromDiscord | <hugogranstrom> Zoom: Fair enough 🙂 but in a "simple" situation like this it is easy to see that you don't modify it |
13:03:58 | hmmmmm | Rika yes I used fmt, it worked, but still looks a bit ugly, while python are like 2 lines of code. I don't doubt correctness but I had to spend ugly patchy hacky lines on that stuff :| |
13:04:20 | FromDiscord | <Rika> what is ugly about `&"{var:2}"`? |
13:04:23 | PMunch | Well the alternative is the language hiding the truth for you |
13:04:28 | PMunch | Which Nim tends not to do |
13:04:28 | FromDiscord | <Rika> its just as short as python? |
13:04:52 | FromDiscord | <Rika> i do not see anything ugly patchy or hacky in fmt rounding |
13:04:53 | hmmmmm | well I had a seq of that stuff, so I made a function lol :D |
13:05:03 | planetis[m] | for parameters the compiler chooses between addr or copy with this formula: `if sizeof(T) > 3*sizeof(int): passbyaddr else: passbyvalue` |
13:05:18 | Zoom[m] | @hugogranstrom I suppose I could, but it's a hack and I'm completely against it, so I'd better just inline my function. |
13:05:24 | FromDiscord | <Rika> i'd argue python's way is ugly and hacky. |
13:05:39 | FromDiscord | <Rika> you'd accumulate errors larger than epsilon without realising |
13:05:48 | hmmmmm | that might be true |
13:05:57 | hmmmmm | still beauty is beauty :D |
13:06:11 | FromDiscord | <lqdev> some call perl beautiful |
13:06:23 | FromDiscord | <hugogranstrom> Zoom: I skipped the function all together and just wrote everything in the same place. A template then perhaps? |
13:06:27 | FromDiscord | <Rika> some call C++ beautiful |
13:06:45 | planetis[m] | sealmove: dont want to be showoff-y but: https://github.com/planetis-m/breakout/blob/master/breakout/serialize.nim |
13:06:46 | FromDiscord | <lqdev> idk about others but i can never read comprehensions in python |
13:06:51 | FromDiscord | <lqdev> they just look so awkward and out of place |
13:06:53 | * | planetis[m] dancing_banana.gif |
13:06:59 | FromDiscord | <lqdev> and read backwards |
13:07:03 | FromDiscord | <lqdev> unlike anything else |
13:07:16 | FromDiscord | <Rika> i got used to it after a year or two back when i still used python |
13:07:37 | Zoom[m] | planetis: thanks, I vaguely remembered it, just expected openArray to work and think some kind a view could be provided |
13:07:40 | FromDiscord | <lqdev> still you read it backwards to figure out what the loop variable is |
13:07:55 | FromDiscord | <Rika> i mean yeah its still backwards |
13:08:03 | FromDiscord | <lqdev> which just goes against any rules of scoping and reading left-to-right, top-to-bottom |
13:08:08 | FromDiscord | <Rika> but you get used to pain after a few hours of it |
13:08:08 | Zoom[m] | I probably focus on unimportant things again |
13:08:16 | FromDiscord | <lqdev> rika lol |
13:10:02 | planetis[m] | i have an idea to build a web-store backend using ecs arch instead of using a database |
13:10:10 | planetis[m] | please stop me if it's stupid |
13:10:25 | * | narimiran quit (Ping timeout: 264 seconds) |
13:10:45 | FromDiscord | <Rika> stupid ideas can be turned into genius with enough iterations |
13:11:05 | FromDiscord | <sealmove> @planetis is your area of interest game dev? |
13:11:48 | * | narimiran joined #nim |
13:11:51 | planetis[m] | well not really, I was experimenting for creating a traffic simulation |
13:12:22 | FromDiscord | <sealmove> can't figure out from your repos, you have many different things. do you have a particular area of interest? |
13:12:32 | FromDiscord | <sealmove> just curious |
13:13:11 | planetis[m] | nope, my father says build me a webstore, i build a webstore |
13:13:14 | planetis[m] | im a simpleton |
13:13:48 | FromDiscord | <shadow.> brute forcing today's aoc part 2 feels so wrong |
13:14:22 | planetis[m] | he has no idea how complex that is, but anyway |
13:14:43 | FromDiscord | <sealmove> aha, I guess it's nice not being obsessive and working on whatever is useful at the time 😛 |
13:15:12 | FromDiscord | <shadow.> there has to be a better way to solve this rahh |
13:15:29 | hmmmmm | also why fmt{number:9.f} stuffs in there a bunch of unneeded whitespace, i just want the juice! |
13:15:40 | narimiran | ~rtfm |
13:15:40 | disbot | rtfm: 11read the fucking manual |
13:15:40 | disbot | rtfm: 11https://nim-lang.org/documentation.html -- narimiran |
13:15:54 | hmmmmm | boing D: |
13:16:03 | hmmmmm | rtfm'd by nari :| |
13:16:25 | planetis[m] | sealmove: well i used to, but i got over its |
13:16:32 | supakeen | it's ok i've been reading the docs and they document a function as "if you dont know what this is dont use it" |
13:16:51 | FromDiscord | <Rika> i really dont understand why you think writing `&"{num:9.f}"` is too much "boilerplate" |
13:17:15 | hmmmmm | it's just because I'm a spoiled python kid that didn't have to handle that stuff before lol |
13:17:29 | FromDiscord | <Rika> well this is nim |
13:17:35 | hmmmmm | ik ik |
13:17:38 | FromDiscord | <Rika> you didnt have to deal with static typing before |
13:18:04 | hmmmmm | well st is useful, my python stuff approach vertical spaghetti after 200 lines so I find it very useful |
13:19:02 | FromDiscord | <Rika> idk man i think its such a minor nitpick |
13:19:08 | FromDiscord | <Rika> regards the float printing |
13:20:11 | hmmmmm | ye I know Rika, I just spent 1 hour on it and it works just the same, didn't expect I had to deal with it because I literally didn't know stuff anything about float representation |
13:20:32 | * | Perkol quit (Remote host closed the connection) |
13:22:56 | narimiran | hmmmmm: here you go, you lazy bastard: https://play.nim-lang.org#ix=2Hiw |
13:23:21 | narimiran | "oh i put 9 in there, and then it uses 9 spaces, stupid nim" |
13:23:22 | hmmmmm | hmm what is this alien tech |
13:23:30 | hmmmmm | OH |
13:23:40 | hmmmmm | I SEE :o |
13:23:52 | FromDiscord | <Rika> pff |
13:24:50 | supakeen | I'm trying to run nim-lang/redis in threads but am encountering some gcsafe things, what gives: https://bpa.st/raw/DY3Q, the relevant proc it points to is: https://bpa.st/7DZQ |
13:28:19 | FromDiscord | <Rika> i believe you have to open a connection per thread |
13:29:14 | FromDiscord | <Rika> ah wait |
13:31:31 | FromDiscord | <Rika> i dont understand the context |
13:31:34 | FromDiscord | <Rika> what is your code? |
13:34:00 | supakeen | Let me make a small example that exhibits this behaviour instead of pasting a lot of lines :) |
13:37:16 | supakeen | Here's the idiom that causes this: https://bpa.st/4UIQ |
13:39:09 | supakeen | I understand what the error means, but I don't know how to solve it and I have a hard time indicating what in the readNext proc actually is shared heap? |
13:40:29 | FromDiscord | <shadow.> pmunch: if you're here have you done today's aoc yet |
13:40:44 | FromDiscord | <shadow.> im interested to see how people did today's |
13:41:12 | * | hmmm joined #nim |
13:45:24 | narimiran | he said he'll stream his solving later |
13:48:26 | PMunch | Yeah, I haven't looked at it yet |
13:48:52 | PMunch | But I will stream it when I'm done at work (in about 1½ hour) |
13:49:05 | FromDiscord | <shadow.> ohh nice nice |
13:50:42 | FromDiscord | <shadow.> also i have a question, when done a ton of times which would be faster: running popFirst() and addLast() on a deque or reassigning a seq to a new slice? |
13:51:09 | Zoom[m] | Could anyone tale a peek at my yesterday's solution? |
13:54:34 | hmmm | munchie can you do an [educational] day1/day2 aoc for the rest of the nimplebs :> day6 was hurting my brain only to look at it |
13:54:51 | FromDiscord | <InventorMatt> supakeen: I don't know if it is safe or not but if you add the {.gcsafe.} pragma to the readnext proc it will no longer give that error |
13:55:22 | PMunch | hmmm, as a video? |
13:55:26 | hmmm | yay |
13:55:32 | PMunch | You can always check out my solutions here: https://github.com/PMunch/aoc2020 |
13:55:35 | FromDiscord | <Rika> i read "nimplebs" as "nimple bs" |
13:55:41 | hmmm | I've seen your solutions :> |
13:55:46 | PMunch | Ah okay :P |
13:55:49 | supakeen | InventorMatt, yes but nim-lang/redis is not under my control :) |
13:56:02 | supakeen | But perhaps the answer is that that library is the wrong one to use if I want to use threads. |
13:57:18 | FromDiscord | <InventorMatt> you can always modify it locally or create an issue on the repo. but other than that maybe a different library may be the answer |
13:57:26 | FromDiscord | <Rika> its not exactly safe |
13:57:41 | FromDiscord | <Rika> until we determine which proc in readnext is causing the gcsafe issue |
13:57:54 | Zoom[m] | narimiran: I look at your D8 and think I overcomplicated mine a bit. Also, expected to deal with loops in the P2 so used CountTable instead of just a set and forgot to replace it later. |
13:58:03 | supakeen | Rika: how would I go about finding out? |
13:58:08 | narimiran | Zoom[m]: link to yours? |
13:58:16 | Zoom[m] | https://github.com/ZoomRmc/aoc2020_nim/blob/main/src/aoc08.nim |
13:58:18 | supakeen | And how do I manually verify if something is gcsafe; I don't really see shared state in the readNext proc? |
13:58:31 | FromDiscord | <Rika> im trying to figure it out |
13:59:12 | narimiran | Zoom[m]: this "overcomplication" might be useful for some later task |
13:59:24 | narimiran | speaking of which.... Zevv, where's my beer? |
13:59:38 | FromDiscord | <Rika> im not exactly sure how to determine it |
13:59:41 | Zoom[m] | He-he |
13:59:46 | FromDiscord | <Rika> is it not further into the error? |
14:00:19 | hmmm | also aoccers please comment your code so it's easier to understand what happens :3 |
14:00:26 | Zoom[m] | I go for much greater function granularity. Probably my human RAM is just too small |
14:00:46 | narimiran | hmmm: our codes are self-documenting :P |
14:00:50 | supakeen | It could be, I'm very clueless as to how Nim approaches this and might've misread the error? The small example should give you the same error (with --threads:on). |
14:00:55 | hmmm | YEYE I'M SURE NARI |
14:00:56 | hmmm | :D |
14:01:16 | hmmm | btw you leave some notes around nari, I like that |
14:01:27 | narimiran | do i? ok :) |
14:01:35 | hmmm | yes in the introduction page |
14:01:43 | hmmm | "Small check elif s[i] + s[j] < 2020: makes the whole program ~4x faster." |
14:01:47 | narimiran | ah, but this year i keep that one quite short |
14:01:54 | narimiran | i was more verbose before |
14:01:56 | Zoom[m] | hmmm: I have notes on some days |
14:01:58 | hmmm | oh |
14:02:00 | hmmm | what year? |
14:02:16 | narimiran | hmmm: last year definitely, but that one was in ocaml |
14:02:20 | Zoom[m] | Not exactly sure what to add for yesterday or today, though. |
14:02:25 | narimiran | i had an essay for each day basically :D |
14:02:29 | hmmm | lol |
14:02:38 | hmmm | you should have done it on nim too :p |
14:02:56 | FromDiscord | <shadow.> hmm i can do one if you'd like lol |
14:03:04 | hmmm | shadow do that |
14:03:05 | FromDiscord | <InventorMatt> just attaching the gsafe pragma on the readnext proc fixes it and the proc just returns nil reference objects so Idon't know other than the nil part what could cause the error @Rika |
14:03:13 | FromDiscord | <shadow.> like what just explaining the solutions? |
14:03:32 | hmmm | no just explaining what is the general approach and then commenting the most important lines |
14:03:37 | hmmm | nothing fancy :p |
14:03:43 | FromDiscord | <shadow.> hmm |
14:03:47 | FromDiscord | <shadow.> well it seems that aoc is about |
14:03:54 | FromDiscord | <shadow.> 1/3 general problem solving |
14:03:55 | FromDiscord | <shadow.> 1/3 parsing |
14:03:57 | FromDiscord | <shadow.> and 1/3 algorithms |
14:04:12 | FromDiscord | <shadow.> parsing just comes with time and knowing yours tools (split, regex, strscans, peg's) etc |
14:04:19 | narimiran | hmmm: if you go through my solutions and find something unclear, you can ask me here about it |
14:04:29 | FromDiscord | <shadow.> i think he wants to know how we get to that point |
14:04:35 | FromDiscord | <shadow.> like our approach? |
14:04:39 | FromDiscord | <shadow.> correct me if im wrong |
14:05:16 | Zoom[m] | hmmm: It's even better to compare different solutions. They've been very much alike. |
14:05:27 | hmmm | yea like what basic CS concept is the problem about and how your algos work |
14:05:27 | Zoom[m] | Excluding Zevv, of course |
14:05:37 | FromDiscord | <shadow.> !repo shadowninja55/aoc-2020 |
14:05:38 | disbot | https://github.com/shadowninja55/aoc-2020 -- 9aoc-2020: 11My attempt at Advent of Code 2020 in Nim. 15 1⭐ 0🍴 |
14:05:40 | FromDiscord | <shadow.> you can compare with pmunch |
14:06:01 | FromDiscord | <shadow.> and anyone else doing them |
14:06:47 | Zoom[m] | @shadow. Why do you use a table for swapping? |
14:06:57 | PMunch | Today might be interesting.. I'm so tired today it feels like I'm literally dying |
14:07:20 | PMunch | So no promises it won't hurt to watch me try to solve todays puzzle |
14:07:25 | Zoom[m] | PMunch: do you work remote or commute, if it's ok to ask? |
14:07:48 | PMunch | Well typically I would be in our office, but now under Corona I've moved to working from home |
14:08:04 | FromDiscord | <shadow.> table for swapping? |
14:08:10 | FromDiscord | <shadow.> ohh idk i find it more concise even tho it might be a little slower |
14:08:36 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HiI |
14:08:45 | FromDiscord | <shadow.> my day 9 solution is quite pretty |
14:09:48 | * | waleee-cl joined #nim |
14:09:48 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2HiJ |
14:09:49 | FromDiscord | <lqdev> problem solved |
14:10:05 | Zoom[m] | @shadow. I mean, why not just a `case`? |
14:10:32 | FromDiscord | <shadow.> hmm |
14:10:36 | FromDiscord | <shadow.> fair enough haha |
14:10:41 | FromDiscord | <shadow.> brain was not really |
14:10:49 | FromDiscord | <shadow.> working that day lol |
14:10:57 | FromDiscord | <shadow.> like today i just went massive brain somehow |
14:11:05 | FromDiscord | <shadow.> but for that one no |
14:11:07 | FromDiscord | <shadow.> solution was quite messy |
14:11:19 | FromDiscord | <shadow.> i think day 4 my brain just hopped out of my head lol |
14:11:57 | hmmm | hmm apparently pmunch day1 is more brain friendly than nari day1 |
14:12:12 | hmmm | nari day1 is a big nest of stuffy stuff |
14:12:41 | PMunch | Where is nari's day1? |
14:12:56 | hmmm | https://github.com/narimiran/AdventOfCode2020/blob/master/nim/day01.nim |
14:13:35 | narimiran | this just in: for-loops are not brain friendly |
14:13:41 | hmmm | :p |
14:13:42 | FromDiscord | <shadow.> my day 1 is like |
14:13:47 | FromDiscord | <shadow.> probably the simplest possible |
14:13:54 | FromDiscord | <shadow.> idk how efficient |
14:14:03 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HiL |
14:14:23 | hmmm | what is var seen = initIntSet() |
14:14:33 | narimiran | ~rtfm |
14:14:34 | PMunch | Wait, isn't that pretty much exactly what I have? |
14:14:35 | FromDiscord | <shadow.> i make an integer set to keep track of the numbers ive already seen |
14:14:38 | FromDiscord | <shadow.> really? |
14:14:42 | FromDiscord | <shadow.> i thought you used nested loops |
14:15:07 | FromDiscord | <shadow.> so apparently using the deque instead of slice seq reassignments takes 2/3 the time thats good to know |
14:15:26 | PMunch | Hmm, did disbot die? |
14:15:47 | narimiran | disbot: you here? |
14:15:51 | Zoom[m] | <narimiran "this just in: for-loops are not "> Loops can be totally unfriendly. Depends on how nested they are and how many exit points do they have. |
14:15:54 | hmmm | well I go eat, dudes pls comment your day ones I'll give you cookies |
14:16:13 | FromDiscord | <shadow.> i know esbeesy has some nifty solutions as well |
14:16:15 | FromDiscord | <shadow.> you could check those out |
14:16:29 | Zoom[m] | You don't promise one a cookie and not deliver |
14:16:30 | narimiran | i will never have a comment in my code explaining what `var seen = initIntSet()` is, sorry |
14:16:34 | FromDiscord | <shadow.> lmao yeah |
14:16:52 | ee7[m] | Is this a bug? https://play.nim-lang.org/#ix=2HiM |
14:17:35 | * | habamax quit (Ping timeout: 258 seconds) |
14:17:58 | FromDiscord | <shadow.> well |
14:18:05 | FromDiscord | <shadow.> hmmm |
14:18:11 | FromDiscord | <shadow.> i have a suspicion lemme test locally |
14:18:28 | FromDiscord | <shadow.> nope, no message |
14:18:29 | FromDiscord | <shadow.> hm |
14:19:15 | FromDiscord | <shadow.> i think because bar is passed it's allowed to use it since it's passed? |
14:19:16 | FromDiscord | <shadow.> im not sure |
14:19:32 | FromDiscord | <shadow.> it would still be global-state mutation so idk |
14:27:11 | Zevv | Zoom[m]: Don't try this at home: https://play.nim-lang.org/#ix=2HiP |
14:27:23 | FromDiscord | <shadow.> oh no |
14:27:51 | FromDiscord | <shadow.> why |
14:27:56 | FromDiscord | <shadow.> why have you done this |
14:28:15 | Zevv | because I live in the land of freedom and unlimited posibilities |
14:28:48 | Zoom[m] | Zevv: that could be useful, but its nastiness overshadows this |
14:29:47 | Zoom[m] | It's even worse than passing with a var. But it could be wrapped in a friendly view iterator or something like that |
14:30:25 | Zevv | you get what you ask for |
14:30:34 | Zevv | you could also just add one single '*' to your local nim lib dequeue |
14:31:40 | Zoom[m] | If it was a life-or-death matter, I could just include the whole thing and completely destroy it from inside :D |
14:34:31 | FromDiscord | <a depressed person uwu> sent a code paste, see https://play.nim-lang.org/#ix=2HiU |
14:34:52 | FromDiscord | <shadow.> has to be inside a macro |
14:34:53 | FromDiscord | <shadow.> iirc |
14:34:59 | FromDiscord | <a depressed person uwu> mk |
14:35:00 | FromDiscord | <shadow.> wait no |
14:35:05 | FromDiscord | <shadow.> the function is just |
14:35:06 | FromDiscord | <a depressed person uwu> wat |
14:35:07 | FromDiscord | <shadow.> ident() |
14:35:13 | FromDiscord | <shadow.> nnkIdent is the node type |
14:35:24 | FromDiscord | <a depressed person uwu> k |
14:35:24 | FromDiscord | <shadow.> in a macro, you can just do `newCall("test")` |
14:36:10 | FromDiscord | <a depressed person uwu> and how do i get the params of the function inside it |
14:36:20 | FromDiscord | <shadow.> wdym? |
14:36:22 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HiW |
14:36:35 | FromDiscord | <shadow.> sorry could you explain that again |
14:37:10 | * | NimBot joined #nim |
14:37:24 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HiY |
14:37:26 | FromDiscord | <a depressed person uwu> o ok |
14:37:30 | FromDiscord | <a depressed person uwu> thx for ur help |
14:37:33 | FromDiscord | <shadow.> np |
14:37:41 | FromDiscord | <shadow.> btw, in this case a template might be easier |
14:37:50 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HiZ |
14:37:55 | FromDiscord | <shadow.> depends on what you're doing |
14:38:35 | FromDiscord | <a depressed person uwu> hm ok |
14:39:00 | FromDiscord | <shadow.> what's your end goal? |
14:41:49 | FromDiscord | <a depressed person uwu> just making some test discord bot |
14:41:52 | FromDiscord | <a depressed person uwu> nothing much tbh |
14:42:17 | * | reyqn joined #nim |
14:42:49 | FromDiscord | <shadow.> i see |
14:42:52 | FromDiscord | <shadow.> dimscord? |
14:43:17 | FromDiscord | <a depressed person uwu> yup |
14:43:20 | FromDiscord | <shadow.> nicee |
14:43:33 | FromDiscord | <a depressed person uwu> making a command handler that automatically loads every command |
14:43:45 | FromDiscord | <shadow.> ahh i see |
14:43:48 | FromDiscord | <shadow.> using a macro? |
14:43:53 | FromDiscord | <a depressed person uwu> ye |
14:43:55 | FromDiscord | <shadow.> smart |
14:44:01 | FromDiscord | <a depressed person uwu> i dont have any other idea on calling the commands |
14:44:05 | FromDiscord | <a depressed person uwu> :p |
14:44:07 | FromDiscord | <shadow.> well |
14:44:27 | FromDiscord | <shadow.> you could just make a macro that transforms the commands into message event arg cases? |
14:44:27 | FromDiscord | <shadow.> idk |
14:45:04 | FromDiscord | <a depressed person uwu> sent a code paste, see https://paste.rs/gUt |
14:46:22 | FromDiscord | <shadow.> yeah that would work |
14:47:03 | FromDiscord | <a depressed person uwu> imagine making discord bots in alot of different langs tho |
14:47:10 | FromDiscord | <shadow.> wdyym |
14:47:16 | FromDiscord | <shadow.> i mean ive done py and js before |
14:47:28 | FromDiscord | <shadow.> for dapi |
14:47:32 | FromDiscord | <a depressed person uwu> i have done in py, js, lua, rust and now making in nim |
14:47:37 | FromDiscord | <shadow.> lol nice nice |
14:47:44 | FromDiscord | <a depressed person uwu> ~~i basically have no life~~ |
14:47:46 | FromDiscord | <shadow.> dja isnt bad if you know java |
14:47:55 | reyqn | Hi. I don't really get how to run nim-gdb. It seems like the exe from .nimble tries to call himself in .choosenim (where it doesn't exist). I'm running windows. Does someone know what I am doing wrong? |
14:48:08 | FromDiscord | <shadow.> you think you're alone w that statement? lol |
14:48:15 | FromDiscord | <shadow.> this is a programming server after all |
14:48:31 | FromDiscord | <a depressed person uwu> epik |
14:49:03 | FromDiscord | <shadow.> lmao |
14:49:32 | FromDiscord | <sealmove> string interpolation doesn't work with backquoted idents in quote do? |
14:49:40 | FromDiscord | <shadow.> show the code |
14:49:41 | FromDiscord | <shadow.> in question |
14:50:16 | FromDiscord | <shadow.> strformat? |
14:50:48 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Hj4 |
14:50:50 | FromDiscord | <shadow.> hmm |
14:51:20 | FromDiscord | <shadow.> are they just interpreted as literals? |
14:51:51 | FromDiscord | <Zeus> Hello everyone |
14:51:54 | FromDiscord | <shadow.> hey |
14:52:07 | FromDiscord | <sealmove> the backquote substitution doesn't seem to happen, I get 'undeclared identifier' |
14:52:11 | FromDiscord | <shadow.> i see |
14:52:13 | FromGitter | <HJarausch_gitlab> Is there something like *StringStream* which can be passed to a procedure which takes an argument of type *File* ⏎ Many thanks for a hint. |
14:52:15 | FromDiscord | <shadow.> hmmm |
14:52:19 | * | hmmm quit (Quit: brb) |
14:52:22 | FromDiscord | <shadow.> stringstream? |
14:52:26 | FromDiscord | <shadow.> i mean theres the streams lib |
14:52:32 | FromDiscord | <shadow.> https://nim-lang.org/docs/streams.html |
14:52:36 | FromDiscord | <shadow.> and that works with files |
14:53:32 | FromDiscord | <shadow.> im not sure then |
14:53:41 | FromDiscord | <shadow.> have you tried with concatenation? |
14:53:52 | FromDiscord | <sealmove> with concatenation it works |
14:54:00 | FromGitter | <HJarausch_gitlab> I have tried ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ but I get ... [https://gitter.im/nim-lang/Nim?at=5fd0e5083dd3b251a4f6744d] |
14:55:57 | FromDiscord | <shadow.> what did you expect to happen lmao |
14:56:04 | FromDiscord | <shadow.> you passed a stringstream to a proc that accepts a file |
14:57:23 | FromGitter | <HJarausch_gitlab> I'd like something *in memory* and I have to pass it to a proc which requires a *File* (it's part of ncurses.nim and it cannot changed by me). |
14:57:43 | PMunch | Save your file in /tmp |
14:57:58 | PMunch | Or just create a FIFO |
15:01:39 | FromGitter | <HJarausch_gitlab> As far as I know, a FIFO connects *two* processes. I just need some *memory mapped file* which can be passed to a *File* parameter. |
15:03:05 | PMunch | Okay, ready to stream in about 10 minutes |
15:03:38 | FromGitter | <HJarausch_gitlab> */tmp* is fine on Linux, but I want my program to run on *Android Termux*, as well. |
15:04:36 | FromDiscord | <shadow.> nicee |
15:04:42 | FromDiscord | <shadow.> ill tune in |
15:05:27 | Prestige | Isn't that linux as well? Is there no /tmp dir? |
15:06:38 | PMunch | Even without /tmp you should be able to do a FIFO |
15:08:49 | FromGitter | <HJarausch_gitlab> @Prestige Only the kernel is Linux. There might be a */tmp* folder but I am definitely not allowed to create a file there. |
15:09:23 | FromDiscord | <shadow.> hmm |
15:09:23 | Prestige | Well yeah, Linux is a kernel. You're sure you can't? |
15:09:48 | * | reyqn quit (Remote host closed the connection) |
15:10:07 | PMunch | Any reason in particular why you don't want to use a FIFO? |
15:10:09 | FromDiscord | <lqdev> @HJarausch_gitlab have you tried? |
15:10:33 | Zevv | HJarausch_gitlab: getenv(TMPDIR) |
15:10:33 | FromDiscord | <lqdev> ah |
15:10:35 | Zevv | it's properly setup in termux |
15:10:41 | FromDiscord | <lqdev> there is no /tmp in termux |
15:11:19 | Zevv | or os.tempDirDefault(), which does the same thing under the hood on linux |
15:11:24 | PMunch | Twitch is live: https://www.twitch.tv/pmunche |
15:11:28 | Zevv | I guess your termux build goes for a linux flavor |
15:11:33 | PMunch | Or should be at least.. |
15:12:19 | FromDiscord | <shadow.> llol ill tune in |
15:12:37 | Zevv | Aah, it's time to relax. You know what that means. A glass of wine, your favorite easy chair, and of course, PMunch's soothing voice playing on your home stereo. |
15:12:38 | FromDiscord | <shadow.> hmm |
15:12:41 | PMunch | Is it working? |
15:12:41 | FromDiscord | <shadow.> offline |
15:12:45 | FromDiscord | <shadow.> nope |
15:12:51 | FromDiscord | <shadow.> now it is |
15:12:56 | FromDiscord | <shadow.> standby |
15:13:00 | PMunch | Ah yeah |
15:13:19 | PMunch | YouTube is also live: https://www.youtube.com/watch?v=aFueLZOBs7I |
15:13:22 | PMunch | Although with the wrong title |
15:13:30 | FromDiscord | <shadow.> ah true |
15:19:32 | Zevv | I *hate* how nim does not allow lines().toSeq().mapIt() |
15:19:54 | FromDiscord | <shadow.> yeahhh |
15:20:52 | * | audiofile quit (Quit: Connection closed) |
15:21:04 | FromDiscord | <lqdev> any ideas on why i can't read `nim check` output via lua's `io.popen()`? |
15:21:53 | FromDiscord | <lqdev> hmm, i think it's due to it outputting to stdout |
15:21:58 | FromDiscord | <lqdev> erm, stderr |
15:22:00 | FromDiscord | <lqdev> and not stdout |
15:26:06 | Zevv | I also *hate* how you sit and think and run once and have it right. You would have thrived in the age of punch cards. |
15:29:21 | FromDiscord | <shadow.> yeah |
15:29:22 | FromDiscord | <shadow.> i prefer the |
15:29:28 | FromDiscord | <shadow.> mash the keyboard and fix all compiler errors |
15:29:30 | FromDiscord | <shadow.> approach |
15:32:24 | * | lritter joined #nim |
15:38:35 | Prestige | Lol Zevv |
15:44:16 | FromDiscord | <dom96> Zevv: Be empowered to be the change you want to see in the world. |
15:45:22 | Zevv | nah, I'm too old for that shit |
15:45:37 | Zevv | I'm starting that period in life where I can be grumpy and complain and cling to what I know |
15:48:21 | FromDiscord | <dom96> Being old is no excuse to avoid change |
15:53:17 | Zevv | ooh yes it is. You're just not old enough to realize that |
15:53:26 | FromDiscord | <shadow.> lol |
15:53:40 | FromGitter | <HJarausch_gitlab> @PMunch Thanks, a *FIFO* seems to work |
15:54:10 | PMunch | Nice |
15:54:27 | PMunch | Just keep in mind that both sides need to be open before you can read/write to the FIFO |
15:55:53 | FromDiscord | <dom96> lol |
15:56:57 | * | PMunch quit (Quit: leaving) |
16:03:01 | * | opal quit (Remote host closed the connection) |
16:03:33 | * | opal joined #nim |
16:06:24 | * | hmmmmm quit (Quit: brb) |
16:13:14 | reversem3 | anyone use moe for an editor ? |
16:16:55 | * | fredrikhr quit (Read error: Connection reset by peer) |
16:17:53 | FromDiscord | <shadow.> does anyone know a good nim debugger for vscode? |
16:18:06 | FromDiscord | <shadow.> or just any way to quickrun from vscode |
16:19:11 | FromDiscord | <shadow.> alr so i can use the nim extension nvm |
16:19:14 | FromDiscord | <shadow.> but how do i run using that? |
16:20:57 | FromDiscord | <shadow.> nvm figured it out |
16:26:36 | * | Kaivo quit (Ping timeout: 240 seconds) |
16:27:53 | FromDiscord | <fwsgonzo> is ORC the most memory efficient GC in Nim? |
16:28:46 | FromDiscord | <shadow.> https://nim-lang.org/docs/gc.html |
16:29:14 | * | Kaivo joined #nim |
16:30:22 | reversem3 | vscode no , I only use ldb or gdb sorry |
16:31:41 | * | habamax joined #nim |
16:40:04 | FromDiscord | <mratsim> @fwsgonzo not allocating memory is always more efficient 😉 |
16:40:20 | FromDiscord | <mratsim> then it's the stack |
16:40:33 | FromDiscord | <mratsim> then reusing buffers |
16:42:38 | FromDiscord | <Esbeesy> Well day 9 wasn't too challenging. |
16:42:49 | FromDiscord | <Esbeesy> Does anyone know of an actor framework for nim? |
16:43:29 | FromDiscord | <mratsim> There was Nimoy, and someone called monster on the forum also wanted to do an Akka one. |
16:43:35 | FromDiscord | <mratsim> but none maintained AFAIK |
16:43:57 | FromDiscord | <mratsim> If I had the time I would write one for learning purpose as well |
16:44:40 | FromDiscord | <Esbeesy> I noticed in search results it used to be std lib around .11-.17, guessing it was removed |
16:45:03 | FromDiscord | <Esbeesy> From someone who has working experience in Erlang/Elixir/Akka - Please not Akka. |
16:45:33 | FromDiscord | <mratsim> inspired by |
16:45:56 | FromDiscord | <mratsim> In my case, I looked underneath Actix, and I also happen to have quite a good idea of Pony internals. |
16:47:04 | FromDiscord | <mratsim> I did some experimentation on top of Weave, but Actors for CPU-bound workloads are meh and Weave does not address the latency needs of IO bounds workloads. |
16:52:00 | FromDiscord | <mratsim> @Esbeesy what kind of things are looking for in an actor framework |
16:52:04 | * | JustASlacker joined #nim |
16:52:12 | FromDiscord | <mratsim> What was nice to solve using actors? |
16:52:19 | FromDiscord | <Esbeesy> Making films |
16:52:21 | FromDiscord | <Esbeesy> I jest |
16:52:36 | FromDiscord | <mratsim> ideally, is there something I can use to showcase actors if I ever implement them? |
16:52:42 | JustASlacker | first time working on a nim project in months \o/ |
16:52:50 | * | JustASlacker tries to remeber how nim works |
16:53:06 | JustASlacker | basically python I guess |
16:53:21 | FromDiscord | <mratsim> for example, for multithreading, I use a 100 lines raytracing C++ demo that I ported to Nim https://github.com/mratsim/weave/tree/master/demos/raytracing |
16:53:53 | * | tane joined #nim |
16:55:41 | FromDiscord | <Esbeesy> So, I work in the online gambling industry, and the issue many of these companies face is database contention when they scale - Because sporting events end at the same time, you can have hundreds of thousands of bets on that one data point. You now have to calculate all of these bets and update the user accounts accordingly. And this is going on constantly, all the events around the world, users with bets on multiple events, non stop |
16:56:04 | FromDiscord | <Esbeesy> So effectively, you want a system that has as little locking behaviour as possible |
16:57:01 | FromDiscord | <shadow.> rah i hate async error messages |
16:57:13 | FromDiscord | <shadow.> they're like hieroglyphics |
16:57:13 | disruptek | shhh. |
16:57:31 | FromDiscord | <shadow.> rip |
16:57:34 | FromDiscord | <Esbeesy> Whenever I explore a new language, I always like to see if there's a distributed actor system since it's one of the best tools to scale high traffic platforms |
16:57:49 | FromDiscord | <shadow.> sounds like rst |
17:01:54 | FromDiscord | <mratsim> I see. No unfortunately Nim doesn't have that yet. Though we do have an Energy trading company that use Nim in a high-scaling + ultra-low latency environment. |
17:02:10 | FromDiscord | <Esbeesy> shadow: Problem with Rust, Actix doesn't have a distributed feature, meaning you have to rely on another system for communication between actor systems. This is what makes Erlang/Elixir so powerful |
17:02:20 | * | hnOsmium0001 joined #nim |
17:02:55 | FromDiscord | <Esbeesy> https://proto.actor/ This is a very interesting idea from the person who made Akka actually |
17:03:10 | FromDiscord | <Esbeesy> Akka.NET |
17:03:11 | FromDiscord | <mratsim> What about that C++ Actor Framework, thoughts? |
17:03:26 | FromDiscord | <Esbeesy> CAF? |
17:03:29 | disruptek | we'll have csp. it's practically the same thing. |
17:03:43 | FromDiscord | <mratsim> yes |
17:03:55 | disruptek | unfortunately, no one gives a shit. |
17:04:16 | FromDiscord | <mratsim> I don't know anything about actors so I don't know how to evaluate a good library from a one that doesn't solve the right problems |
17:04:24 | FromDiscord | <mratsim> @disruptek, I care about CSP. |
17:04:29 | FromDiscord | <Esbeesy> csp isn't the same |
17:04:35 | Zevv | disruptuk: we should market CSP and crowdsource CSP |
17:04:41 | FromDiscord | <Esbeesy> Similar ball park |
17:04:45 | FromDiscord | <Esbeesy> and I definitely want nim routines |
17:04:45 | disruptek | lol |
17:04:54 | Zevv | best case you have income and a cool project |
17:04:56 | FromDiscord | <Esbeesy> https://www.quora.com/How-are-Akka-actors-different-from-Go-channels-How-are-two-related-to-each-other↵↵Good thread on it |
17:04:57 | Zevv | worst case it'll be like V |
17:05:08 | FromDiscord | <mratsim> that's why I asked about it here: https://forum.nim-lang.org/t/7199#45485 |
17:05:09 | Zevv | I hereby offer the first $250 |
17:05:20 | Zevv | and that's for CPS only, not CSP |
17:05:58 | FromDiscord | <mratsim> yeah there is confusion here |
17:05:58 | FromDiscord | <Esbeesy> The person who created Akka.NET has created this: https://proto.actor |
17:06:18 | FromDiscord | <mratsim> disruptek is talking about CPS (Continuation Passing Style) while CSP is (Communicating Sequential Process) |
17:06:27 | disruptek | no, i'm talking about csp. |
17:06:28 | FromDiscord | <Esbeesy> Essentially, building the actor system from the distribution method rather than the code |
17:06:33 | disruptek | cps is already done afaic. |
17:06:38 | FromDiscord | <mratsim> ah |
17:06:57 | Zevv | you heard me disruptek. crowdfund that stuff, you got your first customer. |
17:06:58 | FromDiscord | <Esbeesy> I might make nim bindings for proto actor actually 🤔 |
17:07:02 | FromDiscord | <mratsim> well I care about CSP as well. This is why Weave is channel-based instead of shared memory |
17:07:06 | disruptek | i mean, it may not be properly impl, but i'm satisfied with the research. |
17:07:07 | Zevv | now I will eat soup. bye. |
17:07:11 | disruptek | zevv: okay, thank you. |
17:08:03 | disruptek | honestly, i think cps is ahead of its time for nim. |
17:08:36 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
17:09:55 | disruptek | i am working on csp for nigel. it's just hard to find time because, y'know, i don't have a job and it's fucking snowing here. |
17:10:24 | * | Lord_Nightmare joined #nim |
17:10:39 | disruptek | i have these lambdas running continuations that i serialize into the cloud. csp is just a matter of rendezvous. |
17:11:23 | disruptek | the poor-man's rendezvous is just another process that mutates the two continuations before resuming them simultaneously. |
17:11:55 | FromDiscord | <krisppurg> I mean like in C↵↵https://man7.org/linux/man-pages/man2/read.2.html |
17:12:04 | disruptek | thousands of simultaneous executions in separate nodes is no problem. |
17:12:46 | disruptek | each such execution has 10gig of memory to work with, and commensurate CPU. |
17:16:22 | disruptek | they run in their own little network with a shared filesystem and access to a cache. they are /practically/ a unified cluster, just with extraordinarily poor synchronicity/reliability. |
17:16:54 | disruptek | but you can purchase time on this cluster in increments of 100ms, which is kinda huge. |
17:17:18 | disruptek | and it's as large or small as your code demands. |
17:18:08 | disruptek | now i will make coffee. |
17:22:55 | FromDiscord | <shadow.> enjoy |
17:28:37 | FromDiscord | <dom96> I'd love to see csp in action, but I'm not sure where to look |
17:28:52 | FromDiscord | <dom96> or cps I don't know anymore |
17:29:07 | FromDiscord | <shadow.> lmfao |
17:29:12 | FromDiscord | <shadow.> cps is continuation passing style |
17:29:22 | FromDiscord | <shadow.> csp is communicating sequential process |
17:29:24 | FromDiscord | <shadow.> which of those |
17:29:27 | FromDiscord | <shadow.> do you want to see in action |
17:29:32 | FromDiscord | <Quibono> Not really sure what either of them is but I think I want them if they give us good parallelism |
17:29:39 | FromDiscord | <shadow.> !repo disruptek/cps |
17:29:40 | disbot | https://github.com/disruptek/cps -- 9cps: 11Continuation-Passing Style for Nim 🔗 15 40⭐ 2🍴 |
17:29:44 | FromDiscord | <shadow.> there's an example |
17:29:57 | FromDiscord | <shadow.> i have to plug all of disruptek's repos while hes making coffee |
17:30:56 | FromDiscord | <mratsim> @Quibono, none are really about parallelism though. CPS is about composition of Nim primitives (iterators, macros, templates, closures, ...) and CSP is about composition of processes/event loops/services. |
17:31:12 | FromDiscord | <Quibono> Lol so weave is still my god? |
17:31:31 | FromDiscord | <mratsim> CSP builts on top of a multithreading framework. |
17:31:44 | FromDiscord | <mratsim> so you need a foundation, it's another layer |
17:32:36 | FromDiscord | <mratsim> I do mention CSP quite often in Weave or one of the RFC |
17:33:44 | FromDiscord | <Quibono> I don’t really need parallelism yet for anything, but I want to need it lol |
17:35:40 | FromDiscord | <mratsim> Also the references at the end of Synthesis (Weave State machine code generator) might be a fun read: https://github.com/mratsim/Synthesis#references |
17:36:22 | FromDiscord | <mratsim> Communicating Finite State Machine, Petri Nets, Kahn Process Networks, and the extras which are slides from courses. |
17:37:52 | * | rockcavera quit (Read error: Connection reset by peer) |
17:38:19 | * | rockcavera joined #nim |
17:40:32 | FromDiscord | <mratsim> If you base actors on one of those theories, you can formally verify properties of your distributed systems which is very powerful for reliability. |
17:43:05 | FromDiscord | <dom96> So how do I replace my async/await programs with it? |
17:44:43 | * | junland quit (Quit: %ZNC Disconnected%) |
17:45:29 | FromDiscord | <zetashift> iirc go just uses the `go` keyword |
17:45:33 | * | junland joined #nim |
17:46:16 | * | junland quit (Remote host closed the connection) |
17:47:04 | * | junland joined #nim |
17:47:51 | * | hmmmmm joined #nim |
17:48:51 | hmmmmm | dudes if I have 8 lines in a try block and it fails at line 7, what happens to the first lines? they get executed? |
17:49:12 | FromDiscord | <zetashift> oops my bad Go uses CSP and not CPS |
17:49:53 | FromDiscord | <zetashift> yes, they do, do you have an code example? |
17:49:56 | * | JustASlacker quit (Ping timeout: 272 seconds) |
17:50:44 | disruptek | the cps repo features examples. |
17:51:27 | disruptek | cps is, imo, already superior to async/await because though we haven't bothered to put it in the example dispatcher, it lets you move continuations between threads arbitrarily. |
17:52:01 | disruptek | this synergizes nicely with arc's shared heap and isolate. |
17:52:17 | FromDiscord | <dom96> Are there any examples showing sockets usage? |
17:52:21 | disruptek | it lets us thread i/o instead of having colored functions. |
17:52:38 | disruptek | i think there is a socket example. |
17:52:45 | FromDiscord | <shadow.> !help |
17:52:47 | FromDiscord | <shadow.> rip |
17:52:54 | disruptek | no help for discord users. |
17:52:59 | FromDiscord | <shadow.> sad |
17:53:04 | disruptek | use a real chat client or bug yard to fix the bot. |
17:53:10 | FromDiscord | <shadow.> hmm |
17:53:15 | FromDiscord | <shadow.> bet |
17:53:31 | * | shadowninja55 joined #nim |
17:53:41 | shadowninja55 | boom |
17:53:43 | FromDiscord | <dom96> NimBot can handle discord users 🙂 |
17:53:48 | shadowninja55 | !help |
17:53:52 | shadowninja55 | there we go |
17:54:02 | disruptek | dom96: how does it send them private messages |
17:54:16 | FromDiscord | <dom96> It avoids needing to |
17:54:22 | disruptek | well, that's what !help does. |
17:54:42 | disruptek | i personally don't want to be spammed by the help all the time. |
17:54:46 | FromDiscord | <shadow.> well i just hopped on irc and got help anyways so its cool lol |
17:54:56 | disruptek | hurray. |
17:55:10 | disruptek | ~notes |
17:55:10 | disbot | notes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek |
17:55:15 | disruptek | i think there's some help in there. |
17:55:20 | * | shadowninja55 quit (Client Quit) |
17:55:37 | FromDiscord | <shadow.> fair |
17:55:43 | hmmmmm | woah they really get executed :| |
17:55:50 | FromDiscord | <shadow.> im programming something like this for personal use so i just wanted inspiration for commands lmao |
17:56:12 | disruptek | you probably want to look at my porn bot. |
17:56:30 | FromDiscord | <dom96> > i think there is a socket example.↵I can't find any, do you have a link? |
17:56:35 | FromDiscord | <shadow.> what api? |
17:56:39 | FromDiscord | <shadow.> or do you scrape porn like a real gamer |
17:57:34 | disruptek | it has a lot of nuance. |
17:57:34 | disruptek | it started out as !faster and !harder but i ended up impl a custom sexytalk language. |
17:57:35 | disruptek | dom96: it would be in examples, stash, or tests. |
17:57:36 | disruptek | but you shouldn't need a socket example to evaluate the merits of the technique. |
17:58:02 | FromDiscord | <dom96> I need a socket example to be able to use it |
17:58:07 | FromDiscord | <dom96> which is what I would like to do |
17:58:29 | disruptek | well, you should be able to make one using the existing dispatcher. |
17:59:29 | FromDiscord | <dom96> someone will need to create a high-level socket API for this, otherwise it won't get used |
17:59:41 | FromDiscord | <reilly> So I'm making some API calls, and I need to access a field containing a date. It's stored in what I can only assume to be Unix time. For example, `1596605484971` should be August 5th, 2020. By the looks of it, though, `member["joined"].getInt().fromUnix().local()` seems to read it as June 31, 52,564. |
17:59:46 | disruptek | i think you're missing the point. |
17:59:49 | FromDiscord | <dom96> all I see so far is very low-level code |
18:00:08 | disruptek | there /is no/ api. |
18:00:26 | disruptek | you will write normal synchronous code. it turns into asynchronous code. |
18:00:58 | Zoom[m] | when? 😎 |
18:01:04 | disruptek | compile-time. |
18:01:27 | FromDiscord | <dom96> Right, but an API is needed for the synchronous code |
18:01:29 | hmmmmm | how can I structure my try block to execute only if none of the lines fail |
18:01:37 | Zoom[m] | Right. That's exactly what I was asking |
18:01:37 | disruptek | we already have synchronous sockets. |
18:06:14 | * | junland quit (Quit: %ZNC Disconnected%) |
18:08:22 | disruptek | Zoom[m]: didn't you tell me that you read the 1011 paper? |
18:08:28 | disruptek | and you enjoyed it, right? |
18:08:32 | hmmmmm | ~bentley |
18:08:33 | disbot | bentley: 11https://imgur.com/gallery/yEXiWWG |
18:08:33 | disbot | bentley: 11a good boy |
18:08:44 | hmmmmm | :3 |
18:09:04 | disruptek | stop looking at my dog's cock. |
18:09:07 | hmmmmm | :| |
18:09:18 | hmmmmm | ~disruptke |
18:09:18 | disbot | no footnotes for `disruptke`. 🙁 |
18:09:22 | hmmmmm | meh |
18:09:26 | hmmmmm | you are lazy |
18:13:10 | disruptek | dom96: read 1011. if you aren't sold, we can't be friends. |
18:14:46 | Zoom[m] | <disruptek "and you enjoyed it, right?"> I'm interested, but I'm not sold until I understand how to use it. And I probably won't invest in investigating further until it at least 3/4 production-ready. |
18:15:30 | FromDiscord | <dom96> disruptek: based on the description so far it seems very similar to Go's approach, so I'm not sure I would learn much from reading the paper |
18:15:59 | disruptek | go is csp. |
18:16:05 | FromDiscord | <Esbeesy> ^ this |
18:16:55 | FromDiscord | <dom96> So what's the TL;DR of CSP vs. CPS? |
18:17:22 | disruptek | cps inverts control flow, csp is continuation composition. |
18:17:55 | Zoom[m] | On one hand I have a luxury to be an early adopter of promising techniques, but on the other, I don't code anything serious, so I'm no use as a tester. I can only annoy with unimportant questions and FRы orthogonal to the current project focus. |
18:18:14 | Zoom[m] | So I don't think you really need to get me interested. |
18:18:18 | disruptek | look at the end of this file: |
18:18:20 | disruptek | https://github.com/disruptek/cps/blob/master/experiments/chain.nim |
18:18:25 | disruptek | lines 190+ |
18:18:28 | Zoom[m] | But you should get Dom interested |
18:18:53 | FromDiscord | <mratsim> @dom96 quoting myself "CPS is about composition of Nim primitives (iterators, macros, templates, closures, ...) and CSP is about composition of processes/event loops/services." |
18:19:00 | Zoom[m] | * On one hand I have a luxury to be an early adopter of promising techniques, but on the other, I don't code anything serious, so I'm no use as a tester. I can only annoy with unimportant questions and FRs orthogonal to the current project focus. |
18:19:49 | disruptek | that's everyone who uses nim. |
18:21:18 | * | junland joined #nim |
18:21:42 | * | thomasross joined #nim |
18:23:36 | Zevv | dom96: cps is the building block. It's like the async macro, it splits procs in pieces and lifts the locals |
18:23:45 | Zevv | these locals go into an object together with a pointer to the function |
18:23:56 | disruptek | dom96: the reason you'll learn something from the paper is that it's about impl CPS in C for use in a torrent server aimed at service tens of thousands of clients simultaneously. |
18:24:21 | Zevv | the resulting object with vars + fn is called a closure |
18:24:26 | Zevv | and you can juggle mad things with these |
18:24:37 | Zevv | you can call them in any order, store them in the fridge, send them to disruptekts cloud, whatever |
18:24:40 | Zevv | that's CPS |
18:24:48 | Zevv | it's pretty basic, we got that working, albeit in a deplorable state |
18:24:53 | Zevv | then next there's CSP |
18:25:06 | Zevv | CSP is a higher abstraction layer, typically built on top of CPS |
18:25:12 | Zevv | the acronyms are amazingly confusing |
18:25:14 | disruptek | well, our cps is already more advanced than the cps demonstrated in the paper. i wouldn't say it's /deplorable/, exactly. |
18:25:24 | Zevv | var a: int = 3 |
18:25:52 | Zevv | ok, not deploarble. odious |
18:25:58 | disruptek | odious, lol |
18:26:42 | Zevv | CSP is basically kind of what Go does. |
18:26:47 | Zevv | you make things and you connect them with tubes |
18:26:51 | Zevv | shove stuff in, get stuff out |
18:26:51 | disruptek | it's exactly what go does. |
18:26:57 | Zevv | but onder the hood, the tubes are an illusion |
18:26:59 | Zevv | they are not there |
18:27:02 | Zevv | the compiler makes them go away |
18:27:12 | disruptek | exactly this. it's a semantic designed for the programmer. |
18:27:17 | Zevv | it's not like a pipe or a channel or a socket or a fifo |
18:27:29 | Zevv | it *looks* like it, but it will evaporate |
18:28:08 | Zevv | does that make sense, dom96? |
18:28:08 | disruptek | thing is, i'm not really convinced a pipe is even the right magical object to give the programmer. |
18:28:30 | Zevv | it might not be, but it's what people expect in 2021 |
18:28:33 | Zevv | so lets start with that |
18:28:54 | disruptek | we can give them a pipe, but when they look inside they might see my magic 8-ball. |
18:29:20 | Zevv | CSP: Ceci n'est pas une pipe |
18:29:35 | disruptek | oui oui, this is the way. |
18:30:14 | Zevv | I don't give a single blip about CSP for now. I would like to have a solid and robust CPS first |
18:30:19 | Zevv | that would solve 99% of my problems |
18:30:30 | Zevv | that makes me do async I/O on an AVR with 256 bytes of RAM |
18:30:40 | Zevv | that gives me lua-style coroutines |
18:30:40 | disruptek | tell you what. i will work on it. |
18:30:50 | Zevv | croudfund that shit |
18:30:53 | Zevv | where to I send my money |
18:31:04 | disruptek | i hate those things. |
18:31:09 | Zevv | haha me too :) |
18:31:34 | Zevv | but what is still offputting is that the c words keep on buzzing around |
18:31:40 | disruptek | someone bought me a coffee recently. it was awesome, except that it goes directly to my credit-card debt, so, like, i didn't get any coffee. |
18:31:51 | Zevv | but I still haven't met anyone here *actually* willing to look into all that |
18:31:57 | disruptek | all what? |
18:32:10 | Zevv | c-words. cps csp |
18:32:29 | disruptek | i just said i would fix the compiler bug. |
18:32:38 | Zevv | it's not /you/ i'm talking a bout |
18:32:43 | disruptek | oh. |
18:32:49 | Zevv | it's everybody else. you all hear me?! you! and you! yes and you! |
18:32:50 | disruptek | well, that's why i said it's ahead of nim's time. |
18:32:54 | Zevv | y'all know who I mean |
18:32:56 | Zevv | <_< |
18:33:01 | disruptek | >_> |
18:33:01 | supakeen | Sorry, I went a bit AFK did someone look into the thingy with redis + threads still? |
18:33:02 | FromDiscord | <dom96> I think I get it |
18:33:12 | Zevv | right! |
18:33:23 | disruptek | redis/threads? |
18:33:28 | FromDiscord | <Vindaar> hey Zevv, feel free to make my day have 30 h or so and then I'll gladly help 😛 |
18:33:30 | FromDiscord | <dom96> But from my perspective it seems to be fixing a somewhat niche thing (supporting embedded devices) |
18:33:33 | supakeen | disruptek: I'm trying to run nim-lang/redis in threads but am encountering some gcsafe things, what gives: https://bpa.st/raw/DY3Q, the relevant proc it points to is: https://bpa.st/7DZQ |
18:33:42 | FromDiscord | <dom96> It sounds like CPS is a reimplementation of what we already have with closure iterators |
18:33:55 | supakeen | I can't determine well which part of `readNext` is shared heap, if I understand gcsafe correctly? |
18:33:59 | Zevv | Vindaar: funny, how you answer to that outcry to the anonymous masses. makes me think you have a guilty concience |
18:34:15 | supakeen | Also here's a small program one can compile to get that message: https://bpa.st/4UIQ |
18:34:28 | FromDiscord | <Vindaar> I do, cause there's too many things I want to do / work on etc, but always fail to get even 20% of that done 😦 |
18:34:30 | disruptek | supakeen: gcsafe is just a fence to keep idiots out. |
18:34:35 | Zevv | dom96: no, CPS does'nt work on top of closures, nor iterators |
18:34:37 | disruptek | you can ignore it if you know better. |
18:34:42 | FromDiscord | <dom96> And based on what Zevv has said it seems that CSP is also the plan forward, so knowing what I know about how Go works does help me |
18:34:59 | FromDiscord | <dom96> Zevv: yes, I know. I'm saying that it replaces those. |
18:35:03 | supakeen | disruptek: How would I ignore it in this case or how would I 'fix' this in nim-lang/redis (which would probably be a better approach). |
18:35:11 | FromDiscord | <krisppurg> any help? |
18:35:11 | Zevv | dom96: right! |
18:35:31 | FromDiscord | <krisppurg> msg ^ |
18:35:45 | disruptek | dom96: it's a more general solution; more composable, more powerful. |
18:36:02 | Zevv | so, then there were discussions about doing this in userland (macros) or in the compiler, I think in the end the almighty A also acknowledged that macros would be the most appropriate path forward, for now |
18:36:06 | disruptek | supakeen: are you using zedeus's redis pool? |
18:36:13 | supakeen | disruptek: I am using nim-lang/redis. |
18:36:17 | FromDiscord | <dom96> Right, so I'm writing a ESP32 program right now and I'm not planning to use async await. To be honest, I think the ESP-IDF library exposes enough to deal with the IO in a reasonably nice way |
18:36:41 | Zevv | sure, async is typically totally overkill on embedded stuff. |
18:37:05 | FromDiscord | <dom96> You mentioned above that you would like to use this for embedded stuff though, no? |
18:37:07 | Zevv | But having the posibility to write your code linear, concurrent, and _not needing any kernel or os support_ for taking care of your concurrency |
18:37:12 | Zevv | that is pretty nifty, imho |
18:37:19 | supakeen | Note that I'm fine using a different library but I'm also trying to learn *why* this is happening :) |
18:37:39 | disruptek | cps is to concurrency what arc is to memory management, basically. |
18:38:06 | Zevv | CPS is nothing but moving the stack to the heap and cutting your functions in pieces at the resume/yield border |
18:38:14 | disruptek | supakeen: well, i don't use either lib, i just know that zedeus made his thing to solve a redis client problem. |
18:38:49 | Zevv | the stack is an illusion. because we have support from the compiler and make it part of the language we don't need a full real stack per context. |
18:38:53 | disruptek | supakeen: to ignore gcsafe you just take stuff with .gcsafe to get rid of compiler warnings. |
18:38:56 | * | Jesin quit (Quit: Leaving) |
18:38:58 | disruptek | s/take/tag/ |
18:39:03 | FromDiscord | <dom96> Zevv: right, so it's a reimplementation of closure iterators that gives more control over the allocation |
18:39:08 | disruptek | yes. |
18:39:15 | Zevv | right. |
18:39:17 | disruptek | but it's not limited to iterators. |
18:39:45 | supakeen | disruptek: Yes, but that'd involve patching nim-lang/redis so I'd like to know which part of it is causing the compiler to mark it as problematic :) |
18:39:47 | Zevv | And interestingly, a few weeks ago timothee came with a rfc out of the blue - that was not actually an rfc - where he noted that Nim could implement interators in Nim without having support from the language |
18:40:04 | Zevv | if he would have payed attention, he would have noticed this is exactly what disruptek had been doing |
18:40:28 | disruptek | as far as timmy is concerned, libraries aren't a thing. |
18:40:34 | * | Jesin joined #nim |
18:40:57 | disruptek | supakeen: look for potential memory taint between threads. |
18:41:10 | FromDiscord | <nikki> in cps can you continue from the same frame multiple times |
18:41:13 | supakeen | Sure, I'll search for taints. |
18:41:16 | FromDiscord | <nikki> or once continued is it lost |
18:41:17 | disruptek | yes. |
18:41:25 | disruptek | you can just "fork". |
18:41:29 | FromDiscord | <nikki> cool. can you duplicate 'em. serialize 'em |
18:41:30 | FromDiscord | <nikki> cool |
18:41:33 | disruptek | yes. |
18:41:34 | Zevv | nikki: it's up to the user of the continuation |
18:41:38 | Zevv | you can continue and throw away |
18:41:44 | Zevv | or you can continue twice, and then you have 2 code flows. |
18:41:47 | Zevv | some people call that fork |
18:41:52 | FromDiscord | <nikki> can you kinda implement sth like common lisp consitions / restarts over it |
18:41:59 | FromDiscord | <nikki> conditions |
18:41:59 | disruptek | yes. |
18:42:28 | FromDiscord | <lqdev> wip nim linter for rxi/lite https://www.youtube.com/watch?v=S1ssBConEBc |
18:42:36 | disruptek | i'm hoping to apply cps to my testes. |
18:42:41 | Zevv | you can zip() them, fold() them, map() them, all that |
18:42:44 | * | mika_ joined #nim |
18:42:55 | FromDiscord | <nikki> i like for loops |
18:43:07 | disruptek | https://github.com/disruptek/testes/issues/9 |
18:43:07 | disbot | ➥ use cps to clone env and run longer tests under criterion in another thread |
18:43:08 | Prestige | zip fold and map disruptek's testes? |
18:43:26 | disruptek | i've zipped my testes before. |
18:43:29 | disruptek | cannot recommend. |
18:43:45 | disruptek | folding is fine, though it doesn't increase the performance. |
18:44:01 | disruptek | the reduction in size is an illusion. |
18:44:18 | FromDiscord | <zetashift> cps doesn't work on Windows, it seems cross-platform concurrency seems to be really hard 😦 |
18:44:44 | disruptek | it'll work. flywind ported a wheel timer to windows so we can use that selectors impl there. |
18:44:58 | disruptek | but, really, cps has nothing to do with platform. |
18:45:01 | FromDiscord | <zetashift> oh nice! |
18:45:09 | disruptek | that's merely a dispatcher feature. |
18:45:40 | disruptek | we expect that many dispatchers will be developed. maybe we'll provide a toolset so you can build adhoc dispatchers really trivially. |
18:46:14 | disruptek | in most cases, your dispatcher can be written from scratch and it won't have any boilerplate to it. |
18:46:26 | dom96 | async/await supports windows just fine 👀 |
18:46:36 | FromDiscord | <shadow.> oh no |
18:46:39 | FromDiscord | <shadow.> not another async war |
18:47:08 | disruptek | there's nothing to fight about. it's like bringing a knife to a gun fight. |
18:48:27 | FromDiscord | <zetashift> the papers look like a nice read, I hope I understand it when I go through it |
18:49:16 | disruptek | imagine it's playboy and just look at the pictures and ignore the articles. |
18:49:25 | * | hmmmmm quit (Quit: brb) |
18:49:47 | FromDiscord | <zetashift> That's how I go through life anyways |
18:50:25 | * | Cthalupa quit (Ping timeout: 240 seconds) |
18:51:21 | * | Cthalupa joined #nim |
18:51:28 | Zoom[m] | @lqdev looks cool! |
18:51:35 | dom96 | So the problem for me with CPS/CSP is that it will be a very disruptive change. It needs to have more of an advantage than just removing colors from functions and making passing continuations around threads easier. |
18:52:05 | dom96 | I'm by no means ruling it out, but as it is right now I don't think it's ready for action. |
18:52:10 | disruptek | it doesn't /need/ anything. it's a library. don't use it if you don't want to. |
18:52:36 | * | mika_ quit (Ping timeout: 240 seconds) |
18:54:48 | dom96 | If it needs a dispatcher for windows then it does need something |
18:55:45 | disruptek | you supply the dispatcher yourself. |
18:55:51 | disruptek | we just happen to have written one for linux. |
18:55:55 | dom96 | It's like me telling you to use nimkernel, it doesn't need anything, just a WM, drivers for ethernet, mouse, keyboard VGA, and whatever else you actually need to use it as an OS |
18:56:27 | disruptek | dom96: cps is designed for nim programmers. |
18:56:44 | Zevv | also, it's a building block. I use it to make coroutines |
18:56:46 | disruptek | if you cannot bring rudimentary skills to bear, i don't know what to tell you. |
18:56:46 | Zevv | or exceptions |
18:56:48 | Zevv | or goto |
18:56:51 | disruptek | i hear there's a book on nim available. |
18:56:58 | Zevv | you can use it to *make* async. But you don't have to |
18:57:08 | dom96 | You need those building blocks to get started |
18:57:13 | disruptek | nah. |
18:57:14 | dom96 | Someone has to make the first move |
18:57:28 | disruptek | this is why you need to invest a little more time reading, some day. |
18:57:34 | Zevv | anyway, like disruptek said. It's a library. use it if you want, or not. |
18:57:52 | disruptek | !rfc cps |
18:57:52 | disbot | https://github.com/nim-lang/RFCs/issues/295 -- 3next steps for CPS 7& 2 more... |
18:57:57 | dom96 | Saying it can already replace async/await is simply misleading without these building blocks |
18:58:00 | disruptek | complete cps within. |
18:58:07 | disruptek | all the building blocks you need. |
18:58:12 | disruptek | feel free to copy my code. |
18:58:50 | dom96 | I'd love to use it, but I'm not going to reimplement an async dispatcher for all platforms for the third time |
18:58:53 | disruptek | let's talk again once you've learned a bit more. |
18:59:12 | dom96 | I expect most people feel that way |
18:59:43 | Zevv | I don't think anyone is forced to. |
19:00:05 | zedeus | supakeen: I've since forgotten exactly what I did, but my fork of the redis library is improved in various ways, including being quite a bit more efficient |
19:00:27 | zedeus | redpool works with the original and my fork |
19:00:40 | supakeen | zedeus: nice, i'll take a look at it tomorrow :) |
19:01:21 | zedeus | I was planning on extending the fork to match popular redis clients for other languages, but then real life happened |
19:01:42 | supakeen | as it does |
19:09:06 | FromDiscord | <adokitkat> Hello, is there any way to access fusion/smartptrs? I can't find it on 1.4.2 nor devel build. Thank you. |
19:09:15 | disruptek | zedeus: you should just take over nim-lang/redis. |
19:09:50 | FromDiscord | <dom96> @adokitkat do you have fusion HEAD installed? |
19:12:16 | FromDiscord | <adokitkat> @dom96 Thanks, that was the problem... I didn't know about the nimble package. |
19:12:46 | disruptek | this boggles my mind. |
19:18:21 | Zevv | your mind is easily boggled, of course |
19:25:01 | * | habamax quit (Ping timeout: 258 seconds) |
19:25:01 | FromDiscord | <mratsim> @dom96, I'm well on my way to implement bigint for the 4th time https://github.com/status-im/nim-stint/pull/104 |
19:25:04 | disbot | ➥ [WIP] Refactor to use an array backend ; snippet at 12https://play.nim-lang.org/#ix=2HkS |
19:25:50 | FromDiscord | <mratsim> 1st was wrapping a C++ library, 2nd was Stint, 3rd was constantine, bigint for cryptography, 4th is refactoring stint with learnings. |
19:26:16 | FromDiscord | <dom96> @mratsim if I was getting paid to work on this stuff I would gladly reimplement async 100 times until perfection 🙂 |
19:27:23 | FromDiscord | <mratsim> doing something 100 times is the best way to get disgusted by it |
19:28:07 | FromDiscord | <mratsim> anyway, my plan for tonight is seeing if I can reimplement Arraymancer in 2 different ways at the same time |
19:28:33 | * | Jesin quit (Quit: Leaving) |
19:28:39 | FromDiscord | <Daniel> Doing something many times can make you an expert in that field 🤔 |
19:29:07 | FromDiscord | <mratsim> Some stuff you only need to do them once. |
19:29:08 | FromDiscord | <nikki> i think it takes 10k times to be expert? |
19:29:15 | FromDiscord | <mratsim> 10k hours |
19:29:19 | FromDiscord | <mratsim> not times |
19:29:21 | FromDiscord | <nikki> o ya |
19:29:38 | FromDiscord | <shadow.> does that mean im an expert at being alive |
19:29:41 | FromDiscord | <nikki> do thing for one hour 10k times |
19:29:48 | FromDiscord | <Zeus> That's if you subscribe to the Gladwellian idea of experience |
19:29:49 | FromDiscord | <nikki> @shadow. kinda |
19:29:59 | FromDiscord | <shadow.> so you become an expert at living when you're 1 year and 2 months old |
19:30:01 | FromDiscord | <shadow.> or around there |
19:30:05 | FromDiscord | <Zeus> (edit) "experience" => "expertise" |
19:30:16 | FromDiscord | <mratsim> some people have 10 times 1 year of experience you mean? |
19:30:28 | FromDiscord | <mratsim> instead of 10 years of experience |
19:30:37 | * | Jesin joined #nim |
19:30:51 | FromDiscord | <lqdev> @shadow. what if i'm dead inside |
19:31:05 | FromDiscord | <shadow.> that's a you problem |
19:34:15 | FromDiscord | <Vindaar> what are you gonna try? |
19:35:12 | FromDiscord | <zetashift> He is gonna try and write it in Rust /s |
19:35:31 | FromDiscord | <exelotl> You become an expert at staying alive for an hour :P |
19:35:49 | FromDiscord | <shadow.> damn |
19:36:01 | FromDiscord | <shadow.> is there any way to make constant re strings? |
19:36:37 | FromDiscord | <shadow.> `Regex` objects |
19:37:36 | FromDiscord | <nikki> pcre? probs not bc. c |
19:37:49 | FromDiscord | <nikki> i think nim-regex or w/e could do it tho |
19:37:55 | mipri | with re you can only build them at module initialization time. with nim-regex const's an option I believe. |
19:42:28 | FromDiscord | <mratsim> @Vindaar Your PR for Laser and trying this for minitorch: https://forum.nim-lang.org/t/7230 |
19:42:52 | FromDiscord | <mratsim> @zetashift tried Rust for 3 months, you don't want to use it for scientific computing |
19:43:03 | FromDiscord | <Vindaar> Oh I see. I thought it might be those 2, but "in 2 different ways" sounded more dramatic, haha |
19:43:08 | FromDiscord | <mratsim> @shadow. use npeg |
19:43:16 | FromDiscord | <shadow.> lmao |
19:43:20 | FromDiscord | <shadow.> is that the only way |
19:43:55 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Hl2 |
19:43:58 | FromDiscord | <shadow.> nim regex? |
19:43:59 | FromDiscord | <shadow.> nre? |
19:44:10 | FromDiscord | <shadow.> or this |
19:44:11 | FromDiscord | <shadow.> https://github.com/nitely/nim-regex |
19:44:13 | FromDiscord | <mratsim> no nre is another pcre3 wrapper I think |
19:44:17 | FromDiscord | <shadow.> ahh ok |
19:44:35 | FromDiscord | <mratsim> but for compile-time support you need a pure Nim solution or loading C library at compile-time |
19:44:51 | FromDiscord | <shadow.> nim-regex is pure nim right |
19:44:52 | FromDiscord | <shadow.> so should work |
19:44:55 | * | tiorock joined #nim |
19:44:55 | * | tiorock quit (Changing host) |
19:44:55 | * | tiorock joined #nim |
19:44:55 | * | rockcavera quit (Killed (kornbluth.freenode.net (Nickname regained by services))) |
19:44:55 | * | tiorock is now known as rockcavera |
19:45:00 | FromDiscord | <shadow.> only thing is that's another dependency on the lib oof |
19:45:06 | FromDiscord | <mratsim> ah, you can also use staticExec/gorgeEx and use bash as your compile-time regex but that's even more hacky that compile-time libFFI |
19:45:12 | FromDiscord | <shadow.> yeahh |
19:45:31 | FromDiscord | <mratsim> Nim is flexible 😉 |
19:46:15 | FromDiscord | <zetashift> @mratsim, I know haha, I've read your blogpost about Rust for scientific stuff |
19:46:17 | mipri | if you're doing this for performance, I'd stick with re and just put a let block at module toplevel. The little bit of runtime work you'd save, you'll lose on not having libpcre do the study/jit thing to your regexes. |
19:46:22 | FromDiscord | <zetashift> I was making a joke! |
19:46:30 | FromDiscord | <shadow.> that's exactly what im doing rn haha |
19:46:45 | FromDiscord | <shadow.> it just doesn't feel right having a var used by only one function top level |
19:46:52 | FromDiscord | <shadow.> but ig ill do that for nowp |
19:46:53 | FromDiscord | <shadow.> (edit) "nowp" => "now" |
19:47:02 | FromDiscord | <mratsim> Don't program in C or for embedded :p |
19:47:13 | FromDiscord | <shadow.> hm? |
19:47:29 | FromDiscord | <mratsim> for embedded you use a lot of globals |
19:47:51 | FromDiscord | <mratsim> and C also (or DEFINE) for library constants. |
19:48:14 | FromDiscord | <shadow.> ohhh fair enough |
20:15:30 | FromDiscord | <shadow.> !eval echo @[0] & @[1] |
20:15:32 | NimBot | @[0, 1] |
20:15:35 | FromDiscord | <shadow.> nice |
20:25:05 | * | hmmm joined #nim |
20:25:28 | hmmm | ~areweCPSyet? |
20:25:29 | disbot | no footnotes for `areweCPSyet?`. 🙁 |
20:25:33 | hmmm | :| |
20:25:36 | * | narimiran quit (Ping timeout: 256 seconds) |
20:27:52 | * | Jesin quit (Quit: Leaving) |
20:33:22 | * | Jesin joined #nim |
20:33:31 | * | spiderstew quit (Quit: Konversation terminated!) |
20:34:24 | * | spiderstew joined #nim |
20:36:23 | * | Vladar quit (Quit: Leaving) |
20:38:54 | FromDiscord | <shadow.> are there any cycle types? |
20:38:58 | FromDiscord | <shadow.> like for cycling through values |
20:39:13 | FromDiscord | <shadow.> can be in stl or nimble |
20:39:32 | disruptek | there's a unicycle for when you only have one value and a bicycle for when you have two. i'm working on a tricycle but it's not ready for prime-time yet. |
20:40:47 | mipri | I have no idea at all what you mean by that. |
20:41:25 | disruptek | well, the tricycle requires a fundamentally different approach because it completely omits procession. |
20:41:25 | FromDiscord | <shadow.> ah makes sense disruptek |
20:41:36 | FromDiscord | <shadow.> oh mipri like |
20:41:43 | FromDiscord | <shadow.> if i had a cycle of lets say `[1, 2, 3, 4, 5]` |
20:41:51 | FromDiscord | <shadow.> i could call next() on the cycle and it'd return the next value and so on |
20:42:07 | FromDiscord | <shadow.> it'd be easy to implement myself i just dont wanna do it if it has been made already |
20:42:44 | mipri | you mean, next() on that array? not next() on a 5 of that type? |
20:42:58 | FromDiscord | <shadow.> well here |
20:43:00 | FromDiscord | <shadow.> let me make an example |
20:43:28 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Hlo |
20:43:30 | FromDiscord | <shadow.> something like that |
20:43:32 | FromDiscord | <shadow.> basically a circular list? |
20:43:36 | FromDiscord | <shadow.> maybe that's a better way to describe it |
20:43:47 | FromDiscord | <shadow.> ah i found one |
20:43:49 | mipri | ... |
20:43:50 | FromDiscord | <shadow.> singularly linked ring |
20:43:59 | FromDiscord | <shadow.> what lol |
20:44:08 | mipri | that is a third completely separate thing |
20:44:17 | FromDiscord | <shadow.> im sure it could be used as one, no? |
20:44:27 | FromDiscord | <shadow.> id just have to use the next field on a node |
20:45:20 | FromDiscord | <shadow.> and keep track of currnode |
20:45:48 | FromDiscord | <kenran> Can I give a label to a `while true:` loop somehow? I have an inner `for` loop and wish to `break` out of it and the containing `while`. Or do I have to wrap a block around the `while`? |
20:45:57 | disruptek | wrap the while. |
20:46:10 | FromDiscord | <kenran> ty |
20:46:53 | disruptek | shadow.: if you can't rotate a deque yet, you should PR that feature. |
20:48:46 | FromDiscord | <shadow.> `deque.addFirst deque.popLast`? |
20:49:17 | * | mika_ joined #nim |
20:49:33 | disruptek | not as such, but yes. rotateFront/rotateBack or whatever. |
20:49:52 | disruptek | probably Head and Tail, i guess. i dunno. let some other knuckleheads bikeshed the name. |
20:50:35 | FromDiscord | <shadow.> yeah theres no rotate proc |
20:50:58 | disruptek | point is, rotation on a deque shouldn't require push/pop. |
20:51:06 | FromDiscord | <shadow.> ahh right |
20:51:56 | FromDiscord | <shadow.> something like `rotateBack(n: int)` |
20:52:24 | disruptek | maybe you do rotate(), rotate(2), and rotate(^3). |
20:52:28 | disruptek | that seems best to me. |
20:52:33 | FromDiscord | <shadow.> oh fair |
20:53:16 | FromDiscord | <shadow.> time to find where deques is in the repo |
20:54:05 | * | mika_ quit (Ping timeout: 256 seconds) |
20:54:18 | FromDiscord | <shadow.> found it |
20:56:06 | * | muffindrake joined #nim |
20:56:41 | FromDiscord | <Quibono> Rotate(-42) |
20:57:11 | * | mbomba joined #nim |
20:57:18 | FromDiscord | <shadow.> oh yeah that might make more sense lmao |
20:57:27 | FromDiscord | <shadow.> negative instead of negative index |
20:57:37 | disruptek | support both. |
20:57:43 | FromDiscord | <shadow.> ew they dont use fcs |
20:57:44 | FromDiscord | <shadow.> ufcs |
20:57:49 | FromDiscord | <shadow.> > `emptyCheck(deq)` |
20:57:56 | FromDiscord | <shadow.> `destroy(deq.data[deq.tail])` |
20:57:59 | FromDiscord | <shadow.> blech |
20:58:05 | FromDiscord | <shadow.> im guessing i should be consistent in style and naming? |
20:58:07 | FromDiscord | <InventorMatt> in algorithms there is a couple of rotation procs for openarrays they tend to use rotateleft and rotate right for it |
20:58:27 | FromDiscord | <shadow.> ah fair |
20:58:45 | FromDiscord | <shadow.> wait no |
20:58:48 | FromDiscord | <shadow.> they only have rotateLeft |
20:58:54 | FromDiscord | <shadow.> you just supply a negative |
20:58:55 | FromDiscord | <shadow.> for right |
20:59:22 | FromDiscord | <Quibono> Ewww |
20:59:25 | FromDiscord | <lytedev> bitops I think has rotate{Left,Right} |
20:59:31 | FromDiscord | <shadow.> fair |
20:59:51 | FromDiscord | <shadow.> alr well ill get to coding |
20:59:57 | FromDiscord | <lytedev> (edit) "rotate{Left,Right}" => "rotate{Left,Right}Bits" |
21:00:11 | disruptek | i guess it's okay to have two different names as long as they both support +/-/^ overloads. |
21:00:54 | FromDiscord | <lytedev> rotate vs shift rubs me the wrong way, though... |
21:00:59 | FromDiscord | <shadow.> well stl seems to only do rotateLeft |
21:01:03 | FromDiscord | <shadow.> which is odd but i want to be consistent |
21:01:14 | FromDiscord | <lytedev> just do rotateLeft then 👍 |
21:01:16 | FromDiscord | <shadow.> yeye |
21:03:24 | FromDiscord | <shadow.> ohhhh |
21:03:24 | FromDiscord | <shadow.> i see |
21:03:29 | FromDiscord | <shadow.> you just shift head and mask |
21:03:38 | FromDiscord | <shadow.> and change first? |
21:03:40 | FromDiscord | <shadow.> or something like that |
21:03:47 | disruptek | yes. |
21:03:54 | FromDiscord | <shadow.> i see |
21:04:07 | disruptek | don't worry about consistency. |
21:04:26 | FromDiscord | <shadow.> oh ok |
21:05:01 | FromDiscord | <Quibono> If I had my own language nothing would get done because I’d want everything to be consistent. |
21:05:01 | FromDiscord | <shadow.> `emptyCheck deq` it is |
21:05:05 | FromDiscord | <shadow.> lmao |
21:06:31 | FromDiscord | <Quibono> Like any circular stuff would use rotate(), any line type object would do shift(), etc. |
21:06:47 | FromDiscord | <shadow.> fair |
21:06:56 | FromDiscord | <lqdev> then make PRs to your repo and review your own PRs |
21:07:05 | FromDiscord | <lqdev> to make sure what you wrote makes sense |
21:08:22 | FromDiscord | <shadow.> ye |
21:08:46 | FromDiscord | <Quibono> Lol just make PRs to every inconsistency in Nim lol |
21:09:09 | FromDiscord | <Quibono> I don’t think I’m anywhere near at the point where I’d feel comfortable making a PR on someone’s stuff |
21:09:21 | FromDiscord | <shadow.> hmm |
21:09:23 | FromDiscord | <shadow.> idk how to test this |
21:09:30 | FromDiscord | <shadow.> bc im making a seperate file for now to test |
21:09:33 | FromDiscord | <shadow.> and the fields are private |
21:10:05 | mipri | call some procs that have access to those fields. |
21:10:47 | mipri | by doing so, your test can resemble the code that users of the library will write. |
21:10:53 | FromDiscord | <shadow.> oh fair |
21:11:25 | disruptek | use `include` as a hack, but yeah, don't. |
21:12:15 | FromDiscord | <shadow.> or i could just edit the deques source and make them public but nah |
21:12:17 | FromDiscord | <shadow.> lmao |
21:12:30 | FromDiscord | <shadow.> might as well code how the users will |
21:13:35 | FromDiscord | <mratsim> you can use "include" |
21:13:46 | FromDiscord | <shadow.> dont think ive used that before, how does it wok? |
21:13:47 | FromDiscord | <shadow.> (edit) "wok?" => "work?" |
21:13:56 | disruptek | magic pixie dust. |
21:14:03 | FromDiscord | <mratsim> it's as if you copy pasted the code |
21:14:07 | FromDiscord | <shadow.> ahh i see |
21:14:08 | mipri | it's C's #include |
21:14:12 | FromDiscord | <shadow.> how do you use it? |
21:14:16 | mipri | just like import. |
21:14:18 | FromDiscord | <mratsim> include foo |
21:14:22 | disruptek | sprinkle liberally. |
21:14:28 | FromDiscord | <shadow.> ohh ok |
21:14:30 | FromDiscord | <mratsim> but include in general beyond test is problematic |
21:14:48 | FromDiscord | <shadow.> fair |
21:14:50 | FromDiscord | <shadow.> yeah |
21:14:54 | FromDiscord | <mratsim> even for test it will not help you test visibility issue or will hide some if you use generics and templates. |
21:15:29 | FromDiscord | <mratsim> but should be good enough for starter I think the PR for importing private field is just around the corner |
21:15:46 | mipri | and it's not appropriate for this test either. You're adding a proc and want to ensure that it works as expected. So instantiate the type and call methods on it and confirm that those methods give you answers you expect. You should absolutely not be worrying about private fields here. |
21:16:12 | FromDiscord | <shadow.> fair enough |
21:16:18 | disruptek | that PR is dumb, imo. |
21:16:47 | FromDiscord | <shadow.> hmm ok so i know i can at least shift stuff around by changing head, but i will need to edit the data seq in some way right, or no |
21:16:54 | disruptek | nah. |
21:16:58 | FromDiscord | <shadow.> damn alr |
21:17:02 | FromDiscord | <shadow.> time to figure that out |
21:17:05 | disruptek | not unless i'm wrong. |
21:17:12 | mipri | no, of course not. |
21:17:12 | disruptek | and, y'know, that never happens. |
21:17:19 | FromDiscord | <shadow.> true |
21:17:34 | mipri | you're testing the behavior of the library. Use the library. |
21:17:47 | disruptek | cray cray |
21:18:33 | FromDiscord | <shadow.> ive certainly used it, just haven't had to worry about the internals but yeah i'll go learn how the backend is implemented |
21:19:07 | mipri | you still don't have to worry about the internals, because you're writing a test. |
21:20:11 | FromDiscord | <shadow.> fair enough |
21:20:44 | mipri | if I'm writing a SuperImprovedDeque that has the same interface as this library but is implemented completely differently, I should be able to take its tests and change the import statement and use them without any other changes. Does rotateLeft work as expected? Put some numbers and rotate them and then pull them out and see if I get the rotated result. |
21:21:47 | mipri | internal access isn't completely inappropriate for tests, but it's where I'd stuff something like expensive asserts that I don't in the library proper. |
21:30:20 | FromDiscord | <shadow.> im guessing i wont need to adjust tail for this, just head |
21:30:33 | FromDiscord | <shadow.> actually wait |
21:30:33 | FromDiscord | <shadow.> hm |
21:35:51 | FromDiscord | <shadow.> ok i got something but it def will fail 80% of the time |
21:37:52 | FromDiscord | <shadow.> for a rotation of one, could you just set the deq[tail] = deq[head] and then move up head by one? |
21:38:00 | FromDiscord | <shadow.> nvm |
21:38:03 | FromDiscord | <shadow.> that would move the data up one |
21:38:06 | FromDiscord | <shadow.> ima have to think abt this lol |
21:39:45 | FromDiscord | <kenran> sent a code paste, see https://play.nim-lang.org/#ix=2HlM |
21:39:54 | FromDiscord | <kenran> (edit) "https://play.nim-lang.org/#ix=2HlM" => "https://play.nim-lang.org/#ix=2HlN" |
21:40:19 | FromDiscord | <shadow.> i mean remove the parentheses |
21:40:30 | FromDiscord | <shadow.> but |
21:40:40 | FromDiscord | <kenran> I'm coming from languages where it's quite usual to use local `let`-bindings |
21:42:59 | FromDiscord | <InventorMatt> if you only need the value of x and y then that should be fine |
21:45:03 | FromDiscord | <treeform> @pietroppeter @hugogranstrom keep was interesting. I started with a very complex solution. I was very happy when I discovered a very simple way and it worked! https://github.com/treeform/benchy/blob/master/src/benchy.nim#L42 |
21:47:21 | FromDiscord | <hugogranstrom> @treeform That's always a great feeling when you really nail it down 😄 |
21:47:27 | FromDiscord | <shadow.> so i've got the rotation to work, but it does shift the deq data forwards which is a non |
21:47:28 | FromDiscord | <shadow.> (edit) "non" => "nono" |
21:47:32 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2HlR |
21:47:34 | FromDiscord | <shadow.> if this is happening am i doing it the wrong way? |
21:47:41 | mipri | you can create a scenario with destructors where the style matters, but as a rule it's fine |
21:56:46 | FromDiscord | <shadow.> hmm |
21:56:58 | FromDiscord | <shadow.> i dont see how i can do this without shifting the data seq's head up by one |
22:06:57 | FromDiscord | <mratsim> modulo is your friend |
22:08:07 | FromDiscord | <shadow.> hmm yeah |
22:08:11 | FromDiscord | <shadow.> for multiple rotations right? |
22:08:16 | FromDiscord | <shadow.> im just gonna do one for now to get it odwn |
22:08:18 | FromDiscord | <shadow.> down |
22:09:19 | FromDiscord | <shadow.> oh wait i see |
22:13:39 | FromDiscord | <UNIcodeX> @treeform getting some visual artifacts a fidget example. Not sure if it's just my machine though. |
22:14:19 | FromDiscord | <UNIcodeX> the boxes have funny circles at the bottom left and right corners and some odd curved line at the top right corner. https://media.discordapp.net/attachments/371759389889003532/786355070945329202/unknown.png |
22:15:45 | * | FromGitter quit (Remote host closed the connection) |
22:16:04 | * | FromGitter joined #nim |
22:16:07 | FromDiscord | <UNIcodeX> (edit) @treeform getting some visual artifacts on a fidget example. Not sure if it's just my machine though. |
22:16:18 | * | azed joined #nim |
22:18:09 | FromGitter | <ynfle> Anyone use the `regex` packe? |
22:18:17 | FromGitter | <ynfle> Is the creator in here? |
22:19:18 | mipri | yes. dunno. ask a question about it. |
22:30:39 | FromGitter | <ynfle> Why doesn't this work? https://play.nim-lang.org/#ix=2Hm3 |
22:30:45 | FromGitter | <ynfle> Any idea how to make it work? |
22:31:31 | FromGitter | <ynfle> @mipri |
22:33:47 | mipri | https://play.nim-lang.org/#ix=2Hm4 |
22:35:09 | mipri | https://play.nim-lang.org/#ix=2Hm5 |
22:35:39 | FromGitter | <ynfle> Thanks |
22:36:09 | mipri | the other change in the second link is removing a trailing space from the regex |
22:37:12 | FromGitter | <ynfle> Right |
22:49:50 | FromGitter | <ynfle> Stupid question but does it have to match the whole string? |
22:50:56 | FromGitter | <ynfle> Shouldn't it just match any such substring |
22:51:22 | mipri | https://play.nim-lang.org/#ix=2Hm7 |
22:52:05 | mipri | for some reason, I can only assume a sickness of the spirit, or hostile manipulations of otherworldly beings, people insist on making regex APIs that imply anchors into your regex. |
22:52:35 | mipri | so you have to read the docs to see what the alternative is that doesn't do this. for nim-regex it's find(); for re it's contains() |
22:52:52 | FromGitter | <ynfle> :shrug: |
22:53:50 | FromGitter | <ynfle> Thanks for your help |
22:53:56 | FromGitter | <ynfle> That wasn't obvious |
22:54:20 | mipri | if you're not aware of it, grab inim |
22:54:24 | mipri | you can test this stuff interactively |
22:57:54 | FromDiscord | <shadow.> !repo inim-repl/inim |
22:57:55 | disbot | https://github.com/inim-repl/INim -- 9INim: 11Interactive Nim Shell / REPL / Playground 15 378⭐ 18🍴 |
22:58:13 | FromGitter | <ynfle> Ya I have it thanks |
22:58:18 | * | tane quit (Quit: Leaving) |
22:59:18 | FromDiscord | <adokitkat> Hi again. Is there a way to optimize Nims JS output for size? (Karax output)? ↵Or maybe a way to bypass this bug (I think it is this one at least) https://github.com/nim-lang/Nim/issues/7126↵I am running AsyncHTTPServer on ESP32 via nesper byt response bigger than 25+- kB will cause an exception and reboots it. I think Nim wants to access too large memory at once in `await reg.respond()`. |
22:59:19 | disbot | ➥ No way to process async HTTP response in chunks |
23:01:04 | FromGitter | <ynfle> Not sure your issue, but try compile with `--opt:size` |
23:02:22 | FromDiscord | <adokitkat> thats not working really well unfortunately |
23:02:26 | FromDiscord | <ElegantBeef> Could you not run jsminifier on it? |
23:03:46 | FromDiscord | <adokitkat> @ElegantBeef oh thanks that shaved like 50 kB |
23:03:52 | * | Prestige quit (Quit: Prestige) |
23:04:18 | FromDiscord | <ElegantBeef> Seriously? 😄 |
23:05:03 | FromDiscord | <adokitkat> original size is 143 Kb and output from online minfier is 93kB |
23:06:28 | * | Prestige joined #nim |
23:08:39 | FromDiscord | <adokitkat> compressed with gzip it has 17kB (the 143kB original was 22kB gzipped) |
23:08:52 | FromDiscord | <adokitkat> thats nice, thanks for a tip |
23:33:01 | FromGitter | <ynfle> @mipri Thanks, I worked it out. Inim is hard for debugging regex because it doesn't show you why it failed |
23:35:40 | FromGitter | <fish-face> Is there a stdlib way to perform a `map` in which the proc takes the index as well as the value? |
23:37:20 | FromGitter | <ynfle> You can do `toSeq(sequence.pairs)` Which will give you the index |
23:38:00 | FromGitter | <fish-face> ah yes |
23:38:52 | FromDiscord | <ElegantBeef> ynfle what are you parsing? |
23:39:27 | FromGitter | <ynfle> @fish-face You could also do `zip(toSeq(1..2), [1, 2])` |
23:39:30 | * | disruptek throbs. |
23:39:51 | FromGitter | <ynfle> @ElegantBeef I'll give you 25 guesses 😉 |
23:40:09 | FromDiscord | <ElegantBeef> aoc bag problem? |
23:41:19 | FromGitter | <ynfle> Ya day 7 |
23:41:31 | FromGitter | <ynfle> Only getting to it now cause of school |
23:41:46 | FromGitter | <ynfle> I started off using parseutils, but it got complicated quickly |
23:41:50 | FromDiscord | <ElegantBeef> Ah, i've just been jumping to strscan for aoc 😄 |
23:42:40 | FromDiscord | <ElegantBeef> If curious of my super intelligent and not dumb impl https://play.nim-lang.org/#ix=2Hmo |
23:42:44 | FromGitter | <ynfle> Seemse really cool |
23:42:56 | FromGitter | <ynfle> I'll look at it once I'm done mine |
23:43:17 | FromGitter | <ynfle> Is it lighter weight than regex? |
23:43:25 | FromDiscord | <ElegantBeef> Less annoying imo |
23:43:41 | FromGitter | <ynfle> Not hard to beet |
23:44:01 | FromDiscord | <ElegantBeef> For instance `line.strscan("$i-$i", a ,b)` will have a and b both containing the integers at those positions in the `line` |
23:44:15 | FromDiscord | <ElegantBeef> Although you do currently have to predeclare the variables |
23:44:22 | FromGitter | <ynfle> Nice |
23:44:56 | FromDiscord | <ElegantBeef> I do have a PR which will probably die that injects the variables by using the pattern to find the type 😄 |
23:46:19 | FromGitter | <fish-face> @ynfle I am doing AoC in Nim. My friend wrote a parser in Rust's PEGS equivalent to do Day 7 |
23:46:24 | FromGitter | <fish-face> (I used regex) |
23:46:26 | FromGitter | <ynfle> Do you get to choose the variable names |
23:46:37 | FromGitter | <ynfle> Nice |
23:46:44 | FromGitter | <ynfle> That seems overkill |
23:46:50 | FromGitter | <ynfle> The regex is simple |
23:46:55 | FromGitter | <fish-face> Yes |
23:46:56 | * | lbart quit (Ping timeout: 240 seconds) |
23:47:04 | FromGitter | <fish-face> but it's a learning exercise so.. whatever you want to learn |
23:47:14 | FromGitter | <ynfle> But I guess overkill is a programmers other title |
23:47:16 | FromGitter | <ynfle> Ya |
23:47:46 | FromGitter | <ynfle> There were cool visualizations for the plane one on the subreddit |
23:49:01 | * | lritter quit (Quit: Leaving) |
23:51:51 | * | vicfred joined #nim |
23:52:54 | FromDiscord | <ElegantBeef> Yea zevv used npegs for his |
23:53:03 | FromDiscord | <ElegantBeef> I think it was that one, or one of them |