00:00:14 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:39 | * | tk joined #nim |
00:00:56 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LIn |
00:01:24 | FromDiscord | <Patitotective> Not sure if there's a better way to use `result` |
00:01:30 | FromDiscord | <Elegantbeef> I'd not use return and not do the if expression on a single line |
00:02:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LIo |
00:02:18 | * | crem joined #nim |
00:02:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/JSG |
00:02:39 | FromDiscord | <Elegantbeef> Using return in macros is annoying since you cannot easily debug |
00:03:00 | FromDiscord | <Patitotective> sweet |
00:03:06 | FromDiscord | <Patitotective> thanks, really 🙃 |
00:10:26 | FromDiscord | <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:32 | FromDiscord | <Rosen> You would use nim bindings for the discord api, like `dimscord`, and compile it with the nim compiler |
00:12:03 | FromDiscord | <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:41 | FromDiscord | <Rosen> (edit) "`dimscord`," => "the `dimscord` library," |
00:14:08 | * | victor_boludo joined #nim |
00:14:17 | FromDiscord | <DMI-1407> but will i have to compile it to js or c ? |
00:14:40 | FromDiscord | <DMI-1407> because discords native api is written in js |
00:14:46 | FromDiscord | <DMI-1407> thats what confuses me |
00:15:40 | FromDiscord | <Rosen> Oh I got you |
00:15:53 | FromDiscord | <Rosen> Well if you use dimscord that should be fine for either, up to you |
00:16:08 | FromDiscord | <Rosen> At least as far as I know |
00:16:24 | FromDiscord | <Rosen> When I used it for a bot I compiled it with the C backend |
00:16:33 | FromDiscord | <Rosen> And just ran it on a VPS |
00:17:38 | FromDiscord | <DMI-1407> hm ok, how is the js support for some os handlers ? is it already supported ? |
00:17:53 | FromDiscord | <DMI-1407> (i just read the book about nim, but its a little bit outdated) |
00:18:25 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3LIv |
00:18:36 | FromDiscord | <Rika> Catch is a keyword |
00:18:38 | FromDiscord | <that_dude> Is it |
00:18:41 | FromDiscord | <Rika> I believe so |
00:19:04 | FromDiscord | <that_dude> I couldn't find any documentation on it/nimsuggest doesn't imply that |
00:19:26 | FromDiscord | <that_dude> or whatever nim extension I'm using in vs code |
00:19:38 | FromDiscord | <Rika> Huh it doesn’t say it is so it isn’t |
00:20:43 | FromDiscord | <that_dude> So uh, what is it then, a hidden keyword and intentional, or a bug |
00:20:54 | victor_boludo | Could someone tell me why this code hangs forever on `socket.recv`? |
00:20:55 | victor_boludo | ``` |
00:20:55 | victor_boludo | import net |
00:20:56 | victor_boludo | let socket: Socket = newSocket() |
00:20:56 | victor_boludo | newContext().wrapSocket(socket = socket) |
00:20:57 | victor_boludo | socket.connect( |
00:20:57 | victor_boludo | address = "www.americanas.com.br", |
00:20:58 | victor_boludo | port = Port(443), |
00:20:58 | victor_boludo | timeout = 3000 |
00:20:59 | victor_boludo | ) |
00:20:59 | victor_boludo | socket.send(data = "GET / HTTP/1.1\r\nHost: www.americanas.com.br\r\n\r\n") |
00:21:00 | victor_boludo | discard socket.recv(size = 300, timeout = 3000) |
00:21:00 | victor_boludo | ``` |
00:21:34 | FromDiscord | <Rika> In reply to @that_dude "So uh, what is": Dunno |
00:22:25 | FromDiscord | <that_dude> Well what should I do about this, make a forum post? |
00:25:01 | FromDiscord | <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:15 | FromDiscord | <DMI-1407> and they may block your thread |
00:26:12 | FromDiscord | <DMI-1407> (edit) "garantee" => "guarantee" |
00:26:58 | FromDiscord | <congusbongus> wouldn't it be easier using a http library instead of sockets? |
00:32:48 | victor_boludo | well, it hangs with std/httpclient too |
00:32:58 | victor_boludo | even setting the timeout to a lower value didn't help |
00:33:07 | victor_boludo | it 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:58 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LIx |
00:46:19 | FromDiscord | <Rika> First is invalid, second prolly is preferred, if you like third then okay |
00:49:06 | FromDiscord | <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:18 | FromDiscord | <Rosen> Try port 80 instead, unless this is intended |
00:49:37 | FromDiscord | <sealmove> Does someone know a human readable serialization format that supports sets? |
00:50:49 | FromDiscord | <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:36 | FromDiscord | <sealmove> hmm wdym? |
00:52:06 | FromDiscord | <Rika> I don’t exactly have an answer for you anyway actually |
00:52:38 | FromDiscord | <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:17 | FromDiscord | <sealmove> yeah I am using JSON currently |
00:53:25 | FromDiscord | <sealmove> but schema is ok |
00:53:29 | FromDiscord | <sealmove> maybe even better |
00:54:47 | FromDiscord | <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:25 | FromDiscord | <sealmove> I don't know what this is 😅 |
00:56:43 | FromDiscord | <Elegantbeef> You have a string `"{10, 20, 30}"` in your format |
00:56:52 | FromDiscord | <Elegantbeef> Then parsing you remove `{}` and iterate over it |
00:58:46 | FromDiscord | <evoalg> In reply to @retkid "see, our brains work": I've been using `for a in 0 .. sq.high` |
00:59:53 | FromDiscord | <evoalg> better than `for a in 0 .. len(seq) - 1` ... but yea `for a in 0 ..< len(sq)` is ok too |
01:00:39 | FromDiscord | <Elegantbeef> `for a in 0.. seq.high` is indeed the best |
01:03:00 | FromDiscord | <Rosen> victor_boludo in case it didn't ping you when I replied, see above |
01:04:40 | FromDiscord | <sealmove> In reply to @Elegantbeef "Then parsing you remove": so _parse hook_ means parsing with more than 1 iteration? |
01:05:04 | FromDiscord | <Elegantbeef> Parsehook is a user defined hook for a specific type in `jsony` and the stdlib `std/jsonutils` |
01:05:18 | FromDiscord | <sealmove> oh |
01:05:27 | FromDiscord | <Elegantbeef> Basically you give the data to procedure to then apply to data |
01:05:46 | FromDiscord | <sealmove> i see thanks |
01:09:20 | FromDiscord | <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:41 | FromDiscord | <Elegantbeef> It depends on your definition |
01:09:47 | FromDiscord | <Elegantbeef> Some say "source to source" is transpilation |
01:10:16 | FromDiscord | <Elegantbeef> Others say "higher level to lower level of abstraction is compilation, so Nim -\> C is compilation" |
01:11:05 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LIF |
01:11:12 | FromDiscord | <evoalg> Ahhh so some people belittle nim saying it's just a transpiler, but it's actually a compiler |
01:11:28 | FromDiscord | <Elegantbeef> I mean i'm indifferent i feel like that difference is negligable |
01:11:44 | FromDiscord | <Elegantbeef> Rust for instance uses LLVM as an IR, Nim uses C as an IR |
01:11:53 | FromDiscord | <Elegantbeef> The IR hardly matters |
01:12:03 | FromDiscord | <evoalg> IR? |
01:12:25 | FromDiscord | <Elegantbeef> Intermediate Representation |
01:12:33 | FromDiscord | <Elegantbeef> Basically what does it compile down to before ASM |
01:12:39 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LIG |
01:12:42 | FromDiscord | <Elegantbeef> It's a float32 |
01:12:46 | FromDiscord | <retkid> AH |
01:13:14 | FromDiscord | <Elegantbeef> `'f32` is just a literal annotation |
01:13:17 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#lexical-analysis-numeric-literals |
01:13:39 | FromDiscord | <retkid> but why does it return↵``0.009999999776482582`` |
01:14:07 | FromDiscord | <Elegantbeef> Floating point 32 |
01:14:14 | FromDiscord | <Elegantbeef> Floats have limited range of values |
01:14:22 | FromDiscord | <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:49 | FromDiscord | <Elegantbeef> Thanks ynfle was about to write to that |
01:14:51 | FromDiscord | <retkid> In reply to @Elegantbeef "Floats have limited range": i think im missing something lowlevel |
01:14:59 | FromDiscord | <Elegantbeef> Too many things to address at one, plus trying to fix the compiler |
01:15:03 | FromDiscord | <retkid> (edit) "lowlevel" => "low level" |
01:15:13 | FromDiscord | <Elegantbeef> a float32 is only 32bits but represents -inf .. inf |
01:15:17 | FromDiscord | <Patitotective> In reply to @ynfle "It depends on the": Thanks 🙃 |
01:15:32 | FromDiscord | <Elegantbeef> Becuase of that range and limited size you cannot get exact values |
01:15:40 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> It's not being optimized? |
01:16:04 | FromDiscord | <retkid> but why that |
01:16:13 | FromDiscord | <Elegantbeef> Cause that's how floats work |
01:16:17 | FromDiscord | <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:24 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LIH |
01:16:25 | FromDiscord | <Elegantbeef> `0.01` cannot be represented accurately in 32bit float |
01:16:46 | FromDiscord | <Rika> In binary it cannot |
01:16:54 | FromDiscord | <Rika> In decimal sure |
01:16:56 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3LIH" => "https://play.nim-lang.org/#ix=3LII" |
01:17:00 | FromDiscord | <Rika> But floats are binary |
01:17:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LIJ |
01:17:27 | FromDiscord | <Elegantbeef> How the hell am i supposed to know why they pass 0.01, read the code |
01:17:28 | FromDiscord | <retkid> i think its just the uncommented magic number |
01:17:59 | FromDiscord | <retkid> In reply to @Elegantbeef "How the hell am": THE CODE ISN'T HELPFUL |
01:18:06 | FromDiscord | <Rika> I don’t know what you want help for anymore |
01:18:19 | FromDiscord | <Elegantbeef> Go to the source of `optimizerAdam` |
01:18:29 | FromDiscord | <Elegantbeef> Nim ships source code libraries |
01:19:53 | FromDiscord | <evoalg> isn't it to do with https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems ? |
01:20:04 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LIK |
01:20:17 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3LIK" => "https://play.nim-lang.org/#ix=3LIL" |
01:20:21 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3LIL" => "https://play.nim-lang.org/#ix=3LIM" |
01:20:22 | FromDiscord | <Elegantbeef> You can post the code here all day, read what it's doing |
01:20:24 | FromDiscord | <Elegantbeef> It is indeed vo |
01:20:24 | FromDiscord | <ynfle> It is the learning rate |
01:21:18 | FromDiscord | <Elegantbeef> There was a good website that explained floating point inaccuracies, but dont recall it |
01:21:42 | FromDiscord | <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:10 | FromDiscord | <Rika> In reply to @Elegantbeef "There was a good": Me too |
01:22:40 | FromDiscord | <Rika> https://0.30000000000000004.com/ |
01:22:47 | FromDiscord | <Rika> https://floating-point-gui.de/ |
01:22:48 | FromDiscord | <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:49 | FromDiscord | <Elegantbeef> There you go |
01:22:57 | FromDiscord | <Elegantbeef> The first one is it |
01:23:05 | FromDiscord | <Rika> T can be a static value |
01:23:06 | FromDiscord | <Rika> ? |
01:23:30 | FromDiscord | <Elegantbeef> T is the type |
01:23:44 | FromDiscord | <Rika> I mean yes I know but I ask ret |
01:24:13 | FromDiscord | <retkid> alright i give up on understanding whatever this is |
01:24:37 | FromDiscord | <Elegantbeef> Congrats |
01:31:30 | FromDiscord | <retkid> ok i think i understand but this function has no comments that pertain to the code or why it exists |
01:31:51 | FromDiscord | <retkid> so i still have no clue why they put that in |
01:32:55 | FromDiscord | <retkid> if you use the default value nothing changes |
01:33:24 | FromDiscord | <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:00 | FromDiscord | <retkid> those are worse than no comments |
01:34:09 | FromDiscord | <retkid> because those comments make a lot of sense to the dev |
01:34:17 | FromDiscord | <retkid> it probably makes them immediately remember what it does |
01:34:28 | FromDiscord | <retkid> but you don't have those memories so its kinda taunting you |
01:35:13 | FromDiscord | <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:39 | FromDiscord | <retkid> why they put 0.00'f32 in |
01:35:53 | FromDiscord | <retkid> out of all the numbers, why that |
01:35:59 | FromDiscord | <congusbongus> git blame; email author |
01:36:15 | FromDiscord | <ynfle> You mean 0.001? or the 'f32? |
01:36:17 | FromDiscord | <retkid> I could dm him here, but i dont wanna waste his time |
01:36:36 | FromDiscord | <retkid> why both of those two things together |
01:37:30 | FromDiscord | <retkid> i assume its because the model was setup to use f32 |
01:37:35 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> It's an unconstrained generic proc, why would you make that assumption |
01:38:03 | FromDiscord | <retkid> the models are not |
01:38:12 | FromDiscord | <retkid> the tenors are assigned to types |
01:38:44 | FromDiscord | <retkid> maybe its stupid to assume that interacting the model would require the type explicitly specified ¯\_(ツ)_/¯ |
01:44:09 | * | noeontheend joined #nim |
01:45:53 | FromDiscord | <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:36 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> Performance can be got from using smaller floats for a multitude of reasons |
02:15:18 | FromDiscord | <evoalg> ahhhh ok! |
02:16:34 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> I think on some CPUs it might be slower but cant say for certain |
02:18:56 | FromDiscord | <Elegantbeef> talking about modern CPUs of course |
02:21:25 | FromDiscord | <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:37 | FromDiscord | <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:49 | FromDiscord | <Rika> thats an if youre working on indiv floats though |
02:42:27 | * | Gustavo6046 joined #nim |
02:45:02 | FromDiscord | <evoalg> ahh ok |
02:49:36 | NimEventer | New Nimble package! nim-snappy - Nim implementation of Snappy compression algorithm, see https://github.com/status-im/nim-snappy |
02:51:03 | FromDiscord | <Rika> dont we already have this as supersnappy |
02:53:19 | FromDiscord | <Elegantbeef> I thought so |
02:54:00 | FromDiscord | <Rika> probably a matter of status needing to do whatever they need exactly then |
02:54:27 | FromDiscord | <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:35 | FromDiscord | <Rika> what is the status of destructors again? |
04:49:43 | FromDiscord | <Rika> works with refc? i dont remember |
04:49:56 | FromDiscord | <Elegantbeef> I think they work just not predictably |
04:50:10 | FromDiscord | <Elegantbeef> In other words you have to wait for a GC collect |
04:50:12 | FromDiscord | <Elegantbeef> Or force one |
04:50:44 | FromDiscord | <Rika> yikes |
04:58:04 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3LJs |
04:58:31 | FromDiscord | <Elegantbeef> Yes `varargs` is converted it a contiguous array |
04:58:46 | FromDiscord | <Elegantbeef> into a contiguous\ |
04:58:55 | FromDiscord | <that_dude> What does that mean? |
04:59:12 | FromDiscord | <Elegantbeef> I meant homogenous |
04:59:22 | FromDiscord | <Elegantbeef> So `[1, "abc"]` |
04:59:53 | FromDiscord | <Elegantbeef> Which is invalid |
05:00:06 | FromDiscord | <that_dude> That's what I thought, I just wanted to be sure I wasn't wasting my time lol |
05:03:03 | FromDiscord | <Rika> ~~better to waste someone elses time than your own~~ it is a joke |
05:03:28 | FromDiscord | <that_dude> >:) |
05:05:40 | FromDiscord | <Elegantbeef> Here's a solution around it https://play.nim-lang.org/#ix=3LJw |
05:14:26 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3LJy |
05:14:30 | FromDiscord | <sharpcdf> trying to test out the js backend :/ |
05:15:07 | FromDiscord | <Elegantbeef> What's the mismatch |
05:15:20 | FromDiscord | <Elegantbeef> Oh i see the issue |
05:15:23 | FromDiscord | <Elegantbeef> `document.write` |
05:15:26 | FromDiscord | <Elegantbeef> `Document` is a type |
05:15:43 | FromDiscord | <sharpcdf> oh bruh |
05:15:46 | FromDiscord | <sharpcdf> mb |
05:15:48 | FromDiscord | <sharpcdf> thanks lmao |
05:16:11 | FromDiscord | <sharpcdf> shit youre right |
05:17:09 | FromDiscord | <sharpcdf> ok wait how do i open js files |
05:17:23 | FromDiscord | <sharpcdf> run them |
05:17:43 | FromDiscord | <Rika> compile in nim, you should see an output file? |
05:19:30 | FromDiscord | <Elegantbeef> `nim js yourFile.nim` is how |
05:19:38 | * | lumo_e quit (Quit: Quit) |
05:19:45 | FromDiscord | <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:33 | FromDiscord | <that_dude> In reply to @Elegantbeef "Here's a solution around": That's actually interesting, I'll look into that later |
05:31:51 | FromDiscord | <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:02 | FromDiscord | <haoyu> I found it |
05:36:29 | FromDiscord | <haoyu> https://media.discordapp.net/attachments/371759389889003532/929971939588587602/unknown.png |
05:49:12 | arkanoid | I'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:30 | arkanoid | this 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:41 | FromDiscord | <Elegantbeef> You probably should use clang as the compiler if you're not |
06:06:11 | FromDiscord | <leorize> arkanoid\: `--passL:-Wl,-rpath,path_goes_here` is what you need |
06:19:42 | FromDiscord | <sharpcdf> how would i redirect to another page with the js backend? |
06:20:00 | FromDiscord | <sharpcdf> im trying `window.location` but i dont know how to convert a string to a location object |
06:22:20 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> There is also `replace` which might do what you want? |
06:23:49 | FromDiscord | <Elegantbeef> yea replace seems to be "right" |
06:24:14 | FromDiscord | <Elegantbeef> You could import `assign` or similar |
06:25:49 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "There is also `replace`": ill look into it |
06:25:58 | FromDiscord | <sharpcdf> i also found window.open() which should be fine for now |
06:26:00 | FromDiscord | <sharpcdf> thanks |
06:26:10 | FromDiscord | <Elegantbeef> `proc assign(location: Location, dir: cstring) {.importjs.}` if you want assign |
06:26:20 | FromDiscord | <Elegantbeef> JS super easy to interop with ime |
06:31:55 | FromDiscord | <sharpcdf> the problem is that theres no location variable |
06:32:01 | FromDiscord | <sharpcdf> just the type |
06:32:11 | FromDiscord | <sharpcdf> and i think it has to be preset |
06:34:16 | FromDiscord | <Elegantbeef> `document.location` |
06:34:16 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L208 for reference to what `document` has |
06:34:32 | FromDiscord | <Elegantbeef> What? |
06:34:51 | FromDiscord | <sharpcdf> oh |
06:34:53 | FromDiscord | <Elegantbeef> Ah sorry it's `window.location` i'm tired |
06:34:55 | FromDiscord | <sharpcdf> i didnt see that lmao |
06:35:06 | FromDiscord | <sharpcdf> either way thanks lmao |
06:35:08 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L133 |
06:35:10 | FromDiscord | <Elegantbeef> Sadly this stuff isnt visible |
06:38:44 | FromDiscord | <sharpcdf> thanks |
06:38:52 | FromDiscord | <sharpcdf> one last question before i pass out |
06:40:12 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3LJJ |
06:40:16 | FromDiscord | <sharpcdf> specifically the `else` part |
06:40:26 | FromDiscord | <sharpcdf> it doesnt create the h1 |
06:41:01 | FromDiscord | <Elegantbeef> It creates it but doesnt add it |
06:41:05 | FromDiscord | <Elegantbeef> Or atleast it should |
06:41:36 | FromDiscord | <sharpcdf> so then what might the problem be |
06:41:46 | FromDiscord | <Elegantbeef> not doing `addElement` or w/e it is |
06:41:58 | FromDiscord | <Elegantbeef> I dont raw JS much |
06:43:29 | FromDiscord | <Elegantbeef> Correction i dont raw js ever |
06:45:10 | FromDiscord | <sharpcdf> lmao same |
06:47:46 | FromDiscord | <sharpcdf> found it |
06:47:56 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3LJL |
06:48:03 | FromDiscord | <sharpcdf> thanks |
06:58:12 | FromDiscord | <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:38 | FromDiscord | <evoalg> In reply to @Elegantbeef "Here's a solution around": it doesn't run for me on playground? |
06:58:59 | FromDiscord | <Elegantbeef> Read the error |
06:59:19 | FromDiscord | <Elegantbeef> The design parameters was only accept `int/string` |
06:59:20 | FromDiscord | <evoalg> ohhh! I understand! |
06:59:22 | FromDiscord | <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:56 | FromDiscord | <evoalg> (not the code, but I understand that it should error :D) |
07:01:37 | FromDiscord | <Elegantbeef> That seems to just see if a file exists and if it's a socket |
07:01:43 | FromDiscord | <Elegantbeef> I could be wrong |
07:01:56 | FromDiscord | <Elegantbeef> Just looked at the `stat(2)` manpage |
07:02:07 | FromDiscord | <Elegantbeef> Yea evo it was purposely written to show "hey this does indeed error" |
07:04:47 | FromDiscord | <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:15 | FromDiscord | <Elegantbeef> If you have a keyboard and the willpower to write it, pretty much |
07:06:20 | FromDiscord | <Elegantbeef> Though there are some things restrained |
07:11:14 | * | Gustavo6046 joined #nim |
07:17:42 | FromDiscord | <evoalg> I think I just realized that a generic proc is just shorthand for overloading several proc's |
07:18:04 | FromDiscord | <Elegantbeef> Indeed |
07:18:21 | FromDiscord | <evoalg> I dunno what that took me so long! |
07:18:26 | FromDiscord | <Elegantbeef> It's really just a ergonomic template that's constrained to a list of types |
07:20:35 | FromDiscord | <Elegantbeef> C++'s generics are actually just templates |
07:24:09 | FromDiscord | <evoalg> is it possible to limit args passed to templates in nim ? ... eg to be only int or float? |
07:24:31 | FromDiscord | <Elegantbeef> Yea they work just like procs |
07:24:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/xrD |
07:25:09 | FromDiscord | <Elegantbeef> Templates parameters are dispatched upon just like procs |
07:28:00 | FromDiscord | <evoalg> so I can do `template doThing(a: int or float) = discard` ? |
07:28:14 | FromDiscord | <Elegantbeef> Yess |
07:28:45 | FromDiscord | <evoalg> does the generic `[T]` work with templates also? |
07:29:03 | FromDiscord | <Elegantbeef> Yep |
07:29:04 | FromDiscord | <Rika> Kinda? |
07:29:12 | FromDiscord | <Rika> I’ve heard some issues though |
07:29:31 | FromDiscord | <Elegantbeef> There are some caveats depending what you're doing but it does indeed work |
07:29:59 | * | PMunch joined #nim |
07:30:02 | FromDiscord | <evoalg> Thank you both |
07:30:02 | FromDiscord | <Elegantbeef> I cannot recall them at the moment |
07:44:17 | adigitoleo | I 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:38 | adigitoleo | Or rather, can they be used together? |
07:45:22 | FromDiscord | <Rika> Don’t use them together |
07:45:36 | FromDiscord | <Rika> They’re not made for combined use I believe |
07:46:41 | adigitoleo | OK, 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:01 | FromDiscord | <Rika> Rare. Use unit test |
07:48:33 | FromDiscord | <Rika> Testament is very difficult to learn due to the anemic documentation right now |
07:49:18 | adigitoleo | Yep, unittest seems more intuitive to me so I'll stick to that for now then. |
07:49:23 | adigitoleo | Cheers. |
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:24 | FromDiscord | <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:25 | FromDiscord | <Michal Maršálek> In reply to @ynfle "For some reason `[T;": Lol wth |
09:36:43 | FromDiscord | <ynfle> Perhaps a little cleaner https://play.nim-lang.org/#ix=3LKn |
09:37:21 | FromDiscord | <ynfle> My guess is because this just creates an instance of the type so, T, and static T are concrete |
09:37:39 | FromDiscord | <ynfle> Not sure why it didn't work/isn't needed before |
09:38:23 | FromDiscord | <ynfle> In reply to @adigitoleo "I notice that nim": https://github.com/disruptek has a couple of testing libraries |
09:55:30 | adigitoleo | ynfle: Thanks, some interesting stuff there. |
09:58:11 | FromDiscord | <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:16 | szahid | Hello. |
11:08:40 | szahid | is a way to declare array without size? |
11:09:26 | nrds | <Prestige99> You may want a sequence |
11:09:42 | nrds | <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:50 | szahid | nrds: and is a way to add more items to openarray? |
12:04:16 | nrds | <Prestige99> I don't believe so |
12:20:24 | * | fvs joined #nim |
12:21:12 | fvs | tip - to check the asm generated by nim (and others) you can use: https://godbolt.org/ |
12:32:21 | NimEventer | New Nimble package! zxcvbnim - A zxcvbn clone for Nim. Written in Nim, see https://github.com/jiiihpeeh/zxcvbnim |
12:32:21 | NimEventer | New Nimble package! tome - A natural language library., see https://github.com/dizzyliam/tome |
12:32:21 | NimEventer | New Nimble package! utf8tests - UTF-8 test cases and supporting code., see https://github.com/flenniken/utf8tests/ |
12:38:48 | FromDiscord | <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:24 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3LLk |
13:08:30 | FromDiscord | <Rika> from moduleX import a,b,c |
13:08:32 | FromDiscord | <hmmm> oh |
13:08:33 | FromDiscord | <Rika> does that not work |
13:08:37 | FromDiscord | <hmmm> ty 🥳 |
13:10:44 | FromDiscord | <xx_ns> hi |
13:10:49 | FromDiscord | <xx_ns> how do i stop this from happening https://media.discordapp.net/attachments/371759389889003532/930086279209697330/unknown.png |
13:11:29 | FromDiscord | <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:24 | FromDiscord | <el__maco> add 0.5 before truncating to uint8? |
13:13:33 | FromDiscord | <xx_ns> that's.. really obvious |
13:13:34 | FromDiscord | <xx_ns> thanks |
13:13:50 | FromDiscord | <Rika> or round |
13:14:01 | FromDiscord | <TryAngle> or div? |
13:14:04 | FromDiscord | <xx_ns> rounding is too expensive for what i'm doing |
13:14:23 | FromDiscord | <el__maco> I mean the first one would not work with div at all |
13:15:22 | FromDiscord | <xx_ns> yeah, `(255 div 7919)` would be `(0)` |
13:16:22 | FromDiscord | <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:17 | FromDiscord | <xx_ns> negative numbers are not an issue for me, i'm only working with positive values anyways |
13:19:03 | FromDiscord | <hmmm> recursive module deps are a pain 😡 |
13:19:57 | FromDiscord | <Rika> just dont do it man wtf |
13:23:31 | FromDiscord | <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:44 | FromDiscord | <Rika> just restructure in ur head bro its what i do smhhhhh |
13:24:59 | FromDiscord | <hmmm> lol |
13:27:07 | FromDiscord | <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:31 | FromDiscord | <blans> In reply to @nrds "<Wabby/freenode> Is there a": is this true? |
14:30:08 | * | Vladar quit (Quit: Leaving) |
14:31:46 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/d5L |
14:33:18 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LLH |
14:37:10 | FromDiscord | <Patitotective> huh? I'm confused on how to create an emtpy sequence |
14:39:40 | FromDiscord | <Patitotective> Lol it was `newSeq[int]()` |
14:44:43 | * | arkurious joined #nim |
14:49:34 | FromDiscord | <Patitotective> nvm |
14:49:56 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LLL |
15:26:05 | FromDiscord | <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:34 | FromDiscord | <Patitotective> order |
15:55:05 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3LMb |
15:55:21 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3LMc |
15:56:59 | FromDiscord | <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:57 | FromDiscord | <Michal Maršálek> Hi, why is `nnkHiddenStdConv` inserted in the macro call? https://play.nim-lang.org/#ix=3LMr |
16:28:45 | FromDiscord | <gerwy> there is no --secret in 1.6.0 nim? |
16:28:46 | FromDiscord | <gerwy> D: |
16:33:30 | FromDiscord | <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:57 | FromDiscord | <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:15 | FromDiscord | <KatrinaKitten> sent a code paste, see https://play.nim-lang.org/#ix=3LMB |
16:43:57 | FromDiscord | <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:40 | FromDiscord | <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:51 | FromDiscord | <KatrinaKitten> (edit) "and" => "but" |
16:57:12 | * | noeontheend joined #nim |
16:59:07 | arkanoid | what does it mean when a proc has stropped name and ends with `=` like in "proc `qobjectVal=`*(variant: QVariant, value: QObject)" ? |
17:02:17 | nrds | <Prestige99> it allows you to do variant.qobjectVal = someValue |
17:02:49 | arkanoid | ok, thanks |
17:09:58 | * | pro joined #nim |
17:12:06 | * | justsomeguy left #nim (WeeChat 3.3) |
17:29:32 | FromDiscord | <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:48 | FromDiscord | <eyecon> Or should I just wrap all groups in `asSeq`s? |
17:31:51 | FromDiscord | <whisperdev> What is the best way to do a lot of http get requests? |
17:33:00 | FromDiscord | <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:35 | FromDiscord | <eyecon> In reply to @KatrinaKitten "It's not so much": Thanks, that was really helpful |
17:34:11 | FromDiscord | <KatrinaKitten> Happy to help 💜 |
17:37:25 | arkanoid | if "MyType = distinct pointer" is "*p" and "MyArray = UncheckedArray[MyType]" is "**p", is "ptr MyArray" "***p" ? |
17:48:25 | Amun-Ra | mhm |
17:51:31 | FromDiscord | <Clonkk> Usually, you never use UncheckedArray as is, it's always `ptr UncheckedArray`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
17:53:52 | arkanoid | that'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:05 | arkanoid | is this correct to cast a seq to pass it to C? "cast[ptr UncheckedArray[MyType]](a[0].unsafeAddr)" ? |
17:58:16 | arkanoid | where a is seq[MyType] |
18:00:55 | FromDiscord | <Clonkk> A Nim object containing a pointer to MyType↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
18:01:12 | FromDiscord | <Clonkk> (in short, it has other thing in it) |
18:02:17 | arkanoid | I'm not sure I'm following you |
18:02:58 | arkanoid | are you sayind that UncheckedArray is just a stack wrapper object with a "prt MyType" field in it? |
18:03:46 | arkanoid | UncheckedArray[MyType] = distinct ptr MyType ? |
18:08:45 | Amun-Ra | UncheckedArray[foo] is just like foo[] in C |
18:11:02 | * | jjido joined #nim |
18:12:11 | * | jjido quit (Client Quit) |
18:15:45 | FromDiscord | <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:54 | FromDiscord | <eyecon> It would be very nice, no doubt |
18:37:04 | FromDiscord | <eyecon> I hadn't heard of the site but looks nice |
18:37:29 | FromDiscord | <eyecon> Although some lesser used language implementations look a bit... rough |
18:42:13 | * | noeontheend quit (Ping timeout: 240 seconds) |
18:52:41 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3LNr |
18:55:04 | FromDiscord | <eyecon> Forgot `import honeycomb, sugar` but hopefully that was obvious |
18:57:02 | FromDiscord | <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:09 | FromDiscord | <eyecon> Ah, that does work, thanks again |
19:00:01 | FromDiscord | <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:58 | FromDiscord | <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:58 | FromDiscord | <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:26 | NimEventer | New 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:06 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> `unpack(a)` depends on runtime values so cannot be used like that afaik |
21:20:24 | arkanoid | I'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:44 | FromDiscord | <Elegantbeef> Setup your vscode extension |
21:21:02 | FromDiscord | <Elegantbeef> Nimsuggest doesnt do well with project recognition |
21:21:23 | FromDiscord | <Michal Maršálek> In reply to @ynfle "For some reason `[T;": @ElegantBeef did you see this? |
21:21:53 | FromDiscord | <Elegantbeef> No but i'm still working on a fix |
21:21:57 | FromDiscord | <Elegantbeef> I had it working but it broke something else |
21:23:09 | FromDiscord | <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:46 | FromDiscord | <Elegantbeef> Well it already understands it, it just doesnt propogate it |
21:24:25 | FromDiscord | <Elegantbeef> Meaning it hits the `static T` and doesnt evaluate it properly |
21:25:38 | FromDiscord | <Elegantbeef> But yea arkanoid if using saem's vscode extension set `"nim.project" : ["yourMain.nim"]` if you havent already |
21:25:49 | FromDiscord | <Elegantbeef> It should make it a much nicer experience |
21:26:39 | * | krux02 joined #nim |
21:28:04 | FromDiscord | <Michal Maršálek> In reply to @Michal58 "Hi, why is `nnkHiddenStdConv`": Would you be so kind and look also at this? 🙂 |
21:28:11 | arkanoid | Elegantbeef, I'm already doing that, false positive and negatives are still scattered around like polka-dot |
21:28:44 | arkanoid | moreover it doesn't consider nim files in .cache/nim/myproject_d (like futhark wants) |
21:28:48 | FromDiscord | <Elegantbeef> hidden conversions are what the compiler does for converters or when it should convert to a tyep |
21:28:49 | FromDiscord | <Elegantbeef> Odd |
21:29:13 | FromDiscord | <Elegantbeef> Oh that might be a nimsuggest bug |
21:29:27 | FromDiscord | <Elegantbeef> I've never used futhark so i dont know |
21:30:09 | FromDiscord | <Michal Maršálek> In reply to @Elegantbeef "hidden conversions are what": I see but why is the conversion happening? |
21:31:10 | FromDiscord | <Elegantbeef> int -\> Natural? |
21:32:04 | FromDiscord | <Michal Maršálek> nvm I'm dumb |
21:32:06 | FromDiscord | <Michal Maršálek> Thanks! |
21:39:52 | FromDiscord | <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:15 | FromDiscord | <Michal Maršálek> Why doesn't this work: https://play.nim-lang.org/#ix=3LOv |
21:48:50 | FromDiscord | <Michal Maršálek> This does work: https://play.nim-lang.org/#ix=3LOw |
21:48:57 | FromDiscord | <Michal Maršálek> Can `static` not be generic? |
21:54:03 | FromDiscord | <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:45 | FromDiscord | <Michal Maršálek> I actually need more something like this: https://play.nim-lang.org/#ix=3LOC |
21:58:16 | FromDiscord | <Elegantbeef> Closures only↵(@ajusa) |
21:58:23 | FromDiscord | <Elegantbeef> Inline iterators are basically templates |
21:59:04 | FromDiscord | <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:21 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> Cheers there is also `asResettableClosure` if you want to be able to reset it to default 🙂 |
22:01:49 | FromDiscord | <ajusa> is there is a peek option? |
22:02:01 | FromDiscord | <Elegantbeef> There is not |
22:02:25 | FromDiscord | <Elegantbeef> Iterators dont really support peak due to how they work |
22:02:30 | FromDiscord | <Elegantbeef> Atleast Nim's |
22:02:44 | FromDiscord | <ajusa> yeah, I might be too used to cpp's way of doing it |
22:02:50 | FromDiscord | <Elegantbeef> I could implement it though |
22:03:02 | FromDiscord | <kevin> Is there a simple way to prevent Winim pointer operator (`&`) from conflicting with Strformat's `&` formatting operator? |
22:03:16 | FromDiscord | <Elegantbeef> I think i could |
22:03:18 | FromDiscord | <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:25 | FromDiscord | <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:27 | FromDiscord | <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:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LOF |
22:05:26 | FromDiscord | <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:03 | FromDiscord | <ajusa> But yes if you can implement that it would make my life a LOT easier |
22:06:37 | FromDiscord | <Elegantbeef> Yea will do it in a minute |
22:06:47 | FromDiscord | <Elegantbeef> Eventually i'll get slicerator onto the nimble registry |
22:07:32 | arkanoid | Elegantbeef, 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:36 | FromDiscord | <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:04 | FromDiscord | <Elegantbeef> Why mine? |
22:08:10 | FromDiscord | <Elegantbeef> I never have anything cool |
22:10:46 | madprops | it's beefy stuff |
22:11:20 | FromDiscord | <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:49 | FromDiscord | <Elegantbeef> Well sumtypes is superceded by lerorize's union |
22:16:00 | FromDiscord | <ajusa> yeah, I use that instead now |
22:17:08 | FromDiscord | <Elegantbeef> `peek` has been added |
22:18:33 | FromDiscord | <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:33 | FromDiscord | <ajusa> I am eternally grateful |
22:19:04 | FromDiscord | <Elegantbeef> Only copying the progress variable instead of the entire data to reduce memory consumption to the bare minium |
22:19:42 | FromDiscord | <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:52 | FromDiscord | <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:01 | FromDiscord | <Elegantbeef> Guess it'd just be `result = ((NI) `x`.ClE_0)[1]` fetching that before and resetting it after |
22:21:11 | FromDiscord | <Elegantbeef> I think atleast i dont know |
22:21:18 | FromDiscord | <Elegantbeef> Hey it's what the package is meant for |
22:21:22 | FromDiscord | <Elegantbeef> Making iterators nicer |
22:26:01 | * | noeontheend joined #nim |
22:29:24 | FromDiscord | <Elegantbeef> What do you mean? |
22:30:53 | * | PMunch quit (Quit: leaving) |
22:33:04 | * | jjido joined #nim |
22:35:54 | FromDiscord | <ajusa> ? |
22:36:20 | FromDiscord | <Elegantbeef> @Michal Maršálek\: follow this for fun https://github.com/nim-lang/Nim/pull/19362 😀 |
22:36:35 | FromDiscord | <Elegantbeef> > manual iterators |
22:37:42 | FromDiscord | <ajusa> Like iterators where you can advance and peek easily, not constrained to for loops |
22:37:50 | FromDiscord | <Elegantbeef> Ah |
22:38:05 | FromDiscord | <Elegantbeef> Streams are basically just iterators though |
22:39:53 | FromDiscord | <Elegantbeef> Really i could even make a `a.peek(array): int` which returns amount of elements got |
22:40:32 | FromDiscord | <Elegantbeef> But i think we're getting into where it makes sense to do the low level op to reduce memory usage |
22:41:26 | FromDiscord | <Michal Maršálek> In reply to @Elegantbeef "<@431798919719288832>\: follow this for": What is T: static T supposed to mean? |
22:41:52 | FromDiscord | <Elegantbeef> I didnt write that |
22:42:11 | FromDiscord | <Elegantbeef> That's `proc fun[T](a: static[T])` |
22:42:21 | FromDiscord | <Elegantbeef> It's a inferred static |
22:42:27 | FromDiscord | <Elegantbeef> For procedures which always worked apparently |
22:42:36 | FromDiscord | <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:04 | FromDiscord | <Michal Maršálek> I was referring to `[T, Y: static T]` I would expect a semicolon there instead of the comma. |
23:00:07 | FromDiscord | <Elegantbeef> Well thanks ajusa you got me to have much cheaper resettable iterators |
23:00:31 | FromDiscord | <Elegantbeef> Didnt think about it earlier but i can just reset the state and it seems to work |
23:01:01 | FromDiscord | <Elegantbeef> That's invalid code |
23:01:01 | FromDiscord | <Elegantbeef> Where'd you see that? |
23:02:33 | FromDiscord | <Elegantbeef> That's like `[T: T]` it's illegal recursive code |
23:04:37 | FromDiscord | <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:18 | FromDiscord | <Elegantbeef> That's of course supposed to be `;` |
23:05:42 | FromDiscord | <Elegantbeef> Checked the entire PR for that in the comments but couldnt find it, forgot to check the PR comments 😀 |
23:06:20 | FromDiscord | <Michal Maršálek> Sorry for not being clear about what I meant |
23:06:23 | FromDiscord | <Isofruit> Hmmm I wonder, can you turn space into a symbol for a proc? |
23:06:29 | FromDiscord | <Elegantbeef> It's fine |
23:06:33 | FromDiscord | <Elegantbeef> You can |
23:06:53 | FromDiscord | <Isofruit> That seems like a damn fine way to break your everything |
23:06:54 | FromDiscord | <Elegantbeef> Nvm |
23:06:59 | FromDiscord | <Elegantbeef> Nah |
23:07:03 | FromDiscord | <Isofruit> Awwww |
23:07:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LOS |
23:07:34 | FromDiscord | <Elegantbeef> you can accquote most characters so you can even have multiline variable names |
23:08:03 | FromDiscord | <Elegantbeef> Compiles |
23:08:05 | FromDiscord | <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:49 | FromDiscord | <ajusa> > cheaper resettable iterators↵cool, I saw you updated the codebase as well 😄 |
23:25:11 | adigitoleo | Is there a quick way to copy/unpack from a sequence to array? |
23:31:00 | FromDiscord | <IsaacPaul> In reply to @Elegantbeef "Well sumtypes is superceded": > lerorize's union↵what's this? google shows nothing. |
23:34:53 | FromDiscord | <Elegantbeef> This kids is why you use a similar name on chats as your github name |
23:34:55 | FromDiscord | <Elegantbeef> Fucking leroize |
23:34:57 | FromDiscord | <Elegantbeef> https://github.com/alaviss/union |
23:38:39 | FromDiscord | <Elegantbeef> It's basically what my `sumtypes` was aiming to be |
23:38:44 | FromDiscord | <Elegantbeef> Actually good and nice to use |
23:46:56 | FromDiscord | <IsaacPaul> Looks neat. I was just curious because I'm a fan of using sumtypes as a result. |
23:47:10 | FromDiscord | <IsaacPaul> (edit) "result." => "result for some procedures." |
23:48:00 | FromDiscord | <Elegantbeef> Yea Union is proper sumtypes |
23:48:00 | FromDiscord | <Elegantbeef> not my offbrand version 😀 |
23:57:11 | FromDiscord | <ajusa> In reply to @Elegantbeef "Fucking leroize": This trips me up so much, legit thought leorize was a different person than alaviss |
23:57:24 | FromDiscord | <Elegantbeef> They're one in the same |
23:57:40 | FromDiscord | <ajusa> I was like huh, this guy works a lot on the stuff leorize talks about. How about that? |
23:58:19 | FromDiscord | <leorize> lol |
23:58:31 | FromDiscord | <Elegantbeef> This guy right here |
23:58:55 | FromDiscord | <Elegantbeef> Jus saying |
23:58:57 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/930249385449771058/image.png |