<< 15-11-2020 >>

00:00:01*junland quit (Quit: %ZNC Disconnected%)
00:00:43*junland joined #nim
00:38:14FromDiscord<Rika> @krabbypatty they are both correct syntaxes; in fact, the first one is what is considered idiomatic
00:38:22FromDiscord<Rika> dont ask me why though
00:39:02FromDiscord<krabbypatty> every page of the docs I've seen uses the second one
00:39:05FromDiscord<krabbypatty> `case x:`
00:39:12FromDiscord<krabbypatty> I haven't seen the first one mentioned anywhere
00:39:34FromDiscord<Rika> mind linking?
00:39:38FromDiscord<krabbypatty> ok that's a lie, documentation uses both
00:39:41FromDiscord<krabbypatty> which is worse imo
00:39:44FromDiscord<krabbypatty> https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement
00:39:55FromDiscord<krabbypatty> # indentation of the branches is also allowed; and so is an optional colon↡# after the selecting expression:
00:40:12FromDiscord<Rika> well its to demonstrate both is fine?
00:40:19FromDiscord<krabbypatty> yeah
00:40:27FromDiscord<Rika> i dont see how its worse then
00:40:46FromDiscord<nikki> maybe it's to allow `case x of Y: foo` ?
00:40:49FromDiscord<krabbypatty> you're right, I had misread it
00:41:05FromDiscord<krabbypatty> I mean I don't like it but at least the docs do mention both
00:41:32FromDiscord<Rika> theres no language where you like every single feature it includes
00:41:34FromDiscord<krabbypatty> speaking of minor stylistic issues, styleCheck:error doesn't work
00:41:39FromDiscord<krabbypatty> I get errors from the stdlib
00:41:42FromDiscord<Rika> unless you make it yourself πŸ˜›
00:41:46FromDiscord<Rika> o?
00:42:01FromDiscord<nikki> even if you make it yourself, it's likely you don't haha bc. of tradeoffs and limits
00:42:02FromDiscord<Rika> can we have an example on what fails
00:42:29FromDiscord<krabbypatty> I'll file issues later
00:42:31FromDiscord<krabbypatty> nim-1.4.0/lib/std/private/underscored_calls.nim(42, 22) Error: 'nnkArgList' should be: 'nnkArglist'
01:05:00FromDiscord<krabbypatty> sent a code paste, see https://play.nim-lang.org/#ix=2Ecd
01:05:32FromDiscord<krabbypatty> this doesn't work because the different variants use the same name (e.g. both unary and binary use `operator`)
01:05:52FromDiscord<krabbypatty> is there any way to have duplicate names?
01:06:06FromDiscord<krabbypatty> (edit) "names?" => "names in variant fields?"
01:07:18FromDiscord<Joe-23> I wanted to create a lockscreen for linux for the wayland display server. I am having trouble figuring out where I should start, what to do, what libraries to use etc.
01:10:26FromDiscord<ElegantBeef> Do you know of any wayland lockscreens?
01:12:37FromDiscord<Joe-23> No mate
01:13:03FromDiscord<ElegantBeef> Well i can only suggest to look at lockscreen impls and use whatever libraries they use
01:13:33FromDiscord<Joe-23> Since a lot of applications and libraries are written in C, does NIm offer C interop?
01:13:37FromDiscord<ElegantBeef> Yes
01:14:03FromDiscord<ElegantBeef> Nim outputs C code, so it's interop is very very good
01:15:05FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-importc-pragma
01:19:52FromDiscord<ElegantBeef> @nikki so disruptek responded to my for loop bug with "Feature.". So clearly we're just dumb πŸ˜„
01:20:18FromDiscord<nikki> huh?
01:20:33FromDiscord<nikki> i didn't question that it does that :p
01:20:58FromDiscord<ElegantBeef> That's not what i implied
01:21:15FromDiscord<nikki> o i didn't understand
01:21:18FromDiscord<nikki> what do u mean then πŸ˜…
01:21:31FromDiscord<nikki> also what does feature mean in this case
01:21:36FromDiscord<nikki> just that -- being able to access the _ is a feature?
01:21:46FromDiscord<ElegantBeef> I think it's the "not a bug, it's a feature" joke
01:22:05FromDiscord<ElegantBeef> Or it's actually intended and like i said we're dumb πŸ˜„
01:23:51FromDiscord<nikki> i don't think so, seems like something that could go either way
01:24:06FromDiscord<nikki> one spot 'underscore' is mentioned in the compiler is 'underscored calls' or w/e
01:24:15FromDiscord<nikki> that gets used in the `with:` macro
01:24:18FromDiscord<nikki> wonder what that's about
01:24:42FromDiscord<ElegantBeef> Oh yea i think it's a bug due to being inconsistant, but i was just laughing at disrupteks 1 word response
01:24:48FromDiscord<nikki> hrhr
01:24:50FromDiscord<nikki> hehe
01:25:05FromDiscord<ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/777343380879441921/unknown.png
01:25:12FromDiscord<ElegantBeef> Means it shouldnt be accessible
01:25:25FromDiscord<nikki> ah
01:25:35FromDiscord<ElegantBeef> But it's also magic so heh
01:26:24FromDiscord<Varriount> Hm, I've been busy lately... Anything new in nim-lang-land?
01:29:08FromDiscord<Joe-23> @ElegantBeef Awesome mate, just out of curiosity what about C++?
01:29:13FromDiscord<ElegantBeef> Same
01:29:30FromDiscord<Joe-23> I am surprised given how people struggle to get C++ interop to work
01:29:42FromDiscord<ElegantBeef> there is more explanation for the interop
01:29:49FromDiscord<Joe-23> Right
01:29:57FromDiscord<ElegantBeef> and there are tools like c2nim/nimterop to make it easier
01:30:15FromDiscord<ElegantBeef> But yea all cpp interop is explained here https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma
01:32:13FromDiscord<Rika> @krabbypatty no
01:32:22FromDiscord<Rika> I don't know about plans to work on it either
01:32:22FromDiscord<ElegantBeef> It's in an RFC though
01:33:40FromDiscord<ElegantBeef> https://github.com/nim-lang/RFCs/issues/19#issuecomment-405520616
01:33:42disbotβž₯ Allow usage of the same attribute name in different branches within variant types
01:33:48FromDiscord<ElegantBeef> But yea just an RFC atm
01:35:29FromDiscord<Joe-23> @ElegantBeef Thanks mate
01:45:13*xet7 quit (Remote host closed the connection)
01:48:47*xet7 joined #nim
01:53:52*kinkinkijkin joined #nim
01:54:25FromDiscord<Joe-23> Just out of curiosity, does the user ever have to deal with lifetimes like in Rust, even if GC is disabled and the user uses something like smart pointers?
01:55:00FromDiscord<ElegantBeef> That's outside of my paygrade of non existant
02:04:17FromDiscord<nikki> i think you should be reasoning about the lifetimes (the general word) of objects in your code because that's just part of its functioning, but "lifetime parameters" (the rust-specific concept) don't show up in nim
02:05:38FromDiscord<Rika> lifetime parameters are probably what everyone else hates the most in rust and not lifetimes themselves
02:06:11FromDiscord<nikki> experimental:views is pretty related to this also: https://nim-lang.github.io/Nim/manual_experimental.html#view-types
02:15:38*apahl quit (Ping timeout: 264 seconds)
02:17:32*apahl joined #nim
02:18:56*blep58 joined #nim
02:33:14*blep58 quit (Remote host closed the connection)
02:42:02FromGitter<sealmove> @PMunch I tried your binaryparse lib. Wow! It's so awesome!
02:44:24*screens__ quit (Read error: Connection reset by peer)
02:44:58*screens_ joined #nim
02:45:21voltistIs anyone here lqdev (the developer of Rapid)?
02:49:18FromGitter<sealmove> I think adding more feature to binaryparse is more worth than trying to write a good Nim backend for Kaitai Struct yaml files. These files use an expression language which doesn't map well to Nim, and you can't easily mix it with more fine-grained Nim code (although KS has tons of features). Binaryparse is a lot more similar to python's Construct, and I am starting to think it's a better idea than "universal yaml
02:49:18FromGitter... specs". The specs are easy to transpile anyway since the semantics are similar and everything is declarative.
02:51:02FromDiscord<nikki> voltist: @lqdev is lqdev
02:51:08FromGitter<sealmove> I'll finish the official KS backend (only half of the tests pass atm but there is already an official announcement https://kaitai.io/news/2020/10/16/kaitai-struct-v0.9-released.html), but nimitai is probably not worth it...
02:53:56FromDiscord<Joe-23> @Rika I meant lifetime parameters
02:54:08FromDiscord<Rika> > i think you should be reasoning about the lifetimes (the general word) of objects in your code because that's just part of its functioning, but "lifetime parameters" (the rust-specific concept) don't show up in nim
03:02:06*mmohammadi9812 quit (Ping timeout: 256 seconds)
03:02:14*mmohammadi9812 joined #nim
03:09:30zedeushey disruptek
03:09:54FromDiscord<Joe-23> Yeah I know mate I just wanted to specify I should have been more specfic by saying _lifetime parameters_ rather than just _lifetime_
03:10:01FromDiscord<Joe-23> But interestinng
03:10:06FromDiscord<Joe-23> glad Nim doesn't have this
03:23:48*a_chou joined #nim
03:35:42FromDiscord<Rebel> Are there any cases where converting from a string to a seq[byte] cause the length to go down? For example, if you have a string that has a length of 32 then convert to a seq[byte] the length suddenly goes down....
03:44:03FromDiscord<ElegantBeef> Uhh, probably not
03:44:32*muffindrake quit (Ping timeout: 260 seconds)
03:44:58FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2EcD
03:46:45*muffindrake joined #nim
03:47:02FromDiscord<nikki> @Rebel what kind of 'convert' do you mean? (eg. beef's code does a cast)
04:06:02*supakeen quit (Quit: WeeChat 2.9)
04:06:27FromDiscord<Rebel> https://play.nim-lang.org/#ix=2EcJ
04:06:35*supakeen joined #nim
04:07:58FromDiscord<nikki> unsafe ptr casts are not really meaningful conversions in many cases. like it just reinterprets the underlying memory of one type as another type, but each type tends to have its own (different) way of interpreting memory
04:09:07FromDiscord<nikki> the type system is trying to make memory associated with some type only generally interpreted as that type, but unsafe ptr casts are one way to say "no, type system, let me just do this (but i could get garbage results)"
04:10:40*a_chou quit (Ping timeout: 272 seconds)
04:13:39FromDiscord<Rebel> Ahhh ok that makes sense
04:16:15*apahl quit (Ping timeout: 272 seconds)
04:17:01FromDiscord<nikki> when you call an actual proc to do a conversion, like `something.toADifferentType` the `toADifferentType` proc contains logic that is reading the memory from the source and making a new object for the destination and writing to the destination memory with the correct layout
04:17:05*apahl joined #nim
04:26:53FromDiscord<Rebel> Yeah I realized that was not my problem, was passing params in the wrong order πŸ€¦β€β™‚οΈ
04:27:01FromDiscord<Rebel> especially matters when doing cryptography.....
04:28:52*a_chou joined #nim
04:29:50*vicfred joined #nim
04:39:40*mmohammadi9812 quit (Quit: Quit)
04:52:47*waleee-cl quit (Quit: Connection closed for inactivity)
04:53:03FromDiscord<ThothLoki> so i just installed nim on fedora but i cant use the `nim` command to compile. anyone what what i could have done wrong?
04:54:16FromDiscord<ThothLoki> `sudo dnf install nim` is what i used
04:59:10*a_chou quit (Ping timeout: 256 seconds)
05:07:13FromDiscord<ThothLoki> nevermind. figured it out
05:08:00FromDiscord<ElegantBeef> @ThothLoki i highy suggest using choosenim instead of the package your distro ships
05:08:50FromDiscord<Rika> tell that to the nixos users
05:09:05FromDiscord<Rika> you bet they gonna whoop your ass
05:09:05FromDiscord<ElegantBeef> Hey all two of you, use choosenim
05:09:11FromDiscord<Rika> lmaoooo
05:09:40FromDiscord<ElegantBeef> Really choosenim should be shipped instead of nim πŸ˜„
05:10:03FromDiscord<ThothLoki> @ElegantBeef thats what i did
05:10:27FromDiscord<ElegantBeef> You said you installed through dnf
05:10:37FromDiscord<ThothLoki> then i said i got it figured out
05:10:45FromDiscord<ThothLoki> i installed it again with choosenim
05:10:55FromDiscord<ElegantBeef> Well i didnt know what figured it out meant, so sorry
05:17:25FromDiscord<ThothLoki> I take it there is not much Linux support for nim?
05:18:02FromDiscord<Rika> theres a good amount
05:18:07FromDiscord<Rika> why?
05:18:23FromDiscord<Rika> there isnt much support for package managers if thats what you mean
05:18:27FromDiscord<ElegantBeef> Linux is where most nim programmers are
05:18:58FromDiscord<ElegantBeef> Atleast that are active here
05:19:15FromDiscord<ThothLoki> Ok
05:35:26FromDiscord<nikki> @ThothLoki curious what made you think there wouldn't be much linux support πŸ€”
05:37:30FromDiscord<nikki> funnily enough among the nim stuff i tried, the only platform-specific issue i had was having nimlsp integrate with gvim well on windows. that worked great on linux and macos. everything else worked everywhere
05:38:55FromDiscord<ThothLoki> Just the way rika and beef were talking about it
05:55:36FromDiscord<ElegantBeef> I mean i suggested choosenim and rika made a joke about nixos user
05:55:37FromDiscord<ElegantBeef> (edit) "user" => "users"
05:55:48FromDiscord<ElegantBeef> But eitherway it's a non issue
06:01:26jonjitsu[m]what version nim was ! removed?
06:02:03FromDiscord<ElegantBeef> do you mean `!=` or `!(bool)`?
06:02:17FromDiscord<ElegantBeef> Cause the latter isnt usable even in 0.13.0
06:02:30FromDiscord<ElegantBeef> `not bool` is the way
06:05:01FromDiscord<ElegantBeef> Do remember that it takes 3 seconds to make that operator if it really is something you want
06:05:13jonjitsu[m]https://github.com/Udiknedormin/NimContracts/blob/master/contracts/declarations/keywords.nim#L61
06:05:40jonjitsu[m]I tried using that library and got an undeclared identifier 1
06:05:44jonjitsu[m] * I tried using that library and got an undeclared identifier !
06:07:30FromDiscord<ElegantBeef> The only `!` in the stdlib is for the `pegs` module
06:08:26jonjitsu[m]so `not bool` always worked?
06:08:38FromDiscord<ElegantBeef> Well that's not operating on a bool
06:09:25FromDiscord<ElegantBeef> That proc is attempting to return a NimIdent which is deprecated
06:10:12FromDiscord<ElegantBeef> The nim node it was written was 17.2 so go back there and see what happens
06:10:23FromDiscord<ElegantBeef> (edit) "node" => "version"
06:10:55jonjitsu[m]I see, thx
06:11:09jonjitsu[m]Is there a quickcheck like library out there for nim?
06:12:06FromDiscord<ElegantBeef> What's quickcheck
06:15:12FromDiscord<nikki> it's a generative testing lib for haskell
06:15:24FromDiscord<nikki> but i think they're asking about generative testing, generally, for nim
06:15:34jonjitsu[m]property based checking like: https://hypothesis.readthedocs.io/en/latest/quickstart.html
06:15:59jonjitsu[m]nikki, that's right
06:16:29FromDiscord<nikki> jonjitsu: i think that'd be pretty cool if you end up trying your hand at it
06:16:44FromDiscord<nikki> the ingredients are there: you can introspect types, at compile time even, so you can generate some pretty good generator functions
06:19:01*bung joined #nim
06:20:48jonjitsu[m]ya nim's type system seems like a much better fit for that type of testing then python
06:21:04bunghttps://github.com/nim-lang/Nim/blob/1978b9120250f69df20a5bbb2cb11e73cd3eae5a/nimsuggest/nimsuggest.nim#L739-L743
06:22:26bungwhy conf.writelnHook assign twice ? also does it needed controll here, it may controled when initNimsuggest
06:24:30*a_chou joined #nim
06:25:17FromDiscord<nikki> jonjitsu: yeah. one thing i'm super interested in is if someone makes a trie-like branching switch case for parsing strings
06:25:48FromDiscord<nikki> so like if you give a set { "abcd", "abef" } it generates a switch-case to branch at the first a and at b and then for the next one cases for c and e
06:27:26FromDiscord<nikki> essentially generating something like https://github.com/munificent/craftinginterpreters/blob/5459f9580d0065b59fba68ac3dd3555c1b326ba0/c/scanner.c#L134-L173 out of just the list of identifiers at compile time
06:28:26FromDiscord<nikki> you could imagine generating that for each set of fields in a struct when generating json parsers
06:31:19bungthat need string are all known
06:32:16FromDiscord<nikki> such as in the struct field scenario mentioned?
06:33:30bungfor identifiers that's fine, for json , I think no
06:33:51FromDiscord<nikki> if your structs describe a json schema, it makes sense
06:33:56disruptekzedeus: sup.
06:34:06disruptekbeef: _ being a valid identifier is a feature.
06:34:27FromDiscord<ElegantBeef> It only is valid to reference inside a for loop
06:34:40FromDiscord<ElegantBeef> !eval let _ = 100; echo _
06:34:43NimBotCompile failed: /usercode/in.nim(1, 19) Error: undeclared identifier: '_'
06:35:25FromDiscord<ElegantBeef> !eval for _ in ["a"]: echo _
06:35:26disruptek!eval let (a, _) = (1, 2); echo a
06:35:29NimBota
06:35:29NimBot1
06:35:31FromDiscord<nikki> bung: the idea is to take the compile-time known struct fields, and generate a json parser specifically for that struct
06:35:41FromDiscord<nikki> eg. with macros
06:35:57FromDiscord<ElegantBeef> I know it's supposed to be usable, but inside a for loop it doesnt have the same behaviour
06:36:33FromDiscord<nikki> disruptek: they're not talking about it being a valid identifier or not, just whether it actually can be reused once defined to refer to the same symbol
06:36:58*solitudesf joined #nim
06:36:59FromDiscord<ElegantBeef> Everywhere else it's a "discard value" except in a `for _ in iterator`
06:37:07bungif only specifical to that struct that's fine
06:37:09FromDiscord<nikki> like `let (a, _) = (1, 2); echo _` doesn't work; but `for _ in ...: echo _` does, even though `for _, _ in ...; echo _` doesn't
06:37:58FromDiscord<nikki> bung: yes. that's ... the idea
06:38:08FromDiscord<ElegantBeef> In the `for _, _ in iterator` you'd sorta expect it to say "identifier already declared"
06:38:19FromDiscord<ElegantBeef> Considering the `for _ in iterator` working
06:38:30FromDiscord<nikki> it does that only in multiple parameters for a proc i think (identifier already decl'd)
06:38:31*a_chou quit (Quit: a_chou)
06:38:52FromDiscord<nikki> !eval proc foo (_, _: int) = discard
06:38:54NimBotCompile failed: /usercode/in.nim(1, 14) Error: attempt to redefine: '_'
06:39:15FromDiscord<nikki> i promise i had underscores, even though discord won't let you see them
06:39:24FromDiscord<ElegantBeef> Is this inconsistancy a feature of Nim?
06:39:46FromDiscord<nikki> it keeps you on your toes
06:39:56FromDiscord<ElegantBeef> Thought that's what we had C for πŸ˜›
06:40:17FromDiscord<nikki> only if you actually write some ;p
06:40:24FromDiscord<ElegantBeef> Acceptable response
06:42:59planetis[m]hey check "new" macro dsl https://github.com/nim-lang/fusion/pull/40
06:43:00disbotβž₯ Added macro dsl based on karaxdsl
06:46:09FromDiscord<ElegantBeef> What's it for?
06:46:35disruptekput it in a lib, see if it's used, if it is, campaign for inclusion in fusion.
06:47:04planetis[m]ok will do
06:47:06FromDiscord<ElegantBeef> Yea join the party that shills their DSL when a topic is brought up
06:47:35planetis[m]i started trying to fix breeze then just copied karaxdsl and started over
06:47:47planetis[m]it's used to construct ast trees
06:48:01planetis[m]lol true
06:48:34planetis[m]i was already a member πŸ˜‹ lol
06:48:37FromDiscord<nikki> is it nicer than just `quote do`-ing all the time
06:50:25FromDiscord<ElegantBeef> Always nice to see actual use cases for sugar
06:50:48planetis[m]i don't use quote do, i used to write helper templates and getAst but i think that's better than both
06:51:12disruptekquote do is the wrong way.
06:51:30disruptekzevv: return in expr is a good way to break rewrite assumptions.
06:51:35FromDiscord<ElegantBeef> Psh i use a mix of both and live happily
06:51:41disruptekfor now.
06:51:50FromDiscord<nikki> i haven't had to do anything suuuper weird yet
06:52:10FromDiscord<nikki> only this https://github.com/nikki93/ng-public/blob/e1606f2734eb587b179e8c4bec19f2af2289d6a9/src/engine/uis.nim#L68-L138
06:55:21planetis[m]seems doable
06:55:59FromDiscord<Joe-23> Is there a library that mimics the Processing library so I can do computer graphics?
06:56:21FromDiscord<ElegantBeef> You could use nico similarly
06:56:46FromDiscord<nikki> there's nothing that mimic's processing's api directly, but yeah i'd say nico has similar levels of abstraction. you can also do graphics with aglet or raw opengl or bgfx or ...
06:56:51FromDiscord<ElegantBeef> It wouldnt support 3D, but it supports basics 2D shapes
06:57:00FromDiscord<ElegantBeef> Depends on what you're aiming for
06:57:06FromDiscord<Joe-23> @nikki I see
06:57:11FromDiscord<ElegantBeef> But yea planetis i wanna see some examples
06:57:13FromDiscord<Joe-23> I am aiming for 2D only
06:57:32FromDiscord<Joe-23> Is this for NIm by the way?
06:57:38FromDiscord<ElegantBeef> !repo nim
06:57:40disbothttps://github.com/nim-lang/Nim -- 9Nim: 11Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority). 15 10284⭐ 1097🍴 7& 29 more...
06:57:42FromDiscord<ElegantBeef> Lol
06:57:45FromDiscord<ElegantBeef> I'm dumb
06:57:47FromDiscord<ElegantBeef> !repo nico
06:57:49disbothttps://github.com/ftsf/nico -- 9nico: 11Nim Game Framework based on Pico-8 15 217⭐ 14🍴 7& 6 more...
06:57:49FromDiscord<ElegantBeef> That's what i wanted
06:57:59*habamax joined #nim
06:58:22FromDiscord<nikki> i've been wrapping sdl + sdl-gpu -- just only giving myself the functionality that i need for a particular project i'm building https://github.com/nikki93/ng-public/blob/public/src/engine/graphics.nim
06:59:00FromDiscord<ElegantBeef> The suggestion on what to use highly depends on what you mean by "computer graphics"
06:59:04FromDiscord<Joe-23> Thanks guys
06:59:20FromDiscord<nikki> you could also output postscript
06:59:21FromDiscord<nikki> or svg
06:59:22FromDiscord<nikki> as text
06:59:25FromDiscord<nikki> πŸ˜„
07:00:33FromDiscord<Joe-23> Oh nice mate
07:00:34FromDiscord<Joe-23> πŸ˜„
07:01:36FromDiscord<ElegantBeef> Planetis do you have any examples of your dsl in use?
07:06:04planetis[m]the code in whenIsMainModule
07:07:20planetis[m]basically everything inside buildMacro is interpreted as returning nimnode but there is an escape hatch, append your statement with !
07:07:25planetis[m]similar to karax
07:08:09FromDiscord<ElegantBeef> I see
07:08:11planetis[m]no need to do that for some common procs like echo, expeckKind, etc
07:08:30planetis[m]i will rewrite docs
07:24:13*narimiran joined #nim
07:40:40planetis[m]s/append/prefix
07:41:31FromDiscord<Joe-23> Does nim have `struct`s and `impl`s?
07:46:34*letto quit (Quit: Konversation terminated!)
07:48:13FromDiscord<nikki> it has documentation
07:49:23*letto joined #nim
07:51:06FromDiscord<nikki> https://nim-by-example.github.io/types/objects/
07:51:26FromDiscord<nikki> here's some good examples of objects and procs taking objects a first param
08:43:52*cyraxjoe quit (Quit: No Ping reply in 180 seconds.)
08:45:21*cyraxjoe joined #nim
08:48:16FromDiscord<Joe-23> I see so `type` is like `struct`
08:48:20FromDiscord<Joe-23> what about `impl`s?
08:55:16*neceve joined #nim
09:00:06*nikki93[m] quit (Quit: Idle for 30+ days)
09:30:29*NimBot joined #nim
10:21:58*bung quit (Quit: Lost terminal)
10:32:20*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:32:35FromDiscord<lqdev> `impl` isn't a thing in nim
10:33:00FromDiscord<lqdev> all you need to do is declare procedures with your object as the first parameter
10:33:18FromDiscord<lqdev> and then you can use method call syntax like `myObj.myProc()`
10:39:53FromDiscord<Joe-23> Sorry mate how would this look like?
10:47:03FromDiscord<Recruit_main707> https://play.nim-lang.org/#ix=2Eem
10:50:38FromDiscord<Joe-23> I see thanks
11:03:05FromDiscord<lqdev> nim's a bit more freeform than rust in that regard :)
11:09:37*tane joined #nim
11:26:03FromDiscord<flywind> Why recent commit messages are not squashed?
11:26:31FromDiscord<flywind> (edit) "Why ... recent" added "some"
11:26:36FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/777494756133437440/unknown.png
11:30:20FromDiscord<Clyybber> @flywind by accident I think
11:30:43FromDiscord<flywind> this happens twice
11:30:48FromDiscord<flywind> https://github.com/nim-lang/Nim/pull/15968
11:30:49disbotβž₯ Documentation only
11:31:09FromDiscord<flywind> I don't know whether this is intended.
11:31:22narimiranprobably 4raq switched computers and didn't change the default behaviour there
11:35:44FromDiscord<flywind> If so, we should stop that
12:06:02*supakeen quit (Quit: WeeChat 2.9)
12:06:35*supakeen joined #nim
12:09:05*narimiran quit (Ping timeout: 240 seconds)
12:17:39*sschwarzer joined #nim
12:17:44sschwarzerHi :)
12:18:38FromDiscord<ache of head> πŸ‘‹
12:19:07sschwarzerIs there a way to construct an array from another array, something like https://play.nim-lang.org/#ix=2Ef0 ?
12:19:36*lritter joined #nim
12:19:43sschwarzerI tried different variations, also didn't find anything in the docs.
12:29:15FromDiscord<Rika> sschwarzer nothing in the stdlib afaik, but i made the proc for you https://play.nim-lang.org/#ix=2Ef6
12:30:44sschwarzerRika: wow, thanks :-)
12:30:54FromDiscord<Recruit_main707> i would suggest using join or add since & is used for references and addresses
12:31:32FromDiscord<lqdev> since when
12:31:44FromDiscord<lqdev> sir this is nim not c++
12:32:15FromDiscord<Recruit_main707> pretty sure there was something
12:33:15FromDiscord<lqdev> there wasn't anything
12:33:35FromDiscord<lqdev> that would use `&` for references
12:33:46FromDiscord<Rika> uh
12:33:47FromDiscord<Rika> what
12:33:54FromDiscord<Rika> are you sure you're not thinking of rust or c++
12:34:08sschwarzerRecruit: Also, I can't find anything about `join` or `add` working on arrays (`add` wouldn't make sense as arrays are supposed to be fixed-length)
12:34:11FromDiscord<Recruit_main707> i was convinced it was in nim too
12:34:18FromDiscord<lqdev> it wasn't lol
12:34:32FromDiscord<lqdev> ~~wake up, mr. freeman~~
12:36:46FromDiscord<ache of head> Wake up and smell the coffee, Mrs Bueller.
12:38:11sschwarzerI'll probably go for using sequences for simplicity then. Currently, I'm iterating over array elements, but in one loop the array has one element more than the other array.
12:38:21sschwarzerRika: still nice to know the approach :)
12:44:08*sschwarzer quit (Quit: leaving)
12:56:32*MyMind quit (Ping timeout: 256 seconds)
13:10:16*MyMind joined #nim
13:43:03*PMunch joined #nim
13:54:42*xet7 quit (Quit: Leaving)
14:07:53zedeusdisruptek: your submodule remotes for grok in frosty and json require a github account to clone, which breaks nitter's build
14:07:58zedeusalso frosty 0.4.0 causes OOM
14:09:00zedeusI'm not sure why or how, but running nitter's test suite with frosty 0.4.0 makes it go "oh no, i'm out of memory" which is unfortunate
14:11:36FromDiscord<Mv.Quantum> hello
14:12:02FromDiscord<Mv.Quantum> (edit) "hello ... " added "@everyone"
14:12:23*natrys joined #nim
14:23:21*waleee-cl joined #nim
14:23:57FromDiscord<lqdev> nice try
14:49:36FromDiscord<krisppurg> @everyone I've been getting `An invalid argument was supplied.` whenever I do `await udp.connect(ip, Port(port))`
14:49:45FromDiscord<krisppurg> (edit) removed "@everyone"
14:52:13PMunchkrisppurg, any more than just that?
14:53:06FromDiscord<krisppurg> hm not much really
14:53:27FromDiscord<krisppurg> I'm trying to send a udp message
14:54:07PMunchWait, isn't UDP connectionless?
14:54:16FromDiscord<krisppurg> I am aware
14:54:34FromDiscord<krisppurg> but `asyncnet` doesn't have `sendTo`
14:54:37PMunchSo why do you call connect on it then?
14:55:31PMunchAnd asyncnet does have sendTo: https://nim-lang.org/docs/asyncnet.html#sendTo%2CAsyncSocket%2Cstring%2CPort%2Cstring
14:55:37FromDiscord<krisppurg> wait
14:55:48FromDiscord<krisppurg> I mean below v1.4.0
14:55:53FromDiscord<krisppurg> im using v1.2.0 personally
14:56:53FromDiscord<krisppurg> dial establishes connection
14:57:05FromDiscord<krisppurg> I was either guessing if connect would work
14:57:21FromDiscord<krisppurg> @PMunch
14:57:30FromDiscord<krisppurg> sad
14:59:28PMunchWhy don't you upgrade to 1.4?
14:59:53FromDiscord<krisppurg> I want to make dimscord flexible with nim versions
15:01:37FromDiscord<krisppurg> the only reason why v1.2.0 is required is because of async event handlers, if it was optional and version is below v1.2.0 the event handlers probably wouldn't be much asynchronous.
15:08:25FromDiscord<krisppurg> @392962235737047041> ?
15:08:30FromDiscord<krisppurg> bruh
15:14:16*bung joined #nim
15:19:47bungam not sure if this is necessary ,https://play.nim-lang.org/#ix=2Egc please give me sugestion
15:25:01FromDiscord<krabbypatty> sent a code paste, see https://play.nim-lang.org/#ix=2Ege
15:25:03FromDiscord<krabbypatty> what is the correct way to write this closure?
15:25:15FromDiscord<krabbypatty> I'm getting "anon1" twice
15:29:57FromDiscord<krabbypatty> I realizs that I can use .global. here instead of a closure, I'm just curious why this isn't working
15:30:18bungchange your const
15:30:43Zevvtoo late. he cant. it's a cost. no way of ever ever changing it.
15:30:50bungto let,var
15:32:22FromDiscord<krabbypatty> ah that works, thanks
15:32:38Zevvjoking aside, it's a good question. Because _why_ doesn't it work with const
15:32:38FromDiscord<krabbypatty> also, is there a way to use `std/sugar`'s => with multiline procs?
15:32:41Zevvbut also doesn't break
15:32:49bungit's like vm compile time compute result to a constant string
15:33:24FromDiscord<krabbypatty> I thought it would compute at compile time to the returned proc
15:33:37FromDiscord<krabbypatty> but not the returned proc's _body_
15:34:23bungthat's like js behavior
15:35:07FromDiscord<krabbypatty> what do you mean?
15:35:37bungin js you can declare a function as const
15:36:18FromDiscord<krabbypatty> right, JS's const is more like let in nim
15:36:34FromDiscord<krabbypatty> I mean, somewhat similar πŸ˜› let has more guarantees
15:36:53FromDiscord<krabbypatty> the code snippet is still weird to me
15:38:40bungthink it oppsite of js behavior
15:38:46FromDiscord<krabbypatty> the manual says: "Constant expressions are restricted to depend only on the following categories of values and operations [...]
15:38:53FromDiscord<krabbypatty> - previously declared procedures that have no side effects beyond possibly modifying compile-time variables"
15:38:59FromDiscord<krabbypatty> doesn't my function violate this
15:39:02FromDiscord<krabbypatty> it's mutating i
15:39:07FromDiscord<krabbypatty> so it should be a compile-time error?
15:40:12FromGitter<ynfle> It's result is computed at compile time and all of the variable are local to the calculation
15:41:16bungam not sure if this is necessary ,https://play.nim-lang.org/#ix=2Egc please give me sugestion
15:41:45FromDiscord<krabbypatty> what do you mean local to the calculation
15:41:53FromDiscord<krabbypatty> shouldn't it only calculate at compile-time the _closure_ itself
15:41:56FromDiscord<krabbypatty> and not the calls to the closure
15:43:09bungcome on , think it as static: would be simple
15:44:53*abm joined #nim
15:46:04bungwhere is yarndanico ? disapear for weeks
15:51:09PMunchYeah haven't seen him in a while
15:52:07Zevvhe was heer a few days ago
15:52:30FromDiscord<lqdev> when
15:52:56PMunchCan just do a search through the IRC logs
15:53:15PMunch~last Yardanico
15:53:15disbotno footnotes for `last`. πŸ™
15:53:25PMunchHmm, how was that again?
15:53:26Zevv!last Yardanico
15:53:26disbotYardanico never seen.
15:53:32PMunchAh
15:53:36Zevvthat bot is fake
15:53:42Zevvirc/2020/11/12:05:43 #nim: < Yardanico> (pragmas for routine arguments)
15:53:44FromGitter<bung87> funny
15:54:06FromDiscord<lqdev> 10th of november is the last time he sent a message on discord
15:54:33FromDiscord<lqdev> but i'm definitely seeing him less frequently as of late
15:55:31FromGitter<bung87> I like to see him here
15:55:52FromGitter<ynfle> @krabbypatty I think you should file a bug report. Check this out https://play.nim-lang.org/#ix=2Egs ⏎ (cc @bung )
16:00:37FromGitter<bung87> oh that's do same thing but dont work
16:02:19FromGitter<ynfle> That works to create a const closure
16:09:08*lritter quit (Quit: Leaving)
16:12:54*lritter joined #nim
16:21:13disruptek!last yardanico
16:21:14disbotYardanico spoke in 12#nim-news 6 hours ago
16:22:48disruptekzedeus: gimme a test? i can fix the submodules.
16:24:39disruptekzedeus: jason and frosty have a new patch-level release w/o the submodule snafu.
16:24:55zedeuscool, I'll try to make a test in a bit
16:25:24disruptekthe only real change in 0.4.0 is to remove the magic value.
16:27:05zedeusis that backwards compatible?
16:27:16disrupteknot binary-wise, no.
16:27:30disruptekyou want me to delete 0.4.0 and major it?
16:27:43disruptekdoes your test operate against existing redis cache?
16:28:14zedeusit does, but I'm not sure that's why it happens
16:28:24zedeusdo you feel ready for the big 1.0 release?
16:28:34disrupteki don't care.
16:29:08*PMunch quit (Quit: leaving)
16:29:29zedeusis using 'sorta' always beneficial, or are there specific use cases where it helps a lot?
16:29:48disruptekit slows everything down right now because sorta is not as fast as it should be.
16:30:03disruptekultimately, it will be beneficial in speed only, and only when you have a lot of pointers.
16:30:15zedeusah, thanks
16:30:26disruptekhow does the speed feel to you right now?
16:30:37zedeusnegligible
16:32:48disruptekwhat does that mean?
16:33:05Zevvhe feels negligible about speed
16:33:07zedeusfast enough that I don't care
16:33:14disruptekokay.
16:33:31disruptekzevv: you have a weird habit of adding spaces. what is that from? keyboard?
16:34:09disrupteki see it in your code, too. trailing spaces. everywhere. secret stego notes?
16:34:36zedeuswith profiles/timelines loading in just ~240ms, compared to twitter's ~1.3s, it's really not a concern
16:34:46Zevvyou see trailing spaces in my irc?
16:34:57disruptek!last Yardanico
16:34:57disbotYardanico never seen.
16:42:23FromDiscord<krisppurg> just compiled my code and I seem to just get `out of memory`, solutions?
16:55:17zedeusdownload more ram
16:56:56ForumUpdaterBotNew thread by Jackhftang: How do you deal with dependencies in Nim ? , see https://forum.nim-lang.org/t/7094
17:16:34*narimiran joined #nim
17:20:02disruptekupload less data.
17:20:41solitudesfwrite different code
17:21:03disruptekriir
17:21:08zedeusretweet
17:21:31disruptekzedeus: how do i run the test suite?
17:24:47zedeusinstall a webdriver (chrome or firefox), install seleniumbase and pytest with pip, run redis-server and nitter, then run `pytest --headless -n 12` in the tests dir
17:24:48disruptekzedeus: are you serious with these damned 7-char hashes?
17:24:58disrupteki need to fucking support these in nimph now?
17:25:00zedeusyep
17:25:34disrupteknah.
17:26:55planetis[m]how to handle multiple evaluation bugs (when using templates/ macros) these days?
17:27:14disruptekfix bugs until only one bug exists.
17:27:52disruptekthen fix that bug.
17:28:02planetis[m]i mean there is this: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sequtils.nim#L91 but it's not exported
17:31:46FromDiscord<Clyybber> planetis: Just assign to a temporary var
17:33:52*xet7 joined #nim
17:42:12*rockcavera joined #nim
17:46:52planetis[m]ok done
18:05:05Oddmongeris Β« x.int Β» sugar for Β« int(x) Β» ?
18:05:15disruptekyes.
18:05:16planetis[m]yes
18:05:21Oddmongerthanks
18:06:56planetis[m]there is a bug with generics that make x.T not work in some cases, btw
18:08:25Zevvthat's not a bug
18:08:27Zevvit's by design
18:08:33Zevvhttps://nim-lang.github.io/Nim/manual.html#procedures-method-call-syntax bottom of the par
18:10:38*hnOsmium0001 joined #nim
18:10:55planetis[m]i don't think thats it, I encountered it with https://gist.github.com/planetis-m/c13529cac44b4a9de3f073de502315ee#file-fixed_point-nim-L67 replace R(x) with x.R
18:12:58planetis[m]man, i m still so happy with how the ast dsl turned out https://github.com/nim-lang/fusion/pull/40
18:13:00disbotβž₯ Added macro dsl based on karaxdsl ; snippet at 12https://play.nim-lang.org/#ix=2Ehm
18:13:07planetis[m]it makes macros so easy
18:18:53FromDiscord<NickSeagull> If I got a windows DLL and its corresponding `.h` file? What would be the best way to call it, by using `c2nim`? `nimterop`? Directly?
18:26:35*vicfred quit (Remote host closed the connection)
18:27:03*vicfred joined #nim
18:28:09FromDiscord<NickSeagull> (edit) If I got a windows DLL and its corresponding `.h` file, What would be the best way to call it, by using `c2nim`? `nimterop`? Directly?
18:28:29FromDiscord<NickSeagull> Been looking on the internet for some time already with no avail
18:29:00FromDiscord<lqdev> c2nim probably
18:33:16FromDiscord<Recruit_main707> both will do really, if one fails, try with the other one.
19:06:31FromDiscord<NickSeagull> Awesome thanks
19:17:03zedeusdisruptek: since thawing stuff frozen with 0.3.1 gives garbled output, I dunno if it makes sense to reduce a test case that produces out of memory. the bottom line is it's not backwards compatible, so I'll just add a migration to nitter
19:17:20*neceve quit (Ping timeout: 256 seconds)
19:17:36zedeusthe issue does not happen when running the tests with an empty redis
19:20:47*Jitty[m] quit (Ping timeout: 260 seconds)
19:21:04*Jitty[m] joined #nim
19:22:00zedeusthe submodule issue is still present, you need to update jason in frosty
20:11:04*PMunch joined #nim
20:17:40ForumUpdaterBotNew thread by Kobi: Is there a way to combine types?, see https://forum.nim-lang.org/t/7095
20:18:10*lritter quit (Quit: Leaving)
20:25:25*habamax quit (Ping timeout: 240 seconds)
20:34:01*azed joined #nim
20:34:35*azed quit (Client Quit)
20:45:26*narimiran quit (Quit: leaving)
20:53:10PMunchHmm, why doesn't this work? https://play.nim-lang.org/#ix=2Eib
20:56:14*natrys quit (Quit: natrys)
20:57:44ForumUpdaterBotNew thread by Mildred: Which HTTP server library?, see https://forum.nim-lang.org/t/7096
21:01:31FromDiscord<lqdev> PMunch: sadly, you can't use macros like that
21:01:44FromDiscord<lqdev> you'd have to make the macro output a type section
21:03:05PMunchMeh
21:03:13PMunchThat's not pretty
21:03:44FromDiscord<lander> I replied in the forum: https://forum.nim-lang.org/t/7086, but I cannot see my messages posted unless I'm logged in. Does the account need some validation or is that a glitch?
21:04:27*junland quit (Quit: %ZNC Disconnected%)
21:04:31FromGitter<ynfle> https://play.nim-lang.org/#ix=2Ein @Pmunch
21:05:01PMunch@ynfle, I ended with something similar: https://forum.nim-lang.org/t/7095
21:06:07*junland joined #nim
21:06:45planetis[m]that comment says they work https://github.com/nim-lang/Nim/issues/13830#issuecomment-609031271
21:06:46disbotβž₯ `macro pragmas` in type section should apply to `TypeSection`, not `TypeDef` ; snippet at 12https://play.nim-lang.org/#ix=2rOP
21:07:24planetis[m]you need to output a nnkStmtlistType
21:09:03FromGitter<ynfle> I prefer `quote do:` It's easier to see what's happening in macros
21:11:01*solitudesf quit (Ping timeout: 260 seconds)
21:13:57PMunchAh nice, this works: https://play.nim-lang.org/#ix=2Eio
21:14:49Prestigepretty neat
21:15:58*opal quit (Remote host closed the connection)
21:17:29*opal joined #nim
21:20:21Zoom[m]How to get a pair of random non-equal ints the correct way? I rand A and then rand B in a while loop until B != A
21:22:38FromDiscord<lander> sent a code paste, see https://play.nim-lang.org/#ix=2Eir
21:22:49FromDiscord<lander> sent a code paste, see https://play.nim-lang.org/#ix=
21:24:09PMunchThat is pretty much the only way to do it Zoom[m]
21:25:17FromDiscord<lander> (edit) doAssert not compiles:↡ intEnumWithHoles:↡ type Unordered = enum A, B, C = 12, E, D = 11, F
21:25:39FromDiscord<nikki> Zoom: correct
21:26:15Zoom[m]k, thanks
21:27:36FromDiscord<nikki> another approach is to imagine the integer cartesian plane. you basically want to ignore the x = y diagonal. you can imagine numbeing all of the points starting at 1, 0 and spiralling out from the center
21:28:21FromDiscord<lqdev> @lander https://play.nim-lang.org/#ix=2Eiu
21:31:23Zoom[m]nikki, right, I'll stick with a loop for a while :D
21:33:31FromDiscord<ElegantBeef> You could get a random number, then flip a coin to see if you want to sample higher/lower, then choose between the selected number and the high or low range
21:33:45FromDiscord<ElegantBeef> That way you dont need a while or for loop, and will get still pretty random numbers
21:36:08FromDiscord<lander> @lqdev, thank you!
21:37:29PMunchhttps://github.com/PMunch/notifishower
21:37:47PMunchHooray, notifishower now has a proper icon and the latest version is now on GitHub
21:38:02FromDiscord<ElegantBeef> Grats
21:38:13FromDiscord<lqdev> @lander there also appears to be a simpler, although less pretty solution: https://play.nim-lang.org/#ix=2Eiw
21:38:29PMunchNow I just need to make some cool examples of it
21:54:43FromGitter<sealmove> hey PMunch
21:56:07PMunchHi
21:56:21PMunchI saw your PR
21:56:23PMunchLooks good
21:56:32PMunchBut I'm too tired right now to look it over properly
21:56:50FromGitter<sealmove> Np, I planned to extend binaryparser a lot but there is a big worry.
21:57:21FromGitter<sealmove> since syntax is "type: name" instead of "name: type", it seems impossible to make nested definitions
21:58:30FromGitter<sealmove> I guess if I want something much more versatile with nested defs, conditional fields and type-switching on expressions, I should make a new project and keep binaryparse small and neat?
21:58:52FromDiscord<ElegantBeef> @nikki ehhh https://github.com/nim-lang/Nim/issues/15972
21:58:54disbotβž₯ In for loop `_` is accessible ; snippet at 12https://play.nim-lang.org/#ix=2EiA
21:59:31PMunchOh, that is all already possible
21:59:59FromDiscord<ElegantBeef> Zoom did you see my suggestion for your randomly choosing two numbers without a while loop?
22:00:36PMunch@sealmove, here is one I made to parse DNS messages: http://ix.io/2EiE
22:01:27Zoom[m]ElegantBeef, thanks, saw it. I somehow think there's no real benefit to this approach.
22:01:40FromDiscord<ElegantBeef> Well it removes the while loop πŸ˜›
22:02:25Zoom[m]But it adds branching for the coin toss
22:04:11*Quibono joined #nim
22:04:20planetis[m]thats a neat macro exelotl
22:04:30FromDiscord<nikki> @ElegantBeef can i see your approach
22:04:46FromDiscord<ElegantBeef> Scroll up a bit
22:04:48Zoom[m]If there's just rand(int) in a loop, it's not too bad and the code is simpler. If there were more logic involved, your solutions is of course preferable
22:05:17FromDiscord<ElegantBeef> Basically you flip a coin after picking the first number and then pick between high/low range and that number
22:05:24planetis[m]reminds me of what jblow was evangelizing about anonymous fields
22:06:00FromDiscord<nikki> yea that works too, but doesn't work for non ranged stuff i guess
22:06:00FromGitter<sealmove> @PMunch sure it's good that you can mix declarations with custom parsers (basically with plain Nim). I am talking about having the whole parser in declarative form.
22:06:21FromDiscord<nikki> altho u could choose random unsigned and add to the split?
22:06:27FromGitter<sealmove> Something like Python's Construct.
22:06:32FromDiscord<nikki> in any case integers on computers have ranges so its fine :p
22:06:38PMunchProblem is you will never get it to be 100% compatible with various formats
22:06:45PMunchThat's why I added the custom parser syntax
22:07:22PMunchAnd it's how you compose different parsers into each other, and how you can do conditionals and such
22:08:05PMunchNotice how I in the DnsMessage parser call the Control, Question, and RR parsers
22:09:17FromGitter<sealmove> KS and Construct can encode/decode any format. But I see the benefit in keeping macros minimal and composing with plain Nim code. Maybe it's better dunno have to think about it.
22:09:55PMunch_any_ format?
22:10:34FromGitter<sealmove> yeah, they have enough features to handle anything (unlike serializers like protobuf)
22:10:49PMunchHmm
22:11:20PMunchWell, I like binaryparse. It has a small enough syntax that you can actually know all of it. And for the edge cases you can always go back into Nim and write your own
22:11:47FromGitter<sealmove> Noted, I agree.
22:11:50PMunchAnd you can of course call a parser from within a custom parser to do e.g. conditionals
22:11:54Zoom[m]ElegantBeef, also, there's an edge case: If we get a Min or Max for B we can only go higher or lower. That's an additional check.
22:13:22PMunchI wrote it to parse some satellite data formats that where really weird, and I had just worked with pcap and PNG files before I wrote it. So I kept all those formats in mind and designed it to be able to read all of them. The recent DNS thing I did with it was super easy to implement and it just works perfectly
22:13:48PMunchBy the way, I'd be interested in seeing how KS or Construct handles the DNS message compression algorithm
22:13:58ForumUpdaterBotNew thread by Kobi: Out of memory, see https://forum.nim-lang.org/t/7097
22:14:47planetis[m]hi sealmove checkout what i made https://github.com/nim-lang/fusion/pull/40
22:14:49disbotβž₯ Added macro dsl based on karaxdsl ; snippet at 12https://play.nim-lang.org/#ix=2Ehm
22:14:53PMunchBut I'm heading off for bed now, good night
22:14:54*PMunch quit (Quit: leaving)
22:15:25FromGitter<sealmove> gn!
22:16:22FromGitter<sealmove> well for stuff like compression they allow using custom proc but only for "processing" a sequence of bytes
22:16:52FromGitter<sealmove> so I didn't consider this as part of the spec
22:39:49QuibonoIf there was any python library we could have in Nim, what would you want?
22:41:32FromDiscord<hobbledehoy> requests
22:42:22planetis[m]the one that orders pizzas
22:42:39FromDiscord<ElegantBeef> The inverse of `typing` πŸ˜›
22:42:41planetis[m]πŸ™
22:43:05FromDiscord<ElegantBeef> Purely joking, dont even attempt to implement that
22:43:12FromDiscord<Recruit_main707> we have something similar to request dont we?
22:43:27FromDiscord<ElegantBeef> httpclient?
22:43:46FromDiscord<ElegantBeef> Requests is just a http client
22:44:04FromDiscord<hobbledehoy> We have that↡But it doesn't have session handling for cookies though
22:47:51Zoom[m]ElegantBeef, here's what I've got with your approach: https://play.nim-lang.org/#ix=2EiV
22:48:58Zoom[m]Isn't it too much? πŸ˜›
22:49:25FromDiscord<ElegantBeef> wait to make it look ugly πŸ˜„
22:49:51*Quibono quit (Remote host closed the connection)
22:50:06Zoom[m]BTW, so the ranges in standard library are always inclusive?
22:50:12FromDiscord<ElegantBeef> yes
22:51:22Zoom[m]<FromDiscord "<ElegantBeef> wait to make it lo"> what do you mean? I'm open for corrections, since I'm new to the language.
22:52:41FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2EiY
22:52:53Zoom[m]IMO, inclusive ranges are weird for a language with so much indexing going on
22:54:42FromDiscord<nikki> how do you make a range that includes the min or max of the parent range by only using exclusive ranges?
22:55:34Zoom[m]`..=` instead of `..<`
22:55:45Zoom[m]That's just a preference, I suppose
22:57:36Zoom[m]ElegantBeef, probably better, but not much IMO, as your version has the repeating `rand(0..<a)` πŸ˜€
22:57:50FromDiscord<ElegantBeef> ok
22:57:53FromDiscord<ElegantBeef> here
22:58:15FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2Ej2
23:00:12Zoom[m]Yep, that's it. I almost wrote this but wanted to see the logic lined up first.
23:00:54Zoom[m]This is the way.
23:01:00*abm quit (Quit: Leaving)
23:05:23*Quibono joined #nim
23:09:41QuibonoLol, just want to contribute to the Nim ecosystem, porting a small library from python seems pretty doable.
23:10:13Zoom[m]Is using expressions like `result = if ...` discouraged for any reasons?
23:10:54planetis[m]no, no reasons against it
23:11:26Zoom[m]But is it discouraged? :)
23:11:50planetis[m]well it doesn't come up often, does it?
23:12:27FromDiscord<ElegantBeef> Expressions are not discouraged, just using them a lot like you did is unreadable imo
23:12:55QuibonoMaybe case of would be more elegant?
23:13:17planetis[m]and you might come up with an elif case, then you will need to refactor it
23:13:44planetis[m]no scratch that
23:14:29planetis[m]let x = if cond: a elif cond2: b else: c work afaik
23:14:55QuibonoBut whhhhy
23:14:57disruptekzedeus: sorry about that. i will cut a version-1.0 once i'm done fucking with frosty for IC and then we'll have a major you can pin. i did fix submodules again for criterion.
23:15:10disruptekyou can pin 0.4.2 for now.
23:15:41disruptekor just go back to the 0.3 branch for magics.
23:15:50Quibonoplanetis[m]: Why do you want to write it like that?
23:16:09disruptekzedeus: ^
23:17:16planetis[m]i dont its just possible
23:17:20Zoom[m]ElegantBeef, yeah, in that case the readability really suffered. I think this is due to indentation, it's like you expect the right side of the assignment to be it's own block
23:18:09QuibonoOkay I was worried there.
23:18:54disruptekZoom[m]: rand A; if it's odd (or some other measure), B = rand(A+1 .. A.high). else: B = rand(A.low .. A-1)
23:20:14Zoom[m]disruptek, we've already ended up with something like this
23:20:32disrupteksorry, i was typing while in scrollback. 😁
23:22:33disruptekthey won't be random, but you also won't have the loop.
23:25:38Zoom[m]https://play.nim-lang.org/#ix=2Ej7
23:25:40FromDiscord<ElegantBeef> We just flipped a coin, the coin indicates the range to select
23:26:55Zoom[m]That probably screws up the distribution, depending on where in the range we end up with the first number.
23:30:48Zoom[m]The shorter the "half" the more favour its number get.
23:31:03Zoom[m]But I could be totally wrong, my math is that bad.
23:31:31FromDiscord<nikki> i think the distribution is correct
23:32:35FromDiscord<nikki> if the algo is: for two unique nums in a range (a, b) pick first num p, then flip a coin to decide whether to pick next num in (a, p) or (p, b) right?
23:32:59FromDiscord<ElegantBeef> Yea it should be, if it's 0-12 and you get 3. 0-2, and 4-12 should have equal opportunity to be choosen
23:33:49FromDiscord<nikki> another way to think abt this is
23:33:51FromDiscord<ElegantBeef> the only reasone it'd be unequal is if you constantly get `3` in the above example, since the bottom half would pop up more often
23:33:52Zoom[m]If max=9 and A = 1 we have 1:2 for getting 0 for B and 1:2 for getting 2..9
23:34:05FromDiscord<ElegantBeef> yes but that's only for this one flip
23:34:13FromDiscord<ElegantBeef> Roll for another number, you get 2
23:34:34FromDiscord<nikki> imagine all pairs of unequal numbers (p, q). sort them by q and then by p
23:34:37Zoom[m]Right, that's where I'm wrong
23:35:09FromDiscord<nikki> actually wait i think you shouldn't flip a coin
23:35:16FromDiscord<ElegantBeef> For a single sample it would appear your picking of an uneven split isnt equal, but over multiple numbers the uneven set should be equal
23:35:30FromDiscord<nikki> i think you need to decide with (p - a) / (b - a) chance to pick before p
23:35:40QuibonoWhat is the thing you guys are trying to do?
23:35:53FromDiscord<ElegantBeef> I mean you can always test the distribution yourself
23:36:06FromDiscord<nikki> pick among all pairs of ints (p, q) where p not equal to q, uniformly
23:36:12FromDiscord<ElegantBeef> Run 0-10 a few hundered times and see what numbers pop up
23:36:30Zoom[m]Get a random pair of non equal numbers
23:36:44disruptekyou're wrong because the fundamental assumption is wrong.
23:36:47Zoom[m]We need a one-liner for gnuplot
23:37:09disrupteka will be random among a range of X and b will be random among a range of X-1.
23:37:26FromDiscord<nikki> lolwut
23:37:30disruptekergo, they are not equally random.
23:37:34QuibonoLol so random and it needs to be a one liner.
23:38:06FromDiscord<nikki> there's no assumption. there is a set of all pairs of p, q ints that are not equal. you want to pick among them uniformly
23:38:13disruptekyes.
23:38:29disruptekuse miran's itertools to generate permutations.
23:38:33FromDiscord<nikki> one way is to pick p and rejection sample q (reject when equal to p)
23:39:03disruptekanother way is to use a loop.
23:39:06FromDiscord<nikki> another suggested approach to pick p, flip to decide whether to pick higher or lower, then pick accordingly. we're evaluating if that works
23:39:06Zoom[m]Quibono: I meant a one-liner to feed the results of the tests to get a histogram
23:39:21FromDiscord<nikki> rejection sampling involves a loop
23:39:33FromDiscord<nikki> but you can use a loop in other approaches too, yes
23:39:35disruptekthe coin flip way works but it's not correct.
23:39:38*tane quit (Quit: Leaving)
23:40:19disruptekbut the whole concept is broken.
23:41:11QuibonoWhy not just do this? https://play.nim-lang.org/#ix=2Ejf
23:41:17FromDiscord<nikki> that's what one thinks immediately. but if you think about it more, it seems like maybe it works
23:41:26FromDiscord<nikki> so then you need a proof
23:41:28FromDiscord<nikki> not confidence
23:41:37Zoom[m]I recon, we need to regenerate both of the numbers until we get a pair, not just the second one.
23:41:47Zoom[m]If we go with the loop approach
23:41:55FromDiscord<nikki> nah zoom first then loop on second works
23:42:14FromDiscord<nikki> you select among all pairs involving first p uniformly, which is right
23:42:16disruptekpick a random index from the array. rotate the array randomly, less than N. now use the same index. you have two random numbers that are not equal if the array holds distinct values.
23:42:21QuibonoWhy do you need to regenerate both?
23:42:50disruptekand you can do it with one line.
23:42:52Zoom[m]Quibono, that's what we started from! I asked if it's the correct way and here we go
23:43:02FromDiscord<nikki> it's a correct way
23:43:12FromDiscord<nikki> it's only the correct way if all other approaches are provably wrong
23:43:23disrupteknah.
23:43:44QuibonoLol but the first variable is still random, and because the second number can't equal var1, why would you regen it?
23:44:00zedeusdisruptek: you need to update the jason module in frosty, it still points to a hash with git+ssh
23:44:03Zoom[m]To be sure :D
23:44:10disruptekzedeus: i looked at it and didn't see it.
23:44:12FromDiscord<ElegantBeef> Yep it's not actually random
23:44:22FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2Ejg
23:44:28FromDiscord<ElegantBeef> Distribution is off
23:44:32disruptekzedeus: i'm looking at it now and don't see it.
23:44:46FromDiscord<ElegantBeef> (9, 10) consistantly gets around 4500
23:45:01FromDiscord<lander> @PMunch, after looking at your Scancodes mapping forum response and learning about enum with holes I've sketched this macro that I think it could add good value to the C enums that are properly enums with holes, i.e. densely packed and not the other cases described as enum maps
23:45:06FromDiscord<lander> https://github.com/nim-lang/Nim/pull/15983
23:45:07disbotβž₯ Utility macro to fill holes in enums with synthetic values
23:45:08disruptekzedeus: 0.3.1 is fixed; is it not pushed?
23:45:20FromDiscord<nikki> @ElegantBeef well the primitive rand ur using may not be uniform itself
23:45:34zedeusdisruptek: the jason submodule in frosty is pinned at 1842883, which is "update benchmarks", the next commit in jason is "submodule fix"
23:45:41FromDiscord<nikki> the only issue can be if it biases toward the middle or sth
23:45:45disruptekoh shit.
23:46:00Quibonohttps://play.nim-lang.org/#ix=2Ejh Okay so wouldn't this be the shortest way to do it?
23:46:13disruptekzedeus: who pinned it?
23:46:35zedeusdunno, you probably
23:46:36FromDiscord<lander> I expect controversy for stirring the holed enum pot but let's see what you think.
23:47:38disruptekzedeus: well, it's not pinned for me.
23:47:52disruptekzedeus: get a real package manager and stop pinning everything.
23:48:08zedeusit's pinned according to github's web interface, I dunno how that works
23:48:22disruptekclearly.
23:48:45disrupteklook at the .gitmodules file in the repo.
23:48:49zedeusyeah, I see it
23:48:54FromDiscord<ElegantBeef> Just tested it with only a single number nikki times it was very close per each value
23:49:18disruptekan example of a pin is where i changed skflatbuffers to point to `branch = nim1`.
23:49:21FromDiscord<ElegantBeef> for 100k randoms it was around 9k per each
23:49:28FromDiscord<ElegantBeef> Which is reasonable distribution
23:50:13zedeusrecursively cloning frosty with git prints this "Submodule path 'jason': checked out '18428839d5a41299366b52f9842b27906e0967e4'"
23:55:35FromDiscord<lander> How does the forum moderation work?
23:58:11zedeusyou can also see it when doing `git ls-tree HEAD` in frosty
23:58:13zedeus160000 commit 18428839d5a41299366b52f9842b27906e0967e4 jason
23:58:22zedeusI think you misunderstand how submodules
23:58:27zedeuswork*
23:59:34FromDiscord<nikki> you could do sample first num in 0..range and second num in 0..<range
23:59:46FromDiscord<nikki> and if they are equal, use second num = range