<< 10-01-2022 >>

00:00:14*tk quit (Quit: Well, this is unexpected.)
00:00:39*tk joined #nim
00:00:56FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LIn
00:01:24FromDiscord<Patitotective> Not sure if there's a better way to use `result`
00:01:30FromDiscord<Elegantbeef> I'd not use return and not do the if expression on a single line
00:02:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LIo
00:02:18*crem joined #nim
00:02:27FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/JSG
00:02:39FromDiscord<Elegantbeef> Using return in macros is annoying since you cannot easily debug
00:03:00FromDiscord<Patitotective> sweet
00:03:06FromDiscord<Patitotective> thanks, really 🙃
00:10:26FromDiscord<DMI-1407> if i write a discord bot with nim... do i have to compile it for node.js or is it using a c++ discord api ?↵(also, where can i host it?... or do i have to host it myself)
00:11:32FromDiscord<Rosen> You would use nim bindings for the discord api, like `dimscord`, and compile it with the nim compiler
00:12:03FromDiscord<Rosen> And you would find some service to host it or run it on your own machine, hosting is not related to development
00:12:41FromDiscord<Rosen> (edit) "`dimscord`," => "the `dimscord` library,"
00:14:08*victor_boludo joined #nim
00:14:17FromDiscord<DMI-1407> but will i have to compile it to js or c ?
00:14:40FromDiscord<DMI-1407> because discords native api is written in js
00:14:46FromDiscord<DMI-1407> thats what confuses me
00:15:40FromDiscord<Rosen> Oh I got you
00:15:53FromDiscord<Rosen> Well if you use dimscord that should be fine for either, up to you
00:16:08FromDiscord<Rosen> At least as far as I know
00:16:24FromDiscord<Rosen> When I used it for a bot I compiled it with the C backend
00:16:33FromDiscord<Rosen> And just ran it on a VPS
00:17:38FromDiscord<DMI-1407> hm ok, how is the js support for some os handlers ? is it already supported ?
00:17:53FromDiscord<DMI-1407> (i just read the book about nim, but its a little bit outdated)
00:18:25FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3LIv
00:18:36FromDiscord<Rika> Catch is a keyword
00:18:38FromDiscord<that_dude> Is it
00:18:41FromDiscord<Rika> I believe so
00:19:04FromDiscord<that_dude> I couldn't find any documentation on it/nimsuggest doesn't imply that
00:19:26FromDiscord<that_dude> or whatever nim extension I'm using in vs code
00:19:38FromDiscord<Rika> Huh it doesn’t say it is so it isn’t
00:20:43FromDiscord<that_dude> So uh, what is it then, a hidden keyword and intentional, or a bug
00:20:54victor_boludoCould someone tell me why this code hangs forever on `socket.recv`?
00:20:55victor_boludo```
00:20:55victor_boludoimport net
00:20:56victor_boludolet socket: Socket = newSocket()
00:20:56victor_boludonewContext().wrapSocket(socket = socket)
00:20:57victor_boludosocket.connect(
00:20:57victor_boludo    address = "www.americanas.com.br",
00:20:58victor_boludo    port = Port(443),
00:20:58victor_boludo    timeout = 3000
00:20:59victor_boludo)
00:20:59victor_boludosocket.send(data = "GET / HTTP/1.1\r\nHost: www.americanas.com.br\r\n\r\n")
00:21:00victor_boludodiscard socket.recv(size = 300, timeout = 3000)
00:21:00victor_boludo```
00:21:34FromDiscord<Rika> In reply to @that_dude "So uh, what is": Dunno
00:22:25FromDiscord<that_dude> Well what should I do about this, make a forum post?
00:25:01FromDiscord<DMI-1407> In reply to @victor_boludo "Could someone tell me": send and recv do not garantee that all datas will be send
00:25:15FromDiscord<DMI-1407> and they may block your thread
00:26:12FromDiscord<DMI-1407> (edit) "garantee" => "guarantee"
00:26:58FromDiscord<congusbongus> wouldn't it be easier using a http library instead of sockets?
00:32:48victor_boludowell, it hangs with std/httpclient too
00:32:58victor_boludoeven setting the timeout to a lower value didn't help
00:33:07victor_boludoit just hangs
00:36:52*victor_boludo quit (Quit: Client closed)
00:38:37*victor_boludo joined #nim
00:40:11*victor_boludo quit (Client Quit)
00:44:58FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LIx
00:46:19FromDiscord<Rika> First is invalid, second prolly is preferred, if you like third then okay
00:49:06FromDiscord<Rosen> In reply to @victor_boludo "port = Port(443),": Are you sure you should be connecting to the https socket? I would assume that it's expecting to see a handshake cert
00:49:18FromDiscord<Rosen> Try port 80 instead, unless this is intended
00:49:37FromDiscord<sealmove> Does someone know a human readable serialization format that supports sets?
00:50:49FromDiscord<Rika> What else do you expect out of the format? Free form or schema?
00:51:25*noeontheend quit (Ping timeout: 240 seconds)
00:51:36FromDiscord<sealmove> hmm wdym?
00:52:06FromDiscord<Rika> I don’t exactly have an answer for you anyway actually
00:52:38FromDiscord<Rika> Basically do you want something like JSON which is free form or Protobuf which needs a schema (disregarding that they’re more different than that)
00:53:17FromDiscord<sealmove> yeah I am using JSON currently
00:53:25FromDiscord<sealmove> but schema is ok
00:53:29FromDiscord<sealmove> maybe even better
00:54:47FromDiscord<Elegantbeef> To support sets in a human readable format you're probably almost certainly going to have to do a parse hook on a string
00:56:25FromDiscord<sealmove> I don't know what this is 😅
00:56:43FromDiscord<Elegantbeef> You have a string `"{10, 20, 30}"` in your format
00:56:52FromDiscord<Elegantbeef> Then parsing you remove `{}` and iterate over it
00:58:46FromDiscord<evoalg> In reply to @retkid "see, our brains work": I've been using `for a in 0 .. sq.high`
00:59:53FromDiscord<evoalg> better than `for a in 0 .. len(seq) - 1` ... but yea `for a in 0 ..< len(sq)` is ok too
01:00:39FromDiscord<Elegantbeef> `for a in 0.. seq.high` is indeed the best
01:03:00FromDiscord<Rosen> victor_boludo in case it didn't ping you when I replied, see above
01:04:40FromDiscord<sealmove> In reply to @Elegantbeef "Then parsing you remove": so _parse hook_ means parsing with more than 1 iteration?
01:05:04FromDiscord<Elegantbeef> Parsehook is a user defined hook for a specific type in `jsony` and the stdlib `std/jsonutils`
01:05:18FromDiscord<sealmove> oh
01:05:27FromDiscord<Elegantbeef> Basically you give the data to procedure to then apply to data
01:05:46FromDiscord<sealmove> i see thanks
01:09:20FromDiscord<evoalg> I've seen lots of comments about people taking exception to nim being called "transpiled" ... so I know nim isn't transpiled, but I don' t know what it means (and I don't know why people take exception to it)?
01:09:41FromDiscord<Elegantbeef> It depends on your definition
01:09:47FromDiscord<Elegantbeef> Some say "source to source" is transpilation
01:10:16FromDiscord<Elegantbeef> Others say "higher level to lower level of abstraction is compilation, so Nim -\> C is compilation"
01:11:05FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LIF
01:11:12FromDiscord<evoalg> Ahhh so some people belittle nim saying it's just a transpiler, but it's actually a compiler
01:11:28FromDiscord<Elegantbeef> I mean i'm indifferent i feel like that difference is negligable
01:11:44FromDiscord<Elegantbeef> Rust for instance uses LLVM as an IR, Nim uses C as an IR
01:11:53FromDiscord<Elegantbeef> The IR hardly matters
01:12:03FromDiscord<evoalg> IR?
01:12:25FromDiscord<Elegantbeef> Intermediate Representation
01:12:33FromDiscord<Elegantbeef> Basically what does it compile down to before ASM
01:12:39FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LIG
01:12:42FromDiscord<Elegantbeef> It's a float32
01:12:46FromDiscord<retkid> AH
01:13:14FromDiscord<Elegantbeef> `'f32` is just a literal annotation
01:13:17FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#lexical-analysis-numeric-literals
01:13:39FromDiscord<retkid> but why does it return↵``0.009999999776482582``
01:14:07FromDiscord<Elegantbeef> Floating point 32
01:14:14FromDiscord<Elegantbeef> Floats have limited range of values
01:14:22FromDiscord<ynfle> In reply to @Patitotective "Is this the proper": It depends on the constructor, If you are looking for a `@` with and array then yes. If not, not. Meaning, macros that are untyped, don't have `@[1, 2, 3]` as a sequence. It's just a bunch of identifiers and brackets
01:14:49FromDiscord<Elegantbeef> Thanks ynfle was about to write to that
01:14:51FromDiscord<retkid> In reply to @Elegantbeef "Floats have limited range": i think im missing something lowlevel
01:14:59FromDiscord<Elegantbeef> Too many things to address at one, plus trying to fix the compiler
01:15:03FromDiscord<retkid> (edit) "lowlevel" => "low level"
01:15:13FromDiscord<Elegantbeef> a float32 is only 32bits but represents -inf .. inf
01:15:17FromDiscord<Patitotective> In reply to @ynfle "It depends on the": Thanks 🙃
01:15:32FromDiscord<Elegantbeef> Becuase of that range and limited size you cannot get exact values
01:15:40FromDiscord<retkid> In reply to @Elegantbeef "a float32 is only": ok i think whats confusing me more is why the hell its being fed into an optimizer
01:15:51FromDiscord<Elegantbeef> It's not being optimized?
01:16:04FromDiscord<retkid> but why that
01:16:13FromDiscord<Elegantbeef> Cause that's how floats work
01:16:17FromDiscord<ynfle> In reply to @retkid "i think im missing": You can think of it as having a limited amount of decimal points. 64 bits has more decimal points
01:16:24FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LIH
01:16:25FromDiscord<Elegantbeef> `0.01` cannot be represented accurately in 32bit float
01:16:46FromDiscord<Rika> In binary it cannot
01:16:54FromDiscord<Rika> In decimal sure
01:16:56FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3LIH" => "https://play.nim-lang.org/#ix=3LII"
01:17:00FromDiscord<Rika> But floats are binary
01:17:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LIJ
01:17:27FromDiscord<Elegantbeef> How the hell am i supposed to know why they pass 0.01, read the code
01:17:28FromDiscord<retkid> i think its just the uncommented magic number
01:17:59FromDiscord<retkid> In reply to @Elegantbeef "How the hell am": THE CODE ISN'T HELPFUL
01:18:06FromDiscord<Rika> I don’t know what you want help for anymore
01:18:19FromDiscord<Elegantbeef> Go to the source of `optimizerAdam`
01:18:29FromDiscord<Elegantbeef> Nim ships source code libraries
01:19:53FromDiscord<evoalg> isn't it to do with https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems ?
01:20:04FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LIK
01:20:17FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3LIK" => "https://play.nim-lang.org/#ix=3LIL"
01:20:21FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3LIL" => "https://play.nim-lang.org/#ix=3LIM"
01:20:22FromDiscord<Elegantbeef> You can post the code here all day, read what it's doing
01:20:24FromDiscord<Elegantbeef> It is indeed vo
01:20:24FromDiscord<ynfle> It is the learning rate
01:21:18FromDiscord<Elegantbeef> There was a good website that explained floating point inaccuracies, but dont recall it
01:21:42FromDiscord<evoalg> there is this: https://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/ ... but I dunno if it's good
01:22:10FromDiscord<Rika> In reply to @Elegantbeef "There was a good": Me too
01:22:40FromDiscord<Rika> https://0.30000000000000004.com/
01:22:47FromDiscord<Rika> https://floating-point-gui.de/
01:22:48FromDiscord<retkid> I think im just gonna have to accept it because↵``learning_rate: T = T(0.001)``↵is kinda strange when you give it a float32 because ``(0.01'f32)(0.0001)`` isn't valid code
01:22:49FromDiscord<Elegantbeef> There you go
01:22:57FromDiscord<Elegantbeef> The first one is it
01:23:05FromDiscord<Rika> T can be a static value
01:23:06FromDiscord<Rika> ?
01:23:30FromDiscord<Elegantbeef> T is the type
01:23:44FromDiscord<Rika> I mean yes I know but I ask ret
01:24:13FromDiscord<retkid> alright i give up on understanding whatever this is
01:24:37FromDiscord<Elegantbeef> Congrats
01:31:30FromDiscord<retkid> ok i think i understand but this function has no comments that pertain to the code or why it exists
01:31:51FromDiscord<retkid> so i still have no clue why they put that in
01:32:55FromDiscord<retkid> if you use the default value nothing changes
01:33:24FromDiscord<congusbongus> uncommented code???↵I remember inheriting code from some solo dev of a video codec and trying to understand his comments with stuff like `// I LIKE CHEESE`
01:34:00FromDiscord<retkid> those are worse than no comments
01:34:09FromDiscord<retkid> because those comments make a lot of sense to the dev
01:34:17FromDiscord<retkid> it probably makes them immediately remember what it does
01:34:28FromDiscord<retkid> but you don't have those memories so its kinda taunting you
01:35:13FromDiscord<ynfle> In reply to @retkid "ok i think i": are you wondering what the learning rate is and how it affects the model?
01:35:39FromDiscord<retkid> why they put 0.00'f32 in
01:35:53FromDiscord<retkid> out of all the numbers, why that
01:35:59FromDiscord<congusbongus> git blame; email author
01:36:15FromDiscord<ynfle> You mean 0.001? or the 'f32?
01:36:17FromDiscord<retkid> I could dm him here, but i dont wanna waste his time
01:36:36FromDiscord<retkid> why both of those two things together
01:37:30FromDiscord<retkid> i assume its because the model was setup to use f32
01:37:35FromDiscord<Elegantbeef> Cause they want the proc to be specialized for a float32 and want it to have the learning rate of 0.001
01:37:48FromDiscord<Elegantbeef> It's an unconstrained generic proc, why would you make that assumption
01:38:03FromDiscord<retkid> the models are not
01:38:12FromDiscord<retkid> the tenors are assigned to types
01:38:44FromDiscord<retkid> maybe its stupid to assume that interacting the model would require the type explicitly specified ¯\_(ツ)_/¯
01:44:09*noeontheend joined #nim
01:45:53FromDiscord<ynfle> It doesn't need it specified, but the larger the float, the more the memory
01:46:26*krux02 quit (Remote host closed the connection)
02:06:13*Gustavo6046 quit (Ping timeout: 240 seconds)
02:14:36FromDiscord<evoalg> so float8 and float16 may end up using less mem, but are they faster too? ... with float32 and float64 I've been told that in a 64 bit cpu they are both processed at the same speed, so for smaller ones (if bit-packing isn't used) they wouldn't be faster but only saves mem - is that right?? ... or does the cpu do some sort of batch-processing-number-crunching?
02:15:09FromDiscord<Elegantbeef> Performance can be got from using smaller floats for a multitude of reasons
02:15:18FromDiscord<evoalg> ahhhh ok!
02:16:34FromDiscord<Elegantbeef> They're smaller so you get more cache efficiency is one benefit, I dont know if they're more or less efficient in operations though
02:18:42FromDiscord<Elegantbeef> I think on some CPUs it might be slower but cant say for certain
02:18:56FromDiscord<Elegantbeef> talking about modern CPUs of course
02:21:25FromDiscord<congusbongus> they can be slower if you operate on individual floats - the CPU has to load them out, perform the operation, then store it back in, because it operates at the word size (64 bit)↵so unless you know what the assembly code is, use the native int/float sizes↵except for using less memory if you used packed data structures↵also alignment matters a lot
02:23:30*adigitoleo joined #nim
02:28:37FromDiscord<evoalg> ok easy, thanks!
02:29:06*neurocyte09172 joined #nim
02:30:37*neurocyte0917 quit (Ping timeout: 240 seconds)
02:30:37*neurocyte09172 is now known as neurocyte0917
02:40:49FromDiscord<Rika> thats an if youre working on indiv floats though
02:42:27*Gustavo6046 joined #nim
02:45:02FromDiscord<evoalg> ahh ok
02:49:36NimEventerNew Nimble package! nim-snappy - Nim implementation of Snappy compression algorithm, see https://github.com/status-im/nim-snappy
02:51:03FromDiscord<Rika> dont we already have this as supersnappy
02:53:19FromDiscord<Elegantbeef> I thought so
02:54:00FromDiscord<Rika> probably a matter of status needing to do whatever they need exactly then
02:54:27FromDiscord<Elegantbeef> They do have crc32 in their repo
02:56:34*Gustavo6046 quit (Quit: Leaving)
02:57:11*arkurious quit (Quit: Leaving)
02:58:01*rockcavera joined #nim
02:58:01*rockcavera quit (Changing host)
02:58:01*rockcavera joined #nim
02:58:06*Gustavo6046 joined #nim
03:39:49*noeontheend quit (Ping timeout: 240 seconds)
04:04:24*noeontheend joined #nim
04:32:13*noeontheend quit (Ping timeout: 240 seconds)
04:49:35FromDiscord<Rika> what is the status of destructors again?
04:49:43FromDiscord<Rika> works with refc? i dont remember
04:49:56FromDiscord<Elegantbeef> I think they work just not predictably
04:50:10FromDiscord<Elegantbeef> In other words you have to wait for a GC collect
04:50:12FromDiscord<Elegantbeef> Or force one
04:50:44FromDiscord<Rika> yikes
04:58:04FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3LJs
04:58:31FromDiscord<Elegantbeef> Yes `varargs` is converted it a contiguous array
04:58:46FromDiscord<Elegantbeef> into a contiguous\
04:58:55FromDiscord<that_dude> What does that mean?
04:59:12FromDiscord<Elegantbeef> I meant homogenous
04:59:22FromDiscord<Elegantbeef> So `[1, "abc"]`
04:59:53FromDiscord<Elegantbeef> Which is invalid
05:00:06FromDiscord<that_dude> That's what I thought, I just wanted to be sure I wasn't wasting my time lol
05:03:03FromDiscord<Rika> ~~better to waste someone elses time than your own~~ it is a joke
05:03:28FromDiscord<that_dude> >:)
05:05:40FromDiscord<Elegantbeef> Here's a solution around it https://play.nim-lang.org/#ix=3LJw
05:14:26FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3LJy
05:14:30FromDiscord<sharpcdf> trying to test out the js backend :/
05:15:07FromDiscord<Elegantbeef> What's the mismatch
05:15:20FromDiscord<Elegantbeef> Oh i see the issue
05:15:23FromDiscord<Elegantbeef> `document.write`
05:15:26FromDiscord<Elegantbeef> `Document` is a type
05:15:43FromDiscord<sharpcdf> oh bruh
05:15:46FromDiscord<sharpcdf> mb
05:15:48FromDiscord<sharpcdf> thanks lmao
05:16:11FromDiscord<sharpcdf> shit youre right
05:17:09FromDiscord<sharpcdf> ok wait how do i open js files
05:17:23FromDiscord<sharpcdf> run them
05:17:43FromDiscord<Rika> compile in nim, you should see an output file?
05:19:30FromDiscord<Elegantbeef> `nim js yourFile.nim` is how
05:19:38*lumo_e quit (Quit: Quit)
05:19:45FromDiscord<Elegantbeef> You'll probably want `-d:danger` or `-d:release` to reduce the debug information, but that's between you and your god
05:31:33FromDiscord<that_dude> In reply to @Elegantbeef "Here's a solution around": That's actually interesting, I'll look into that later
05:31:51FromDiscord<haoyu> the nim-lang nightly build is stuck in 2021, will it come with us into the new year?
05:32:25*rockcavera quit (Remote host closed the connection)
05:32:52*sagax joined #nim
05:36:02FromDiscord<haoyu> I found it
05:36:29FromDiscord<haoyu> https://media.discordapp.net/attachments/371759389889003532/929971939588587602/unknown.png
05:49:12arkanoidI'm currently using "patchelf --set-rpath '$ORIGIN/lib' myexecutable" after build pass as I'm failing to do the same with passC/passL, do you know how?
05:56:30arkanoidthis page does that just with --passL:"-rpath ..." https://pewpewthespells.com/blog/using-sanitizers-with-nim.html but I'm getting "gcc: error: unrecognized command line option ‘-rpath’" instead
05:58:41FromDiscord<Elegantbeef> You probably should use clang as the compiler if you're not
06:06:11FromDiscord<leorize> arkanoid\: `--passL:-Wl,-rpath,path_goes_here` is what you need
06:19:42FromDiscord<sharpcdf> how would i redirect to another page with the js backend?
06:20:00FromDiscord<sharpcdf> im trying `window.location` but i dont know how to convert a string to a location object
06:22:20FromDiscord<Elegantbeef> Ah `LocationObj` isnt exported so it's less than ideal but you'd just use the object constructor and set the coresponding fields here i think https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L1239-L1249
06:22:47FromDiscord<Elegantbeef> There is also `replace` which might do what you want?
06:23:49FromDiscord<Elegantbeef> yea replace seems to be "right"
06:24:14FromDiscord<Elegantbeef> You could import `assign` or similar
06:25:49FromDiscord<sharpcdf> In reply to @Elegantbeef "There is also `replace`": ill look into it
06:25:58FromDiscord<sharpcdf> i also found window.open() which should be fine for now
06:26:00FromDiscord<sharpcdf> thanks
06:26:10FromDiscord<Elegantbeef> `proc assign(location: Location, dir: cstring) {.importjs.}` if you want assign
06:26:20FromDiscord<Elegantbeef> JS super easy to interop with ime
06:31:55FromDiscord<sharpcdf> the problem is that theres no location variable
06:32:01FromDiscord<sharpcdf> just the type
06:32:11FromDiscord<sharpcdf> and i think it has to be preset
06:34:16FromDiscord<Elegantbeef> `document.location`
06:34:16FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L208 for reference to what `document` has
06:34:32FromDiscord<Elegantbeef> What?
06:34:51FromDiscord<sharpcdf> oh
06:34:53FromDiscord<Elegantbeef> Ah sorry it's `window.location` i'm tired
06:34:55FromDiscord<sharpcdf> i didnt see that lmao
06:35:06FromDiscord<sharpcdf> either way thanks lmao
06:35:08FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L133
06:35:10FromDiscord<Elegantbeef> Sadly this stuff isnt visible
06:38:44FromDiscord<sharpcdf> thanks
06:38:52FromDiscord<sharpcdf> one last question before i pass out
06:40:12FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3LJJ
06:40:16FromDiscord<sharpcdf> specifically the `else` part
06:40:26FromDiscord<sharpcdf> it doesnt create the h1
06:41:01FromDiscord<Elegantbeef> It creates it but doesnt add it
06:41:05FromDiscord<Elegantbeef> Or atleast it should
06:41:36FromDiscord<sharpcdf> so then what might the problem be
06:41:46FromDiscord<Elegantbeef> not doing `addElement` or w/e it is
06:41:58FromDiscord<Elegantbeef> I dont raw JS much
06:43:29FromDiscord<Elegantbeef> Correction i dont raw js ever
06:45:10FromDiscord<sharpcdf> lmao same
06:47:46FromDiscord<sharpcdf> found it
06:47:56FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3LJL
06:48:03FromDiscord<sharpcdf> thanks
06:58:12FromDiscord<Larky> hi everyone, can someone tell me what this code does? (I need to write its analog on windows, but I cannot do it until I understand what this code does. posix library)
06:58:38FromDiscord<evoalg> In reply to @Elegantbeef "Here's a solution around": it doesn't run for me on playground?
06:58:59FromDiscord<Elegantbeef> Read the error
06:59:19FromDiscord<Elegantbeef> The design parameters was only accept `int/string`
06:59:20FromDiscord<evoalg> ohhh! I understand!
06:59:22FromDiscord<Larky> (edit) "hi everyone, can someone tell me what this" => "sent a" | "does? (I need to write its analog on windows, but I cannot do it until I understand what this code does. posix library)" => "paste, see https://play.nim-lang.org/#ix=3LJN"
06:59:56FromDiscord<evoalg> (not the code, but I understand that it should error :D)
07:01:37FromDiscord<Elegantbeef> That seems to just see if a file exists and if it's a socket
07:01:43FromDiscord<Elegantbeef> I could be wrong
07:01:56FromDiscord<Elegantbeef> Just looked at the `stat(2)` manpage
07:02:07FromDiscord<Elegantbeef> Yea evo it was purposely written to show "hey this does indeed error"
07:04:47FromDiscord<evoalg> I thought it was purposely written to show anything can be done with macros 😉
07:05:17*Gustavo6046 quit (Ping timeout: 240 seconds)
07:06:15FromDiscord<Elegantbeef> If you have a keyboard and the willpower to write it, pretty much
07:06:20FromDiscord<Elegantbeef> Though there are some things restrained
07:11:14*Gustavo6046 joined #nim
07:17:42FromDiscord<evoalg> I think I just realized that a generic proc is just shorthand for overloading several proc's
07:18:04FromDiscord<Elegantbeef> Indeed
07:18:21FromDiscord<evoalg> I dunno what that took me so long!
07:18:26FromDiscord<Elegantbeef> It's really just a ergonomic template that's constrained to a list of types
07:20:35FromDiscord<Elegantbeef> C++'s generics are actually just templates
07:24:09FromDiscord<evoalg> is it possible to limit args passed to templates in nim ? ... eg to be only int or float?
07:24:31FromDiscord<Elegantbeef> Yea they work just like procs
07:24:45FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/xrD
07:25:09FromDiscord<Elegantbeef> Templates parameters are dispatched upon just like procs
07:28:00FromDiscord<evoalg> so I can do `template doThing(a: int or float) = discard` ?
07:28:14FromDiscord<Elegantbeef> Yess
07:28:45FromDiscord<evoalg> does the generic `[T]` work with templates also?
07:29:03FromDiscord<Elegantbeef> Yep
07:29:04FromDiscord<Rika> Kinda?
07:29:12FromDiscord<Rika> I’ve heard some issues though
07:29:31FromDiscord<Elegantbeef> There are some caveats depending what you're doing but it does indeed work
07:29:59*PMunch joined #nim
07:30:02FromDiscord<evoalg> Thank you both
07:30:02FromDiscord<Elegantbeef> I cannot recall them at the moment
07:44:17adigitoleoI notice that nim source uses Testament but doesn't seem to use std/unittest much. When using testament, is it better to use files as "test suites" rather than `suite` from std/unittest?
07:44:38adigitoleoOr rather, can they be used together?
07:45:22FromDiscord<Rika> Don’t use them together
07:45:36FromDiscord<Rika> They’re not made for combined use I believe
07:46:41adigitoleoOK, I wonder if there are any other packages using Testament yet? Seems like most people are using unittest, but the docs sort of recommends Testament...
07:48:01FromDiscord<Rika> Rare. Use unit test
07:48:33FromDiscord<Rika> Testament is very difficult to learn due to the anemic documentation right now
07:49:18adigitoleoYep, unittest seems more intuitive to me so I'll stick to that for now then.
07:49:23adigitoleoCheers.
07:59:43*beshr joined #nim
08:09:30*Gustavo6046 quit (*.net *.split)
08:09:31*justsomeguy quit (*.net *.split)
08:09:31*kayabaNerve_ quit (*.net *.split)
08:09:31*joast quit (*.net *.split)
08:09:32*vicecea quit (*.net *.split)
08:09:32*ozzz quit (*.net *.split)
08:09:32*ehmry quit (*.net *.split)
08:09:32*Onionhammer quit (*.net *.split)
08:09:32*oddish quit (*.net *.split)
08:09:32*anadahz quit (*.net *.split)
08:09:33*Goodbye_Vincent quit (*.net *.split)
08:09:33*mahlon quit (*.net *.split)
08:09:33*rlp10 quit (*.net *.split)
08:09:33*GnuYawk quit (*.net *.split)
08:09:34*ecs quit (*.net *.split)
08:09:34*[R] quit (*.net *.split)
08:09:34*xiamx quit (*.net *.split)
08:09:35*robertmeta quit (*.net *.split)
08:09:35*neurocyte0917 quit (*.net *.split)
08:09:35*sagax quit (*.net *.split)
08:09:36*rb quit (*.net *.split)
08:09:37*jkl1337 quit (*.net *.split)
08:09:37*Zevv quit (*.net *.split)
08:09:38*happycorsair[m] quit (*.net *.split)
08:09:38*xiamx[m] quit (*.net *.split)
08:09:38*averell quit (*.net *.split)
08:09:39*meowray quit (*.net *.split)
08:09:40*toothlessgear quit (*.net *.split)
08:09:40*blackbeard420 quit (*.net *.split)
08:09:41*zacts quit (*.net *.split)
08:09:41*zgasma[m] quit (*.net *.split)
08:09:42*xet7 quit (*.net *.split)
08:09:42*dtomato quit (*.net *.split)
08:09:42*redj quit (*.net *.split)
08:09:42*GreaseMonkey quit (*.net *.split)
08:09:42*koltrast quit (*.net *.split)
08:09:42*dom96 quit (*.net *.split)
08:09:42*adium quit (*.net *.split)
08:09:43*FromDiscord quit (*.net *.split)
08:09:43*mal`` quit (*.net *.split)
08:09:43*anddam quit (*.net *.split)
08:09:43*mjsir911 quit (*.net *.split)
08:09:44*ormiret quit (*.net *.split)
08:09:44*Yardanico quit (*.net *.split)
08:09:44*NimEventer quit (*.net *.split)
08:09:44*nixfreaknim[m] quit (*.net *.split)
08:09:44*cheer[m] quit (*.net *.split)
08:09:44*notchris quit (*.net *.split)
08:09:44*Schnouki quit (*.net *.split)
08:09:45*gshumway quit (*.net *.split)
08:09:45*madprops quit (*.net *.split)
08:09:45*djanatyn quit (*.net *.split)
08:21:44*Gustavo6046 joined #nim
08:21:44*sagax joined #nim
08:21:44*neurocyte0917 joined #nim
08:21:44*justsomeguy joined #nim
08:21:44*kayabaNerve_ joined #nim
08:21:44*anadahz joined #nim
08:21:44*joast joined #nim
08:21:44*vicecea joined #nim
08:21:44*zgasma[m] joined #nim
08:21:44*nixfreaknim[m] joined #nim
08:21:44*xiamx joined #nim
08:21:44*happycorsair[m] joined #nim
08:21:44*cheer[m] joined #nim
08:21:44*xiamx[m] joined #nim
08:21:44*Zevv joined #nim
08:21:44*jkl1337 joined #nim
08:21:44*rb joined #nim
08:21:44*[R] joined #nim
08:21:44*ecs joined #nim
08:21:44*GnuYawk joined #nim
08:21:44*rlp10 joined #nim
08:21:44*mahlon joined #nim
08:21:44*Goodbye_Vincent joined #nim
08:21:44*robertmeta joined #nim
08:21:44*meowray joined #nim
08:21:44*averell joined #nim
08:21:44*blackbeard420 joined #nim
08:21:44*toothlessgear joined #nim
08:21:44*zacts joined #nim
08:21:44*NimEventer joined #nim
08:21:44*Yardanico joined #nim
08:21:44*ormiret joined #nim
08:21:44*mjsir911 joined #nim
08:21:44*anddam joined #nim
08:21:44*mal`` joined #nim
08:21:44*FromDiscord joined #nim
08:21:44*koltrast joined #nim
08:21:44*GreaseMonkey joined #nim
08:21:44*redj joined #nim
08:21:44*dtomato joined #nim
08:21:44*xet7 joined #nim
08:21:44*adium joined #nim
08:21:44*dom96 joined #nim
08:21:44*djanatyn joined #nim
08:21:44*madprops joined #nim
08:21:44*Schnouki joined #nim
08:21:44*notchris joined #nim
08:21:44*gshumway joined #nim
08:21:44*oddish joined #nim
08:21:44*Onionhammer joined #nim
08:21:44*ehmry joined #nim
08:21:44*ozzz joined #nim
08:33:19*jjido joined #nim
08:42:17*pro joined #nim
09:28:24FromDiscord<ynfle> In reply to @Michal58 "I thought of a": For some reason `[T; X: static[T]]` works for the func https://play.nim-lang.org/#ix=3LKm
09:30:13*Gustavo6046 quit (Ping timeout: 240 seconds)
09:34:16*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:36:25FromDiscord<Michal Maršálek> In reply to @ynfle "For some reason `[T;": Lol wth
09:36:43FromDiscord<ynfle> Perhaps a little cleaner https://play.nim-lang.org/#ix=3LKn
09:37:21FromDiscord<ynfle> My guess is because this just creates an instance of the type so, T, and static T are concrete
09:37:39FromDiscord<ynfle> Not sure why it didn't work/isn't needed before
09:38:23FromDiscord<ynfle> In reply to @adigitoleo "I notice that nim": https://github.com/disruptek has a couple of testing libraries
09:55:30adigitoleoynfle: Thanks, some interesting stuff there.
09:58:11FromDiscord<Bung> In reply to @Elegantbeef "<@714152700920594493>\: i know it's": I search messaged mentioned me found this, that's great thing, so I can continue my static site generator. Thank you !👍
10:03:57*jjido joined #nim
10:20:12*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
10:40:46*jjido joined #nim
11:06:12*szahid joined #nim
11:06:16szahidHello.
11:08:40szahidis a way to declare array without size?
11:09:26nrds<Prestige99> You may want a sequence
11:09:42nrds<Prestige99> https://nim-lang.org/docs/tut1.html#advanced-types-sequences
11:12:29*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:14:08*pro quit (Quit: WeeChat 3.4)
11:53:50szahidnrds: and is a way to add more items to openarray?
12:04:16nrds<Prestige99> I don't believe so
12:20:24*fvs joined #nim
12:21:12fvstip - to check the asm generated by nim (and others) you can use: https://godbolt.org/
12:32:21NimEventerNew Nimble package! zxcvbnim - A zxcvbn clone for Nim. Written in Nim, see https://github.com/jiiihpeeh/zxcvbnim
12:32:21NimEventerNew Nimble package! tome - A natural language library., see https://github.com/dizzyliam/tome
12:32:21NimEventerNew Nimble package! utf8tests - UTF-8 test cases and supporting code., see https://github.com/flenniken/utf8tests/
12:38:48FromDiscord<Rika> damn thats a lot
12:42:30*beshr quit (Ping timeout: 256 seconds)
12:55:29*jjido joined #nim
12:59:39*rockcavera joined #nim
12:59:39*rockcavera quit (Changing host)
12:59:39*rockcavera joined #nim
13:01:59*kayabaNerve_ quit (Read error: Connection reset by peer)
13:02:08*kayabaNerve_ joined #nim
13:08:24FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3LLk
13:08:30FromDiscord<Rika> from moduleX import a,b,c
13:08:32FromDiscord<hmmm> oh
13:08:33FromDiscord<Rika> does that not work
13:08:37FromDiscord<hmmm> ty 🥳
13:10:44FromDiscord<xx_ns> hi
13:10:49FromDiscord<xx_ns> how do i stop this from happening https://media.discordapp.net/attachments/371759389889003532/930086279209697330/unknown.png
13:11:29FromDiscord<xx_ns> namely, the first evaluates to 255.0 but is converted to 254 when cast to uint8, probably because of floating point math rounding errors
13:12:24FromDiscord<el__maco> add 0.5 before truncating to uint8?
13:13:33FromDiscord<xx_ns> that's.. really obvious
13:13:34FromDiscord<xx_ns> thanks
13:13:50FromDiscord<Rika> or round
13:14:01FromDiscord<TryAngle> or div?
13:14:04FromDiscord<xx_ns> rounding is too expensive for what i'm doing
13:14:23FromDiscord<el__maco> I mean the first one would not work with div at all
13:15:22FromDiscord<xx_ns> yeah, `(255 div 7919)` would be `(0)`
13:16:22FromDiscord<el__maco> adding 0.5 might not work with negative numbers, I keep forgetting what is a good way to deal with that
13:17:17FromDiscord<xx_ns> negative numbers are not an issue for me, i'm only working with positive values anyways
13:19:03FromDiscord<hmmm> recursive module deps are a pain 😡
13:19:57FromDiscord<Rika> just dont do it man wtf
13:23:31FromDiscord<hmmm> pfttt the pain about this thing is that it hits when you wrote already a lot of lines and modules and suddenly some major restructuring is needed
13:24:44FromDiscord<Rika> just restructure in ur head bro its what i do smhhhhh
13:24:59FromDiscord<hmmm> lol
13:27:07FromDiscord<hmmm> I guess I'll just make a new file, import the common stuff and pass values around but it's ugly as hell. Hope my boi Araq fixes this after we get IC
13:55:38*Vladar joined #nim
14:09:58*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:29:31FromDiscord<blans> In reply to @nrds "<Wabby/freenode> Is there a": is this true?
14:30:08*Vladar quit (Quit: Leaving)
14:31:46FromDiscord<Patitotective> sent a code paste, see https://paste.rs/d5L
14:33:18FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LLH
14:37:10FromDiscord<Patitotective> huh? I'm confused on how to create an emtpy sequence
14:39:40FromDiscord<Patitotective> Lol it was `newSeq[int]()`
14:44:43*arkurious joined #nim
14:49:34FromDiscord<Patitotective> nvm
14:49:56FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LLL
15:26:05FromDiscord<eyecon> In reply to @KatrinaKitten "The biggest thing I": I couldn't find it in the honeycomb documentation: can we parse in the middle of a string (optionally many times), like ignoring some cruft at the beginning and at the end?
15:28:30*oprypin quit (Ping timeout: 268 seconds)
15:29:12*oprypin joined #nim
15:40:34FromDiscord<Patitotective> order
15:55:05FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3LMb
15:55:21FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3LMc
15:56:59FromDiscord<eyecon> (If I move the `.asSeq` to the first group the result is the same, which surprises me: why does this make the second group be reported as a `seq`?)
16:26:28*jjido joined #nim
16:26:57FromDiscord<Michal Maršálek> Hi, why is `nnkHiddenStdConv` inserted in the macro call? https://play.nim-lang.org/#ix=3LMr
16:28:45FromDiscord<gerwy> there is no --secret in 1.6.0 nim?
16:28:46FromDiscord<gerwy> D:
16:33:30FromDiscord<Rosen> do you mean the repl that comes up with `nim secret`?
16:37:23*vicecea quit (Read error: Connection reset by peer)
16:37:53*vicecea joined #nim
16:38:57FromDiscord<KatrinaKitten> In reply to @eyecon "I couldn't find it": It's possible to make a parser which matches anything, such as the built in `anyChar`, and then skip its value with `>>`. That said, Honeycomb parses greedily, which makes it unwieldy to do so.
16:43:15FromDiscord<KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3LMB
16:43:57FromDiscord<KatrinaKitten> (edit) "https://play.nim-lang.org/#ix=3LMB" => "https://play.nim-lang.org/#ix=3LMC"
16:44:04*Figworm joined #nim
16:46:56*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
16:47:40FromDiscord<KatrinaKitten> In other words, `(bit 3)` gives a `seq[T]` parser, and `(bit 3).asSeq` gives a `seq[seq[T]]` parser, so the latter causes `&` to wrap the other parsers to match the most deeply nested level.
16:47:51FromDiscord<KatrinaKitten> (edit) "and" => "but"
16:57:12*noeontheend joined #nim
16:59:07arkanoidwhat does it mean when a proc has stropped name and ends with `=` like in "proc `qobjectVal=`*(variant: QVariant, value: QObject)" ?
17:02:17nrds<Prestige99> it allows you to do variant.qobjectVal = someValue
17:02:49arkanoidok, thanks
17:09:58*pro joined #nim
17:12:06*justsomeguy left #nim (WeeChat 3.3)
17:29:32FromDiscord<eyecon> In reply to @KatrinaKitten "Honeycomb attempts to merge": Understood, thank you. Is there a proper combination method that would do what I want, namely have the first group of three, second group of three, and the rest in separate `seq`s? I am asking for a "proper" solution because I think you meant that the way I do it is an unintended side-effect.
17:29:48FromDiscord<eyecon> Or should I just wrap all groups in `asSeq`s?
17:31:51FromDiscord<whisperdev> What is the best way to do a lot of http get requests?
17:33:00FromDiscord<KatrinaKitten> In reply to @eyecon "Understood, thank you. Is": It's not so much an unintended side effect as an intended but slightly unintuitive one. The second parser in your example is actually equivalent to using `asSeq` on all groups, since `&` actually does so internally to match the nesting levels, but if it helps you more clearly understand your code, I recommend being explicit about it 🙂
17:33:35FromDiscord<eyecon> In reply to @KatrinaKitten "It's not so much": Thanks, that was really helpful
17:34:11FromDiscord<KatrinaKitten> Happy to help 💜
17:37:25arkanoidif "MyType = distinct pointer" is "*p" and "MyArray = UncheckedArray[MyType]" is "**p", is "ptr MyArray" "***p" ?
17:48:25Amun-Ramhm
17:51:31FromDiscord<Clonkk> Usually, you never use UncheckedArray as is, it's always `ptr UncheckedArray`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
17:53:52arkanoidthat's what confuses me, what's the difference from UncheckedArray[X] and prt UncheckedArray[X]? is the first a stack allocated array anyway?
17:58:05arkanoidis this correct to cast a seq to pass it to C? "cast[ptr UncheckedArray[MyType]](a[0].unsafeAddr)" ?
17:58:16arkanoidwhere a is seq[MyType]
18:00:55FromDiscord<Clonkk> A Nim object containing a pointer to MyType↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
18:01:12FromDiscord<Clonkk> (in short, it has other thing in it)
18:02:17arkanoidI'm not sure I'm following you
18:02:58arkanoidare you sayind that UncheckedArray is just a stack wrapper object with a "prt MyType" field in it?
18:03:46arkanoidUncheckedArray[MyType] = distinct ptr MyType ?
18:08:45Amun-RaUncheckedArray[foo] is just like foo[] in C
18:11:02*jjido joined #nim
18:12:11*jjido quit (Client Quit)
18:15:45FromDiscord<Jiezron> I wonder if it would be possible to add a repository for Nim for this Github organisation page : https://github.com/TheAlgorithms↵The list of algorithms for Python is pretty impressive, and I am sure much of them translates well into Nim. Maybe it could help to advertise Nim (and to have implementation reference for classical algorithms) ?
18:20:45*Gustavo6046 joined #nim
18:36:54FromDiscord<eyecon> It would be very nice, no doubt
18:37:04FromDiscord<eyecon> I hadn't heard of the site but looks nice
18:37:29FromDiscord<eyecon> Although some lesser used language implementations look a bit... rough
18:42:13*noeontheend quit (Ping timeout: 240 seconds)
18:52:41FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3LNr
18:55:04FromDiscord<eyecon> Forgot `import honeycomb, sugar` but hopefully that was obvious
18:57:02FromDiscord<KatrinaKitten> Try using `.join` instead of mapping to join. If that doesn't work, show the echoed result please 😄
18:57:13*vicfred joined #nim
18:58:09FromDiscord<eyecon> Ah, that does work, thanks again
19:00:01FromDiscord<eyecon> So the map is supposed to be used only for the final result, and not to be combined with other parser parts, is that right?
19:12:58FromDiscord<KatrinaKitten> In reply to @eyecon "So the map is": Not exactly, it can be used mid-parser, but it changes the result type which may mess with things. I'm not sure why what you posted didn't work, aside from maybe some issue with not providing a separator to the stdlib `join` (or maybe it not being imported?), but I do know that mapping to join is unnecessary since that's basically what the `join` template in Honeycomb already implements for you
19:14:58FromDiscord<KatrinaKitten> (edit) "In reply to @eyecon "So the map is": Not exactly, it can be used mid-parser, but it changes the result type which may mess with things. I'm not sure why what you posted didn't work, aside from maybe some issue with not providing" => "sent" | "separator to the stdlib `join` (or maybe it not being imported?), but I do know that mapping to join is unnecessary since that's basically what the `join` template in Honeycomb alrea
19:16:22*pro quit (Quit: WeeChat 3.4)
19:46:41*noeontheend joined #nim
20:05:01*noeontheend quit (Ping timeout: 240 seconds)
20:09:07*Gustavo6046 quit (Remote host closed the connection)
20:17:26NimEventerNew thread by Mratsim: Introducing taskpools, a small lightweight ARC/ORC threadpool, see https://forum.nim-lang.org/t/8791
20:18:51*Gustavo6046 joined #nim
20:23:22*Figworm quit (Quit: Figworm)
20:27:45*noeontheend joined #nim
20:33:50*rlp10 quit (Ping timeout: 260 seconds)
20:34:37*rlp10 joined #nim
20:37:06FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LO2
20:46:37*rlp10 quit (Ping timeout: 240 seconds)
20:48:47*rlp10 joined #nim
20:57:43*fvs left #nim (WeeChat 3.4)
21:01:42FromDiscord<Elegantbeef> `unpack(a)` depends on runtime values so cannot be used like that afaik
21:20:24arkanoidI'm really quite stressed by the bad nim+vscode integration since I've started using nim. I've been escaping python due to lack of static typing, I ended up in a development environment where the ide complains hundred of errors and my code if scattered of red and yellow lines, but yet it compiles and runs correctly
21:20:44FromDiscord<Elegantbeef> Setup your vscode extension
21:21:02FromDiscord<Elegantbeef> Nimsuggest doesnt do well with project recognition
21:21:23FromDiscord<Michal Maršálek> In reply to @ynfle "For some reason `[T;": @ElegantBeef did you see this?
21:21:53FromDiscord<Elegantbeef> No but i'm still working on a fix
21:21:57FromDiscord<Elegantbeef> I had it working but it broke something else
21:23:09FromDiscord<Michal Maršálek> Oh like improving the compiler to understand that syntax? You are a beast
21:23:25*noeontheend quit (Ping timeout: 240 seconds)
21:23:46FromDiscord<Elegantbeef> Well it already understands it, it just doesnt propogate it
21:24:25FromDiscord<Elegantbeef> Meaning it hits the `static T` and doesnt evaluate it properly
21:25:38FromDiscord<Elegantbeef> But yea arkanoid if using saem's vscode extension set `"nim.project" : ["yourMain.nim"]` if you havent already
21:25:49FromDiscord<Elegantbeef> It should make it a much nicer experience
21:26:39*krux02 joined #nim
21:28:04FromDiscord<Michal Maršálek> In reply to @Michal58 "Hi, why is `nnkHiddenStdConv`": Would you be so kind and look also at this? 🙂
21:28:11arkanoidElegantbeef, I'm already doing that, false positive and negatives are still scattered around like polka-dot
21:28:44arkanoidmoreover it doesn't consider nim files in .cache/nim/myproject_d (like futhark wants)
21:28:48FromDiscord<Elegantbeef> hidden conversions are what the compiler does for converters or when it should convert to a tyep
21:28:49FromDiscord<Elegantbeef> Odd
21:29:13FromDiscord<Elegantbeef> Oh that might be a nimsuggest bug
21:29:27FromDiscord<Elegantbeef> I've never used futhark so i dont know
21:30:09FromDiscord<Michal Maršálek> In reply to @Elegantbeef "hidden conversions are what": I see but why is the conversion happening?
21:31:10FromDiscord<Elegantbeef> int -\> Natural?
21:32:04FromDiscord<Michal Maršálek> nvm I'm dumb
21:32:06FromDiscord<Michal Maršálek> Thanks!
21:39:52FromDiscord<ajusa> can I manually iterate an iterator? Like iterator.next, can iterate, etc? I saw an RFC (the first RFC) but not sure what the state is now, four years later
21:46:15FromDiscord<Michal Maršálek> Why doesn't this work: https://play.nim-lang.org/#ix=3LOv
21:48:50FromDiscord<Michal Maršálek> This does work: https://play.nim-lang.org/#ix=3LOw
21:48:57FromDiscord<Michal Maršálek> Can `static` not be generic?
21:54:03FromDiscord<Michal Maršálek> This https://play.nim-lang.org/#ix=3LOz creates a different error: "cannot generate VM code for S". What does it mean?
21:57:45FromDiscord<Michal Maršálek> I actually need more something like this: https://play.nim-lang.org/#ix=3LOC
21:58:16FromDiscord<Elegantbeef> Closures only↵(@ajusa)
21:58:23FromDiscord<Elegantbeef> Inline iterators are basically templates
21:59:04FromDiscord<Elegantbeef> If you want to convert a inline to closure checkout https://github.com/beef331/slicerator/blob/master/tests/test1.nim#L71-L117
22:00:21FromDiscord<ajusa> In reply to @Elegantbeef "If you want to": Neat, thanks for the example! Guess I'm using slicerator as a dependency lol
22:00:48FromDiscord<Elegantbeef> Cheers there is also `asResettableClosure` if you want to be able to reset it to default 🙂
22:01:49FromDiscord<ajusa> is there is a peek option?
22:02:01FromDiscord<Elegantbeef> There is not
22:02:25FromDiscord<Elegantbeef> Iterators dont really support peak due to how they work
22:02:30FromDiscord<Elegantbeef> Atleast Nim's
22:02:44FromDiscord<ajusa> yeah, I might be too used to cpp's way of doing it
22:02:50FromDiscord<Elegantbeef> I could implement it though
22:03:02FromDiscord<kevin> Is there a simple way to prevent Winim pointer operator (`&`) from conflicting with Strformat's `&` formatting operator?
22:03:16FromDiscord<Elegantbeef> I think i could
22:03:18FromDiscord<ajusa> In reply to @Elegantbeef "I could implement it": That'd be amazing at least for the project I'm working on, and for iterators in general. I'd think you'd basically just call the iterator and cache the value
22:03:25FromDiscord<eyecon> In reply to @KatrinaKitten "Not exactly, it can": The empty separator seems to be not the issue, but makes sense; if in doubt I will take a look at the code and not further bother you with this as it's working with the `.join` - thanks again!
22:04:27FromDiscord<Elegantbeef> I mean `peek` should take a closure iterator, call it once returning the value but resetting the data back to what it was before
22:04:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LOF
22:05:26FromDiscord<ajusa> Ah yeah, there's that option as well. I was thinking more call the iterator, save the value, and use that cached value for peek. I think mine would be faster, but yours requires less memory and is simpler to implement as well.
22:06:03FromDiscord<ajusa> But yes if you can implement that it would make my life a LOT easier
22:06:37FromDiscord<Elegantbeef> Yea will do it in a minute
22:06:47FromDiscord<Elegantbeef> Eventually i'll get slicerator onto the nimble registry
22:07:32arkanoidElegantbeef, btw I suggest you to try futhark. I've wrapped all the C libs I've encoutered so far in less than 10 lines. It works so well that you actually don't need to make a separate package as polished wrapper, but you use it as-is
22:07:36FromDiscord<ajusa> I generally check out your Github, treeform, and disruptek on a weekly or so basis just to see the cool stuff lol, so it has been on my radar for a while
22:08:04FromDiscord<Elegantbeef> Why mine?
22:08:10FromDiscord<Elegantbeef> I never have anything cool
22:10:46madpropsit's beefy stuff
22:11:20FromDiscord<ajusa> nah dude, you have some cool stuff. picostd-lib, the constructor helper, slicerator, sumtypes, and kashae are the ones I've either used or considered using
22:13:49FromDiscord<Elegantbeef> Well sumtypes is superceded by lerorize's union
22:16:00FromDiscord<ajusa> yeah, I use that instead now
22:17:08FromDiscord<Elegantbeef> `peek` has been added
22:18:33FromDiscord<Elegantbeef> There is an optimization to be done for `peek` but i dont feel like doing the low level op to do it 😀
22:18:33FromDiscord<ajusa> I am eternally grateful
22:19:04FromDiscord<Elegantbeef> Only copying the progress variable instead of the entire data to reduce memory consumption to the bare minium
22:19:42FromDiscord<Elegantbeef> But given that `rawEnv` does https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L2451-L2458 i'm too lazy to presently do it
22:19:52FromDiscord<ajusa> manual iterators are honestly pretty useful for iterating over multiple lists IMO, especially streams (which is what I'm using it for). Fair enough lol
22:21:01FromDiscord<Elegantbeef> Guess it'd just be `result = ((NI) `x`.ClE_0)[1]` fetching that before and resetting it after
22:21:11FromDiscord<Elegantbeef> I think atleast i dont know
22:21:18FromDiscord<Elegantbeef> Hey it's what the package is meant for
22:21:22FromDiscord<Elegantbeef> Making iterators nicer
22:26:01*noeontheend joined #nim
22:29:24FromDiscord<Elegantbeef> What do you mean?
22:30:53*PMunch quit (Quit: leaving)
22:33:04*jjido joined #nim
22:35:54FromDiscord<ajusa> ?
22:36:20FromDiscord<Elegantbeef> @Michal Maršálek\: follow this for fun https://github.com/nim-lang/Nim/pull/19362 😀
22:36:35FromDiscord<Elegantbeef> > manual iterators
22:37:42FromDiscord<ajusa> Like iterators where you can advance and peek easily, not constrained to for loops
22:37:50FromDiscord<Elegantbeef> Ah
22:38:05FromDiscord<Elegantbeef> Streams are basically just iterators though
22:39:53FromDiscord<Elegantbeef> Really i could even make a `a.peek(array): int` which returns amount of elements got
22:40:32FromDiscord<Elegantbeef> But i think we're getting into where it makes sense to do the low level op to reduce memory usage
22:41:26FromDiscord<Michal Maršálek> In reply to @Elegantbeef "<@431798919719288832>\: follow this for": What is T: static T supposed to mean?
22:41:52FromDiscord<Elegantbeef> I didnt write that
22:42:11FromDiscord<Elegantbeef> That's `proc fun[T](a: static[T])`
22:42:21FromDiscord<Elegantbeef> It's a inferred static
22:42:27FromDiscord<Elegantbeef> For procedures which always worked apparently
22:42:36FromDiscord<Elegantbeef> It just doesnt work inside the proc generic params
22:56:04*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:00:04FromDiscord<Michal Maršálek> I was referring to `[T, Y: static T]` I would expect a semicolon there instead of the comma.
23:00:07FromDiscord<Elegantbeef> Well thanks ajusa you got me to have much cheaper resettable iterators
23:00:31FromDiscord<Elegantbeef> Didnt think about it earlier but i can just reset the state and it seems to work
23:01:01FromDiscord<Elegantbeef> That's invalid code
23:01:01FromDiscord<Elegantbeef> Where'd you see that?
23:02:33FromDiscord<Elegantbeef> That's like `[T: T]` it's illegal recursive code
23:04:37FromDiscord<Michal Maršálek> In reply to @Elegantbeef "Where'd you see that?": https://media.discordapp.net/attachments/371759389889003532/930235711070818344/Screenshot_20220111-000418.png
23:05:18FromDiscord<Elegantbeef> That's of course supposed to be `;`
23:05:42FromDiscord<Elegantbeef> Checked the entire PR for that in the comments but couldnt find it, forgot to check the PR comments 😀
23:06:20FromDiscord<Michal Maršálek> Sorry for not being clear about what I meant
23:06:23FromDiscord<Isofruit> Hmmm I wonder, can you turn space into a symbol for a proc?
23:06:29FromDiscord<Elegantbeef> It's fine
23:06:33FromDiscord<Elegantbeef> You can
23:06:53FromDiscord<Isofruit> That seems like a damn fine way to break your everything
23:06:54FromDiscord<Elegantbeef> Nvm
23:06:59FromDiscord<Elegantbeef> Nah
23:07:03FromDiscord<Isofruit> Awwww
23:07:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LOS
23:07:34FromDiscord<Elegantbeef> you can accquote most characters so you can even have multiline variable names
23:08:03FromDiscord<Elegantbeef> Compiles
23:08:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LOT
23:08:17*noeontheend quit (Ping timeout: 240 seconds)
23:09:54*noeontheend joined #nim
23:10:49FromDiscord<ajusa> > cheaper resettable iterators↵cool, I saw you updated the codebase as well 😄
23:25:11adigitoleoIs there a quick way to copy/unpack from a sequence to array?
23:31:00FromDiscord<IsaacPaul> In reply to @Elegantbeef "Well sumtypes is superceded": > lerorize's union↵what's this? google shows nothing.
23:34:53FromDiscord<Elegantbeef> This kids is why you use a similar name on chats as your github name
23:34:55FromDiscord<Elegantbeef> Fucking leroize
23:34:57FromDiscord<Elegantbeef> https://github.com/alaviss/union
23:38:39FromDiscord<Elegantbeef> It's basically what my `sumtypes` was aiming to be
23:38:44FromDiscord<Elegantbeef> Actually good and nice to use
23:46:56FromDiscord<IsaacPaul> Looks neat. I was just curious because I'm a fan of using sumtypes as a result.
23:47:10FromDiscord<IsaacPaul> (edit) "result." => "result for some procedures."
23:48:00FromDiscord<Elegantbeef> Yea Union is proper sumtypes
23:48:00FromDiscord<Elegantbeef> not my offbrand version 😀
23:57:11FromDiscord<ajusa> In reply to @Elegantbeef "Fucking leroize": This trips me up so much, legit thought leorize was a different person than alaviss
23:57:24FromDiscord<Elegantbeef> They're one in the same
23:57:40FromDiscord<ajusa> I was like huh, this guy works a lot on the stuff leorize talks about. How about that?
23:58:19FromDiscord<leorize> lol
23:58:31FromDiscord<Elegantbeef> This guy right here
23:58:55FromDiscord<Elegantbeef> Jus saying
23:58:57FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/930249385449771058/image.png