00:15:09 | FromDiscord | <KingDarBoja> Does OrderedTable.sort works for values different than primitives? |
00:15:26 | FromDiscord | <KingDarBoja> Something like OrderedTable[string, SomeType]` |
00:15:30 | FromDiscord | <KingDarBoja> (edit) "OrderedTable[string," => "`OrderedTable[string," |
00:16:11 | mipri | .sort takes a cmp |
00:17:15 | FromDiscord | <KingDarBoja> Yes but, does it work with complex table values? I just want to sort the OrderedTable by alphabetic order of keys |
00:17:18 | FromDiscord | <Rika> Provide it a cmp function that isn't the default in system |
00:17:29 | FromDiscord | <Rika> Why wouldn't it if you're making your own cmp function |
00:17:45 | FromDiscord | <KingDarBoja> Ah, so I must provide a custom one... 🤔 |
00:18:01 | mipri | if system.cmp doesn't do what you want, sure |
00:19:01 | mipri | the answer anyway is yes: it works for non-primitive types. |
00:19:05 | FromDiscord | <KingDarBoja> Ah, okay, sorted it out at the end 😄 |
00:19:21 | FromDiscord | <KingDarBoja> `result.sort(proc (x,y: (string, MyType)): int = result = cmp(x[0], y[0]))` |
00:42:59 | FromDiscord | <shadow.> use sugarr |
00:43:34 | FromDiscord | <shadow.> `result.sort((x, y) => (cmp(x[0], y[0]))` iirc |
00:43:52 | FromDiscord | <shadow.> (edit) "y[0]))`" => "y[0])))`" |
00:53:25 | FromDiscord | <Rika> Type is unspecified, might result in undesirable proc |
00:53:39 | FromDiscord | <Rika> Rather I don't know if that works at all |
00:57:48 | mipri | https://play.nim-lang.org/#ix=2Iev |
01:01:09 | * | aHaquer joined #nim |
01:01:58 | FromDiscord | <19> hi guys, a little help here? https://play.nim-lang.org/#ix=2Iez |
01:04:08 | FromDiscord | <19> is that a function pointer? |
01:07:52 | mipri | yeah, that's a function pointer |
01:09:21 | FromDiscord | <19> are you sure because in here he doesn't mention this function https://ericscrivner.me/2017/10/getting-circular-sdl-audio/ |
01:10:00 | mipri | yes, I'm sure |
01:10:26 | FromDiscord | <19> cool! |
01:10:35 | mipri | cdecl.org isn't as good of a site as I thought it was, since it can't handle the way that's written |
01:10:37 | FromDiscord | <WalrusNoj> hey is there any way to compile nim to browser JS that interacts with elements and stuff? |
01:10:41 | mipri | but https://cdecl.org/?q=int+%28*GetSample%29%28int*%29 it close, just changing some of the types to int |
01:11:28 | FromDiscord | <19> lol what an epic site! |
01:11:39 | mipri | https://nim-lang.org/docs/backends.html#backends-the-javascript-target - like so, just don't pass -d:nodejs |
01:11:51 | FromDiscord | <19> thanks mipri |
01:11:54 | mipri | and follow the link to JS mods |
01:12:29 | FromDiscord | <WalrusNoj> okk thanks! |
01:14:32 | * | Tanger joined #nim |
01:27:01 | FromDiscord | <bark> i realize -8 div 8 is 1 |
01:27:13 | FromDiscord | <bark> then i realized i had been using nim 1.0.0 all along 😭 |
01:30:47 | FromDiscord | <19> <mipri> https://play.nim-lang.org/#ix=2IeK does this look right to you? |
01:33:17 | mipri | you're using platform_audio_settings twice, but passing it where a _buffer and a _config are expected, respectively |
01:33:44 | mipri | other than that, sure. I haven't used the FFI to this extent though, so I'd test with a little self-contained library. |
01:40:23 | * | opal quit (Remote host closed the connection) |
01:40:44 | * | opal joined #nim |
01:40:56 | FromDiscord | <19> nice! |
01:41:32 | FromDiscord | <19> is there a way to omit the function pointer's param name? not very important but just curious |
01:41:48 | FromDiscord | <19> yes im testing in a self contained little space |
01:41:59 | FromDiscord | <19> learned that the hard way :p |
01:42:36 | mipri | no, I don't know if the name's omittable. Nim cares more about that because it allows named parameters at the call site. |
01:43:37 | FromDiscord | <19> cool! thanks so much |
01:59:52 | * | krux02 quit (Remote host closed the connection) |
02:38:44 | * | reversem3 quit (Ping timeout: 268 seconds) |
02:38:44 | * | leorize[m] quit (Ping timeout: 268 seconds) |
02:39:03 | * | BitPuffin quit (Ping timeout: 260 seconds) |
02:39:21 | * | nikki93[m] quit (Ping timeout: 268 seconds) |
02:39:21 | * | VijayMarupudi[m] quit (Ping timeout: 268 seconds) |
02:39:21 | * | L[m] quit (Ping timeout: 268 seconds) |
02:39:49 | * | L[m] joined #nim |
02:39:56 | * | nikki93[m] joined #nim |
02:40:15 | * | reversem3 joined #nim |
02:40:20 | * | BitPuffin joined #nim |
02:40:59 | * | VijayMarupudi[m] joined #nim |
02:42:17 | * | leorize[m] joined #nim |
02:52:28 | * | vicfred quit (Quit: Leaving) |
02:53:32 | * | lritter joined #nim |
02:53:34 | * | Fish-Face quit (Read error: Connection reset by peer) |
02:54:50 | * | Fish-Face joined #nim |
03:08:51 | * | aHaquer left #nim (#nim) |
03:09:12 | * | leorize joined #nim |
03:19:20 | leorize | dom96: does nimble support monorepo (repo with multiple packages)? |
03:22:56 | leorize | ah, found the ?subdir thingy |
03:29:53 | FromDiscord | <flywind> It is supported. See https://github.com/nim-lang/graveyard |
03:53:18 | * | regreg joined #nim |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:35 | * | supakeen joined #nim |
04:13:04 | * | lritter quit (Ping timeout: 272 seconds) |
04:13:17 | * | muffindrake joined #nim |
04:13:17 | * | lritter joined #nim |
04:32:19 | * | narimiran joined #nim |
04:49:03 | * | regreg quit (Ping timeout: 272 seconds) |
04:58:38 | * | rockcavera quit (Remote host closed the connection) |
04:59:20 | * | spiderstew_ joined #nim |
05:00:21 | * | spiderstew quit (Ping timeout: 258 seconds) |
05:16:36 | * | leorize[m] quit (Ping timeout: 268 seconds) |
05:16:48 | * | leorize[m] joined #nim |
05:37:44 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:47:17 | FromDiscord | <mratsim> I have found my new blog article for Nim "Multithreading flavors: choosing the right tool for the right job". |
06:51:16 | leorize | I'm eagarly waiting for the great mratsim to explain how to do multithreading in nim :D |
07:02:00 | * | habamax joined #nim |
07:09:58 | FromDiscord | <D3F0LT> Hi |
07:10:09 | FromDiscord | <ElegantBeef> Hello |
07:16:25 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Ig8 |
07:17:19 | Zevv | excellent |
07:17:55 | supakeen | goedemorgen |
07:19:55 | Zevv | goedemorgen |
07:20:38 | FromDiscord | <mratsim> It's mostly because I see a confusion over and over on what to people try to use Weave on. |
07:20:54 | Zevv | even ar4q, which kind of surprised me |
07:22:49 | FromDiscord | <mratsim> Ah, I should had to "scheduler": optimizing for latency: a budget system to ensure fairness and optimizing for throughput: using data hot in cache (last in first out) |
07:22:59 | FromDiscord | <ElegantBeef> And then there is me, someone that rarely touches multithreading/async due to the nature of what i make |
07:26:04 | FromDiscord | <kenran> what are you doing mainly? |
07:26:27 | FromDiscord | <ElegantBeef> Typically hanging around game dev |
07:36:52 | FromDiscord | <mratsim> ah yes, it's not evident but I will also write about multithreading without scheduler, just spinning thread dedicated to providing one "service", say one for animation, one for computing physics, one for AI, one for UI/control/networking. |
07:37:10 | FromDiscord | <mratsim> and communicating in a producer/consumer manner. |
07:46:31 | FromDiscord | <haxscramper> How I can wrap `enum class` in order to be able to use it in built-in sets. It is not implicitly convertible to integer, so codegen fails compilation when trying to `echo` set of resulting enums |
07:47:47 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Igh |
07:48:59 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Igi |
07:52:19 | FromDiscord | <lqdev> gosh, enum class is such a shitty design |
07:54:04 | FromDiscord | <haxscramper> Well, this is still better than getting destroyed by implicit conversions |
07:54:32 | FromDiscord | <haxscramper> Though in this case I'd prefer that `enum class` wasn't a thing |
07:54:56 | FromDiscord | <ElegantBeef> The fuck is an enum class? |
07:55:05 | FromDiscord | <ElegantBeef> Is it just making it what nim considers "pure"? |
07:55:12 | FromDiscord | <lqdev> i mean removing implicit conversions is a valid reason, it's just that enum class's ideas are good but the execution is poor |
07:55:22 | FromDiscord | <lqdev> @ElegantBeef kind of |
07:55:23 | FromDiscord | <haxscramper> 'typesafe' enum from C++ that does not allow implicit conversions to integers |
07:55:29 | FromDiscord | <mratsim> I have a macro for that |
07:55:49 | FromDiscord | <ElegantBeef> Wait they're implictly converted? |
07:55:54 | FromDiscord | <ElegantBeef> The fuck |
07:56:18 | FromDiscord | <mratsim> https://github.com/status-im/nimbus-eth1/blob/master/nimbus/vm/interpreter/opcode_values.nim#L10 |
07:56:46 | FromDiscord | <mratsim> I think @haxscramper meant integer promotion instead of implicit conversion. |
07:57:26 | FromDiscord | <mratsim> https://github.com/status-im/nimbus-eth1/blob/master/nimbus/vm/interpreter/utils/macros_gen_opcodes.nim#L25-L83↵↵the fill_enum_holes macro transfrom an enum with holes into a full enum, that can be used in a set |
07:58:19 | FromDiscord | <mratsim> (edit) https://github.com/status-im/nimbus-eth1/blob/master/nimbus/vm/interpreter/opcode_values.nim#L10 |
07:58:20 | * | FromDiscord quit (Remote host closed the connection) |
07:58:37 | * | FromDiscord joined #nim |
07:58:56 | FromDiscord | <haxscramper> This is not a problem of enum with holes, I have issues on codegen stage |
07:59:06 | FromDiscord | <haxscramper> Let me clean up the example from `=2` `=3` |
08:01:22 | FromDiscord | <haxscramper> Oh, actlually |
08:02:35 | FromDiscord | <haxscramper> Yeah, now no errors in codegen, but previously it was related to `echo`, not sets. I could create set with this enum without errors |
08:05:45 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Igr |
08:08:58 | FromDiscord | <haxscramper> But this creates invalid `valFixup0` that can be used in nim code, but don't correspond to anything in wrapped backend. |
08:11:37 | leorize | hmm, not sure if enums with holes should even be supported by bitsets |
08:12:17 | FromDiscord | <mratsim> They aren't, or they were not when I wrote my macro |
08:14:14 | FromDiscord | <mratsim> by the way @Zevv Apparently from the C++Con talk: at 40:00 https://youtu.be/tF-Nz4aRWAM?t=2395↵C++ coroutines are using Continuation-passing Style underneath |
08:16:45 | * | Cthalupa quit (Ping timeout: 240 seconds) |
08:17:39 | * | Cthalupa joined #nim |
08:27:01 | * | mbomba joined #nim |
08:41:20 | * | nikki93[m] quit (Ping timeout: 268 seconds) |
08:41:28 | * | nikki93[m] joined #nim |
08:44:52 | * | Tanger quit (Remote host closed the connection) |
08:46:12 | * | PMunch joined #nim |
09:02:07 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:05:44 | Zevv | sure what else |
09:06:13 | Zevv | it's either that or you need a full stack and context switching magic glue |
09:06:48 | * | abm joined #nim |
09:12:13 | FromDiscord | <mratsim> TBH All those stackfull coroutines, stackless coroutines, fibers and context switching mechanics still elude me |
09:12:49 | Zevv | "coroutines is how people are going to do async programming in the future" |
09:12:50 | Zevv | really |
09:13:01 | Zevv | I have doing my async IO in lua in coroutines in the last 15 years |
09:13:55 | FromDiscord | <mratsim> And then you read discussions like this and you're like mmmh: https://www.reddit.com/r/rust/comments/83tak7/implementing_kotlinstyle_continuations_on_top_of |
09:16:09 | Zevv | what part of that thread makes you go 'mmmhh' |
09:19:23 | * | mbomba quit (Quit: WeeChat 3.0) |
09:19:51 | FromDiscord | <mratsim> The tradeoffs, impact on implementation and user API. |
09:20:34 | FromDiscord | <mratsim> For example, Rust zero cost is about futures being fully stack allocated and just a pointer to a kernel "file" which can be as simple as a socket |
09:20:49 | FromDiscord | <mratsim> Apparently this works perfectly in the readiness model like epoll |
09:21:04 | FromDiscord | <mratsim> but not greatly with completion model like IOCP |
09:21:50 | FromDiscord | <mratsim> well fine. But as an implementation "detail", it's good because everything is on the stack which significantly simplifies threading since you can track ownership and you don' need heap allocation |
09:22:27 | FromDiscord | <mratsim> the alternative is a future owning some buffer, for example a channel, to receive the result and there is a sender, the task spawned that fills it (promise:future, ...) |
09:23:11 | FromDiscord | <mratsim> this has a couple of disadvantage: heap allocation and so refcounting because there are 2 users, need for synchronization |
09:23:53 | FromDiscord | <mratsim> In Weave, you can drop the heap allocation and refcounting, if and only if a future cannot escape its spawning scope. |
09:24:22 | FromDiscord | <mratsim> by using alloca in that case, but the compiler doesn't expose tool for that. |
09:25:09 | FromDiscord | <mratsim> but people expect to be able to have a future and carry it everywhere. |
09:25:26 | FromDiscord | <mratsim> in Nim you now have sink to ensure single ownership so it's solved. |
09:25:43 | * | leorize quit (Ping timeout: 240 seconds) |
09:25:44 | FromDiscord | <mratsim> but as you begin to see, there is a lot of interactions at play |
09:26:04 | FromDiscord | <mratsim> just from a user perpective, API and the implementation chosen |
09:27:17 | FromDiscord | <mratsim> And I'm not talking at all about the scheduler because depending on the model you choose, the scheduler will either sleep and wait for a kernel signal or poll the kernel. |
09:27:53 | FromDiscord | <mratsim> at least for IO, because for CPU, I think I reviewed all the scheduling techniques when implementing Weave and carefully analyzed the tradeoffs. |
09:29:04 | * | leorize joined #nim |
09:30:24 | FromDiscord | <mratsim> And then you need to think about cancellation and apparently in Rust it's a major pain point: https://gist.github.com/Matthias247/ffc0f189742abf6aa41a226fe07398a8 |
09:32:11 | FromDiscord | <mratsim> Anyway on another note. I keep having the nagging feeling that Weave is actually using continuation passing style internally. Especially the parallelFor loop transformation, so i need to understand the CPS transformation more deeply. |
09:33:16 | supakeen | I am still confused by that CPS term. |
09:33:27 | supakeen | Nowadays it means passing a state holding object right? |
09:33:53 | supakeen | Or is still passing a callback function? |
09:36:27 | FromDiscord | <Deleted User 5bd78114> Really, i don't know how to start, because i have found a way to use Raylib, but now i want to also use `Physac` (an addon-type thing) for Raylib, it adds Physics but i can't figure out how i could use it |
09:36:35 | FromDiscord | <kenran> Do you have any idea how I can debug `could not load): libfreetype-6.dylib` on macOS? I have freetype installed, and it doesn't work inside or outside of a nix-shell. There doesn't seem to be a file with this exact name either, only `libfreetype.6.dylib`. |
09:36:54 | FromDiscord | <kenran> (I'm using the `freetype` package from nimble) |
09:40:23 | * | krux02 joined #nim |
09:44:04 | mipri | there's not really anything to debug. the constant doesn't suit the library path you have. |
09:44:50 | mipri | the simplest way to resolve it should be 'nimble develop freetype', and patching your own copy to have a path that works for you. |
09:45:21 | mipri | the package can also be smarter about what paths to use and mkaing an issue or a pr is a step to making it smarter |
09:46:13 | mipri | f.e. the macOS libpcre string is "libpcre(.3|.1|).dylib", exactly like that. |
09:50:32 | FromDiscord | <kenran> mipri ty! |
09:50:35 | FromDiscord | <haxscramper> Discord replies are not relayed to irc yet, so you should probably ping directly |
09:50:59 | FromDiscord | <kenran> now I'm getting all sorts of other issues, but those are at least in my code 🙂 |
10:10:45 | * | narimiran quit (Ping timeout: 240 seconds) |
10:11:50 | * | NimBot joined #nim |
10:12:02 | * | narimiran joined #nim |
10:18:53 | narimiran | question: i can create a bit set like this: `let s = {a..b, c..d}` where a, b, c, d are some ints, and then `typeof(s)` is `set[0..65535]` |
10:19:13 | FromDiscord | <mratsim> @supakeen As far as I understood, continuation passing style is instead of calling a function and then resuming where you were once that calls end, you call the function and tell it to handle/take over resuming itself. |
10:19:30 | narimiran | so if i want a Table having a bitset for its values, i need to do `var t: Table[string, set[0..65535]]`? no way around this uglyness? |
10:19:50 | supakeen | ack |
10:21:36 | mipri | that's equivalent to set[uint16], although you'd actually need cast[] to change it between them it seems |
10:24:36 | mipri | !eval echo (typeof {1..2u16,3}, typeof {1u16..2, 3}) |
10:24:38 | NimBot | (set[range 0..65535(int)], set[uint16]) |
10:31:10 | narimiran | mipri: yeah, if i define it as `set[uint16]`, i cannot just do `{a..b, c..d}` like before |
10:32:51 | narimiran | and `{a.uint16..b.uint16, c.uint16..d.uint16}` is much uglier |
10:33:47 | mipri | only the first one is needed though |
10:35:02 | * | fanta1 joined #nim |
10:37:22 | mipri | it's disappointing that set[uint16]({1..2, 3..4}) isn't enough. That would permit something like {1..2, 3..4}.MyType |
10:38:45 | narimiran | mipri: i tried with only first one. nope. |
10:40:02 | mipri | with literals it works. if you have a,b,c,d, you do need the others |
10:42:13 | mipri | !eval import tables; echo typeof({"r1":{1..2, 3..4}}.toTable) |
10:42:15 | NimBot | Table[system.string, set[range 0..65535(int)]] |
10:43:24 | mipri | oh, this works: https://play.nim-lang.org/#ix=2Ihh |
10:45:37 | mipri | you can carry that even into functions over the table |
10:46:03 | narimiran | ungh |
10:47:43 | mipri | more palatably, you can type SetType = r1.type |
10:47:48 | mipri | and then refer to that when wanted |
11:02:37 | * | Q-Master quit (Ping timeout: 264 seconds) |
11:33:57 | FromGitter | <gogolxdong> Is there anyway to cast seq[byte] to string? |
11:35:14 | mipri | just cast[string]() AFAIK |
11:35:57 | * | Q-Master joined #nim |
11:41:24 | * | Q-Master quit (Ping timeout: 268 seconds) |
11:47:47 | FromDiscord | <mratsim> no |
11:47:50 | FromDiscord | <mratsim> don't do that |
11:48:15 | mipri | is it no longer guaranteed to be the same? |
11:48:23 | FromDiscord | <mratsim> use a proc foo[T: byte|char](input: openarray[T]) proc instead to be compatible with both |
11:48:47 | FromDiscord | <mratsim> it's guaranteed to not have a terminating \0 byte and cause issue in FFI |
11:49:48 | FromDiscord | <mratsim> also if you need to assign to a variable, there is a copy needed anyway so do a copy like this: https://github.com/status-im/nim-http-utils/pull/9/files |
11:49:49 | disbot | ➥ Null terminate public strings |
11:51:04 | FromDiscord | <dom96> @mratsim perhaps you'd be up for writing a quick article about dealing with byte data in Nim? Sounds like this knowledge is very important to be shared widely |
11:52:13 | mipri | type conversions, how much they cost, how much they check. There was a SO answer for the idiomatic Rust translations that I read about 50 times a week when I used that language. |
11:52:42 | FromDiscord | <mratsim> @dom96 with the view types I have to refresh my knowledge :/ |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:32 | * | supakeen joined #nim |
12:15:59 | * | Q-Master joined #nim |
12:34:01 | * | rockcavera joined #nim |
12:50:23 | Zevv | disruptek: does youtube work for you |
12:50:37 | * | Q-Master quit (Ping timeout: 264 seconds) |
12:57:36 | FromDiscord | <kenran> I'd second that. I will soon have to go down that rabbit hole I thing because I have to receive byte data from an FD and was already wondering how I should do the conversion. |
12:59:40 | FromDiscord | <kenran> (edit) I'd second that. I will soon have to go down that rabbit hole I think because I have to receive byte data from an FD and was already wondering how I should do the conversion. |
13:04:06 | FromDiscord | <shadow.> zevv how did you say you could debug npeg? |
13:04:12 | FromDiscord | <shadow.> to see where it was failing assertion etc |
13:06:39 | Zevv | shadow.: I'd be glad to answer you |
13:07:03 | Zevv | but up to now, all questions you aksed have answers clearly stated in the manual :) |
13:07:18 | Zevv | for example, did you read the section "TRacing and debugging" |
13:07:34 | FromDiscord | <shadow.> fair enough |
13:07:37 | FromDiscord | <shadow.> thanks |
13:07:37 | Zevv | -d:npegTrace |
13:07:43 | Zevv | is the go-to first thing |
13:08:06 | Zevv | at compile time it'll show a representation of the generated parser, which you might or might not find useful |
13:08:39 | Zevv | at run time it will print a line for every FSM state and current instruction, together with the subject stream at the current position |
13:08:49 | Zevv | it will show for each try if it matches or not, and what it is trying at any time |
13:08:52 | FromDiscord | <shadow.> ahh i see interesting thanks |
13:10:45 | Zevv | mratsim: What I miss in this cppcon talk is how the CPSing is done, and what happens with the lifed locals. how is that memory managed, owned, etc |
13:11:32 | FromDiscord | <exelotl> I just use strings whenever dealing with byte data lol |
13:12:35 | FromDiscord | <exelotl> would gladly read an article on how to do it better x) |
13:13:19 | FromDiscord | <exelotl> it's only tripped me up once tbh, when writeFile broke on Windows 🙃 |
13:15:12 | Zevv | exelotl: for a lot of use cases, using strings for byte data can work just fine |
13:15:37 | Zevv | you can also seq[uint8] of signedness is problematic |
13:15:38 | FromDiscord | <shadow.> the correct way of matching up to something is like `+1 ...` right? |
13:15:50 | Zevv | what do you mean with "matching up" ? |
13:15:54 | FromDiscord | <shadow.> well rather |
13:15:57 | FromDiscord | <shadow.> consuming until something |
13:16:11 | Zevv | that'll go past the finish line. PEG is greedy by default |
13:16:16 | FromDiscord | <shadow.> oh damn ok |
13:16:20 | Zevv | so +1 will eat everything |
13:16:25 | FromDiscord | <shadow.> i see |
13:16:30 | FromDiscord | <shadow.> i have to split it into a dif rule then? |
13:16:32 | Zevv | if you want to skip until p, you can do a shortcut @p |
13:16:35 | FromDiscord | <shadow.> wait nvm |
13:16:36 | FromDiscord | <shadow.> ohhh |
13:16:38 | Zevv | which means "search for p" |
13:16:39 | FromDiscord | <shadow.> that is very useful thanks |
13:16:54 | FromDiscord | <shadow.> and is there a way to capture with something like that or no |
13:17:09 | PMunch | @shadow. are you working on todays AoC? |
13:17:12 | Zevv | the manual says no, there is not. If you want to do that, you need to do it manually |
13:17:23 | Zevv | you can do >(*(1-p)) * p |
13:17:41 | Zevv | which means "capture a sequence of zero or more things not matching p, and then match p" |
13:17:50 | FromDiscord | <shadow.> fair fair thanks |
13:22:56 | * | ForumUpdaterBot quit (Remote host closed the connection) |
13:23:04 | * | ForumUpdaterBot joined #nim |
13:29:23 | * | Vladar joined #nim |
13:31:14 | * | narimiran quit (Ping timeout: 256 seconds) |
13:32:38 | * | narimiran joined #nim |
13:44:30 | FromDiscord | <mratsim> @Zevv, will try to find some info under the hood of C++ coroutines |
13:44:45 | FromDiscord | <mratsim> but I guess I should start with your CPS PoC first |
13:45:05 | Zevv | if true stackless coroutines are coming to C++, I'd expect a bit more noise about |
13:45:14 | Zevv | becaus that would be a Big Deal, IMHO |
13:46:02 | Zevv | with "stackless" I mean "without complete stack frames". Not the silly useless boost-kind of coroutines |
13:47:18 | planetis[m] | Who wants to read a lengthy technical article about ecs? https://gist.github.com/planetis-m/3bcfa093ca0ad3859e6078c956311472 |
13:47:30 | planetis[m] | comments welcome |
13:48:10 | Zevv | comment: start your very first paragraph with a consise description of what ECS actually *is* |
13:48:21 | Zevv | I'm at par 3 and still don't know |
13:49:20 | FromDiscord | <sealmove> @PMunch sorry to bother again. Can you take a quick glimpse of new README.rst and tell me if you like it now? I polished the ideas. |
13:49:22 | planetis[m] | im doing that with examples do you read the code |
13:49:52 | Zevv | planetis[m]: sure, but if I don't know what an article is about after reading the first few lines, I lose motivation to spend the time to read it |
13:50:08 | Zevv | start with "what is it, and what does it solve" |
13:50:44 | planetis[m] | ok i will try to improve but seems strange to me bc i already wrote a paragraph called "what is an ecs" |
13:50:46 | Zevv | and you might consider at least explaining what the acronym stands for :) |
13:50:52 | FromDiscord | <sealmove> just look at Strings section https://github.com/sealmove/binaryparse#strings and perhaps Substreams. |
13:52:27 | Zevv | apart from that, looks good, good examples |
13:55:16 | planetis[m] | i added the acronym missed that |
13:55:30 | planetis[m] | thanks, Zevv |
13:57:36 | * | krux02 quit (Remote host closed the connection) |
13:58:58 | PMunch | @sealmove, README looks fine, still not sold on the whole concept of sub-streams though.. |
14:01:37 | FromDiscord | <mratsim> @Zevv, I think Rust futures are stackless, it's a design tradeoff. |
14:05:23 | * | Amun_Ra quit (Quit: Gdyby mi się chciało tak jak mi się nie chce…) |
14:05:41 | FromDiscord | <sealmove> @PMunch the main advantage is that reading strings is made transparent. In reality they are always read as null-terminated (except when using assertion or magic sequence). |
14:05:58 | * | Amun_Ra joined #nim |
14:07:24 | FromDiscord | <sealmove> `'\0'` also means "end of stream", so I think it's neat |
14:09:14 | FromDiscord | <mratsim> @planetis↵> I chose an ecommerce store as an example, mainly because everyone has solved math problems with selling goods↵I thought programming problems at school involved employee class and salary property? |
14:10:01 | FromDiscord | <sealmove> though it does mean that if you do `s: x(5)` and the substream has a null byte at index 2, the string will terminate earlier |
14:10:04 | FromDiscord | <mratsim> also hide that password: array[128, char] :/ field |
14:10:52 | planetis[m] | lol okay |
14:11:22 | FromDiscord | <sealmove> hmm, why is designing a DSL so hard to make coherent and convenient at the same time? >_< |
14:12:25 | FromDiscord | <mratsim> also you need at the end in the summary, a "why so complex" or why so unnatural summary |
14:12:42 | FromDiscord | <mratsim> maybe with a remainder of the constraint of 1/60 frame? |
14:13:09 | FromDiscord | <sealmove> well, in the case above case, one would use `u8: x[5]`. since assertion works with strings (`s: x = "MAGIC"), I think it's fine. |
14:13:27 | FromDiscord | <mratsim> @sealmove, because you need to address domain experts that might have very differing need or impose serious constraints relative to the underlying implementation |
14:14:05 | FromDiscord | <mratsim> and if you aren't a domain expert yourself, you will miss some cases that aren't covered |
14:14:13 | planetis[m] | we didn't go to the same school unfortunetly (for me) |
14:14:29 | FromDiscord | <sealmove> yes, I fell pray to this and PMunch corrected me many times, which is nice |
14:14:36 | FromDiscord | <mratsim> for example the neural network DSL for Arraymancer had a glaring hole I realized when implementing one example. |
14:15:41 | FromDiscord | <mratsim> also you might want to have a read into the section "Developping extensible shallow embeddings (functions in host lang) on top of deep embeddings (fixed AST/IR): " of my issue https://github.com/mratsim/Arraymancer/issues/347#issuecomment-461009747 |
14:15:42 | disbot | ➥ discussion: porting Halide to nim ; snippet at 12https://play.nim-lang.org/#ix=2lSX |
14:16:32 | FromDiscord | <mratsim> Basically I was exploring a DSL for array/matrix/tensor computation to cleanly describe A[i, j] matrix operations without polluting your code with for loop |
14:16:56 | FromDiscord | <mratsim> and optimizations without polluting the code with vectorization, parallelism and what not. |
14:17:29 | FromDiscord | <mratsim> otherwise excellent article, it's much clearer to me @planetis |
14:17:58 | planetis[m] | thank :) |
14:23:35 | * | L[m] quit (Ping timeout: 268 seconds) |
14:23:44 | * | L[m] joined #nim |
14:35:45 | * | waleee-cl joined #nim |
14:46:24 | * | Q-Master joined #nim |
14:49:49 | FromDiscord | <inv> Hello, nimble question: requires "https://github.com/status-im/nim-decimal#master"↵↵But in .nimble\pkgs\Decimal-#master directory I just see two files: decimal.nimble and nimblemeta.json . But I expected code to be there - what is wrong ? |
14:50:13 | FromDiscord | <inv> (edit) "Hello, nimble question: requires "https://github.com/status-im/nim-decimal#master"↵↵But in .nimble\pkgs\Decimal-#master directory I just see two files: decimal.nimble and nimblemeta.json . But I expected code to be there ... -" added "also" |
14:52:18 | Zevv | mratsim: with 'stackless' you mean 'no locals allowed', right? |
14:53:11 | Zevv | what's the proper terminology here? There's "one stack per coro", there is "no stack at all" and there is "lifting the stack to the heap" (which is what our CPS) does. |
14:53:22 | Zevv | #1 is heavy and requires small stacks or a lot of memory |
14:53:34 | Zevv | #2 has usability issues but a trivial implementation |
14:53:44 | Zevv | #3 is the most user friendly IMHO, with the tradeoff of memory management |
14:54:03 | Zevv | If you don't want to pay for that, you can choose to use it as in #2 by simply not using any local variables |
14:54:03 | FromDiscord | <shadow.> https://play.nim-lang.org/#ix=2Ij1 for anyone doing part two of today's aoc, is there an issue with finding the order of the rules in this logic? |
14:56:22 | PMunch | Getting ready to stream my attempt at day 2 :) |
14:56:28 | PMunch | day 16* |
14:57:05 | Zevv | did you solve'm all in your sessions? |
14:58:22 | FromDiscord | <shadow.> i think he didnt do 13 iirc |
14:58:25 | FromDiscord | <shadow.> or maybe it was 10? |
14:58:35 | PMunch | I have two part 2's that I haven't solved on stream, but that's been because I've had to go do other stuff and finish them later in the daf |
14:58:37 | PMunch | day* |
14:58:42 | FromDiscord | <shadow.> ah ye |
14:59:00 | PMunch | Well, apart from day 10 when I cheated and looked at narimirans solution :P |
15:02:01 | Zevv | dude |
15:05:24 | * | habamax quit (Ping timeout: 272 seconds) |
15:06:15 | PMunch | Zevv, dude? |
15:07:20 | Zevv | cheating and stealing |
15:09:41 | FromDiscord | <shadow.> wow |
15:09:56 | FromDiscord | <shadow.> i can't figure out why my current solution isn't working feelsbadman |
15:10:43 | PMunch | Stream is ready: https://www.youtube.com/watch?v=TrxyCNdI0bw https://www.twitch.tv/pmunche |
15:10:50 | PMunch | Zevv, it's open source! |
15:11:03 | Zevv | oh yeah, does it have a LICENSE |
15:11:24 | PMunch | But yeah, I had been drinking sparkling wine and watching Norway win and handball, so I wasn't really up for solving puzzles :P |
15:12:13 | FromDiscord | <sealmove> the documentation for `genSym` states: "The symbol needs to occur in a declaration context". What exactly does this mean? |
15:12:22 | PMunch | narimiran, stream is up if you want to watch today |
15:12:35 | narimiran | PMunch: thanks, i will |
15:12:47 | FromDiscord | <sealmove> me too |
15:16:06 | FromDiscord | <sealmove> I keep getting this annoying error "Error: internal error: environment misses: :tmp" |
15:16:28 | FromDiscord | <sealmove> Someone people teach me how symbols work, lol |
15:17:23 | FromDiscord | <sealmove> I am doing some kind of aliasing. I have code with `quote do` which I want to use different symbol depending on conditions |
15:20:44 | * | vicfred joined #nim |
15:20:50 | FromDiscord | <shadow.> pmunch you checkin twitch chat this time round lol? |
15:21:33 | * | Q-Master quit (Ping timeout: 268 seconds) |
15:29:08 | FromDiscord | <inv> off: what wm @PMunch uses? looks like dwm, but some icons are there |
15:29:27 | PMunch | I'm using i3 |
15:29:35 | PMunch | With i3bar |
15:29:40 | PMunch | And a lot of custom scripts |
15:29:42 | FromDiscord | <inv> thx |
15:30:03 | * | leorize quit (Ping timeout: 240 seconds) |
15:37:43 | * | MarderIII joined #nim |
15:41:28 | * | Vladar quit (Quit: Leaving) |
15:47:38 | * | leorize joined #nim |
15:48:16 | * | fputs joined #nim |
15:48:24 | * | aHaquer joined #nim |
15:49:13 | * | fputs quit (Client Quit) |
15:50:54 | * | fputs joined #nim |
15:51:18 | * | Q-Master joined #nim |
15:51:27 | FromDiscord | <dom96> Check out the .nimble file: https://github.com/status-im/nim-decimal/blob/master/decimal.nimble↵↵It has `srcDir` set to "src", but the repo has no "src" dir |
15:52:05 | FromDiscord | <dom96> @mratsim can you fix the above package? |
15:52:06 | FromDiscord | <inv> Yep + I found fork of the package with fix |
15:52:21 | FromDiscord | <inv> here it is https://github.com/cerk/nim-decimal/tree/nimbleForNim1.0 |
15:53:53 | FromDiscord | <inv> isn't @PMunch sound volume too low? checked everything on PC - everything is on max, but stream volume is very low |
15:54:10 | FromDiscord | <inv> (edit) "PC" => "PC, music is ok" |
15:54:35 | FromDiscord | <inv> Yep, a bit better. thx |
15:56:03 | * | fputs quit (Quit: WeeChat 2.9) |
15:56:20 | * | fputs joined #nim |
16:04:57 | FromDiscord | <mratsim> @dom96 should be fixed now. I used to use "src" but it caused issues due to the src dir disappearing on users installation |
16:20:45 | * | leorize[m] quit (Ping timeout: 268 seconds) |
16:20:57 | * | leorize[m] joined #nim |
16:24:24 | FromDiscord | <inv> Are you about nim-decimal ? |
16:24:47 | FromDiscord | <inv> (edit) "Are you about nim-decimal ? ... " added "Because I am using the fork I mentioned, maybe I can switch then" |
16:28:52 | FromDiscord | <mratsim> yeah |
16:29:15 | FromDiscord | <mratsim> actually if you want to maintain the fork I can update the readme to point to yours, and archive it. |
16:29:58 | FromDiscord | <inv> @mratsim nope, I just found there is a PR which do everything |
16:30:16 | FromDiscord | <inv> (edit) "everything" => "everything, I mean - probably it would be ok just to merge it" |
16:30:31 | FromDiscord | <inv> ah, it is not fork |
16:30:39 | FromDiscord | <inv> (edit) "ah, it is not ... fork" added "my" |
16:32:10 | FromDiscord | <inv> sent a code paste, see https://play.nim-lang.org/#ix=2Ijv |
16:34:06 | FromDiscord | <inv> Yep, just checked in separate package. Is it nim-bug (I think so) or module's one? |
16:34:34 | FromDiscord | <shadow.> @PMunch: we're getting 8-15 inches of snow lol so i should probably get a fire setup too |
16:34:43 | FromDiscord | <mratsim> pretty sure that's new |
16:35:03 | PMunch | @shadow. the annoying part is that I haven't had a fireplace for a while |
16:35:11 | PMunch | Or it has been sitting there in the corner, mocking me |
16:36:18 | PMunch | Because the fire marshal said the chimney wasn't up to standard, so had to get that replaced for about €4.6k. Then the guy who installed the new chimney wasn't sure if the wall behind my fireplace was good enough, so he didn't want to connect it |
16:36:30 | FromDiscord | <shadow.> damnnn |
16:36:33 | FromDiscord | <shadow.> that is quite rough |
16:36:41 | PMunch | Contacted the fire marshal, they came and looked at it and agreed that it probably wasn't fine |
16:37:36 | PMunch | So after a bunch of back and forth between me and the guy I bought it from, the guy who originally installed the fireplace, and trying to get in touch with the guy who did the chimney I cut through the wall to figure out what it was made out of and what was behind it |
16:37:58 | PMunch | Turns out it was all just non-flammable stuff after all, so the fire marshal came by today for a second look and approved it |
16:38:09 | PMunch | So now I just need to mortar it all up and I'm good to go |
16:38:21 | PMunch | Just about a year and half without my fireplace.. |
16:40:11 | PMunch | So yeah, I'm off to do that now |
16:40:14 | * | PMunch quit (Quit: leaving) |
16:40:38 | FromDiscord | <inv> beep: https://github.com/nim-lang/Nim/issues/16373 |
16:40:40 | disbot | ➥ gc:arc raises "type bound operation X can be defined only in the same module with its type Y" ; snippet at 12https://play.nim-lang.org/#ix=2Ijz |
16:43:49 | FromDiscord | <inv> But, hm ... sorry, I think it is probably the lib problem |
16:44:04 | FromDiscord | <inv> (edit) removed "think it is probably the lib problem" |
16:53:31 | * | kenran joined #nim |
16:53:36 | * | habamax joined #nim |
16:55:10 | * | klaufir joined #nim |
16:56:47 | * | lritter quit (Quit: Leaving) |
16:57:08 | * | L[m] quit (Ping timeout: 268 seconds) |
16:57:20 | * | L[m] joined #nim |
17:00:00 | * | aHaquer left #nim (#nim) |
17:22:26 | FromDiscord | <Clyybber> disruptek: So I tracked it down now |
17:24:44 | FromDiscord | <Clyybber> And have two fixes |
17:24:58 | FromDiscord | <Clyybber> Araq: Hey, are you there? |
17:25:07 | disruptek | clyybber: oh yeah? |
17:25:10 | FromDiscord | <shadow.> @PMunch: fixed my day 16 finally lol, switching methods worked |
17:25:28 | FromDiscord | <Clyybber> disruptek: The compiler doesn't resem operands if they already have a type |
17:26:00 | FromDiscord | <Clyybber> so you can either change that; and it fixes it |
17:26:12 | FromDiscord | <Clyybber> or you strip the output of macros of its types |
17:26:30 | FromDiscord | <Clyybber> I'm not sure which is better yet. |
17:26:37 | disruptek | hmm, maybe that makes more sense. |
17:26:58 | FromDiscord | <Clyybber> disruptek: That also explains why fib(x - 1) exhibits the issue but fib(x) doesn't |
17:26:58 | disruptek | and maybe we can afford that more easily now due to ic. |
17:27:23 | FromDiscord | <Clyybber> Because in fib(x) you overwrite the operand with your ident node which doesn't have a type |
17:28:08 | FromDiscord | <Clyybber> disruptek: I can't think of a case where we'd want macros to type our stuff |
17:28:13 | FromDiscord | <Clyybber> other than to confuse the compiler :D |
17:28:33 | FromDiscord | <Clyybber> typing seems like it should be the compilers job |
17:28:47 | disruptek | well, what i hear you saying is that we just cannot afford to trust macros, which i agree with. |
17:28:56 | FromDiscord | <Clyybber> yeah |
17:30:37 | disruptek | so would we resym everything, always? |
17:31:03 | disruptek | because that sounds bad. 😁 |
17:31:48 | disruptek | maybe it makes the most sense though, from the "what i see in my editor is what i want" perspective. |
17:33:24 | FromDiscord | <Clyybber> disruptek: macro results already get all their nfSem stripped |
17:33:43 | FromDiscord | <Clyybber> so the intention to always resem their output is already there |
17:35:48 | disruptek | then so we don't need the resym pass in macro code. |
17:36:55 | FromDiscord | <Clyybber> wdym? |
17:37:24 | disruptek | we have this sym->ident pattern in macro code now but it shouldn't exist. |
17:37:49 | FromDiscord | <Clyybber> no thats not the issue |
17:38:04 | FromDiscord | <Clyybber> the underlying issue is more general |
17:38:16 | disruptek | i know, but this is something that helps ergonomics. |
17:38:22 | FromDiscord | <Clyybber> the compiler trusts .typ fields in a lot of places |
17:38:46 | FromDiscord | <Clyybber> but we can't trust them for macro output |
17:40:55 | disruptek | let me ask you this: is macro output untyped? is it typed? |
17:41:05 | disruptek | like, in your ideal world. |
17:44:48 | FromDiscord | <Clyybber> disruptek: Are you not in telegram anymore? |
17:47:01 | FromDiscord | <Daniel> discord is the easiest, its on web(in browser), on android, on iphone, on desktop...everyhwere |
17:47:12 | * | haxscramper joined #nim |
17:47:21 | haxscramper | On C++ enum again - do you have any suggestions for wrapping enums with holes so that they could be used in bitsets? It is quite common to see patterns like `enum Flags { flag1 = (1 << 0), flag2 = (1 << 1), ... flagn = (1 << n) };` which would be really nice to also automatically wrap in a way that would be usable for `set[T]` types. |
17:47:36 | FromDiscord | <Clyybber> @Daniel and so is telegram :p |
17:48:09 | haxscramper | I found out you can automatically fill holes for wrapped enums to use in `set[enum]`, but for cases like `(1 << 12)` this is not a feasible solution |
17:48:23 | leorize | haxscramper: set[T] only supports ordinals and enums with holes are not ordinals :P |
17:48:28 | haxscramper | I know it |
17:48:37 | haxscramper | say it to C++ shit that doesn't knwo |
17:49:04 | haxscramper | I mean I need to somehow meld these two together, so people using C wrapers won't have to do bitshits all the time |
17:49:13 | haxscramper | bitshift* |
17:49:26 | haxscramper | This is the problem actually |
17:49:53 | leorize | haxscramper: for (1 << x) enums, if they're sequential and non-duplicating, just map them into a normal enum :P |
17:50:04 | leorize | like enum without any value whatsoever |
17:50:14 | leorize | then add `{.size: sizeof(cint).}` |
17:50:16 | FromDiscord | <Clyybber> leorize: Regarding your reply on telegram; this is not about the spec of typed ast itself, but more about wether to trust macro output or not |
17:50:46 | leorize | the sets coming from them should be the same as or-ing the flags |
17:50:46 | FromDiscord | <Clyybber> (replying here because I don't want to drown the telegram channel) |
17:50:57 | haxscramper | leorize: and this would allow to use them in sets, or some additional workarounds are necessary? |
17:50:57 | disruptek | i have nothing to contribute to telegram. |
17:51:17 | FromDiscord | <Avatarfighter> :disruptek: |
17:51:52 | FromDiscord | <Clyybber> disruptek: its much easier to discuss important things there |
17:52:15 | disruptek | how? |
17:52:20 | FromDiscord | <Clyybber> because people actually read it |
17:52:21 | leorize | haxscramper: see https://nim-lang.org/docs/manual.html#set-type-bit-fields |
17:53:10 | FromDiscord | <Clyybber> disruptek: Only you are here currently; on telegram everyone will see it eventually |
17:53:11 | disruptek | make an issue in compilerdev; then it's less noisy. |
17:53:11 | leorize | I would consider using a wrapping enum tbh, less surprising to the user |
17:54:18 | haxscramper | You mean declare proxy enum that would be converted to underlying C one only on interfacing, and duplicate all API to work with proxy? |
17:55:26 | leorize | yea, something like that |
17:56:15 | haxscramper | Yes, I could probably take this apporach in the end, for cases where authors went completely crazy and had mixed `<<` enums and regular values |
17:57:11 | haxscramper | Though `sizeof(cint)`/filling holes should cover majority of the edge cases |
17:57:33 | leorize | filling holes is kinda dangerous |
17:57:57 | haxscramper | Yes, it can create invalid values if you mean that |
17:58:07 | haxscramper | I'm thinking about how to work around this |
17:58:16 | * | lritter joined #nim |
17:59:24 | leorize | maybe take a look at timothee enummap? |
18:01:02 | leorize | https://github.com/nim-lang/fusion/pull/23 |
18:01:04 | disbot | ➥ Add `enummaps` module to attach metadata to enums; as a special case, it replaces enum with holes |
18:02:11 | * | ^Q-Master^ joined #nim |
18:02:57 | * | Q-Master quit (Read error: Connection reset by peer) |
18:03:51 | FromDiscord | <Daniel> @Clyybber not the same, telegram requires phone number |
18:04:34 | * | hnOsmium0001 joined #nim |
18:08:12 | * | regreg joined #nim |
18:18:41 | haxscramper | leorize: Yes, it does look pretty good, I should probably use this approach for wrappers. Wrap C enum as-is - with holes and everything, and introduce proxy that would be used in the actual API. Make overloads for all for all procs that either (1) accept enum directly, or (2) have argument marked as `bitset-on-enum`. For first type just map nim enum to corresponding C one via mapping table and pass it to implementation. For second it |
18:18:41 | haxscramper | would additionally do bitor on values before passing them |
18:19:51 | haxscramper | This would provide nim-style interface for enum without holes. If someone needs to use underlying value I can introduce helper functions for mapping to integers etc. |
18:21:04 | haxscramper | And duplicate C enum values would be mapped to `const enDuplicate = enOriginal` to make case matching work as expected. |
18:29:54 | leorize[m] | stringification would be weird for them but is an acceptable tradeoff |
18:33:10 | haxscramper | Nim enum will have regular stringification, and for C I could use namespaced value? Like `struct S { enum E { Val }; };` is stringified as `S::E::Val`. |
18:33:52 | haxscramper | Though stringification for C should probably be implemented as `toString` *proc* so one could roll own implementation if needed |
18:34:07 | haxscramper | For cases where original C library also provides stringification (like libclang does for example) |
18:34:44 | disruptek | eh `$` vs. toString. |
18:34:58 | haxscramper | Yes, it is explictly verbose |
18:35:14 | disruptek | explicitly noisy. |
18:35:21 | haxscramper | *if* you want you can do ``proc `$`(e: Enum): string = toString(e)`` |
18:35:44 | disruptek | why would i want that? |
18:36:01 | disruptek | toString will produce the C++ version? |
18:36:02 | haxscramper | On the other hand - locally defined procs shadow declaration from imported modules AFAIK, so I can probably do `$` by default them |
18:36:15 | haxscramper | disruptek: yes, `toString` will produce C++ version |
18:36:53 | disruptek | it won't hurt to impl toString but i will always want `$` to do the obvious thing. |
18:37:11 | haxscramper | Oh, actually this is all rubbish, because I get `$` for enum anyway by default, so implementing overload for `$` |
18:37:24 | haxscramper | Is what one should do by default |
18:37:28 | disruptek | yes. |
18:37:32 | leorize[m] | it's rather trivial to replace a `$` proc |
19:05:19 | * | regreg quit (Ping timeout: 272 seconds) |
19:27:34 | * | hmmm joined #nim |
19:30:09 | hmmm | dudes whats the idea of memoizing a recursive algorithm |
19:30:47 | hmmm | I mean the idea is to do less calculations by storing results? |
19:34:23 | oz | yes |
19:34:42 | hmmm | hmmm |
19:42:37 | disruptek | username checks out. |
19:43:07 | oz | yes |
19:43:55 | hmmm | dudes I hate frigging recursion my head is exploding |
19:46:47 | FromGitter | <timotheecour> @leorize @haxscramper ⏎ ⏎ > filling holes is kinda dangerous ⏎ > Yes, it can create invalid values if you mean that; I'm thinking about how to work around this ⏎ ... [https://gitter.im/nim-lang/Nim?at=5fda64276c2aad27540ab79a] |
19:47:22 | leorize | yes, I already linked your enummaps to them right after |
19:48:09 | leorize | please make it into a nimble package |
19:49:26 | FromGitter | <timotheecour> I can; the main downside is preventing its use in stdlib/compiler code, which could benefit from it in many places |
19:50:02 | leorize | "perfect is the enemy of good" -- 4raq |
19:50:33 | hmmm | "recursion is the evil of the world" -- hmmm |
19:51:24 | FromGitter | <timotheecour> `s/I can /I will/` and hopefully can be moved to stdlib in future |
19:52:28 | FromDiscord | <dom96> TIL Araq is Voltaire |
19:55:16 | leorize | I heard it from him first so I just quote it like that :P |
19:55:23 | FromGitter | <haxscramper> @timotheecour proxy enum for C++ wrappers is probably the best approach. Might be a bit fragile, but if peopl don't touch `_IMPL_DONT_TOUCH` things it shoudl be fine |
19:55:55 | hmmm | wat, python has an inbuild decorator thingy to automemoize stuff |
19:56:05 | hmmm | do we have something like that? |
19:57:22 | FromDiscord | <haxscramper> Just remember all your function calls, and then hide inside the computer |
19:57:28 | FromDiscord | <haxscramper> And return answers |
19:57:36 | hmmm | :O |
19:57:44 | FromDiscord | <haxscramper> On the more serious size - no we don't have this in stdlib/fustion AFAIK |
19:58:11 | hmmm | disruptek build it and ship it to stdlib |
19:58:16 | hmmm | you have 5 minutes |
19:58:23 | FromDiscord | <haxscramper> But you could probably implement this even without macros or procs, just with higher-order function that does memoization |
19:58:37 | FromDiscord | <haxscramper> Like this `aux` thing |
19:58:51 | hmmm | ye actually doing it auto defeats the purpose since it's educational stuff anyway |
20:03:42 | * | hmmm quit (Ping timeout: 272 seconds) |
20:03:50 | * | hmmm joined #nim |
20:04:20 | FromDiscord | <shadow.> hmm why do you hate recursion? |
20:04:25 | FromDiscord | <shadow.> what are you workin on |
20:04:38 | * | leorize quit (Quit: WeeChat 2.9) |
20:04:50 | FromDiscord | <haxscramper> ~recursion |
20:04:51 | disbot | no footnotes for `recursion`. 🙁 |
20:05:02 | FromDiscord | <shadow.> lol |
20:05:13 | FromDiscord | <haxscramper> I want to add `"recursion is the evil of the world" -- hmmm` quote |
20:05:28 | FromDiscord | <shadow.> eh recursion isn't that bad |
20:05:32 | FromDiscord | <haxscramper> Probably shouldn't do this though |
20:05:40 | FromDiscord | <shadow.> i typically prefer a breadth-first approach but yk |
20:05:40 | FromDiscord | <shadow.> ymmv |
20:07:11 | FromDiscord | <haxscramper> Yeah, but then you get trees everywhere and stracktrace reports exception in 20th layer of nested calls on missing subnode, and you are starting to wonder if you made correct life choices and maybe it was a better idea to try gamedev |
20:08:18 | FromDiscord | <nikki> ~recursion is see ~recursion |
20:08:18 | disbot | recursion: 11see ~recursion |
20:08:41 | hmmm | I can't wrap my stupid head around the memoizating stuff. Recurstion starts at the end and goes to the base case so wtf am I storing since I have to calculate all the stuff till the base case :O |
20:09:23 | FromDiscord | <nikki> hmmm it's if u reuse some result again in a different branch |
20:09:23 | FromDiscord | <haxscramper> Actually memoization is not directly related to recursion |
20:09:53 | FromDiscord | <nikki> but yeah recursion is just recursion, you don't need to memoize to recurse |
20:10:10 | hmmm | yea but it's slow as my grandpa while memoizing stuff make it fast right? |
20:10:14 | FromDiscord | <haxscramper> This is basically `var cache: Table[ArgType, ResType]` and `proc impl(a: ArgType): ResType ... if a in cache: return cache[a]` |
20:10:16 | FromDiscord | <nikki> recursion is a good succinct description of an algo in many cases for shallow trees |
20:10:36 | FromDiscord | <haxscramper> Otherwise do `cache[a] = <expensive computations>` + `return cache[a]` |
20:10:40 | FromDiscord | <nikki> i usually do recursion with a visited map, and no it's a dfs and just linear time then |
20:11:13 | FromDiscord | <nikki> reverse postorder dfs is topsort which is v useful |
20:11:49 | * | leorize joined #nim |
20:11:54 | FromDiscord | <pietroppeter> @hmmmm there is in fact a package for memoization (with a pragma similar to python decorator): https://github.com/andreaferretti/memo |
20:12:02 | FromDiscord | <dom96> hmmm: depends what you're doing, memoization and recursion doesn't always go together |
20:12:41 | FromDiscord | <nikki> recursion is just the calling of a function from itself, including transitively |
20:19:32 | * | tane joined #nim |
20:20:01 | * | narimiran quit (Ping timeout: 268 seconds) |
20:29:39 | * | mbomba joined #nim |
20:32:27 | FromDiscord | <bark> if I wanted to have the same function body, but 2 different parameter kinds based on a const, how would I do that in nim? |
20:33:10 | leorize | either generics or templates I suppose? |
20:33:29 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2IkZ |
20:33:30 | leorize | an example of what you're trying to do would help though |
20:34:06 | * | fanta1 quit (Remote host closed the connection) |
20:34:15 | FromDiscord | <bark> sent a code paste, see https://play.nim-lang.org/#ix=2Il0 |
20:34:31 | FromDiscord | <lqdev> do what i did |
20:34:36 | FromDiscord | <bark> yeah and add placeholder type |
20:34:36 | FromDiscord | <lqdev> you can make your type `void` |
20:34:50 | FromDiscord | <bark> I don't have to pass void? |
20:34:54 | FromDiscord | <lqdev> yeah |
20:34:57 | FromDiscord | <bark> nice |
20:34:58 | FromDiscord | <bark> thanks |
20:34:58 | FromDiscord | <lqdev> it acts as if it weren't there |
20:35:10 | leorize | if it doesn't have argument then just make it an overload? |
20:35:43 | FromDiscord | <bark> I want to keep the same body |
20:36:12 | leorize | well the x parameter won't go away, right? |
20:37:06 | leorize | `proc a() = a(some predefined x?)` |
20:37:18 | leorize | but without seeing some actual code I can't advise too much |
20:40:49 | hmmm | nikki u frigging genius |
20:40:55 | hmmm | I just understood the branch part |
20:41:11 | hmmm | <3 |
20:41:59 | hmmm | it's actually very clever |
20:45:49 | * | habamax quit (Ping timeout: 264 seconds) |
20:49:04 | FromDiscord | <bloatoo> sent a long message, see http://ix.io/2Il8 |
20:53:41 | hmmm | hmm 13yo is a bit early to consider the business perspective my bro, in your shoes I would consider just having fun with python and see where it leads u :> |
20:54:03 | FromDiscord | <kenran> or having fun with nim |
20:54:03 | FromDiscord | <InventorMatt> nim is a wonderful language that is growing in popularity currently and there are jobs already that exist that require nim and it is likely that there will be more within the next decade or so when you'll get need a full time job. but outside of learning nim it will help you to learn other languages better so if you do need to learn another language it should be significantly easier |
20:54:30 | hmmm | or having fun with nim like me :3 |
20:54:32 | leorize | yea, 13yo is basically the "have fun" period |
20:54:48 | FromDiscord | <mratsim> Also what you learn with Nim is applicable to C, C++, Rust directly and also will teach you more about the low-level details which might help you deal with slowness with higher level language. |
20:54:55 | leorize | and once you got the basics down picking up other languages is really easy |
20:55:04 | leorize | most of them are pretty much the same thing |
20:55:16 | FromDiscord | <haxscramper> C++ in production is very depressing language imo, and "as a language" it also not really good |
20:55:25 | FromDiscord | <mratsim> Have fun and be sure that whatever happens, the knowledge transfers |
20:55:40 | FromDiscord | <haxscramper> Certainly not for starting language |
20:56:05 | FromDiscord | <haxscramper> Nim is a very good language to try out all different concepts - FP, OOP etc. |
20:56:51 | FromDiscord | <exelotl> C++ was my first language, and every language I've tried since, I've enjoyed more (including C) |
20:56:53 | FromDiscord | <mratsim> FP not so much, the closure iterators are a bit clunky, the function callbacks are noisy with {.gcsafe.} annotation and the inline iterators don't chain. |
20:57:18 | FromDiscord | <haxscramper> In whatever proportions you feel is interesting and then decide if particular programming paradigm suits you or not. C++/rust have very strong ideology about what should and should not be used (in C++ is it more blurred though) |
20:57:23 | FromDiscord | <mratsim> I did enjoy haskell as my first language butmaybe it's because I enjoy mindsplosion |
20:58:02 | FromDiscord | <haxscramper> Well, to me this is actually that perfect amount of FP when you still have your brains intact without worrying about recursion-as-loops |
20:59:14 | FromDiscord | <haxscramper> But can still enjoy maps/folds/options etc. Though I'm just callback-crazy, not really FP person |
20:59:45 | leorize | I found dabbling a bit into Haskell is a nice way to learn all the crazy FP stuff |
21:00:06 | leorize | you should definitely not do everything the Haskell way but pick the right tool for the job :P |
21:00:18 | FromDiscord | <haxscramper> Every time I tried to do something with haskell I got destroyed by `cabal hell` out of nowhere. Ocaml is nice |
21:00:24 | FromDiscord | <kenran> recursion-as-loops is in your blood after a short while IME, and nowadays I enjoy the abstraction mechnisms haskell gives me with higher-kinded types and the like, and I already start missing them in other languages. but I still don't know anything about low-level stuff and algorithmic performance |
21:00:40 | FromDiscord | <kenran> in haskell, that's just a totally different beast with laziness |
21:01:50 | FromDiscord | <haxscramper> Well, like ... yes ..., but I'd prefer to be able to fallback to imperative algorithms when needed. But again - majority of the FP-ness that make your daily life easier is already present in nim or can be implemented in theory |
21:01:55 | FromDiscord | <mratsim> I didn't need cabal or packages when i started, I just played around with prelude |
21:02:13 | FromDiscord | <kenran> the cabal `v2-` commands (that are now the default) make it much better nowadays. we use `nix` at work to manage the haskell deps, and while it's still a hassle sometimes, it's been a long while since I've been in cabal hell 😄 |
21:02:32 | FromDiscord | <haxscramper> Maybe I should try haskell again |
21:02:37 | FromDiscord | <kenran> yeah, I'm just not yet sure how to test my low-level code in nim 🙂 |
21:02:50 | FromDiscord | <mratsim> I don't know how to read my Haskell code anymore xD |
21:03:02 | * | nyd joined #nim |
21:03:44 | FromDiscord | <haxscramper> The one thing I really don't like is type global type inference |
21:03:52 | * | MarderIII quit (Ping timeout: 260 seconds) |
21:04:00 | FromDiscord | <kenran> right now I love learning Nim (and common lisp), since I haven't studied CS at all but now work with FP. I studied maths, so FP came more naturally I guess, and even though Nim is not C++, it's still a challenge to learn the concepts 🙂 |
21:04:08 | FromDiscord | <haxscramper> and people omitting type annotations |
21:04:35 | FromDiscord | <mratsim> One thing that is fun with Haskell is code obfuscation.↵Watch unobfuscated: https://github.com/mratsim/haskell-numbertheory/blob/master/expmod_2.hs#L6-L12↵obfuscated: https://github.com/mratsim/haskell-numbertheory/blob/master/expmod_1.hs#L7-L11 |
21:04:40 | FromDiscord | <kenran> that put me off OCaml first. in production haskell at least it's standard now to use them thankfully |
21:04:42 | FromDiscord | <haxscramper> Because we are now basically in python-level of code readability now |
21:05:37 | FromDiscord | <kenran> haha, great stuff 😄 |
21:06:09 | FromDiscord | <kenran> a colleague of mine writes all his code this way (point-free style and no let-bindings) and there it gets kind of annoying quickly |
21:06:35 | FromDiscord | <Zeus> after working on a lot of clojure, it feels more natural to read the second one rather than the first |
21:07:04 | FromDiscord | <haxscramper> I wanted to write lisp -> nim ast transpiler once |
21:07:08 | leorize | @kenran we can abstract away low-level computer stuff but in the end they are still important for achieving good performance |
21:07:57 | FromDiscord | <mratsim> Yeah, I did a lot of prime sieves optimization in Haskell, but a simple bitset in Nim brought me 2x speed when I tried Nim the first time |
21:09:20 | FromDiscord | <kenran> we had a space leak at some point that cost us weeks to debug in Haskell. you'd send 10 MB of json, then throw a heavy data pipeline algorithm at it, and it would blow up the memory to 1.6 GB. in the end, it was the json parsing paired with laziness instead of the algorithm itself. but it was just so hard to find |
21:09:48 | FromDiscord | <kenran> (edit) "pipeline" => "transformation" |
21:10:03 | FromDiscord | <bloatoo> sent a long message, see http://ix.io/2Ili |
21:11:22 | leorize | you can't predict the future in computer science |
21:11:25 | FromDiscord | <shadow.> as someone around the same age (14), id say try learning nim |
21:11:35 | FromDiscord | <shadow.> it really didn't take me very long to get it down well (around a month) and i love using it |
21:11:41 | FromDiscord | <shadow.> great for low level and high level programming |
21:12:09 | FromDiscord | <shadow.> it really has no downfalls in my opinion, and it's a great tool to have in the future |
21:12:34 | FromDiscord | <mratsim> > it really has no downfalls in my opinion↵You're in nim channel so you'll get rose colored views 😉 |
21:12:40 | FromDiscord | <shadow.> that is quite true |
21:12:51 | FromDiscord | <shadow.> i mean if you want the otherside you could go to the rst server but i don't recommend it |
21:12:52 | FromDiscord | <shadow.> lmfao |
21:12:55 | FromDiscord | <Quibono> No goroutines. |
21:12:57 | FromDiscord | <shadow.> (edit) "otherside" => "other side" |
21:12:59 | FromDiscord | <Quibono> That’s the biggest issue |
21:13:01 | FromDiscord | <mratsim> the real issue with Nim is the library ecosystem, so if you want to achieve something you might have no support and have to do it all yourself. |
21:13:07 | FromDiscord | <shadow.> yeah that's true |
21:13:07 | FromDiscord | <Quibono> That too |
21:13:11 | FromDiscord | <shadow.> depends what kinda stuff you do |
21:13:14 | FromDiscord | <haxscramper> Well, if we take pure potential then I'd say nim absolutely destroys everything else. The ecosystem might not seem that big, but sheer flexibility of the language makes it usable for anything |
21:13:29 | FromDiscord | <shadow.> i do mostly algorithms for stuff like codewars, leetcode, etc and the stl handles that stuff very well |
21:13:31 | FromDiscord | <mratsim> sometimes it may feel like you're the only one dealing with some problems. |
21:13:42 | FromDiscord | <shadow.> but for some other stuff the eco is probably lacking, yes |
21:13:44 | FromDiscord | <haxscramper> And byt anything I mean really anything modulo some things that I've never touched |
21:13:49 | FromDiscord | <shadow.> true |
21:14:04 | FromDiscord | <mratsim> but it's also a chance to solve something were people will not ask "why don't you contribute your code yo library x y z" |
21:14:06 | FromDiscord | <shadow.> also if you haven't tried metaprogramming before, nim is really good for getting you in that mindset |
21:14:20 | FromDiscord | <bloatoo> why isn't nim used widely? i could assume it's probably that it's a really new, immature language |
21:14:33 | leorize | fun fact: nim is older than go and rust |
21:14:36 | FromDiscord | <mratsim> new, and not backed by a known big corporation. |
21:14:39 | FromDiscord | <Quibono> It’s really new and people are creatures of habit. |
21:14:49 | FromDiscord | <haxscramper> And nim is probably the only language that can take EEE approach on C++ |
21:14:55 | FromDiscord | <mratsim> People use and learn by imitation 😉 |
21:14:56 | FromDiscord | <haxscramper> Instead of trying to replace it with everyhting |
21:14:59 | FromDiscord | <Quibono> Yeah like I feel like the only person currently working on financial stuff in Nim |
21:15:24 | FromDiscord | <mratsim> not quite, there is qqdev who is a HK trader that has nim libraries |
21:15:28 | FromDiscord | <kenran> it's probably just not on many radars (due to the things mentioned above) |
21:15:29 | FromDiscord | <bloatoo> it really has potential to become my scripting language of choice |
21:15:35 | FromDiscord | <mratsim> and one of the Nim core contributor is an energy trader. |
21:15:36 | FromDiscord | <bloatoo> (edit) "it" => "nim" |
21:15:54 | FromDiscord | <bloatoo> and then i could use rust for in specific lower level development |
21:15:59 | FromDiscord | <haxscramper> Well, at least I'm really hoping that whatewher I'm currently doing will lead to this eventually |
21:16:09 | FromDiscord | <mratsim> I would love to build more financial stuff in Nim but I have my hands full with cryptography, multithreading and machine learning already. |
21:16:13 | FromDiscord | <Quibono> Bloatoo why use rust for something Nim can do better? |
21:16:31 | FromDiscord | <shadow.> if you need inspiration for how easy and elegant nim is then take a look at any aoc repo. it's almost always most concise in nim or python |
21:16:35 | FromDiscord | <shadow.> and i'll let you guess which one is faster 😉 |
21:16:43 | FromDiscord | <shadow.> lol |
21:17:20 | FromDiscord | <shadow.> and honestly yeah i agree with the scripting thing. it's pretty hard to think of another language that is so versatile it can be used for systems programming and scripting both just as easily |
21:17:42 | leorize | nim ecosystem is horrible for making use of operating system services atm (ie. subprocess, piping, etc.) due to the lack of high-level abstractions for those |
21:17:48 | FromDiscord | <kenran> probably common lisp can as well, given enough experience. it's just even more obscure 😄 |
21:17:59 | FromDiscord | <inv> Looks like I missed Rust-discussion 😦 |
21:18:02 | leorize | I'm planning to solve that one but I lost all of my work recently... |
21:18:20 | FromDiscord | <shadow.> ah damn that sucks |
21:18:39 | FromDiscord | <kenran> leorize coming from Haskell, I am really missing some high-level abstractions, yes. sorry you lost your stuff |
21:19:07 | FromDiscord | <mratsim> for system, it would be nice if --gc:arc DLLs don't need that "NimMain()" call at start. |
21:19:10 | FromDiscord | <bloatoo> i look at a language from a wider view. i think nim as a language outdoes rust in most ways, but there's that small bit of businessman in me that always asks me "what is this language? why have i not heard of it before?" rust doesn't seem to be used that widely in companies either but it's another language that truly has potential of being used. |
21:19:30 | FromDiscord | <shadow.> well |
21:19:35 | FromDiscord | <shadow.> you're 13, you have time to learn both |
21:19:38 | FromDiscord | <mratsim> @kenran, if you want Monads and friends use concepts: https://github.com/unicredit/emmy#algebraic-structures |
21:19:49 | FromDiscord | <shadow.> it's not going to ruin your life to try nim for a month or so to see if you like it |
21:20:10 | leorize | @mratsim they don't, but we still have to put initializers (of other modules) somewhere. maybe write an rfc for renaming `NimMain()`? |
21:20:13 | FromDiscord | <mratsim> and you can even have dependent types |
21:20:20 | FromDiscord | <shadow.> is there a way to do `lines(string)` with js backend (node)? i'm getting `fopen` not defined (for obvious reasons lmao) |
21:20:28 | leorize | an option to rename NimMain()* |
21:20:33 | FromDiscord | <kenran> whaaaaaaaat |
21:20:58 | FromDiscord | <bloatoo> true that. perhaps i'll give nim a try at first, see if i like it, and if so, go further at learning it. after i've become fluent at it i'd start learning rust. |
21:21:02 | FromDiscord | <inv> Ah, answer is easy for me because I have a big project on rust for ~2 years. It is better to know both. Rust provides good conception, if you do not care about time and care too much about gc - use rust, else - use Nim |
21:21:13 | FromDiscord | <bloatoo> i'll do that. thanks for your input guys. |
21:21:20 | FromDiscord | <shadow.> course |
21:21:46 | FromDiscord | <mratsim> use AOC for learning, that should give you a good view of Nim |
21:21:51 | FromDiscord | <mratsim> and plenty of help in the forum |
21:21:55 | FromDiscord | <inv> Probably I can add: what I did in rust for ~1year, I rewrote in Nim for ~2-3 weeks |
21:22:09 | FromDiscord | <inv> (edit) "what" => "that" |
21:22:18 | FromDiscord | <inv> (edit) "~1year," => "~1year period," |
21:22:47 | FromDiscord | <inv> (edit) "weeks" => "weeks. Funny fact - some parts are even faster in Nim" |
21:22:55 | FromDiscord | <inv> (edit) "Funny" => "Fun" |
21:22:58 | FromDiscord | <shadow.> yup, aoc is very fun lol |
21:23:14 | FromDiscord | <shadow.> i didnt know about scanf or npeg before, so i've at least learned a good bit abt parsing |
21:23:33 | FromDiscord | <kenran> why does that link to `concepts` not lead anywhere in the manual? I didn't learn much of Nim's language features yet, but I cannot find that in the manual |
21:23:44 | leorize | it's in the experimental module |
21:23:48 | leorize | manual* |
21:23:54 | leorize | an is pending a rewrite |
21:23:57 | leorize | and* |
21:24:33 | FromDiscord | <kenran> but is it "bound to stay"? |
21:24:50 | FromDiscord | <kenran> that bumps up my willingness to learn more in Nim by a whole lot 😄 |
21:25:23 | leorize | yes, concepts will eventually evolve into stable |
21:25:44 | leorize | just that the main dev @zah is no longer active in the compiler |
21:25:50 | FromDiscord | <inv> (edit) Probably I can add: that I did in rust for ~1year period, I rewrote on Nim in ~2-3 weeks. Fun fact - some parts are even faster in Nim |
21:25:54 | leorize | so 4raq now has to work on it |
21:26:02 | leorize | and he's busy with other stuff |
21:27:40 | FromDiscord | <shadow.> can you do io with the js backend in node mode? (sry haven't used it before) |
21:27:43 | FromDiscord | <shadow.> file io |
21:28:33 | leorize | nope, we don't officially support node as a target |
21:28:41 | FromDiscord | <shadow.> damn |
21:28:46 | FromDiscord | <shadow.> is there any way to read from local files? |
21:28:52 | leorize | import jsffi |
21:28:55 | leorize | it has `requires()` |
21:28:59 | leorize | then you can use node stuff |
21:29:03 | FromDiscord | <shadow.> ohh bet |
21:29:50 | FromDiscord | <shadow.> hmm |
21:30:07 | FromDiscord | <shadow.> so i'd need a way to read file using node functions with ffi and get that as a string in my nim code? |
21:30:36 | FromDiscord | <mratsim> @kenran, as an example of dependent types, I parametrize elliptic curves by an enum name, and I also parse and compute their value at compile-time: https://github.com/mratsim/constantine/blob/master/constantine/config/curves_declaration.nim#L45-L68 |
21:31:17 | FromDiscord | <mratsim> https://github.com/mratsim/constantine/blob/master/constantine/elliptic/ec_shortweierstrass_affine.nim#L23-L33 |
21:31:19 | leorize | shadow.: `let fs = requires("fs"); let content = fs.readFileSync().to(cstring)` |
21:31:26 | leorize | native js string is mapped to cstring |
21:31:54 | FromDiscord | <shadow.> oh thanks |
21:32:31 | FromDiscord | <mratsim> I actually think there is no language that come close to Nim to work on big integer, finite fields, elliptic curve and cryptography |
21:33:07 | FromDiscord | <mratsim> as a bonus you can also use unicode variable name to annoy the hell out of potential contributors: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/tower_instantiation.nim#L27-L32 |
21:34:21 | * | leorize quit (Remote host closed the connection) |
21:34:35 | FromDiscord | <shadow.> `TypeError: c_1475079.charCodeAt is not a function` |
21:34:36 | FromDiscord | <shadow.> rip |
21:35:02 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Ilr |
21:35:07 | * | leorize joined #nim |
21:35:10 | FromDiscord | <kenran> seeing this, I can believe it! |
21:35:20 | FromDiscord | <kenran> this looks awesome, though I understand very little |
21:36:02 | FromDiscord | <shadow.> nvm got it to work |
21:37:44 | FromDiscord | <mratsim> Basically I'm implementing complex number but for big ints. |
21:37:50 | FromDiscord | <mratsim> so a + ib |
21:38:11 | FromDiscord | <mratsim> and modulo a prime. |
21:38:33 | FromDiscord | <mratsim> between 254 bits and the recent I added was 761 |
21:39:06 | FromDiscord | <mratsim> sometimes i is not sqrt(-1), but sqrt(-2) or sqrt(-5), so genericity helps as well i can't specialize too much. |
21:39:40 | FromDiscord | <mratsim> So Nim helps me translate high-level might concepts. But also special-case some things for efficiency |
21:40:29 | FromDiscord | <kenran> yeah, you could probably do the first part in the high-abstraction languages like idris or haskell (with types), but the second part would be hard to impossible |
21:40:38 | FromDiscord | <mratsim> and when I need raw performance I can drop down to assembly: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/assembly/limbs_asm_x86.nim#L140-L149↵That will be compiled in the same step and type checked. |
21:41:23 | * | leorize quit (Ping timeout: 240 seconds) |
21:42:05 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Ilv |
21:42:13 | FromDiscord | <shadow.> what part would be problematic? |
21:43:01 | FromDiscord | <mratsim> and you can have corecursive concepts: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/tower_common.nim#L26-L39↵↵complex is an quadratic (degree 2) extension of real numbers. In modular arithmetic you can build degree 3 extensions a + jb + j²c (cubic) and you can stack them doing quadratic of cubic of quadratic. Which is used in cryptography. |
21:43:29 | FromDiscord | <mratsim> In C, C++, Rust and Go the other libraries need to write the code for each |
21:43:50 | FromDiscord | <mratsim> but some proposition needs to stack 10 times. |
21:44:04 | FromDiscord | <mratsim> In Nim everything is autogenerated from the concept implementation. |
21:57:03 | * | leorize joined #nim |
22:02:08 | * | hmmm quit () |
22:07:00 | * | haxscramper quit (Remote host closed the connection) |
22:12:38 | FromDiscord | <Recruit_main707> why arent strings just `seq[char]`? that would make things easier wouldnt it? |
22:14:37 | leorize | strings has a nul at the end for c interfacing, and a "statically allocated" state which differs them from seq[char] atm |
22:15:34 | * | mbomba quit (Quit: WeeChat 3.0) |
22:19:08 | * | kenran quit (Quit: leaving) |
22:19:26 | FromDiscord | <Recruit_main707> ok, interesting |
22:19:35 | FromDiscord | <shadow.> can i not use `algorithm` sort with js backend? |
22:19:49 | FromDiscord | <shadow.> > throw new Error(cbuf_1440201);↵> Error: Error: unhandled exception: key not found: g [KeyError] |
22:19:59 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IlN |
22:20:58 | FromDiscord | <shadow.> nvm i figured out the issue |
22:59:52 | * | tane quit (Quit: Leaving) |
23:00:44 | * | vsantana joined #nim |
23:10:02 | Zoom[m] | How can I convert a set of 1 into a value? |
23:10:22 | FromDiscord | <Quibono> So we have data frames yet? |
23:10:25 | FromDiscord | <Quibono> do |
23:11:34 | disruptek | sure. |
23:13:20 | FromDiscord | <Avatarfighter> @mratsim your snippet where you have assembly is really cool |
23:13:48 | FromDiscord | <Quibono> Lol sure is very helpful. |
23:14:47 | FromDiscord | <Avatarfighter> @Quibono thats disruptek for ya |
23:14:50 | FromDiscord | <Avatarfighter> :disruptek: |
23:14:54 | FromDiscord | <Quibono> Lol |
23:15:45 | mipri | Zoom[m]: for x in it: return x |
23:16:14 | FromDiscord | <InventorMatt> ggplotnim has dataframes as well as nimdata and probably others as well |
23:18:34 | FromDiscord | <Quibono> Cool |
23:22:20 | Zoom[m] | Huh, thanks mipri. Makes sense that it works. |
23:23:01 | FromGitter | <deech> Mistakenly naming some module in your library the same as a stdlib one is a fun bug hunt |
23:24:33 | mipri | with new modules that can't be imported without a std/ prefix, like std/enumerate, there's some nudging away from that |
23:32:28 | disruptek | lazy questions beget lazy answers. |
23:33:40 | * | casaca quit (Remote host closed the connection) |
23:34:54 | * | nyd quit (Ping timeout: 256 seconds) |
23:57:25 | * | casaca joined #nim |