<< 14-01-2022 >>

00:01:48*Gustavo6046 quit (Read error: Connection reset by peer)
00:01:49arkanoidnimpy is great for python, futhark is great for C, should I consider nbindgen on same level?
00:02:14arkanoidI've never used rust in my life, just tutorial to understand what kind of beast it is
00:02:38arkanoidI'm interested in some scientific libraries written in it
00:06:42*Gustavo6046 joined #nim
00:11:52noeontheendFrom this whole conversation, I guess I'm the oddball--I deeply enjoy writing both Nim and Rust.
00:18:46nrds<Prestige99> hm this blows that closure iterators can't recurse
00:18:50arkanoidfighting the borrow checker and the ugly syntax is keeping my away from rust, but apart from that, I do understand the revolution it brings
00:26:44nrds<Prestige99> Couldn't get any of the macros working for my use case, for some reason
00:27:15FromDiscord<Elegantbeef> What are you trying to do?↵(<@709044657232936960_nrds=5b=49=52=43=5d>)
00:27:28FromDiscord<Elegantbeef> Oh right that reply was silly 😀
00:30:33FromDiscord<evoalg> In reply to @noeontheend "From this whole conversation,": What do you like about Nim (as compared to Rust)?
00:30:49FromDiscord<Elegantbeef> Prestige what're you doing!
00:31:00nrds<Prestige99> https://play.nim-lang.org/#ix=3M6Y
00:31:06FromDiscord<Elegantbeef> Attempting a recursive iteration over a binary tree?
00:31:12nrds<Prestige99> yep
00:31:18nrds<Prestige99> for postorder iteration
00:35:34FromDiscord<Elegantbeef> Why didnt the for loop macro not work
00:35:46FromDiscord<Elegantbeef> Or that without a double negative
00:37:32noeontheendevoalg: It's hard for me to pin down why, but I always tell people Nim fills me with joy. I think a big part is actually the syntactic flexibility--I feel like I can write in whatever style I want to whenever I want to. Another big plus is the stdlib. sequtils and sugar in particular make life very pleasant.
00:38:08nrds<Prestige99> I tried a few and they failed for different reasons beef, I can try pulling them in again and making a playground
00:38:38nrds<Prestige99> https://play.nim-lang.org/#ix=3M7b
00:39:29FromDiscord<evoalg> In reply to @noeontheend "<@900872397224280125>: It's hard for": interesting thank you, and what do you like about Rust (as compared to Nim)?
00:46:29noeontheendevoalg: Again, I'm struggling to articulate it because I think it's mostly matters of taste. I like how explicit (most) things are in Rust. Without going full Rust-evangelist, it is nice to have memory safety and no GC (don't throw things, I <3 Nim). Then Rust has enough modern features (ADTs, a reasonably powerful type system, various functional niceties, etc.) that I feel like it fits my style well.
00:46:59FromDiscord<Elegantbeef> well the only thing to throw is that `arc/orc` arent a conventional GC\: P
00:47:03FromDiscord<Sabena Sema> I find nim way more ergonomic in almost every way than rust
00:47:25noeontheendI will say that I didn't fully grok the borrow checker for a *long* time. Like, I thought I did, but I only recently realized I didn't. My last few projects in Rust have been much better because I'm finally understanding why things that I thought should work weren't working.
00:47:44FromDiscord<Elegantbeef> Prestige this is doable without recursion just requires a big ol' think
00:48:48noeontheendElegantbeef: Touché, ARC/ORC are really nifty.
00:48:56FromDiscord<evoalg> In reply to @noeontheend "I will say that": Thank you!
00:49:15FromDiscord<Sabena Sema> you don't really save much memory with a non-recursive tree visitation
00:49:25FromDiscord<Sabena Sema> but can save some I guess
00:49:33FromDiscord<Elegantbeef> Well the issue prestige wants it in an iterator
00:49:42FromDiscord<Sabena Sema> oh, yeah
00:49:48FromDiscord<Sabena Sema> in that case make the stack explicit
00:50:00nrds<Prestige99> oh
00:50:07FromDiscord<Elegantbeef> Sabena can probably help you make this work better than i
00:50:52FromDiscord<Sabena Sema> you basically just make a stack, push the root on, then write `while !stack.empty() ...`
00:51:19FromDiscord<Sabena Sema> visiting the current node is a pop followed by an operation
00:52:04FromDiscord<Sabena Sema> traversing to the next node is a peek followed by pushing the node then continuing
00:52:05FromDiscord<Sabena Sema> etc
00:53:11FromDiscord<Rika> I sleep and the rust thread gains 25 replies
00:53:13FromDiscord<Rika> Jesus
00:53:31FromDiscord<Elegantbeef> I slept and it was made and locked with 25 replies 😀
00:53:52FromDiscord<Rika> I’ll backread the channel wait
00:55:45FromDiscord<Sabena Sema> There's almost no reliable evidence that any language reduces overall number of bugs (I think C vs writing assembly has some compelling evidence)
00:56:32FromDiscord<Sabena Sema> it's plausible that it does, but it's hard to study effectively, most people who do study it don't do very good experimental design, and results so far have not shown much
00:56:55FromDiscord<Elegantbeef> hey `set[T]` can easily reduce bugs caused by bitwise operations 😛
00:57:54nrds<Prestige99> Sabena: so I'd basically build the stack until I reach a leaf node, then yeild the leaves in left, right order?
00:58:00nrds<Prestige99> That may work..
00:58:59FromDiscord<Sabena Sema> yeah you probably want "peak always, then pushes for children (with continue) then yield, then pop"
00:59:20FromDiscord<Sabena Sema> In reply to @Elegantbeef "hey `set[T]` can easily": it might, it might not
00:59:33FromDiscord<Sabena Sema> it's plausible that it does
01:00:00FromDiscord<Elegantbeef> I was mostly joking
01:01:13FromDiscord<Sabena Sema> it ends up being the same amount of memory basically, but it's heap memory, so you tend to be able to use a lot more
01:01:35FromDiscord<Sabena Sema> and it's in reality slightly less memory because you don't have to store the return address or frame pointers or whatnot
01:03:32FromDiscord<Sabena Sema> I do like Araq's quote about round wheels, you can't get a round wheel via incremental improvements
01:04:13FromDiscord<Sabena Sema> Anyway wrapping rust has the same problem as C++, the abi isn't usually stable
01:04:22FromDiscord<Sabena Sema> for rust it's worse because the language abi itself is unstable
01:04:52FromDiscord<Sabena Sema> also: I _hate_ that rust doesn't have any implicit widening conversions
01:05:14FromDiscord<Sabena Sema> it's like someone saw C's integral promotions (which are _different_) and just decided all widening was bad
01:05:43FromDiscord<Sabena Sema> imho Rust's standard library _is_ extremely good
01:08:14FromDiscord<Patitotective> In reply to @Patitotective "Hey <@!392962235737047041>, I'm having": i think i've got the answer, make three different rules, the start of the sequence, the content and the end, so it starts saving the elements in the content until the end
01:50:59*adigitoleo_ is now known as adigitoleo
02:02:27FromDiscord<Patitotective> I have an object and I want the `seqRef` field to be a reference to a sequence so if I change that field the sequence changes, but I'm not sure how to set that field to something↵`ref mySeqVar`??↵https://play.nim-lang.org/#ix=3M7u
02:03:29FromDiscord<Elegantbeef> To have what you want you need to make the seq a reference aswell
02:04:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M7y
02:04:33FromDiscord<Patitotective> Oh, that makes sense
02:04:34FromDiscord<Patitotective> Thanks
02:04:36FromDiscord<Patitotective> 🙃
02:05:27nrds<Prestige99> hmm, @Sabena Sema working on postorder for a binary tree, the only solution I can think of is building the entire stack _first_, then iterating over it and yielding each element. Do you know if there's a way I could do that without this?
02:05:35nrds<Prestige99> maybe if I had a do while
02:06:36FromDiscord<dumbmahreeo> Hey, is someone else having trouble cross compiling to ARM64 from x86\_64?↵↵The compilation doesn't fail but the produced binary is still a x86\_64
02:07:07FromDiscord<Elegantbeef> how are you attempting to compile it?
02:09:49FromDiscord<dumbmahreeo> immagine.png https://media.discordapp.net/attachments/371759389889003532/931369484386713660/immagine.png
02:12:22FromDiscord<Elegantbeef> You did read https://nim-lang.org/docs/nimc.html#crossminuscompilation ?
02:12:30FromDiscord<dumbmahreeo> yep
02:14:19FromDiscord<Elegantbeef> compile with `--verbosity:2` to see the command it calls
02:14:35FromDiscord<Elegantbeef> I swear there is a way to get it to echo the C compiler command but i dont recall
02:14:37*noeontheend quit (Ping timeout: 240 seconds)
02:14:46FromDiscord<Elegantbeef> it might be `--listCmd`
02:15:04FromDiscord<dumbmahreeo> It's quite the output, gonna put it on pastebin
02:15:13FromDiscord<Elegantbeef> Ah yes `--listCmd` does
02:15:53FromDiscord<dumbmahreeo> https://pastebin.com/Ay0QwZrE↵↵This is --verbosity\:2 output, gonna try --listCmd now
02:15:55FromDiscord<Bung> In reply to @PMunch "That is still a": I dont know since it changes main branch, I can assuming my first PR will be merged , then create PRs base on that, If the first PR can
02:16:20FromDiscord<dumbmahreeo> immagine.png https://media.discordapp.net/attachments/371759389889003532/931371126205055066/immagine.png
02:16:21FromDiscord<Elegantbeef> I just tried `--arm64` it compiled with no issue but `--arm` threw an error
02:16:30FromDiscord<Bung> (edit) "can" => "can't not be merged, I just waste of my time."
02:17:15FromDiscord<dumbmahreeo> Yardanico on the telegram group is telling me that I need a separate C compiler to cross compile
02:17:31FromDiscord<dumbmahreeo> I've never attempted C or C++ cross compilation so I know nothing about them
02:17:39FromDiscord<dumbmahreeo> Only time I've tried cross compilation was with Rust and Go
02:17:48FromDiscord<dumbmahreeo> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/931371419365945355): I've never attempted C or C++ cross compilation so I know nothing about this
02:17:51FromDiscord<Elegantbeef> Yea you need to get the arm tool chain
02:17:52FromDiscord<Elegantbeef> It might be in your package manager
02:18:15FromDiscord<Elegantbeef> Like when i try with `--cpu:arm` i get `/bin/sh: 1: arm-linux-gnueabihf-gcc: not found`
02:21:03FromDiscord<auxym> hey beef, in your tusb stuff, why are you using `codegendecl: "$1 $2$3"` a lot, instead of say `{.cdecl.}`?
02:21:29FromDiscord<Elegantbeef> Cant recall atm
02:21:38FromDiscord<dumbmahreeo> Perhaps the package aarch64-linux-gnu-gcc will do
02:21:40FromDiscord<Elegantbeef> Think it was related to what they expected
02:21:41FromDiscord<Elegantbeef> especially `const`
02:21:49FromDiscord<auxym> k
02:26:16*neurocyte091709 joined #nim
02:27:54*neurocyte09170 quit (Ping timeout: 250 seconds)
02:27:54*neurocyte091709 is now known as neurocyte09170
02:28:17FromDiscord<dumbmahreeo> Nope, absolutely nothing changed after installing the package along with all its dependencies (glibc, headers, etc...)
02:29:22FromDiscord<Elegantbeef> Given that `arm64` doesnt error and produces a binary that runs on amd64 i think there is a misconfiguration with the c compiler
02:29:24FromDiscord<Elegantbeef> I could be wrong
02:31:50FromDiscord<auxym> https://nim-lang.org/docs/nimc.html#crossminuscompilation
02:32:04FromDiscord<Elegantbeef> If only someone didnt link it before!
02:32:41FromDiscord<dumbmahreeo> I already read it before asking \:D↵(@auxym)
02:32:52FromDiscord<auxym> oh
02:33:03FromDiscord<auxym> did you set the `aarch64.linux.gcc...` options in your nim.cfg?
02:35:02FromDiscord<auxym> in case it helps: see here the options I pass for arm cortex mcus (`arm-none-eabi-gcc`): https://github.com/auxym/nim-on-samd21/blob/master/config.nims#L13
02:35:10FromDiscord<dumbmahreeo> sent a code paste, see https://play.nim-lang.org/#ix=3M7z
02:36:36FromDiscord<auxym> not sure, I set them myself in config to get it to work. See above link, combined with cli args `--os:any --cpu:arm`
02:37:47FromDiscord<auxym> https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L23
02:37:51FromDiscord<Elegantbeef> I think for crosscompilation they dont have a consistent name which is why it's something you have to set
02:38:37FromDiscord<auxym> That's the default config, it calls `arm-linux-gnueabihf-gcc` for `--cpu:arm`, which is the cross toolchain for 32bit arm
02:39:09FromDiscord<Elegantbeef> Oddly `--cpu:arm64` calls your default gcc
02:39:52FromDiscord<dumbmahreeo> Wait, I solved
02:39:56FromDiscord<auxym> no idea, it might fall back on the default if there's nothing in the config?
02:40:06FromDiscord<Elegantbeef> Perhaps
02:40:09FromDiscord<dumbmahreeo> immagine.png https://media.discordapp.net/attachments/371759389889003532/931377117114023986/immagine.png
02:40:24FromDiscord<dumbmahreeo> Yardanico told me to simply point to the aarch64 compiler trough those flags
02:40:32FromDiscord<Elegantbeef> no make a `config.nims` with those
02:40:35FromDiscord<Elegantbeef> now\
02:40:37FromDiscord<Elegantbeef> And you're holden
02:40:40FromDiscord<Elegantbeef> golden even
02:40:42FromDiscord<dumbmahreeo> Which I guess is what auxym was telling me to do
02:40:43FromDiscord<auxym> yeah that's the equivalent of setting those in the config
02:40:51FromDiscord<dumbmahreeo> Yeah, that's what I'll
02:41:00FromDiscord<dumbmahreeo> Yeah, that's what I'll do. This was just a test though
02:41:19FromDiscord<auxym> I thing you can define an arbitrary string for the cpu? Like you could call it arm64 or aarch64?
02:41:22FromDiscord<Elegantbeef> Yea we were all pointing to manually setting those 😀
02:41:26FromDiscord<Elegantbeef> So cheers, we have it!
02:41:35FromDiscord<auxym> If you want to differentiate from eabihf (332bit arm)
02:41:38FromDiscord<Elegantbeef> nah if you dont pass one of the valiid cpu flags iterrors
02:41:45FromDiscord<auxym> ah
02:41:48FromDiscord<Elegantbeef> it errors\
02:41:57FromDiscord<dumbmahreeo> Now time to try statically linking with musl while crosscompiling
02:42:12FromDiscord<Elegantbeef> like i tried `nim --cpu:dinglebop` to see and it errored with a list of valid CPUs
02:42:38FromDiscord<Elegantbeef> You can do `-d:arm64` which is used by your `config.nims`
02:43:14FromDiscord<auxym> arm64 is in there, that's probably what you should use for `--cpu` @DumbMahreeo
02:43:34FromDiscord<auxym> combined with `arm64.gcc...` options in nim.cfg
02:43:39FromDiscord<dumbmahreeo> That's what I use for --cpu, aarch is just how the compiler toolchain is called↵(@auxym)
02:43:40FromDiscord<Elegantbeef> Yep
02:43:48FromDiscord<auxym> all good
02:43:57FromDiscord<Elegantbeef> that's why it compiles with system
02:44:05FromDiscord<Elegantbeef> It doesnt have a default and falls through system gcc
02:44:19FromDiscord<Elegantbeef> Wonder if a PR should be made for this
02:44:27FromDiscord<auxym> yeah. someone should probably put in a pr
02:44:37FromDiscord<Elegantbeef> I'm a numpty so i dont know 😀
02:45:38FromDiscord<Elegantbeef> I wonder how many fun conversations i miss from telegram
02:45:43FromDiscord<Elegantbeef> I know they despised when they got bridged here 😀
02:52:59FromDiscord<evoalg> what's this telegram channel you speak of?
02:53:32FromDiscord<Elegantbeef> There is a nim chat on telegram
02:54:02FromDiscord<evoalg> I have telegram ... dunno if it's worth checking out tho
02:54:14FromDiscord<Elegantbeef> Probably a few people that dont come here there
02:54:43FromDiscord<Elegantbeef> It's 100% less me so clearly superior
02:54:54FromDiscord<dumbmahreeo> I just realized I'm also on the Discord after receiving the ping both on Matrix and on Discord
02:54:54FromDiscord<evoalg> ... not to sound like a stalker, but I'll stick to where you are beefy
02:55:19FromDiscord<Elegantbeef> I think i'll stay where i am aswell though
02:55:50FromDiscord<evoalg> Then I'll do nothing ... I'm good at that (just ask my boss)
02:55:51FromDiscord<dumbmahreeo> Btw I think eventually I'm gonna create something like Rust's cross. Containers to have seamless crosscompilation
02:56:16FromDiscord<Elegantbeef> When i was searching for the flags i diid stumble on https://github.com/iffy/nimxc
02:56:24FromDiscord<Elegantbeef> Might be up your alley
02:56:58FromDiscord<Elegantbeef> Evo you capable of profiling yet?
02:57:23FromDiscord<evoalg> no ... I'm going to use something to time proc's myself
02:58:02FromDiscord<Elegantbeef> Hey it's template time!
02:58:12FromDiscord<Elegantbeef> PS use `std/monotimes`
02:58:48FromDiscord<evoalg> ok thanks ... I think in my notes I have an example of monotimes .. .maybe it was one of your eg's
02:58:58FromDiscord<Elegantbeef> Perhaps
02:59:00FromDiscord<evoalg> it's not a template tho
02:59:40FromDiscord<evoalg> I was just going to do it horribly and update some global vars instead the proc
03:00:32FromDiscord<evoalg> I was even thinking of writing a bash script to copy nim code and substitute it in ... see what I mean by horrible?
03:01:22FromDiscord<evoalg> I mean take nim source file and substitute it into a 2nd nim source file ... in case there are lots of procs
03:01:40FromDiscord<dumbmahreeo> Everything works like a charm, aarch64 cross compilation + musl static linking. Thanks everyone for the help
03:01:42FromDiscord<Elegantbeef> templates you're describing templates 😀
03:01:54FromDiscord<Elegantbeef> Or macros
03:02:15FromDiscord<evoalg> so with templates, I'd just do a call at the beginning of the proc and the end?
03:04:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M7F
03:04:48FromDiscord<evoalg> oh!!
03:05:52FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/WXq
03:06:25FromDiscord<evoalg> ahhh ok as it doesn't care what the body is
03:07:51FromDiscord<evoalg> that's cunning, and simple!
03:10:51FromDiscord<evoalg> that 2nd code times the calling of the two procs, but both of those proc's are timed too ... so I get total and breakdown ... amazing
03:13:06FromDiscord<evoalg> `static string` because the template it in-lined at compile time, ok I see
03:13:23FromDiscord<Elegantbeef> the calls for monotime and echo have some cost, nah the static is just so you dont do silly stuff 😛
03:14:25FromDiscord<evoalg> so if it was just `string` instead of `static string` what silliness could I do?
03:15:14FromDiscord<Elegantbeef> Pass in runtime strings basically is it
03:15:18FromDiscord<Elegantbeef> So concatenated funky stuff
03:21:15FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3M7H
03:21:31FromDiscord<Rika> The time code has overhead
03:21:33FromDiscord<Elegantbeef> echoing takes time
03:21:43FromDiscord<Rika> That as well
03:23:44FromDiscord<Elegantbeef> Really the time it should be used to time overall operations and not procedures do to the overhead
03:24:52FromDiscord<evoalg> ahh ok ... I was hoping to extend this to update the total times a proc is called (adding to a variable for the proc each time it's called) so at the end I can have total times for each proc ... and maybe the number of times they are called ... just to get a sense of which proc is using most of the time etc. I guess I can use a table
03:34:25FromDiscord<evoalg> Can the template get the name of the proc it's inside? .. or is that asking a bit much from it?
03:34:43*arkurious quit (Quit: Leaving)
03:35:40FromDiscord<Elegantbeef> It can with a hack
03:35:40FromDiscord<Elegantbeef> But as is it cannot
03:36:15FromDiscord<evoalg> that's fine ... I'll keep it simple and in a way I can understand ... it's a great little temple, thank you beefy!
03:40:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M7J
03:43:37FromDiscord<evoalg> oh!
03:43:49FromDiscord<Elegantbeef> Evo's like "Well cool but i dont know what's going on, send help"
03:43:59FromDiscord<evoalg> lol
03:43:59*rockcavera quit (Remote host closed the connection)
03:44:11FromDiscord<Elegantbeef> Oh guess we dont need the static string parameter anymore
03:45:56FromDiscord<evoalg> that feeling a bliss but confusion at the same time ... it's like you're giving me drugs
03:46:14FromDiscord<Elegantbeef> Drugs are cool dont got to school kids
03:46:29FromDiscord<Elegantbeef> I think that's what we're supposed to say
03:46:53FromDiscord<evoalg> that's what all the dealers say ... even the dealer kids
03:48:02FromDiscord<evoalg> I'm sure before long I'll be back for more
03:48:22FromDiscord<Elegantbeef> It'll give you a small amount of enjoyment but just more want for knowledge
03:48:24FromDiscord<Elegantbeef> Is learning a drug
04:01:01FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3M7P
04:06:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M7Q
04:07:28FromDiscord<evoalg> magic!
04:08:39FromDiscord<evoalg> @hmmm take a look at this!
04:08:48FromDiscord<Elegantbeef> Of course you can make an overload that takes a string you can put in place of `getProcName(start)` like it was doing so you can have named blocks
04:09:35FromDiscord<evoalg> Right
04:12:18FromDiscord<evoalg> I'm tempted to just stay with the template
04:30:00FromDiscord<huantian> Just to make sure I’m C-ing correctly, a Window is the same as a ptr UncheckedArray[ptr Window] right
04:30:40FromDiscord<Elegantbeef> Sounds right
04:31:42FromDiscord<huantian> Then I have still 0 idea why XQueryTree is only filling the first element of the array
04:36:13FromDiscord<Elegantbeef> Can i see the code again?
04:37:26FromDiscord<huantian> Yeah sure, just 1 dev
04:37:29FromDiscord<huantian> Sec
04:47:10FromDiscord<mratsim> In reply to @leorize "btw <@570268431522201601>, are you": My time has been blackholed by being a father ¯\_(ツ)_/¯
04:47:37FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3M7Y
04:48:46FromDiscord<congusbongus> In reply to @mratsim "My time has been": then your children must inherit your duties, for the good of the kingdom
04:53:58FromDiscord<mratsim> In reply to @congusbongus "then your children must": they certainly cry for food efficiently enough. With O(1) complexity
04:54:39FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/hil
04:54:43FromDiscord<Elegantbeef> I dont get why it returns an incorrect length but it does
04:59:49FromDiscord<huantian> It doesn't make sense that there's only one child window though
05:00:16FromDiscord<huantian> thanks for the help tho
05:45:15FromDiscord<evoalg> In reply to @mratsim "My time has been": Congrats!
06:24:18NimEventerNew thread by Bj0: Cannot instantiate: 'T' with importcpp generic, see https://forum.nim-lang.org/t/8803
06:50:17*anadahz quit (Remote host closed the connection)
06:50:38*anadahz joined #nim
07:11:40*jjido joined #nim
07:12:25NimEventerNew thread by Ethernaut: Variable prints out its type correctly, but can't access members and I can't figure out why, see https://forum.nim-lang.org/t/8804
07:21:26FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3M8f
07:22:16FromDiscord<evoalg> https://termbin.com/jjlo
07:22:51FromDiscord<evoalg> (since play is down)
07:23:56FromDiscord<Elegantbeef> `sortedByIt` exists btw
07:24:26FromDiscord<Elegantbeef> Oh wait that's a table
07:25:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M8g
07:27:20FromDiscord<Elegantbeef> tinge cleaner even
07:27:24FromDiscord<evoalg> "tingle" <-- I like that word .... yea I sort of remembered that was hasKeyOrPut but then I sort of remembered it was slow or something (but I'm probably misremembering)
07:27:38FromDiscord<evoalg> no I'm sticking with tingle
07:27:48FromDiscord<Elegantbeef> It's not slow it just lacks lazy evaluation
07:28:02FromDiscord<Elegantbeef> So `(1, delta)` is created regardless of if it has the key
07:28:47FromDiscord<evoalg> ok nice thank you!
07:29:00FromDiscord<Elegantbeef> The issue is when that's a function call or something costly
07:29:54FromDiscord<evoalg> a function call to create the key?
07:30:10FromDiscord<Elegantbeef> A function to create the new entry
07:30:35FromDiscord<Elegantbeef> Say you do `calltimes.hasKeyOrPut(name, aCostlyCalc())`
07:31:01FromDiscord<evoalg> ahhhh right!
07:31:21FromDiscord<evoalg> In reply to @Elegantbeef "So `(1, delta)` is": that's why you said this ... I understand now!
07:31:31FromDiscord<Elegantbeef> With lazy evaluation that you get from a template you can only do that when you add a key
07:32:50FromDiscord<evoalg> now I'm confused again by your last sentence 😉
07:34:03FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Nru
07:34:40FromDiscord<Elegantbeef> Unlike if a function `newVal` will get moved into a conditional statement and only get called if it's met
07:35:18FromDiscord<Elegantbeef> This gives us lazy evaluation like behaviour, we can pass `aCostlyCalc()` to a call, but it only is evaluated under a specific scenario
07:36:28FromDiscord<Elegantbeef> Versus a function call which is eagerly evaluated, when we call the present `hasKeyOrPut` all arguments are called if they're a function then it calls the procedure
07:38:28FromDiscord<Elegantbeef> This just comes down to templates being code substitution and as such dont call function arguments, they just take them as is and paste them at the call site
07:39:50FromDiscord<evoalg> I think I may be falling in love with templates
07:40:00FromDiscord<Elegantbeef> They're quite nice tools
07:40:26FromDiscord<Elegantbeef> They give you flexibility and reduce redundancy
07:41:03FromDiscord<Elegantbeef> The half joke i say is i hate coding so i use metaprogramming to make me not code as much
07:42:02FromDiscord<evoalg> hehehe gotcha ... but ... but with macros, it's like learning a whole new languages by the looks
07:42:34FromDiscord<Elegantbeef> And i mean like your first reaction to do what you're doing was to use an external tool to generated code, which ime is what languages without templates/macros force you to do
07:42:48FromDiscord<Elegantbeef> It's not a whole knew language as much as learning what this language does under the hood
07:42:56FromDiscord<Elegantbeef> You learn the languages semantics at a lower level
07:43:26FromDiscord<evoalg> You got me there
07:43:41FromDiscord<evoalg> guilty as charged
07:44:04FromDiscord<Elegantbeef> Macros really arent that complex once you realize you're a manual macro writer
07:45:33FromDiscord<Elegantbeef> Like for the getting proc name stuff the code that's written goes up the owner and looks for a `proc`, which is basically what you'd do when looking for the proc name
07:45:55FromDiscord<Elegantbeef> You'd look until you find the first `proc name` and then copy that name to where you want
07:46:06FromDiscord<Elegantbeef> Owners in nim are a bit more complicated but you can just think of them as any named scope
07:46:40FromDiscord<evoalg> ok
07:47:27FromDiscord<evoalg> thank you btw for letting me start to get comfy with templates first ... starting to, but a long way to go 😉
07:47:54FromDiscord<evoalg> and that template you gave me sold it
07:47:55FromDiscord<Elegantbeef> The thing that tickles my brain is that it's technically possible to have an entire compiler written in macros 😀
07:48:10FromDiscord<evoalg> LOL!
07:48:25FromDiscord<Elegantbeef> You'd have to be a masochist todo it, but it's technically possible, since macros can represent any code
07:48:53*PMunch joined #nim
07:50:17FromDiscord<Elegantbeef> Once you use macros and templates you're corrupted and will miss them where you dont have them
07:50:18FromDiscord<evoalg> it is possible to write a nim-non-macro-to-macro converter?
07:50:38FromDiscord<Elegantbeef> You mean take nim code and generate a macro from it?
07:50:58FromDiscord<evoalg> yea ... like, it takes a whole program and automatically converts it to macros but it does the same thing
07:51:08FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html#dumpAstGen.m%2Cuntyped
07:51:18FromDiscord<evoalg> ohhhhhhh
07:52:04FromDiscord<Elegantbeef> Not that it'd be very useful or pointful, it's probably possible
07:52:30FromDiscord<evoalg> yea true I dunno why I was wondering about that
07:53:17FromDiscord<evoalg> I must be a tingle tired
07:53:32FromDiscord<Elegantbeef> lol
07:54:08PMunchI mean you can wrap your entire codebase in a macro call, that would turn it into a macro :P
07:54:24FromDiscord<evoalg> hehe true
07:54:26FromDiscord<Elegantbeef> In the loosest sense
07:54:52FromDiscord<Elegantbeef> All code needs to be making nodes or it doesnt count!
07:56:02FromDiscord<evoalg> "code with nodes"
07:57:07FromDiscord<Elegantbeef> Stuff like this though is what just makes me love templates https://github.com/beef331/nimscripter/blob/master/tests/example/first.nims#L48-L71
07:57:16FromDiscord<Elegantbeef> Plays right into my i dont like writing code 😛
07:58:33FromDiscord<evoalg> hang on ... what does that do?
07:59:01FromDiscord<Elegantbeef> Emits a bunch of procedures named `getType` so for `uint16` emits `getunit16`
07:59:08FromDiscord<Elegantbeef> `uint16`\
07:59:36FromDiscord<Elegantbeef> Templates have a symbol joining feature where you can abuse the acc quote to join a symbol
08:00:05FromDiscord<evoalg> "acc"?
08:00:18FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/3dB
08:00:27FromDiscord<Elegantbeef> accent i think, dont recall
08:01:12FromDiscord<evoalg> ohhhh
08:01:28FromDiscord<Elegantbeef> It's just any identifier that surrounded by backticks
08:01:54FromDiscord<evoalg> so `makeNumTest(char)` is expanded into what?
08:02:09FromDiscord<evoalg> (it's still hurting my brain)
08:02:24FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/xUt
08:02:47FromDiscord<Elegantbeef> it's pointless everywhere but this test
08:03:00FromDiscord<Elegantbeef> I need to ensure that a char going in matches a char coming out
08:03:09FromDiscord<evoalg> ohhhhh ... ohhh right ... and so you cunning made the "getchar" through abuse
08:03:19FromDiscord<evoalg> ahhhh
08:04:33FromDiscord<Elegantbeef> I know pmunch also uses it a fair bit, think he's the one that showed me
08:04:56FromDiscord<evoalg> the abuse?
08:05:03PMunchUses what?
08:05:25FromDiscord<Elegantbeef> backticks to join a template paramter with a identifer
08:05:37PMunchAh right, yes that I use from time to time :)
08:05:39*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:05:42PMunchNifty little feature
08:06:07FromDiscord<Elegantbeef> Oh i know it put me prestige and saem in a loop of "where the fuck does this function exist"
08:06:29FromDiscord<evoalg> that's not possible with a proc right?
08:06:41FromDiscord<Elegantbeef> Think prestige was working on nimlsp and we stared for like 10 minutes just confused, then one of us remembered the joining stuff
08:07:31FromDiscord<Elegantbeef> Also pmunch what's with the playground?
08:07:38FromDiscord<Elegantbeef> Shit broke
08:07:41PMunchAnything wrong with it?
08:07:48FromDiscord<Elegantbeef> Cant access it
08:08:05PMunchHuh, that's not great
08:09:29PMunchI think Docker might've filled up the hard-disk again..
08:11:03FromDiscord<Elegantbeef> I'll try not to make too many examples this time
08:11:33*jjido joined #nim
08:12:03FromDiscord<Elegantbeef> Well i mean you can use accquoted identifiers anywhere just templates allow you to paste the arguments inside them which then expands↵(@evoalg)
08:12:28FromDiscord<Elegantbeef> It doesnt make sense with a proc since they're not expanding and cannot inject ast
08:14:29FromDiscord<evoalg> ahhh I meant: is it something that templates can do that proc's can't ... I wasn't challenging you to create a proc that does it ... it seemed to me that it wouldn't make sense for a proc because ... I dunno actually!
08:16:37FromDiscord<Elegantbeef> Well even if a proc code it'd be a case of well yes you can do it, but it's pointless cause you cannot call it
08:16:57PMunch@Elegantbeef, problem is that for every example docker leaves a tiny little bit of data behind that doesn't get cleaned out
08:17:41FromDiscord<evoalg> cron a bash script to delete?
08:17:54FromDiscord<Elegantbeef> Yea i figured which is why i jokingly said i'd make fewer examples cause i do make a lot
08:20:42FromDiscord<evoalg> is a new docker fired up for each example??
08:21:15PMunch@evoalg, you're not supposed to delete these files manually, so they can trip up docker and break stuff (once I even had to completely reinstall docker)
08:21:23PMunchSo I can't really put it in a cron job..
08:21:33FromDiscord<evoalg> ahhh true
08:41:26FromDiscord<mratsim> In reply to @evoalg "that's not possible with": It is, if the proc is in a template 😉
08:41:53FromDiscord<evoalg> hehe ok 🙂
08:44:05FromDiscord<retkid> how can i create a thread and add it to an array of threads
08:44:14FromDiscord<retkid> ie
08:44:53PMunch@retkid, have you seen the threading example in the manual?
08:44:56PMunchIt does exactly that
08:45:06FromDiscord<retkid> sent a code paste, see https://paste.rs/QJe
08:45:13FromDiscord<retkid> believe it not, I come here usually as a last resort
08:45:17FromDiscord<retkid> I tend to try and read the docs
08:45:39FromDiscord<Rika> That’s not really how you make a thread
08:45:52FromDiscord<retkid> createThread runs a thread
08:45:59FromDiscord<retkid> unless im wrong
08:46:03FromDiscord<retkid> and it only does sometimes
08:46:14FromDiscord<Rika> Well you must use that to create a thread properly
08:47:46FromDiscord<retkid> oh wait i should have looked at my example code
08:47:56FromDiscord<retkid> (edit) removed "example"
08:48:09FromDiscord<retkid> thats kinda strange behaviour
08:48:12FromDiscord<retkid> (edit) "behaviour" => "behavior"
08:48:40FromDiscord<Rika> Why so
08:48:51FromDiscord<retkid> createThread kinda casts data onto a Thread type, like jsonutils.fromJson
08:49:01FromDiscord<retkid> correct?
08:49:34FromDiscord<Rika> I don’t know, I never bothered to read the source for threads
08:49:53FromDiscord<retkid> probably best you dont
08:50:03FromDiscord<Rika> Why do you need to create a thread without running it?
08:50:23FromDiscord<retkid> i dont quite know thats just how i wanna organize it
08:50:24FromDiscord<retkid> but i cant
08:53:15FromDiscord<mratsim> organization is good but what do you want to do? Organization serves and end goal.
08:54:05FromDiscord<retkid> there is no end goal, i just wanted my code to flow where you make the threads, runs, clears, make the threads, runs, clears
08:54:10szahidWhen i should use let and when const?
08:54:28FromDiscord<retkid> const is compiler defined, non-static immovable, code-imprinted data
08:54:35FromDiscord<retkid> (edit) "non-static" => ""
08:54:40FromDiscord<retkid> (edit) removed ""
08:54:52FromDiscord<retkid> so like lets say you wanted to have a file that you read in your program
08:55:26PMunch@evoalg, @Elegantbeef, welp dockers fucked again..
08:56:15FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3M8x
08:56:32FromDiscord<retkid> b is defined at compile time, a is defined on execution
08:59:08FromDiscord<retkid> i use const for distributing stuff for testing on different systems, because i dont have to manage directories
08:59:27FromDiscord<retkid> otherwise i prefer the flexibility of let
08:59:45FromDiscord<retkid> (edit) "directories" => "directories, or things being out of date-sync"
08:59:54FromDiscord<retkid> god sorry for editing its bad habbit
09:08:54PMunchThink I've got it now, just need to rebuild all the images (should take a couple hours I believe)
09:13:45PMunchI should really reverse the install order in that script, it starts with the oldest version :P
09:15:28PMunchIf you want you can now have a blast from the past and run your examples on 0.13.0
09:22:08*Gustavo6046 quit (Quit: Leaving)
09:25:21FromDiscord<mratsim> In reply to @retkid "there is no end": you should use a threadpool instead. Thread creation and destruction takes a loooong time.
09:26:45FromDiscord<mratsim> 1. A thread must be started with a proc.↵2. So either you have a very-long running task (think minutes) or you give a job to wait for new tasks in a loop (threadpool)
09:27:57FromDiscord<retkid> In reply to @mratsim "you should use a": threadpool has a lot of problems
09:28:07FromDiscord<retkid> its basically abandoned
09:28:26FromDiscord<retkid> last time i tried to use 'em they had weird performance issues, things
09:28:28FromDiscord<mratsim> you can write one.
09:28:43FromDiscord<retkid> Y'know what. With enough time, I could write one
09:28:48FromDiscord<retkid> is that time worth it? no
09:29:03FromDiscord<retkid> it would be worse than the already existing one shaha
09:29:07FromDiscord<mratsim> but the main question is, why do you want threads?
09:29:15FromDiscord<retkid> math takes long
09:29:25FromDiscord<mratsim> here is one I wrote: https://forum.nim-lang.org/t/8791
09:29:29FromDiscord<retkid> im not smart enough to write the equation in asm
09:29:39FromDiscord<mratsim> what kind of math?
09:29:53FromDiscord<retkid> median deviation of like 400 numbers
09:30:03FromDiscord<retkid> more specifically, colors
09:30:08FromDiscord<mratsim> that's not worth parallelizing.
09:30:09FromDiscord<retkid> so like 1200 numbers
09:30:12FromDiscord<retkid> but over uhh
09:30:18FromDiscord<retkid> theres around 96000 of them
09:30:25FromDiscord<retkid> so its like 12009600
09:30:33FromDiscord<retkid> 120096000
09:30:41FromDiscord<retkid> (edit) "120096000" => "1200 96000"
09:31:19FromDiscord<mratsim> In reply to @retkid "1200 * 96000": https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/tensor/aggregate.nim#L114-L156
09:31:43FromDiscord<retkid> then its adding it to a db, its taking a pretty long time
09:32:15FromDiscord<mratsim> you want to add just the stddev to the db or all numbers as well?
09:33:05FromDiscord<mratsim> threads won't solve DB access, they will make it worse due to synchronization issues.
09:33:48FromDiscord<retkid> its that or channel it and save it to a json, but i need to read it manually so into a db it goes
09:34:06FromDiscord<retkid> eh fuck it'll serial write it and channel it
09:34:17FromDiscord<mratsim> channel?
09:34:24FromDiscord<retkid> Channel[type]
09:34:59FromDiscord<mratsim> What I'm saying is that you're adding threading problems where it's not an issue
09:35:18FromDiscord<retkid> lol
09:35:26FromDiscord<retkid> its almost certainly an issue what
09:35:49FromDiscord<retkid> you're telling me im watching something max out a thread and its not an issue?
09:36:21FromDiscord<mratsim> sure, if you're using the wrong algorithm or data structures with O(n²) complexity it is.
09:36:36FromDiscord<mratsim> it is your algorithm the issue.
09:39:08FromDiscord<retkid> im loosing some efficiency to db locking but the algorithm is literally just adding numbers to a sequence then getting a mean then writing it to a db
09:41:01FromDiscord<retkid> running 30 at a time right now and its averaging about 3 seconds each
09:41:23FromDiscord<retkid> while using around 16 gm of ram
09:41:48FromDiscord<retkid> a big performance loss in half of that being swap
09:42:11FromDiscord<retkid> im going to destroy this nvme ssd....
09:43:21*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:45:13FromDiscord<mratsim> In reply to @retkid "running 30 at a": https://media.discordapp.net/attachments/371759389889003532/931484087334625290/unknown.png
09:45:37FromDiscord<mratsim> this is single-threaded
09:46:19FromDiscord<retkid> its more like↵compare every number to every number in that range using Distance() from chroma
09:46:33FromDiscord<mratsim> with openmp https://media.discordapp.net/attachments/371759389889003532/931484420265885736/unknown.png
09:46:51FromDiscord<mratsim> mmmh pairwise distance is a bit of a memory and CPU hog.
09:47:29FromDiscord<retkid> ¯\_(ツ)_/¯
09:47:34FromDiscord<mratsim> it's n², I wonder if we could reduce that to O(n log n) using something similar to FFT for polynomial multiplication
09:48:18FromDiscord<retkid> its more like this
09:53:42FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3M8M
09:53:50FromDiscord<retkid> turns out discord is not a good ide
09:54:34FromDiscord<retkid> thats not valid code, and distance.add() should be indented
09:56:53FromDiscord<mratsim> so many sqrt and exponetial in distance
09:57:38FromDiscord<retkid> thats why its annoying to implement in asm
09:57:55FromDiscord<mratsim> let's see if I can parallelize this
09:59:01FromDiscord<retkid> i did it just by running the calcs at the same time
09:59:16FromDiscord<retkid> so instead of doing 1000, it does 1000/30
10:03:26FromDiscord<mratsim> do you need float64 btw?
10:03:43FromDiscord<retkid> not really i dont think
10:04:48FromDiscord<retkid> this isn't the most accurate, some have more numbers than others, etc
10:05:07FromDiscord<mratsim> also why are you parseHex within a loop?
10:05:12FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3M8Q
10:05:23FromDiscord<mratsim> string processing is very slow
10:05:44FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3M8R
10:05:44FromDiscord<retkid> i didn't know taht
10:05:49FromDiscord<retkid> (edit) "taht" => "that"
10:05:53FromDiscord<eyecon> No, it's just a number
10:06:02FromDiscord<eyecon> 255 is 0xFF
10:06:38FromDiscord<retkid> i dont think that would work because it could be like↵05, 255, 96
10:07:02FromDiscord<retkid> lemme look at this lol
10:08:40FromDiscord<retkid> nimplayground down
10:08:50FromDiscord<eyecon> In reply to @retkid "nimplayground down": Yep, just saw that
10:09:34FromDiscord<retkid> https://replit.com/languages/nim
10:10:06FromDiscord<eyecon> In reply to @retkid "https://replit.com/languages/nim": This uses 1.2.0 but better than nothing I suppose
10:10:56FromDiscord<retkid> i guess it does work.
10:11:05FromDiscord<retkid> kinda hard for me to think of colors as an increasing number
10:11:11FromDiscord<retkid> idk why i didnt think of that
10:11:12FromDiscord<mratsim> In reply to @retkid "rand outputs hex?": https://media.discordapp.net/attachments/371759389889003532/931490629039583232/unknown.png
10:11:30FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=3M8T
10:11:38FromDiscord<mratsim> (edit)
10:12:21FromDiscord<retkid> rand 1.0"
10:12:27FromDiscord<mratsim> are there only 25 colors in the real app?
10:12:33FromDiscord<retkid> no
10:12:48FromDiscord<mratsim> the x 0 ..1000 is just for benchmarking right?
10:12:53FromDiscord<retkid> yes
10:13:59FromDiscord<retkid> well the data is already in strings
10:14:06FromDiscord<retkid> so i kinda do have to process them
10:15:03szahidIm looking for dict replacment in nim. is there something like this?
10:15:08FromDiscord<retkid> though i guess that is my fault for shooting myself in the foot when i compiled the data
10:15:17FromDiscord<mratsim> In reply to @szahid "Im looking for dict": std/tables
10:18:17szahidmratsim i need something like this: var x = {"key":"value"} \ echo x["key"]
10:18:34FromDiscord<retkid> yea
10:19:18FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3M8V
10:19:23FromDiscord<retkid> might need tables import
10:22:04szahid{}.toTable works fine
10:40:16FromDiscord<eyecon> I didn't know about futhark until recently, any reason why it's not in the curated packages list?
10:43:23FromDiscord<eyecon> And isn't the package "cascade" listed there basically std/with?
10:43:37FromDiscord<mratsim> In reply to @retkid "though i guess that": https://media.discordapp.net/attachments/371759389889003532/931498783395688479/message.txt
10:43:56FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/931498860512182312/unknown.png
10:44:03FromDiscord<mratsim> on an 8 core machine
10:44:31FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=3M91
10:45:10FromDiscord<retkid> this is very interesting code
10:45:31FromDiscord<retkid> some of this stuff is above my head ahaha
10:46:10FromDiscord<mratsim> the casting to ptr UncheckedArray is because passing seq to threads is annoying
10:46:22FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3M92
10:46:28FromDiscord<mratsim> in the code it's both
10:46:49FromDiscord<mratsim> there is a distance coming from the chroma library, and there is a seq of distances
10:47:02FromDiscord<eyecon> That's... I dunno... Isn't it confusing
10:47:15FromDiscord<mratsim> that's on @retkid
10:47:31FromDiscord<eyecon> Yeah
10:47:48FromDiscord<retkid> hey in the smaller code it works
10:47:51FromDiscord<retkid> in that it doesn't
10:48:32FromDiscord<mratsim> anyway, you have an example on parallelizing your code using Weave. can't spend more time on this today unfortunately
10:49:13FromDiscord<retkid> Weave?
10:49:18FromDiscord<retkid> what is weave
10:51:33FromDiscord<mratsim> my multithreading runtime.
10:51:41FromDiscord<mratsim> added an issue for UI improvement: https://github.com/mratsim/weave/issues/179
10:52:10FromDiscord<mratsim> it's an implementation of this RFC: https://github.com/nim-lang/RFCs/issues/160
10:52:53FromDiscord<mratsim> I also did this threadpool https://github.com/status-im/nim-taskpools↵↵But weave is particularly tuned for parallel for loops and scientific computing in general
10:56:15FromDiscord<eyecon> In reply to @eyecon "I didn't know about": Also honeycomb which is a very nice to use PEG
11:10:04szahidGuys. How i should declare Table [string, string] ?
11:10:41szahidjust table?
11:11:22NimEventerNew thread by Rforcen: Llvm wrap, see https://forum.nim-lang.org/t/8805
11:13:05PMunchszahid, what do you mean?
11:13:24PMunch`Table[string, string]` is how you would do that
11:14:46szahidVisual studio code mark this as error.
11:15:04PMunchWhat is the error?
11:15:12PMunchMight be something else you're doing wrong
11:16:13szahidtype mismatch. But app run correctly.
11:23:21*jjido joined #nim
11:27:38PMunchThen it's probably an error with nimsuggest
11:28:06PMunchMight be related to this https://github.com/nim-lang/Nim/issues/19371
12:01:06FromDiscord<ynfle (ynfle)> Anyone know of a library that converts a jsonschema to a nim type or something like that?
12:01:58PMunchOh, you have a scheme in some format and want to have a Nim type that represents it?
12:02:07PMunchMy jsonschema package does something similar
12:02:07FromDiscord<ynfle (ynfle)> Ya
12:02:17PMunchI use it for NimLSP
12:02:33FromDiscord<ynfle (ynfle)> I know. It's really cool, but it doesn't read in a json schema file
12:02:35PMunchIt's actually caught multiple poorly implemented clients :P
12:02:45FromDiscord<ynfle (ynfle)> Nice
12:03:00PMunchThere is no specified format for json schema though is there?
12:04:01FromDiscord<ynfle (ynfle)> json schema specifies the format if that's what you're saying. And you can build schemas on other schemas which specify the format of the schema
12:06:47PMunchI know what a schema is, but you're asking for a package that reads schema definitions. But there is no standard for these, so how would you write a package for it?
12:31:58FromDiscord<xx_ns> ynfle: you mean like https://json-schema.org/draft/2020-12/schema ?
12:46:14*rockcavera joined #nim
12:46:14*rockcavera quit (Changing host)
12:46:14*rockcavera joined #nim
13:13:21FromDiscord<xx_ns> @treeform haha I didn't realise you were in here
13:13:42FromDiscord<xx_ns> you can merge the pixie PR if you want, i put the asserts in the test file itself
13:40:57FromDiscord<Isofruit> sent a code paste, see https://paste.rs/HN4
13:43:09FromDiscord<Isofruit> In the sqlite lib it'd then use DbConn alias specifically for PSqlite, in the postgress lib it'd use the DbConn alias for PPGConn etc.↵Splitting it into a separate module to avoid code duplication just feels like it'll start coupling these modules and makes the code more complex (because I now need to handle allowing various DbConn types), while the other way round feels bad because code duplication and unnecessary work.
13:44:55FromDiscord<Isofruit> Hmm you know what, I'll first start writing the generic variation of this (without concepts for now, I don't want to force the maintainer of norm to adopt a still experimental feature) and see how that goes
14:00:34FromDiscord<Isofruit> Yeah, I was being silly, I had to write separate tests for them either way, but I could just make a central model that is imported and exported by the other two
14:37:29*arkurious joined #nim
14:43:15nrds<Prestige99> Hey @PMunch
15:00:31PMunchHello Prestige
15:00:34PMunchWhat's up?
15:04:08*PMunch quit (Quit: leaving)
15:11:08FromDiscord<Bung> @ElegantBeef `intr.invoke(fancyStuff, 10) # Calls `fancyStuff(10)` in vm` where is fancyStuff symbol ?
15:35:05FromDiscord<baalajimaestro> https://paste.baalajimaestro.me/MDvGXU↵↵can someone guide me on how to convert the input to output with nim. I tried with regex patterns but i am not able to achieve it. Is there any other logical approach to doing this
15:38:23FromDiscord<geekrelief> In reply to @baalajimaestro "https://paste.baalajimaestro.me/MDvGXU can someone": Have you looked at strscans?
15:38:49FromDiscord<geekrelief> actually, nevermind not sure that would work cause you need to ignore stuff
15:39:18FromDiscord<Bung> you need parseHtml and xmltree
15:39:20FromDiscord<geekrelief> you might have to use a parsing library
15:42:44FromDiscord<Bung> I think u can find what u need here https://github.com/nim-lang/fusion/tree/master/src/fusion/htmlparser
15:48:16FromDiscord<baalajimaestro> fine with even if there is an option to remove the entire \<img\@geekrelief)
15:49:00FromDiscord<baalajimaestro> lemme check, im pretty new to nim so gotta figure out how to use this↵(@Bung)
15:50:01FromDiscord<auxym> old but classic SO: https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
15:52:16FromDiscord<baalajimaestro> hmmmmm, so gotta figure out how to use a parser. any docs other than the code as such?
15:53:26FromDiscord<baalajimaestro> i dont understand much from the example provided here https://github.com/nim-lang/fusion/blob/master/src/fusion/htmlparser.nim
15:55:27FromDiscord<baalajimaestro> got it never mind
16:05:26FromDiscord<auxym> you could also try xmlparser in the stdlib. Though you might need to add a "root" element that wraps you "img" element in order for it to be considered strictly valid xml. Not sure if xmlparser is tolerant of that. https://nim-lang.org/docs/parsexml.html
16:05:54*rockcavera quit (Remote host closed the connection)
16:20:33FromDiscord<baalajimaestro> https://nim-lang.org/docs/htmlparser.html↵↵I found this, will try it out tomorrow
16:22:23*stkrdknmibalz quit (Ping timeout: 256 seconds)
16:30:18NimEventerNew thread by Geekrelief: How can I implement a conditional access operator?, see https://forum.nim-lang.org/t/8806
16:43:57FromDiscord<Patitotective> Is there a way I could find where a procedure has been called from? to debug
16:45:39FromDiscord<Tanguy> echo getStackTrace()
16:47:12FromDiscord<Patitotective> Thanks 🙃
16:47:37FromDiscord<treeform> In reply to @xx_ns "<@!107140179025735680> haha I didn't": I merged your PR, thanks!
16:58:42*vicfred joined #nim
17:47:43*Lord_Nightmare quit (Read error: Connection reset by peer)
17:49:31*Lord_Nightmare joined #nim
18:05:31*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
18:26:37NimEventerNew thread by Sixte: Nim 1.6.2 : silent program rejection, see https://forum.nim-lang.org/t/8807
18:54:46*vicfred quit (Quit: Leaving)
19:36:03nrds<Prestige99> @PMunch not much. Been having a painful nim editing experience because of nimsuggest lol
20:08:16FromDiscord<hmmm> nimsuggest is evil turn it off 🤔
20:11:28nrds<Prestige99> Yeah it's been broken since 1.6.0 it seems
20:20:07FromDiscord<QueenFuckingAdrielle> What's everyone working on with nim? Anybody doing any interesting projects?
20:23:14FromDiscord<hmmm> there is "This month in nim" on the official blog if you hadn't read with plenty of nifty stuff
20:25:55*fvs left #nim (WeeChat 3.4)
20:27:12FromDiscord<Isofruit> Has anyone here successfully used "nimcrypto" to compute hashes?
20:27:23FromDiscord<Isofruit> (edit) "hashes?" => "hashes (in my case of passwords)?"
20:30:22FromDiscord<hmmm> I tested it for a smol project I abandoned and it seemed to work, afaik it's the best crypto lib we have
20:30:54FromDiscord<Patitotective> In reply to @QueenFuckingAdrielle "What's everyone working on": NiPrefs: _PREFS_ for _Nim_ 😎 lol
20:31:52FromDiscord<Isofruit> In reply to @hmmm "I tested it for": Do you know whether it supports pbkdf2? I supposedly does, I've been searching for any sort of function mentioning it for a while (as someone with very little knowledge about cryptography, I'm still not too sure about the concept of digests neither)
20:32:22FromDiscord<hmmm> ah no idea, wait for the brainy guys 😊
20:34:29FromDiscord<Isofruit> In reply to @QueenFuckingAdrielle "What's everyone working on": I'm rewriting my REST-API from Django to Nim, because I feel personally slighted that some of my pages need more than 500ms to load even though the serialization etc. should be trivial... and I wanted to learn another language either way, so killing 2 birds with one stone instead of improving the Django backend
20:36:32FromDiscord<Isofruit> ... which turns out means I'm now also contributing to norm, hopefully my current PR isn't too bad
20:43:43FromDiscord<Isofruit> In reply to @hmmm "ah no idea, wait": I mean, if you used a function you proooobably had to at one point uses one that uses an "HMAC" type as a param?
20:53:51FromDiscord<hmmm> hm maybe I don't even remember, I remember using the CTR thing to encrypt stuff
21:08:55FromDiscord<Elegantbeef> it's declared in the constant `script`↵(@Bung)
21:25:38FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Mcd
21:26:19*anadahz quit (Remote host closed the connection)
21:26:53*anadahz joined #nim
21:39:57*anadahz quit (Remote host closed the connection)
21:41:03*anadahz joined #nim
21:46:29*anadahz quit (Quit: anadahz)
21:51:26NimEventerNew thread by Freeflow: Novice Question: Implement the Step functionality in VBA, see https://forum.nim-lang.org/t/8808
21:51:59NimEventerNew question by Philipp Doerner: How do I re-build django&#39;s password hashing with nimcrypto?, see https://stackoverflow.com/questions/70716906/how-do-i-re-build-djangos-password-hashing-with-nimcrypto
21:53:06FromDiscord<Isofruit> (Nobody worry about this one, I'm answering it myself so I can also figure out in the future how to use nimcrypto)
21:57:19FromDiscord<Elegantbeef> No i'm going to worry about it
22:00:12FromDiscord<leorize> I'm not sure if nimcrypto has been audited yet
22:00:12FromDiscord<leorize> probably already by the Status folks
22:01:01FromDiscord<leorize> but for security applications I'd recommend using already established libraries like libsodium which does have a good nim wrapper
22:01:54FromDiscord<Elegantbeef> Clearly you're supposed to role your own cause that's totally the safest thing possible 😛
22:02:21FromDiscord<Isofruit> God
22:02:22FromDiscord<Isofruit> dangit
22:02:27FromDiscord<Isofruit> Like, I appreciate it leorize
22:02:33FromDiscord<treeform> sent a long message, see http://ix.io/3Mcs
22:02:34FromDiscord<Isofruit> But I had assumed nimcrypto was already safe
22:02:44FromDiscord<Isofruit> And it took me way too long to figure out how to use that lib
22:03:17FromDiscord<Isofruit> I guess back to the drawing board and looking at libsodium
22:03:59FromDiscord<QueenFuckingAdrielle> Nice, came back from the store and saw all these cool projects
22:04:32FromDiscord<leorize> when it comes to security libraries, always check if they are wildly adopted and whether they are audited
22:04:37FromDiscord<leorize> better be safe than sorry
22:06:52FromDiscord<Elegantbeef> Lol treeform just linked his entire git 😀
22:07:11FromDiscord<treeform> No just the nimble published stuff
22:10:01FromDiscord<evoalg> In reply to @treeform "No just the nimble": I'm enjoying bitty so far ... thank you!
22:11:03*lispy joined #nim
22:11:26FromDiscord<QueenFuckingAdrielle> sent a long message, see http://ix.io/3Mcu
22:13:22FromDiscord<Isofruit> Is there a largely adopted wrapper of libsodium leorize? I found like 3 different wrappers by now and the one from FredericoCeratto was the most adopted one I could find yet (https://github.com/FedericoCeratto/nim-libsodium)
22:13:39FromDiscord<leorize> federico is the one I used, I haven't tried the other ones
22:15:06FromDiscord<treeform> In reply to @evoalg "I'm enjoying bitty so": Thank you for using my stuff.
22:15:07FromDiscord<Isofruit> Then to figure out how to do that entire sha256+HMAC+pbkdf2 in that one
22:15:26FromDiscord<QueenFuckingAdrielle> I have seen much activity with some of the nim math libs we are using. I'm worried I'll have to take over maintaining them.
22:15:34FromDiscord<QueenFuckingAdrielle> (edit) "have" => "havent"
22:16:41FromDiscord<leorize> you can query the science people for more details
22:16:51FromDiscord<leorize> they might be shifting development priorities elsewhere
22:18:14FromDiscord<QueenFuckingAdrielle> Yea that might be a good idea. The main one is arrayfire, which is just c2nim iirc. That's probably the most important lib. We are also using weave/laser/arraymancer some.
22:19:03FromDiscord<leorize> looks like mratsim just announced that he doesn't have time to maintain arraymancer anymore
22:19:29FromDiscord<QueenFuckingAdrielle> We are currently looking at ways on inlining nvidia ptx to bypass cuda completely but we haven't figured it out yet.
22:19:42FromDiscord<QueenFuckingAdrielle> I had thought that might be the case
22:20:31FromDiscord<QueenFuckingAdrielle> Finding anyone who knows ptx is like, impossible.
22:20:43FromDiscord<hmmm> In reply to @treeform "I am working on:": print not named printy... it must not production ready 🤔
22:20:53FromDiscord<hmmm> in treeform-land the y is given to the golden eggs
22:20:58*joe_mad joined #nim
22:21:10*jjido joined #nim
22:21:12FromDiscord<evoalg> treeformy
22:21:55FromDiscord<QueenFuckingAdrielle> What is everyone's opinion on the outlook of nim? I hope it continues to increase in popularity.
22:23:26FromDiscord<Isofruit> As someone barely in deep enough to be able to contribute to an ORM and even that at debatable levels, I don't think I have a qualified opinion here. ↵I'd assume a growth in popularity, but I know little and the world is complex
22:23:31FromDiscord<Elegantbeef> Considering its gotten me into compiler dev i hope it dies 😛
22:23:41FromDiscord<QueenFuckingAdrielle> Lol
22:23:45FromDiscord<Isofruit> That would be a disaster beef!
22:23:59FromDiscord<Isofruit> Where else could you abandon your macros as easily as here?
22:23:59FromDiscord<QueenFuckingAdrielle> There are just no other real options
22:24:05FromDiscord<hmmm> I'm glad we have it 😊 it must grow at it's own pace imo
22:24:34FromDiscord<QueenFuckingAdrielle> Say what you will but rust and nim are apples and oranges and they are usually compared to each other.
22:25:04FromDiscord<QueenFuckingAdrielle> I agree, I'm promoting it in dl and robotics as much as possible
22:25:29FromDiscord<QueenFuckingAdrielle> But I'm not really an application developer in a traditional sense so idk
22:26:12FromDiscord<Isofruit> I shill for it in my own circles, got one person to look at it confirmed for now, though she got put a bit off-guard by the antivirus warnings
22:26:37FromDiscord<leorize> that's the fate of all unpopular languages
22:26:44FromDiscord<leorize> even go went through that phase
22:26:44FromDiscord<theSherwood> Speaking of which, are the antivirus warnings an ongoing issue?
22:27:08FromDiscord<Isofruit> Last I checked 1.6 is once again under antivirus flagging
22:27:10FromDiscord<Elegantbeef> Yea i'm more of a game dev, which is why i like it, tons of nice features to make life easy there↵(@QueenFuckingAdrielle)
22:27:22FromDiscord<Isofruit> as is 1.6.2, given that said friend of mine got it immediately flagged as such
22:27:22FromDiscord<leorize> aren't you a compiler dev?
22:27:29FromDiscord<Elegantbeef> I hate you leorize
22:27:33FromDiscord<Elegantbeef> Go die in a hole or something 😛
22:27:38FromDiscord<leorize> \:P
22:27:51FromDiscord<QueenFuckingAdrielle> In reply to @Elegantbeef "Yea i'm more of": Oh cool, have you used nim with godot?
22:28:17FromDiscord<Elegantbeef> I have briefly, but eh godo's native sucks imo
22:28:26FromDiscord<Elegantbeef> It's not a first class feature and it feels it
22:28:35FromDiscord<QueenFuckingAdrielle> My gf and I are planning a little indie title and I was going to look at the nim interface.
22:28:52FromDiscord<leorize> as more malwares are written in Nim, AV will pick up Nim executables as malicious↵(@Isofruit)
22:28:56FromDiscord<QueenFuckingAdrielle> Yea, I just hate how bloated unity and unreal are for what we are doing.
22:29:05FromDiscord<leorize> it's kinda unavoidable until we have mainstream software in Nim
22:29:06FromDiscord<Elegantbeef> It works and all but it's not fun imo, my most recent stuff is built on my own framework using Opengl/Sdl/Assimp
22:29:12FromDiscord<Elegantbeef> Might be interested in TheMachinery aswell
22:29:25FromDiscord<Elegantbeef> Or pay for signing
22:29:27FromDiscord<QueenFuckingAdrielle> Ah gotcha, I'm not on that level of gamedev
22:29:32FromDiscord<Isofruit> Okay it appears I'm blind, I can't find a pbkdf2 function or so for the life of me in libsodium
22:29:49FromDiscord<Elegantbeef> I mean i'm not either
22:29:50FromDiscord<Elegantbeef> I just play pretend 😛
22:29:57FromDiscord<Elegantbeef> As i do everywhere
22:30:05FromDiscord<hmmm> I mean antivirus software is the real malware themselves. We are on the right side of history 🧐
22:30:34FromDiscord<Elegantbeef> drop-2021-11-19\_19.05.30.mp4 https://media.discordapp.net/attachments/371759389889003532/931676696032182322/drop-2021-11-19_19.05.30.mp4
22:30:36FromDiscord<Elegantbeef> This is where my project sits if wondering
22:30:38FromDiscord<hmmm> In reply to @Elegantbeef "I just play pretend": not tru, beef best compiler dev
22:30:51FromDiscord<evoalg> In reply to @QueenFuckingAdrielle "Ah gotcha, I'm not": do you do like data analysis or ai programming?
22:31:03FromDiscord<QueenFuckingAdrielle> We are making a witchy version of stardew valley basically. Unreal isn't great for that.
22:31:11FromDiscord<Isofruit> In reply to @Elegantbeef "drop-2021-11-19\_19.05.30.mp4": puzzle game I take it?
22:31:20FromDiscord<Elegantbeef> Yea
22:31:22FromDiscord<Elegantbeef> As all my good games are
22:31:27*joe_mad left #nim (ERC (IRC client for Emacs 27.1))
22:31:53FromDiscord<leorize> any day now, beef will make a puzzle game about debugging the compiler
22:31:56FromDiscord<hmmm> In reply to @Elegantbeef "drop-2021-11-19\_19.05.30.mp4": beef put space marines in there
22:32:29FromDiscord<Isofruit> In reply to @leorize "any day now, beef": with ~~knuckles~~ macros!
22:32:30FromDiscord<QueenFuckingAdrielle> In reply to @evoalg "do you do like": I do, my background is in cognitive science and cs. My main research is in neuromorphic computing and cognitive robotics.
22:33:00FromDiscord<Elegantbeef> Hey with nimscripter that's not too far off just need to make a compiler in nimscripter and purposely put bugs in it 😜
22:33:19FromDiscord<evoalg> In reply to @QueenFuckingAdrielle "I do, my background": Interesting ... I'm not familiar with those terms ... but is it neural network based?
22:33:21FromDiscord<Elegantbeef> If you're doing 2D Queen, i can suggest Nico
22:33:32FromDiscord<Elegantbeef> https://jbeetham.itch.io/linerino was made using Nico
22:34:14FromDiscord<QueenFuckingAdrielle> In reply to @evoalg "Interesting ... I'm not": Yea I dot alot of neural network training etc. Not just in nim but also with pytorch and Tensorflow... when I have to.
22:34:31FromDiscord<QueenFuckingAdrielle> In reply to @Elegantbeef "If you're doing 2D": Oh cool, I'll check that out
22:34:57FromDiscord<evoalg> Oh you prefer Nim to pytorch?
22:35:13FromDiscord<QueenFuckingAdrielle> We are mostly planning right now, she's an artist and wants to learn to program and the other way around for me.
22:36:04FromDiscord<QueenFuckingAdrielle> I do prefer nim c or cpp yea. I prefer to use tensor/array libraries directly because of the architectures I work on.
22:36:59FromDiscord<QueenFuckingAdrielle> Most of them are more tied to simulating how the brain actually functions as opposed to what alot of models do nowadays.
22:37:29FromDiscord<QueenFuckingAdrielle> We also train transformers and the like, but that's a product of the gpu and von Neumann hardware we use.
22:38:34FromDiscord<evoalg> wow you sound like a serious ai researcher
22:39:48FromDiscord<Elegantbeef> Remember AI is nothing but nested if statements
22:39:48FromDiscord<Elegantbeef> Anyone that says otherwise is a liar
22:40:32FromDiscord<evoalg> it might be more like voting believe it or not
22:40:33FromDiscord<QueenFuckingAdrielle> Lol, thanks! Like @ElegantBeef I just kinda do the stuff I do.
22:40:58FromDiscord<Elegantbeef> Wait i do stuff?
22:41:05FromDiscord<QueenFuckingAdrielle> Idk, game stuff
22:41:08FromDiscord<QueenFuckingAdrielle> Sounds like lol
22:41:22FromDiscord<Elegantbeef> Fuck dont let my mind know that, might make the "Useless narrative" harder to believe!
22:41:26lispyBesides nim, what would you say your favourite programming language is?
22:41:37FromDiscord<Elegantbeef> Nimscript 😛
22:41:45FromDiscord<QueenFuckingAdrielle> Tbh I just wanna be a stay at home mom. But that's expensive nowadays lol.
22:42:11FromDiscord<Elegantbeef> Jokes aside, i dont really use anything but Nim, so dont really have a second
22:42:21lispyDon't lie I know it's VBA
22:42:26FromDiscord<Elegantbeef> I do have respect for Rust/Ada/Odin/Zig 😀
22:42:31FromDiscord<Elegantbeef> Fuck no
22:42:39FromDiscord<Elegantbeef> That's a heavily dotnet relying language
22:43:11FromDiscord<evoalg> In reply to @QueenFuckingAdrielle "Tbh I just wanna": make an ai child?
22:43:25FromDiscord<QueenFuckingAdrielle> Hmm can't narrow it past 3. C and julia I guess. Haxe is kinda neeto.
22:43:31FromDiscord<Elegantbeef> The benefit of an AI child is you can kill it and no one complains
22:43:38FromDiscord<QueenFuckingAdrielle> In reply to @evoalg "make an ai child?": That's the goal.
22:44:31FromDiscord<QueenFuckingAdrielle> Truth. "Is that an affliction tshirt??" Then I just yank the cord to the server.
22:44:59FromDiscord<Elegantbeef> Do that to a real child and you're called a murderer or something dumb
22:45:43lispyikr double standards
22:46:15FromDiscord<evoalg> In reply to @Elegantbeef "The benefit of an": not if it kills you first, like in ex machina
22:46:31FromDiscord<Elegantbeef> Jokes on you i dont speak latin
22:47:11FromDiscord<Isofruit> not knowing latin saves you from ex machina↵Noted!
22:47:36FromDiscord<Elegantbeef> What you dont know cant harm you, and that's why i'm still alive after smoking 30 packs of cigs a day
22:49:42FromDiscord<evoalg> In reply to @QueenFuckingAdrielle "That's the goal.": NN's have been put into robots (physical and simulated) and everyone is surprised at how hard it is to make true ai ... it's really difficult
22:50:29FromDiscord<Elegantbeef> What i've watched Pinocchio, that was a wooden AI
22:50:52FromDiscord<Elegantbeef> That's a good documentary
22:52:29FromDiscord<evoalg> lots of trees where you live too I bet beefy
22:52:56FromDiscord<evoalg> but are you emotionally ready for an ai child?
22:53:44FromDiscord<Elegantbeef> Nah they call it a boreal forest cause there arent any trees
22:53:56FromDiscord<evoalg> makes sense
22:54:35FromDiscord<Elegantbeef> So uhh do any more fun template stuff?
22:55:29FromDiscord<evoalg> hehe not yet
22:56:06*lispy quit (Quit: Leaving)
22:56:36FromDiscord<evoalg> I still can't get over how simple and clean your timing template made things
22:56:54FromDiscord<Elegantbeef> Lol
22:57:06FromDiscord<Elegantbeef> Like i said before i went to sleep, welcome to metaprogramming
22:57:28FromDiscord<Elegantbeef> If you can write the code by hand you can write a macro or template to automate it
22:59:23FromDiscord<evoalg> yea it finally makes sense to me that it's the next step up from procedures / functions
22:59:55FromDiscord<Elegantbeef> I'd say they're simpler to procedures, but that's playing semantics 😀
23:00:10FromDiscord<Elegantbeef> templates i mean
23:00:48FromDiscord<evoalg> so templates are just procedures that take code as arguments?
23:01:24FromDiscord<Elegantbeef> Nah
23:01:35FromDiscord<Elegantbeef> They're callables that take anything as arguments 😀
23:01:39*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:01:53FromDiscord<Elegantbeef> Procedures by definition run code inside them, templates emit code inside them
23:02:21FromDiscord<leorize> very important details about templates\: the arguments are AST nodes
23:03:19FromDiscord<leorize> so be careful about potential side-effects from them
23:03:30FromDiscord<Elegantbeef> Yea we talked about lazy evaluation yesterday
23:03:41FromDiscord<Elegantbeef> Well yesterday for me
23:04:45FromDiscord<evoalg> I understand that (or thought I did) because the template would rewrite it by hand to do the right thing (lazy evaluation), but what has that got to do with AST?
23:05:04FromDiscord<Elegantbeef> Well leorize is just saying "It doesnt get the result so be cautious"
23:06:00FromDiscord<evoalg> ahhh ok I think I understand
23:06:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3McD
23:06:40FromDiscord<evoalg> that is lazy, no
23:06:48FromDiscord<evoalg> no?
23:07:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3McH
23:07:44FromDiscord<evoalg> ohhhh you're saying that the "a" arg isn't evaluated!
23:07:52FromDiscord<Elegantbeef> Yep
23:08:04FromDiscord<Elegantbeef> And as such you can have a value that is less than `b`
23:08:48FromDiscord<leorize> https://play.nim-lang.org/#ix=3McJ
23:09:02FromDiscord<leorize> ^ that one is much easier to follow
23:09:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3McK
23:09:45FromDiscord<leorize> can't beat deterministic execution \:p
23:10:02FromDiscord<Elegantbeef> Now the question is "Can evo solve this himself"
23:11:00FromDiscord<evoalg> I though the if and else block would be substituted in ... hmmmm lemme think
23:11:25FromDiscord<Elegantbeef> It is
23:11:57FromDiscord<Elegantbeef> Remember everywhere a template parameter is, the code passed is pasted in
23:13:01FromDiscord<leorize> https://play.nim-lang.org/#ix=3McL \<- here is the exploded version if you wanna see the answer
23:13:43FromDiscord<Elegantbeef> Now leorize show how to prevent it in the most mundane way 😛
23:13:59FromDiscord<leorize> use a proc \:p
23:14:13FromDiscord<Elegantbeef> No that doesnt work always 😛
23:14:25FromDiscord<Elegantbeef> \glares at `hasKeyOrPut`
23:14:32FromDiscord<Isofruit> But what if you use a lot of procs?
23:14:44FromDiscord<Elegantbeef> What about it
23:15:06FromDiscord<evoalg> so `s.pop()` is performed twice!
23:15:16FromDiscord<Elegantbeef> Procs are what you should generally use first unless you need certain behaviour or desires
23:15:38FromDiscord<Elegantbeef> Indeed
23:15:48FromDiscord<leorize> https://play.nim-lang.org/#ix=3McM \<- here is how to fix it if you really want to use templates for whatever reason
23:15:51FromDiscord<Elegantbeef> For instance if you want lazy evaluation you'd use a template
23:16:26FromDiscord<evoalg> In reply to @evoalg "so `s.pop()` is performed": lol expanded it myself and saw the problem and then I read your expanded version leorize 😉
23:16:53FromDiscord<Elegantbeef> the table interaction procedures are things that should be templates `hasKeyOrPut` and `getOrDefault` for instance
23:17:20FromDiscord<Elegantbeef> Just cause your default shouldnt be ran unless you want to insert it
23:17:41FromDiscord<Elegantbeef> anyone that relies on the behaviour that the default is called should be shot imo
23:18:01FromDiscord<Elegantbeef> But you use the simplest tool for the job which is generaly a proc
23:18:01FromDiscord<evoalg> I can see that now!
23:18:25FromDiscord<evoalg> (being shot I mean)
23:19:24FromDiscord<evoalg> and yea assigning the args to variables means they are only evaluated once each ... why did you use `_genSym` though leo?
23:19:50FromDiscord<Elegantbeef> Cause he's showing that you cannot access the variables
23:20:23FromDiscord<evoalg> ahh
23:20:34FromDiscord<Elegantbeef> templates are hygienic which means to pollute the scope is an explicit operation
23:21:07FromDiscord<Elegantbeef> So `tmpA` and `tmpB` are not accessible by you unless you explicitly say you want them with either `var tmpA {.inject.}` or make the template `{.dirty.}`
23:21:32FromDiscord<evoalg> ah yea I've seen those dirty tricks
23:22:21FromDiscord<evoalg> so my lesson for today is, args to templates are taken as is and they are evaluated when passed
23:22:23FromDiscord<Elegantbeef> And now you're a template master
23:22:40FromDiscord<Elegantbeef> are not\ ?
23:22:56FromDiscord<evoalg> not
23:23:03FromDiscord<evoalg> aren't
23:23:16FromDiscord<Isofruit> to be or not to be?
23:25:15FromDiscord<evoalg> In reply to @Isofruit "to be or not": apparently once when Bobby Fischer was thinking about taking a potentially poisoned pawn on b2, someone who was watching said "b2 or not b2" and Fischer told them to fuck off
23:25:34FromDiscord<evoalg> (if might not have been Fischer)
23:25:58FromDiscord<Isofruit> Either way makes for a funny little story 😄
23:26:55FromDiscord<leorize> they can be templates once views work
23:26:58FromDiscord<leorize> maybe in a decade or so
23:27:12FromDiscord<Elegantbeef> Why do we need views for them?
23:27:45FromDiscord<leorize> try writing the template, you will end up evaluating the "table" argument more than once
23:28:05FromDiscord<Elegantbeef> It'd be a `var T`
23:28:21FromDiscord<leorize> not like templates care and give you a nice pointer \:p
23:28:33FromDiscord<Elegantbeef> So.. worst comes to worse you cache it and use `byaddr` like logic
23:29:15FromDiscord<leorize> you can also generate a closure on-the-fly \:p
23:36:41FromDiscord<Elegantbeef> I can also reset them 😛
23:36:50FromDiscord<Elegantbeef> Oh wait you dont mean you you
23:37:46NimEventerNew post on r/nim by Pcarbonn: Nim Community Survey 2021 Results, see https://reddit.com/r/nim/comments/s46036/nim_community_survey_2021_results/